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,6 +1,7 @@
(module
(type $ii (func (param i32) (result i32)))
(type $iiiiv (func (param i32 i32 i32 i32)))
(type $i (func (result i32)))
(type $iv (func (param i32)))
(type $v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
@ -177,7 +178,15 @@
)
(get_local $1)
)
(func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32)
(func $~lib/memory/memory.size (; 2 ;) (type $i) (result i32)
(current_memory)
)
(func $~lib/memory/memory.grow (; 3 ;) (type $ii) (param $0 i32) (result i32)
(grow_memory
(get_local $0)
)
)
(func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
@ -190,7 +199,7 @@
(if
(i32.gt_u
(get_local $0)
(i32.const 1073741824)
(get_global $~lib/internal/allocator/MAX_SIZE_32)
)
(unreachable)
)
@ -204,16 +213,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
@ -258,14 +267,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)
@ -285,7 +294,14 @@
)
(i32.const 0)
)
(func $~lib/string/String#toUTF8 (; 3 ;) (type $ii) (param $0 i32) (result i32)
(func $~lib/memory/memory.allocate (; 5 ;) (type $ii) (param $0 i32) (result i32)
(return
(call $~lib/allocator/arena/__memory_allocate
(get_local $0)
)
)
)
(func $~lib/string/String#toUTF8 (; 6 ;) (type $ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
@ -294,7 +310,7 @@
(local $6 i32)
(local $7 i32)
(set_local $1
(call $~lib/allocator/arena/allocate_memory
(call $~lib/memory/memory.allocate
(call $~lib/string/String#get:lengthUTF8
(get_local $0)
)
@ -597,18 +613,24 @@
)
(get_local $1)
)
(func $~lib/allocator/arena/free_memory (; 4 ;) (type $iv) (param $0 i32)
(func $~lib/allocator/arena/__memory_free (; 7 ;) (type $iv) (param $0 i32)
(nop)
)
(func $start (; 5 ;) (type $v)
(func $~lib/memory/memory.free (; 8 ;) (type $iv) (param $0 i32)
(call $~lib/allocator/arena/__memory_free
(get_local $0)
)
(return)
)
(func $start (; 9 ;) (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)
)
)
@ -852,7 +874,7 @@
(unreachable)
)
)
(call $~lib/allocator/arena/free_memory
(call $~lib/memory/memory.free
(get_global $std/string-utf8/ptr)
)
)