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

@ -40,92 +40,91 @@
i32.sub
i32.shl
)
(func $~lib/memory/memory.allocate (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/allocator/arena/__mem_allocate (; 2 ;) (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 (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
call $~lib/allocator/arena/__mem_allocate
return
)
(func $~lib/runtime/allocate (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $~lib/runtime/allocate (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
call $~lib/runtime/ADJUSTOBLOCK
@ -141,7 +140,7 @@
global.get $~lib/runtime/HEADER_SIZE
i32.add
)
(func $~lib/runtime/register (; 4 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(func $~lib/runtime/register (; 5 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
global.get $~lib/memory/HEAP_BASE
@ -150,7 +149,7 @@
if
i32.const 0
i32.const 16
i32.const 151
i32.const 149
i32.const 4
call $~lib/env/abort
unreachable
@ -167,7 +166,7 @@
if
i32.const 0
i32.const 16
i32.const 153
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -177,7 +176,7 @@
i32.store
local.get $0
)
(func $constructor/EmptyCtor#constructor (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/EmptyCtor#constructor (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.eqz
if
@ -189,7 +188,7 @@
end
local.get $0
)
(func $constructor/EmptyCtorWithFieldInit#constructor (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/EmptyCtorWithFieldInit#constructor (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.eqz
if
@ -204,7 +203,7 @@
i32.store
local.get $0
)
(func $constructor/EmptyCtorWithFieldNoInit#constructor (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/EmptyCtorWithFieldNoInit#constructor (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.eqz
if
@ -219,7 +218,7 @@
i32.store
local.get $0
)
(func $constructor/None#constructor (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/None#constructor (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.eqz
if
@ -231,7 +230,7 @@
end
local.get $0
)
(func $constructor/JustFieldInit#constructor (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/JustFieldInit#constructor (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.eqz
if
@ -246,7 +245,7 @@
i32.store
local.get $0
)
(func $constructor/JustFieldNoInit#constructor (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/JustFieldNoInit#constructor (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.eqz
if
@ -261,11 +260,11 @@
i32.store
local.get $0
)
(func $constructor/CtorReturns#constructor (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/CtorReturns#constructor (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
i32.const 0
call $~lib/memory/memory.allocate
)
(func $constructor/CtorConditionallyReturns#constructor (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/CtorConditionallyReturns#constructor (; 13 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
global.get $constructor/b
if
i32.const 0
@ -283,7 +282,7 @@
end
local.get $0
)
(func $constructor/CtorAllocates#constructor (; 13 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/CtorAllocates#constructor (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
block (result i32)
local.get $0
i32.eqz
@ -299,7 +298,7 @@
drop
local.get $0
)
(func $constructor/CtorConditionallyAllocates#constructor (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $constructor/CtorConditionallyAllocates#constructor (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
global.get $constructor/b
if
block (result i32)
@ -327,7 +326,7 @@
end
local.get $0
)
(func $start:constructor (; 15 ;) (type $FUNCSIG$v)
(func $start:constructor (; 16 ;) (type $FUNCSIG$v)
global.get $~lib/memory/HEAP_BASE
i32.const 7
i32.add
@ -369,9 +368,9 @@
call $constructor/CtorConditionallyAllocates#constructor
global.set $constructor/ctorConditionallyAllocates
)
(func $start (; 16 ;) (type $FUNCSIG$v)
(func $start (; 17 ;) (type $FUNCSIG$v)
call $start:constructor
)
(func $null (; 17 ;) (type $FUNCSIG$v)
(func $null (; 18 ;) (type $FUNCSIG$v)
)
)