diff --git a/std/assembly/rt/index.d.ts b/std/assembly/rt/index.d.ts index b8d1c74f3c..a911e2627c 100644 --- a/std/assembly/rt/index.d.ts +++ b/std/assembly/rt/index.d.ts @@ -12,5 +12,6 @@ declare function __visit_globals(cookie: u32): void; declare function __visit_members(ref: usize, cookie: u32): void; declare function __allocBuffer(size: usize, id: u32, data?: usize): usize; declare function __allocArray(length: i32, alignLog2: usize, id: u32, data?: usize): usize; +declare function __finalize(ref: usize): void; declare const ASC_RTRACE: bool; declare const __GC_ALL_ACYCLIC: bool; diff --git a/std/assembly/rt/pure.ts b/std/assembly/rt/pure.ts index 0f27bd326e..863fc141a2 100644 --- a/std/assembly/rt/pure.ts +++ b/std/assembly/rt/pure.ts @@ -124,10 +124,10 @@ function decrement(s: Block): void { __visit_members(changetype(s) + BLOCK_OVERHEAD, VISIT_DECREMENT); if (isDefined(__GC_ALL_ACYCLIC)) { if (DEBUG) assert(!(info & BUFFERED_MASK)); - freeBlock(ROOT, s); + finalize(s); } else { if (!(info & BUFFERED_MASK)) { - freeBlock(ROOT, s); + finalize(s); } else { s.gcInfo = BUFFERED_MASK | COLOR_BLACK | 0; } @@ -149,6 +149,14 @@ function decrement(s: Block): void { } } +/** Finalizes the specified block, giving it back to the memory manager. */ +function finalize(s: Block): void { + if (isDefined(__finalize)) { + __finalize(changetype(s) + BLOCK_OVERHEAD); + } + freeBlock(ROOT, s); +} + /** Buffer of possible roots. */ // @ts-ignore: decorator @lazy var ROOTS: usize; @@ -205,7 +213,7 @@ export function __collect(): void { cur += sizeof(); } else { if ((info & COLOR_MASK) == COLOR_BLACK && !(info & REFCOUNT_MASK)) { - freeBlock(ROOT, s); + finalize(s); } else { s.gcInfo = info & ~BUFFERED_MASK; } @@ -261,7 +269,7 @@ function collectWhite(s: Block): void { if ((info & COLOR_MASK) == COLOR_WHITE && !(info & BUFFERED_MASK)) { s.gcInfo = (info & ~COLOR_MASK) | COLOR_BLACK; __visit_members(changetype(s) + BLOCK_OVERHEAD, VISIT_COLLECTWHITE); - freeBlock(ROOT, s); + finalize(s); } } diff --git a/tests/compiler/do.untouched.wat b/tests/compiler/do.untouched.wat index 418a287303..4ba3692148 100644 --- a/tests/compiler/do.untouched.wat +++ b/tests/compiler/do.untouched.wat @@ -2296,6 +2296,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -2352,9 +2359,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/extends-baseaggregate.untouched.wat b/tests/compiler/extends-baseaggregate.untouched.wat index fd84213021..38f5b817f3 100644 --- a/tests/compiler/extends-baseaggregate.untouched.wat +++ b/tests/compiler/extends-baseaggregate.untouched.wat @@ -3377,6 +3377,13 @@ call $~lib/rt/__visit_members end ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/scanBlack (param $0 i32) local.get $0 local.get $0 @@ -3464,9 +3471,8 @@ i32.add i32.const 5 call $~lib/rt/__visit_members - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize end ) (func $~lib/rt/pure/__collect @@ -3539,9 +3545,8 @@ i32.const 0 end if - global.get $~lib/rt/tlsf/ROOT local.get $5 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else local.get $5 local.get $6 @@ -3761,9 +3766,8 @@ i32.and i32.eqz if - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else local.get $0 i32.const -2147483648 diff --git a/tests/compiler/for.untouched.wat b/tests/compiler/for.untouched.wat index 78c447d516..70b18169ff 100644 --- a/tests/compiler/for.untouched.wat +++ b/tests/compiler/for.untouched.wat @@ -2341,6 +2341,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -2397,9 +2404,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/implicit-getter-setter.untouched.wat b/tests/compiler/implicit-getter-setter.untouched.wat index e046c665dc..8074e7f460 100644 --- a/tests/compiler/implicit-getter-setter.untouched.wat +++ b/tests/compiler/implicit-getter-setter.untouched.wat @@ -1,6 +1,6 @@ (module - (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_none (func (param i32))) + (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) @@ -1636,6 +1636,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -1692,9 +1699,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/issues/1095.untouched.wat b/tests/compiler/issues/1095.untouched.wat index ababb570f7..69356e6ffa 100644 --- a/tests/compiler/issues/1095.untouched.wat +++ b/tests/compiler/issues/1095.untouched.wat @@ -1620,6 +1620,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -1676,9 +1683,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/issues/1225.untouched.wat b/tests/compiler/issues/1225.untouched.wat index 110b340240..52e7dc1158 100644 --- a/tests/compiler/issues/1225.untouched.wat +++ b/tests/compiler/issues/1225.untouched.wat @@ -1641,6 +1641,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -1697,9 +1704,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/logical.untouched.wat b/tests/compiler/logical.untouched.wat index 65e10a3ab1..dd56298c72 100644 --- a/tests/compiler/logical.untouched.wat +++ b/tests/compiler/logical.untouched.wat @@ -2171,6 +2171,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -2227,9 +2234,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/managed-cast.untouched.wat b/tests/compiler/managed-cast.untouched.wat index 1c3c6de678..819a059fba 100644 --- a/tests/compiler/managed-cast.untouched.wat +++ b/tests/compiler/managed-cast.untouched.wat @@ -1884,6 +1884,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -1940,9 +1947,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/object-literal.untouched.wat b/tests/compiler/object-literal.untouched.wat index 98f6656a59..a8a39b0dda 100644 --- a/tests/compiler/object-literal.untouched.wat +++ b/tests/compiler/object-literal.untouched.wat @@ -3914,6 +3914,13 @@ drop return ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -3970,9 +3977,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/rc/global-init.untouched.wat b/tests/compiler/rc/global-init.untouched.wat index 5e52828faa..bcb9c93bde 100644 --- a/tests/compiler/rc/global-init.untouched.wat +++ b/tests/compiler/rc/global-init.untouched.wat @@ -734,6 +734,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -790,9 +797,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/rc/local-init.untouched.wat b/tests/compiler/rc/local-init.untouched.wat index 3f346a5bc7..4c5c5cecdd 100644 --- a/tests/compiler/rc/local-init.untouched.wat +++ b/tests/compiler/rc/local-init.untouched.wat @@ -1582,6 +1582,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -1638,9 +1645,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/rc/logical-and-mismatch.untouched.wat b/tests/compiler/rc/logical-and-mismatch.untouched.wat index 75a31a6e5d..9047c17834 100644 --- a/tests/compiler/rc/logical-and-mismatch.untouched.wat +++ b/tests/compiler/rc/logical-and-mismatch.untouched.wat @@ -1627,6 +1627,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -1683,9 +1690,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/rc/logical-or-mismatch.untouched.wat b/tests/compiler/rc/logical-or-mismatch.untouched.wat index 05b2addd50..1992299e68 100644 --- a/tests/compiler/rc/logical-or-mismatch.untouched.wat +++ b/tests/compiler/rc/logical-or-mismatch.untouched.wat @@ -1627,6 +1627,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -1683,9 +1690,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/rc/optimize.untouched.wat b/tests/compiler/rc/optimize.untouched.wat index 2504b02101..adac094c22 100644 --- a/tests/compiler/rc/optimize.untouched.wat +++ b/tests/compiler/rc/optimize.untouched.wat @@ -1879,6 +1879,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -1935,9 +1942,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/rc/rereturn.untouched.wat b/tests/compiler/rc/rereturn.untouched.wat index 86eaab64c7..6e8fcd49cc 100644 --- a/tests/compiler/rc/rereturn.untouched.wat +++ b/tests/compiler/rc/rereturn.untouched.wat @@ -1,7 +1,7 @@ (module (type $i32_i32_=>_none (func (param i32 i32))) - (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) + (type $none_=>_none (func)) (type $none_=>_i32 (func (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) @@ -1575,6 +1575,13 @@ i32.const 0 drop ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -1629,9 +1636,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/rc/ternary-mismatch.untouched.wat b/tests/compiler/rc/ternary-mismatch.untouched.wat index f502716e41..a0a89202e2 100644 --- a/tests/compiler/rc/ternary-mismatch.untouched.wat +++ b/tests/compiler/rc/ternary-mismatch.untouched.wat @@ -1611,6 +1611,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -1667,9 +1674,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/resolve-ternary.untouched.wat b/tests/compiler/resolve-ternary.untouched.wat index ddf482c710..865361be0d 100644 --- a/tests/compiler/resolve-ternary.untouched.wat +++ b/tests/compiler/resolve-ternary.untouched.wat @@ -4926,6 +4926,13 @@ drop return ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -4980,9 +4987,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/retain-release-sanity.untouched.wat b/tests/compiler/retain-release-sanity.untouched.wat index e1fa94dd82..a2f9ce9a3e 100644 --- a/tests/compiler/retain-release-sanity.untouched.wat +++ b/tests/compiler/retain-release-sanity.untouched.wat @@ -3962,6 +3962,13 @@ (func $~start call $start:retain-release-sanity ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/__typeinfo (param $0 i32) (result i32) (local $1 i32) global.get $~lib/rt/__rtti_base @@ -4121,9 +4128,8 @@ i32.and i32.eqz if - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else local.get $0 i32.const -2147483648 @@ -4303,9 +4309,8 @@ i32.add i32.const 5 call $~lib/rt/__visit_members - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize end ) (func $~lib/rt/pure/__collect @@ -4378,9 +4383,8 @@ i32.const 0 end if - global.get $~lib/rt/tlsf/ROOT local.get $5 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else local.get $5 local.get $6 diff --git a/tests/compiler/retain-return.untouched.wat b/tests/compiler/retain-return.untouched.wat index 5f9a41b003..072fb06768 100644 --- a/tests/compiler/retain-return.untouched.wat +++ b/tests/compiler/retain-return.untouched.wat @@ -2,8 +2,8 @@ (type $none_=>_i32 (func (result i32))) (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_i32 (func (param i32) (result i32))) - (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) + (type $none_=>_none (func)) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) @@ -1713,6 +1713,13 @@ i32.const 0 drop ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -1767,9 +1774,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/rt/finalize.json b/tests/compiler/rt/finalize.json new file mode 100644 index 0000000000..93ce9d8b22 --- /dev/null +++ b/tests/compiler/rt/finalize.json @@ -0,0 +1,6 @@ +{ + "asc_flags": [ + "--runtime half", + "--explicitStart" + ] +} \ No newline at end of file diff --git a/tests/compiler/rt/finalize.optimized.wat b/tests/compiler/rt/finalize.optimized.wat new file mode 100644 index 0000000000..390f9872fd --- /dev/null +++ b/tests/compiler/rt/finalize.optimized.wat @@ -0,0 +1,2316 @@ +(module + (type $i32_=>_none (func (param i32))) + (type $i32_i32_=>_none (func (param i32 i32))) + (type $none_=>_none (func)) + (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $i32_i32_f64_f64_f64_f64_f64_=>_none (func (param i32 i32 f64 f64 f64 f64 f64))) + (type $none_=>_i32 (func (result i32))) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (import "env" "trace" (func $~lib/builtins/trace (param i32 i32 f64 f64 f64 f64 f64))) + (memory $0 1) + (data (i32.const 1024) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h") + (data (i32.const 1072) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00s\00t\00a\00t\00i\00c\00a\00r\00r\00a\00y\00.\00t\00s") + (data (i32.const 1136) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") + (data (i32.const 1184) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") + (data (i32.const 1248) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s") + (data (i32.const 1296) "\1a\00\00\00\01\00\00\00\01\00\00\00\1a\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s") + (data (i32.const 1344) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00r\00t\00/\00f\00i\00n\00a\00l\00i\00z\00e\00.\00t\00s") + (data (i32.const 1392) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e") + (data (i32.const 1456) "\10\00\00\00\01\00\00\00\01\00\00\00\10\00\00\00f\00i\00n\00a\00l\00i\00z\00e") + (data (i32.const 1488) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s") + (data (i32.const 1536) "\07\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00$\01\00\00\00\00\00\00\"\t") + (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) + (global $rt/finalize/expected (mut i32) (i32.const 0)) + (global $rt/finalize/expectedWriteIndex (mut i32) (i32.const 0)) + (global $rt/finalize/expectedReadIndex (mut i32) (i32.const 0)) + (global $~started (mut i32) (i32.const 0)) + (global $~lib/rt/pure/CUR (mut i32) (i32.const 0)) + (global $~lib/rt/pure/END (mut i32) (i32.const 0)) + (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) + (export "_start" (func $~start)) + (export "memory" (memory $0)) + (func $~lib/rt/pure/__release (param $0 i32) + local.get $0 + i32.const 1596 + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + end + ) + (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + local.tee $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 1152 + i32.const 277 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const -4 + i32.and + local.tee $2 + i32.const 16 + i32.ge_u + if (result i32) + local.get $2 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 1152 + i32.const 279 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 256 + i32.lt_u + if + local.get $2 + i32.const 4 + i32.shr_u + local.set $2 + else + local.get $2 + i32.const 31 + local.get $2 + i32.clz + i32.sub + local.tee $4 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + local.set $2 + local.get $4 + i32.const 7 + i32.sub + local.set $4 + end + local.get $2 + i32.const 16 + i32.lt_u + i32.const 0 + local.get $4 + i32.const 23 + i32.lt_u + select + i32.eqz + if + i32.const 0 + i32.const 1152 + i32.const 292 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load offset=20 + local.set $3 + local.get $1 + i32.load offset=16 + local.tee $5 + if + local.get $5 + local.get $3 + i32.store offset=20 + end + local.get $3 + if + local.get $3 + local.get $5 + i32.store offset=16 + end + local.get $1 + local.get $0 + local.get $2 + local.get $4 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + i32.eq + if + local.get $0 + local.get $2 + local.get $4 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + local.get $3 + i32.store offset=96 + local.get $3 + i32.eqz + if + local.get $0 + local.get $4 + i32.const 2 + i32.shl + i32.add + local.tee $3 + i32.load offset=4 + i32.const 1 + local.get $2 + i32.shl + i32.const -1 + i32.xor + i32.and + local.set $1 + local.get $3 + local.get $1 + i32.store offset=4 + local.get $1 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $4 + i32.shl + i32.const -1 + i32.xor + i32.and + i32.store + end + end + end + ) + (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + local.get $1 + i32.eqz + if + i32.const 0 + i32.const 1152 + i32.const 205 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load + local.tee $3 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 1152 + i32.const 207 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.tee $5 + i32.const 1 + i32.and + if + local.get $3 + i32.const -4 + i32.and + i32.const 16 + i32.add + local.get $5 + i32.const -4 + i32.and + i32.add + local.tee $2 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $2 + local.get $3 + i32.const 3 + i32.and + i32.or + local.tee $3 + i32.store + local.get $1 + i32.const 16 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $4 + i32.load + local.set $5 + end + end + local.get $3 + i32.const 2 + i32.and + if + local.get $1 + i32.const 4 + i32.sub + i32.load + local.tee $2 + i32.load + local.tee $7 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 1152 + i32.const 228 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $7 + i32.const -4 + i32.and + i32.const 16 + i32.add + local.get $3 + i32.const -4 + i32.and + i32.add + local.tee $8 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $2 + call $~lib/rt/tlsf/removeBlock + local.get $2 + local.get $8 + local.get $7 + i32.const 3 + i32.and + i32.or + local.tee $3 + i32.store + local.get $2 + local.set $1 + end + end + local.get $4 + local.get $5 + i32.const 2 + i32.or + i32.store + local.get $3 + i32.const -4 + i32.and + local.tee $2 + i32.const 16 + i32.ge_u + if (result i32) + local.get $2 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 1152 + i32.const 243 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + local.get $1 + i32.const 16 + i32.add + i32.add + local.get $4 + i32.ne + if + i32.const 0 + i32.const 1152 + i32.const 244 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $2 + i32.const 256 + i32.lt_u + if + local.get $2 + i32.const 4 + i32.shr_u + local.set $2 + else + local.get $2 + i32.const 31 + local.get $2 + i32.clz + i32.sub + local.tee $3 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + local.set $2 + local.get $3 + i32.const 7 + i32.sub + local.set $6 + end + local.get $2 + i32.const 16 + i32.lt_u + i32.const 0 + local.get $6 + i32.const 23 + i32.lt_u + select + i32.eqz + if + i32.const 0 + i32.const 1152 + i32.const 260 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $2 + local.get $6 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $3 + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + local.get $3 + i32.store offset=20 + local.get $3 + if + local.get $3 + local.get $1 + i32.store offset=16 + end + local.get $0 + local.get $2 + local.get $6 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + local.get $1 + i32.store offset=96 + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $6 + i32.shl + i32.or + i32.store + local.get $0 + local.get $6 + i32.const 2 + i32.shl + i32.add + local.tee $0 + local.get $0 + i32.load offset=4 + i32.const 1 + local.get $2 + i32.shl + i32.or + i32.store offset=4 + ) + (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + local.get $2 + i32.const 15 + i32.and + i32.eqz + i32.const 0 + local.get $1 + i32.const 15 + i32.and + i32.eqz + i32.const 0 + local.get $1 + local.get $2 + i32.le_u + select + select + i32.eqz + if + i32.const 0 + i32.const 1152 + i32.const 386 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load offset=1568 + local.tee $3 + if + local.get $1 + local.get $3 + i32.const 16 + i32.add + i32.lt_u + if + i32.const 0 + i32.const 1152 + i32.const 396 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $3 + local.get $1 + i32.const 16 + i32.sub + i32.eq + if + local.get $3 + i32.load + local.set $4 + local.get $1 + i32.const 16 + i32.sub + local.set $1 + end + else + local.get $1 + local.get $0 + i32.const 1572 + i32.add + i32.lt_u + if + i32.const 0 + i32.const 1152 + i32.const 408 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + local.get $2 + local.get $1 + i32.sub + local.tee $2 + i32.const 48 + i32.lt_u + if + return + end + local.get $1 + local.get $4 + i32.const 2 + i32.and + local.get $2 + i32.const 32 + i32.sub + i32.const 1 + i32.or + i32.or + i32.store + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + i32.const 0 + i32.store offset=20 + local.get $1 + local.get $2 + i32.add + i32.const 16 + i32.sub + local.tee $2 + i32.const 2 + i32.store + local.get $0 + local.get $2 + i32.store offset=1568 + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + ) + (func $~lib/rt/tlsf/maybeInitialize (result i32) + (local $0 i32) + (local $1 i32) + (local $2 i32) + global.get $~lib/rt/tlsf/ROOT + local.tee $0 + i32.eqz + if + i32.const 1 + memory.size + local.tee $0 + i32.gt_s + if (result i32) + i32.const 1 + local.get $0 + i32.sub + memory.grow + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable + end + i32.const 1600 + local.tee $0 + i32.const 0 + i32.store + i32.const 3168 + i32.const 0 + i32.store + loop $for-loop|0 + local.get $1 + i32.const 23 + i32.lt_u + if + local.get $1 + i32.const 2 + i32.shl + i32.const 1600 + i32.add + i32.const 0 + i32.store offset=4 + i32.const 0 + local.set $2 + loop $for-loop|1 + local.get $2 + i32.const 16 + i32.lt_u + if + local.get $1 + i32.const 4 + i32.shl + local.get $2 + i32.add + i32.const 2 + i32.shl + i32.const 1600 + i32.add + i32.const 0 + i32.store offset=96 + local.get $2 + i32.const 1 + i32.add + local.set $2 + br $for-loop|1 + end + end + local.get $1 + i32.const 1 + i32.add + local.set $1 + br $for-loop|0 + end + end + i32.const 1600 + i32.const 3184 + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + i32.const 1600 + global.set $~lib/rt/tlsf/ROOT + end + local.get $0 + ) + (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + local.get $1 + i32.const 256 + i32.lt_u + if + local.get $1 + i32.const 4 + i32.shr_u + local.set $1 + else + local.get $1 + i32.const 536870904 + i32.lt_u + if + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + local.set $1 + end + local.get $1 + i32.const 31 + local.get $1 + i32.clz + i32.sub + local.tee $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + local.set $1 + local.get $2 + i32.const 7 + i32.sub + local.set $2 + end + local.get $1 + i32.const 16 + i32.lt_u + i32.const 0 + local.get $2 + i32.const 23 + i32.lt_u + select + i32.eqz + if + i32.const 0 + i32.const 1152 + i32.const 338 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $2 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const -1 + local.get $1 + i32.shl + i32.and + local.tee $1 + if (result i32) + local.get $0 + local.get $1 + i32.ctz + local.get $2 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + else + local.get $0 + i32.load + i32.const -1 + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.tee $1 + if (result i32) + local.get $0 + local.get $1 + i32.ctz + local.tee $1 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.tee $2 + i32.eqz + if + i32.const 0 + i32.const 1152 + i32.const 351 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $2 + i32.ctz + local.get $1 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + else + i32.const 0 + end + end + ) + (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + local.get $1 + i32.load + local.set $3 + local.get $2 + i32.const 15 + i32.and + if + i32.const 0 + i32.const 1152 + i32.const 365 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const -4 + i32.and + local.get $2 + i32.sub + local.tee $4 + i32.const 32 + i32.ge_u + if + local.get $1 + local.get $2 + local.get $3 + i32.const 2 + i32.and + i32.or + i32.store + local.get $2 + local.get $1 + i32.const 16 + i32.add + i32.add + local.tee $1 + local.get $4 + i32.const 16 + i32.sub + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + local.get $3 + i32.const -2 + i32.and + i32.store + local.get $1 + i32.const 16 + i32.add + local.tee $0 + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.get $0 + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + i32.load + i32.const -3 + i32.and + i32.store + end + ) + (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + global.get $~lib/rt/tlsf/collectLock + if + i32.const 0 + i32.const 1152 + i32.const 501 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 1073741808 + i32.ge_u + if + i32.const 1200 + i32.const 1152 + i32.const 461 + i32.const 30 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 15 + i32.add + i32.const -16 + i32.and + local.tee $3 + i32.const 16 + local.get $3 + i32.const 16 + i32.gt_u + select + local.tee $4 + call $~lib/rt/tlsf/searchBlock + local.tee $3 + i32.eqz + if + i32.const 1 + global.set $~lib/rt/tlsf/collectLock + call $~lib/rt/pure/__collect + i32.const 0 + global.set $~lib/rt/tlsf/collectLock + local.get $0 + local.get $4 + call $~lib/rt/tlsf/searchBlock + local.tee $3 + i32.eqz + if + i32.const 16 + memory.size + local.tee $3 + i32.const 16 + i32.shl + i32.const 16 + i32.sub + local.get $0 + i32.load offset=1568 + i32.ne + i32.shl + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.get $4 + local.get $4 + i32.const 536870904 + i32.lt_u + select + i32.add + i32.const 65535 + i32.add + i32.const -65536 + i32.and + i32.const 16 + i32.shr_u + local.set $5 + local.get $3 + local.get $5 + local.get $3 + local.get $5 + i32.gt_s + select + memory.grow + i32.const 0 + i32.lt_s + if + local.get $5 + memory.grow + i32.const 0 + i32.lt_s + if + unreachable + end + end + local.get $0 + local.get $3 + i32.const 16 + i32.shl + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + local.get $0 + local.get $4 + call $~lib/rt/tlsf/searchBlock + local.tee $3 + i32.eqz + if + i32.const 0 + i32.const 1152 + i32.const 513 + i32.const 20 + call $~lib/builtins/abort + unreachable + end + end + end + local.get $3 + i32.load + i32.const -4 + i32.and + local.get $4 + i32.lt_u + if + i32.const 0 + i32.const 1152 + i32.const 521 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 0 + i32.store offset=4 + local.get $3 + local.get $2 + i32.store offset=8 + local.get $3 + local.get $1 + i32.store offset=12 + local.get $0 + local.get $3 + call $~lib/rt/tlsf/removeBlock + local.get $0 + local.get $3 + local.get $4 + call $~lib/rt/tlsf/prepareBlock + local.get $3 + ) + (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) + call $~lib/rt/tlsf/maybeInitialize + local.get $0 + local.get $1 + call $~lib/rt/tlsf/allocateBlock + i32.const 16 + i32.add + ) + (func $~lib/memory/memory.fill (param $0 i32) (param $1 i32) + (local $2 i32) + block $~lib/util/memory/memset|inlined.0 + local.get $1 + i32.eqz + br_if $~lib/util/memory/memset|inlined.0 + local.get $0 + i32.const 0 + i32.store8 + local.get $0 + local.get $1 + i32.add + i32.const 4 + i32.sub + local.tee $2 + i32.const 0 + i32.store8 offset=3 + local.get $1 + i32.const 2 + i32.le_u + br_if $~lib/util/memory/memset|inlined.0 + local.get $0 + i32.const 0 + i32.store8 offset=1 + local.get $0 + i32.const 0 + i32.store8 offset=2 + local.get $2 + i32.const 0 + i32.store8 offset=2 + local.get $2 + i32.const 0 + i32.store8 offset=1 + local.get $1 + i32.const 6 + i32.le_u + br_if $~lib/util/memory/memset|inlined.0 + local.get $0 + i32.const 0 + i32.store8 offset=3 + local.get $2 + i32.const 0 + i32.store8 + local.get $1 + i32.const 8 + i32.le_u + br_if $~lib/util/memory/memset|inlined.0 + local.get $0 + i32.const 0 + local.get $0 + i32.sub + i32.const 3 + i32.and + local.tee $2 + i32.add + local.tee $0 + i32.const 0 + i32.store + local.get $0 + local.get $1 + local.get $2 + i32.sub + i32.const -4 + i32.and + local.tee $2 + i32.add + i32.const 28 + i32.sub + local.tee $1 + i32.const 0 + i32.store offset=24 + local.get $2 + i32.const 8 + i32.le_u + br_if $~lib/util/memory/memset|inlined.0 + local.get $0 + i32.const 0 + i32.store offset=4 + local.get $0 + i32.const 0 + i32.store offset=8 + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + i32.const 0 + i32.store offset=20 + local.get $2 + i32.const 24 + i32.le_u + br_if $~lib/util/memory/memset|inlined.0 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $0 + i32.const 0 + i32.store offset=16 + local.get $0 + i32.const 0 + i32.store offset=20 + local.get $0 + i32.const 0 + i32.store offset=24 + local.get $1 + i32.const 0 + i32.store + local.get $1 + i32.const 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 $0 + local.get $0 + i32.const 4 + i32.and + i32.const 24 + i32.add + local.tee $1 + i32.add + local.set $0 + local.get $2 + local.get $1 + i32.sub + local.set $1 + loop $while-continue|0 + local.get $1 + i32.const 32 + i32.ge_u + if + local.get $0 + i64.const 0 + i64.store + local.get $0 + i64.const 0 + i64.store offset=8 + local.get $0 + i64.const 0 + i64.store offset=16 + local.get $0 + i64.const 0 + i64.store offset=24 + local.get $1 + i32.const 32 + i32.sub + local.set $1 + local.get $0 + i32.const 32 + i32.add + local.set $0 + br $while-continue|0 + end + end + end + ) + (func $~lib/rt/pure/__retain (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.const 1596 + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + local.tee $1 + i32.load offset=4 + local.tee $2 + i32.const -268435456 + i32.and + local.get $2 + i32.const 1 + i32.add + i32.const -268435456 + i32.and + i32.ne + if + i32.const 0 + i32.const 1264 + i32.const 109 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $1 + local.get $2 + i32.const 1 + i32.add + i32.store offset=4 + local.get $1 + i32.load + i32.const 1 + i32.and + if + i32.const 0 + i32.const 1264 + i32.const 112 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + end + local.get $0 + ) + (func $~lib/staticarray/StaticArray#get:length (param $0 i32) (result i32) + local.get $0 + i32.const 16 + i32.sub + i32.load offset=12 + i32.const 2 + i32.shr_u + ) + (func $rt/finalize/expect (param $0 i32) + (local $1 i32) + (local $2 i32) + global.get $rt/finalize/expectedWriteIndex + global.get $rt/finalize/expected + call $~lib/staticarray/StaticArray#get:length + i32.ge_s + if + i32.const 0 + i32.const 1360 + i32.const 8 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + global.get $rt/finalize/expectedWriteIndex + local.tee $2 + i32.const 1 + i32.add + global.set $rt/finalize/expectedWriteIndex + local.get $2 + local.tee $1 + global.get $rt/finalize/expected + local.tee $2 + call $~lib/staticarray/StaticArray#get:length + i32.ge_u + if + i32.const 1408 + i32.const 1088 + i32.const 110 + i32.const 41 + call $~lib/builtins/abort + unreachable + end + local.get $2 + local.get $1 + i32.const 2 + i32.shl + i32.add + local.get $0 + i32.store + ) + (func $start:rt/finalize + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + i32.const 40 + i32.const 3 + call $~lib/rt/tlsf/__alloc + local.tee $0 + i32.const 40 + call $~lib/memory/memory.fill + local.get $0 + call $~lib/rt/pure/__retain + local.tee $0 + global.set $rt/finalize/expected + i32.const 16 + i32.const 4 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.tee $3 + i32.const 0 + i32.store + local.get $3 + i32.const 0 + i32.store offset=4 + local.get $3 + i32.const 0 + i32.store offset=8 + local.get $3 + i32.const 0 + i32.store offset=12 + i32.const 0 + i32.const 0 + call $~lib/rt/tlsf/__alloc + local.tee $2 + i32.const 0 + call $~lib/memory/memory.fill + local.get $2 + local.tee $0 + local.get $3 + i32.load + local.tee $1 + i32.ne + if + local.get $0 + call $~lib/rt/pure/__retain + local.set $0 + local.get $1 + call $~lib/rt/pure/__release + end + local.get $3 + local.get $0 + i32.store + local.get $3 + local.get $2 + i32.store offset=4 + local.get $3 + i32.const 0 + i32.store offset=8 + local.get $3 + i32.const 0 + i32.store offset=12 + local.get $3 + i32.load + call $rt/finalize/expect + local.get $3 + call $rt/finalize/expect + local.get $3 + call $~lib/rt/pure/__release + global.get $rt/finalize/expectedWriteIndex + i32.const 2 + i32.ne + if + i32.const 0 + i32.const 1360 + i32.const 28 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $rt/finalize/expectedReadIndex + global.get $rt/finalize/expectedWriteIndex + i32.ne + if + i32.const 0 + i32.const 1360 + i32.const 29 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + i32.const 4 + i32.const 5 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.tee $2 + i32.const 0 + i32.store + i32.const 4 + i32.const 6 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.tee $0 + i32.const 0 + i32.store + local.get $0 + local.tee $1 + local.get $2 + i32.load + local.tee $3 + i32.ne + if + local.get $1 + call $~lib/rt/pure/__retain + local.set $1 + local.get $3 + call $~lib/rt/pure/__release + end + local.get $2 + local.tee $3 + local.get $1 + i32.store + local.get $3 + local.tee $1 + local.get $0 + i32.load + local.tee $3 + i32.ne + if + local.get $1 + call $~lib/rt/pure/__retain + local.set $1 + local.get $3 + call $~lib/rt/pure/__release + end + local.get $0 + local.get $1 + i32.store + local.get $0 + call $rt/finalize/expect + local.get $2 + call $rt/finalize/expect + local.get $2 + call $~lib/rt/pure/__release + local.get $0 + call $~lib/rt/pure/__release + call $~lib/rt/pure/__collect + global.get $rt/finalize/expectedWriteIndex + i32.const 4 + i32.ne + if + i32.const 0 + i32.const 1360 + i32.const 51 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $rt/finalize/expectedReadIndex + global.get $rt/finalize/expectedWriteIndex + i32.ne + if + i32.const 0 + i32.const 1360 + i32.const 52 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $rt/finalize/expected + call $rt/finalize/expect + global.get $rt/finalize/expected + local.tee $0 + if + local.get $0 + call $~lib/rt/pure/__release + end + i32.const 0 + global.set $rt/finalize/expected + global.get $rt/finalize/expectedWriteIndex + i32.const 5 + i32.ne + if + i32.const 0 + i32.const 1360 + i32.const 58 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $rt/finalize/expectedReadIndex + global.get $rt/finalize/expectedWriteIndex + i32.ne + if + i32.const 0 + i32.const 1360 + i32.const 59 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + ) + (func $~start + global.get $~started + if + return + else + i32.const 1 + global.set $~started + end + call $start:rt/finalize + ) + (func $~lib/rt/tlsf/freeBlock (param $0 i32) (param $1 i32) + local.get $1 + local.get $1 + i32.load + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + ) + (func $~lib/rt/pure/finalize (param $0 i32) + (local $1 i32) + (local $2 i32) + i32.const 1472 + i32.const 1 + local.get $0 + i32.const 16 + i32.add + local.tee $1 + f64.convert_i32_u + f64.const 0 + f64.const 0 + f64.const 0 + f64.const 0 + call $~lib/builtins/trace + global.get $rt/finalize/expectedReadIndex + local.tee $2 + i32.const 1 + i32.add + global.set $rt/finalize/expectedReadIndex + local.get $1 + global.get $rt/finalize/expected + local.get $2 + i32.const 2 + i32.shl + i32.add + i32.load + i32.ne + if + i32.const 0 + i32.const 1360 + i32.const 17 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) + (func $~lib/memory/memory.copy (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + block $~lib/util/memory/memmove|inlined.0 + local.get $2 + local.set $4 + local.get $0 + local.get $1 + i32.eq + br_if $~lib/util/memory/memmove|inlined.0 + local.get $0 + local.get $1 + i32.lt_u + if + local.get $1 + i32.const 7 + i32.and + local.get $0 + i32.const 7 + i32.and + i32.eq + if + loop $while-continue|0 + local.get $0 + i32.const 7 + i32.and + if + local.get $4 + i32.eqz + br_if $~lib/util/memory/memmove|inlined.0 + local.get $4 + i32.const 1 + i32.sub + local.set $4 + local.get $0 + local.tee $2 + i32.const 1 + i32.add + local.set $0 + local.get $1 + local.tee $3 + i32.const 1 + i32.add + local.set $1 + local.get $2 + local.get $3 + i32.load8_u + i32.store8 + br $while-continue|0 + end + end + loop $while-continue|1 + local.get $4 + i32.const 8 + i32.ge_u + if + local.get $0 + local.get $1 + i64.load + i64.store + local.get $4 + i32.const 8 + i32.sub + local.set $4 + local.get $0 + i32.const 8 + i32.add + local.set $0 + local.get $1 + i32.const 8 + i32.add + local.set $1 + br $while-continue|1 + end + end + end + loop $while-continue|2 + local.get $4 + if + local.get $0 + local.tee $2 + i32.const 1 + i32.add + local.set $0 + local.get $1 + local.tee $3 + i32.const 1 + i32.add + local.set $1 + local.get $2 + local.get $3 + i32.load8_u + i32.store8 + local.get $4 + i32.const 1 + i32.sub + local.set $4 + br $while-continue|2 + end + end + else + local.get $1 + i32.const 7 + i32.and + local.get $0 + i32.const 7 + i32.and + i32.eq + if + loop $while-continue|3 + local.get $0 + local.get $4 + i32.add + i32.const 7 + i32.and + if + local.get $4 + i32.eqz + br_if $~lib/util/memory/memmove|inlined.0 + local.get $4 + i32.const 1 + i32.sub + local.tee $4 + local.get $0 + i32.add + local.get $1 + local.get $4 + i32.add + i32.load8_u + i32.store8 + br $while-continue|3 + end + end + loop $while-continue|4 + local.get $4 + i32.const 8 + i32.ge_u + if + local.get $4 + i32.const 8 + i32.sub + local.tee $4 + local.get $0 + i32.add + local.get $1 + local.get $4 + i32.add + i64.load + i64.store + br $while-continue|4 + end + end + end + loop $while-continue|5 + local.get $4 + if + local.get $4 + i32.const 1 + i32.sub + local.tee $4 + local.get $0 + i32.add + local.get $1 + local.get $4 + i32.add + i32.load8_u + i32.store8 + br $while-continue|5 + end + end + end + end + ) + (func $~lib/rt/pure/growRoots + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + global.get $~lib/rt/pure/CUR + global.get $~lib/rt/pure/ROOTS + local.tee $0 + i32.sub + local.tee $3 + i32.const 1 + i32.shl + local.tee $1 + i32.const 256 + local.get $1 + i32.const 256 + i32.gt_u + select + local.tee $4 + i32.const 0 + call $~lib/rt/tlsf/__alloc + local.tee $1 + local.get $0 + local.get $3 + call $~lib/memory/memory.copy + local.get $0 + if + call $~lib/rt/tlsf/maybeInitialize + local.get $0 + i32.const 16 + i32.sub + local.set $2 + local.get $0 + i32.const 15 + i32.and + i32.eqz + i32.const 0 + local.get $0 + select + if (result i32) + local.get $2 + i32.load + i32.const 1 + i32.and + i32.eqz + else + i32.const 0 + end + if (result i32) + local.get $2 + i32.load offset=4 + i32.const -268435456 + i32.and + i32.eqz + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 1152 + i32.const 581 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $2 + call $~lib/rt/tlsf/freeBlock + end + local.get $1 + global.set $~lib/rt/pure/ROOTS + local.get $1 + local.get $3 + i32.add + global.set $~lib/rt/pure/CUR + local.get $1 + local.get $4 + i32.add + global.set $~lib/rt/pure/END + ) + (func $~lib/rt/pure/decrement (param $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + local.get $0 + i32.load offset=4 + local.tee $2 + i32.const 268435455 + i32.and + local.set $1 + local.get $0 + i32.load + i32.const 1 + i32.and + if + i32.const 0 + i32.const 1264 + i32.const 122 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 1 + i32.eq + if + local.get $0 + i32.const 16 + i32.add + i32.const 1 + call $~lib/rt/__visit_members + local.get $2 + i32.const -2147483648 + i32.and + if + local.get $0 + i32.const -2147483648 + i32.store offset=4 + else + local.get $0 + call $~lib/rt/pure/finalize + end + else + local.get $1 + i32.const 0 + i32.le_u + if + i32.const 0 + i32.const 1264 + i32.const 136 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load offset=8 + local.tee $3 + i32.const 1536 + i32.load + i32.gt_u + if + i32.const 1408 + i32.const 1504 + i32.const 22 + i32.const 28 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.shl + i32.const 1540 + i32.add + i32.load + i32.const 32 + i32.and + i32.eqz + if + local.get $0 + local.get $1 + i32.const 1 + i32.sub + i32.const -1342177280 + i32.or + i32.store offset=4 + local.get $2 + i32.const -2147483648 + i32.and + i32.eqz + if + global.get $~lib/rt/pure/CUR + local.tee $1 + global.get $~lib/rt/pure/END + i32.ge_u + if + call $~lib/rt/pure/growRoots + global.get $~lib/rt/pure/CUR + local.set $1 + end + local.get $1 + local.get $0 + i32.store + local.get $1 + i32.const 4 + i32.add + global.set $~lib/rt/pure/CUR + end + else + local.get $0 + local.get $1 + i32.const 1 + i32.sub + local.get $2 + i32.const -268435456 + i32.and + i32.or + i32.store offset=4 + end + end + ) + (func $~lib/rt/pure/markGray (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.tee $1 + i32.const 1879048192 + i32.and + i32.const 268435456 + i32.ne + if + local.get $0 + local.get $1 + i32.const -1879048193 + i32.and + i32.const 268435456 + i32.or + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 2 + call $~lib/rt/__visit_members + end + ) + (func $~lib/rt/pure/scanBlack (param $0 i32) + local.get $0 + local.get $0 + i32.load offset=4 + i32.const -1879048193 + i32.and + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 4 + call $~lib/rt/__visit_members + ) + (func $~lib/rt/pure/scan (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.tee $1 + i32.const 1879048192 + i32.and + i32.const 268435456 + i32.eq + if + local.get $1 + i32.const 268435455 + i32.and + i32.const 0 + i32.gt_u + if + local.get $0 + call $~lib/rt/pure/scanBlack + else + local.get $0 + local.get $1 + i32.const -1879048193 + i32.and + i32.const 536870912 + i32.or + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 3 + call $~lib/rt/__visit_members + end + end + ) + (func $~lib/rt/pure/collectWhite (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.tee $1 + i32.const 1879048192 + i32.and + i32.const 536870912 + i32.eq + if (result i32) + local.get $1 + i32.const -2147483648 + i32.and + i32.eqz + else + i32.const 0 + end + if + local.get $0 + local.get $1 + i32.const -1879048193 + i32.and + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 5 + call $~lib/rt/__visit_members + local.get $0 + call $~lib/rt/pure/finalize + end + ) + (func $~lib/rt/pure/__collect + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + global.get $~lib/rt/pure/ROOTS + local.tee $0 + local.tee $4 + local.set $3 + global.get $~lib/rt/pure/CUR + local.set $1 + loop $for-loop|0 + local.get $3 + local.get $1 + i32.lt_u + if + local.get $3 + i32.load + local.tee $2 + i32.load offset=4 + local.tee $5 + i32.const 1879048192 + i32.and + i32.const 805306368 + i32.eq + if (result i32) + local.get $5 + i32.const 268435455 + i32.and + i32.const 0 + i32.gt_u + else + i32.const 0 + end + if + local.get $2 + call $~lib/rt/pure/markGray + local.get $4 + local.get $2 + i32.store + local.get $4 + i32.const 4 + i32.add + local.set $4 + else + i32.const 0 + local.get $5 + i32.const 268435455 + i32.and + i32.eqz + local.get $5 + i32.const 1879048192 + i32.and + select + if + local.get $2 + call $~lib/rt/pure/finalize + else + local.get $2 + local.get $5 + i32.const 2147483647 + i32.and + i32.store offset=4 + end + end + local.get $3 + i32.const 4 + i32.add + local.set $3 + br $for-loop|0 + end + end + local.get $4 + global.set $~lib/rt/pure/CUR + local.get $0 + local.set $1 + loop $for-loop|1 + local.get $1 + local.get $4 + i32.lt_u + if + local.get $1 + i32.load + call $~lib/rt/pure/scan + local.get $1 + i32.const 4 + i32.add + local.set $1 + br $for-loop|1 + end + end + local.get $0 + local.set $1 + loop $for-loop|2 + local.get $1 + local.get $4 + i32.lt_u + if + local.get $1 + i32.load + local.tee $5 + local.get $5 + i32.load offset=4 + i32.const 2147483647 + i32.and + i32.store offset=4 + local.get $5 + call $~lib/rt/pure/collectWhite + local.get $1 + i32.const 4 + i32.add + local.set $1 + br $for-loop|2 + end + end + local.get $0 + global.set $~lib/rt/pure/CUR + ) + (func $~lib/rt/pure/__visit (param $0 i32) (param $1 i32) + local.get $0 + i32.const 1596 + i32.lt_u + if + return + end + local.get $0 + i32.const 16 + i32.sub + local.set $0 + block $break|0 + block $case5|0 + block $case4|0 + block $case3|0 + block $case2|0 + block $case1|0 + local.get $1 + i32.const 1 + i32.ne + if + local.get $1 + i32.const 2 + i32.sub + br_table $case1|0 $case2|0 $case3|0 $case4|0 $case5|0 + end + local.get $0 + call $~lib/rt/pure/decrement + br $break|0 + end + local.get $0 + i32.load offset=4 + i32.const 268435455 + i32.and + i32.const 0 + i32.le_u + if + i32.const 0 + i32.const 1264 + i32.const 79 + i32.const 20 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $0 + i32.load offset=4 + i32.const 1 + i32.sub + i32.store offset=4 + local.get $0 + call $~lib/rt/pure/markGray + br $break|0 + end + local.get $0 + call $~lib/rt/pure/scan + br $break|0 + end + local.get $0 + i32.load offset=4 + local.tee $1 + i32.const -268435456 + i32.and + local.get $1 + i32.const 1 + i32.add + i32.const -268435456 + i32.and + i32.ne + if + i32.const 0 + i32.const 1264 + i32.const 90 + i32.const 9 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 1 + i32.add + i32.store offset=4 + local.get $1 + i32.const 1879048192 + i32.and + if + local.get $0 + call $~lib/rt/pure/scanBlack + end + br $break|0 + end + local.get $0 + call $~lib/rt/pure/collectWhite + br $break|0 + end + i32.const 0 + i32.const 1264 + i32.const 101 + i32.const 27 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/__visit_members (param $0 i32) (param $1 i32) + block $switch$1$default + block $switch$1$case$6 + block $switch$1$case$5 + block $switch$1$case$4 + block $switch$1$case$2 + local.get $0 + i32.const 8 + i32.sub + i32.load + br_table $switch$1$case$2 $switch$1$case$2 $switch$1$case$4 $switch$1$case$5 $switch$1$case$6 $switch$1$case$4 $switch$1$case$4 $switch$1$default + end + return + end + local.get $0 + i32.load + local.tee $0 + if + local.get $0 + local.get $1 + call $~lib/rt/pure/__visit + end + return + end + return + end + local.get $0 + i32.load + local.get $1 + call $~lib/rt/pure/__visit + return + end + unreachable + ) +) diff --git a/tests/compiler/rt/finalize.ts b/tests/compiler/rt/finalize.ts new file mode 100644 index 0000000000..d9a0ada7a2 --- /dev/null +++ b/tests/compiler/rt/finalize.ts @@ -0,0 +1,59 @@ +// Add bookkeeping + +var expected = new StaticArray(10); +var expectedWriteIndex = 0; +var expectedReadIndex = 0; + +function expect(ptr: usize): void { + assert(expectedWriteIndex < expected.length); + expected[expectedWriteIndex++] = ptr; +} + +// Implement finalization hook + +// @ts-ignore +@global function __finalize(ptr: usize): void { + trace("finalize", 1, ptr); + assert(ptr == unchecked(expected[expectedReadIndex++])); +} + +// Simple test with locals becoming finalized immediately + +function testSimple(): void { + var a = new Array(0); + expect(changetype(a.buffer)); + expect(changetype(a)); +} +testSimple(); +assert(expectedWriteIndex == 2); +assert(expectedReadIndex == expectedWriteIndex); + +// Cyclic test with locals becoming deferred until collected + +class Foo { + bar: Bar; +} +class Bar { + foo: Foo; +} + +function testCyclic(): void { + var foo = new Foo(); + var bar = new Bar(); + foo.bar = bar; + bar.foo = foo; + expect(changetype(bar)); + expect(changetype(foo)); +} + +testCyclic(); +__collect(); +assert(expectedWriteIndex == 4); +assert(expectedReadIndex == expectedWriteIndex); + +// Unleak bookkeeping, expecting it to become finalized as well + +expect(changetype(expected)); +expected = changetype>(0); +assert(expectedWriteIndex == 5); +assert(expectedReadIndex == expectedWriteIndex); diff --git a/tests/compiler/rt/finalize.untouched.wat b/tests/compiler/rt/finalize.untouched.wat new file mode 100644 index 0000000000..c96a353ee5 --- /dev/null +++ b/tests/compiler/rt/finalize.untouched.wat @@ -0,0 +1,4177 @@ +(module + (type $i32_=>_none (func (param i32))) + (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_i32 (func (param i32) (result i32))) + (type $none_=>_none (func)) + (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $i32_i32_f64_f64_f64_f64_f64_=>_none (func (param i32 i32 f64 f64 f64 f64 f64))) + (type $none_=>_i32 (func (result i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (import "env" "trace" (func $~lib/builtins/trace (param i32 i32 f64 f64 f64 f64 f64))) + (memory $0 1) + (data (i32.const 16) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00I\00n\00v\00a\00l\00i\00d\00 \00l\00e\00n\00g\00t\00h\00") + (data (i32.const 64) "&\00\00\00\01\00\00\00\01\00\00\00&\00\00\00~\00l\00i\00b\00/\00s\00t\00a\00t\00i\00c\00a\00r\00r\00a\00y\00.\00t\00s\00") + (data (i32.const 128) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") + (data (i32.const 176) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") + (data (i32.const 240) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") + (data (i32.const 288) "\1a\00\00\00\01\00\00\00\01\00\00\00\1a\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00") + (data (i32.const 336) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00r\00t\00/\00f\00i\00n\00a\00l\00i\00z\00e\00.\00t\00s\00") + (data (i32.const 384) "$\00\00\00\01\00\00\00\01\00\00\00$\00\00\00I\00n\00d\00e\00x\00 \00o\00u\00t\00 \00o\00f\00 \00r\00a\00n\00g\00e\00") + (data (i32.const 448) "\10\00\00\00\01\00\00\00\01\00\00\00\10\00\00\00f\00i\00n\00a\00l\00i\00z\00e\00") + (data (i32.const 480) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00~\00l\00i\00b\00/\00r\00t\00.\00t\00s\00") + (data (i32.const 528) "\07\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00$\01\00\00\00\00\00\00\"\t\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (table $0 1 funcref) + (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) + (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) + (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) + (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) + (global $rt/finalize/expected (mut i32) (i32.const 0)) + (global $rt/finalize/expectedWriteIndex (mut i32) (i32.const 0)) + (global $rt/finalize/expectedReadIndex (mut i32) (i32.const 0)) + (global $~started (mut i32) (i32.const 0)) + (global $~lib/rt/pure/CUR (mut i32) (i32.const 0)) + (global $~lib/rt/pure/END (mut i32) (i32.const 0)) + (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) + (global $~lib/rt/__rtti_base i32 (i32.const 528)) + (global $~lib/heap/__heap_base i32 (i32.const 588)) + (export "_start" (func $~start)) + (export "memory" (memory $0)) + (func $~lib/rt/pure/__release (param $0 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + end + ) + (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + local.get $1 + i32.load + local.set $2 + i32.const 1 + drop + local.get $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 277 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $3 + i32.const 1 + drop + local.get $3 + i32.const 16 + i32.ge_u + if (result i32) + local.get $3 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 279 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $4 + local.get $3 + i32.const 4 + i32.shr_u + local.set $5 + else + i32.const 31 + local.get $3 + i32.clz + i32.sub + local.set $4 + local.get $3 + local.get $4 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $5 + local.get $4 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $4 + end + i32.const 1 + drop + local.get $4 + i32.const 23 + i32.lt_u + if (result i32) + local.get $5 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 292 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load offset=16 + local.set $6 + local.get $1 + i32.load offset=20 + local.set $7 + local.get $6 + if + local.get $6 + local.get $7 + i32.store offset=20 + end + local.get $7 + if + local.get $7 + local.get $6 + i32.store offset=16 + end + local.get $1 + local.get $0 + local.set $10 + local.get $4 + local.set $9 + local.get $5 + local.set $8 + local.get $10 + local.get $9 + i32.const 4 + i32.shl + local.get $8 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + i32.eq + if + local.get $0 + local.set $11 + local.get $4 + local.set $10 + local.get $5 + local.set $9 + local.get $7 + local.set $8 + local.get $11 + local.get $10 + i32.const 4 + i32.shl + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $8 + i32.store offset=96 + local.get $7 + i32.eqz + if + local.get $0 + local.set $9 + local.get $4 + local.set $8 + local.get $9 + local.get $8 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $9 + local.get $0 + local.set $8 + local.get $4 + local.set $11 + local.get $9 + i32.const 1 + local.get $5 + i32.shl + i32.const -1 + i32.xor + i32.and + local.tee $9 + local.set $10 + local.get $8 + local.get $11 + i32.const 2 + i32.shl + i32.add + local.get $10 + i32.store offset=4 + local.get $9 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $4 + i32.shl + i32.const -1 + i32.xor + i32.and + i32.store + end + end + end + ) + (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + i32.const 1 + drop + local.get $1 + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 205 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load + local.set $2 + i32.const 1 + drop + local.get $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 207 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + local.set $3 + local.get $3 + i32.const 16 + i32.add + local.get $3 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + local.get $5 + i32.const 1 + i32.and + if + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $5 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $3 + local.get $3 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $2 + i32.const 3 + i32.and + local.get $3 + i32.or + local.tee $2 + i32.store + local.get $1 + local.set $6 + local.get $6 + i32.const 16 + i32.add + local.get $6 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + end + end + local.get $2 + i32.const 2 + i32.and + if + local.get $1 + local.set $6 + local.get $6 + i32.const 4 + i32.sub + i32.load + local.set $6 + local.get $6 + i32.load + local.set $3 + i32.const 1 + drop + local.get $3 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 228 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $7 + local.get $7 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $6 + call $~lib/rt/tlsf/removeBlock + local.get $6 + local.get $3 + i32.const 3 + i32.and + local.get $7 + i32.or + local.tee $2 + i32.store + local.get $6 + local.set $1 + end + end + local.get $4 + local.get $5 + i32.const 2 + i32.or + i32.store + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $8 + i32.const 1 + drop + local.get $8 + i32.const 16 + i32.ge_u + if (result i32) + local.get $8 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 243 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + local.get $1 + i32.const 16 + i32.add + local.get $8 + i32.add + local.get $4 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 244 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $8 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $9 + local.get $8 + i32.const 4 + i32.shr_u + local.set $10 + else + i32.const 31 + local.get $8 + i32.clz + i32.sub + local.set $9 + local.get $8 + local.get $9 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $10 + local.get $9 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $9 + end + i32.const 1 + drop + local.get $9 + i32.const 23 + i32.lt_u + if (result i32) + local.get $10 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 260 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $7 + local.get $9 + local.set $3 + local.get $10 + local.set $6 + local.get $7 + local.get $3 + i32.const 4 + i32.shl + local.get $6 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $11 + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + local.get $11 + i32.store offset=20 + local.get $11 + if + local.get $11 + local.get $1 + i32.store offset=16 + end + local.get $0 + local.set $12 + local.get $9 + local.set $7 + local.get $10 + local.set $3 + local.get $1 + local.set $6 + local.get $12 + local.get $7 + i32.const 4 + i32.shl + local.get $3 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=96 + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $9 + i32.shl + i32.or + i32.store + local.get $0 + local.set $13 + local.get $9 + local.set $12 + local.get $0 + local.set $3 + local.get $9 + local.set $6 + local.get $3 + local.get $6 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 1 + local.get $10 + i32.shl + i32.or + local.set $7 + local.get $13 + local.get $12 + i32.const 2 + i32.shl + i32.add + local.get $7 + i32.store offset=4 + ) + (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + i32.const 1 + drop + local.get $1 + local.get $2 + i32.le_u + if (result i32) + local.get $1 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + if (result i32) + local.get $2 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 386 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + local.set $4 + i32.const 0 + local.set $5 + local.get $4 + if + i32.const 1 + drop + local.get $1 + local.get $4 + i32.const 16 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 396 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.sub + local.get $4 + i32.eq + if + local.get $1 + i32.const 16 + i32.sub + local.set $1 + local.get $4 + i32.load + local.set $5 + else + nop + end + else + i32.const 1 + drop + local.get $1 + local.get $0 + i32.const 1572 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 408 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + local.get $2 + local.get $1 + i32.sub + local.set $6 + local.get $6 + i32.const 16 + i32.const 16 + i32.add + i32.const 16 + i32.add + i32.lt_u + if + i32.const 0 + return + end + local.get $6 + i32.const 16 + i32.const 1 + i32.shl + i32.sub + local.set $7 + local.get $1 + local.set $8 + local.get $8 + local.get $7 + i32.const 1 + i32.or + local.get $5 + i32.const 2 + i32.and + i32.or + i32.store + local.get $8 + i32.const 0 + i32.store offset=16 + local.get $8 + i32.const 0 + i32.store offset=20 + local.get $1 + local.get $6 + i32.add + i32.const 16 + i32.sub + local.set $4 + local.get $4 + i32.const 0 + i32.const 2 + i32.or + i32.store + local.get $0 + local.set $9 + local.get $4 + local.set $3 + local.get $9 + local.get $3 + i32.store offset=1568 + local.get $0 + local.get $8 + call $~lib/rt/tlsf/insertBlock + i32.const 1 + ) + (func $~lib/rt/tlsf/maybeInitialize (result i32) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + global.get $~lib/rt/tlsf/ROOT + local.set $0 + local.get $0 + i32.eqz + if + global.get $~lib/heap/__heap_base + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $1 + memory.size + local.set $2 + local.get $1 + i32.const 1572 + i32.add + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $3 + local.get $3 + local.get $2 + i32.gt_s + if (result i32) + local.get $3 + local.get $2 + i32.sub + memory.grow + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable + end + local.get $1 + local.set $0 + local.get $0 + i32.const 0 + i32.store + local.get $0 + local.set $5 + i32.const 0 + local.set $4 + local.get $5 + local.get $4 + i32.store offset=1568 + i32.const 0 + local.set $5 + loop $for-loop|0 + local.get $5 + i32.const 23 + i32.lt_u + local.set $4 + local.get $4 + if + local.get $0 + local.set $8 + local.get $5 + local.set $7 + i32.const 0 + local.set $6 + local.get $8 + local.get $7 + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=4 + i32.const 0 + local.set $8 + loop $for-loop|1 + local.get $8 + i32.const 16 + i32.lt_u + local.set $7 + local.get $7 + if + local.get $0 + local.set $11 + local.get $5 + local.set $10 + local.get $8 + local.set $9 + i32.const 0 + local.set $6 + local.get $11 + local.get $10 + i32.const 4 + i32.shl + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=96 + local.get $8 + i32.const 1 + i32.add + local.set $8 + br $for-loop|1 + end + end + local.get $5 + i32.const 1 + i32.add + local.set $5 + br $for-loop|0 + end + end + local.get $1 + i32.const 1572 + i32.add + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $5 + i32.const 0 + drop + local.get $0 + local.get $5 + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop + local.get $0 + global.set $~lib/rt/tlsf/ROOT + end + local.get $0 + ) + (func $~lib/rt/tlsf/prepareSize (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.const 1073741808 + i32.ge_u + if + i32.const 192 + i32.const 144 + i32.const 461 + i32.const 30 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.tee $1 + i32.const 16 + local.tee $2 + local.get $1 + local.get $2 + i32.gt_u + select + ) + (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + local.get $1 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $2 + local.get $1 + i32.const 4 + i32.shr_u + local.set $3 + else + local.get $1 + i32.const 536870904 + i32.lt_u + if (result i32) + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $1 + end + local.set $4 + i32.const 31 + local.get $4 + i32.clz + i32.sub + local.set $2 + local.get $4 + local.get $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $3 + local.get $2 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $2 + end + i32.const 1 + drop + local.get $2 + i32.const 23 + i32.lt_u + if (result i32) + local.get $3 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 338 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $5 + local.get $2 + local.set $4 + local.get $5 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 0 + i32.const -1 + i32.xor + local.get $3 + i32.shl + i32.and + local.set $6 + i32.const 0 + local.set $7 + local.get $6 + i32.eqz + if + local.get $0 + i32.load + i32.const 0 + i32.const -1 + i32.xor + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.set $5 + local.get $5 + i32.eqz + if + i32.const 0 + local.set $7 + else + local.get $5 + i32.ctz + local.set $2 + local.get $0 + local.set $8 + local.get $2 + local.set $4 + local.get $8 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $6 + i32.const 1 + drop + local.get $6 + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 351 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + else + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + local.get $7 + ) + (func $~lib/rt/tlsf/growMemory (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + drop + local.get $1 + i32.const 536870904 + i32.lt_u + if + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $1 + end + memory.size + local.set $2 + local.get $1 + i32.const 16 + local.get $2 + i32.const 16 + i32.shl + i32.const 16 + i32.sub + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + i32.ne + i32.shl + i32.add + local.set $1 + local.get $1 + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $4 + local.get $2 + local.tee $3 + local.get $4 + local.tee $5 + local.get $3 + local.get $5 + i32.gt_s + select + local.set $6 + local.get $6 + memory.grow + i32.const 0 + i32.lt_s + if + local.get $4 + memory.grow + i32.const 0 + i32.lt_s + if + unreachable + end + end + memory.size + local.set $7 + local.get $0 + local.get $2 + i32.const 16 + i32.shl + local.get $7 + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop + ) + (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + local.set $3 + i32.const 1 + drop + local.get $2 + i32.const 15 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 365 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.sub + local.set $4 + local.get $4 + i32.const 16 + i32.const 16 + i32.add + i32.ge_u + if + local.get $1 + local.get $2 + local.get $3 + i32.const 2 + i32.and + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.get $2 + i32.add + local.set $5 + local.get $5 + local.get $4 + i32.const 16 + i32.sub + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $5 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + local.get $3 + i32.const 1 + i32.const -1 + i32.xor + i32.and + i32.store + local.get $1 + local.set $5 + local.get $5 + i32.const 16 + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.get $1 + local.set $5 + local.get $5 + i32.const 16 + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + i32.load + i32.const 2 + i32.const -1 + i32.xor + i32.and + i32.store + end + ) + (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + i32.const 1 + drop + global.get $~lib/rt/tlsf/collectLock + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 501 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + call $~lib/rt/tlsf/prepareSize + local.set $3 + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + global.get $~lib/gc/gc.auto + if + i32.const 1 + drop + i32.const 1 + global.set $~lib/rt/tlsf/collectLock + call $~lib/rt/pure/__collect + i32.const 1 + drop + i32.const 0 + global.set $~lib/rt/tlsf/collectLock + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + local.get $0 + local.get $3 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + i32.const 1 + drop + local.get $4 + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 513 + i32.const 20 + call $~lib/builtins/abort + unreachable + end + end + else + local.get $0 + local.get $3 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + i32.const 1 + drop + local.get $4 + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 518 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + end + end + i32.const 1 + drop + local.get $4 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $3 + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 521 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 0 + i32.store offset=4 + local.get $4 + local.get $2 + i32.store offset=8 + local.get $4 + local.get $1 + i32.store offset=12 + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $0 + local.get $4 + local.get $3 + call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop + local.get $4 + ) + (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) + call $~lib/rt/tlsf/maybeInitialize + local.get $0 + local.get $1 + call $~lib/rt/tlsf/allocateBlock + i32.const 16 + i32.add + ) + (func $~lib/memory/memory.fill (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i64) + (local $10 i32) + block $~lib/util/memory/memset|inlined.0 + local.get $0 + local.set $5 + local.get $1 + local.set $4 + local.get $2 + local.set $3 + i32.const 0 + i32.const 1 + i32.gt_s + drop + local.get $3 + i32.eqz + if + br $~lib/util/memory/memset|inlined.0 + end + local.get $5 + local.get $3 + i32.add + i32.const 4 + i32.sub + local.set $6 + local.get $5 + local.get $4 + i32.store8 + local.get $6 + local.get $4 + i32.store8 offset=3 + local.get $3 + i32.const 2 + i32.le_u + if + br $~lib/util/memory/memset|inlined.0 + end + local.get $5 + local.get $4 + i32.store8 offset=1 + local.get $5 + local.get $4 + i32.store8 offset=2 + local.get $6 + local.get $4 + i32.store8 offset=2 + local.get $6 + local.get $4 + i32.store8 offset=1 + local.get $3 + i32.const 6 + i32.le_u + if + br $~lib/util/memory/memset|inlined.0 + end + local.get $5 + local.get $4 + i32.store8 offset=3 + local.get $6 + local.get $4 + i32.store8 + local.get $3 + i32.const 8 + i32.le_u + if + br $~lib/util/memory/memset|inlined.0 + end + i32.const 0 + local.get $5 + i32.sub + i32.const 3 + i32.and + local.set $7 + local.get $5 + local.get $7 + i32.add + local.set $5 + local.get $3 + local.get $7 + i32.sub + local.set $3 + local.get $3 + i32.const -4 + i32.and + local.set $3 + i32.const -1 + i32.const 255 + i32.div_u + local.get $4 + i32.const 255 + i32.and + i32.mul + local.set $8 + local.get $5 + local.get $3 + i32.add + i32.const 28 + i32.sub + local.set $6 + local.get $5 + local.get $8 + i32.store + local.get $6 + local.get $8 + i32.store offset=24 + local.get $3 + i32.const 8 + i32.le_u + if + br $~lib/util/memory/memset|inlined.0 + end + local.get $5 + local.get $8 + i32.store offset=4 + local.get $5 + local.get $8 + i32.store offset=8 + local.get $6 + local.get $8 + i32.store offset=16 + local.get $6 + local.get $8 + i32.store offset=20 + local.get $3 + i32.const 24 + i32.le_u + if + br $~lib/util/memory/memset|inlined.0 + end + local.get $5 + local.get $8 + i32.store offset=12 + local.get $5 + local.get $8 + i32.store offset=16 + local.get $5 + local.get $8 + i32.store offset=20 + local.get $5 + local.get $8 + i32.store offset=24 + local.get $6 + local.get $8 + i32.store + local.get $6 + local.get $8 + i32.store offset=4 + local.get $6 + local.get $8 + i32.store offset=8 + local.get $6 + local.get $8 + i32.store offset=12 + i32.const 24 + local.get $5 + i32.const 4 + i32.and + i32.add + local.set $7 + local.get $5 + local.get $7 + i32.add + local.set $5 + local.get $3 + local.get $7 + i32.sub + local.set $3 + local.get $8 + i64.extend_i32_u + local.get $8 + i64.extend_i32_u + i64.const 32 + i64.shl + i64.or + local.set $9 + loop $while-continue|0 + local.get $3 + i32.const 32 + i32.ge_u + local.set $10 + local.get $10 + if + local.get $5 + local.get $9 + i64.store + local.get $5 + local.get $9 + i64.store offset=8 + local.get $5 + local.get $9 + i64.store offset=16 + local.get $5 + local.get $9 + i64.store offset=24 + local.get $3 + i32.const 32 + i32.sub + local.set $3 + local.get $5 + i32.const 32 + i32.add + local.set $5 + br $while-continue|0 + end + end + end + ) + (func $~lib/rt/pure/increment (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $1 + i32.const 1 + i32.add + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + i32.eq + i32.eqz + if + i32.const 0 + i32.const 256 + i32.const 109 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 1 + i32.add + i32.store offset=4 + i32.const 0 + drop + i32.const 1 + drop + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 256 + i32.const 112 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/pure/__retain (param $0 i32) (result i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/increment + end + local.get $0 + ) + (func $~lib/staticarray/StaticArray#constructor (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + local.get $1 + i32.const 1073741808 + i32.const 2 + i32.shr_u + i32.gt_u + if + i32.const 32 + i32.const 80 + i32.const 83 + i32.const 60 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 2 + i32.shl + local.set $2 + local.get $2 + i32.const 3 + call $~lib/rt/tlsf/__alloc + local.set $3 + local.get $3 + i32.const 0 + local.get $2 + call $~lib/memory/memory.fill + local.get $3 + call $~lib/rt/pure/__retain + local.set $4 + local.get $0 + call $~lib/rt/pure/__release + local.get $4 + ) + (func $~lib/array/Array#constructor (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + local.get $0 + i32.eqz + if + i32.const 16 + i32.const 4 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + 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 + i32.const 0 + i32.store offset=8 + local.get $0 + i32.const 0 + i32.store offset=12 + local.get $1 + i32.const 1073741808 + i32.const 2 + i32.shr_u + i32.gt_u + if + i32.const 32 + i32.const 304 + i32.const 57 + i32.const 60 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 2 + i32.shl + local.set $2 + local.get $2 + i32.const 0 + call $~lib/rt/tlsf/__alloc + local.set $3 + local.get $3 + i32.const 0 + local.get $2 + call $~lib/memory/memory.fill + local.get $0 + local.tee $4 + local.get $3 + local.tee $5 + local.get $4 + i32.load + local.tee $6 + i32.ne + if + local.get $5 + call $~lib/rt/pure/__retain + local.set $5 + local.get $6 + call $~lib/rt/pure/__release + end + local.get $5 + i32.store + local.get $0 + local.get $3 + i32.store offset=4 + local.get $0 + local.get $2 + i32.store offset=8 + local.get $0 + local.get $1 + i32.store offset=12 + local.get $0 + ) + (func $~lib/staticarray/StaticArray#get:length (param $0 i32) (result i32) + local.get $0 + i32.const 16 + i32.sub + i32.load offset=12 + i32.const 2 + i32.shr_u + ) + (func $~lib/staticarray/StaticArray#__uset (param $0 i32) (param $1 i32) (param $2 i32) + i32.const 0 + drop + local.get $0 + local.get $1 + i32.const 2 + i32.shl + i32.add + local.get $2 + i32.store + ) + (func $~lib/staticarray/StaticArray#__set (param $0 i32) (param $1 i32) (param $2 i32) + local.get $1 + local.get $0 + call $~lib/staticarray/StaticArray#get:length + i32.ge_u + if + i32.const 400 + i32.const 80 + i32.const 110 + i32.const 41 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + local.get $2 + call $~lib/staticarray/StaticArray#__uset + ) + (func $rt/finalize/expect (param $0 i32) + (local $1 i32) + global.get $rt/finalize/expectedWriteIndex + global.get $rt/finalize/expected + call $~lib/staticarray/StaticArray#get:length + i32.lt_s + i32.eqz + if + i32.const 0 + i32.const 352 + i32.const 8 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + global.get $rt/finalize/expected + global.get $rt/finalize/expectedWriteIndex + local.tee $1 + i32.const 1 + i32.add + global.set $rt/finalize/expectedWriteIndex + local.get $1 + local.get $0 + call $~lib/staticarray/StaticArray#__set + ) + (func $rt/finalize/testSimple + (local $0 i32) + i32.const 0 + i32.const 0 + call $~lib/array/Array#constructor + local.set $0 + local.get $0 + i32.load + call $rt/finalize/expect + local.get $0 + call $rt/finalize/expect + local.get $0 + call $~lib/rt/pure/__release + ) + (func $rt/finalize/Foo#constructor (param $0 i32) (result i32) + local.get $0 + i32.eqz + if + i32.const 4 + i32.const 5 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.set $0 + end + local.get $0 + i32.const 0 + i32.store + local.get $0 + ) + (func $rt/finalize/Bar#constructor (param $0 i32) (result i32) + local.get $0 + i32.eqz + if + i32.const 4 + i32.const 6 + call $~lib/rt/tlsf/__alloc + call $~lib/rt/pure/__retain + local.set $0 + end + local.get $0 + i32.const 0 + i32.store + local.get $0 + ) + (func $rt/finalize/testCyclic + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + i32.const 0 + call $rt/finalize/Foo#constructor + local.set $0 + i32.const 0 + call $rt/finalize/Bar#constructor + local.set $1 + local.get $0 + local.tee $2 + local.get $1 + local.tee $3 + local.get $2 + i32.load + local.tee $4 + i32.ne + if + local.get $3 + call $~lib/rt/pure/__retain + local.set $3 + local.get $4 + call $~lib/rt/pure/__release + end + local.get $3 + i32.store + local.get $1 + local.tee $4 + local.get $0 + local.tee $3 + local.get $4 + i32.load + local.tee $2 + i32.ne + if + local.get $3 + call $~lib/rt/pure/__retain + local.set $3 + local.get $2 + call $~lib/rt/pure/__release + end + local.get $3 + i32.store + local.get $1 + call $rt/finalize/expect + local.get $0 + call $rt/finalize/expect + local.get $0 + call $~lib/rt/pure/__release + local.get $1 + call $~lib/rt/pure/__release + ) + (func $start:rt/finalize + (local $0 i32) + (local $1 i32) + i32.const 0 + i32.const 10 + call $~lib/staticarray/StaticArray#constructor + global.set $rt/finalize/expected + call $rt/finalize/testSimple + global.get $rt/finalize/expectedWriteIndex + i32.const 2 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 352 + i32.const 28 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $rt/finalize/expectedReadIndex + global.get $rt/finalize/expectedWriteIndex + i32.eq + i32.eqz + if + i32.const 0 + i32.const 352 + i32.const 29 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + call $rt/finalize/testCyclic + call $~lib/rt/pure/__collect + global.get $rt/finalize/expectedWriteIndex + i32.const 4 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 352 + i32.const 51 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $rt/finalize/expectedReadIndex + global.get $rt/finalize/expectedWriteIndex + i32.eq + i32.eqz + if + i32.const 0 + i32.const 352 + i32.const 52 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $rt/finalize/expected + call $rt/finalize/expect + i32.const 0 + local.tee $0 + global.get $rt/finalize/expected + local.tee $1 + i32.ne + if + local.get $0 + call $~lib/rt/pure/__retain + local.set $0 + local.get $1 + call $~lib/rt/pure/__release + end + local.get $0 + global.set $rt/finalize/expected + global.get $rt/finalize/expectedWriteIndex + i32.const 5 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 352 + i32.const 58 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + global.get $rt/finalize/expectedReadIndex + global.get $rt/finalize/expectedWriteIndex + i32.eq + i32.eqz + if + i32.const 0 + i32.const 352 + i32.const 59 + i32.const 1 + call $~lib/builtins/abort + unreachable + end + ) + (func $~start + global.get $~started + if + return + else + i32.const 1 + global.set $~started + end + call $start:rt/finalize + ) + (func $~lib/staticarray/StaticArray#__uget (param $0 i32) (param $1 i32) (result i32) + local.get $0 + local.get $1 + i32.const 2 + i32.shl + i32.add + i32.load + ) + (func $rt/finalize/__finalize (param $0 i32) + (local $1 i32) + i32.const 464 + i32.const 1 + local.get $0 + f64.convert_i32_u + f64.const 0 + f64.const 0 + f64.const 0 + f64.const 0 + call $~lib/builtins/trace + local.get $0 + global.get $rt/finalize/expected + global.get $rt/finalize/expectedReadIndex + local.tee $1 + i32.const 1 + i32.add + global.set $rt/finalize/expectedReadIndex + local.get $1 + call $~lib/staticarray/StaticArray#__uget + i32.eq + i32.eqz + if + i32.const 0 + i32.const 352 + i32.const 17 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/tlsf/freeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $1 + i32.load + local.set $2 + local.get $1 + local.get $2 + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + i32.const 0 + drop + ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 1 + drop + local.get $0 + i32.const 16 + i32.add + call $rt/finalize/__finalize + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) + (func $~lib/rt/__typeinfo (param $0 i32) (result i32) + (local $1 i32) + global.get $~lib/rt/__rtti_base + local.set $1 + local.get $0 + local.get $1 + i32.load + i32.gt_u + if + i32.const 400 + i32.const 496 + i32.const 22 + i32.const 28 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 4 + i32.add + local.get $0 + i32.const 8 + i32.mul + i32.add + i32.load + ) + (func $~lib/util/memory/memcpy (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + loop $while-continue|0 + local.get $2 + if (result i32) + local.get $1 + i32.const 3 + i32.and + else + i32.const 0 + end + local.set $5 + local.get $5 + if + local.get $0 + local.tee $6 + i32.const 1 + i32.add + local.set $0 + local.get $6 + local.get $1 + local.tee $6 + i32.const 1 + i32.add + local.set $1 + local.get $6 + i32.load8_u + i32.store8 + local.get $2 + i32.const 1 + i32.sub + local.set $2 + br $while-continue|0 + end + end + local.get $0 + i32.const 3 + i32.and + i32.const 0 + i32.eq + if + loop $while-continue|1 + local.get $2 + i32.const 16 + i32.ge_u + local.set $5 + local.get $5 + if + local.get $0 + local.get $1 + i32.load + i32.store + local.get $0 + i32.const 4 + i32.add + local.get $1 + i32.const 4 + i32.add + i32.load + i32.store + local.get $0 + i32.const 8 + i32.add + local.get $1 + i32.const 8 + i32.add + i32.load + i32.store + local.get $0 + i32.const 12 + i32.add + local.get $1 + i32.const 12 + i32.add + i32.load + i32.store + local.get $1 + i32.const 16 + i32.add + local.set $1 + local.get $0 + i32.const 16 + i32.add + local.set $0 + local.get $2 + i32.const 16 + i32.sub + local.set $2 + br $while-continue|1 + end + end + local.get $2 + i32.const 8 + i32.and + if + local.get $0 + local.get $1 + i32.load + i32.store + local.get $0 + i32.const 4 + i32.add + local.get $1 + i32.const 4 + i32.add + i32.load + i32.store + local.get $0 + i32.const 8 + i32.add + local.set $0 + local.get $1 + i32.const 8 + i32.add + local.set $1 + end + local.get $2 + i32.const 4 + i32.and + if + local.get $0 + local.get $1 + i32.load + i32.store + local.get $0 + i32.const 4 + i32.add + local.set $0 + local.get $1 + i32.const 4 + i32.add + local.set $1 + end + local.get $2 + i32.const 2 + i32.and + if + local.get $0 + local.get $1 + i32.load16_u + i32.store16 + local.get $0 + i32.const 2 + i32.add + local.set $0 + local.get $1 + i32.const 2 + i32.add + local.set $1 + end + local.get $2 + i32.const 1 + i32.and + if + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + end + return + end + local.get $2 + i32.const 32 + i32.ge_u + if + block $break|2 + block $case2|2 + block $case1|2 + block $case0|2 + local.get $0 + i32.const 3 + i32.and + local.set $5 + local.get $5 + i32.const 1 + i32.eq + br_if $case0|2 + local.get $5 + i32.const 2 + i32.eq + br_if $case1|2 + local.get $5 + i32.const 3 + i32.eq + br_if $case2|2 + br $break|2 + end + local.get $1 + i32.load + local.set $3 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $2 + i32.const 3 + i32.sub + local.set $2 + loop $while-continue|3 + local.get $2 + i32.const 17 + i32.ge_u + local.set $5 + local.get $5 + if + local.get $1 + i32.const 1 + i32.add + i32.load + local.set $4 + local.get $0 + local.get $3 + i32.const 24 + i32.shr_u + local.get $4 + i32.const 8 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 5 + i32.add + i32.load + local.set $3 + local.get $0 + i32.const 4 + i32.add + local.get $4 + i32.const 24 + i32.shr_u + local.get $3 + i32.const 8 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 9 + i32.add + i32.load + local.set $4 + local.get $0 + i32.const 8 + i32.add + local.get $3 + i32.const 24 + i32.shr_u + local.get $4 + i32.const 8 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 13 + i32.add + i32.load + local.set $3 + local.get $0 + i32.const 12 + i32.add + local.get $4 + i32.const 24 + i32.shr_u + local.get $3 + i32.const 8 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.set $1 + local.get $0 + i32.const 16 + i32.add + local.set $0 + local.get $2 + i32.const 16 + i32.sub + local.set $2 + br $while-continue|3 + end + end + br $break|2 + end + local.get $1 + i32.load + local.set $3 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $2 + i32.const 2 + i32.sub + local.set $2 + loop $while-continue|4 + local.get $2 + i32.const 18 + i32.ge_u + local.set $5 + local.get $5 + if + local.get $1 + i32.const 2 + i32.add + i32.load + local.set $4 + local.get $0 + local.get $3 + i32.const 16 + i32.shr_u + local.get $4 + i32.const 16 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 6 + i32.add + i32.load + local.set $3 + local.get $0 + i32.const 4 + i32.add + local.get $4 + i32.const 16 + i32.shr_u + local.get $3 + i32.const 16 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 10 + i32.add + i32.load + local.set $4 + local.get $0 + i32.const 8 + i32.add + local.get $3 + i32.const 16 + i32.shr_u + local.get $4 + i32.const 16 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 14 + i32.add + i32.load + local.set $3 + local.get $0 + i32.const 12 + i32.add + local.get $4 + i32.const 16 + i32.shr_u + local.get $3 + i32.const 16 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.set $1 + local.get $0 + i32.const 16 + i32.add + local.set $0 + local.get $2 + i32.const 16 + i32.sub + local.set $2 + br $while-continue|4 + end + end + br $break|2 + end + local.get $1 + i32.load + local.set $3 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $2 + i32.const 1 + i32.sub + local.set $2 + loop $while-continue|5 + local.get $2 + i32.const 19 + i32.ge_u + local.set $5 + local.get $5 + if + local.get $1 + i32.const 3 + i32.add + i32.load + local.set $4 + local.get $0 + local.get $3 + i32.const 8 + i32.shr_u + local.get $4 + i32.const 24 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 7 + i32.add + i32.load + local.set $3 + local.get $0 + i32.const 4 + i32.add + local.get $4 + i32.const 8 + i32.shr_u + local.get $3 + i32.const 24 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 11 + i32.add + i32.load + local.set $4 + local.get $0 + i32.const 8 + i32.add + local.get $3 + i32.const 8 + i32.shr_u + local.get $4 + i32.const 24 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 15 + i32.add + i32.load + local.set $3 + local.get $0 + i32.const 12 + i32.add + local.get $4 + i32.const 8 + i32.shr_u + local.get $3 + i32.const 24 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.set $1 + local.get $0 + i32.const 16 + i32.add + local.set $0 + local.get $2 + i32.const 16 + i32.sub + local.set $2 + br $while-continue|5 + end + end + br $break|2 + end + end + local.get $2 + i32.const 16 + i32.and + if + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 8 + i32.and + if + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 4 + i32.and + if + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 2 + i32.and + if + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 1 + i32.and + if + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + i32.load8_u + i32.store8 + end + ) + (func $~lib/memory/memory.copy (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + block $~lib/util/memory/memmove|inlined.0 + local.get $0 + local.set $5 + local.get $1 + local.set $4 + local.get $2 + local.set $3 + local.get $5 + local.get $4 + i32.eq + if + br $~lib/util/memory/memmove|inlined.0 + end + i32.const 0 + i32.const 1 + i32.lt_s + drop + local.get $4 + local.get $3 + i32.add + local.get $5 + i32.le_u + if (result i32) + i32.const 1 + else + local.get $5 + local.get $3 + i32.add + local.get $4 + i32.le_u + end + if + local.get $5 + local.get $4 + local.get $3 + call $~lib/util/memory/memcpy + br $~lib/util/memory/memmove|inlined.0 + end + local.get $5 + local.get $4 + i32.lt_u + if + i32.const 0 + i32.const 2 + i32.lt_s + drop + local.get $4 + i32.const 7 + i32.and + local.get $5 + i32.const 7 + i32.and + i32.eq + if + loop $while-continue|0 + local.get $5 + i32.const 7 + i32.and + local.set $6 + local.get $6 + if + local.get $3 + i32.eqz + if + br $~lib/util/memory/memmove|inlined.0 + end + local.get $3 + i32.const 1 + i32.sub + local.set $3 + local.get $5 + local.tee $7 + i32.const 1 + i32.add + local.set $5 + local.get $7 + local.get $4 + local.tee $7 + i32.const 1 + i32.add + local.set $4 + local.get $7 + i32.load8_u + i32.store8 + br $while-continue|0 + end + end + loop $while-continue|1 + local.get $3 + i32.const 8 + i32.ge_u + local.set $6 + local.get $6 + if + local.get $5 + local.get $4 + i64.load + i64.store + local.get $3 + i32.const 8 + i32.sub + local.set $3 + local.get $5 + i32.const 8 + i32.add + local.set $5 + local.get $4 + i32.const 8 + i32.add + local.set $4 + br $while-continue|1 + end + end + end + loop $while-continue|2 + local.get $3 + local.set $6 + local.get $6 + if + local.get $5 + local.tee $7 + i32.const 1 + i32.add + local.set $5 + local.get $7 + local.get $4 + local.tee $7 + i32.const 1 + i32.add + local.set $4 + local.get $7 + i32.load8_u + i32.store8 + local.get $3 + i32.const 1 + i32.sub + local.set $3 + br $while-continue|2 + end + end + else + i32.const 0 + i32.const 2 + i32.lt_s + drop + local.get $4 + i32.const 7 + i32.and + local.get $5 + i32.const 7 + i32.and + i32.eq + if + loop $while-continue|3 + local.get $5 + local.get $3 + i32.add + i32.const 7 + i32.and + local.set $6 + local.get $6 + if + local.get $3 + i32.eqz + if + br $~lib/util/memory/memmove|inlined.0 + end + local.get $5 + local.get $3 + i32.const 1 + i32.sub + local.tee $3 + i32.add + local.get $4 + local.get $3 + i32.add + i32.load8_u + i32.store8 + br $while-continue|3 + end + end + loop $while-continue|4 + local.get $3 + i32.const 8 + i32.ge_u + local.set $6 + local.get $6 + if + local.get $3 + i32.const 8 + i32.sub + local.set $3 + local.get $5 + local.get $3 + i32.add + local.get $4 + local.get $3 + i32.add + i64.load + i64.store + br $while-continue|4 + end + end + end + loop $while-continue|5 + local.get $3 + local.set $6 + local.get $6 + if + local.get $5 + local.get $3 + i32.const 1 + i32.sub + local.tee $3 + i32.add + local.get $4 + local.get $3 + i32.add + i32.load8_u + i32.store8 + br $while-continue|5 + end + end + end + end + ) + (func $~lib/rt/tlsf/checkUsedBlock (param $0 i32) (result i32) + (local $1 i32) + local.get $0 + i32.const 16 + i32.sub + local.set $1 + local.get $0 + i32.const 0 + i32.ne + if (result i32) + local.get $0 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + if (result i32) + local.get $1 + i32.load + i32.const 1 + i32.and + i32.eqz + else + i32.const 0 + end + if (result i32) + local.get $1 + i32.load offset=4 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + i32.eqz + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 581 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $1 + ) + (func $~lib/rt/tlsf/__free (param $0 i32) + call $~lib/rt/tlsf/maybeInitialize + local.get $0 + call $~lib/rt/tlsf/checkUsedBlock + call $~lib/rt/tlsf/freeBlock + ) + (func $~lib/rt/pure/growRoots + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + global.get $~lib/rt/pure/ROOTS + local.set $0 + global.get $~lib/rt/pure/CUR + local.get $0 + i32.sub + local.set $1 + local.get $1 + i32.const 2 + i32.mul + local.tee $2 + i32.const 64 + i32.const 2 + i32.shl + local.tee $3 + local.get $2 + local.get $3 + i32.gt_u + select + local.set $4 + local.get $4 + i32.const 0 + call $~lib/rt/tlsf/__alloc + local.set $5 + i32.const 0 + drop + local.get $5 + local.get $0 + local.get $1 + call $~lib/memory/memory.copy + local.get $0 + if + i32.const 0 + drop + local.get $0 + call $~lib/rt/tlsf/__free + end + local.get $5 + global.set $~lib/rt/pure/ROOTS + local.get $5 + local.get $1 + i32.add + global.set $~lib/rt/pure/CUR + local.get $5 + local.get $4 + i32.add + global.set $~lib/rt/pure/END + ) + (func $~lib/rt/pure/appendRoot (param $0 i32) + (local $1 i32) + global.get $~lib/rt/pure/CUR + local.set $1 + local.get $1 + global.get $~lib/rt/pure/END + i32.ge_u + if + call $~lib/rt/pure/growRoots + global.get $~lib/rt/pure/CUR + local.set $1 + end + local.get $1 + local.get $0 + i32.store + local.get $1 + i32.const 4 + i32.add + global.set $~lib/rt/pure/CUR + ) + (func $~lib/rt/pure/decrement (param $0 i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 268435455 + i32.and + local.set $2 + i32.const 0 + drop + i32.const 1 + drop + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 256 + i32.const 122 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 1 + i32.eq + if + local.get $0 + i32.const 16 + i32.add + i32.const 1 + call $~lib/rt/__visit_members + i32.const 0 + drop + local.get $1 + i32.const -2147483648 + i32.and + i32.eqz + if + local.get $0 + call $~lib/rt/pure/finalize + else + local.get $0 + i32.const -2147483648 + i32.const 0 + i32.or + i32.const 0 + i32.or + i32.store offset=4 + end + else + i32.const 1 + drop + local.get $2 + i32.const 0 + i32.gt_u + i32.eqz + if + i32.const 0 + i32.const 256 + i32.const 136 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + i32.const 0 + drop + local.get $0 + i32.load offset=8 + call $~lib/rt/__typeinfo + i32.const 32 + i32.and + i32.eqz + if + local.get $0 + i32.const -2147483648 + i32.const 805306368 + i32.or + local.get $2 + i32.const 1 + i32.sub + i32.or + i32.store offset=4 + local.get $1 + i32.const -2147483648 + i32.and + i32.eqz + if + local.get $0 + call $~lib/rt/pure/appendRoot + end + else + local.get $0 + local.get $1 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.const 1 + i32.sub + i32.or + i32.store offset=4 + end + end + ) + (func $~lib/rt/pure/markGray (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 1879048192 + i32.and + i32.const 268435456 + i32.ne + if + local.get $0 + local.get $1 + i32.const 1879048192 + i32.const -1 + i32.xor + i32.and + i32.const 268435456 + i32.or + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 2 + call $~lib/rt/__visit_members + end + ) + (func $~lib/rt/pure/scanBlack (param $0 i32) + local.get $0 + local.get $0 + i32.load offset=4 + i32.const 1879048192 + i32.const -1 + i32.xor + i32.and + i32.const 0 + i32.or + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 4 + call $~lib/rt/__visit_members + ) + (func $~lib/rt/pure/scan (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 1879048192 + i32.and + i32.const 268435456 + i32.eq + if + local.get $1 + i32.const 268435455 + i32.and + i32.const 0 + i32.gt_u + if + local.get $0 + call $~lib/rt/pure/scanBlack + else + local.get $0 + local.get $1 + i32.const 1879048192 + i32.const -1 + i32.xor + i32.and + i32.const 536870912 + i32.or + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 3 + call $~lib/rt/__visit_members + end + end + ) + (func $~lib/rt/pure/collectWhite (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 1879048192 + i32.and + i32.const 536870912 + i32.eq + if (result i32) + local.get $1 + i32.const -2147483648 + i32.and + i32.eqz + else + i32.const 0 + end + if + local.get $0 + local.get $1 + i32.const 1879048192 + i32.const -1 + i32.xor + i32.and + i32.const 0 + i32.or + i32.store offset=4 + local.get $0 + i32.const 16 + i32.add + i32.const 5 + call $~lib/rt/__visit_members + local.get $0 + call $~lib/rt/pure/finalize + end + ) + (func $~lib/rt/pure/__collect + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + i32.const 0 + drop + global.get $~lib/rt/pure/ROOTS + local.set $0 + local.get $0 + local.set $1 + local.get $1 + local.set $2 + global.get $~lib/rt/pure/CUR + local.set $3 + loop $for-loop|0 + local.get $2 + local.get $3 + i32.lt_u + local.set $4 + local.get $4 + if + local.get $2 + i32.load + local.set $5 + local.get $5 + i32.load offset=4 + local.set $6 + local.get $6 + i32.const 1879048192 + i32.and + i32.const 805306368 + i32.eq + if (result i32) + local.get $6 + i32.const 268435455 + i32.and + i32.const 0 + i32.gt_u + else + i32.const 0 + end + if + local.get $5 + call $~lib/rt/pure/markGray + local.get $1 + local.get $5 + i32.store + local.get $1 + i32.const 4 + i32.add + local.set $1 + else + local.get $6 + i32.const 1879048192 + i32.and + i32.const 0 + i32.eq + if (result i32) + local.get $6 + i32.const 268435455 + i32.and + i32.eqz + else + i32.const 0 + end + if + local.get $5 + call $~lib/rt/pure/finalize + else + local.get $5 + local.get $6 + i32.const -2147483648 + i32.const -1 + i32.xor + i32.and + i32.store offset=4 + end + end + local.get $2 + i32.const 4 + i32.add + local.set $2 + br $for-loop|0 + end + end + local.get $1 + global.set $~lib/rt/pure/CUR + local.get $0 + local.set $3 + loop $for-loop|1 + local.get $3 + local.get $1 + i32.lt_u + local.set $2 + local.get $2 + if + local.get $3 + i32.load + call $~lib/rt/pure/scan + local.get $3 + i32.const 4 + i32.add + local.set $3 + br $for-loop|1 + end + end + local.get $0 + local.set $3 + loop $for-loop|2 + local.get $3 + local.get $1 + i32.lt_u + local.set $2 + local.get $2 + if + local.get $3 + i32.load + local.set $4 + local.get $4 + local.get $4 + i32.load offset=4 + i32.const -2147483648 + i32.const -1 + i32.xor + i32.and + i32.store offset=4 + local.get $4 + call $~lib/rt/pure/collectWhite + local.get $3 + i32.const 4 + i32.add + local.set $3 + br $for-loop|2 + end + end + local.get $0 + global.set $~lib/rt/pure/CUR + ) + (func $~lib/rt/pure/__visit (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.lt_u + if + return + end + i32.const 0 + drop + local.get $0 + i32.const 16 + i32.sub + local.set $2 + block $break|0 + block $case5|0 + block $case4|0 + block $case3|0 + block $case2|0 + block $case1|0 + block $case0|0 + local.get $1 + local.set $3 + local.get $3 + i32.const 1 + i32.eq + br_if $case0|0 + local.get $3 + i32.const 2 + i32.eq + br_if $case1|0 + local.get $3 + i32.const 3 + i32.eq + br_if $case2|0 + local.get $3 + i32.const 4 + i32.eq + br_if $case3|0 + local.get $3 + i32.const 5 + i32.eq + br_if $case4|0 + br $case5|0 + end + local.get $2 + call $~lib/rt/pure/decrement + br $break|0 + end + i32.const 1 + drop + local.get $2 + i32.load offset=4 + i32.const 268435455 + i32.and + i32.const 0 + i32.gt_u + i32.eqz + if + i32.const 0 + i32.const 256 + i32.const 79 + i32.const 20 + call $~lib/builtins/abort + unreachable + end + local.get $2 + local.get $2 + i32.load offset=4 + i32.const 1 + i32.sub + i32.store offset=4 + local.get $2 + call $~lib/rt/pure/markGray + br $break|0 + end + local.get $2 + call $~lib/rt/pure/scan + br $break|0 + end + local.get $2 + i32.load offset=4 + local.set $3 + local.get $3 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $3 + i32.const 1 + i32.add + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + i32.eq + i32.eqz + if + i32.const 0 + i32.const 256 + i32.const 90 + i32.const 9 + call $~lib/builtins/abort + unreachable + end + local.get $2 + local.get $3 + i32.const 1 + i32.add + i32.store offset=4 + local.get $3 + i32.const 1879048192 + i32.and + i32.const 0 + i32.ne + if + local.get $2 + call $~lib/rt/pure/scanBlack + end + br $break|0 + end + local.get $2 + call $~lib/rt/pure/collectWhite + br $break|0 + end + i32.const 1 + drop + i32.const 0 + i32.eqz + if + i32.const 0 + i32.const 256 + i32.const 101 + i32.const 27 + call $~lib/builtins/abort + unreachable + end + end + ) + (func $~lib/staticarray/StaticArray#__visit_impl (param $0 i32) (param $1 i32) + i32.const 0 + drop + ) + (func $~lib/array/Array#__visit_impl (param $0 i32) (param $1 i32) + i32.const 0 + drop + local.get $0 + i32.load + local.get $1 + call $~lib/rt/pure/__visit + ) + (func $~lib/rt/__visit_members (param $0 i32) (param $1 i32) + (local $2 i32) + block $switch$1$default + block $switch$1$case$6 + block $switch$1$case$5 + block $switch$1$case$4 + block $switch$1$case$2 + local.get $0 + i32.const 8 + i32.sub + i32.load + br_table $switch$1$case$2 $switch$1$case$2 $switch$1$case$4 $switch$1$case$5 $switch$1$case$6 $switch$1$case$4 $switch$1$case$4 $switch$1$default + end + return + end + local.get $0 + i32.load + local.tee $2 + if + local.get $2 + local.get $1 + call $~lib/rt/pure/__visit + end + return + end + local.get $0 + local.get $1 + call $~lib/staticarray/StaticArray#__visit_impl + return + end + local.get $0 + local.get $1 + call $~lib/array/Array#__visit_impl + return + end + unreachable + ) +) diff --git a/tests/compiler/runtime-full.untouched.wat b/tests/compiler/runtime-full.untouched.wat index d7ab098ac5..23b59efce8 100644 --- a/tests/compiler/runtime-full.untouched.wat +++ b/tests/compiler/runtime-full.untouched.wat @@ -1548,6 +1548,13 @@ i32.const 0 drop ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -1602,9 +1609,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/std/array-literal.untouched.wat b/tests/compiler/std/array-literal.untouched.wat index 88dd7543cb..8249707688 100644 --- a/tests/compiler/std/array-literal.untouched.wat +++ b/tests/compiler/std/array-literal.untouched.wat @@ -3386,6 +3386,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -3442,9 +3449,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index 67512ffaca..676ecf4438 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -25014,6 +25014,13 @@ end call $start:std/array ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -25070,9 +25077,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/std/arraybuffer.untouched.wat b/tests/compiler/std/arraybuffer.untouched.wat index 5491c52dc2..18d1314edc 100644 --- a/tests/compiler/std/arraybuffer.untouched.wat +++ b/tests/compiler/std/arraybuffer.untouched.wat @@ -4080,6 +4080,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -4136,9 +4143,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/std/dataview.untouched.wat b/tests/compiler/std/dataview.untouched.wat index e7910f81cf..8581adb76a 100644 --- a/tests/compiler/std/dataview.untouched.wat +++ b/tests/compiler/std/dataview.untouched.wat @@ -4555,6 +4555,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -4611,9 +4618,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index 1131cad73a..8a09e76627 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -21046,6 +21046,13 @@ (func $~start call $start:std/map ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -21102,9 +21109,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index 20a7bc6553..1a14648c53 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -14585,6 +14585,13 @@ (func $~start call $start:std/set ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -14641,9 +14648,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/std/staticarray.untouched.wat b/tests/compiler/std/staticarray.untouched.wat index 69b4f3f24b..c975b65418 100644 --- a/tests/compiler/std/staticarray.untouched.wat +++ b/tests/compiler/std/staticarray.untouched.wat @@ -1,6 +1,6 @@ (module - (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_none (func (param i32))) + (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i32_=>_i32 (func (param i32) (result i32))) (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) @@ -3165,6 +3165,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -3221,9 +3228,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/std/string-casemapping.untouched.wat b/tests/compiler/std/string-casemapping.untouched.wat index 41c7e6ce04..84265d9f4f 100644 --- a/tests/compiler/std/string-casemapping.untouched.wat +++ b/tests/compiler/std/string-casemapping.untouched.wat @@ -1,8 +1,8 @@ (module (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_none (func (param i32))) + (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $i64_=>_i32 (func (param i64) (result i32))) (type $none_=>_none (func)) @@ -6912,6 +6912,13 @@ drop return ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -6968,9 +6975,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/std/string-encoding.untouched.wat b/tests/compiler/std/string-encoding.untouched.wat index 49ea1dfcdb..9ebfbcd5af 100644 --- a/tests/compiler/std/string-encoding.untouched.wat +++ b/tests/compiler/std/string-encoding.untouched.wat @@ -5031,6 +5031,13 @@ (func $~start call $start:std/string-encoding ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -5087,9 +5094,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/std/string.untouched.wat b/tests/compiler/std/string.untouched.wat index 031785e12e..b927c901ab 100644 --- a/tests/compiler/std/string.untouched.wat +++ b/tests/compiler/std/string.untouched.wat @@ -2,8 +2,8 @@ (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_=>_none (func (param i32))) + (type $i32_i32_=>_none (func (param i32 i32))) (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) (type $none_=>_none (func)) (type $i64_=>_i32 (func (param i64) (result i32))) @@ -18614,6 +18614,13 @@ end call $start:std/string ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -18670,9 +18677,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index f73af30f0c..32b0132fa2 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -55769,6 +55769,13 @@ end call $start:std/typedarray ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -55825,9 +55832,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/throw.untouched.wat b/tests/compiler/throw.untouched.wat index ea5e0ddf76..383394d55d 100644 --- a/tests/compiler/throw.untouched.wat +++ b/tests/compiler/throw.untouched.wat @@ -727,6 +727,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -783,9 +790,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop diff --git a/tests/compiler/while.untouched.wat b/tests/compiler/while.untouched.wat index 7caedb7a8b..9601138127 100644 --- a/tests/compiler/while.untouched.wat +++ b/tests/compiler/while.untouched.wat @@ -2430,6 +2430,13 @@ local.get $1 call $~lib/rt/rtrace/onfree ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) (func $~lib/rt/pure/decrement (param $0 i32) (local $1 i32) (local $2 i32) @@ -2486,9 +2493,8 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/rt/tlsf/ROOT local.get $0 - call $~lib/rt/tlsf/freeBlock + call $~lib/rt/pure/finalize else i32.const 1 drop