This commit is contained in:
dcode
2019-03-27 14:43:35 +01:00
parent 3146f8f9e0
commit bb1609c9ea
91 changed files with 6426 additions and 11009 deletions

View File

@ -106,7 +106,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -121,7 +121,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -140,7 +140,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -157,7 +157,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -168,23 +168,14 @@
local.get $0
)
(func $call-super/A#constructor (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<A>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
i32.const 4
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 1
call $~lib/runtime/register
end
i32.const 4
call $~lib/runtime/allocate
i32.const 1
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -207,19 +198,12 @@
local.get $0
)
(func $call-super/B#constructor (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
i32.const 8
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 8
call $~lib/runtime/allocate
i32.const 3
call $~lib/runtime/register
end
@ -289,22 +273,13 @@
end
)
(func $call-super/C#constructor (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<C>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.2 (result i32)
i32.const 4
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 4
call $~lib/runtime/register
end
i32.const 4
call $~lib/runtime/allocate
i32.const 4
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -313,19 +288,12 @@
local.get $0
)
(func $call-super/D#constructor (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.3 (result i32)
i32.const 8
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 8
call $~lib/runtime/allocate
i32.const 5
call $~lib/runtime/register
end
@ -395,23 +363,14 @@
end
)
(func $call-super/E#constructor (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<E>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.4 (result i32)
i32.const 4
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 6
call $~lib/runtime/register
end
i32.const 4
call $~lib/runtime/allocate
i32.const 6
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -434,22 +393,13 @@
local.get $0
)
(func $call-super/F#constructor (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<F>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.5 (result i32)
i32.const 8
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 7
call $~lib/runtime/register
end
i32.const 8
call $~lib/runtime/allocate
i32.const 7
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -493,22 +443,13 @@
end
)
(func $call-super/G#constructor (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<G>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.6 (result i32)
i32.const 4
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 8
call $~lib/runtime/register
end
i32.const 4
call $~lib/runtime/allocate
i32.const 8
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -517,22 +458,13 @@
local.get $0
)
(func $call-super/H#constructor (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<H>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.7 (result i32)
i32.const 8
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 9
call $~lib/runtime/register
end
i32.const 8
call $~lib/runtime/allocate
i32.const 9
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -576,22 +508,13 @@
end
)
(func $call-super/I#constructor (; 17 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<I>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.8 (result i32)
i32.const 4
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 10
call $~lib/runtime/register
end
i32.const 4
call $~lib/runtime/allocate
i32.const 10
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -600,22 +523,13 @@
local.get $0
)
(func $call-super/J#constructor (; 18 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<J>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.9 (result i32)
i32.const 8
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 11
call $~lib/runtime/register
end
i32.const 8
call $~lib/runtime/allocate
i32.const 11
call $~lib/runtime/register
local.set $0
end
local.get $0

View File

@ -116,7 +116,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -131,7 +131,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -150,7 +150,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -167,7 +167,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -178,43 +178,25 @@
local.get $0
)
(func $constructor/EmptyCtor#constructor (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<EmptyCtor>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 1
call $~lib/runtime/register
end
i32.const 0
call $~lib/runtime/allocate
i32.const 1
call $~lib/runtime/register
local.set $0
end
local.get $0
)
(func $constructor/EmptyCtorWithFieldInit#constructor (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<EmptyCtorWithFieldInit>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
i32.const 4
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 3
call $~lib/runtime/register
end
i32.const 4
call $~lib/runtime/allocate
i32.const 3
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -223,22 +205,13 @@
local.get $0
)
(func $constructor/EmptyCtorWithFieldNoInit#constructor (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<EmptyCtorWithFieldNoInit>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.2 (result i32)
i32.const 4
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 4
call $~lib/runtime/register
end
i32.const 4
call $~lib/runtime/allocate
i32.const 4
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -247,43 +220,25 @@
local.get $0
)
(func $constructor/None#constructor (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<None>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.3 (result i32)
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 5
call $~lib/runtime/register
end
i32.const 0
call $~lib/runtime/allocate
i32.const 5
call $~lib/runtime/register
local.set $0
end
local.get $0
)
(func $constructor/JustFieldInit#constructor (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<JustFieldInit>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.4 (result i32)
i32.const 4
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 6
call $~lib/runtime/register
end
i32.const 4
call $~lib/runtime/allocate
i32.const 6
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -292,22 +247,13 @@
local.get $0
)
(func $constructor/JustFieldNoInit#constructor (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<JustFieldNoInit>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.5 (result i32)
i32.const 4
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 7
call $~lib/runtime/register
end
i32.const 4
call $~lib/runtime/allocate
i32.const 7
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -320,7 +266,6 @@
call $~lib/memory/memory.allocate
)
(func $constructor/CtorConditionallyReturns#constructor (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $constructor/b
if
i32.const 0
@ -330,40 +275,23 @@
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<CtorConditionallyReturns>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.6 (result i32)
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 8
call $~lib/runtime/register
end
i32.const 0
call $~lib/runtime/allocate
i32.const 8
call $~lib/runtime/register
local.set $0
end
local.get $0
)
(func $constructor/CtorAllocates#constructor (; 13 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<CtorAllocates>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.7 (result i32)
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 9
call $~lib/runtime/register
end
i32.const 0
call $~lib/runtime/allocate
i32.const 9
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -372,25 +300,16 @@
local.get $0
)
(func $constructor/CtorConditionallyAllocates#constructor (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
global.get $constructor/b
if
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<CtorConditionallyAllocates>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.8 (result i32)
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 10
call $~lib/runtime/register
end
i32.const 0
call $~lib/runtime/allocate
i32.const 10
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -400,18 +319,10 @@
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<CtorConditionallyAllocates>|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.9 (result i32)
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 10
call $~lib/runtime/register
end
i32.const 0
call $~lib/runtime/allocate
i32.const 10
call $~lib/runtime/register
local.set $0
end
local.get $0

View File

@ -41,7 +41,7 @@
(export "Car.getNumTires" (func $exports/Car.getNumTires))
(export "vehicles.Car#get:doors" (func $exports/Car#get:numDoors))
(export "vehicles.Car#set:doors" (func $exports/Car#set:numDoors))
(export "vehicles.Car#constructor" (func $exports/Car#constructor|trampoline))
(export "vehicles.Car#constructor" (func $exports/vehicles.Car#constructor|trampoline))
(export "vehicles.Car#get:numDoors" (func $exports/Car#get:numDoors))
(export "vehicles.Car#set:numDoors" (func $exports/Car#set:numDoors))
(export "vehicles.Car#openDoors" (func $exports/Car#openDoors))
@ -124,15 +124,29 @@
global.set $~lib/allocator/arena/offset
local.get $1
)
(func $~lib/runtime/register (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(func $~lib/runtime/allocate (; 5 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
i32.const 16
call $~lib/memory/memory.allocate
local.tee $0
i32.const -1520547049
i32.store
local.get $0
i32.const 4
i32.store offset=4
local.get $0
i32.const 8
i32.add
)
(func $~lib/runtime/register (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
i32.const 48
i32.le_u
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -140,45 +154,45 @@
local.get $0
i32.const 8
i32.sub
local.tee $1
local.tee $2
i32.load
i32.const -1520547049
i32.ne
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $2
local.get $1
i32.const 1
i32.store
local.get $0
)
(func $exports/Car#get:numDoors (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(func $exports/Car#get:numDoors (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.load
)
(func $exports/Car#set:numDoors (; 7 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(func $exports/Car#set:numDoors (; 8 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
local.get $0
local.get $1
i32.store
)
(func $exports/Car#openDoors (; 8 ;) (type $FUNCSIG$vi) (param $0 i32)
(func $exports/Car#openDoors (; 9 ;) (type $FUNCSIG$vi) (param $0 i32)
nop
)
(func $start (; 9 ;) (type $FUNCSIG$v)
(func $start (; 10 ;) (type $FUNCSIG$v)
i32.const 48
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
)
(func $null (; 10 ;) (type $FUNCSIG$v)
(func $null (; 11 ;) (type $FUNCSIG$v)
nop
)
(func $exports/subOpt|trampoline (; 11 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(func $exports/subOpt|trampoline (; 12 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
block $1of1
block $0of1
block $outOfRange
@ -196,11 +210,11 @@
local.get $1
i32.sub
)
(func $~lib/setargc (; 12 ;) (type $FUNCSIG$vi) (param $0 i32)
(func $~lib/setargc (; 13 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.set $~lib/argc
)
(func $exports/Car#constructor|trampoline (; 13 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(func $exports/Car#constructor|trampoline (; 14 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
block $1of1
block $0of1
block $outOfRange
@ -215,17 +229,36 @@
local.get $0
i32.eqz
if
i32.const 16
call $~lib/memory/memory.allocate
local.tee $0
i32.const -1520547049
i32.store
local.get $0
i32.const 4
i32.store offset=4
local.get $0
i32.const 8
i32.add
call $~lib/runtime/allocate
i32.const 1
call $~lib/runtime/register
local.set $0
end
local.get $0
local.get $1
i32.store
local.get $0
local.get $1
i32.store
local.get $0
)
(func $exports/vehicles.Car#constructor|trampoline (; 15 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
block $1of1
block $0of1
block $outOfRange
global.get $~lib/argc
br_table $0of1 $1of1 $outOfRange
end
unreachable
end
i32.const 2
local.set $1
end
local.get $0
i32.eqz
if
call $~lib/runtime/allocate
i32.const 3
call $~lib/runtime/register
local.set $0
end

View File

@ -193,7 +193,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -210,7 +210,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -221,23 +221,14 @@
local.get $0
)
(func $exports/Car#constructor (; 9 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Car>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
i32.const 4
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 1
call $~lib/runtime/register
end
i32.const 4
call $~lib/runtime/allocate
i32.const 1
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -265,23 +256,14 @@
global.get $exports/vehicles.Car.TIRES
)
(func $exports/vehicles.Car#constructor (; 14 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Car>|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
i32.const 4
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 1
call $~lib/runtime/register
end
i32.const 4
call $~lib/runtime/allocate
i32.const 3
call $~lib/runtime/register
local.set $0
end
local.get $0

View File

@ -0,0 +1 @@
Tracing GC tests

View File

@ -0,0 +1,47 @@
// A dummy tracing GC for testing.
export var collect_count = 0;
// @ts-ignore: decorator
@global @unsafe
function __ref_collect(): void {
trace("gc.collect");
collect_count++;
}
export var register_count = 0;
export var register_ref: usize = 0;
// @ts-ignore: decorator
@global @unsafe
function __ref_register(ref: usize): void {
trace("gc.register", 1, ref);
register_count++;
register_ref = ref;
}
export var link_count = 0;
export var link_ref: usize = 0;
export var link_parentRef: usize = 0;
// @ts-ignore: decorator
@global @unsafe
function __ref_link(ref: usize, parentRef: usize): void {
trace("gc.link", 2, ref, parentRef);
link_count++;
link_ref = ref;
link_parentRef = ref;
}
export var unlink_count = 0;
export var unlink_ref: usize = 0;
export var unlink_parentRef: usize = 0;
// @ts-ignore: decorator
@global @unsafe
function __ref_unlink(ref: usize, parentRef: usize): void {
trace("gc.unlink", 2, ref, parentRef);
unlink_count++;
unlink_ref = ref;
unlink_parentRef = parentRef;
}

View File

@ -0,0 +1,251 @@
(module
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$viiddddd (func (param i32 i32 f64 f64 f64 f64 f64)))
(type $FUNCSIG$v (func))
(type $FUNCSIG$i (func (result i32)))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64)))
(memory $0 1)
(data (i32.const 8) "\02\00\00\00\1e")
(data (i32.const 24) "~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s")
(data (i32.const 56) "\02\00\00\00\16")
(data (i32.const 72) "g\00c\00.\00r\00e\00g\00i\00s\00t\00e\00r")
(data (i32.const 96) "\02\00\00\00&")
(data (i32.const 112) "g\00c\00/\00g\00l\00o\00b\00a\00l\00-\00a\00s\00s\00i\00g\00n\00.\00t\00s")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $gc/_dummy/register_count (mut i32) (i32.const 0))
(global $gc/_dummy/register_ref (mut i32) (i32.const 0))
(global $gc/_dummy/link_count (mut i32) (i32.const 0))
(global $gc/_dummy/unlink_count (mut i32) (i32.const 0))
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $gc/global-assign/global (mut i32) (i32.const 0))
(global $gc/global-assign/globalRef (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/capabilities i32 (i32.const 2))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $gc/global-assign/main))
(export ".capabilities" (global $~lib/capabilities))
(func $~lib/memory/memory.allocate (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
local.get $0
i32.const 1073741824
i32.gt_u
if
unreachable
end
global.get $~lib/allocator/arena/offset
local.tee $1
local.get $0
i32.const 1
local.get $0
i32.const 1
i32.gt_u
select
i32.add
i32.const 7
i32.add
i32.const -8
i32.and
local.tee $0
current_memory
local.tee $2
i32.const 16
i32.shl
i32.gt_u
if
local.get $2
local.get $0
local.get $1
i32.sub
i32.const 65535
i32.add
i32.const -65536
i32.and
i32.const 16
i32.shr_u
local.tee $3
local.get $2
local.get $3
i32.gt_s
select
grow_memory
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
i32.const 0
i32.lt_s
if
unreachable
end
end
end
local.get $0
global.set $~lib/allocator/arena/offset
local.get $1
)
(func $~lib/runtime/allocate (; 3 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
i32.const 16
call $~lib/memory/memory.allocate
local.tee $0
i32.const -1520547049
i32.store
local.get $0
i32.const 0
i32.store offset=4
local.get $0
i32.const 0
i32.store offset=8
local.get $0
i32.const 0
i32.store offset=12
local.get $0
i32.const 16
i32.add
)
(func $gc/_dummy/__ref_register (; 4 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 72
i32.const 1
local.get $0
f64.convert_i32_u
f64.const 0
f64.const 0
f64.const 0
f64.const 0
call $~lib/env/trace
global.get $gc/_dummy/register_count
i32.const 1
i32.add
global.set $gc/_dummy/register_count
local.get $0
global.set $gc/_dummy/register_ref
)
(func $~lib/runtime/register (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.const 152
i32.le_u
if
i32.const 0
i32.const 24
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $0
i32.const 16
i32.sub
local.tee $1
i32.load
i32.const -1520547049
i32.ne
if
i32.const 0
i32.const 24
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $1
i32.const 1
i32.store
local.get $0
call $gc/_dummy/__ref_register
local.get $0
)
(func $start:gc/global-assign (; 6 ;) (type $FUNCSIG$v)
i32.const 152
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
call $~lib/runtime/allocate
call $~lib/runtime/register
global.set $gc/global-assign/global
global.get $gc/global-assign/global
global.set $gc/global-assign/globalRef
global.get $gc/_dummy/register_count
i32.const 1
i32.ne
if
i32.const 0
i32.const 112
i32.const 12
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/link_count
if
i32.const 0
i32.const 112
i32.const 13
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/unlink_count
if
i32.const 0
i32.const 112
i32.const 14
i32.const 0
call $~lib/env/abort
unreachable
end
call $~lib/runtime/allocate
call $~lib/runtime/register
global.set $gc/global-assign/global
global.get $gc/_dummy/register_count
i32.const 2
i32.ne
if
i32.const 0
i32.const 112
i32.const 19
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/link_count
if
i32.const 0
i32.const 112
i32.const 20
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/unlink_count
if
i32.const 0
i32.const 112
i32.const 21
i32.const 0
call $~lib/env/abort
unreachable
end
)
(func $gc/global-assign/main (; 7 ;) (type $FUNCSIG$v)
global.get $~lib/started
i32.eqz
if
call $start:gc/global-assign
i32.const 1
global.set $~lib/started
end
)
(func $null (; 8 ;) (type $FUNCSIG$v)
nop
)
)

View File

@ -0,0 +1,21 @@
import "allocator/arena";
import { register_count, link_count, unlink_count } from "./_dummy";
@start export function main(): void {}
class Ref {}
// should register only
var global: Ref = new Ref();
var globalRef = changetype<usize>(global);
assert(register_count == 1);
assert(link_count == 0);
assert(unlink_count == 0);
// should register only
global = new Ref();
assert(register_count == 2);
assert(link_count == 0);
assert(unlink_count == 0);

View File

@ -0,0 +1,331 @@
(module
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$viiddddd (func (param i32 i32 f64 f64 f64 f64 f64)))
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64)))
(memory $0 1)
(data (i32.const 8) "\02\00\00\00\1e\00\00\00\00\00\00\00\00\00\00\00~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s\00")
(data (i32.const 56) "\02\00\00\00\16\00\00\00\00\00\00\00\00\00\00\00g\00c\00.\00r\00e\00g\00i\00s\00t\00e\00r\00")
(data (i32.const 96) "\02\00\00\00&\00\00\00\00\00\00\00\00\00\00\00g\00c\00/\00g\00l\00o\00b\00a\00l\00-\00a\00s\00s\00i\00g\00n\00.\00t\00s\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $gc/_dummy/collect_count (mut i32) (i32.const 0))
(global $gc/_dummy/register_count (mut i32) (i32.const 0))
(global $gc/_dummy/register_ref (mut i32) (i32.const 0))
(global $gc/_dummy/link_count (mut i32) (i32.const 0))
(global $gc/_dummy/link_ref (mut i32) (i32.const 0))
(global $gc/_dummy/link_parentRef (mut i32) (i32.const 0))
(global $gc/_dummy/unlink_count (mut i32) (i32.const 0))
(global $gc/_dummy/unlink_ref (mut i32) (i32.const 0))
(global $gc/_dummy/unlink_parentRef (mut i32) (i32.const 0))
(global $~lib/runtime/HEADER_SIZE i32 (i32.const 16))
(global $~lib/runtime/HEADER_MAGIC i32 (i32.const -1520547049))
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $~lib/ASC_NO_ASSERT i32 (i32.const 0))
(global $gc/global-assign/global (mut i32) (i32.const 0))
(global $gc/global-assign/globalRef (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/memory/HEAP_BASE i32 (i32.const 152))
(global $~lib/capabilities i32 (i32.const 2))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $gc/global-assign/main))
(export ".capabilities" (global $~lib/capabilities))
(func $~lib/runtime/ADJUSTOBLOCK (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
i32.const 1
i32.const 32
local.get $0
global.get $~lib/runtime/HEADER_SIZE
i32.add
i32.const 1
i32.sub
i32.clz
i32.sub
i32.shl
)
(func $~lib/memory/memory.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 $4
i32.gt_u
select
i32.add
i32.const 7
i32.add
i32.const 7
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
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
end
end
local.get $3
global.set $~lib/allocator/arena/offset
local.get $2
end
return
)
(func $~lib/runtime/allocate (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
call $~lib/runtime/ADJUSTOBLOCK
call $~lib/memory/memory.allocate
local.set $1
local.get $1
global.get $~lib/runtime/HEADER_MAGIC
i32.store
local.get $1
local.get $0
i32.store offset=4
local.get $1
i32.const 0
i32.store offset=8
local.get $1
i32.const 0
i32.store offset=12
local.get $1
global.get $~lib/runtime/HEADER_SIZE
i32.add
)
(func $gc/_dummy/__ref_register (; 5 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 72
i32.const 1
local.get $0
f64.convert_i32_u
f64.const 0
f64.const 0
f64.const 0
f64.const 0
call $~lib/env/trace
global.get $gc/_dummy/register_count
i32.const 1
i32.add
global.set $gc/_dummy/register_count
local.get $0
global.set $gc/_dummy/register_ref
)
(func $~lib/runtime/register (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
global.get $~lib/memory/HEAP_BASE
i32.gt_u
i32.eqz
if
i32.const 0
i32.const 24
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $0
global.get $~lib/runtime/HEADER_SIZE
i32.sub
local.set $2
local.get $2
i32.load
global.get $~lib/runtime/HEADER_MAGIC
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $2
local.get $1
i32.store
local.get $0
call $gc/_dummy/__ref_register
local.get $0
)
(func $gc/global-assign/Ref#constructor (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.eqz
if
i32.const 0
call $~lib/runtime/allocate
i32.const 1
call $~lib/runtime/register
local.set $0
end
local.get $0
)
(func $start:gc/global-assign (; 8 ;) (type $FUNCSIG$v)
global.get $~lib/memory/HEAP_BASE
i32.const 7
i32.add
i32.const 7
i32.const -1
i32.xor
i32.and
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
i32.const 0
call $gc/global-assign/Ref#constructor
global.set $gc/global-assign/global
global.get $gc/global-assign/global
global.set $gc/global-assign/globalRef
global.get $gc/_dummy/register_count
i32.const 1
i32.eq
i32.eqz
if
i32.const 0
i32.const 112
i32.const 12
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/link_count
i32.const 0
i32.eq
i32.eqz
if
i32.const 0
i32.const 112
i32.const 13
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/unlink_count
i32.const 0
i32.eq
i32.eqz
if
i32.const 0
i32.const 112
i32.const 14
i32.const 0
call $~lib/env/abort
unreachable
end
i32.const 0
call $gc/global-assign/Ref#constructor
global.set $gc/global-assign/global
global.get $gc/_dummy/register_count
i32.const 2
i32.eq
i32.eqz
if
i32.const 0
i32.const 112
i32.const 19
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/link_count
i32.const 0
i32.eq
i32.eqz
if
i32.const 0
i32.const 112
i32.const 20
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/unlink_count
i32.const 0
i32.eq
i32.eqz
if
i32.const 0
i32.const 112
i32.const 21
i32.const 0
call $~lib/env/abort
unreachable
end
)
(func $gc/global-assign/main (; 9 ;) (type $FUNCSIG$v)
global.get $~lib/started
i32.eqz
if
call $start
i32.const 1
global.set $~lib/started
end
)
(func $start (; 10 ;) (type $FUNCSIG$v)
call $start:gc/global-assign
)
(func $null (; 11 ;) (type $FUNCSIG$v)
)
)

View File

@ -0,0 +1,248 @@
(module
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$viiddddd (func (param i32 i32 f64 f64 f64 f64 f64)))
(type $FUNCSIG$v (func))
(type $FUNCSIG$i (func (result i32)))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64)))
(memory $0 1)
(data (i32.const 8) "\02\00\00\00\1e")
(data (i32.const 24) "~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s")
(data (i32.const 56) "\02\00\00\00\16")
(data (i32.const 72) "g\00c\00.\00r\00e\00g\00i\00s\00t\00e\00r")
(data (i32.const 96) "\02\00\00\00\"")
(data (i32.const 112) "g\00c\00/\00g\00l\00o\00b\00a\00l\00-\00i\00n\00i\00t\00.\00t\00s")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $gc/_dummy/register_count (mut i32) (i32.const 0))
(global $gc/_dummy/register_ref (mut i32) (i32.const 0))
(global $gc/_dummy/link_count (mut i32) (i32.const 0))
(global $gc/_dummy/unlink_count (mut i32) (i32.const 0))
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $gc/global-init/global (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/capabilities i32 (i32.const 2))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $gc/global-init/main))
(export ".capabilities" (global $~lib/capabilities))
(func $~lib/memory/memory.allocate (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
local.get $0
i32.const 1073741824
i32.gt_u
if
unreachable
end
global.get $~lib/allocator/arena/offset
local.tee $1
local.get $0
i32.const 1
local.get $0
i32.const 1
i32.gt_u
select
i32.add
i32.const 7
i32.add
i32.const -8
i32.and
local.tee $0
current_memory
local.tee $2
i32.const 16
i32.shl
i32.gt_u
if
local.get $2
local.get $0
local.get $1
i32.sub
i32.const 65535
i32.add
i32.const -65536
i32.and
i32.const 16
i32.shr_u
local.tee $3
local.get $2
local.get $3
i32.gt_s
select
grow_memory
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
i32.const 0
i32.lt_s
if
unreachable
end
end
end
local.get $0
global.set $~lib/allocator/arena/offset
local.get $1
)
(func $~lib/runtime/allocate (; 3 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
i32.const 16
call $~lib/memory/memory.allocate
local.tee $0
i32.const -1520547049
i32.store
local.get $0
i32.const 0
i32.store offset=4
local.get $0
i32.const 0
i32.store offset=8
local.get $0
i32.const 0
i32.store offset=12
local.get $0
i32.const 16
i32.add
)
(func $gc/_dummy/__ref_register (; 4 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 72
i32.const 1
local.get $0
f64.convert_i32_u
f64.const 0
f64.const 0
f64.const 0
f64.const 0
call $~lib/env/trace
global.get $gc/_dummy/register_count
i32.const 1
i32.add
global.set $gc/_dummy/register_count
local.get $0
global.set $gc/_dummy/register_ref
)
(func $~lib/runtime/register (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.const 148
i32.le_u
if
i32.const 0
i32.const 24
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $0
i32.const 16
i32.sub
local.tee $1
i32.load
i32.const -1520547049
i32.ne
if
i32.const 0
i32.const 24
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $1
i32.const 1
i32.store
local.get $0
call $gc/_dummy/__ref_register
local.get $0
)
(func $start:gc/global-init (; 6 ;) (type $FUNCSIG$v)
i32.const 152
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
call $~lib/runtime/allocate
call $~lib/runtime/register
global.set $gc/global-init/global
global.get $gc/_dummy/register_count
i32.const 1
i32.ne
if
i32.const 0
i32.const 112
i32.const 11
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/link_count
if
i32.const 0
i32.const 112
i32.const 12
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/unlink_count
if
i32.const 0
i32.const 112
i32.const 13
i32.const 0
call $~lib/env/abort
unreachable
end
call $~lib/runtime/allocate
call $~lib/runtime/register
global.set $gc/global-init/global
global.get $gc/_dummy/register_count
i32.const 2
i32.ne
if
i32.const 0
i32.const 112
i32.const 16
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/link_count
if
i32.const 0
i32.const 112
i32.const 17
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/unlink_count
if
i32.const 0
i32.const 112
i32.const 18
i32.const 0
call $~lib/env/abort
unreachable
end
)
(func $gc/global-init/main (; 7 ;) (type $FUNCSIG$v)
global.get $~lib/started
i32.eqz
if
call $start:gc/global-init
i32.const 1
global.set $~lib/started
end
)
(func $null (; 8 ;) (type $FUNCSIG$v)
nop
)
)

View File

@ -0,0 +1,18 @@
import "allocator/arena";
import { register_count, link_count, unlink_count } from "./_dummy";
@start export function main(): void {}
class Ref {}
// should register only
var global: Ref = new Ref();
assert(register_count == 1);
assert(link_count == 0);
assert(unlink_count == 0);
global = new Ref();
assert(register_count == 2);
assert(link_count == 0);
assert(unlink_count == 0);

View File

@ -0,0 +1,328 @@
(module
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$viiddddd (func (param i32 i32 f64 f64 f64 f64 f64)))
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64)))
(memory $0 1)
(data (i32.const 8) "\02\00\00\00\1e\00\00\00\00\00\00\00\00\00\00\00~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s\00")
(data (i32.const 56) "\02\00\00\00\16\00\00\00\00\00\00\00\00\00\00\00g\00c\00.\00r\00e\00g\00i\00s\00t\00e\00r\00")
(data (i32.const 96) "\02\00\00\00\"\00\00\00\00\00\00\00\00\00\00\00g\00c\00/\00g\00l\00o\00b\00a\00l\00-\00i\00n\00i\00t\00.\00t\00s\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $gc/_dummy/collect_count (mut i32) (i32.const 0))
(global $gc/_dummy/register_count (mut i32) (i32.const 0))
(global $gc/_dummy/register_ref (mut i32) (i32.const 0))
(global $gc/_dummy/link_count (mut i32) (i32.const 0))
(global $gc/_dummy/link_ref (mut i32) (i32.const 0))
(global $gc/_dummy/link_parentRef (mut i32) (i32.const 0))
(global $gc/_dummy/unlink_count (mut i32) (i32.const 0))
(global $gc/_dummy/unlink_ref (mut i32) (i32.const 0))
(global $gc/_dummy/unlink_parentRef (mut i32) (i32.const 0))
(global $~lib/runtime/HEADER_SIZE i32 (i32.const 16))
(global $~lib/runtime/HEADER_MAGIC i32 (i32.const -1520547049))
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $~lib/ASC_NO_ASSERT i32 (i32.const 0))
(global $gc/global-init/global (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/memory/HEAP_BASE i32 (i32.const 148))
(global $~lib/capabilities i32 (i32.const 2))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $gc/global-init/main))
(export ".capabilities" (global $~lib/capabilities))
(func $~lib/runtime/ADJUSTOBLOCK (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
i32.const 1
i32.const 32
local.get $0
global.get $~lib/runtime/HEADER_SIZE
i32.add
i32.const 1
i32.sub
i32.clz
i32.sub
i32.shl
)
(func $~lib/memory/memory.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 $4
i32.gt_u
select
i32.add
i32.const 7
i32.add
i32.const 7
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
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
end
end
local.get $3
global.set $~lib/allocator/arena/offset
local.get $2
end
return
)
(func $~lib/runtime/allocate (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
call $~lib/runtime/ADJUSTOBLOCK
call $~lib/memory/memory.allocate
local.set $1
local.get $1
global.get $~lib/runtime/HEADER_MAGIC
i32.store
local.get $1
local.get $0
i32.store offset=4
local.get $1
i32.const 0
i32.store offset=8
local.get $1
i32.const 0
i32.store offset=12
local.get $1
global.get $~lib/runtime/HEADER_SIZE
i32.add
)
(func $gc/_dummy/__ref_register (; 5 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 72
i32.const 1
local.get $0
f64.convert_i32_u
f64.const 0
f64.const 0
f64.const 0
f64.const 0
call $~lib/env/trace
global.get $gc/_dummy/register_count
i32.const 1
i32.add
global.set $gc/_dummy/register_count
local.get $0
global.set $gc/_dummy/register_ref
)
(func $~lib/runtime/register (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
global.get $~lib/memory/HEAP_BASE
i32.gt_u
i32.eqz
if
i32.const 0
i32.const 24
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $0
global.get $~lib/runtime/HEADER_SIZE
i32.sub
local.set $2
local.get $2
i32.load
global.get $~lib/runtime/HEADER_MAGIC
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $2
local.get $1
i32.store
local.get $0
call $gc/_dummy/__ref_register
local.get $0
)
(func $gc/global-init/Ref#constructor (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.eqz
if
i32.const 0
call $~lib/runtime/allocate
i32.const 1
call $~lib/runtime/register
local.set $0
end
local.get $0
)
(func $start:gc/global-init (; 8 ;) (type $FUNCSIG$v)
global.get $~lib/memory/HEAP_BASE
i32.const 7
i32.add
i32.const 7
i32.const -1
i32.xor
i32.and
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
i32.const 0
call $gc/global-init/Ref#constructor
global.set $gc/global-init/global
global.get $gc/_dummy/register_count
i32.const 1
i32.eq
i32.eqz
if
i32.const 0
i32.const 112
i32.const 11
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/link_count
i32.const 0
i32.eq
i32.eqz
if
i32.const 0
i32.const 112
i32.const 12
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/unlink_count
i32.const 0
i32.eq
i32.eqz
if
i32.const 0
i32.const 112
i32.const 13
i32.const 0
call $~lib/env/abort
unreachable
end
i32.const 0
call $gc/global-init/Ref#constructor
global.set $gc/global-init/global
global.get $gc/_dummy/register_count
i32.const 2
i32.eq
i32.eqz
if
i32.const 0
i32.const 112
i32.const 16
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/link_count
i32.const 0
i32.eq
i32.eqz
if
i32.const 0
i32.const 112
i32.const 17
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/_dummy/unlink_count
i32.const 0
i32.eq
i32.eqz
if
i32.const 0
i32.const 112
i32.const 18
i32.const 0
call $~lib/env/abort
unreachable
end
)
(func $gc/global-init/main (; 9 ;) (type $FUNCSIG$v)
global.get $~lib/started
i32.eqz
if
call $start
i32.const 1
global.set $~lib/started
end
)
(func $start (; 10 ;) (type $FUNCSIG$v)
call $start:gc/global-init
)
(func $null (; 11 ;) (type $FUNCSIG$v)
)
)

View File

@ -0,0 +1 @@
Reference counting GC tests

View File

@ -0,0 +1,43 @@
// A dummy reference counting GC for testing.
export var collect_count = 0;
// @ts-ignore: decorator
@global @unsafe
function __ref_collect(): void {
trace("gc.collect");
collect_count++;
}
export var register_count = 0;
export var register_ref: usize = 0;
// @ts-ignore: decorator
@global @unsafe
function __ref_register(ref: usize): void {
trace("gc.register", 1, ref);
register_count++;
register_ref = ref;
}
export var retain_count = 0;
export var retain_ref: usize = 0;
// @ts-ignore: decorator
@global @unsafe
function __ref_retain(ref: usize): void {
trace("gc.retain", 1, ref);
retain_count++;
retain_ref = ref;
}
export var release_count = 0;
export var release_ref: usize = 0;
// @ts-ignore: decorator
@global @unsafe
function __ref_release(ref: usize): void {
trace("gc.release", 1, ref);
release_count++;
release_ref = ref;
}

View File

@ -0,0 +1,349 @@
(module
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$viiddddd (func (param i32 i32 f64 f64 f64 f64 f64)))
(type $FUNCSIG$v (func))
(type $FUNCSIG$i (func (result i32)))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64)))
(memory $0 1)
(data (i32.const 8) "\02\00\00\00\1e")
(data (i32.const 24) "~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s")
(data (i32.const 56) "\02\00\00\00\16")
(data (i32.const 72) "g\00c\00.\00r\00e\00g\00i\00s\00t\00e\00r")
(data (i32.const 96) "\02\00\00\00\12")
(data (i32.const 112) "g\00c\00.\00r\00e\00t\00a\00i\00n")
(data (i32.const 136) "\02\00\00\00,")
(data (i32.const 152) "g\00c\00/\00r\00c\00/\00g\00l\00o\00b\00a\00l\00-\00a\00s\00s\00i\00g\00n\00.\00t\00s")
(data (i32.const 200) "\02\00\00\00\14")
(data (i32.const 216) "g\00c\00.\00r\00e\00l\00e\00a\00s\00e")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $gc/rc/_dummy/register_count (mut i32) (i32.const 0))
(global $gc/rc/_dummy/register_ref (mut i32) (i32.const 0))
(global $gc/rc/_dummy/retain_count (mut i32) (i32.const 0))
(global $gc/rc/_dummy/retain_ref (mut i32) (i32.const 0))
(global $gc/rc/_dummy/release_count (mut i32) (i32.const 0))
(global $gc/rc/_dummy/release_ref (mut i32) (i32.const 0))
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $gc/rc/global-assign/global (mut i32) (i32.const 0))
(global $gc/rc/global-assign/globalRef (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/capabilities i32 (i32.const 2))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $gc/rc/global-assign/main))
(export ".capabilities" (global $~lib/capabilities))
(func $~lib/memory/memory.allocate (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
local.get $0
i32.const 1073741824
i32.gt_u
if
unreachable
end
global.get $~lib/allocator/arena/offset
local.tee $1
local.get $0
i32.const 1
local.get $0
i32.const 1
i32.gt_u
select
i32.add
i32.const 7
i32.add
i32.const -8
i32.and
local.tee $0
current_memory
local.tee $2
i32.const 16
i32.shl
i32.gt_u
if
local.get $2
local.get $0
local.get $1
i32.sub
i32.const 65535
i32.add
i32.const -65536
i32.and
i32.const 16
i32.shr_u
local.tee $3
local.get $2
local.get $3
i32.gt_s
select
grow_memory
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
i32.const 0
i32.lt_s
if
unreachable
end
end
end
local.get $0
global.set $~lib/allocator/arena/offset
local.get $1
)
(func $~lib/runtime/allocate (; 3 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
i32.const 16
call $~lib/memory/memory.allocate
local.tee $0
i32.const -1520547049
i32.store
local.get $0
i32.const 0
i32.store offset=4
local.get $0
i32.const 0
i32.store offset=8
local.get $0
i32.const 0
i32.store offset=12
local.get $0
i32.const 16
i32.add
)
(func $gc/rc/_dummy/__ref_register (; 4 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 72
i32.const 1
local.get $0
f64.convert_i32_u
f64.const 0
f64.const 0
f64.const 0
f64.const 0
call $~lib/env/trace
global.get $gc/rc/_dummy/register_count
i32.const 1
i32.add
global.set $gc/rc/_dummy/register_count
local.get $0
global.set $gc/rc/_dummy/register_ref
)
(func $~lib/runtime/register (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.const 236
i32.le_u
if
i32.const 0
i32.const 24
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $0
i32.const 16
i32.sub
local.tee $1
i32.load
i32.const -1520547049
i32.ne
if
i32.const 0
i32.const 24
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $1
i32.const 1
i32.store
local.get $0
call $gc/rc/_dummy/__ref_register
local.get $0
)
(func $gc/rc/_dummy/__ref_retain (; 6 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 112
i32.const 1
local.get $0
f64.convert_i32_u
f64.const 0
f64.const 0
f64.const 0
f64.const 0
call $~lib/env/trace
global.get $gc/rc/_dummy/retain_count
i32.const 1
i32.add
global.set $gc/rc/_dummy/retain_count
local.get $0
global.set $gc/rc/_dummy/retain_ref
)
(func $gc/rc/_dummy/__ref_release (; 7 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 216
i32.const 1
local.get $0
f64.convert_i32_u
f64.const 0
f64.const 0
f64.const 0
f64.const 0
call $~lib/env/trace
global.get $gc/rc/_dummy/release_count
i32.const 1
i32.add
global.set $gc/rc/_dummy/release_count
local.get $0
global.set $gc/rc/_dummy/release_ref
)
(func $start:gc/rc/global-assign (; 8 ;) (type $FUNCSIG$v)
(local $0 i32)
(local $1 i32)
i32.const 240
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
call $~lib/runtime/allocate
call $~lib/runtime/register
local.tee $0
call $gc/rc/_dummy/__ref_retain
local.get $0
global.set $gc/rc/global-assign/global
global.get $gc/rc/global-assign/global
global.set $gc/rc/global-assign/globalRef
global.get $gc/rc/_dummy/register_count
i32.const 1
i32.ne
if
i32.const 0
i32.const 152
i32.const 12
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/retain_count
i32.const 1
i32.ne
if
i32.const 0
i32.const 152
i32.const 13
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/retain_ref
global.get $gc/rc/global-assign/globalRef
i32.ne
if
i32.const 0
i32.const 152
i32.const 14
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/release_count
if
i32.const 0
i32.const 152
i32.const 15
i32.const 0
call $~lib/env/abort
unreachable
end
call $~lib/runtime/allocate
call $~lib/runtime/register
local.tee $0
global.get $gc/rc/global-assign/global
local.tee $1
i32.ne
if
local.get $1
if
local.get $1
call $gc/rc/_dummy/__ref_release
end
local.get $0
call $gc/rc/_dummy/__ref_retain
end
local.get $0
global.set $gc/rc/global-assign/global
global.get $gc/rc/_dummy/register_count
i32.const 2
i32.ne
if
i32.const 0
i32.const 152
i32.const 20
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/retain_count
i32.const 2
i32.ne
if
i32.const 0
i32.const 152
i32.const 21
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/retain_ref
global.get $gc/rc/global-assign/global
i32.ne
if
i32.const 0
i32.const 152
i32.const 22
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/release_count
i32.const 1
i32.ne
if
i32.const 0
i32.const 152
i32.const 23
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/release_ref
global.get $gc/rc/global-assign/globalRef
i32.ne
if
i32.const 0
i32.const 152
i32.const 24
i32.const 0
call $~lib/env/abort
unreachable
end
)
(func $gc/rc/global-assign/main (; 9 ;) (type $FUNCSIG$v)
global.get $~lib/started
i32.eqz
if
call $start:gc/rc/global-assign
i32.const 1
global.set $~lib/started
end
)
(func $null (; 10 ;) (type $FUNCSIG$v)
nop
)
)

View File

@ -0,0 +1,24 @@
import "allocator/arena";
import { register_count, retain_count, retain_ref, release_count, release_ref } from "./_dummy";
@start export function main(): void {}
class Ref {}
// should register and retain
var global: Ref = new Ref();
var globalRef = changetype<usize>(global);
assert(register_count == 1);
assert(retain_count == 1);
assert(retain_ref == globalRef);
assert(release_count == 0);
// should register, release old and retain new
global = new Ref();
assert(register_count == 2);
assert(retain_count == 2);
assert(retain_ref == changetype<usize>(global));
assert(release_count == 1);
assert(release_ref == globalRef);

View File

@ -0,0 +1,425 @@
(module
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$viiddddd (func (param i32 i32 f64 f64 f64 f64 f64)))
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64)))
(memory $0 1)
(data (i32.const 8) "\02\00\00\00\1e\00\00\00\00\00\00\00\00\00\00\00~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s\00")
(data (i32.const 56) "\02\00\00\00\16\00\00\00\00\00\00\00\00\00\00\00g\00c\00.\00r\00e\00g\00i\00s\00t\00e\00r\00")
(data (i32.const 96) "\02\00\00\00\12\00\00\00\00\00\00\00\00\00\00\00g\00c\00.\00r\00e\00t\00a\00i\00n\00")
(data (i32.const 136) "\02\00\00\00,\00\00\00\00\00\00\00\00\00\00\00g\00c\00/\00r\00c\00/\00g\00l\00o\00b\00a\00l\00-\00a\00s\00s\00i\00g\00n\00.\00t\00s\00")
(data (i32.const 200) "\02\00\00\00\14\00\00\00\00\00\00\00\00\00\00\00g\00c\00.\00r\00e\00l\00e\00a\00s\00e\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $gc/rc/_dummy/collect_count (mut i32) (i32.const 0))
(global $gc/rc/_dummy/register_count (mut i32) (i32.const 0))
(global $gc/rc/_dummy/register_ref (mut i32) (i32.const 0))
(global $gc/rc/_dummy/retain_count (mut i32) (i32.const 0))
(global $gc/rc/_dummy/retain_ref (mut i32) (i32.const 0))
(global $gc/rc/_dummy/release_count (mut i32) (i32.const 0))
(global $gc/rc/_dummy/release_ref (mut i32) (i32.const 0))
(global $~lib/runtime/HEADER_SIZE i32 (i32.const 16))
(global $~lib/runtime/HEADER_MAGIC i32 (i32.const -1520547049))
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $~lib/ASC_NO_ASSERT i32 (i32.const 0))
(global $gc/rc/global-assign/global (mut i32) (i32.const 0))
(global $gc/rc/global-assign/globalRef (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/memory/HEAP_BASE i32 (i32.const 236))
(global $~lib/capabilities i32 (i32.const 2))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $gc/rc/global-assign/main))
(export ".capabilities" (global $~lib/capabilities))
(func $~lib/runtime/ADJUSTOBLOCK (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
i32.const 1
i32.const 32
local.get $0
global.get $~lib/runtime/HEADER_SIZE
i32.add
i32.const 1
i32.sub
i32.clz
i32.sub
i32.shl
)
(func $~lib/memory/memory.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 $4
i32.gt_u
select
i32.add
i32.const 7
i32.add
i32.const 7
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
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
end
end
local.get $3
global.set $~lib/allocator/arena/offset
local.get $2
end
return
)
(func $~lib/runtime/allocate (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
call $~lib/runtime/ADJUSTOBLOCK
call $~lib/memory/memory.allocate
local.set $1
local.get $1
global.get $~lib/runtime/HEADER_MAGIC
i32.store
local.get $1
local.get $0
i32.store offset=4
local.get $1
i32.const 0
i32.store offset=8
local.get $1
i32.const 0
i32.store offset=12
local.get $1
global.get $~lib/runtime/HEADER_SIZE
i32.add
)
(func $gc/rc/_dummy/__ref_register (; 5 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 72
i32.const 1
local.get $0
f64.convert_i32_u
f64.const 0
f64.const 0
f64.const 0
f64.const 0
call $~lib/env/trace
global.get $gc/rc/_dummy/register_count
i32.const 1
i32.add
global.set $gc/rc/_dummy/register_count
local.get $0
global.set $gc/rc/_dummy/register_ref
)
(func $~lib/runtime/register (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
global.get $~lib/memory/HEAP_BASE
i32.gt_u
i32.eqz
if
i32.const 0
i32.const 24
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $0
global.get $~lib/runtime/HEADER_SIZE
i32.sub
local.set $2
local.get $2
i32.load
global.get $~lib/runtime/HEADER_MAGIC
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $2
local.get $1
i32.store
local.get $0
call $gc/rc/_dummy/__ref_register
local.get $0
)
(func $gc/rc/global-assign/Ref#constructor (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.eqz
if
i32.const 0
call $~lib/runtime/allocate
i32.const 1
call $~lib/runtime/register
local.set $0
end
local.get $0
)
(func $gc/rc/_dummy/__ref_retain (; 8 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 112
i32.const 1
local.get $0
f64.convert_i32_u
f64.const 0
f64.const 0
f64.const 0
f64.const 0
call $~lib/env/trace
global.get $gc/rc/_dummy/retain_count
i32.const 1
i32.add
global.set $gc/rc/_dummy/retain_count
local.get $0
global.set $gc/rc/_dummy/retain_ref
)
(func $gc/rc/_dummy/__ref_release (; 9 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 216
i32.const 1
local.get $0
f64.convert_i32_u
f64.const 0
f64.const 0
f64.const 0
f64.const 0
call $~lib/env/trace
global.get $gc/rc/_dummy/release_count
i32.const 1
i32.add
global.set $gc/rc/_dummy/release_count
local.get $0
global.set $gc/rc/_dummy/release_ref
)
(func $start:gc/rc/global-assign (; 10 ;) (type $FUNCSIG$v)
(local $0 i32)
(local $1 i32)
global.get $~lib/memory/HEAP_BASE
i32.const 7
i32.add
i32.const 7
i32.const -1
i32.xor
i32.and
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
block (result i32)
i32.const 0
call $gc/rc/global-assign/Ref#constructor
local.set $0
local.get $0
call $gc/rc/_dummy/__ref_retain
local.get $0
end
global.set $gc/rc/global-assign/global
global.get $gc/rc/global-assign/global
global.set $gc/rc/global-assign/globalRef
global.get $gc/rc/_dummy/register_count
i32.const 1
i32.eq
i32.eqz
if
i32.const 0
i32.const 152
i32.const 12
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/retain_count
i32.const 1
i32.eq
i32.eqz
if
i32.const 0
i32.const 152
i32.const 13
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/retain_ref
global.get $gc/rc/global-assign/globalRef
i32.eq
i32.eqz
if
i32.const 0
i32.const 152
i32.const 14
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/release_count
i32.const 0
i32.eq
i32.eqz
if
i32.const 0
i32.const 152
i32.const 15
i32.const 0
call $~lib/env/abort
unreachable
end
i32.const 0
call $gc/rc/global-assign/Ref#constructor
local.tee $0
global.get $gc/rc/global-assign/global
local.tee $1
i32.ne
if (result i32)
local.get $1
if
local.get $1
call $gc/rc/_dummy/__ref_release
end
local.get $0
call $gc/rc/_dummy/__ref_retain
local.get $0
else
local.get $0
end
global.set $gc/rc/global-assign/global
global.get $gc/rc/_dummy/register_count
i32.const 2
i32.eq
i32.eqz
if
i32.const 0
i32.const 152
i32.const 20
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/retain_count
i32.const 2
i32.eq
i32.eqz
if
i32.const 0
i32.const 152
i32.const 21
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/retain_ref
global.get $gc/rc/global-assign/global
i32.eq
i32.eqz
if
i32.const 0
i32.const 152
i32.const 22
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/release_count
i32.const 1
i32.eq
i32.eqz
if
i32.const 0
i32.const 152
i32.const 23
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/release_ref
global.get $gc/rc/global-assign/globalRef
i32.eq
i32.eqz
if
i32.const 0
i32.const 152
i32.const 24
i32.const 0
call $~lib/env/abort
unreachable
end
)
(func $gc/rc/global-assign/main (; 11 ;) (type $FUNCSIG$v)
global.get $~lib/started
i32.eqz
if
call $start
i32.const 1
global.set $~lib/started
end
)
(func $start (; 12 ;) (type $FUNCSIG$v)
call $start:gc/rc/global-assign
)
(func $null (; 13 ;) (type $FUNCSIG$v)
)
)

View File

@ -0,0 +1,253 @@
(module
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$viiddddd (func (param i32 i32 f64 f64 f64 f64 f64)))
(type $FUNCSIG$v (func))
(type $FUNCSIG$i (func (result i32)))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64)))
(memory $0 1)
(data (i32.const 8) "\02\00\00\00\1e")
(data (i32.const 24) "~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s")
(data (i32.const 56) "\02\00\00\00\16")
(data (i32.const 72) "g\00c\00.\00r\00e\00g\00i\00s\00t\00e\00r")
(data (i32.const 96) "\02\00\00\00\12")
(data (i32.const 112) "g\00c\00.\00r\00e\00t\00a\00i\00n")
(data (i32.const 136) "\02\00\00\00(")
(data (i32.const 152) "g\00c\00/\00r\00c\00/\00g\00l\00o\00b\00a\00l\00-\00i\00n\00i\00t\00.\00t\00s")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $gc/rc/_dummy/register_count (mut i32) (i32.const 0))
(global $gc/rc/_dummy/register_ref (mut i32) (i32.const 0))
(global $gc/rc/_dummy/retain_count (mut i32) (i32.const 0))
(global $gc/rc/_dummy/retain_ref (mut i32) (i32.const 0))
(global $gc/rc/_dummy/release_count (mut i32) (i32.const 0))
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $gc/rc/global-init/global (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/capabilities i32 (i32.const 2))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $gc/rc/global-init/main))
(export ".capabilities" (global $~lib/capabilities))
(func $~lib/memory/memory.allocate (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
local.get $0
i32.const 1073741824
i32.gt_u
if
unreachable
end
global.get $~lib/allocator/arena/offset
local.tee $1
local.get $0
i32.const 1
local.get $0
i32.const 1
i32.gt_u
select
i32.add
i32.const 7
i32.add
i32.const -8
i32.and
local.tee $0
current_memory
local.tee $2
i32.const 16
i32.shl
i32.gt_u
if
local.get $2
local.get $0
local.get $1
i32.sub
i32.const 65535
i32.add
i32.const -65536
i32.and
i32.const 16
i32.shr_u
local.tee $3
local.get $2
local.get $3
i32.gt_s
select
grow_memory
i32.const 0
i32.lt_s
if
local.get $3
grow_memory
i32.const 0
i32.lt_s
if
unreachable
end
end
end
local.get $0
global.set $~lib/allocator/arena/offset
local.get $1
)
(func $~lib/runtime/allocate (; 3 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
i32.const 16
call $~lib/memory/memory.allocate
local.tee $0
i32.const -1520547049
i32.store
local.get $0
i32.const 0
i32.store offset=4
local.get $0
i32.const 0
i32.store offset=8
local.get $0
i32.const 0
i32.store offset=12
local.get $0
i32.const 16
i32.add
)
(func $gc/rc/_dummy/__ref_register (; 4 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 72
i32.const 1
local.get $0
f64.convert_i32_u
f64.const 0
f64.const 0
f64.const 0
f64.const 0
call $~lib/env/trace
global.get $gc/rc/_dummy/register_count
i32.const 1
i32.add
global.set $gc/rc/_dummy/register_count
local.get $0
global.set $gc/rc/_dummy/register_ref
)
(func $~lib/runtime/register (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.const 192
i32.le_u
if
i32.const 0
i32.const 24
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $0
i32.const 16
i32.sub
local.tee $1
i32.load
i32.const -1520547049
i32.ne
if
i32.const 0
i32.const 24
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $1
i32.const 1
i32.store
local.get $0
call $gc/rc/_dummy/__ref_register
local.get $0
)
(func $gc/rc/_dummy/__ref_retain (; 6 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 112
i32.const 1
local.get $0
f64.convert_i32_u
f64.const 0
f64.const 0
f64.const 0
f64.const 0
call $~lib/env/trace
global.get $gc/rc/_dummy/retain_count
i32.const 1
i32.add
global.set $gc/rc/_dummy/retain_count
local.get $0
global.set $gc/rc/_dummy/retain_ref
)
(func $start:gc/rc/global-init (; 7 ;) (type $FUNCSIG$v)
(local $0 i32)
i32.const 192
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
call $~lib/runtime/allocate
call $~lib/runtime/register
local.tee $0
call $gc/rc/_dummy/__ref_retain
local.get $0
global.set $gc/rc/global-init/global
global.get $gc/rc/_dummy/register_count
i32.const 1
i32.ne
if
i32.const 0
i32.const 152
i32.const 11
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/retain_count
i32.const 1
i32.ne
if
i32.const 0
i32.const 152
i32.const 12
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/retain_ref
global.get $gc/rc/global-init/global
i32.ne
if
i32.const 0
i32.const 152
i32.const 13
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/release_count
if
i32.const 0
i32.const 152
i32.const 14
i32.const 0
call $~lib/env/abort
unreachable
end
)
(func $gc/rc/global-init/main (; 8 ;) (type $FUNCSIG$v)
global.get $~lib/started
i32.eqz
if
call $start:gc/rc/global-init
i32.const 1
global.set $~lib/started
end
)
(func $null (; 9 ;) (type $FUNCSIG$v)
nop
)
)

View File

@ -0,0 +1,14 @@
import "allocator/arena";
import { register_count, retain_count, retain_ref, release_count } from "./_dummy";
@start export function main(): void {}
class Ref {}
// should register and retain, with nothing to release
var global = new Ref();
assert(register_count == 1);
assert(retain_count == 1);
assert(retain_ref == changetype<usize>(global));
assert(release_count == 0);

View File

@ -0,0 +1,324 @@
(module
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$viiddddd (func (param i32 i32 f64 f64 f64 f64 f64)))
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64)))
(memory $0 1)
(data (i32.const 8) "\02\00\00\00\1e\00\00\00\00\00\00\00\00\00\00\00~\00l\00i\00b\00/\00r\00u\00n\00t\00i\00m\00e\00.\00t\00s\00")
(data (i32.const 56) "\02\00\00\00\16\00\00\00\00\00\00\00\00\00\00\00g\00c\00.\00r\00e\00g\00i\00s\00t\00e\00r\00")
(data (i32.const 96) "\02\00\00\00\12\00\00\00\00\00\00\00\00\00\00\00g\00c\00.\00r\00e\00t\00a\00i\00n\00")
(data (i32.const 136) "\02\00\00\00(\00\00\00\00\00\00\00\00\00\00\00g\00c\00/\00r\00c\00/\00g\00l\00o\00b\00a\00l\00-\00i\00n\00i\00t\00.\00t\00s\00")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $gc/rc/_dummy/collect_count (mut i32) (i32.const 0))
(global $gc/rc/_dummy/register_count (mut i32) (i32.const 0))
(global $gc/rc/_dummy/register_ref (mut i32) (i32.const 0))
(global $gc/rc/_dummy/retain_count (mut i32) (i32.const 0))
(global $gc/rc/_dummy/retain_ref (mut i32) (i32.const 0))
(global $gc/rc/_dummy/release_count (mut i32) (i32.const 0))
(global $gc/rc/_dummy/release_ref (mut i32) (i32.const 0))
(global $~lib/runtime/HEADER_SIZE i32 (i32.const 16))
(global $~lib/runtime/HEADER_MAGIC i32 (i32.const -1520547049))
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $~lib/ASC_NO_ASSERT i32 (i32.const 0))
(global $gc/rc/global-init/global (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/memory/HEAP_BASE i32 (i32.const 192))
(global $~lib/capabilities i32 (i32.const 2))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $gc/rc/global-init/main))
(export ".capabilities" (global $~lib/capabilities))
(func $~lib/runtime/ADJUSTOBLOCK (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
i32.const 1
i32.const 32
local.get $0
global.get $~lib/runtime/HEADER_SIZE
i32.add
i32.const 1
i32.sub
i32.clz
i32.sub
i32.shl
)
(func $~lib/memory/memory.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 $4
i32.gt_u
select
i32.add
i32.const 7
i32.add
i32.const 7
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
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
end
end
local.get $3
global.set $~lib/allocator/arena/offset
local.get $2
end
return
)
(func $~lib/runtime/allocate (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
call $~lib/runtime/ADJUSTOBLOCK
call $~lib/memory/memory.allocate
local.set $1
local.get $1
global.get $~lib/runtime/HEADER_MAGIC
i32.store
local.get $1
local.get $0
i32.store offset=4
local.get $1
i32.const 0
i32.store offset=8
local.get $1
i32.const 0
i32.store offset=12
local.get $1
global.get $~lib/runtime/HEADER_SIZE
i32.add
)
(func $gc/rc/_dummy/__ref_register (; 5 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 72
i32.const 1
local.get $0
f64.convert_i32_u
f64.const 0
f64.const 0
f64.const 0
f64.const 0
call $~lib/env/trace
global.get $gc/rc/_dummy/register_count
i32.const 1
i32.add
global.set $gc/rc/_dummy/register_count
local.get $0
global.set $gc/rc/_dummy/register_ref
)
(func $~lib/runtime/register (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
global.get $~lib/memory/HEAP_BASE
i32.gt_u
i32.eqz
if
i32.const 0
i32.const 24
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $0
global.get $~lib/runtime/HEADER_SIZE
i32.sub
local.set $2
local.get $2
i32.load
global.get $~lib/runtime/HEADER_MAGIC
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
end
local.get $2
local.get $1
i32.store
local.get $0
call $gc/rc/_dummy/__ref_register
local.get $0
)
(func $gc/rc/global-init/Ref#constructor (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.eqz
if
i32.const 0
call $~lib/runtime/allocate
i32.const 1
call $~lib/runtime/register
local.set $0
end
local.get $0
)
(func $gc/rc/_dummy/__ref_retain (; 8 ;) (type $FUNCSIG$vi) (param $0 i32)
i32.const 112
i32.const 1
local.get $0
f64.convert_i32_u
f64.const 0
f64.const 0
f64.const 0
f64.const 0
call $~lib/env/trace
global.get $gc/rc/_dummy/retain_count
i32.const 1
i32.add
global.set $gc/rc/_dummy/retain_count
local.get $0
global.set $gc/rc/_dummy/retain_ref
)
(func $start:gc/rc/global-init (; 9 ;) (type $FUNCSIG$v)
(local $0 i32)
global.get $~lib/memory/HEAP_BASE
i32.const 7
i32.add
i32.const 7
i32.const -1
i32.xor
i32.and
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
block (result i32)
i32.const 0
call $gc/rc/global-init/Ref#constructor
local.set $0
local.get $0
call $gc/rc/_dummy/__ref_retain
local.get $0
end
global.set $gc/rc/global-init/global
global.get $gc/rc/_dummy/register_count
i32.const 1
i32.eq
i32.eqz
if
i32.const 0
i32.const 152
i32.const 11
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/retain_count
i32.const 1
i32.eq
i32.eqz
if
i32.const 0
i32.const 152
i32.const 12
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/retain_ref
global.get $gc/rc/global-init/global
i32.eq
i32.eqz
if
i32.const 0
i32.const 152
i32.const 13
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $gc/rc/_dummy/release_count
i32.const 0
i32.eq
i32.eqz
if
i32.const 0
i32.const 152
i32.const 14
i32.const 0
call $~lib/env/abort
unreachable
end
)
(func $gc/rc/global-init/main (; 10 ;) (type $FUNCSIG$v)
global.get $~lib/started
i32.eqz
if
call $start
i32.const 1
global.set $~lib/started
end
)
(func $start (; 11 ;) (type $FUNCSIG$v)
call $start:gc/rc/global-init
)
(func $null (; 12 ;) (type $FUNCSIG$v)
)
)

View File

@ -85,7 +85,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -100,7 +100,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -142,7 +142,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -159,7 +159,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -170,22 +170,13 @@
local.get $0
)
(func $getter-call/C#constructor (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<C>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 1
call $~lib/runtime/register
end
i32.const 0
call $~lib/runtime/allocate
i32.const 1
call $~lib/runtime/register
local.set $0
end
local.get $0

View File

@ -131,7 +131,7 @@
if
i32.const 0
i32.const 48
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -146,7 +146,7 @@
if
i32.const 0
i32.const 48
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -406,7 +406,7 @@
if
i32.const 0
i32.const 48
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -423,7 +423,7 @@
if
i32.const 0
i32.const 48
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -439,7 +439,6 @@
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
block $inlining/Bar#constructor|inlined.0 (result i32)
i32.const 0
local.set $1
@ -450,14 +449,8 @@
if (result i32)
local.get $1
else
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
i32.const 16
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 16
call $~lib/runtime/allocate
i32.const 2
call $~lib/runtime/register
end
@ -468,18 +461,10 @@
local.get $3
i32.eqz
if
block $~lib/runtime/REGISTER<Baz>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
i32.const 8
local.set $4
local.get $4
call $~lib/runtime/allocate
end
local.set $4
local.get $4
i32.const 3
call $~lib/runtime/register
end
i32.const 8
call $~lib/runtime/allocate
i32.const 3
call $~lib/runtime/register
local.set $3
end
local.get $3
@ -506,8 +491,8 @@
i32.store offset=12
local.get $1
end
local.set $5
local.get $5
local.set $4
local.get $4
i32.load
i32.const 1
i32.eq
@ -520,7 +505,7 @@
call $~lib/env/abort
unreachable
end
local.get $5
local.get $4
i32.load offset=4
i32.const 2
i32.eq
@ -533,7 +518,7 @@
call $~lib/env/abort
unreachable
end
local.get $5
local.get $4
i32.load offset=8
i32.const 3
i32.eq
@ -546,7 +531,7 @@
call $~lib/env/abort
unreachable
end
local.get $5
local.get $4
i32.load offset=12
i32.const 4
i32.eq

View File

@ -56,7 +56,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -73,7 +73,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -84,22 +84,13 @@
local.get $0
)
(func $new-without-allocator/A#constructor (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<A>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 1
call $~lib/runtime/register
end
i32.const 0
call $~lib/runtime/allocate
i32.const 1
call $~lib/runtime/register
local.set $0
end
local.get $0

View File

@ -303,7 +303,7 @@
if
i32.const 0
i32.const 464
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -318,7 +318,7 @@
if
i32.const 0
i32.const 464
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -2516,7 +2516,7 @@
if
i32.const 0
i32.const 464
i32.const 185
i32.const 175
i32.const 4
call $~lib/env/abort
unreachable
@ -2530,7 +2530,7 @@
if
i32.const 0
i32.const 464
i32.const 187
i32.const 177
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -400,7 +400,7 @@
if
i32.const 0
i32.const 464
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -417,7 +417,7 @@
if
i32.const 0
i32.const 464
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -3549,7 +3549,7 @@
if
i32.const 0
i32.const 464
i32.const 185
i32.const 175
i32.const 4
call $~lib/env/abort
unreachable
@ -3566,7 +3566,7 @@
if
i32.const 0
i32.const 464
i32.const 187
i32.const 177
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -107,7 +107,7 @@
if
i32.const 0
i32.const 48
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -122,7 +122,7 @@
if
i32.const 0
i32.const 48
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -143,7 +143,7 @@
if
i32.const 0
i32.const 48
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -160,7 +160,7 @@
if
i32.const 0
i32.const 48
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -337,7 +337,6 @@
(local $0 i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
global.get $~lib/memory/HEAP_BASE
i32.const 7
i32.add
@ -349,18 +348,10 @@
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
block (result i32)
block $~lib/runtime/REGISTER<Foo>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
i32.const 8
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 2
call $~lib/runtime/register
end
i32.const 8
call $~lib/runtime/allocate
i32.const 2
call $~lib/runtime/register
local.set $0
local.get $0
i32.const 1
@ -372,18 +363,10 @@
end
call $object-literal/bar
block (result i32)
block $~lib/runtime/REGISTER<Foo2>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
i32.const 4
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 3
call $~lib/runtime/register
end
i32.const 4
call $~lib/runtime/allocate
i32.const 3
call $~lib/runtime/register
local.set $1
local.get $1
i32.const 2
@ -392,18 +375,10 @@
end
call $object-literal/bar2
block (result i32)
block $~lib/runtime/REGISTER<Foo2>|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.2 (result i32)
i32.const 4
local.set $3
local.get $3
call $~lib/runtime/allocate
end
local.set $3
local.get $3
i32.const 3
call $~lib/runtime/register
end
i32.const 4
call $~lib/runtime/allocate
i32.const 3
call $~lib/runtime/register
local.set $2
local.get $2
i32.const 3

View File

@ -100,7 +100,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -115,7 +115,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -149,7 +149,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -166,7 +166,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -177,22 +177,13 @@
local.get $0
)
(func $optional-typeparameters/TestConcrete<i32,i32>#constructor (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<TestConcrete<i32,i32>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 1
call $~lib/runtime/register
end
i32.const 0
call $~lib/runtime/allocate
i32.const 1
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -203,22 +194,13 @@
i32.add
)
(func $optional-typeparameters/TestDerived<f64,f64>#constructor (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<TestDerived<f64,f64>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 3
call $~lib/runtime/register
end
i32.const 0
call $~lib/runtime/allocate
i32.const 3
call $~lib/runtime/register
local.set $0
end
local.get $0

View File

@ -1,21 +1,12 @@
(module
(type $FUNCSIG$v (func))
(memory $0 1)
(data (i32.const 8) "\07\00\00\00s\00i\00m\00d\00.\00t\00s")
(data (i32.const 8) "\01\00\00\00\0e\00\00\00s\00i\00m\00d\00.\00t\00s")
(table $0 1 funcref)
(elem (i32.const 0) $null)
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(elem (i32.const 0) $start)
(export "memory" (memory $0))
(export "table" (table $0))
(start $start)
(func $start (; 0 ;) (type $FUNCSIG$v)
i32.const 32
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
)
(func $null (; 1 ;) (type $FUNCSIG$v)
nop
)
)

View File

@ -1,7 +1,5 @@
// hint: asc tests/compiler/simd --enable simd --validate
import "allocator/arena";
function test_v128(): void {
// equality and inequality
assert(

File diff suppressed because it is too large Load Diff

View File

@ -177,7 +177,7 @@
if
i32.const 0
i32.const 296
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -192,7 +192,7 @@
if
i32.const 0
i32.const 296
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -234,7 +234,7 @@
if
i32.const 0
i32.const 296
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -251,7 +251,7 @@
if
i32.const 0
i32.const 296
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -1710,15 +1710,15 @@
(local $9 i32)
i32.const 16
call $~lib/runtime/allocate
local.get $2
local.get $1
call $~lib/runtime/register
local.set $4
local.get $0
local.get $3
local.get $2
i32.shl
local.set $5
local.get $0
local.get $3
local.get $2
i32.shl
call $~lib/runtime/allocate
i32.const 1
@ -1756,32 +1756,23 @@
local.get $4
local.get $0
i32.store offset=12
local.get $1
local.get $3
if
local.get $6
local.get $1
local.get $3
local.get $5
call $~lib/memory/memory.copy
end
local.get $4
)
(func $std/array-literal/Ref#constructor (; 17 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Ref>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 5
call $~lib/runtime/register
end
i32.const 0
call $~lib/runtime/allocate
i32.const 5
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -1791,22 +1782,13 @@
i32.load offset=12
)
(func $std/array-literal/RefWithCtor#constructor (; 19 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<RefWithCtor>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
i32.const 0
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 7
call $~lib/runtime/register
end
i32.const 0
call $~lib/runtime/allocate
i32.const 7
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -1819,7 +1801,6 @@
(local $0 i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
global.get $std/array-literal/staticArrayI8
call $~lib/array/Array<i8>#get:length
i32.const 3
@ -1954,17 +1935,11 @@
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
block (result i32)
block $~lib/runtime/MAKEARRAY<i8>|inlined.0 (result i32)
i32.const 3
local.set $2
i32.const 0
local.set $3
local.get $2
local.get $3
i32.const 2
i32.const 0
call $~lib/runtime/makeArray
end
i32.const 3
i32.const 2
i32.const 0
i32.const 0
call $~lib/runtime/makeArray
local.set $0
local.get $0
i32.load offset=4
@ -1977,9 +1952,9 @@
global.get $std/array-literal/i
i32.const 1
i32.add
local.tee $3
local.tee $2
global.set $std/array-literal/i
local.get $3
local.get $2
end
i32.store8 offset=1
local.get $1
@ -1987,9 +1962,9 @@
global.get $std/array-literal/i
i32.const 1
i32.add
local.tee $3
local.tee $2
global.set $std/array-literal/i
local.get $3
local.get $2
end
i32.store8 offset=2
local.get $0
@ -2053,17 +2028,11 @@
i32.const 0
global.set $std/array-literal/i
block (result i32)
block $~lib/runtime/MAKEARRAY<i32>|inlined.0 (result i32)
i32.const 3
local.set $3
i32.const 0
local.set $2
local.get $3
local.get $2
i32.const 4
i32.const 2
call $~lib/runtime/makeArray
end
i32.const 3
i32.const 4
i32.const 2
i32.const 0
call $~lib/runtime/makeArray
local.set $1
local.get $1
i32.load offset=4
@ -2150,17 +2119,11 @@
unreachable
end
block (result i32)
block $~lib/runtime/MAKEARRAY<Ref>|inlined.0 (result i32)
i32.const 3
local.set $2
i32.const 0
local.set $3
local.get $2
local.get $3
i32.const 6
i32.const 2
call $~lib/runtime/makeArray
end
i32.const 3
i32.const 6
i32.const 2
i32.const 0
call $~lib/runtime/makeArray
local.set $0
local.get $0
i32.load offset=4
@ -2169,33 +2132,33 @@
block (result i32)
i32.const 0
call $std/array-literal/Ref#constructor
local.set $3
local.get $3
local.set $2
local.get $2
local.get $0
call $~lib/collector/dummy/__ref_link
local.get $3
local.get $2
end
i32.store
local.get $1
block (result i32)
i32.const 0
call $std/array-literal/Ref#constructor
local.set $3
local.get $3
local.set $2
local.get $2
local.get $0
call $~lib/collector/dummy/__ref_link
local.get $3
local.get $2
end
i32.store offset=4
local.get $1
block (result i32)
i32.const 0
call $std/array-literal/Ref#constructor
local.set $3
local.get $3
local.set $2
local.get $2
local.get $0
call $~lib/collector/dummy/__ref_link
local.get $3
local.get $2
end
i32.store offset=8
local.get $0
@ -2215,17 +2178,11 @@
unreachable
end
block (result i32)
block $~lib/runtime/MAKEARRAY<RefWithCtor>|inlined.0 (result i32)
i32.const 3
local.set $3
i32.const 0
local.set $2
local.get $3
local.get $2
i32.const 8
i32.const 2
call $~lib/runtime/makeArray
end
i32.const 3
i32.const 8
i32.const 2
i32.const 0
call $~lib/runtime/makeArray
local.set $1
local.get $1
i32.load offset=4

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -326,7 +326,7 @@
if
i32.const 0
i32.const 64
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -341,7 +341,7 @@
if
i32.const 0
i32.const 64
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -1547,7 +1547,7 @@
if
i32.const 0
i32.const 64
i32.const 244
i32.const 234
i32.const 57
call $~lib/env/abort
unreachable

View File

@ -408,7 +408,7 @@
if
i32.const 0
i32.const 64
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -425,7 +425,7 @@
if
i32.const 0
i32.const 64
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -2037,7 +2037,6 @@
)
(func $~lib/runtime/ArrayBufferView#constructor (; 16 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(local $4 i32)
local.get $1
global.get $~lib/runtime/MAX_BYTELENGTH
local.get $2
@ -2046,7 +2045,7 @@
if
i32.const 0
i32.const 64
i32.const 244
i32.const 234
i32.const 57
call $~lib/env/abort
unreachable
@ -2062,18 +2061,10 @@
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<ArrayBufferView>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.2 (result i32)
i32.const 12
local.set $4
local.get $4
call $~lib/runtime/allocate
end
local.set $4
local.get $4
i32.const 3
call $~lib/runtime/register
end
i32.const 12
call $~lib/runtime/allocate
i32.const 3
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -2098,19 +2089,12 @@
local.get $0
)
(func $~lib/typedarray/Uint8Array#constructor (; 17 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.3 (result i32)
i32.const 12
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 12
call $~lib/runtime/allocate
i32.const 4
call $~lib/runtime/register
end
@ -2126,15 +2110,15 @@
(local $6 i32)
i32.const 16
call $~lib/runtime/allocate
local.get $2
local.get $1
call $~lib/runtime/register
local.set $4
local.get $0
local.get $3
local.get $2
i32.shl
local.set $5
local.get $0
local.get $3
local.get $2
i32.shl
call $~lib/runtime/allocate
i32.const 2
@ -2152,29 +2136,22 @@
local.get $4
local.get $0
i32.store offset=12
local.get $1
local.get $3
if
local.get $6
local.get $1
local.get $3
local.get $5
call $~lib/memory/memory.copy
end
local.get $4
)
(func $~lib/typedarray/Int32Array#constructor (; 19 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.4 (result i32)
i32.const 12
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 12
call $~lib/runtime/allocate
i32.const 6
call $~lib/runtime/register
end
@ -2186,7 +2163,6 @@
)
(func $~lib/dataview/DataView#constructor (; 20 ;) (type $FUNCSIG$iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
(local $4 i32)
(local $5 i32)
local.get $3
global.get $~lib/builtins/i32.MIN_VALUE
i32.eq
@ -2219,18 +2195,10 @@
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<DataView>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.5 (result i32)
i32.const 12
local.set $4
local.get $4
call $~lib/runtime/allocate
end
local.set $4
local.get $4
i32.const 7
call $~lib/runtime/register
end
i32.const 12
call $~lib/runtime/allocate
i32.const 7
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -2249,9 +2217,9 @@
local.get $1
local.get $2
i32.add
local.set $5
local.set $4
local.get $0
local.get $5
local.get $4
i32.store offset=4
local.get $0
local.get $3
@ -2263,8 +2231,6 @@
i32.load
)
(func $start:std/arraybuffer (; 22 ;) (type $FUNCSIG$v)
(local $0 i32)
(local $1 i32)
global.get $~lib/memory/HEAP_BASE
i32.const 7
i32.add
@ -2524,17 +2490,11 @@
i32.const 1
call $~lib/typedarray/Uint8Array#constructor
global.set $std/arraybuffer/arr8
block $~lib/runtime/MAKEARRAY<i32>|inlined.0 (result i32)
i32.const 2
local.set $0
i32.const 152
local.set $1
local.get $0
local.get $1
i32.const 5
i32.const 2
call $~lib/runtime/makeArray
end
i32.const 2
i32.const 5
i32.const 2
i32.const 152
call $~lib/runtime/makeArray
call $~lib/arraybuffer/ArrayBuffer.isView<Array<i32>>
i32.eqz
i32.eqz

View File

@ -164,7 +164,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -179,7 +179,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -414,7 +414,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -431,7 +431,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -476,7 +476,6 @@
)
(func $~lib/runtime/ArrayBufferView#constructor (; 7 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(local $4 i32)
local.get $1
global.get $~lib/runtime/MAX_BYTELENGTH
local.get $2
@ -485,7 +484,7 @@
if
i32.const 0
i32.const 16
i32.const 244
i32.const 234
i32.const 57
call $~lib/env/abort
unreachable
@ -501,18 +500,10 @@
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<ArrayBufferView>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
i32.const 12
local.set $4
local.get $4
call $~lib/runtime/allocate
end
local.set $4
local.get $4
i32.const 3
call $~lib/runtime/register
end
i32.const 12
call $~lib/runtime/allocate
i32.const 3
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -537,19 +528,12 @@
local.get $0
)
(func $~lib/typedarray/Uint8Array#constructor (; 8 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.2 (result i32)
i32.const 12
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 12
call $~lib/runtime/allocate
i32.const 4
call $~lib/runtime/register
end
@ -587,7 +571,6 @@
)
(func $~lib/dataview/DataView#constructor (; 11 ;) (type $FUNCSIG$iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32)
(local $4 i32)
(local $5 i32)
local.get $3
global.get $~lib/builtins/i32.MIN_VALUE
i32.eq
@ -620,18 +603,10 @@
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<DataView>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.3 (result i32)
i32.const 12
local.set $4
local.get $4
call $~lib/runtime/allocate
end
local.set $4
local.get $4
i32.const 5
call $~lib/runtime/register
end
i32.const 12
call $~lib/runtime/allocate
i32.const 5
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -650,9 +625,9 @@
local.get $1
local.get $2
i32.add
local.set $5
local.set $4
local.get $0
local.get $5
local.get $4
i32.store offset=4
local.get $0
local.get $3

View File

@ -89,7 +89,7 @@
if
i32.const 0
i32.const 48
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -104,7 +104,7 @@
if
i32.const 0
i32.const 48
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -149,7 +149,7 @@
if
i32.const 0
i32.const 48
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -166,7 +166,7 @@
if
i32.const 0
i32.const 48
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -177,23 +177,14 @@
local.get $0
)
(func $~lib/date/Date#constructor (; 7 ;) (type $FUNCSIG$iij) (param $0 i32) (param $1 i64) (result i32)
(local $2 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Date>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
i32.const 8
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 2
call $~lib/runtime/register
end
i32.const 8
call $~lib/runtime/allocate
i32.const 2
call $~lib/runtime/register
local.set $0
end
local.get $0

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
import "allocator/arena";
import "collector/itcm";
class Foo {
}
var arr: Foo[] = [];
gc.collect(); // should do nothing
arr[0] = {};
gc.collect(); // should do nothing
arr[1] = {};
gc.collect(); // should do nothing
arr[0] = {};
gc.collect(); // should collect the old one
@start
export function main(): i32 { return 0; }

File diff suppressed because it is too large Load Diff

View File

@ -1,481 +0,0 @@
(module
(type $FUNCSIG$v (func))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vii (func (param i32 i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$i (func (result i32)))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data (i32.const 16) "\03\00\00\00\00\00\00\00\10\00\00\00s\00t\00d\00/\00g\00c\00-\00b\00a\00s\00i\00c\00s\00.\00t\00s")
(table $0 4 funcref)
(elem (i32.const 0) $null $std/gc-basics/MyObject_visit $~lib/collector/itcm/__gc_mark $~lib/string/String~gc)
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $~lib/collector/itcm/state (mut i32) (i32.const 0))
(global $~lib/collector/itcm/white (mut i32) (i32.const 0))
(global $~lib/collector/itcm/fromSpace (mut i32) (i32.const 0))
(global $~lib/collector/itcm/toSpace (mut i32) (i32.const 0))
(global $~lib/collector/itcm/iter (mut i32) (i32.const 0))
(global $~lib/argc (mut i32) (i32.const 0))
(global $std/gc-basics/obj (mut i32) (i32.const 0))
(global $std/gc-basics/obj2 (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $std/gc-basics/main))
(func $std/gc-basics/MyObject_visit (; 1 ;) (type $FUNCSIG$vi) (param $0 i32)
nop
)
(func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
local.get $0
i32.const 1073741824
i32.gt_u
if
unreachable
end
global.get $~lib/allocator/arena/offset
local.tee $1
local.get $0
i32.const 1
local.get $0
i32.const 1
i32.gt_u
select
i32.add
i32.const 7
i32.add
i32.const -8
i32.and
local.tee $2
current_memory
local.tee $3
i32.const 16
i32.shl
i32.gt_u
if
local.get $3
local.get $2
local.get $1
i32.sub
i32.const 65535
i32.add
i32.const -65536
i32.and
i32.const 16
i32.shr_u
local.tee $0
local.get $3
local.get $0
i32.gt_s
select
grow_memory
i32.const 0
i32.lt_s
if
local.get $0
grow_memory
i32.const 0
i32.lt_s
if
unreachable
end
end
end
local.get $2
global.set $~lib/allocator/arena/offset
local.get $1
)
(func $~lib/collector/itcm/ManagedObjectList#push (; 3 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
local.get $0
i32.load offset=4
local.set $2
local.get $1
local.get $1
i32.load
i32.const 3
i32.and
local.get $0
i32.or
i32.store
local.get $1
local.get $2
i32.store offset=4
local.get $2
local.get $2
i32.load
i32.const 3
i32.and
local.get $1
i32.or
i32.store
local.get $0
local.get $1
i32.store offset=4
)
(func $~lib/collector/itcm/ManagedObject#makeGray (; 4 ;) (type $FUNCSIG$vi) (param $0 i32)
(local $1 i32)
(local $2 i32)
global.get $~lib/collector/itcm/iter
local.get $0
i32.eq
if
local.get $0
i32.load offset=4
global.set $~lib/collector/itcm/iter
end
local.get $0
i32.load
i32.const -4
i32.and
local.tee $2
local.get $0
i32.load offset=4
local.tee $1
i32.store offset=4
local.get $1
local.get $1
i32.load
i32.const 3
i32.and
local.get $2
i32.or
i32.store
global.get $~lib/collector/itcm/toSpace
local.get $0
call $~lib/collector/itcm/ManagedObjectList#push
local.get $0
local.get $0
i32.load
i32.const -4
i32.and
i32.const 2
i32.or
i32.store
)
(func $~lib/collector/itcm/__gc_mark (; 5 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
if
global.get $~lib/collector/itcm/white
local.get $0
i32.const 16
i32.sub
local.tee $0
i32.load
i32.const 3
i32.and
i32.eq
if
local.get $0
call $~lib/collector/itcm/ManagedObject#makeGray
end
end
)
(func $~lib/collector/itcm/step (; 6 ;) (type $FUNCSIG$v)
(local $0 i32)
block $break|0
block $case3|0
block $case2|0
block $case1|0
global.get $~lib/collector/itcm/state
local.tee $0
if
local.get $0
i32.const 1
i32.sub
br_table $case1|0 $case2|0 $case3|0 $break|0
end
i32.const 16
call $~lib/allocator/arena/__memory_allocate
global.set $~lib/collector/itcm/fromSpace
global.get $~lib/collector/itcm/fromSpace
local.tee $0
i32.const -1
i32.store offset=8
local.get $0
local.get $0
i32.store
local.get $0
local.get $0
i32.store offset=4
i32.const 16
call $~lib/allocator/arena/__memory_allocate
global.set $~lib/collector/itcm/toSpace
global.get $~lib/collector/itcm/toSpace
local.tee $0
i32.const -1
i32.store offset=8
local.get $0
local.get $0
i32.store
local.get $0
local.get $0
i32.store offset=4
global.get $~lib/collector/itcm/toSpace
global.set $~lib/collector/itcm/iter
i32.const 1
global.set $~lib/collector/itcm/state
end
global.get $std/gc-basics/obj
i32.const 2
call_indirect (type $FUNCSIG$vi)
global.get $std/gc-basics/obj2
i32.const 2
call_indirect (type $FUNCSIG$vi)
i32.const 2
global.set $~lib/collector/itcm/state
br $break|0
end
global.get $~lib/collector/itcm/iter
i32.load
i32.const -4
i32.and
local.tee $0
global.get $~lib/collector/itcm/toSpace
i32.ne
if
local.get $0
global.set $~lib/collector/itcm/iter
local.get $0
global.get $~lib/collector/itcm/white
i32.eqz
local.get $0
i32.load
i32.const -4
i32.and
i32.or
i32.store
i32.const 1
global.set $~lib/argc
local.get $0
i32.const 16
i32.add
local.get $0
i32.load offset=8
call_indirect (type $FUNCSIG$vi)
else
global.get $std/gc-basics/obj
i32.const 2
call_indirect (type $FUNCSIG$vi)
global.get $std/gc-basics/obj2
i32.const 2
call_indirect (type $FUNCSIG$vi)
global.get $~lib/collector/itcm/toSpace
global.get $~lib/collector/itcm/iter
i32.load
i32.const -4
i32.and
i32.eq
if
global.get $~lib/collector/itcm/fromSpace
local.set $0
global.get $~lib/collector/itcm/toSpace
global.set $~lib/collector/itcm/fromSpace
local.get $0
global.set $~lib/collector/itcm/toSpace
global.get $~lib/collector/itcm/white
i32.eqz
global.set $~lib/collector/itcm/white
local.get $0
i32.load
i32.const -4
i32.and
global.set $~lib/collector/itcm/iter
i32.const 3
global.set $~lib/collector/itcm/state
end
end
br $break|0
end
global.get $~lib/collector/itcm/iter
local.tee $0
global.get $~lib/collector/itcm/toSpace
i32.ne
if
local.get $0
i32.load
i32.const -4
i32.and
global.set $~lib/collector/itcm/iter
else
global.get $~lib/collector/itcm/toSpace
local.tee $0
local.get $0
i32.store
local.get $0
local.get $0
i32.store offset=4
i32.const 1
global.set $~lib/collector/itcm/state
end
end
)
(func $~lib/collector/itcm/__gc_allocate (; 7 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
call $~lib/collector/itcm/step
i32.const 20
call $~lib/allocator/arena/__memory_allocate
local.tee $0
i32.const 1
i32.store offset=8
local.get $0
global.get $~lib/collector/itcm/white
local.get $0
i32.load
i32.const -4
i32.and
i32.or
i32.store
global.get $~lib/collector/itcm/fromSpace
local.get $0
call $~lib/collector/itcm/ManagedObjectList#push
local.get $0
i32.const 16
i32.add
)
(func $~lib/string/String~gc (; 8 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
i32.eqz
if
return
end
local.get $0
call $~lib/collector/itcm/__gc_mark
)
(func $~lib/collector/itcm/__gc_collect (; 9 ;) (type $FUNCSIG$v)
(local $0 i32)
block $break|0
block $case1|0
global.get $~lib/collector/itcm/state
local.tee $0
i32.eqz
br_if $case1|0
local.get $0
i32.const 1
i32.eq
br_if $case1|0
br $break|0
end
call $~lib/collector/itcm/step
end
loop $continue|1
global.get $~lib/collector/itcm/state
i32.const 1
i32.ne
if
call $~lib/collector/itcm/step
br $continue|1
end
end
)
(func $start:std/gc-basics (; 10 ;) (type $FUNCSIG$v)
(local $0 i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
i32.const 64
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
call $~lib/collector/itcm/__gc_allocate
global.set $std/gc-basics/obj
global.get $std/gc-basics/obj
local.tee $0
i32.const 123
i32.store
local.get $0
i32.const 16
i32.sub
local.tee $1
i32.load offset=4
local.set $2
block (result i32)
local.get $1
i32.load
i32.const -4
i32.and
local.tee $3
i32.const 0
i32.ne
local.tee $0
if
local.get $2
i32.const 0
i32.ne
local.set $0
end
local.get $0
end
if (result i32)
local.get $2
local.get $3
i32.eq
else
local.get $0
end
i32.eqz
if
i32.const 0
i32.const 24
i32.const 19
i32.const 2
call $~lib/env/abort
unreachable
end
local.get $1
i32.load offset=8
i32.const 1
i32.ne
if
i32.const 0
i32.const 24
i32.const 21
i32.const 2
call $~lib/env/abort
unreachable
end
local.get $1
i32.load offset=12
if
i32.const 0
i32.const 24
i32.const 23
i32.const 2
call $~lib/env/abort
unreachable
end
local.get $1
i32.load offset=16
i32.const 123
i32.ne
if
i32.const 0
i32.const 24
i32.const 25
i32.const 2
call $~lib/env/abort
unreachable
end
call $~lib/collector/itcm/__gc_collect
i32.const 0
global.set $std/gc-basics/obj
call $~lib/collector/itcm/__gc_collect
)
(func $std/gc-basics/main (; 11 ;) (type $FUNCSIG$i) (result i32)
global.get $~lib/started
i32.eqz
if
call $start:std/gc-basics
i32.const 1
global.set $~lib/started
end
i32.const 0
)
(func $null (; 12 ;) (type $FUNCSIG$v)
nop
)
)

View File

@ -1,35 +0,0 @@
import "allocator/arena";
import "collector/itcm";
// a class to test with
class MyObject {
a: u32;
}
function MyObject_visit(ref: usize): void {} // function table index == classId ?
// allocate a managed instance
var obj: MyObject | null = changetype<MyObject>(__gc_allocate(offsetof<MyObject>(), MyObject_visit));
obj.a = 123;
// check header
{
let head = changetype<usize>(obj) - 16;
let next = load<u32>(head, 0) & ~3;
let prev = load<u32>(head, 4);
assert(next != 0 && prev != 0 && next == prev);
let visitFn = load<u32>(head, 8);
assert(visitFn == changetype<u32>(MyObject_visit));
let unused = load<u32>(head, 12);
assert(unused == 0);
let a = load<u32>(head, 16);
assert(a == 123);
}
gc.collect(); // should keep 'obj' because it's a referenced root (see trace output)
obj = null;
gc.collect(); // should free 'obj' because it isn't referenced anymore (see trace output)
var obj2: MyObject; // should also iterate globals defined late
@start
export function main(): i32 { return 0; }

View File

@ -1,629 +0,0 @@
(module
(type $FUNCSIG$v (func))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vii (func (param i32 i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$i (func (result i32)))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data (i32.const 8) "\00\00\00\00\00\00\00\00\03\00\00\00\00\00\00\00\10\00\00\00s\00t\00d\00/\00g\00c\00-\00b\00a\00s\00i\00c\00s\00.\00t\00s\00")
(table $0 4 funcref)
(elem (i32.const 0) $null $std/gc-basics/MyObject_visit $~lib/collector/itcm/__gc_mark $~lib/string/String~gc)
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $~lib/collector/itcm/state (mut i32) (i32.const 0))
(global $~lib/collector/itcm/white (mut i32) (i32.const 0))
(global $~lib/collector/itcm/fromSpace (mut i32) (i32.const 0))
(global $~lib/collector/itcm/toSpace (mut i32) (i32.const 0))
(global $~lib/collector/itcm/iter (mut i32) (i32.const 0))
(global $~lib/argc (mut i32) (i32.const 0))
(global $std/gc-basics/obj (mut i32) (i32.const 0))
(global $std/gc-basics/obj2 (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/memory/HEAP_BASE i32 (i32.const 60))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $std/gc-basics/main))
(func $start:~lib/allocator/arena (; 1 ;) (type $FUNCSIG$v)
global.get $~lib/memory/HEAP_BASE
i32.const 7
i32.add
i32.const 7
i32.const -1
i32.xor
i32.and
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
)
(func $std/gc-basics/MyObject_visit (; 2 ;) (type $FUNCSIG$vi) (param $0 i32)
nop
)
(func $~lib/allocator/arena/__memory_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.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
local.get $1
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 $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 $2
grow_memory
i32.const 0
i32.lt_s
if
unreachable
end
end
end
local.get $4
global.set $~lib/allocator/arena/offset
local.get $1
)
(func $~lib/collector/itcm/ManagedObjectList#clear (; 4 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
local.get $0
i32.store
local.get $0
local.get $0
i32.store offset=4
)
(func $~lib/collector/itcm/ManagedObject#get:color (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.load
i32.const 3
i32.and
)
(func $~lib/collector/itcm/ManagedObject#get:next (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.load
i32.const 3
i32.const -1
i32.xor
i32.and
)
(func $~lib/collector/itcm/ManagedObject#set:next (; 7 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
local.get $0
local.get $1
local.get $0
i32.load
i32.const 3
i32.and
i32.or
i32.store
)
(func $~lib/collector/itcm/ManagedObject#unlink (; 8 ;) (type $FUNCSIG$vi) (param $0 i32)
(local $1 i32)
(local $2 i32)
local.get $0
call $~lib/collector/itcm/ManagedObject#get:next
local.set $1
local.get $0
i32.load offset=4
local.set $2
local.get $1
local.get $2
i32.store offset=4
local.get $2
local.get $1
call $~lib/collector/itcm/ManagedObject#set:next
)
(func $~lib/collector/itcm/ManagedObjectList#push (; 9 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
local.get $0
i32.load offset=4
local.set $2
local.get $1
local.get $0
call $~lib/collector/itcm/ManagedObject#set:next
local.get $1
local.get $2
i32.store offset=4
local.get $2
local.get $1
call $~lib/collector/itcm/ManagedObject#set:next
local.get $0
local.get $1
i32.store offset=4
)
(func $~lib/collector/itcm/ManagedObject#makeGray (; 10 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/collector/itcm/iter
i32.eq
if
local.get $0
i32.load offset=4
global.set $~lib/collector/itcm/iter
end
local.get $0
call $~lib/collector/itcm/ManagedObject#unlink
global.get $~lib/collector/itcm/toSpace
local.get $0
call $~lib/collector/itcm/ManagedObjectList#push
local.get $0
local.get $0
i32.load
i32.const 3
i32.const -1
i32.xor
i32.and
i32.const 2
i32.or
i32.store
)
(func $~lib/collector/itcm/__gc_mark (; 11 ;) (type $FUNCSIG$vi) (param $0 i32)
(local $1 i32)
local.get $0
if
block $~lib/collector/itcm/refToObj|inlined.0 (result i32)
local.get $0
local.set $1
local.get $1
i32.const 16
i32.sub
end
local.set $1
local.get $1
call $~lib/collector/itcm/ManagedObject#get:color
global.get $~lib/collector/itcm/white
i32.eq
if
local.get $1
call $~lib/collector/itcm/ManagedObject#makeGray
end
end
)
(func $~lib/collector/itcm/ManagedObject#set:color (; 12 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
local.get $0
local.get $0
i32.load
i32.const 3
i32.const -1
i32.xor
i32.and
local.get $1
i32.or
i32.store
)
(func $~lib/allocator/arena/__memory_free (; 13 ;) (type $FUNCSIG$vi) (param $0 i32)
nop
)
(func $~lib/collector/itcm/step (; 14 ;) (type $FUNCSIG$v)
(local $0 i32)
(local $1 i32)
block $break|0
block $case3|0
block $case2|0
block $case1|0
block $case0|0
global.get $~lib/collector/itcm/state
local.set $1
local.get $1
i32.const 0
i32.eq
br_if $case0|0
local.get $1
i32.const 1
i32.eq
br_if $case1|0
local.get $1
i32.const 2
i32.eq
br_if $case2|0
local.get $1
i32.const 3
i32.eq
br_if $case3|0
br $break|0
end
block
block $~lib/memory/memory.allocate|inlined.0 (result i32)
i32.const 16
local.set $1
local.get $1
call $~lib/allocator/arena/__memory_allocate
br $~lib/memory/memory.allocate|inlined.0
end
global.set $~lib/collector/itcm/fromSpace
global.get $~lib/collector/itcm/fromSpace
i32.const -1
i32.store offset=8
global.get $~lib/collector/itcm/fromSpace
call $~lib/collector/itcm/ManagedObjectList#clear
block $~lib/memory/memory.allocate|inlined.1 (result i32)
i32.const 16
local.set $1
local.get $1
call $~lib/allocator/arena/__memory_allocate
br $~lib/memory/memory.allocate|inlined.1
end
global.set $~lib/collector/itcm/toSpace
global.get $~lib/collector/itcm/toSpace
i32.const -1
i32.store offset=8
global.get $~lib/collector/itcm/toSpace
call $~lib/collector/itcm/ManagedObjectList#clear
global.get $~lib/collector/itcm/toSpace
global.set $~lib/collector/itcm/iter
i32.const 1
global.set $~lib/collector/itcm/state
end
end
block
i32.const 2
call $~iterateRoots
i32.const 2
global.set $~lib/collector/itcm/state
br $break|0
unreachable
end
unreachable
end
block
global.get $~lib/collector/itcm/iter
call $~lib/collector/itcm/ManagedObject#get:next
local.set $0
local.get $0
global.get $~lib/collector/itcm/toSpace
i32.ne
if
local.get $0
global.set $~lib/collector/itcm/iter
local.get $0
global.get $~lib/collector/itcm/white
i32.eqz
call $~lib/collector/itcm/ManagedObject#set:color
i32.const 1
global.set $~lib/argc
block $~lib/collector/itcm/objToRef|inlined.0 (result i32)
local.get $0
local.set $1
local.get $1
i32.const 16
i32.add
end
local.get $0
i32.load offset=8
call_indirect (type $FUNCSIG$vi)
else
i32.const 2
call $~iterateRoots
global.get $~lib/collector/itcm/iter
call $~lib/collector/itcm/ManagedObject#get:next
local.set $0
local.get $0
global.get $~lib/collector/itcm/toSpace
i32.eq
if
global.get $~lib/collector/itcm/fromSpace
local.set $1
global.get $~lib/collector/itcm/toSpace
global.set $~lib/collector/itcm/fromSpace
local.get $1
global.set $~lib/collector/itcm/toSpace
global.get $~lib/collector/itcm/white
i32.eqz
global.set $~lib/collector/itcm/white
local.get $1
call $~lib/collector/itcm/ManagedObject#get:next
global.set $~lib/collector/itcm/iter
i32.const 3
global.set $~lib/collector/itcm/state
end
end
br $break|0
unreachable
end
unreachable
end
block
global.get $~lib/collector/itcm/iter
local.set $0
local.get $0
global.get $~lib/collector/itcm/toSpace
i32.ne
if
local.get $0
call $~lib/collector/itcm/ManagedObject#get:next
global.set $~lib/collector/itcm/iter
local.get $0
global.get $~lib/memory/HEAP_BASE
i32.ge_u
if
block $~lib/memory/memory.free|inlined.0
local.get $0
local.set $1
local.get $1
call $~lib/allocator/arena/__memory_free
br $~lib/memory/memory.free|inlined.0
end
end
else
global.get $~lib/collector/itcm/toSpace
call $~lib/collector/itcm/ManagedObjectList#clear
i32.const 1
global.set $~lib/collector/itcm/state
end
br $break|0
unreachable
end
unreachable
end
)
(func $~lib/collector/itcm/__gc_allocate (; 15 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
local.get $0
i32.const 1073741824
i32.const 16
i32.sub
i32.gt_u
if
unreachable
end
call $~lib/collector/itcm/step
block $~lib/memory/memory.allocate|inlined.2 (result i32)
i32.const 16
local.get $0
i32.add
local.set $2
local.get $2
call $~lib/allocator/arena/__memory_allocate
br $~lib/memory/memory.allocate|inlined.2
end
local.set $3
local.get $3
local.get $1
i32.store offset=8
local.get $3
global.get $~lib/collector/itcm/white
call $~lib/collector/itcm/ManagedObject#set:color
global.get $~lib/collector/itcm/fromSpace
local.get $3
call $~lib/collector/itcm/ManagedObjectList#push
block $~lib/collector/itcm/objToRef|inlined.1 (result i32)
local.get $3
local.set $2
local.get $2
i32.const 16
i32.add
end
)
(func $~lib/string/String~gc (; 16 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
i32.eqz
if
return
end
local.get $0
call $~lib/collector/itcm/__gc_mark
)
(func $~lib/collector/itcm/__gc_collect (; 17 ;) (type $FUNCSIG$v)
(local $0 i32)
block $break|0
block $case1|0
block $case0|0
global.get $~lib/collector/itcm/state
local.set $0
local.get $0
i32.const 0
i32.eq
br_if $case0|0
local.get $0
i32.const 1
i32.eq
br_if $case1|0
br $break|0
end
end
call $~lib/collector/itcm/step
end
block $break|1
loop $continue|1
global.get $~lib/collector/itcm/state
i32.const 1
i32.ne
if
call $~lib/collector/itcm/step
br $continue|1
end
end
end
)
(func $~lib/gc/gc.collect (; 18 ;) (type $FUNCSIG$v)
call $~lib/collector/itcm/__gc_collect
return
)
(func $start:std/gc-basics (; 19 ;) (type $FUNCSIG$v)
(local $0 i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
(local $4 i32)
(local $5 i32)
call $start:~lib/allocator/arena
i32.const 4
i32.const 1
call $~lib/collector/itcm/__gc_allocate
global.set $std/gc-basics/obj
global.get $std/gc-basics/obj
i32.const 123
i32.store
block
global.get $std/gc-basics/obj
i32.const 16
i32.sub
local.set $0
local.get $0
i32.load
i32.const 3
i32.const -1
i32.xor
i32.and
local.set $1
local.get $0
i32.load offset=4
local.set $2
local.get $1
i32.const 0
i32.ne
local.tee $3
if (result i32)
local.get $2
i32.const 0
i32.ne
else
local.get $3
end
local.tee $3
if (result i32)
local.get $1
local.get $2
i32.eq
else
local.get $3
end
i32.eqz
if
i32.const 0
i32.const 24
i32.const 19
i32.const 2
call $~lib/env/abort
unreachable
end
local.get $0
i32.load offset=8
local.set $3
local.get $3
i32.const 1
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 21
i32.const 2
call $~lib/env/abort
unreachable
end
local.get $0
i32.load offset=12
local.set $4
local.get $4
i32.const 0
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 23
i32.const 2
call $~lib/env/abort
unreachable
end
local.get $0
i32.load offset=16
local.set $5
local.get $5
i32.const 123
i32.eq
i32.eqz
if
i32.const 0
i32.const 24
i32.const 25
i32.const 2
call $~lib/env/abort
unreachable
end
end
call $~lib/gc/gc.collect
i32.const 0
global.set $std/gc-basics/obj
call $~lib/gc/gc.collect
)
(func $std/gc-basics/main (; 20 ;) (type $FUNCSIG$i) (result i32)
global.get $~lib/started
i32.eqz
if
call $start
i32.const 1
global.set $~lib/started
end
i32.const 0
)
(func $start (; 21 ;) (type $FUNCSIG$v)
call $start:std/gc-basics
)
(func $null (; 22 ;) (type $FUNCSIG$v)
)
(func $~iterateRoots (; 23 ;) (type $FUNCSIG$vi) (param $0 i32)
global.get $std/gc-basics/obj
local.get $0
call_indirect (type $FUNCSIG$vi)
global.get $std/gc-basics/obj2
local.get $0
call_indirect (type $FUNCSIG$vi)
)
)

View File

@ -1,67 +0,0 @@
(module
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data (i32.const 8) "\15\00\00\00s\00t\00d\00/\00g\00c\00-\00i\00n\00t\00e\00g\00r\00a\00t\00i\00o\00n\00.\00t\00s")
(table $0 2 funcref)
(elem (i32.const 0) $null $start:std/gc-integration~anonymous|0)
(global $std/gc-integration/B.d (mut i32) (i32.const 16))
(global $std/gc-integration/a_ref (mut i32) (i32.const 24))
(global $std/gc-integration/b_ref (mut i32) (i32.const 32))
(global $std/gc-integration/i (mut i32) (i32.const 0))
(export "memory" (memory $0))
(export "table" (table $0))
(start $start)
(func $start:std/gc-integration~anonymous|0 (; 1 ;) (type $FUNCSIG$vi) (param $0 i32)
global.get $std/gc-integration/i
i32.const 1
i32.add
global.set $std/gc-integration/i
local.get $0
global.get $std/gc-integration/i
i32.const 3
i32.shl
i32.ne
if
i32.const 0
i32.const 8
i32.const 18
i32.const 42
call $~lib/env/abort
unreachable
end
)
(func $start:std/gc-integration (; 2 ;) (type $FUNCSIG$v)
i32.const 8
i32.const 1
call_indirect (type $FUNCSIG$vi)
global.get $std/gc-integration/B.d
i32.const 1
call_indirect (type $FUNCSIG$vi)
global.get $std/gc-integration/a_ref
i32.const 1
call_indirect (type $FUNCSIG$vi)
global.get $std/gc-integration/b_ref
i32.const 1
call_indirect (type $FUNCSIG$vi)
global.get $std/gc-integration/i
i32.const 4
i32.ne
if
i32.const 0
i32.const 8
i32.const 19
i32.const 0
call $~lib/env/abort
unreachable
end
)
(func $start (; 3 ;) (type $FUNCSIG$v)
call $start:std/gc-integration
)
(func $null (; 4 ;) (type $FUNCSIG$v)
nop
)
)

View File

@ -1,19 +0,0 @@
// declare classes to test with
class A {}
class B {
static readonly c: B = changetype<B>(8); // static root, readonly
static d: A = changetype<A>(16); // static root, writable
}
// make sure static properties are compiled
B.c;
B.d;
// declare roots
var no_ref: usize = 64; // NOT a root, basic value
var a_ref: A | null = changetype<A>(24); // global root, nullable
var b_ref: B = changetype<B>(32); // global root, non-nullable
var i: i32 = 0;
__rt_iterateroots((ref: usize): void => { assert(<u32>ref == ++i << 3); });
assert(i == 4);

View File

@ -1,81 +0,0 @@
(module
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$viiii (func (param i32 i32 i32 i32)))
(type $FUNCSIG$v (func))
(import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32)))
(memory $0 1)
(data (i32.const 8) "\15\00\00\00s\00t\00d\00/\00g\00c\00-\00i\00n\00t\00e\00g\00r\00a\00t\00i\00o\00n\00.\00t\00s\00")
(table $0 2 funcref)
(elem (i32.const 0) $null $start:std/gc-integration~anonymous|0)
(global $std/gc-integration/B.c i32 (i32.const 8))
(global $std/gc-integration/B.d (mut i32) (i32.const 16))
(global $std/gc-integration/no_ref (mut i32) (i32.const 64))
(global $std/gc-integration/a_ref (mut i32) (i32.const 24))
(global $std/gc-integration/b_ref (mut i32) (i32.const 32))
(global $std/gc-integration/i (mut i32) (i32.const 0))
(global $~lib/memory/HEAP_BASE i32 (i32.const 56))
(export "memory" (memory $0))
(export "table" (table $0))
(start $start)
(func $start:std/gc-integration~anonymous|0 (; 1 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
block (result i32)
global.get $std/gc-integration/i
i32.const 1
i32.add
global.set $std/gc-integration/i
global.get $std/gc-integration/i
end
i32.const 3
i32.shl
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 18
i32.const 42
call $~lib/env/abort
unreachable
end
)
(func $start:std/gc-integration (; 2 ;) (type $FUNCSIG$v)
global.get $std/gc-integration/B.c
drop
global.get $std/gc-integration/B.d
drop
i32.const 1
call $~iterateRoots
global.get $std/gc-integration/i
i32.const 4
i32.eq
i32.eqz
if
i32.const 0
i32.const 8
i32.const 19
i32.const 0
call $~lib/env/abort
unreachable
end
)
(func $start (; 3 ;) (type $FUNCSIG$v)
call $start:std/gc-integration
)
(func $null (; 4 ;) (type $FUNCSIG$v)
)
(func $~iterateRoots (; 5 ;) (type $FUNCSIG$vi) (param $0 i32)
global.get $std/gc-integration/B.c
local.get $0
call_indirect (type $FUNCSIG$vi)
global.get $std/gc-integration/B.d
local.get $0
call_indirect (type $FUNCSIG$vi)
global.get $std/gc-integration/a_ref
local.get $0
call_indirect (type $FUNCSIG$vi)
global.get $std/gc-integration/b_ref
local.get $0
call_indirect (type $FUNCSIG$vi)
)
)

View File

@ -1,437 +0,0 @@
(module
(type $FUNCSIG$v (func))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$vii (func (param i32 i32)))
(type $FUNCSIG$i (func (result i32)))
(memory $0 0)
(table $0 4 funcref)
(elem (i32.const 0) $null $~lib/collector/itcm/__gc_mark $std/gc-object/Base~gc $std/gc-object/Custom~gc)
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $~lib/collector/itcm/state (mut i32) (i32.const 0))
(global $~lib/collector/itcm/white (mut i32) (i32.const 0))
(global $~lib/collector/itcm/fromSpace (mut i32) (i32.const 0))
(global $~lib/collector/itcm/toSpace (mut i32) (i32.const 0))
(global $~lib/collector/itcm/iter (mut i32) (i32.const 0))
(global $~lib/argc (mut i32) (i32.const 0))
(global $std/gc-object/obj (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $std/gc-object/main))
(func $~lib/allocator/arena/__memory_allocate (; 0 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
(local $2 i32)
(local $3 i32)
local.get $0
i32.const 1073741824
i32.gt_u
if
unreachable
end
global.get $~lib/allocator/arena/offset
local.tee $1
local.get $0
i32.const 1
local.get $0
i32.const 1
i32.gt_u
select
i32.add
i32.const 7
i32.add
i32.const -8
i32.and
local.tee $2
current_memory
local.tee $3
i32.const 16
i32.shl
i32.gt_u
if
local.get $3
local.get $2
local.get $1
i32.sub
i32.const 65535
i32.add
i32.const -65536
i32.and
i32.const 16
i32.shr_u
local.tee $0
local.get $3
local.get $0
i32.gt_s
select
grow_memory
i32.const 0
i32.lt_s
if
local.get $0
grow_memory
i32.const 0
i32.lt_s
if
unreachable
end
end
end
local.get $2
global.set $~lib/allocator/arena/offset
local.get $1
)
(func $~lib/collector/itcm/ManagedObjectList#push (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
local.get $0
i32.load offset=4
local.set $2
local.get $1
local.get $1
i32.load
i32.const 3
i32.and
local.get $0
i32.or
i32.store
local.get $1
local.get $2
i32.store offset=4
local.get $2
local.get $2
i32.load
i32.const 3
i32.and
local.get $1
i32.or
i32.store
local.get $0
local.get $1
i32.store offset=4
)
(func $~lib/collector/itcm/ManagedObject#makeGray (; 2 ;) (type $FUNCSIG$vi) (param $0 i32)
(local $1 i32)
(local $2 i32)
global.get $~lib/collector/itcm/iter
local.get $0
i32.eq
if
local.get $0
i32.load offset=4
global.set $~lib/collector/itcm/iter
end
local.get $0
i32.load
i32.const -4
i32.and
local.tee $2
local.get $0
i32.load offset=4
local.tee $1
i32.store offset=4
local.get $1
local.get $1
i32.load
i32.const 3
i32.and
local.get $2
i32.or
i32.store
global.get $~lib/collector/itcm/toSpace
local.get $0
call $~lib/collector/itcm/ManagedObjectList#push
local.get $0
local.get $0
i32.load
i32.const -4
i32.and
i32.const 2
i32.or
i32.store
)
(func $~lib/collector/itcm/__gc_mark (; 3 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
if
global.get $~lib/collector/itcm/white
local.get $0
i32.const 16
i32.sub
local.tee $0
i32.load
i32.const 3
i32.and
i32.eq
if
local.get $0
call $~lib/collector/itcm/ManagedObject#makeGray
end
end
)
(func $~lib/collector/itcm/step (; 4 ;) (type $FUNCSIG$v)
(local $0 i32)
block $break|0
block $case3|0
block $case2|0
block $case1|0
global.get $~lib/collector/itcm/state
local.tee $0
if
local.get $0
i32.const 1
i32.sub
br_table $case1|0 $case2|0 $case3|0 $break|0
end
i32.const 16
call $~lib/allocator/arena/__memory_allocate
global.set $~lib/collector/itcm/fromSpace
global.get $~lib/collector/itcm/fromSpace
local.tee $0
i32.const -1
i32.store offset=8
local.get $0
local.get $0
i32.store
local.get $0
local.get $0
i32.store offset=4
i32.const 16
call $~lib/allocator/arena/__memory_allocate
global.set $~lib/collector/itcm/toSpace
global.get $~lib/collector/itcm/toSpace
local.tee $0
i32.const -1
i32.store offset=8
local.get $0
local.get $0
i32.store
local.get $0
local.get $0
i32.store offset=4
global.get $~lib/collector/itcm/toSpace
global.set $~lib/collector/itcm/iter
i32.const 1
global.set $~lib/collector/itcm/state
end
global.get $std/gc-object/obj
i32.const 1
call_indirect (type $FUNCSIG$vi)
i32.const 2
global.set $~lib/collector/itcm/state
br $break|0
end
global.get $~lib/collector/itcm/iter
i32.load
i32.const -4
i32.and
local.tee $0
global.get $~lib/collector/itcm/toSpace
i32.ne
if
local.get $0
global.set $~lib/collector/itcm/iter
local.get $0
global.get $~lib/collector/itcm/white
i32.eqz
local.get $0
i32.load
i32.const -4
i32.and
i32.or
i32.store
i32.const 1
global.set $~lib/argc
local.get $0
i32.const 16
i32.add
local.get $0
i32.load offset=8
call_indirect (type $FUNCSIG$vi)
else
global.get $std/gc-object/obj
i32.const 1
call_indirect (type $FUNCSIG$vi)
global.get $~lib/collector/itcm/toSpace
global.get $~lib/collector/itcm/iter
i32.load
i32.const -4
i32.and
i32.eq
if
global.get $~lib/collector/itcm/fromSpace
local.set $0
global.get $~lib/collector/itcm/toSpace
global.set $~lib/collector/itcm/fromSpace
local.get $0
global.set $~lib/collector/itcm/toSpace
global.get $~lib/collector/itcm/white
i32.eqz
global.set $~lib/collector/itcm/white
local.get $0
i32.load
i32.const -4
i32.and
global.set $~lib/collector/itcm/iter
i32.const 3
global.set $~lib/collector/itcm/state
end
end
br $break|0
end
global.get $~lib/collector/itcm/iter
local.tee $0
global.get $~lib/collector/itcm/toSpace
i32.ne
if
local.get $0
i32.load
i32.const -4
i32.and
global.set $~lib/collector/itcm/iter
else
global.get $~lib/collector/itcm/toSpace
local.tee $0
local.get $0
i32.store
local.get $0
local.get $0
i32.store offset=4
i32.const 1
global.set $~lib/collector/itcm/state
end
end
)
(func $~lib/collector/itcm/__gc_allocate (; 5 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
local.get $0
i32.const 1073741808
i32.gt_u
if
unreachable
end
call $~lib/collector/itcm/step
local.get $0
i32.const 16
i32.add
call $~lib/allocator/arena/__memory_allocate
local.tee $0
local.get $1
i32.store offset=8
local.get $0
global.get $~lib/collector/itcm/white
local.get $0
i32.load
i32.const -4
i32.and
i32.or
i32.store
global.get $~lib/collector/itcm/fromSpace
local.get $0
call $~lib/collector/itcm/ManagedObjectList#push
local.get $0
i32.const 16
i32.add
)
(func $std/gc-object/Base~gc (; 6 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
i32.eqz
if
return
end
local.get $0
call $~lib/collector/itcm/__gc_mark
)
(func $std/gc-object/Custom~gc (; 7 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
i32.eqz
if
return
end
local.get $0
i32.const 2
call_indirect (type $FUNCSIG$vi)
local.get $0
i32.load
call $~lib/collector/itcm/__gc_mark
local.get $0
i32.load offset=4
call $~lib/collector/itcm/__gc_mark
)
(func $std/gc-object/Custom#constructor (; 8 ;) (type $FUNCSIG$i) (result i32)
(local $0 i32)
i32.const 8
i32.const 3
call $~lib/collector/itcm/__gc_allocate
local.tee $0
i32.eqz
if
i32.const 0
i32.const 2
call $~lib/collector/itcm/__gc_allocate
local.set $0
end
local.get $0
i32.const 0
i32.store
local.get $0
i32.const 0
i32.store offset=4
local.get $0
)
(func $~lib/collector/itcm/__gc_collect (; 9 ;) (type $FUNCSIG$v)
(local $0 i32)
block $break|0
block $case1|0
global.get $~lib/collector/itcm/state
local.tee $0
i32.eqz
br_if $case1|0
local.get $0
i32.const 1
i32.eq
br_if $case1|0
br $break|0
end
call $~lib/collector/itcm/step
end
loop $continue|1
global.get $~lib/collector/itcm/state
i32.const 1
i32.ne
if
call $~lib/collector/itcm/step
br $continue|1
end
end
)
(func $start:std/gc-object (; 10 ;) (type $FUNCSIG$v)
(local $0 i32)
i32.const 8
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
call $std/gc-object/Custom#constructor
global.set $std/gc-object/obj
call $~lib/collector/itcm/__gc_collect
global.get $std/gc-object/obj
local.tee $0
local.get $0
i32.store
call $~lib/collector/itcm/__gc_collect
i32.const 0
global.set $std/gc-object/obj
call $~lib/collector/itcm/__gc_collect
)
(func $std/gc-object/main (; 11 ;) (type $FUNCSIG$v)
global.get $~lib/started
i32.eqz
if
call $start:std/gc-object
i32.const 1
global.set $~lib/started
end
)
(func $null (; 12 ;) (type $FUNCSIG$v)
nop
)
)

View File

@ -1,25 +0,0 @@
import "allocator/arena";
import "collector/itcm";
class Base {
}
class Custom extends Base {
a: Custom;
b: Base;
}
var obj: Custom | null = new Custom();
gc.collect();
obj.a = <Custom>obj;
gc.collect();
obj = null;
gc.collect();
@start
export function main(): void {}

View File

@ -1,569 +0,0 @@
(module
(type $FUNCSIG$v (func))
(type $FUNCSIG$iii (func (param i32 i32) (result i32)))
(type $FUNCSIG$ii (func (param i32) (result i32)))
(type $FUNCSIG$vi (func (param i32)))
(type $FUNCSIG$vii (func (param i32 i32)))
(memory $0 0)
(table $0 4 funcref)
(elem (i32.const 0) $null $~lib/collector/itcm/__gc_mark $std/gc-object/Base~gc $std/gc-object/Custom~gc)
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $~lib/collector/itcm/state (mut i32) (i32.const 0))
(global $~lib/collector/itcm/white (mut i32) (i32.const 0))
(global $~lib/collector/itcm/fromSpace (mut i32) (i32.const 0))
(global $~lib/collector/itcm/toSpace (mut i32) (i32.const 0))
(global $~lib/collector/itcm/iter (mut i32) (i32.const 0))
(global $~lib/argc (mut i32) (i32.const 0))
(global $std/gc-object/obj (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/memory/HEAP_BASE i32 (i32.const 8))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $std/gc-object/main))
(func $start:~lib/allocator/arena (; 0 ;) (type $FUNCSIG$v)
global.get $~lib/memory/HEAP_BASE
i32.const 7
i32.add
i32.const 7
i32.const -1
i32.xor
i32.and
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
)
(func $~lib/allocator/arena/__memory_allocate (; 1 ;) (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.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
local.get $1
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 $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 $2
grow_memory
i32.const 0
i32.lt_s
if
unreachable
end
end
end
local.get $4
global.set $~lib/allocator/arena/offset
local.get $1
)
(func $~lib/collector/itcm/ManagedObjectList#clear (; 2 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
local.get $0
i32.store
local.get $0
local.get $0
i32.store offset=4
)
(func $~lib/collector/itcm/ManagedObject#get:color (; 3 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.load
i32.const 3
i32.and
)
(func $~lib/collector/itcm/ManagedObject#get:next (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.load
i32.const 3
i32.const -1
i32.xor
i32.and
)
(func $~lib/collector/itcm/ManagedObject#set:next (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
local.get $0
local.get $1
local.get $0
i32.load
i32.const 3
i32.and
i32.or
i32.store
)
(func $~lib/collector/itcm/ManagedObject#unlink (; 6 ;) (type $FUNCSIG$vi) (param $0 i32)
(local $1 i32)
(local $2 i32)
local.get $0
call $~lib/collector/itcm/ManagedObject#get:next
local.set $1
local.get $0
i32.load offset=4
local.set $2
local.get $1
local.get $2
i32.store offset=4
local.get $2
local.get $1
call $~lib/collector/itcm/ManagedObject#set:next
)
(func $~lib/collector/itcm/ManagedObjectList#push (; 7 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
(local $2 i32)
local.get $0
i32.load offset=4
local.set $2
local.get $1
local.get $0
call $~lib/collector/itcm/ManagedObject#set:next
local.get $1
local.get $2
i32.store offset=4
local.get $2
local.get $1
call $~lib/collector/itcm/ManagedObject#set:next
local.get $0
local.get $1
i32.store offset=4
)
(func $~lib/collector/itcm/ManagedObject#makeGray (; 8 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
global.get $~lib/collector/itcm/iter
i32.eq
if
local.get $0
i32.load offset=4
global.set $~lib/collector/itcm/iter
end
local.get $0
call $~lib/collector/itcm/ManagedObject#unlink
global.get $~lib/collector/itcm/toSpace
local.get $0
call $~lib/collector/itcm/ManagedObjectList#push
local.get $0
local.get $0
i32.load
i32.const 3
i32.const -1
i32.xor
i32.and
i32.const 2
i32.or
i32.store
)
(func $~lib/collector/itcm/__gc_mark (; 9 ;) (type $FUNCSIG$vi) (param $0 i32)
(local $1 i32)
local.get $0
if
block $~lib/collector/itcm/refToObj|inlined.0 (result i32)
local.get $0
local.set $1
local.get $1
i32.const 16
i32.sub
end
local.set $1
local.get $1
call $~lib/collector/itcm/ManagedObject#get:color
global.get $~lib/collector/itcm/white
i32.eq
if
local.get $1
call $~lib/collector/itcm/ManagedObject#makeGray
end
end
)
(func $~lib/collector/itcm/ManagedObject#set:color (; 10 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32)
local.get $0
local.get $0
i32.load
i32.const 3
i32.const -1
i32.xor
i32.and
local.get $1
i32.or
i32.store
)
(func $~lib/allocator/arena/__memory_free (; 11 ;) (type $FUNCSIG$vi) (param $0 i32)
nop
)
(func $~lib/collector/itcm/step (; 12 ;) (type $FUNCSIG$v)
(local $0 i32)
(local $1 i32)
block $break|0
block $case3|0
block $case2|0
block $case1|0
block $case0|0
global.get $~lib/collector/itcm/state
local.set $1
local.get $1
i32.const 0
i32.eq
br_if $case0|0
local.get $1
i32.const 1
i32.eq
br_if $case1|0
local.get $1
i32.const 2
i32.eq
br_if $case2|0
local.get $1
i32.const 3
i32.eq
br_if $case3|0
br $break|0
end
block
block $~lib/memory/memory.allocate|inlined.0 (result i32)
i32.const 16
local.set $1
local.get $1
call $~lib/allocator/arena/__memory_allocate
br $~lib/memory/memory.allocate|inlined.0
end
global.set $~lib/collector/itcm/fromSpace
global.get $~lib/collector/itcm/fromSpace
i32.const -1
i32.store offset=8
global.get $~lib/collector/itcm/fromSpace
call $~lib/collector/itcm/ManagedObjectList#clear
block $~lib/memory/memory.allocate|inlined.1 (result i32)
i32.const 16
local.set $1
local.get $1
call $~lib/allocator/arena/__memory_allocate
br $~lib/memory/memory.allocate|inlined.1
end
global.set $~lib/collector/itcm/toSpace
global.get $~lib/collector/itcm/toSpace
i32.const -1
i32.store offset=8
global.get $~lib/collector/itcm/toSpace
call $~lib/collector/itcm/ManagedObjectList#clear
global.get $~lib/collector/itcm/toSpace
global.set $~lib/collector/itcm/iter
i32.const 1
global.set $~lib/collector/itcm/state
end
end
block
i32.const 1
call $~iterateRoots
i32.const 2
global.set $~lib/collector/itcm/state
br $break|0
unreachable
end
unreachable
end
block
global.get $~lib/collector/itcm/iter
call $~lib/collector/itcm/ManagedObject#get:next
local.set $0
local.get $0
global.get $~lib/collector/itcm/toSpace
i32.ne
if
local.get $0
global.set $~lib/collector/itcm/iter
local.get $0
global.get $~lib/collector/itcm/white
i32.eqz
call $~lib/collector/itcm/ManagedObject#set:color
i32.const 1
global.set $~lib/argc
block $~lib/collector/itcm/objToRef|inlined.0 (result i32)
local.get $0
local.set $1
local.get $1
i32.const 16
i32.add
end
local.get $0
i32.load offset=8
call_indirect (type $FUNCSIG$vi)
else
i32.const 1
call $~iterateRoots
global.get $~lib/collector/itcm/iter
call $~lib/collector/itcm/ManagedObject#get:next
local.set $0
local.get $0
global.get $~lib/collector/itcm/toSpace
i32.eq
if
global.get $~lib/collector/itcm/fromSpace
local.set $1
global.get $~lib/collector/itcm/toSpace
global.set $~lib/collector/itcm/fromSpace
local.get $1
global.set $~lib/collector/itcm/toSpace
global.get $~lib/collector/itcm/white
i32.eqz
global.set $~lib/collector/itcm/white
local.get $1
call $~lib/collector/itcm/ManagedObject#get:next
global.set $~lib/collector/itcm/iter
i32.const 3
global.set $~lib/collector/itcm/state
end
end
br $break|0
unreachable
end
unreachable
end
block
global.get $~lib/collector/itcm/iter
local.set $0
local.get $0
global.get $~lib/collector/itcm/toSpace
i32.ne
if
local.get $0
call $~lib/collector/itcm/ManagedObject#get:next
global.set $~lib/collector/itcm/iter
local.get $0
global.get $~lib/memory/HEAP_BASE
i32.ge_u
if
block $~lib/memory/memory.free|inlined.0
local.get $0
local.set $1
local.get $1
call $~lib/allocator/arena/__memory_free
br $~lib/memory/memory.free|inlined.0
end
end
else
global.get $~lib/collector/itcm/toSpace
call $~lib/collector/itcm/ManagedObjectList#clear
i32.const 1
global.set $~lib/collector/itcm/state
end
br $break|0
unreachable
end
unreachable
end
)
(func $~lib/collector/itcm/__gc_allocate (; 13 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
(local $3 i32)
local.get $0
i32.const 1073741824
i32.const 16
i32.sub
i32.gt_u
if
unreachable
end
call $~lib/collector/itcm/step
block $~lib/memory/memory.allocate|inlined.2 (result i32)
i32.const 16
local.get $0
i32.add
local.set $2
local.get $2
call $~lib/allocator/arena/__memory_allocate
br $~lib/memory/memory.allocate|inlined.2
end
local.set $3
local.get $3
local.get $1
i32.store offset=8
local.get $3
global.get $~lib/collector/itcm/white
call $~lib/collector/itcm/ManagedObject#set:color
global.get $~lib/collector/itcm/fromSpace
local.get $3
call $~lib/collector/itcm/ManagedObjectList#push
block $~lib/collector/itcm/objToRef|inlined.1 (result i32)
local.get $3
local.set $2
local.get $2
i32.const 16
i32.add
end
)
(func $std/gc-object/Base~gc (; 14 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
i32.eqz
if
return
end
local.get $0
call $~lib/collector/itcm/__gc_mark
)
(func $std/gc-object/Base#constructor (; 15 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.eqz
if
i32.const 0
i32.const 2
call $~lib/collector/itcm/__gc_allocate
local.set $0
end
local.get $0
)
(func $std/gc-object/Custom~gc (; 16 ;) (type $FUNCSIG$vi) (param $0 i32)
local.get $0
i32.eqz
if
return
end
local.get $0
i32.const 2
call_indirect (type $FUNCSIG$vi)
local.get $0
i32.load
call $~lib/collector/itcm/__gc_mark
local.get $0
i32.load offset=4
call $~lib/collector/itcm/__gc_mark
)
(func $std/gc-object/Custom#constructor (; 17 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
local.get $0
i32.eqz
if
i32.const 8
i32.const 3
call $~lib/collector/itcm/__gc_allocate
local.set $0
end
local.get $0
call $std/gc-object/Base#constructor
local.set $0
local.get $0
i32.const 0
i32.store
local.get $0
i32.const 0
i32.store offset=4
local.get $0
)
(func $~lib/collector/itcm/__gc_collect (; 18 ;) (type $FUNCSIG$v)
(local $0 i32)
block $break|0
block $case1|0
block $case0|0
global.get $~lib/collector/itcm/state
local.set $0
local.get $0
i32.const 0
i32.eq
br_if $case0|0
local.get $0
i32.const 1
i32.eq
br_if $case1|0
br $break|0
end
end
call $~lib/collector/itcm/step
end
block $break|1
loop $continue|1
global.get $~lib/collector/itcm/state
i32.const 1
i32.ne
if
call $~lib/collector/itcm/step
br $continue|1
end
end
end
)
(func $~lib/gc/gc.collect (; 19 ;) (type $FUNCSIG$v)
call $~lib/collector/itcm/__gc_collect
return
)
(func $start:std/gc-object (; 20 ;) (type $FUNCSIG$v)
call $start:~lib/allocator/arena
i32.const 0
call $std/gc-object/Custom#constructor
global.set $std/gc-object/obj
call $~lib/gc/gc.collect
global.get $std/gc-object/obj
global.get $std/gc-object/obj
i32.store
call $~lib/gc/gc.collect
i32.const 0
global.set $std/gc-object/obj
call $~lib/gc/gc.collect
)
(func $std/gc-object/main (; 21 ;) (type $FUNCSIG$v)
global.get $~lib/started
i32.eqz
if
call $start
i32.const 1
global.set $~lib/started
end
)
(func $start (; 22 ;) (type $FUNCSIG$v)
call $start:std/gc-object
)
(func $null (; 23 ;) (type $FUNCSIG$v)
)
(func $~iterateRoots (; 24 ;) (type $FUNCSIG$vi) (param $0 i32)
global.get $std/gc-object/obj
local.get $0
call_indirect (type $FUNCSIG$vi)
)
)

View File

@ -135,7 +135,7 @@
if
i32.const 0
i32.const 24
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -150,7 +150,7 @@
if
i32.const 0
i32.const 24
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -167,7 +167,7 @@
if
i32.const 0
i32.const 24
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -184,7 +184,7 @@
if
i32.const 0
i32.const 24
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -467,7 +467,7 @@
call $~lib/env/abort
unreachable
end
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
local.get $1
local.set $2
local.get $2
@ -562,23 +562,14 @@
i32.store offset=20
)
(func $~lib/map/Map<i8,i32>#constructor (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Map<i8,i32>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 1
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 1
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -1528,23 +1519,14 @@
i32.store offset=20
)
(func $~lib/map/Map<u8,i32>#constructor (; 22 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Map<u8,i32>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.2 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 4
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 4
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -2463,23 +2445,14 @@
i32.store offset=20
)
(func $~lib/map/Map<i16,i32>#constructor (; 32 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Map<i16,i32>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.3 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 5
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 5
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -3444,23 +3417,14 @@
i32.store offset=20
)
(func $~lib/map/Map<u16,i32>#constructor (; 43 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Map<u16,i32>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.4 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 6
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 6
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -4379,23 +4343,14 @@
i32.store offset=20
)
(func $~lib/map/Map<i32,i32>#constructor (; 53 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Map<i32,i32>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.5 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 7
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 7
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -5332,23 +5287,14 @@
i32.store offset=20
)
(func $~lib/map/Map<u32,i32>#constructor (; 64 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Map<u32,i32>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.6 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 8
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 8
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -6243,23 +6189,14 @@
i32.store offset=20
)
(func $~lib/map/Map<i64,i32>#constructor (; 74 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Map<i64,i32>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.7 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 9
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 9
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -7252,23 +7189,14 @@
i32.store offset=20
)
(func $~lib/map/Map<u64,i32>#constructor (; 85 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Map<u64,i32>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.8 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 10
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 10
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -8173,23 +8101,14 @@
i32.store offset=20
)
(func $~lib/map/Map<f32,i32>#constructor (; 95 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Map<f32,i32>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.9 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 11
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 11
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -9099,23 +9018,14 @@
i32.store offset=20
)
(func $~lib/map/Map<f64,i32>#constructor (; 105 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Map<f64,i32>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.10 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 12
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 12
call $~lib/runtime/register
local.set $0
end
local.get $0

View File

@ -84,7 +84,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -99,7 +99,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -142,7 +142,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -159,7 +159,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -170,24 +170,15 @@
local.get $0
)
(func $std/new/AClass#constructor (; 5 ;) (type $FUNCSIG$iif) (param $0 i32) (param $1 f32) (result i32)
(local $2 i32)
local.get $0
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<AClass>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
i32.const 8
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 1
call $~lib/runtime/register
end
i32.const 8
call $~lib/runtime/allocate
i32.const 1
call $~lib/runtime/register
local.set $0
end
local.get $0

View File

@ -167,7 +167,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -182,7 +182,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -210,7 +210,7 @@
if
i32.const 0
i32.const 16
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -227,7 +227,7 @@
if
i32.const 0
i32.const 16
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -238,22 +238,13 @@
local.get $0
)
(func $std/operator-overloading/Tester#constructor (; 5 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Tester>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
i32.const 8
local.set $3
local.get $3
call $~lib/runtime/allocate
end
local.set $3
local.get $3
i32.const 1
call $~lib/runtime/register
end
i32.const 8
call $~lib/runtime/allocate
i32.const 1
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -1820,22 +1811,13 @@
call $std/operator-overloading/Tester#constructor
)
(func $std/operator-overloading/TesterInlineStatic#constructor (; 34 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<TesterInlineStatic>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
i32.const 8
local.set $3
local.get $3
call $~lib/runtime/allocate
end
local.set $3
local.get $3
i32.const 3
call $~lib/runtime/register
end
i32.const 8
call $~lib/runtime/allocate
i32.const 3
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -1847,22 +1829,13 @@
local.get $0
)
(func $std/operator-overloading/TesterInlineInstance#constructor (; 35 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<TesterInlineInstance>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.2 (result i32)
i32.const 8
local.set $3
local.get $3
call $~lib/runtime/allocate
end
local.set $3
local.get $3
i32.const 4
call $~lib/runtime/register
end
i32.const 8
call $~lib/runtime/allocate
i32.const 4
call $~lib/runtime/register
local.set $0
end
local.get $0

View File

@ -38,11 +38,12 @@
(global $std/runtime/ref4 (mut i32) (i32.const 0))
(global $std/runtime/header4 (mut i32) (i32.const 0))
(global $std/runtime/ref5 (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/capabilities i32 (i32.const 2))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $std/runtime/main))
(export ".capabilities" (global $~lib/capabilities))
(start $start)
(func $~lib/allocator/tlsf/Root#setSLMap (; 2 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
local.get $1
i32.const 22
@ -2616,7 +2617,7 @@
if
i32.const 0
i32.const 232
i32.const 125
i32.const 115
i32.const 8
call $~lib/env/abort
unreachable
@ -2653,7 +2654,7 @@
if
i32.const 0
i32.const 232
i32.const 185
i32.const 175
i32.const 4
call $~lib/env/abort
unreachable
@ -2668,7 +2669,7 @@
if
i32.const 0
i32.const 232
i32.const 187
i32.const 177
i32.const 4
call $~lib/env/abort
unreachable
@ -2684,7 +2685,7 @@
if
i32.const 0
i32.const 232
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -2699,7 +2700,7 @@
if
i32.const 0
i32.const 232
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -2750,7 +2751,7 @@
else
i32.const 0
i32.const 88
i32.const 34
i32.const 36
i32.const 2
call $~lib/env/abort
unreachable
@ -2861,7 +2862,7 @@
if
i32.const 0
i32.const 88
i32.const 49
i32.const 51
i32.const 0
call $~lib/env/abort
unreachable
@ -2873,7 +2874,7 @@
if
i32.const 0
i32.const 88
i32.const 50
i32.const 52
i32.const 0
call $~lib/env/abort
unreachable
@ -2887,7 +2888,7 @@
if
i32.const 0
i32.const 88
i32.const 51
i32.const 53
i32.const 0
call $~lib/env/abort
unreachable
@ -2899,7 +2900,7 @@
if
i32.const 0
i32.const 88
i32.const 52
i32.const 54
i32.const 0
call $~lib/env/abort
unreachable
@ -2914,7 +2915,7 @@
if
i32.const 0
i32.const 88
i32.const 54
i32.const 56
i32.const 0
call $~lib/env/abort
unreachable
@ -2930,7 +2931,7 @@
if
i32.const 0
i32.const 88
i32.const 56
i32.const 58
i32.const 0
call $~lib/env/abort
unreachable
@ -2946,7 +2947,7 @@
if
i32.const 0
i32.const 88
i32.const 59
i32.const 61
i32.const 0
call $~lib/env/abort
unreachable
@ -2962,7 +2963,7 @@
if
i32.const 0
i32.const 88
i32.const 63
i32.const 65
i32.const 0
call $~lib/env/abort
unreachable
@ -2978,7 +2979,7 @@
if
i32.const 0
i32.const 88
i32.const 65
i32.const 67
i32.const 0
call $~lib/env/abort
unreachable
@ -2990,7 +2991,7 @@
if
i32.const 0
i32.const 88
i32.const 66
i32.const 68
i32.const 0
call $~lib/env/abort
unreachable
@ -3007,7 +3008,7 @@
if
i32.const 0
i32.const 88
i32.const 69
i32.const 71
i32.const 0
call $~lib/env/abort
unreachable
@ -3023,14 +3024,20 @@
if
i32.const 0
i32.const 88
i32.const 70
i32.const 72
i32.const 0
call $~lib/env/abort
unreachable
end
)
(func $start (; 26 ;) (type $FUNCSIG$v)
call $start:std/runtime
(func $std/runtime/main (; 26 ;) (type $FUNCSIG$v)
global.get $~lib/started
i32.eqz
if
call $start:std/runtime
i32.const 1
global.set $~lib/started
end
)
(func $null (; 27 ;) (type $FUNCSIG$v)
nop

View File

@ -1,5 +1,7 @@
import "allocator/tlsf";
import { CLASSID, ADJUSTOBLOCK, ALLOCATE, REALLOCATE, REGISTER, DISCARD, HEADER, HEADER_SIZE, HEADER_MAGIC } from "runtime";
import { classId, ADJUSTOBLOCK, ALLOCATE, REALLOCATE, REGISTER, DISCARD, HEADER, HEADER_SIZE, HEADER_MAGIC } from "runtime";
@start export function main(): void {}
var register_ref: usize = 0;
@ -23,7 +25,7 @@ var link_parentRef: usize = 0;
class A {}
class B {}
assert(CLASSID<A>() != CLASSID<B>());
assert(classId<A>() != classId<B>());
function isPowerOf2(x: i32): bool {
return x != 0 && (x & (x - 1)) == 0;
@ -62,7 +64,7 @@ var ref4 = ALLOCATE(barrier1);
REGISTER<A>(ref4); // should call __gc_register
assert(register_ref == ref4);
var header4 = changetype<HEADER>(register_ref - HEADER_SIZE);
assert(header4.classId == CLASSID<A>());
assert(header4.classId == classId<A>());
assert(header4.payloadSize == barrier1);
var ref5 = ALLOCATE(10);

View File

@ -53,12 +53,13 @@
(global $std/runtime/ref4 (mut i32) (i32.const 0))
(global $std/runtime/header4 (mut i32) (i32.const 0))
(global $std/runtime/ref5 (mut i32) (i32.const 0))
(global $~lib/started (mut i32) (i32.const 0))
(global $~lib/memory/HEAP_BASE i32 (i32.const 264))
(global $~lib/capabilities i32 (i32.const 2))
(export "memory" (memory $0))
(export "table" (table $0))
(export "main" (func $std/runtime/main))
(export ".capabilities" (global $~lib/capabilities))
(start $start)
(func $start:~lib/allocator/tlsf (; 2 ;) (type $FUNCSIG$v)
i32.const 1
global.get $~lib/allocator/tlsf/SL_BITS
@ -3303,7 +3304,7 @@
if
i32.const 0
i32.const 232
i32.const 125
i32.const 115
i32.const 8
call $~lib/env/abort
unreachable
@ -3345,7 +3346,7 @@
if
i32.const 0
i32.const 232
i32.const 185
i32.const 175
i32.const 4
call $~lib/env/abort
unreachable
@ -3362,7 +3363,7 @@
if
i32.const 0
i32.const 232
i32.const 187
i32.const 177
i32.const 4
call $~lib/env/abort
unreachable
@ -3379,7 +3380,7 @@
if
i32.const 0
i32.const 232
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -3396,7 +3397,7 @@
if
i32.const 0
i32.const 232
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -3433,7 +3434,7 @@
if
i32.const 0
i32.const 88
i32.const 26
i32.const 28
i32.const 0
call $~lib/env/abort
unreachable
@ -3446,7 +3447,7 @@
if
i32.const 0
i32.const 88
i32.const 32
i32.const 34
i32.const 0
call $~lib/env/abort
unreachable
@ -3467,7 +3468,7 @@
if
i32.const 0
i32.const 88
i32.const 34
i32.const 36
i32.const 2
call $~lib/env/abort
unreachable
@ -3574,7 +3575,7 @@
if
i32.const 0
i32.const 88
i32.const 49
i32.const 51
i32.const 0
call $~lib/env/abort
unreachable
@ -3587,7 +3588,7 @@
if
i32.const 0
i32.const 88
i32.const 50
i32.const 52
i32.const 0
call $~lib/env/abort
unreachable
@ -3607,7 +3608,7 @@
if
i32.const 0
i32.const 88
i32.const 51
i32.const 53
i32.const 0
call $~lib/env/abort
unreachable
@ -3620,7 +3621,7 @@
if
i32.const 0
i32.const 88
i32.const 52
i32.const 54
i32.const 0
call $~lib/env/abort
unreachable
@ -3642,7 +3643,7 @@
if
i32.const 0
i32.const 88
i32.const 54
i32.const 56
i32.const 0
call $~lib/env/abort
unreachable
@ -3659,7 +3660,7 @@
if
i32.const 0
i32.const 88
i32.const 56
i32.const 58
i32.const 0
call $~lib/env/abort
unreachable
@ -3684,7 +3685,7 @@
if
i32.const 0
i32.const 88
i32.const 59
i32.const 61
i32.const 0
call $~lib/env/abort
unreachable
@ -3711,7 +3712,7 @@
if
i32.const 0
i32.const 88
i32.const 63
i32.const 65
i32.const 0
call $~lib/env/abort
unreachable
@ -3728,7 +3729,7 @@
if
i32.const 0
i32.const 88
i32.const 65
i32.const 67
i32.const 0
call $~lib/env/abort
unreachable
@ -3741,7 +3742,7 @@
if
i32.const 0
i32.const 88
i32.const 66
i32.const 68
i32.const 0
call $~lib/env/abort
unreachable
@ -3761,7 +3762,7 @@
if
i32.const 0
i32.const 88
i32.const 69
i32.const 71
i32.const 0
call $~lib/env/abort
unreachable
@ -3774,15 +3775,24 @@
if
i32.const 0
i32.const 88
i32.const 70
i32.const 72
i32.const 0
call $~lib/env/abort
unreachable
end
)
(func $start (; 35 ;) (type $FUNCSIG$v)
(func $std/runtime/main (; 35 ;) (type $FUNCSIG$v)
global.get $~lib/started
i32.eqz
if
call $start
i32.const 1
global.set $~lib/started
end
)
(func $start (; 36 ;) (type $FUNCSIG$v)
call $start:std/runtime
)
(func $null (; 36 ;) (type $FUNCSIG$v)
(func $null (; 37 ;) (type $FUNCSIG$v)
)
)

View File

@ -131,7 +131,7 @@
if
i32.const 0
i32.const 24
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -146,7 +146,7 @@
if
i32.const 0
i32.const 24
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -167,7 +167,7 @@
if
i32.const 0
i32.const 24
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -184,7 +184,7 @@
if
i32.const 0
i32.const 24
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -467,7 +467,7 @@
call $~lib/env/abort
unreachable
end
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
local.get $1
local.set $2
local.get $2
@ -562,23 +562,14 @@
i32.store offset=20
)
(func $~lib/set/Set<i8>#constructor (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Set<i8>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 1
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 1
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -1391,23 +1382,14 @@
i32.store offset=20
)
(func $~lib/set/Set<u8>#constructor (; 21 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Set<u8>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.2 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 4
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 4
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -2205,23 +2187,14 @@
i32.store offset=20
)
(func $~lib/set/Set<i16>#constructor (; 30 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Set<i16>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.3 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 5
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 5
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -3049,23 +3022,14 @@
i32.store offset=20
)
(func $~lib/set/Set<u16>#constructor (; 40 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Set<u16>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.4 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 6
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 6
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -3863,23 +3827,14 @@
i32.store offset=20
)
(func $~lib/set/Set<i32>#constructor (; 49 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Set<i32>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.5 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 7
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 7
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -4711,23 +4666,14 @@
i32.store offset=20
)
(func $~lib/set/Set<u32>#constructor (; 59 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Set<u32>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.6 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 8
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 8
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -5517,23 +5463,14 @@
i32.store offset=20
)
(func $~lib/set/Set<i64>#constructor (; 68 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Set<i64>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.7 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 9
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 9
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -6414,23 +6351,14 @@
i32.store offset=20
)
(func $~lib/set/Set<u64>#constructor (; 78 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Set<u64>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.8 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 10
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 10
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -7223,23 +7151,14 @@
i32.store offset=20
)
(func $~lib/set/Set<f32>#constructor (; 87 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Set<f32>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.9 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 11
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 11
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -8036,23 +7955,14 @@
i32.store offset=20
)
(func $~lib/set/Set<f64>#constructor (; 96 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Set<f64>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.10 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 12
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 12
call $~lib/runtime/register
local.set $0
end
local.get $0

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,5 @@
import "allocator/arena"; // assignment checks for possible resize
const i: i32[] = [1, 2];
const I: i64[] = [3, 4];
const f: f32[] = [1.5, 2.5];

View File

@ -33,6 +33,8 @@
(global $~lib/runtime/HEADER_SIZE i32 (i32.const 8))
(global $~lib/runtime/HEADER_MAGIC i32 (i32.const -1520547049))
(global $~lib/runtime/MAX_BYTELENGTH i32 (i32.const 1073741816))
(global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0))
(global $~lib/allocator/arena/offset (mut i32) (i32.const 0))
(global $~lib/memory/HEAP_BASE i32 (i32.const 312))
(export "memory" (memory $0))
(export "table" (table $0))
@ -82,7 +84,89 @@
i32.shl
)
(func $~lib/memory/memory.allocate (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
unreachable
(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 $4
i32.gt_u
select
i32.add
i32.const 7
i32.add
i32.const 7
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
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
end
end
local.get $3
global.set $~lib/allocator/arena/offset
local.get $2
end
return
)
(func $~lib/util/memory/memcpy (; 6 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32)
(local $3 i32)
@ -1774,7 +1858,9 @@
end
)
(func $~lib/memory/memory.free (; 9 ;) (type $FUNCSIG$vi) (param $0 i32)
nop
(local $1 i32)
local.get $0
local.set $1
)
(func $~lib/runtime/reallocate (; 10 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
@ -1841,7 +1927,7 @@
if
i32.const 0
i32.const 280
i32.const 125
i32.const 115
i32.const 8
call $~lib/env/abort
unreachable
@ -2180,7 +2266,7 @@
if
i32.const 0
i32.const 192
i32.const 6
i32.const 8
i32.const 0
call $~lib/env/abort
unreachable
@ -2194,7 +2280,7 @@
if
i32.const 0
i32.const 192
i32.const 7
i32.const 9
i32.const 0
call $~lib/env/abort
unreachable
@ -2208,11 +2294,21 @@
if
i32.const 0
i32.const 192
i32.const 8
i32.const 10
i32.const 0
call $~lib/env/abort
unreachable
end
global.get $~lib/memory/HEAP_BASE
i32.const 7
i32.add
i32.const 7
i32.const -1
i32.xor
i32.and
global.set $~lib/allocator/arena/startOffset
global.get $~lib/allocator/arena/startOffset
global.set $~lib/allocator/arena/offset
global.get $std/static-array/i
i32.const 0
i32.const 2
@ -2226,7 +2322,7 @@
if
i32.const 0
i32.const 192
i32.const 10
i32.const 12
i32.const 0
call $~lib/env/abort
unreachable
@ -2239,7 +2335,7 @@
if
i32.const 0
i32.const 192
i32.const 12
i32.const 14
i32.const 0
call $~lib/env/abort
unreachable
@ -2253,7 +2349,7 @@
if
i32.const 0
i32.const 192
i32.const 13
i32.const 15
i32.const 0
call $~lib/env/abort
unreachable
@ -2267,7 +2363,7 @@
if
i32.const 0
i32.const 192
i32.const 14
i32.const 16
i32.const 0
call $~lib/env/abort
unreachable
@ -2285,7 +2381,7 @@
if
i32.const 0
i32.const 192
i32.const 16
i32.const 18
i32.const 0
call $~lib/env/abort
unreachable
@ -2298,7 +2394,7 @@
if
i32.const 0
i32.const 192
i32.const 18
i32.const 20
i32.const 0
call $~lib/env/abort
unreachable
@ -2312,7 +2408,7 @@
if
i32.const 0
i32.const 192
i32.const 19
i32.const 21
i32.const 0
call $~lib/env/abort
unreachable
@ -2326,7 +2422,7 @@
if
i32.const 0
i32.const 192
i32.const 20
i32.const 22
i32.const 0
call $~lib/env/abort
unreachable
@ -2344,7 +2440,7 @@
if
i32.const 0
i32.const 192
i32.const 22
i32.const 24
i32.const 0
call $~lib/env/abort
unreachable
@ -2357,7 +2453,7 @@
if
i32.const 0
i32.const 192
i32.const 24
i32.const 26
i32.const 0
call $~lib/env/abort
unreachable
@ -2371,7 +2467,7 @@
if
i32.const 0
i32.const 192
i32.const 25
i32.const 27
i32.const 0
call $~lib/env/abort
unreachable
@ -2385,7 +2481,7 @@
if
i32.const 0
i32.const 192
i32.const 26
i32.const 28
i32.const 0
call $~lib/env/abort
unreachable
@ -2403,7 +2499,7 @@
if
i32.const 0
i32.const 192
i32.const 28
i32.const 30
i32.const 0
call $~lib/env/abort
unreachable

View File

@ -1514,7 +1514,7 @@
if
i32.const 0
i32.const 136
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -1529,7 +1529,7 @@
if
i32.const 0
i32.const 136
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -1928,7 +1928,7 @@
if
i32.const 0
i32.const 136
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -1945,7 +1945,7 @@
if
i32.const 0
i32.const 136
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -444,7 +444,7 @@
if
i32.const 0
i32.const 120
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -459,7 +459,7 @@
if
i32.const 0
i32.const 120
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -3289,7 +3289,7 @@
if
i32.const 0
i32.const 120
i32.const 125
i32.const 115
i32.const 8
call $~lib/env/abort
unreachable
@ -5235,7 +5235,7 @@
if
i32.const 0
i32.const 120
i32.const 185
i32.const 175
i32.const 4
call $~lib/env/abort
unreachable
@ -5249,7 +5249,7 @@
if
i32.const 0
i32.const 120
i32.const 187
i32.const 177
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -366,7 +366,7 @@
if
i32.const 0
i32.const 120
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -383,7 +383,7 @@
if
i32.const 0
i32.const 120
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -3505,15 +3505,15 @@
(local $9 i32)
i32.const 16
call $~lib/runtime/allocate
local.get $2
local.get $1
call $~lib/runtime/register
local.set $4
local.get $0
local.get $3
local.get $2
i32.shl
local.set $5
local.get $0
local.get $3
local.get $2
i32.shl
call $~lib/runtime/allocate
i32.const 3
@ -3551,10 +3551,10 @@
local.get $4
local.get $0
i32.store offset=12
local.get $1
local.get $3
if
local.get $6
local.get $1
local.get $3
local.get $5
call $~lib/memory/memory.copy
end
@ -3893,7 +3893,7 @@
if
i32.const 0
i32.const 120
i32.const 125
i32.const 115
i32.const 8
call $~lib/env/abort
unreachable
@ -4123,9 +4123,9 @@
i32.const 0
local.set $3
local.get $4
i32.const 2
i32.const 2
local.get $3
i32.const 2
i32.const 2
call $~lib/runtime/makeArray
end
return
@ -4135,17 +4135,11 @@
i32.eq
if
block (result i32)
block $~lib/runtime/MAKEARRAY<String>|inlined.1 (result i32)
i32.const 1
local.set $5
i32.const 0
local.set $6
local.get $5
local.get $6
i32.const 2
i32.const 2
call $~lib/runtime/makeArray
end
i32.const 1
i32.const 2
i32.const 2
i32.const 0
call $~lib/runtime/makeArray
local.set $3
local.get $3
i32.load offset=4
@ -4153,11 +4147,11 @@
local.get $4
block (result i32)
local.get $0
local.set $6
local.get $6
local.set $5
local.get $5
local.get $3
call $~lib/collector/dummy/__ref_link
local.get $6
local.get $5
end
i32.store
local.get $3
@ -4166,10 +4160,10 @@
end
local.get $0
call $~lib/string/String#get:length
local.set $7
local.set $6
local.get $1
call $~lib/string/String#get:length
local.set $8
local.set $7
local.get $2
i32.const 0
i32.lt_s
@ -4177,26 +4171,26 @@
global.get $~lib/builtins/i32.MAX_VALUE
local.set $2
end
local.get $8
local.get $7
i32.eqz
if
local.get $7
local.get $6
i32.eqz
if
block $~lib/runtime/MAKEARRAY<String>|inlined.2 (result i32)
block $~lib/runtime/MAKEARRAY<String>|inlined.1 (result i32)
i32.const 0
local.set $3
i32.const 0
local.set $4
local.get $3
i32.const 2
i32.const 2
local.get $4
i32.const 2
i32.const 2
call $~lib/runtime/makeArray
end
return
end
local.get $7
local.get $6
local.tee $4
local.get $2
local.tee $3
@ -4204,16 +4198,16 @@
local.get $3
i32.lt_s
select
local.set $7
block $~lib/runtime/MAKEARRAY<String>|inlined.3 (result i32)
local.get $7
local.set $6
block $~lib/runtime/MAKEARRAY<String>|inlined.2 (result i32)
local.get $6
local.set $3
i32.const 0
local.set $4
local.get $3
i32.const 2
i32.const 2
local.get $4
i32.const 2
i32.const 2
call $~lib/runtime/makeArray
end
local.set $4
@ -4222,10 +4216,10 @@
local.set $3
block $break|0
i32.const 0
local.set $6
local.set $5
loop $repeat|0
local.get $5
local.get $6
local.get $7
i32.lt_s
i32.eqz
br_if $break|0
@ -4237,35 +4231,35 @@
local.get $9
call $~lib/runtime/allocate
end
local.set $5
local.get $5
local.set $8
local.get $8
i32.const 1
call $~lib/runtime/register
end
local.set $5
local.get $5
local.set $8
local.get $8
local.get $0
local.get $6
local.get $5
i32.const 1
i32.shl
i32.add
i32.load16_u
i32.store16
local.get $3
local.get $6
local.get $5
i32.const 2
i32.shl
i32.add
local.get $5
local.get $8
i32.store
local.get $5
local.get $8
local.get $4
call $~lib/collector/dummy/__ref_link
end
local.get $6
local.get $5
i32.const 1
i32.add
local.set $6
local.set $5
br $repeat|0
unreachable
end
@ -4274,18 +4268,18 @@
local.get $4
return
else
local.get $7
local.get $6
i32.eqz
if
block $~lib/runtime/MAKEARRAY<String>|inlined.4 (result i32)
block $~lib/runtime/MAKEARRAY<String>|inlined.3 (result i32)
i32.const 1
local.set $4
i32.const 0
local.set $3
local.get $4
i32.const 2
i32.const 2
local.get $3
i32.const 2
i32.const 2
call $~lib/runtime/makeArray
end
local.set $3
@ -4297,15 +4291,15 @@
return
end
end
block $~lib/runtime/MAKEARRAY<String>|inlined.5 (result i32)
block $~lib/runtime/MAKEARRAY<String>|inlined.4 (result i32)
i32.const 0
local.set $4
i32.const 0
local.set $3
local.get $4
i32.const 2
i32.const 2
local.get $3
i32.const 2
i32.const 2
call $~lib/runtime/makeArray
end
local.set $10
@ -4362,8 +4356,8 @@
local.get $10
block $~lib/runtime/REGISTER<String>|inlined.8 (result i32)
local.get $4
local.set $6
local.get $6
local.set $5
local.get $5
i32.const 1
call $~lib/runtime/register
end
@ -4386,7 +4380,7 @@
return
end
local.get $11
local.get $8
local.get $7
i32.add
local.set $12
end
@ -4397,15 +4391,15 @@
local.get $12
i32.eqz
if
block $~lib/runtime/MAKEARRAY<String>|inlined.6 (result i32)
block $~lib/runtime/MAKEARRAY<String>|inlined.5 (result i32)
i32.const 1
local.set $4
i32.const 0
local.set $3
local.get $4
i32.const 2
i32.const 2
local.get $3
i32.const 2
i32.const 2
call $~lib/runtime/makeArray
end
local.set $3
@ -4416,7 +4410,7 @@
local.get $3
return
end
local.get $7
local.get $6
local.get $12
i32.sub
local.set $14
@ -6711,7 +6705,7 @@
if
i32.const 0
i32.const 120
i32.const 185
i32.const 175
i32.const 4
call $~lib/env/abort
unreachable
@ -6728,7 +6722,7 @@
if
i32.const 0
i32.const 120
i32.const 187
i32.const 177
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -144,7 +144,7 @@
if
i32.const 0
i32.const 72
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -159,7 +159,7 @@
if
i32.const 0
i32.const 72
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable

View File

@ -201,7 +201,7 @@
if
i32.const 0
i32.const 72
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -218,7 +218,7 @@
if
i32.const 0
i32.const 72
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -499,7 +499,7 @@
call $~lib/env/abort
unreachable
end
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
local.get $1
local.set $2
local.get $2
@ -545,23 +545,14 @@
i32.store offset=20
)
(func $~lib/map/Map<String,usize>#constructor (; 9 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Map<String,usize>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.0 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 2
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 2
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -614,23 +605,14 @@
i32.store offset=20
)
(func $~lib/map/Map<usize,String>#constructor (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32)
(local $1 i32)
block (result i32)
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<Map<usize,String>>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.2 (result i32)
i32.const 24
local.set $1
local.get $1
call $~lib/runtime/allocate
end
local.set $1
local.get $1
i32.const 4
call $~lib/runtime/register
end
i32.const 24
call $~lib/runtime/allocate
i32.const 4
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -3036,7 +3018,7 @@
i32.const 160
return
end
block $~lib/runtime/ALLOCATE|inlined.3 (result i32)
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
local.get $4
local.set $5
local.get $5

View File

@ -439,7 +439,7 @@
if
i32.const 0
i32.const 80
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -454,7 +454,7 @@
if
i32.const 0
i32.const 80
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -497,7 +497,7 @@
if
i32.const 0
i32.const 80
i32.const 244
i32.const 234
i32.const 57
call $~lib/env/abort
unreachable
@ -3055,26 +3055,26 @@
(local $5 i32)
i32.const 16
call $~lib/runtime/allocate
local.get $2
local.get $1
call $~lib/runtime/register
local.set $4
local.get $0
local.get $3
local.get $2
i32.shl
local.tee $5
call $~lib/runtime/allocate
i32.const 2
call $~lib/runtime/register
local.tee $3
local.set $2
local.tee $2
local.set $1
local.get $4
i32.load
drop
local.get $4
local.get $2
local.get $1
i32.store
local.get $4
local.get $3
local.get $2
i32.store offset=4
local.get $4
local.get $5
@ -3082,10 +3082,10 @@
local.get $4
local.get $0
i32.store offset=12
local.get $1
local.get $3
if
local.get $2
local.get $3
local.get $1
local.get $5
call $~lib/memory/memory.copy
end
@ -13038,9 +13038,9 @@
call $~lib/typedarray/Int8Array#fill
global.get $std/typedarray/arr8
i32.const 5
i32.const 240
i32.const 15
i32.const 0
i32.const 240
call $~lib/runtime/makeArray
call $std/typedarray/isInt8ArrayEqual
i32.eqz
@ -13059,9 +13059,9 @@
call $~lib/typedarray/Int8Array#fill
global.get $std/typedarray/arr8
i32.const 5
i32.const 312
i32.const 15
i32.const 0
i32.const 312
call $~lib/runtime/makeArray
call $std/typedarray/isInt8ArrayEqual
i32.eqz
@ -13080,9 +13080,9 @@
call $~lib/typedarray/Int8Array#fill
global.get $std/typedarray/arr8
i32.const 5
i32.const 336
i32.const 15
i32.const 0
i32.const 336
call $~lib/runtime/makeArray
call $std/typedarray/isInt8ArrayEqual
i32.eqz
@ -13101,9 +13101,9 @@
call $~lib/typedarray/Int8Array#fill
global.get $std/typedarray/arr8
i32.const 5
i32.const 360
i32.const 15
i32.const 0
i32.const 360
call $~lib/runtime/makeArray
call $std/typedarray/isInt8ArrayEqual
i32.eqz
@ -13122,9 +13122,9 @@
call $~lib/typedarray/Int8Array#fill
global.get $std/typedarray/arr8
i32.const 5
i32.const 384
i32.const 15
i32.const 0
i32.const 384
call $~lib/runtime/makeArray
call $std/typedarray/isInt8ArrayEqual
i32.eqz
@ -13188,9 +13188,9 @@
end
global.get $std/typedarray/sub8
i32.const 3
i32.const 408
i32.const 15
i32.const 0
i32.const 408
call $~lib/runtime/makeArray
call $std/typedarray/isInt8ArrayEqual
i32.eqz
@ -13204,9 +13204,9 @@
end
global.get $std/typedarray/arr8
i32.const 5
i32.const 432
i32.const 15
i32.const 0
i32.const 432
call $~lib/runtime/makeArray
call $std/typedarray/isInt8ArrayEqual
i32.eqz
@ -13248,9 +13248,9 @@
call $~lib/typedarray/Int32Array#fill
global.get $std/typedarray/arr32
i32.const 5
i32.const 456
i32.const 16
i32.const 2
i32.const 456
call $~lib/runtime/makeArray
call $std/typedarray/isInt32ArrayEqual
i32.eqz
@ -13269,9 +13269,9 @@
call $~lib/typedarray/Int32Array#fill
global.get $std/typedarray/arr32
i32.const 5
i32.const 496
i32.const 16
i32.const 2
i32.const 496
call $~lib/runtime/makeArray
call $std/typedarray/isInt32ArrayEqual
i32.eqz
@ -13290,9 +13290,9 @@
call $~lib/typedarray/Int32Array#fill
global.get $std/typedarray/arr32
i32.const 5
i32.const 536
i32.const 16
i32.const 2
i32.const 536
call $~lib/runtime/makeArray
call $std/typedarray/isInt32ArrayEqual
i32.eqz
@ -13311,9 +13311,9 @@
call $~lib/typedarray/Int32Array#fill
global.get $std/typedarray/arr32
i32.const 5
i32.const 576
i32.const 16
i32.const 2
i32.const 576
call $~lib/runtime/makeArray
call $std/typedarray/isInt32ArrayEqual
i32.eqz
@ -13332,9 +13332,9 @@
call $~lib/typedarray/Int32Array#fill
global.get $std/typedarray/arr32
i32.const 5
i32.const 616
i32.const 16
i32.const 2
i32.const 616
call $~lib/runtime/makeArray
call $std/typedarray/isInt32ArrayEqual
i32.eqz
@ -13400,9 +13400,9 @@
end
global.get $std/typedarray/sub32
i32.const 3
i32.const 656
i32.const 16
i32.const 2
i32.const 656
call $~lib/runtime/makeArray
call $std/typedarray/isInt32ArrayEqual
i32.eqz
@ -13416,9 +13416,9 @@
end
global.get $std/typedarray/arr32
i32.const 5
i32.const 688
i32.const 16
i32.const 2
i32.const 688
call $~lib/runtime/makeArray
call $std/typedarray/isInt32ArrayEqual
i32.eqz

View File

@ -498,7 +498,7 @@
if
i32.const 0
i32.const 80
i32.const 161
i32.const 151
i32.const 4
call $~lib/env/abort
unreachable
@ -515,7 +515,7 @@
if
i32.const 0
i32.const 80
i32.const 163
i32.const 153
i32.const 4
call $~lib/env/abort
unreachable
@ -579,7 +579,7 @@
if
i32.const 0
i32.const 80
i32.const 244
i32.const 234
i32.const 57
call $~lib/env/abort
unreachable
@ -595,18 +595,10 @@
local.get $0
i32.eqz
if
block $~lib/runtime/REGISTER<ArrayBufferView>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
i32.const 12
local.set $4
local.get $4
call $~lib/runtime/allocate
end
local.set $4
local.get $4
i32.const 3
call $~lib/runtime/register
end
i32.const 12
call $~lib/runtime/allocate
i32.const 3
call $~lib/runtime/register
local.set $0
end
local.get $0
@ -651,19 +643,12 @@
local.get $0
)
(func $~lib/typedarray/Int8Array#constructor (; 11 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.2 (result i32)
i32.const 12
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 12
call $~lib/runtime/allocate
i32.const 4
call $~lib/runtime/register
end
@ -689,19 +674,12 @@
call $~lib/runtime/ArrayBufferView#get:byteLength
)
(func $~lib/typedarray/Uint8Array#constructor (; 15 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.3 (result i32)
i32.const 12
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 12
call $~lib/runtime/allocate
i32.const 5
call $~lib/runtime/register
end
@ -716,19 +694,12 @@
call $~lib/runtime/ArrayBufferView#get:byteLength
)
(func $~lib/typedarray/Uint8ClampedArray#constructor (; 17 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.4 (result i32)
i32.const 12
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 12
call $~lib/runtime/allocate
i32.const 6
call $~lib/runtime/register
end
@ -743,19 +714,12 @@
call $~lib/runtime/ArrayBufferView#get:byteLength
)
(func $~lib/typedarray/Int16Array#constructor (; 19 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.5 (result i32)
i32.const 12
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 12
call $~lib/runtime/allocate
i32.const 7
call $~lib/runtime/register
end
@ -772,19 +736,12 @@
i32.shr_u
)
(func $~lib/typedarray/Uint16Array#constructor (; 21 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.6 (result i32)
i32.const 12
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 12
call $~lib/runtime/allocate
i32.const 8
call $~lib/runtime/register
end
@ -801,19 +758,12 @@
i32.shr_u
)
(func $~lib/typedarray/Int32Array#constructor (; 23 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.7 (result i32)
i32.const 12
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 12
call $~lib/runtime/allocate
i32.const 9
call $~lib/runtime/register
end
@ -830,19 +780,12 @@
i32.shr_u
)
(func $~lib/typedarray/Uint32Array#constructor (; 25 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.8 (result i32)
i32.const 12
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 12
call $~lib/runtime/allocate
i32.const 10
call $~lib/runtime/register
end
@ -859,19 +802,12 @@
i32.shr_u
)
(func $~lib/typedarray/Int64Array#constructor (; 27 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.9 (result i32)
i32.const 12
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 12
call $~lib/runtime/allocate
i32.const 11
call $~lib/runtime/register
end
@ -888,19 +824,12 @@
i32.shr_u
)
(func $~lib/typedarray/Uint64Array#constructor (; 29 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.10 (result i32)
i32.const 12
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 12
call $~lib/runtime/allocate
i32.const 12
call $~lib/runtime/register
end
@ -917,19 +846,12 @@
i32.shr_u
)
(func $~lib/typedarray/Float32Array#constructor (; 31 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.11 (result i32)
i32.const 12
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 12
call $~lib/runtime/allocate
i32.const 13
call $~lib/runtime/register
end
@ -946,19 +868,12 @@
i32.shr_u
)
(func $~lib/typedarray/Float64Array#constructor (; 33 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32)
(local $2 i32)
local.get $0
if (result i32)
local.get $0
else
block $~lib/runtime/ALLOCATE|inlined.12 (result i32)
i32.const 12
local.set $2
local.get $2
call $~lib/runtime/allocate
end
local.set $2
local.get $2
i32.const 12
call $~lib/runtime/allocate
i32.const 14
call $~lib/runtime/register
end
@ -1608,8 +1523,8 @@
select
local.set $3
end
block $~lib/runtime/REGISTER<Int32Array>|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.13 (result i32)
block $~lib/runtime/REGISTER<Int32Array>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.1 (result i32)
i32.const 12
local.set $8
local.get $8
@ -1769,8 +1684,8 @@
select
local.set $3
end
block $~lib/runtime/REGISTER<Float64Array>|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.14 (result i32)
block $~lib/runtime/REGISTER<Float64Array>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.2 (result i32)
i32.const 12
local.set $8
local.get $8
@ -3987,15 +3902,15 @@
(local $9 i32)
i32.const 16
call $~lib/runtime/allocate
local.get $2
local.get $1
call $~lib/runtime/register
local.set $4
local.get $0
local.get $3
local.get $2
i32.shl
local.set $5
local.get $0
local.get $3
local.get $2
i32.shl
call $~lib/runtime/allocate
i32.const 2
@ -4033,10 +3948,10 @@
local.get $4
local.get $0
i32.store offset=12
local.get $1
local.get $3
if
local.get $6
local.get $1
local.get $3
local.get $5
call $~lib/memory/memory.copy
end
@ -4220,8 +4135,8 @@
select
local.set $3
end
block $~lib/runtime/REGISTER<Int8Array>|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.15 (result i32)
block $~lib/runtime/REGISTER<Int8Array>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.3 (result i32)
i32.const 12
local.set $8
local.get $8
@ -15189,8 +15104,8 @@
select
local.set $3
end
block $~lib/runtime/REGISTER<Uint8Array>|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.16 (result i32)
block $~lib/runtime/REGISTER<Uint8Array>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.4 (result i32)
i32.const 12
local.set $8
local.get $8
@ -15554,8 +15469,8 @@
select
local.set $3
end
block $~lib/runtime/REGISTER<Uint8ClampedArray>|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.17 (result i32)
block $~lib/runtime/REGISTER<Uint8ClampedArray>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.5 (result i32)
i32.const 12
local.set $8
local.get $8
@ -15919,8 +15834,8 @@
select
local.set $3
end
block $~lib/runtime/REGISTER<Int16Array>|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.18 (result i32)
block $~lib/runtime/REGISTER<Int16Array>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.6 (result i32)
i32.const 12
local.set $8
local.get $8
@ -16290,8 +16205,8 @@
select
local.set $3
end
block $~lib/runtime/REGISTER<Uint16Array>|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.19 (result i32)
block $~lib/runtime/REGISTER<Uint16Array>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.7 (result i32)
i32.const 12
local.set $8
local.get $8
@ -16877,8 +16792,8 @@
select
local.set $3
end
block $~lib/runtime/REGISTER<Uint32Array>|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.20 (result i32)
block $~lib/runtime/REGISTER<Uint32Array>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.8 (result i32)
i32.const 12
local.set $8
local.get $8
@ -17236,8 +17151,8 @@
select
local.set $3
end
block $~lib/runtime/REGISTER<Int64Array>|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.21 (result i32)
block $~lib/runtime/REGISTER<Int64Array>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.9 (result i32)
i32.const 12
local.set $8
local.get $8
@ -17598,8 +17513,8 @@
select
local.set $3
end
block $~lib/runtime/REGISTER<Uint64Array>|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.22 (result i32)
block $~lib/runtime/REGISTER<Uint64Array>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.10 (result i32)
i32.const 12
local.set $8
local.get $8
@ -17960,8 +17875,8 @@
select
local.set $3
end
block $~lib/runtime/REGISTER<Float32Array>|inlined.1 (result i32)
block $~lib/runtime/ALLOCATE|inlined.23 (result i32)
block $~lib/runtime/REGISTER<Float32Array>|inlined.0 (result i32)
block $~lib/runtime/ALLOCATE|inlined.11 (result i32)
i32.const 12
local.set $8
local.get $8
@ -18400,7 +18315,6 @@
)
(func $start:std/typedarray (; 378 ;) (type $FUNCSIG$v)
(local $0 i32)
(local $1 i32)
global.get $~lib/typedarray/Int8Array.BYTES_PER_ELEMENT
i32.const 1
i32.eq
@ -18933,17 +18847,11 @@
call $~lib/typedarray/Int8Array#fill
drop
global.get $std/typedarray/arr8
block $~lib/runtime/MAKEARRAY<i8>|inlined.0 (result i32)
i32.const 5
local.set $0
i32.const 240
local.set $1
local.get $0
local.get $1
i32.const 15
i32.const 0
call $~lib/runtime/makeArray
end
i32.const 5
i32.const 15
i32.const 0
i32.const 240
call $~lib/runtime/makeArray
call $std/typedarray/isInt8ArrayEqual
i32.eqz
if
@ -18961,17 +18869,11 @@
call $~lib/typedarray/Int8Array#fill
drop
global.get $std/typedarray/arr8
block $~lib/runtime/MAKEARRAY<i8>|inlined.1 (result i32)
i32.const 5
local.set $1
i32.const 312
local.set $0
local.get $1
local.get $0
i32.const 15
i32.const 0
call $~lib/runtime/makeArray
end
i32.const 5
i32.const 15
i32.const 0
i32.const 312
call $~lib/runtime/makeArray
call $std/typedarray/isInt8ArrayEqual
i32.eqz
if
@ -18989,17 +18891,11 @@
call $~lib/typedarray/Int8Array#fill
drop
global.get $std/typedarray/arr8
block $~lib/runtime/MAKEARRAY<i8>|inlined.2 (result i32)
i32.const 5
local.set $0
i32.const 336
local.set $1
local.get $0
local.get $1
i32.const 15
i32.const 0
call $~lib/runtime/makeArray
end
i32.const 5
i32.const 15
i32.const 0
i32.const 336
call $~lib/runtime/makeArray
call $std/typedarray/isInt8ArrayEqual
i32.eqz
if
@ -19017,17 +18913,11 @@
call $~lib/typedarray/Int8Array#fill
drop
global.get $std/typedarray/arr8
block $~lib/runtime/MAKEARRAY<i8>|inlined.3 (result i32)
i32.const 5
local.set $1
i32.const 360
local.set $0
local.get $1
local.get $0
i32.const 15
i32.const 0
call $~lib/runtime/makeArray
end
i32.const 5
i32.const 15
i32.const 0
i32.const 360
call $~lib/runtime/makeArray
call $std/typedarray/isInt8ArrayEqual
i32.eqz
if
@ -19045,17 +18935,11 @@
call $~lib/typedarray/Int8Array#fill
drop
global.get $std/typedarray/arr8
block $~lib/runtime/MAKEARRAY<i8>|inlined.4 (result i32)
i32.const 5
local.set $0
i32.const 384
local.set $1
local.get $0
local.get $1
i32.const 15
i32.const 0
call $~lib/runtime/makeArray
end
i32.const 5
i32.const 15
i32.const 0
i32.const 384
call $~lib/runtime/makeArray
call $std/typedarray/isInt8ArrayEqual
i32.eqz
if
@ -19117,17 +19001,11 @@
unreachable
end
global.get $std/typedarray/sub8
block $~lib/runtime/MAKEARRAY<i8>|inlined.5 (result i32)
i32.const 3
local.set $1
i32.const 408
local.set $0
local.get $1
local.get $0
i32.const 15
i32.const 0
call $~lib/runtime/makeArray
end
i32.const 3
i32.const 15
i32.const 0
i32.const 408
call $~lib/runtime/makeArray
call $std/typedarray/isInt8ArrayEqual
i32.eqz
if
@ -19139,17 +19017,11 @@
unreachable
end
global.get $std/typedarray/arr8
block $~lib/runtime/MAKEARRAY<i8>|inlined.6 (result i32)
i32.const 5
local.set $0
i32.const 432
local.set $1
local.get $0
local.get $1
i32.const 15
i32.const 0
call $~lib/runtime/makeArray
end
i32.const 5
i32.const 15
i32.const 0
i32.const 432
call $~lib/runtime/makeArray
call $std/typedarray/isInt8ArrayEqual
i32.eqz
if
@ -19191,17 +19063,11 @@
call $~lib/typedarray/Int32Array#fill
drop
global.get $std/typedarray/arr32
block $~lib/runtime/MAKEARRAY<i32>|inlined.0 (result i32)
i32.const 5
local.set $1
i32.const 456
local.set $0
local.get $1
local.get $0
i32.const 16
i32.const 2
call $~lib/runtime/makeArray
end
i32.const 5
i32.const 16
i32.const 2
i32.const 456
call $~lib/runtime/makeArray
call $std/typedarray/isInt32ArrayEqual
i32.eqz
if
@ -19219,17 +19085,11 @@
call $~lib/typedarray/Int32Array#fill
drop
global.get $std/typedarray/arr32
block $~lib/runtime/MAKEARRAY<i32>|inlined.1 (result i32)
i32.const 5
local.set $0
i32.const 496
local.set $1
local.get $0
local.get $1
i32.const 16
i32.const 2
call $~lib/runtime/makeArray
end
i32.const 5
i32.const 16
i32.const 2
i32.const 496
call $~lib/runtime/makeArray
call $std/typedarray/isInt32ArrayEqual
i32.eqz
if
@ -19247,17 +19107,11 @@
call $~lib/typedarray/Int32Array#fill
drop
global.get $std/typedarray/arr32
block $~lib/runtime/MAKEARRAY<i32>|inlined.2 (result i32)
i32.const 5
local.set $1
i32.const 536
local.set $0
local.get $1
local.get $0
i32.const 16
i32.const 2
call $~lib/runtime/makeArray
end
i32.const 5
i32.const 16
i32.const 2
i32.const 536
call $~lib/runtime/makeArray
call $std/typedarray/isInt32ArrayEqual
i32.eqz
if
@ -19275,17 +19129,11 @@
call $~lib/typedarray/Int32Array#fill
drop
global.get $std/typedarray/arr32
block $~lib/runtime/MAKEARRAY<i32>|inlined.3 (result i32)
i32.const 5
local.set $0
i32.const 576
local.set $1
local.get $0
local.get $1
i32.const 16
i32.const 2
call $~lib/runtime/makeArray
end
i32.const 5
i32.const 16
i32.const 2
i32.const 576
call $~lib/runtime/makeArray
call $std/typedarray/isInt32ArrayEqual
i32.eqz
if
@ -19303,17 +19151,11 @@
call $~lib/typedarray/Int32Array#fill
drop
global.get $std/typedarray/arr32
block $~lib/runtime/MAKEARRAY<i32>|inlined.4 (result i32)
i32.const 5
local.set $1
i32.const 616
local.set $0
local.get $1
local.get $0
i32.const 16
i32.const 2
call $~lib/runtime/makeArray
end
i32.const 5
i32.const 16
i32.const 2
i32.const 616
call $~lib/runtime/makeArray
call $std/typedarray/isInt32ArrayEqual
i32.eqz
if
@ -19379,17 +19221,11 @@
unreachable
end
global.get $std/typedarray/sub32
block $~lib/runtime/MAKEARRAY<i32>|inlined.5 (result i32)
i32.const 3
local.set $0
i32.const 656
local.set $1
local.get $0
local.get $1
i32.const 16
i32.const 2
call $~lib/runtime/makeArray
end
i32.const 3
i32.const 16
i32.const 2
i32.const 656
call $~lib/runtime/makeArray
call $std/typedarray/isInt32ArrayEqual
i32.eqz
if
@ -19401,17 +19237,11 @@
unreachable
end
global.get $std/typedarray/arr32
block $~lib/runtime/MAKEARRAY<i32>|inlined.6 (result i32)
i32.const 5
local.set $1
i32.const 688
local.set $0
local.get $1
local.get $0
i32.const 16
i32.const 2
call $~lib/runtime/makeArray
end
i32.const 5
i32.const 16
i32.const 2
i32.const 688
call $~lib/runtime/makeArray
call $std/typedarray/isInt32ArrayEqual
i32.eqz
if