unify mem/ref interface

This commit is contained in:
dcode
2019-03-27 17:21:52 +01:00
parent a3095478a3
commit e36722f2e6
66 changed files with 3501 additions and 3490 deletions

View File

@ -152,92 +152,91 @@
end
local.get $1
)
(func $~lib/memory/memory.allocate (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/allocator/arena/__mem_allocate (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
(local $6 i32)
(local $7 i32)
block $~lib/allocator/arena/__memory_allocate|inlined.0 (result i32)
local.get $0
local.set $1
local.get $1
i32.const 1073741824
i32.gt_u
if
unreachable
end
global.get $~lib/allocator/arena/offset
local.set $2
local.get $2
local.get $1
local.tee $3
i32.const 1
local.tee $4
local.get $3
local.get $0
i32.const 1073741824
i32.gt_u
if
unreachable
end
global.get $~lib/allocator/arena/offset
local.set $1
local.get $1
local.get $0
local.tee $2
i32.const 1
local.tee $3
local.get $2
local.get $3
i32.gt_u
select
i32.add
i32.const 7
i32.add
i32.const 7
i32.const -1
i32.xor
i32.and
local.set $4
current_memory
local.set $5
local.get $4
local.get $5
i32.const 16
i32.shl
i32.gt_u
if
local.get $4
i32.gt_u
select
local.get $1
i32.sub
i32.const 65535
i32.add
i32.const 7
i32.add
i32.const 7
i32.const 65535
i32.const -1
i32.xor
i32.and
local.set $3
current_memory
local.set $4
local.get $3
local.get $4
i32.const 16
i32.shl
i32.gt_u
i32.shr_u
local.set $2
local.get $5
local.tee $3
local.get $2
local.tee $6
local.get $3
local.get $6
i32.gt_s
select
local.set $3
local.get $3
grow_memory
i32.const 0
i32.lt_s
if
local.get $3
local.get $2
i32.sub
i32.const 65535
i32.add
i32.const 65535
i32.const -1
i32.xor
i32.and
i32.const 16
i32.shr_u
local.set $5
local.get $4
local.tee $6
local.get $5
local.tee $7
local.get $6
local.get $7
i32.gt_s
select
local.set $6
local.get $6
grow_memory
i32.const 0
i32.lt_s
if
local.get $5
grow_memory
i32.const 0
i32.lt_s
if
unreachable
end
unreachable
end
end
local.get $3
global.set $~lib/allocator/arena/offset
local.get $2
end
local.get $4
global.set $~lib/allocator/arena/offset
local.get $1
)
(func $~lib/memory/memory.allocate (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
call $~lib/allocator/arena/__mem_allocate
return
)
(func $~lib/string/String#toUTF8 (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/string/String#toUTF8 (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
@ -454,7 +453,7 @@
i32.store8
local.get $1
)
(func $~lib/runtime/ADJUSTOBLOCK (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/runtime/ADJUSTOBLOCK (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
i32.const 1
i32.const 32
local.get $0
@ -466,7 +465,7 @@
i32.sub
i32.shl
)
(func $~lib/runtime/allocate (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/runtime/allocate (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
call $~lib/runtime/ADJUSTOBLOCK
@ -482,7 +481,7 @@
global.get $~lib/runtime/HEADER_SIZE
i32.add
)
(func $~lib/util/memory/memcpy (; 7 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
(func $~lib/util/memory/memcpy (; 8 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
@ -1683,7 +1682,7 @@
i32.store8
end
)
(func $~lib/memory/memory.copy (; 8 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
(func $~lib/memory/memory.copy (; 9 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
@ -1914,12 +1913,14 @@
end
end
)
(func $~lib/memory/memory.free (; 9 ;) (type $FUNCSIG$vi) (param $0 i32)
(local $1 i32)
local.get $0
local.set $1
(func $~lib/allocator/arena/__mem_free (; 10 ;) (type $FUNCSIG$vi) (param $0 i32)
nop
)
(func $~lib/runtime/register (; 10 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/memory/memory.free (; 11 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
call $~lib/allocator/arena/__mem_free
)
(func $~lib/runtime/register (; 12 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
global.get $~lib/memory/HEAP_BASE
@ -1928,7 +1929,7 @@
if
i32.const 0
i32.const 136
i32.const 151
i32.const 149
i32.const 4
call $~lib/env/abort
unreachable
@ -1945,7 +1946,7 @@
if
i32.const 0
i32.const 136
i32.const 153
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -1955,7 +1956,7 @@
i32.store
local.get $0
)
(func $~lib/string/String.fromUTF8 (; 11 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/string/String.fromUTF8 (; 13 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
@ -2270,7 +2271,7 @@
call $~lib/runtime/register
end
)
(func $~lib/util/string/compareImpl (; 12 ;) (type $FUNCSIG$iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32)
(func $~lib/util/string/compareImpl (; 14 ;) (type $FUNCSIG$iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32)
(local $5 i32)
(local $6 i32)
(local $7 i32)
@ -2323,7 +2324,7 @@
end
local.get $5
)
(func $~lib/string/String.__eq (; 13 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/string/String.__eq (; 15 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
local.get $0
@ -2367,7 +2368,7 @@
call $~lib/util/string/compareImpl
i32.eqz
)
(func $start:std/string-utf8 (; 14 ;) (type $FUNCSIG$v)
(func $start:std/string-utf8 (; 16 ;) (type $FUNCSIG$v)
global.get $std/string-utf8/str
call $~lib/string/String#get:lengthUTF8
global.set $std/string-utf8/len
@ -2634,9 +2635,9 @@
global.get $std/string-utf8/ptr
call $~lib/memory/memory.free
)
(func $start (; 15 ;) (type $FUNCSIG$v)
(func $start (; 17 ;) (type $FUNCSIG$v)
call $start:std/string-utf8
)
(func $null (; 16 ;) (type $FUNCSIG$v)
(func $null (; 18 ;) (type $FUNCSIG$v)
)
)