mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-07-02 16:11:49 +00:00
Rename memory instructions; Rework constant handling
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
(module
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $i (func (result i32)))
|
||||
(type $iiiiv (func (param i32 i32 i32 i32)))
|
||||
(type $iiiv (func (param i32 i32 i32)))
|
||||
(type $iiii (func (param i32 i32 i32) (result i32)))
|
||||
@ -21,7 +22,15 @@
|
||||
(data (i32.const 8) "\16\00\00\00s\00t\00d\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00_\00a\00r\00e\00n\00a\00.\00t\00s\00")
|
||||
(export "memory" (memory $0))
|
||||
(start $start)
|
||||
(func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $~lib/memory/memory.size (; 1 ;) (type $i) (result i32)
|
||||
(current_memory)
|
||||
)
|
||||
(func $~lib/memory/memory.grow (; 2 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(grow_memory
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
@ -34,7 +43,7 @@
|
||||
(if
|
||||
(i32.gt_u
|
||||
(get_local $0)
|
||||
(i32.const 1073741824)
|
||||
(get_global $~lib/internal/allocator/MAX_SIZE_32)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
@ -48,16 +57,16 @@
|
||||
(get_local $1)
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 7)
|
||||
(get_global $~lib/internal/allocator/AL_MASK)
|
||||
)
|
||||
(i32.xor
|
||||
(i32.const 7)
|
||||
(get_global $~lib/internal/allocator/AL_MASK)
|
||||
(i32.const -1)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $3
|
||||
(current_memory)
|
||||
(call $~lib/memory/memory.size)
|
||||
)
|
||||
(if
|
||||
(i32.gt_u
|
||||
@ -102,14 +111,14 @@
|
||||
)
|
||||
(if
|
||||
(i32.lt_s
|
||||
(grow_memory
|
||||
(call $~lib/memory/memory.grow
|
||||
(get_local $5)
|
||||
)
|
||||
(i32.const 0)
|
||||
)
|
||||
(if
|
||||
(i32.lt_s
|
||||
(grow_memory
|
||||
(call $~lib/memory/memory.grow
|
||||
(get_local $4)
|
||||
)
|
||||
(i32.const 0)
|
||||
@ -129,7 +138,14 @@
|
||||
)
|
||||
(i32.const 0)
|
||||
)
|
||||
(func $~lib/memory/set_memory (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(return
|
||||
(call $~lib/allocator/arena/__memory_allocate
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/memory/memset (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i64)
|
||||
@ -481,7 +497,14 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/memory/copy_memory (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $~lib/memory/memory.fill (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(call $~lib/memory/memset
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
(func $~lib/memory/memcpy (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(local $4 i32)
|
||||
(local $5 i32)
|
||||
@ -2283,7 +2306,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/memory/move_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(func $~lib/memory/memmove (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(local $3 i32)
|
||||
(if
|
||||
(i32.eq
|
||||
@ -2313,7 +2336,7 @@
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/memory/copy_memory
|
||||
(call $~lib/memory/memcpy
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
@ -2601,7 +2624,15 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $~lib/memory/compare_memory (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
||||
(func $~lib/memory/memory.copy (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32)
|
||||
(call $~lib/memory/memmove
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
(func $~lib/memory/memcmp (; 10 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
||||
(local $3 i32)
|
||||
(if
|
||||
(i32.eq
|
||||
(get_local $0)
|
||||
@ -2615,7 +2646,12 @@
|
||||
(loop $continue|0
|
||||
(if
|
||||
(if (result i32)
|
||||
(get_local $2)
|
||||
(tee_local $3
|
||||
(i32.ne
|
||||
(get_local $2)
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(i32.eq
|
||||
(i32.load8_u
|
||||
(get_local $0)
|
||||
@ -2624,7 +2660,7 @@
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
@ -2665,23 +2701,40 @@
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $~lib/allocator/arena/free_memory (; 6 ;) (type $iv) (param $0 i32)
|
||||
(func $~lib/memory/memory.compare (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
|
||||
(call $~lib/memory/memcmp
|
||||
(get_local $0)
|
||||
(get_local $1)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
(func $~lib/allocator/arena/__memory_free (; 12 ;) (type $iv) (param $0 i32)
|
||||
(nop)
|
||||
)
|
||||
(func $~lib/allocator/arena/reset_memory (; 7 ;) (type $v)
|
||||
(func $~lib/memory/memory.free (; 13 ;) (type $iv) (param $0 i32)
|
||||
(call $~lib/allocator/arena/__memory_free
|
||||
(get_local $0)
|
||||
)
|
||||
(return)
|
||||
)
|
||||
(func $~lib/allocator/arena/__memory_reset (; 14 ;) (type $v)
|
||||
(set_global $~lib/allocator/arena/offset
|
||||
(get_global $~lib/allocator/arena/startOffset)
|
||||
)
|
||||
)
|
||||
(func $start (; 8 ;) (type $v)
|
||||
(func $~lib/memory/memory.reset (; 15 ;) (type $v)
|
||||
(call $~lib/allocator/arena/__memory_reset)
|
||||
(return)
|
||||
)
|
||||
(func $start (; 16 ;) (type $v)
|
||||
(set_global $~lib/allocator/arena/startOffset
|
||||
(i32.and
|
||||
(i32.add
|
||||
(get_global $HEAP_BASE)
|
||||
(i32.const 7)
|
||||
(get_global $~lib/internal/allocator/AL_MASK)
|
||||
)
|
||||
(i32.xor
|
||||
(i32.const 7)
|
||||
(get_global $~lib/internal/allocator/AL_MASK)
|
||||
(i32.const -1)
|
||||
)
|
||||
)
|
||||
@ -2690,13 +2743,13 @@
|
||||
(get_global $~lib/allocator/arena/startOffset)
|
||||
)
|
||||
(set_global $std/allocator_arena/ptr1
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(i32.const 42)
|
||||
(call $~lib/memory/memory.allocate
|
||||
(get_global $std/allocator_arena/size)
|
||||
)
|
||||
)
|
||||
(set_global $std/allocator_arena/ptr2
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(i32.const 42)
|
||||
(call $~lib/memory/memory.allocate
|
||||
(get_global $std/allocator_arena/size)
|
||||
)
|
||||
)
|
||||
(if
|
||||
@ -2716,10 +2769,10 @@
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(call $~lib/memory/set_memory
|
||||
(call $~lib/memory/memory.fill
|
||||
(get_global $std/allocator_arena/ptr1)
|
||||
(i32.const 18)
|
||||
(i32.const 42)
|
||||
(get_global $std/allocator_arena/size)
|
||||
)
|
||||
(block $break|0
|
||||
(set_global $std/allocator_arena/i
|
||||
@ -2730,7 +2783,7 @@
|
||||
(i32.eqz
|
||||
(i32.lt_u
|
||||
(get_global $std/allocator_arena/i)
|
||||
(i32.const 42)
|
||||
(get_global $std/allocator_arena/size)
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -2750,8 +2803,8 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 13)
|
||||
(i32.const 2)
|
||||
(i32.const 12)
|
||||
(i32.const 27)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
@ -2765,10 +2818,10 @@
|
||||
(br $repeat|0)
|
||||
)
|
||||
)
|
||||
(call $~lib/memory/move_memory
|
||||
(call $~lib/memory/memory.copy
|
||||
(get_global $std/allocator_arena/ptr2)
|
||||
(get_global $std/allocator_arena/ptr1)
|
||||
(i32.const 42)
|
||||
(get_global $std/allocator_arena/size)
|
||||
)
|
||||
(block $break|1
|
||||
(set_global $std/allocator_arena/i
|
||||
@ -2779,7 +2832,7 @@
|
||||
(i32.eqz
|
||||
(i32.lt_u
|
||||
(get_global $std/allocator_arena/i)
|
||||
(i32.const 42)
|
||||
(get_global $std/allocator_arena/size)
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -2799,8 +2852,8 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 18)
|
||||
(i32.const 2)
|
||||
(i32.const 16)
|
||||
(i32.const 27)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
@ -2817,10 +2870,10 @@
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(call $~lib/memory/compare_memory
|
||||
(call $~lib/memory/memory.compare
|
||||
(get_global $std/allocator_arena/ptr1)
|
||||
(get_global $std/allocator_arena/ptr2)
|
||||
(i32.const 42)
|
||||
(get_global $std/allocator_arena/size)
|
||||
)
|
||||
(i32.const 0)
|
||||
)
|
||||
@ -2829,22 +2882,22 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 20)
|
||||
(i32.const 18)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
(call $~lib/allocator/arena/free_memory
|
||||
(call $~lib/memory/memory.free
|
||||
(get_global $std/allocator_arena/ptr1)
|
||||
)
|
||||
(call $~lib/allocator/arena/free_memory
|
||||
(call $~lib/memory/memory.free
|
||||
(get_global $std/allocator_arena/ptr2)
|
||||
)
|
||||
(call $~lib/allocator/arena/reset_memory)
|
||||
(call $~lib/memory/memory.reset)
|
||||
(set_global $std/allocator_arena/ptr1
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(i32.const 42)
|
||||
(call $~lib/memory/memory.allocate
|
||||
(get_global $std/allocator_arena/size)
|
||||
)
|
||||
)
|
||||
(if
|
||||
@ -2867,7 +2920,7 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 8)
|
||||
(i32.const 27)
|
||||
(i32.const 25)
|
||||
(i32.const 0)
|
||||
)
|
||||
(unreachable)
|
||||
|
Reference in New Issue
Block a user