mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-16 00:11:28 +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 $v (func))
|
||||
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
|
||||
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
|
||||
@ -14,11 +15,18 @@
|
||||
(global $std/constructor/ctorConditionallyReturns (mut i32) (i32.const 0))
|
||||
(global $std/constructor/ctorAllocates (mut i32) (i32.const 0))
|
||||
(global $std/constructor/ctorConditionallyAllocates (mut i32) (i32.const 0))
|
||||
(global $HEAP_BASE i32 (i32.const 8))
|
||||
(memory $0 0)
|
||||
(export "memory" (memory $0))
|
||||
(start $start)
|
||||
(func $~lib/allocator/arena/allocate_memory (; 0 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $~lib/memory/memory.size (; 0 ;) (type $i) (result i32)
|
||||
(current_memory)
|
||||
)
|
||||
(func $~lib/memory/memory.grow (; 1 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(grow_memory
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(local $3 i32)
|
||||
@ -50,14 +58,14 @@
|
||||
)
|
||||
(i32.shl
|
||||
(tee_local $2
|
||||
(current_memory)
|
||||
(call $~lib/memory/memory.size)
|
||||
)
|
||||
(i32.const 16)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.lt_s
|
||||
(grow_memory
|
||||
(call $~lib/memory/memory.grow
|
||||
(select
|
||||
(get_local $2)
|
||||
(tee_local $3
|
||||
@ -85,7 +93,7 @@
|
||||
)
|
||||
(if
|
||||
(i32.lt_s
|
||||
(grow_memory
|
||||
(call $~lib/memory/memory.grow
|
||||
(get_local $3)
|
||||
)
|
||||
(i32.const 0)
|
||||
@ -104,23 +112,28 @@
|
||||
)
|
||||
(i32.const 0)
|
||||
)
|
||||
(func $std/constructor/EmptyCtor#constructor (; 1 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(call $~lib/allocator/arena/__memory_allocate
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
(func $std/constructor/EmptyCtor#constructor (; 4 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(if (result i32)
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(call $~lib/memory/memory.allocate
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std/constructor/EmptyCtorWithFieldInit#constructor (; 2 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $std/constructor/EmptyCtorWithFieldInit#constructor (; 5 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(if
|
||||
(i32.eqz
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.store
|
||||
(tee_local $0
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(call $~lib/memory/memory.allocate
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
@ -129,14 +142,14 @@
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
(func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 3 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(if
|
||||
(i32.eqz
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.store
|
||||
(tee_local $0
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(call $~lib/memory/memory.allocate
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
@ -145,16 +158,16 @@
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
(func $std/constructor/CtorReturns#constructor (; 4 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(func $std/constructor/CtorReturns#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(call $~lib/memory/memory.allocate
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(func $std/constructor/CtorConditionallyReturns#constructor (; 5 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $std/constructor/CtorConditionallyReturns#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(if
|
||||
(get_global $std/constructor/b)
|
||||
(return
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(call $~lib/memory/memory.allocate
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
@ -162,12 +175,12 @@
|
||||
(if (result i32)
|
||||
(get_local $0)
|
||||
(get_local $0)
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(call $~lib/memory/memory.allocate
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std/constructor/CtorConditionallyAllocates#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(func $std/constructor/CtorConditionallyAllocates#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(if
|
||||
(get_global $std/constructor/b)
|
||||
(if
|
||||
@ -175,7 +188,7 @@
|
||||
(get_local $0)
|
||||
)
|
||||
(set_local $0
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(call $~lib/memory/memory.allocate
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
@ -186,23 +199,17 @@
|
||||
(get_local $0)
|
||||
)
|
||||
(set_local $0
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(call $~lib/memory/memory.allocate
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
(func $start (; 7 ;) (type $v)
|
||||
(func $start (; 10 ;) (type $v)
|
||||
(local $0 i32)
|
||||
(set_global $~lib/allocator/arena/startOffset
|
||||
(i32.and
|
||||
(i32.add
|
||||
(get_global $HEAP_BASE)
|
||||
(i32.const 7)
|
||||
)
|
||||
(i32.const -8)
|
||||
)
|
||||
(i32.const 8)
|
||||
)
|
||||
(set_global $~lib/allocator/arena/offset
|
||||
(get_global $~lib/allocator/arena/startOffset)
|
||||
@ -223,13 +230,13 @@
|
||||
)
|
||||
)
|
||||
(set_global $std/constructor/none
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(call $~lib/memory/memory.allocate
|
||||
(i32.const 0)
|
||||
)
|
||||
)
|
||||
(i32.store
|
||||
(tee_local $0
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(call $~lib/memory/memory.allocate
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
@ -240,7 +247,7 @@
|
||||
)
|
||||
(i32.store
|
||||
(tee_local $0
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(call $~lib/memory/memory.allocate
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user