mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-26 05:01:52 +00:00
Rename memory instructions; Rework constant handling
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
(module
|
||||
(type $ifi (func (param i32 f32) (result i32)))
|
||||
(type $ii (func (param i32) (result i32)))
|
||||
(type $i (func (result i32)))
|
||||
(type $v (func))
|
||||
(global $~lib/internal/allocator/AL_BITS i32 (i32.const 3))
|
||||
(global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8))
|
||||
@ -13,7 +14,15 @@
|
||||
(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)
|
||||
@ -26,7 +35,7 @@
|
||||
(if
|
||||
(i32.gt_u
|
||||
(get_local $0)
|
||||
(i32.const 1073741824)
|
||||
(get_global $~lib/internal/allocator/MAX_SIZE_32)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
@ -40,16 +49,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
|
||||
@ -94,14 +103,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)
|
||||
@ -121,7 +130,14 @@
|
||||
)
|
||||
(i32.const 0)
|
||||
)
|
||||
(func $std/new/AClass#constructor (; 1 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32)
|
||||
(func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32)
|
||||
(return
|
||||
(call $~lib/allocator/arena/__memory_allocate
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $std/new/AClass#constructor (; 4 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32)
|
||||
(local $2 i32)
|
||||
(i32.store
|
||||
(get_local $0)
|
||||
@ -134,7 +150,7 @@
|
||||
(tee_local $0
|
||||
(block (result i32)
|
||||
(set_local $2
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(call $~lib/memory/memory.allocate
|
||||
(i32.const 8)
|
||||
)
|
||||
)
|
||||
@ -161,15 +177,15 @@
|
||||
)
|
||||
(get_local $0)
|
||||
)
|
||||
(func $start (; 2 ;) (type $v)
|
||||
(func $start (; 5 ;) (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)
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user