Rename memory instructions; Rework constant handling

This commit is contained in:
dcodeIO
2018-07-18 23:49:32 +02:00
parent 34e8facfdc
commit a1b75b69b7
170 changed files with 26392 additions and 5185 deletions

View File

@ -1,5 +1,6 @@
(module
(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))
@ -22,7 +23,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)
@ -35,7 +44,7 @@
(if
(i32.gt_u
(get_local $0)
(i32.const 1073741824)
(get_global $~lib/internal/allocator/MAX_SIZE_32)
)
(unreachable)
)
@ -49,16 +58,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
@ -103,14 +112,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)
@ -130,7 +139,14 @@
)
(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)
(return
(call $~lib/allocator/arena/__memory_allocate
(get_local $0)
)
)
)
(func $std/constructor/EmptyCtor#constructor (; 4 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(tee_local $0
(if (result i32)
@ -139,7 +155,7 @@
(tee_local $0
(block (result i32)
(set_local $1
(call $~lib/allocator/arena/allocate_memory
(call $~lib/memory/memory.allocate
(i32.const 0)
)
)
@ -149,7 +165,7 @@
)
)
)
(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)
(local $1 i32)
(tee_local $0
(if (result i32)
@ -158,7 +174,7 @@
(tee_local $0
(block (result i32)
(set_local $1
(call $~lib/allocator/arena/allocate_memory
(call $~lib/memory/memory.allocate
(i32.const 4)
)
)
@ -172,7 +188,7 @@
)
)
)
(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)
(local $1 i32)
(tee_local $0
(if (result i32)
@ -181,7 +197,7 @@
(tee_local $0
(block (result i32)
(set_local $1
(call $~lib/allocator/arena/allocate_memory
(call $~lib/memory/memory.allocate
(i32.const 4)
)
)
@ -195,17 +211,17 @@
)
)
)
(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)
(local $1 i32)
(if
(get_global $std/constructor/b)
(return
(call $~lib/allocator/arena/allocate_memory
(call $~lib/memory/memory.allocate
(i32.const 0)
)
)
@ -217,7 +233,7 @@
(tee_local $0
(block (result i32)
(set_local $1
(call $~lib/allocator/arena/allocate_memory
(call $~lib/memory/memory.allocate
(i32.const 0)
)
)
@ -227,7 +243,7 @@
)
)
)
(func $std/constructor/CtorAllocates#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32)
(func $std/constructor/CtorAllocates#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(drop
(tee_local $0
@ -237,7 +253,7 @@
(tee_local $0
(block (result i32)
(set_local $1
(call $~lib/allocator/arena/allocate_memory
(call $~lib/memory/memory.allocate
(i32.const 0)
)
)
@ -249,7 +265,7 @@
)
(get_local $0)
)
(func $std/constructor/CtorConditionallyAllocates#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32)
(func $std/constructor/CtorConditionallyAllocates#constructor (; 10 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(if
(get_global $std/constructor/b)
@ -261,7 +277,7 @@
(tee_local $0
(block (result i32)
(set_local $1
(call $~lib/allocator/arena/allocate_memory
(call $~lib/memory/memory.allocate
(i32.const 0)
)
)
@ -279,7 +295,7 @@
(tee_local $0
(block (result i32)
(set_local $1
(call $~lib/allocator/arena/allocate_memory
(call $~lib/memory/memory.allocate
(i32.const 0)
)
)
@ -289,16 +305,16 @@
)
)
)
(func $start (; 8 ;) (type $v)
(func $start (; 11 ;) (type $v)
(local $0 i32)
(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)
)
)
@ -324,7 +340,7 @@
(set_global $std/constructor/none
(block (result i32)
(set_local $0
(call $~lib/allocator/arena/allocate_memory
(call $~lib/memory/memory.allocate
(i32.const 0)
)
)
@ -334,7 +350,7 @@
(set_global $std/constructor/justFieldInit
(block (result i32)
(set_local $0
(call $~lib/allocator/arena/allocate_memory
(call $~lib/memory/memory.allocate
(i32.const 4)
)
)
@ -348,7 +364,7 @@
(set_global $std/constructor/justFieldNoInit
(block (result i32)
(set_local $0
(call $~lib/allocator/arena/allocate_memory
(call $~lib/memory/memory.allocate
(i32.const 4)
)
)