From a1b75b69b7781e166cd08623d0b0d5c6759ceef5 Mon Sep 17 00:00:00 2001 From: dcodeIO Date: Wed, 18 Jul 2018 23:49:32 +0200 Subject: [PATCH] Rename memory instructions; Rework constant handling --- examples/i64-polyfill/build/optimized.wat | 2 +- examples/i64-polyfill/build/untouched.wat | 2 +- examples/mandelbrot/build/untouched.wat | 8 +- examples/n-body/build/index.asm.js | 14 +- examples/n-body/build/optimized.wat | 14 +- examples/n-body/build/untouched.wat | 435 ++- examples/ugc/assembly/ugc.ts | 4 +- lib/loader/tests/assembly/index.ts | 4 +- package-lock.json | 6 +- package.json | 2 +- snap/README.md | 2 +- src/binary.ts | 4 +- src/builtins.ts | 189 +- src/compiler.ts | 577 +-- src/decompiler.ts | 4 +- src/definitions.ts | 5 +- src/diagnosticMessages.generated.ts | 8 +- src/diagnosticMessages.json | 4 +- src/glue/js/binaryen.d.ts | 9 +- src/glue/js/binaryen.js | 44 +- src/glue/js/index.ts | 12 +- src/module.ts | 175 +- src/program.ts | 155 +- std/assembly/allocator/arena.ts | 14 +- std/assembly/allocator/buddy.ts | 14 +- std/assembly/allocator/emscripten.ts | 6 +- std/assembly/allocator/system.ts | 6 +- std/assembly/allocator/tlsf.ts | 20 +- std/assembly/array.ts | 10 +- std/assembly/arraybuffer.ts | 4 +- std/assembly/builtins.ts | 71 +- std/assembly/collector/itcm.ts | 148 +- std/assembly/index.d.ts | 251 +- std/assembly/internal/array.ts | 6 +- std/assembly/internal/arraybuffer.ts | 8 +- std/assembly/internal/string.ts | 2 +- std/assembly/internal/typedarray.ts | 4 +- std/assembly/memory.ts | 82 +- std/assembly/string.ts | 36 +- std/assembly/table.ts | 16 + std/portable/index.d.ts | 170 +- std/portable/index.js | 30 +- std/portable/memory.js | 36 - tests/allocators/arena/assembly/index.ts | 3 +- tests/allocators/arena/optimized.wat | 3031 ++++++++++++++- tests/allocators/arena/untouched.wat | 3357 +++++++++++++++- tests/allocators/buddy/assembly/index.ts | 3 +- tests/allocators/buddy/optimized.wat | 3066 ++++++++++++++- tests/allocators/buddy/untouched.wat | 3389 +++++++++++++++- tests/allocators/index.js | 12 +- tests/allocators/runner.js | 65 +- tests/allocators/tlsf/assembly/index.ts | 3 +- tests/allocators/tlsf/optimized.wat | 3073 ++++++++++++++- tests/allocators/tlsf/untouched.wat | 3408 ++++++++++++++++- tests/binaryen/const-global.js | 18 + tests/binaryen/const-global.wat | 8 + tests/binaryen/const-local.js | 18 + tests/compiler/abi.optimized.wat | 2 +- tests/compiler/abi.untouched.wat | 2 +- tests/compiler/asc-constants.untouched.wat | 8 + tests/compiler/builtins.optimized.wat | 26 +- tests/compiler/builtins.ts | 8 +- tests/compiler/builtins.untouched.wat | 114 +- tests/compiler/call-optional.optimized.wat | 4 +- tests/compiler/call-optional.untouched.wat | 4 +- tests/compiler/class-extends.optimized.wat | 2 +- tests/compiler/class-extends.untouched.wat | 2 +- .../compiler/class-overloading.optimized.wat | 2 +- .../compiler/class-overloading.untouched.wat | 2 +- .../class-with-boolean-field.optimized.wat | 2 +- .../class-with-boolean-field.untouched.wat | 2 +- tests/compiler/class.optimized.wat | 2 +- tests/compiler/class.untouched.wat | 2 +- tests/compiler/enum.optimized.wat | 4 +- tests/compiler/enum.ts | 17 +- tests/compiler/enum.untouched.wat | 10 +- tests/compiler/export.optimized.wat | 2 +- tests/compiler/export.untouched.wat | 2 +- tests/compiler/exports.optimized.wat | 160 +- tests/compiler/exports.ts | 4 +- tests/compiler/exports.untouched.wat | 269 +- tests/compiler/external.optimized.wat | 6 +- tests/compiler/external.untouched.wat | 5 +- tests/compiler/function-types.optimized.wat | 4 +- tests/compiler/function-types.untouched.wat | 4 +- tests/compiler/i64-polyfill.optimized.wat | 2 +- tests/compiler/i64-polyfill.untouched.wat | 2 +- tests/compiler/if.optimized.wat | 2 +- tests/compiler/if.untouched.wat | 2 +- tests/compiler/import.untouched.wat | 24 +- tests/compiler/infer-type.untouched.wat | 12 +- .../compiler/inlining-recursive.optimized.wat | 6 +- .../compiler/inlining-recursive.untouched.wat | 6 +- tests/compiler/inlining.optimized.wat | 2 +- tests/compiler/inlining.untouched.wat | 4 +- tests/compiler/limits.untouched.wat | 78 +- tests/compiler/main.optimized.wat | 15 +- tests/compiler/main.untouched.wat | 15 +- tests/compiler/mandelbrot.optimized.wat | 2 +- tests/compiler/mandelbrot.untouched.wat | 9 +- tests/compiler/many-locals.optimized.wat | 2 +- tests/compiler/many-locals.untouched.wat | 2 +- tests/compiler/memcpy.optimized.wat | 2 +- tests/compiler/memcpy.untouched.wat | 50 +- tests/compiler/memmove.untouched.wat | 48 +- tests/compiler/memset.optimized.wat | 3 +- .../named-export-default.optimized.wat | 2 +- .../named-export-default.untouched.wat | 2 +- .../named-import-default.optimized.wat | 2 +- .../named-import-default.untouched.wat | 2 +- tests/compiler/namespace.ts | 4 +- tests/compiler/namespace.untouched.wat | 4 +- .../new-without-allocator.optimized.wat | 18 + tests/compiler/new-without-allocator.ts | 2 - .../new-without-allocator.untouched.wat | 26 + tests/compiler/object-literal.optimized.wat | 72 +- tests/compiler/object-literal.untouched.wat | 75 +- tests/compiler/recursive.optimized.wat | 2 +- tests/compiler/recursive.untouched.wat | 2 +- tests/compiler/reexport.optimized.wat | 8 +- tests/compiler/reexport.untouched.wat | 3 +- tests/compiler/retain-i32.untouched.wat | 87 +- .../std/allocator_arena.optimized.wat | 128 +- tests/compiler/std/allocator_arena.ts | 26 +- .../std/allocator_arena.untouched.wat | 137 +- tests/compiler/std/array-access.optimized.wat | 35 +- tests/compiler/std/array-access.untouched.wat | 37 +- .../compiler/std/array-literal.optimized.wat | 54 +- .../compiler/std/array-literal.untouched.wat | 71 +- tests/compiler/std/array.optimized.wat | 398 +- tests/compiler/std/array.untouched.wat | 469 ++- tests/compiler/std/arraybuffer.optimized.wat | 73 +- tests/compiler/std/arraybuffer.untouched.wat | 90 +- tests/compiler/std/constructor.optimized.wat | 67 +- tests/compiler/std/constructor.ts | 4 +- tests/compiler/std/constructor.untouched.wat | 74 +- .../compiler/std/gc-integration.optimized.wat | 76 + tests/compiler/std/gc-integration.ts | 15 + .../compiler/std/gc-integration.untouched.wat | 93 + tests/compiler/std/gc.optimized.wat | 319 ++ tests/compiler/std/gc.ts | 23 + tests/compiler/std/gc.untouched.wat | 398 ++ tests/compiler/std/hash.untouched.wat | 32 +- tests/compiler/std/libm.optimized.wat | 2 +- tests/compiler/std/libm.untouched.wat | 15 +- tests/compiler/std/map.optimized.wat | 186 +- tests/compiler/std/map.untouched.wat | 669 ++-- tests/compiler/std/math.untouched.wat | 2076 +++++----- tests/compiler/std/mod.untouched.wat | 2 +- tests/compiler/std/new.optimized.wat | 37 +- tests/compiler/std/new.untouched.wat | 40 +- .../std/operator-overloading.optimized.wat | 89 +- .../std/operator-overloading.untouched.wat | 103 +- tests/compiler/std/pointer.optimized.wat | 56 +- tests/compiler/std/pointer.untouched.wat | 56 +- tests/compiler/std/set.optimized.wat | 186 +- tests/compiler/std/set.untouched.wat | 669 ++-- tests/compiler/std/static-array.optimized.wat | 99 +- tests/compiler/std/static-array.untouched.wat | 146 +- tests/compiler/std/string-utf8.optimized.wat | 46 +- tests/compiler/std/string-utf8.ts | 2 +- tests/compiler/std/string-utf8.untouched.wat | 50 +- tests/compiler/std/string.optimized.wat | 180 +- tests/compiler/std/string.untouched.wat | 297 +- tests/compiler/std/symbol.optimized.wat | 113 +- tests/compiler/std/symbol.untouched.wat | 206 +- tests/compiler/std/typedarray.optimized.wat | 86 +- tests/compiler/std/typedarray.untouched.wat | 206 +- tests/compiler/typealias.optimized.wat | 2 +- tests/compiler/typealias.untouched.wat | 2 +- 170 files changed, 26392 insertions(+), 5185 deletions(-) create mode 100644 std/assembly/table.ts delete mode 100644 std/portable/memory.js create mode 100644 tests/binaryen/const-global.js create mode 100644 tests/binaryen/const-global.wat create mode 100644 tests/binaryen/const-local.js create mode 100644 tests/compiler/new-without-allocator.optimized.wat create mode 100644 tests/compiler/new-without-allocator.untouched.wat create mode 100644 tests/compiler/std/gc-integration.optimized.wat create mode 100644 tests/compiler/std/gc-integration.ts create mode 100644 tests/compiler/std/gc-integration.untouched.wat create mode 100644 tests/compiler/std/gc.optimized.wat create mode 100644 tests/compiler/std/gc.ts create mode 100644 tests/compiler/std/gc.untouched.wat diff --git a/examples/i64-polyfill/build/optimized.wat b/examples/i64-polyfill/build/optimized.wat index 693481d9..8f74a27b 100644 --- a/examples/i64-polyfill/build/optimized.wat +++ b/examples/i64-polyfill/build/optimized.wat @@ -4,7 +4,7 @@ (type $iiiiv (func (param i32 i32 i32 i32))) (global $assembly/i64/lo (mut i32) (i32.const 0)) (global $assembly/i64/hi (mut i32) (i32.const 0)) - (memory $0 1) + (memory $0 0) (export "getLo" (func $assembly/i64/getLo)) (export "getHi" (func $assembly/i64/getHi)) (export "clz" (func $assembly/i64/clz)) diff --git a/examples/i64-polyfill/build/untouched.wat b/examples/i64-polyfill/build/untouched.wat index ae701740..cab16526 100644 --- a/examples/i64-polyfill/build/untouched.wat +++ b/examples/i64-polyfill/build/untouched.wat @@ -7,7 +7,7 @@ (global $NaN f64 (f64.const nan:0x8000000000000)) (global $Infinity f64 (f64.const inf)) (global $HEAP_BASE i32 (i32.const 8)) - (memory $0 1) + (memory $0 0) (export "getLo" (func $assembly/i64/getLo)) (export "getHi" (func $assembly/i64/getHi)) (export "clz" (func $assembly/i64/clz)) diff --git a/examples/mandelbrot/build/untouched.wat b/examples/mandelbrot/build/untouched.wat index 5e51161b..f5143619 100644 --- a/examples/mandelbrot/build/untouched.wat +++ b/examples/mandelbrot/build/untouched.wat @@ -12,15 +12,15 @@ (export "computeLine" (func $assembly/index/computeLine)) (export "memory" (memory $0)) (func $isFinite (; 2 ;) (type $Fi) (param $0 f64) (result i32) - ;;@ ~lib/builtins.ts:22:26 + ;;@ ~lib/builtins.ts:26:26 (f64.eq - ;;@ ~lib/builtins.ts:22:9 + ;;@ ~lib/builtins.ts:26:9 (f64.sub (get_local $0) - ;;@ ~lib/builtins.ts:22:17 + ;;@ ~lib/builtins.ts:26:17 (get_local $0) ) - ;;@ ~lib/builtins.ts:22:26 + ;;@ ~lib/builtins.ts:26:26 (f64.const 0) ) ) diff --git a/examples/n-body/build/index.asm.js b/examples/n-body/build/index.asm.js index 332b9c2b..9f467fe1 100644 --- a/examples/n-body/build/index.asm.js +++ b/examples/n-body/build/index.asm.js @@ -26,7 +26,7 @@ function asmFunc(global, env, buffer) { var assembly_index_system = 0; var HEAP_BASE = 40; var i64toi32_i32$HIGH_BITS = 0; - function $lib_allocator_arena_allocate_memory($0) { + function $lib_allocator_arena___memory_allocate($0) { $0 = $0 | 0; var $1 = 0, $2 = 0, $3 = 0, wasm2asm_i32$0 = 0, wasm2asm_i32$1 = 0, wasm2asm_i32$2 = 0; if ($0) { @@ -55,7 +55,7 @@ function asmFunc(global, env, buffer) { $7 = +$7; var wasm2asm_i32$0 = 0, wasm2asm_f64$0 = 0.0; if (($0 | 0) == (0 | 0)) { - $0 = $lib_allocator_arena_allocate_memory(56 | 0) | 0; + $0 = $lib_allocator_arena___memory_allocate(56 | 0) | 0; wasm2asm_i32$0 = $0; wasm2asm_f64$0 = $1; HEAPF64[wasm2asm_i32$0 >> 3] = wasm2asm_f64$0; @@ -81,7 +81,7 @@ function asmFunc(global, env, buffer) { return $0 | 0; } - function $lib_memory_set_memory($0, $1, $2) { + function $lib_memory_memory_fill($0, $1, $2) { $0 = $0 | 0; $1 = $1 | 0; $2 = $2 | 0; @@ -253,12 +253,12 @@ function asmFunc(global, env, buffer) { abort(); } $2 = $1 << 2 | 0; - $3 = $lib_allocator_arena_allocate_memory(1 << (32 - Math_clz32($2 + 7 | 0) | 0) | 0 | 0) | 0; + $3 = $lib_allocator_arena___memory_allocate(1 << (32 - Math_clz32($2 + 7 | 0) | 0) | 0 | 0) | 0; wasm2asm_i32$0 = $3; wasm2asm_i32$1 = $2; HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1; if (($0 | 0) == (0 | 0)) { - $0 = $lib_allocator_arena_allocate_memory(8 | 0) | 0; + $0 = $lib_allocator_arena___memory_allocate(8 | 0) | 0; wasm2asm_i32$0 = $0; wasm2asm_i32$1 = 0; HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1; @@ -272,7 +272,7 @@ function asmFunc(global, env, buffer) { wasm2asm_i32$0 = $0; wasm2asm_i32$1 = $1; HEAP32[(wasm2asm_i32$0 + 4 | 0) >> 2] = wasm2asm_i32$1; - $lib_memory_set_memory($3 + 8 | 0 | 0, 0 | 0, $2 | 0); + $lib_memory_memory_fill($3 + 8 | 0 | 0, 0 | 0, $2 | 0); return $0 | 0; } @@ -307,7 +307,7 @@ function asmFunc(global, env, buffer) { wasm2asm_f64$0 = -$7 / 39.47841760435743; HEAPF64[(wasm2asm_i32$0 + 40 | 0) >> 3] = wasm2asm_f64$0; if (($0 | 0) == (0 | 0)) { - $2 = $lib_allocator_arena_allocate_memory(4 | 0) | 0; + $2 = $lib_allocator_arena___memory_allocate(4 | 0) | 0; wasm2asm_i32$0 = $2; wasm2asm_i32$1 = $1; HEAP32[wasm2asm_i32$0 >> 2] = wasm2asm_i32$1; diff --git a/examples/n-body/build/optimized.wat b/examples/n-body/build/optimized.wat index debca963..24fbd49b 100644 --- a/examples/n-body/build/optimized.wat +++ b/examples/n-body/build/optimized.wat @@ -22,7 +22,7 @@ (export "bench" (func $assembly/index/bench)) (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -116,7 +116,7 @@ (block (f64.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/allocator/arena/__memory_allocate (i32.const 56) ) ) @@ -150,7 +150,7 @@ ) (get_local $0) ) - (func $~lib/memory/set_memory (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memory.fill (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -500,7 +500,7 @@ ) (i32.store (tee_local $3 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/allocator/arena/__memory_allocate (i32.shl (i32.const 1) (i32.sub @@ -529,7 +529,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/allocator/arena/__memory_allocate (i32.const 8) ) ) @@ -549,7 +549,7 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) (i32.const 8) @@ -693,7 +693,7 @@ (block (i32.store (tee_local $2 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/allocator/arena/__memory_allocate (i32.const 4) ) ) diff --git a/examples/n-body/build/untouched.wat b/examples/n-body/build/untouched.wat index eadc916a..c01093ce 100644 --- a/examples/n-body/build/untouched.wat +++ b/examples/n-body/build/untouched.wat @@ -33,7 +33,18 @@ (export "bench" (func $assembly/index/bench)) (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 1 ;) (type $i) (result i32) + ;;@ ~lib/memory.ts:4:25 + (current_memory) + ) + (func $~lib/memory/memory.grow (; 2 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:8:30 + (grow_memory + ;;@ ~lib/memory.ts:8:25 + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -86,8 +97,8 @@ ) ;;@ ~lib/allocator/arena.ts:21:4 (set_local $3 - ;;@ ~lib/allocator/arena.ts:21:22 - (current_memory) + ;;@ ~lib/allocator/arena.ts:21:29 + (call $~lib/memory/memory.size) ) ;;@ ~lib/allocator/arena.ts:22:4 (if @@ -152,7 +163,8 @@ (if ;;@ ~lib/allocator/arena.ts:25:10 (i32.lt_s - (grow_memory + ;;@ ~lib/allocator/arena.ts:25:17 + (call $~lib/memory/memory.grow ;;@ ~lib/allocator/arena.ts:25:22 (get_local $5) ) @@ -163,7 +175,8 @@ (if ;;@ ~lib/allocator/arena.ts:26:12 (i32.lt_s - (grow_memory + ;;@ ~lib/allocator/arena.ts:26:19 + (call $~lib/memory/memory.grow ;;@ ~lib/allocator/arena.ts:26:24 (get_local $4) ) @@ -190,7 +203,17 @@ ;;@ ~lib/allocator/arena.ts:34:9 (i32.const 0) ) - (func $assembly/index/Body#constructor (; 2 ;) (type $iFFFFFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (param $7 f64) (result i32) + (func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:144:4 + (return + ;;@ ~lib/memory.ts:144:45 + (call $~lib/allocator/arena/__memory_allocate + ;;@ ~lib/memory.ts:144:63 + (get_local $0) + ) + ) + ) + (func $assembly/index/Body#constructor (; 5 ;) (type $iFFFFFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (param $7 f64) (result i32) (local $8 i32) (tee_local $0 (if (result i32) @@ -199,7 +222,7 @@ (tee_local $0 (block (result i32) (set_local $8 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 56) ) ) @@ -237,7 +260,7 @@ ) ) ) - (func $assembly/index/Sun (; 3 ;) (type $i) (result i32) + (func $assembly/index/Sun (; 6 ;) (type $i) (result i32) ;;@ assembly/index.ts:34:2 (call $assembly/index/Body#constructor (i32.const 0) @@ -257,7 +280,7 @@ (f64.const 39.47841760435743) ) ) - (func $assembly/index/Jupiter (; 4 ;) (type $i) (result i32) + (func $assembly/index/Jupiter (; 7 ;) (type $i) (result i32) ;;@ assembly/index.ts:46:2 (call $assembly/index/Body#constructor (i32.const 0) @@ -293,7 +316,7 @@ ) ) ) - (func $assembly/index/Saturn (; 5 ;) (type $i) (result i32) + (func $assembly/index/Saturn (; 8 ;) (type $i) (result i32) ;;@ assembly/index.ts:58:2 (call $assembly/index/Body#constructor (i32.const 0) @@ -329,7 +352,7 @@ ) ) ) - (func $assembly/index/Uranus (; 6 ;) (type $i) (result i32) + (func $assembly/index/Uranus (; 9 ;) (type $i) (result i32) ;;@ assembly/index.ts:70:2 (call $assembly/index/Body#constructor (i32.const 0) @@ -365,7 +388,7 @@ ) ) ) - (func $assembly/index/Neptune (; 7 ;) (type $i) (result i32) + (func $assembly/index/Neptune (; 10 ;) (type $i) (result i32) ;;@ assembly/index.ts:82:2 (call $assembly/index/Body#constructor (i32.const 0) @@ -401,7 +424,7 @@ ) ) ) - (func $~lib/internal/arraybuffer/computeSize (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/computeSize (; 11 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/internal/arraybuffer.ts:17:77 (i32.shl ;;@ ~lib/internal/arraybuffer.ts:17:9 @@ -426,7 +449,7 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 9 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocUnsafe (; 12 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) ;;@ ~lib/internal/arraybuffer.ts:22:2 (if @@ -450,8 +473,8 @@ ) ;;@ ~lib/internal/arraybuffer.ts:23:2 (set_local $1 - ;;@ ~lib/internal/arraybuffer.ts:23:15 - (call $~lib/allocator/arena/allocate_memory + ;;@ ~lib/internal/arraybuffer.ts:23:22 + (call $~lib/memory/memory.allocate ;;@ ~lib/internal/arraybuffer.ts:23:31 (call $~lib/internal/arraybuffer/computeSize ;;@ ~lib/internal/arraybuffer.ts:23:43 @@ -469,519 +492,519 @@ ;;@ ~lib/internal/arraybuffer.ts:25:39 (get_local $1) ) - (func $~lib/memory/set_memory (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memory.fill (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) - ;;@ ~lib/memory.ts:196:2 + ;;@ ~lib/memory.ts:17:4 (if - ;;@ ~lib/memory.ts:196:6 + ;;@ ~lib/memory.ts:17:8 (i32.eqz - ;;@ ~lib/memory.ts:196:7 + ;;@ ~lib/memory.ts:17:9 (get_local $2) ) - ;;@ ~lib/memory.ts:196:10 + ;;@ ~lib/memory.ts:17:12 (return) ) - ;;@ ~lib/memory.ts:197:2 + ;;@ ~lib/memory.ts:18:4 (i32.store8 - ;;@ ~lib/memory.ts:197:12 + ;;@ ~lib/memory.ts:18:14 (get_local $0) - ;;@ ~lib/memory.ts:197:18 + ;;@ ~lib/memory.ts:18:20 (get_local $1) ) - ;;@ ~lib/memory.ts:198:2 + ;;@ ~lib/memory.ts:19:4 (i32.store8 - ;;@ ~lib/memory.ts:198:12 + ;;@ ~lib/memory.ts:19:14 (i32.sub (i32.add (get_local $0) - ;;@ ~lib/memory.ts:198:19 + ;;@ ~lib/memory.ts:19:21 (get_local $2) ) - ;;@ ~lib/memory.ts:198:23 + ;;@ ~lib/memory.ts:19:25 (i32.const 1) ) - ;;@ ~lib/memory.ts:198:26 + ;;@ ~lib/memory.ts:19:28 (get_local $1) ) - ;;@ ~lib/memory.ts:199:2 + ;;@ ~lib/memory.ts:20:4 (if - ;;@ ~lib/memory.ts:199:6 + ;;@ ~lib/memory.ts:20:8 (i32.le_u (get_local $2) - ;;@ ~lib/memory.ts:199:11 + ;;@ ~lib/memory.ts:20:13 (i32.const 2) ) - ;;@ ~lib/memory.ts:199:14 + ;;@ ~lib/memory.ts:20:16 (return) ) - ;;@ ~lib/memory.ts:201:2 + ;;@ ~lib/memory.ts:22:4 (i32.store8 - ;;@ ~lib/memory.ts:201:12 + ;;@ ~lib/memory.ts:22:14 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:201:19 + ;;@ ~lib/memory.ts:22:21 (i32.const 1) ) - ;;@ ~lib/memory.ts:201:22 + ;;@ ~lib/memory.ts:22:24 (get_local $1) ) - ;;@ ~lib/memory.ts:202:2 + ;;@ ~lib/memory.ts:23:4 (i32.store8 - ;;@ ~lib/memory.ts:202:12 + ;;@ ~lib/memory.ts:23:14 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:202:19 + ;;@ ~lib/memory.ts:23:21 (i32.const 2) ) - ;;@ ~lib/memory.ts:202:22 + ;;@ ~lib/memory.ts:23:24 (get_local $1) ) - ;;@ ~lib/memory.ts:203:2 + ;;@ ~lib/memory.ts:24:4 (i32.store8 - ;;@ ~lib/memory.ts:203:12 + ;;@ ~lib/memory.ts:24:14 (i32.sub (i32.add (get_local $0) - ;;@ ~lib/memory.ts:203:19 + ;;@ ~lib/memory.ts:24:21 (get_local $2) ) - ;;@ ~lib/memory.ts:203:23 + ;;@ ~lib/memory.ts:24:25 (i32.const 2) ) - ;;@ ~lib/memory.ts:203:26 + ;;@ ~lib/memory.ts:24:28 (get_local $1) ) - ;;@ ~lib/memory.ts:204:2 + ;;@ ~lib/memory.ts:25:4 (i32.store8 - ;;@ ~lib/memory.ts:204:12 + ;;@ ~lib/memory.ts:25:14 (i32.sub (i32.add (get_local $0) - ;;@ ~lib/memory.ts:204:19 + ;;@ ~lib/memory.ts:25:21 (get_local $2) ) - ;;@ ~lib/memory.ts:204:23 + ;;@ ~lib/memory.ts:25:25 (i32.const 3) ) - ;;@ ~lib/memory.ts:204:26 + ;;@ ~lib/memory.ts:25:28 (get_local $1) ) - ;;@ ~lib/memory.ts:205:2 + ;;@ ~lib/memory.ts:26:4 (if - ;;@ ~lib/memory.ts:205:6 + ;;@ ~lib/memory.ts:26:8 (i32.le_u (get_local $2) - ;;@ ~lib/memory.ts:205:11 + ;;@ ~lib/memory.ts:26:13 (i32.const 6) ) - ;;@ ~lib/memory.ts:205:14 + ;;@ ~lib/memory.ts:26:16 (return) ) - ;;@ ~lib/memory.ts:206:2 + ;;@ ~lib/memory.ts:27:4 (i32.store8 - ;;@ ~lib/memory.ts:206:12 + ;;@ ~lib/memory.ts:27:14 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:206:19 + ;;@ ~lib/memory.ts:27:21 (i32.const 3) ) - ;;@ ~lib/memory.ts:206:22 + ;;@ ~lib/memory.ts:27:24 (get_local $1) ) - ;;@ ~lib/memory.ts:207:2 + ;;@ ~lib/memory.ts:28:4 (i32.store8 - ;;@ ~lib/memory.ts:207:12 + ;;@ ~lib/memory.ts:28:14 (i32.sub (i32.add (get_local $0) - ;;@ ~lib/memory.ts:207:19 + ;;@ ~lib/memory.ts:28:21 (get_local $2) ) - ;;@ ~lib/memory.ts:207:23 + ;;@ ~lib/memory.ts:28:25 (i32.const 4) ) - ;;@ ~lib/memory.ts:207:26 + ;;@ ~lib/memory.ts:28:28 (get_local $1) ) - ;;@ ~lib/memory.ts:208:2 + ;;@ ~lib/memory.ts:29:4 (if - ;;@ ~lib/memory.ts:208:6 + ;;@ ~lib/memory.ts:29:8 (i32.le_u (get_local $2) - ;;@ ~lib/memory.ts:208:11 + ;;@ ~lib/memory.ts:29:13 (i32.const 8) ) - ;;@ ~lib/memory.ts:208:14 + ;;@ ~lib/memory.ts:29:16 (return) ) - ;;@ ~lib/memory.ts:211:2 + ;;@ ~lib/memory.ts:32:4 (set_local $3 - ;;@ ~lib/memory.ts:211:17 + ;;@ ~lib/memory.ts:32:19 (i32.and (i32.sub (i32.const 0) - ;;@ ~lib/memory.ts:211:18 + ;;@ ~lib/memory.ts:32:20 (get_local $0) ) - ;;@ ~lib/memory.ts:211:25 + ;;@ ~lib/memory.ts:32:27 (i32.const 3) ) ) - ;;@ ~lib/memory.ts:212:2 + ;;@ ~lib/memory.ts:33:4 (set_local $0 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:212:10 + ;;@ ~lib/memory.ts:33:12 (get_local $3) ) ) - ;;@ ~lib/memory.ts:213:2 + ;;@ ~lib/memory.ts:34:4 (set_local $2 (i32.sub (get_local $2) - ;;@ ~lib/memory.ts:213:7 + ;;@ ~lib/memory.ts:34:9 (get_local $3) ) ) - ;;@ ~lib/memory.ts:214:2 + ;;@ ~lib/memory.ts:35:4 (set_local $2 (i32.and (get_local $2) - ;;@ ~lib/memory.ts:214:7 + ;;@ ~lib/memory.ts:35:9 (i32.const -4) ) ) - ;;@ ~lib/memory.ts:216:2 + ;;@ ~lib/memory.ts:37:4 (set_local $4 - ;;@ ~lib/memory.ts:216:17 + ;;@ ~lib/memory.ts:37:19 (i32.mul (i32.div_u (i32.const -1) - ;;@ ~lib/memory.ts:216:27 + ;;@ ~lib/memory.ts:37:29 (i32.const 255) ) (i32.and - ;;@ ~lib/memory.ts:216:33 + ;;@ ~lib/memory.ts:37:35 (get_local $1) (i32.const 255) ) ) ) - ;;@ ~lib/memory.ts:219:2 + ;;@ ~lib/memory.ts:40:4 (i32.store - ;;@ ~lib/memory.ts:219:13 + ;;@ ~lib/memory.ts:40:15 (get_local $0) - ;;@ ~lib/memory.ts:219:19 + ;;@ ~lib/memory.ts:40:21 (get_local $4) ) - ;;@ ~lib/memory.ts:220:2 + ;;@ ~lib/memory.ts:41:4 (i32.store - ;;@ ~lib/memory.ts:220:13 + ;;@ ~lib/memory.ts:41:15 (i32.sub (i32.add (get_local $0) - ;;@ ~lib/memory.ts:220:20 + ;;@ ~lib/memory.ts:41:22 (get_local $2) ) - ;;@ ~lib/memory.ts:220:24 + ;;@ ~lib/memory.ts:41:26 (i32.const 4) ) - ;;@ ~lib/memory.ts:220:27 + ;;@ ~lib/memory.ts:41:29 (get_local $4) ) - ;;@ ~lib/memory.ts:221:2 + ;;@ ~lib/memory.ts:42:4 (if - ;;@ ~lib/memory.ts:221:6 + ;;@ ~lib/memory.ts:42:8 (i32.le_u (get_local $2) - ;;@ ~lib/memory.ts:221:11 + ;;@ ~lib/memory.ts:42:13 (i32.const 8) ) - ;;@ ~lib/memory.ts:221:14 + ;;@ ~lib/memory.ts:42:16 (return) ) - ;;@ ~lib/memory.ts:222:2 + ;;@ ~lib/memory.ts:43:4 (i32.store - ;;@ ~lib/memory.ts:222:13 + ;;@ ~lib/memory.ts:43:15 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:222:20 + ;;@ ~lib/memory.ts:43:22 (i32.const 4) ) - ;;@ ~lib/memory.ts:222:23 + ;;@ ~lib/memory.ts:43:25 (get_local $4) ) - ;;@ ~lib/memory.ts:223:2 + ;;@ ~lib/memory.ts:44:4 (i32.store - ;;@ ~lib/memory.ts:223:13 + ;;@ ~lib/memory.ts:44:15 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:223:20 + ;;@ ~lib/memory.ts:44:22 (i32.const 8) ) - ;;@ ~lib/memory.ts:223:23 + ;;@ ~lib/memory.ts:44:25 (get_local $4) ) - ;;@ ~lib/memory.ts:224:2 + ;;@ ~lib/memory.ts:45:4 (i32.store - ;;@ ~lib/memory.ts:224:13 + ;;@ ~lib/memory.ts:45:15 (i32.sub (i32.add (get_local $0) - ;;@ ~lib/memory.ts:224:20 + ;;@ ~lib/memory.ts:45:22 (get_local $2) ) - ;;@ ~lib/memory.ts:224:24 + ;;@ ~lib/memory.ts:45:26 (i32.const 12) ) - ;;@ ~lib/memory.ts:224:28 + ;;@ ~lib/memory.ts:45:30 (get_local $4) ) - ;;@ ~lib/memory.ts:225:2 + ;;@ ~lib/memory.ts:46:4 (i32.store - ;;@ ~lib/memory.ts:225:13 + ;;@ ~lib/memory.ts:46:15 (i32.sub (i32.add (get_local $0) - ;;@ ~lib/memory.ts:225:20 + ;;@ ~lib/memory.ts:46:22 (get_local $2) ) - ;;@ ~lib/memory.ts:225:24 + ;;@ ~lib/memory.ts:46:26 (i32.const 8) ) - ;;@ ~lib/memory.ts:225:27 + ;;@ ~lib/memory.ts:46:29 (get_local $4) ) - ;;@ ~lib/memory.ts:226:2 + ;;@ ~lib/memory.ts:47:4 (if - ;;@ ~lib/memory.ts:226:6 + ;;@ ~lib/memory.ts:47:8 (i32.le_u (get_local $2) - ;;@ ~lib/memory.ts:226:11 + ;;@ ~lib/memory.ts:47:13 (i32.const 24) ) - ;;@ ~lib/memory.ts:226:15 + ;;@ ~lib/memory.ts:47:17 (return) ) - ;;@ ~lib/memory.ts:227:2 + ;;@ ~lib/memory.ts:48:4 (i32.store - ;;@ ~lib/memory.ts:227:13 + ;;@ ~lib/memory.ts:48:15 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:227:20 + ;;@ ~lib/memory.ts:48:22 (i32.const 12) ) - ;;@ ~lib/memory.ts:227:24 + ;;@ ~lib/memory.ts:48:26 (get_local $4) ) - ;;@ ~lib/memory.ts:228:2 + ;;@ ~lib/memory.ts:49:4 (i32.store - ;;@ ~lib/memory.ts:228:13 + ;;@ ~lib/memory.ts:49:15 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:228:20 + ;;@ ~lib/memory.ts:49:22 (i32.const 16) ) - ;;@ ~lib/memory.ts:228:24 + ;;@ ~lib/memory.ts:49:26 (get_local $4) ) - ;;@ ~lib/memory.ts:229:2 + ;;@ ~lib/memory.ts:50:4 (i32.store - ;;@ ~lib/memory.ts:229:13 + ;;@ ~lib/memory.ts:50:15 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:229:20 + ;;@ ~lib/memory.ts:50:22 (i32.const 20) ) - ;;@ ~lib/memory.ts:229:24 + ;;@ ~lib/memory.ts:50:26 (get_local $4) ) - ;;@ ~lib/memory.ts:230:2 + ;;@ ~lib/memory.ts:51:4 (i32.store - ;;@ ~lib/memory.ts:230:13 + ;;@ ~lib/memory.ts:51:15 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:230:20 + ;;@ ~lib/memory.ts:51:22 (i32.const 24) ) - ;;@ ~lib/memory.ts:230:24 + ;;@ ~lib/memory.ts:51:26 (get_local $4) ) - ;;@ ~lib/memory.ts:231:2 + ;;@ ~lib/memory.ts:52:4 (i32.store - ;;@ ~lib/memory.ts:231:13 + ;;@ ~lib/memory.ts:52:15 (i32.sub (i32.add (get_local $0) - ;;@ ~lib/memory.ts:231:20 + ;;@ ~lib/memory.ts:52:22 (get_local $2) ) - ;;@ ~lib/memory.ts:231:24 + ;;@ ~lib/memory.ts:52:26 (i32.const 28) ) - ;;@ ~lib/memory.ts:231:28 + ;;@ ~lib/memory.ts:52:30 (get_local $4) ) - ;;@ ~lib/memory.ts:232:2 + ;;@ ~lib/memory.ts:53:4 (i32.store - ;;@ ~lib/memory.ts:232:13 + ;;@ ~lib/memory.ts:53:15 (i32.sub (i32.add (get_local $0) - ;;@ ~lib/memory.ts:232:20 + ;;@ ~lib/memory.ts:53:22 (get_local $2) ) - ;;@ ~lib/memory.ts:232:24 + ;;@ ~lib/memory.ts:53:26 (i32.const 24) ) - ;;@ ~lib/memory.ts:232:28 + ;;@ ~lib/memory.ts:53:30 (get_local $4) ) - ;;@ ~lib/memory.ts:233:2 + ;;@ ~lib/memory.ts:54:4 (i32.store - ;;@ ~lib/memory.ts:233:13 + ;;@ ~lib/memory.ts:54:15 (i32.sub (i32.add (get_local $0) - ;;@ ~lib/memory.ts:233:20 + ;;@ ~lib/memory.ts:54:22 (get_local $2) ) - ;;@ ~lib/memory.ts:233:24 + ;;@ ~lib/memory.ts:54:26 (i32.const 20) ) - ;;@ ~lib/memory.ts:233:28 + ;;@ ~lib/memory.ts:54:30 (get_local $4) ) - ;;@ ~lib/memory.ts:234:2 + ;;@ ~lib/memory.ts:55:4 (i32.store - ;;@ ~lib/memory.ts:234:13 + ;;@ ~lib/memory.ts:55:15 (i32.sub (i32.add (get_local $0) - ;;@ ~lib/memory.ts:234:20 + ;;@ ~lib/memory.ts:55:22 (get_local $2) ) - ;;@ ~lib/memory.ts:234:24 + ;;@ ~lib/memory.ts:55:26 (i32.const 16) ) - ;;@ ~lib/memory.ts:234:28 + ;;@ ~lib/memory.ts:55:30 (get_local $4) ) - ;;@ ~lib/memory.ts:237:2 + ;;@ ~lib/memory.ts:58:4 (set_local $3 - ;;@ ~lib/memory.ts:237:6 + ;;@ ~lib/memory.ts:58:8 (i32.add (i32.const 24) - ;;@ ~lib/memory.ts:237:11 + ;;@ ~lib/memory.ts:58:13 (i32.and - ;;@ ~lib/memory.ts:237:12 + ;;@ ~lib/memory.ts:58:14 (get_local $0) - ;;@ ~lib/memory.ts:237:19 + ;;@ ~lib/memory.ts:58:21 (i32.const 4) ) ) ) - ;;@ ~lib/memory.ts:238:2 + ;;@ ~lib/memory.ts:59:4 (set_local $0 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:238:10 + ;;@ ~lib/memory.ts:59:12 (get_local $3) ) ) - ;;@ ~lib/memory.ts:239:2 + ;;@ ~lib/memory.ts:60:4 (set_local $2 (i32.sub (get_local $2) - ;;@ ~lib/memory.ts:239:7 + ;;@ ~lib/memory.ts:60:9 (get_local $3) ) ) - ;;@ ~lib/memory.ts:242:2 + ;;@ ~lib/memory.ts:63:4 (set_local $5 - ;;@ ~lib/memory.ts:242:17 + ;;@ ~lib/memory.ts:63:19 (i64.or (i64.extend_u/i32 (get_local $4) ) - ;;@ ~lib/memory.ts:242:28 + ;;@ ~lib/memory.ts:63:30 (i64.shl - ;;@ ~lib/memory.ts:242:29 + ;;@ ~lib/memory.ts:63:31 (i64.extend_u/i32 (get_local $4) ) - ;;@ ~lib/memory.ts:242:41 + ;;@ ~lib/memory.ts:63:43 (i64.const 32) ) ) ) - ;;@ ~lib/memory.ts:243:2 + ;;@ ~lib/memory.ts:64:4 (block $break|0 (loop $continue|0 (if - ;;@ ~lib/memory.ts:243:9 + ;;@ ~lib/memory.ts:64:11 (i32.ge_u (get_local $2) - ;;@ ~lib/memory.ts:243:14 + ;;@ ~lib/memory.ts:64:16 (i32.const 32) ) (block (block - ;;@ ~lib/memory.ts:244:4 + ;;@ ~lib/memory.ts:65:6 (i64.store - ;;@ ~lib/memory.ts:244:15 + ;;@ ~lib/memory.ts:65:17 (get_local $0) - ;;@ ~lib/memory.ts:244:21 + ;;@ ~lib/memory.ts:65:23 (get_local $5) ) - ;;@ ~lib/memory.ts:245:4 + ;;@ ~lib/memory.ts:66:6 (i64.store - ;;@ ~lib/memory.ts:245:15 + ;;@ ~lib/memory.ts:66:17 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:245:22 + ;;@ ~lib/memory.ts:66:24 (i32.const 8) ) - ;;@ ~lib/memory.ts:245:25 + ;;@ ~lib/memory.ts:66:27 (get_local $5) ) - ;;@ ~lib/memory.ts:246:4 + ;;@ ~lib/memory.ts:67:6 (i64.store - ;;@ ~lib/memory.ts:246:15 + ;;@ ~lib/memory.ts:67:17 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:246:22 + ;;@ ~lib/memory.ts:67:24 (i32.const 16) ) - ;;@ ~lib/memory.ts:246:26 + ;;@ ~lib/memory.ts:67:28 (get_local $5) ) - ;;@ ~lib/memory.ts:247:4 + ;;@ ~lib/memory.ts:68:6 (i64.store - ;;@ ~lib/memory.ts:247:15 + ;;@ ~lib/memory.ts:68:17 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:247:22 + ;;@ ~lib/memory.ts:68:24 (i32.const 24) ) - ;;@ ~lib/memory.ts:247:26 + ;;@ ~lib/memory.ts:68:28 (get_local $5) ) - ;;@ ~lib/memory.ts:248:4 + ;;@ ~lib/memory.ts:69:6 (set_local $2 (i32.sub (get_local $2) - ;;@ ~lib/memory.ts:248:9 + ;;@ ~lib/memory.ts:69:11 (i32.const 32) ) ) - ;;@ ~lib/memory.ts:249:4 + ;;@ ~lib/memory.ts:70:6 (set_local $0 (i32.add (get_local $0) - ;;@ ~lib/memory.ts:249:12 + ;;@ ~lib/memory.ts:70:14 (i32.const 32) ) ) @@ -992,7 +1015,7 @@ ) ) ) - (func $~lib/array/Array#constructor (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#constructor (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1041,7 +1064,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -1067,8 +1090,8 @@ ;;@ ~lib/array.ts:27:19 (get_local $1) ) - ;;@ ~lib/array.ts:28:4 - (call $~lib/memory/set_memory + ;;@ ~lib/array.ts:28:11 + (call $~lib/memory/memory.fill ;;@ ~lib/array.ts:29:6 (i32.add (get_local $3) @@ -1082,7 +1105,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#__unchecked_set (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__unchecked_set (; 15 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) ;;@ ~lib/array.ts:96:4 (block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 @@ -1110,14 +1133,14 @@ ) ) ) - (func $~lib/array/Array#get:length (; 13 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 16 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/array.ts:36:16 (i32.load offset=4 ;;@ ~lib/array.ts:36:11 (get_local $0) ) ) - (func $~lib/array/Array#__unchecked_get (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__unchecked_get (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) ;;@ ~lib/array.ts:77:46 (block $~lib/internal/arraybuffer/loadUnsafe|inlined.0 (result i32) @@ -1143,7 +1166,7 @@ ) ) ) - (func $~lib/array/Array#__get (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__get (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) ;;@ ~lib/array.ts:69:4 (set_local $2 @@ -1188,7 +1211,7 @@ (unreachable) ) ) - (func $assembly/index/Body#offsetMomentum (; 16 ;) (type $iFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32) + (func $assembly/index/Body#offsetMomentum (; 19 ;) (type $iFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32) ;;@ assembly/index.ts:24:4 (f64.store offset=24 (get_local $0) @@ -1231,7 +1254,7 @@ ;;@ assembly/index.ts:27:11 (get_local $0) ) - (func $assembly/index/NBodySystem#constructor (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $assembly/index/NBodySystem#constructor (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 f64) (local $3 f64) (local $4 f64) @@ -1375,7 +1398,7 @@ (tee_local $0 (block (result i32) (set_local $6 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) @@ -1389,7 +1412,7 @@ ) ) ) - (func $assembly/index/init (; 18 ;) (type $v) + (func $assembly/index/init (; 21 ;) (type $v) (local $0 i32) ;;@ assembly/index.ts:191:2 (set_global $assembly/index/system @@ -1439,7 +1462,7 @@ ) ) ) - (func $assembly/index/getBody (; 19 ;) (type $ii) (param $0 i32) (result i32) + (func $assembly/index/getBody (; 22 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) ;;@ assembly/index.ts:201:2 (set_local $1 @@ -1469,7 +1492,7 @@ (i32.const 0) ) ) - (func $assembly/index/NBodySystem#advance (; 20 ;) (type $iFv) (param $0 i32) (param $1 f64) + (func $assembly/index/NBodySystem#advance (; 23 ;) (type $iFv) (param $0 i32) (param $1 f64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1890,7 +1913,7 @@ ) ) ) - (func $assembly/index/NBodySystem#energy (; 21 ;) (type $iF) (param $0 i32) (result f64) + (func $assembly/index/NBodySystem#energy (; 24 ;) (type $iF) (param $0 i32) (result f64) (local $1 f64) (local $2 i32) (local $3 i32) @@ -2191,7 +2214,7 @@ ;;@ assembly/index.ts:184:11 (get_local $1) ) - (func $assembly/index/step (; 22 ;) (type $F) (result f64) + (func $assembly/index/step (; 25 ;) (type $F) (result f64) ;;@ assembly/index.ts:206:9 (call $assembly/index/NBodySystem#advance ;;@ assembly/index.ts:206:2 @@ -2205,7 +2228,7 @@ (get_global $assembly/index/system) ) ) - (func $assembly/index/bench (; 23 ;) (type $iv) (param $0 i32) + (func $assembly/index/bench (; 26 ;) (type $iv) (param $0 i32) (local $1 i32) ;;@ assembly/index.ts:211:2 (block $break|0 @@ -2243,7 +2266,7 @@ ) ) ) - (func $start (; 24 ;) (type $v) + (func $start (; 27 ;) (type $v) (set_global $~lib/allocator/arena/startOffset ;;@ ~lib/allocator/arena.ts:12:25 (i32.and diff --git a/examples/ugc/assembly/ugc.ts b/examples/ugc/assembly/ugc.ts index 3c0c6883..31b4947b 100644 --- a/examples/ugc/assembly/ugc.ts +++ b/examples/ugc/assembly/ugc.ts @@ -245,7 +245,7 @@ class Control { // TODO: should happen dynamically so it DCE's if all objects are unmanaged var GC = Control.create(HEAP_BASE); -// var someObject = allocate_memory(64); +// var someObject = memory.allocate(64); // GC.register(changetype(someObject)); // Exported interface @@ -293,5 +293,5 @@ function gc_free_fn(control: Control, header: ObjectHeader): void { // array, string: free their data segments // TODO: might make sense to provide @finalize or similar // } - free_memory(changetype(header)); + memory.free(changetype(header)); } diff --git a/lib/loader/tests/assembly/index.ts b/lib/loader/tests/assembly/index.ts index cee93791..e448e44c 100644 --- a/lib/loader/tests/assembly/index.ts +++ b/lib/loader/tests/assembly/index.ts @@ -39,8 +39,8 @@ export class Car { } dispose(): void { - free_memory(changetype(this)); + memory.free(changetype(this)); } } -export { allocate_memory, free_memory }; +export { memory }; diff --git a/package-lock.json b/package-lock.json index 16c20613..71225f67 100644 --- a/package-lock.json +++ b/package-lock.json @@ -664,9 +664,9 @@ "dev": true }, "binaryen": { - "version": "48.0.0-nightly.20180712", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-48.0.0-nightly.20180712.tgz", - "integrity": "sha512-E3DR6Pi2iTSqF4E93fFZrLhv0gZpSIr8MDS9R4P2Lm+/n3CGfkQvYGN20GmFwbOYNLKU68UWOXYdqRFTAkNrTA==" + "version": "49.0.0-nightly.20180718", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-49.0.0-nightly.20180718.tgz", + "integrity": "sha512-r7gYKbwYYF5DBTN2fSomv1BNUNYSPros20eTng5MV/Bsv7V6DfJtrvietJ35p+jqI797P83vnJ0PEB1vTZ9qoQ==" }, "bluebird": { "version": "3.5.1", diff --git a/package.json b/package.json index 157c1fdc..d64580b7 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@protobufjs/utf8": "^1.1.0", - "binaryen": "48.0.0-nightly.20180712", + "binaryen": "49.0.0-nightly.20180718", "long": "^4.0.0" }, "devDependencies": { diff --git a/snap/README.md b/snap/README.md index 0a2c51e3..51104249 100644 --- a/snap/README.md +++ b/snap/README.md @@ -1,3 +1,3 @@ Snaps are containerised software packages that are simple to create and install on all major Linux systems without modification. [Learn more](https://docs.snapcraft.io/). -[![Snap Status](https://build.snapcraft.io/badge/AssemblyScript/assemblyscript.svg)](https://build.snapcraft.io/user/AssemblyScript/assemblyscript) +[![Snap Status](https://build.snapcraft.io/badge/AssemblyScript/assemblyscript.svg)](https://snapcraft.io/assemblyscript) diff --git a/src/binary.ts b/src/binary.ts index 20c5d614..4b643a67 100644 --- a/src/binary.ts +++ b/src/binary.ts @@ -121,8 +121,8 @@ export enum Op { i64_store8 = 0x3c, i64_store16 = 0x3d, i64_store32 = 0x3e, - current_memory = 0x3f, - grow_memory = 0x40, + memory_size = 0x3f, + memory_grow = 0x40, i32_const = 0x41, i64_const = 0x42, f32_const = 0x43, diff --git a/src/builtins.ts b/src/builtins.ts index ca595fa5..38ef7b44 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -48,13 +48,19 @@ import { Class, Field, OperatorKind, - FlowFlags + FlowFlags, + Global, + DecoratorFlags } from "./program"; import { ReportMode } from "./resolver"; +import { + CommonFlags +} from "./common"; + /** Compiles a call to a built-in function. */ export function compileCall( compiler: Compiler, @@ -134,24 +140,17 @@ export function compileCall( } case "isDefined": { // isDefined(expression) -> bool compiler.currentType = Type.bool; - if (operands.length != 1) { - if (typeArguments) { - compiler.error( - DiagnosticCode.Type_0_is_not_generic, - reportNode.range, prototype.internalName - ); - } - compiler.error( - DiagnosticCode.Expected_0_arguments_but_got_1, - reportNode.range, "1", operands.length.toString(10) - ); - return module.createUnreachable(); - } if (typeArguments) { compiler.error( DiagnosticCode.Type_0_is_not_generic, reportNode.range, prototype.internalName ); + } + if (operands.length != 1) { + compiler.error( + DiagnosticCode.Expected_0_arguments_but_got_1, + reportNode.range, "1", operands.length.toString(10) + ); return module.createUnreachable(); } let element = compiler.resolver.resolveExpression(operands[0], compiler.currentFunction, ReportMode.SWALLOW); @@ -159,24 +158,17 @@ export function compileCall( } case "isConstant": { // isConstant(expression) -> bool compiler.currentType = Type.bool; - if (operands.length != 1) { - if (typeArguments) { - compiler.error( - DiagnosticCode.Type_0_is_not_generic, - reportNode.range, prototype.internalName - ); - } - compiler.error( - DiagnosticCode.Expected_0_arguments_but_got_1, - reportNode.range, "1", operands.length.toString(10) - ); - return module.createUnreachable(); - } if (typeArguments) { compiler.error( DiagnosticCode.Type_0_is_not_generic, reportNode.range, prototype.internalName ); + } + if (operands.length != 1) { + compiler.error( + DiagnosticCode.Expected_0_arguments_but_got_1, + reportNode.range, "1", operands.length.toString(10) + ); return module.createUnreachable(); } let expr = compiler.compileExpressionRetainType(operands[0], Type.i32, WrapMode.NONE); @@ -1879,7 +1871,7 @@ export function compileCall( // host operations - case "current_memory": { // current_memory() -> i32 + case "__memory_size": { // __memory_size() -> i32 compiler.currentType = Type.i32; if (operands.length != 0) { compiler.error( @@ -1895,7 +1887,7 @@ export function compileCall( } return module.createHost(HostOp.CurrentMemory); } - case "grow_memory": { // grow_memory(pages: i32) -> i32 + case "__memory_grow": { // __memory_grow(pages: i32) -> i32 compiler.currentType = Type.i32; if (operands.length != 1) { compiler.error( @@ -1915,7 +1907,7 @@ export function compileCall( return module.createHost(HostOp.GrowMemory, null, [ arg0 ]); } // see: https://github.com/WebAssembly/bulk-memory-operations - case "move_memory": { // move_memory(dest: usize, src: usize: n: usize) -> void + case "__memory_copy": { // __memory_copy(dest: usize, src: usize: n: usize) -> void if (typeArguments) { compiler.error( DiagnosticCode.Type_0_is_not_generic, @@ -1952,7 +1944,7 @@ export function compileCall( throw new Error("not implemented"); // return module.createHost(HostOp.MoveMemory, null, [ arg0, arg1, arg2 ]); } - case "set_memory": { // set_memory(dest: usize, value: u8, n: usize) -> void + case "__memory_fill": { // __memory_fill(dest: usize, value: u8, n: usize) -> void if (typeArguments) { compiler.error( DiagnosticCode.Type_0_is_not_generic, @@ -2318,6 +2310,30 @@ export function compileCall( return module.createCallIndirect(arg0, operandExprs, typeName); } + // user-defined diagnostic macros + + case "ERROR": { + compiler.error( + DiagnosticCode.User_defined_0, + reportNode.range, (operands.length ? operands[0] : reportNode).range.toString() + ); + return module.createUnreachable(); + } + case "WARNING": { + compiler.warning( + DiagnosticCode.User_defined_0, + reportNode.range, (operands.length ? operands[0] : reportNode).range.toString() + ); + return module.createNop(); + } + case "INFO": { + compiler.info( + DiagnosticCode.User_defined_0, + reportNode.range, (operands.length ? operands[0] : reportNode).range.toString() + ); + return module.createNop(); + } + // conversions case "i8": { @@ -2610,6 +2626,84 @@ export function compileCall( WrapMode.NONE ); } + + // gc + + case "__gc_iterate_roots": { + // TOOD: make it so that this can only be called from a library file? + if (typeArguments) { + compiler.error( + DiagnosticCode.Type_0_is_not_generic, + reportNode.range, prototype.internalName + ); + } + if (operands.length != 1) { + compiler.error( + DiagnosticCode.Expected_0_arguments_but_got_1, + reportNode.range, "1", operands.length.toString(10) + ); + compiler.currentType = Type.void; + return module.createUnreachable(); + } + let expr = compiler.compileExpressionRetainType(operands[0], Type.u32, WrapMode.NONE); + let type = compiler.currentType; + let signatureReference = type.signatureReference; + compiler.currentType = Type.void; + if ( + !type.is(TypeFlags.REFERENCE) || + !signatureReference || + signatureReference.parameterTypes.length != 1 || + signatureReference.parameterTypes[0] != compiler.options.usizeType + ) { + compiler.error( + DiagnosticCode.Type_0_is_not_assignable_to_type_1, + reportNode.range, type.toString(), "(ref: usize) => void" + ); + return module.createUnreachable(); + } + let exprs = new Array(); + for (let element of compiler.program.elementsLookup.values()) { + if (element.kind != ElementKind.GLOBAL) continue; + let global = element; + let classReference = global.type.classReference; + if ( + global.is(CommonFlags.COMPILED) && + classReference !== null && + !classReference.hasDecorator(DecoratorFlags.UNMANAGED) + ) { + if (global.is(CommonFlags.INLINED)) { + let value = global.constantIntegerValue; + exprs.push( + module.createCallIndirect( + expr, + [ + compiler.options.isWasm64 + ? module.createI64(i64_low(value), i64_high(value)) + : module.createI32(i64_low(value)) + ], + signatureReference.toSignatureString() + ) + ); + } else { + exprs.push( + module.createCallIndirect( + expr, + [ + module.createGetGlobal( + global.internalName, + compiler.options.nativeSizeType + ) + ], + signatureReference.toSignatureString() + ) + ); + } + } + } + return exprs.length + ? module.createBlock(null, exprs) + : module.createNop(); + } } var expr = deferASMCall(compiler, prototype, operands, contextualType, reportNode); if (expr) { @@ -2816,8 +2910,6 @@ function evaluateConstantOffset(compiler: Compiler, expression: Expression): i32 return value; } -const allocateInternalName = "allocate_memory"; - /** Compiles a memory allocation for an instance of the specified class. */ export function compileAllocate( compiler: Compiler, @@ -2828,29 +2920,15 @@ export function compileAllocate( assert(classInstance.program == program); var module = compiler.module; var options = compiler.options; - - var allocatePrototype = program.elementsLookup.get(allocateInternalName); - if (!allocatePrototype) { + var allocateInstance = program.memoryAllocateInstance; + if (!allocateInstance) { program.error( DiagnosticCode.Cannot_find_name_0, - reportNode.range, allocateInternalName - ); - program.info( - DiagnosticCode.An_allocator_must_be_declared_to_allocate_memory_Try_importing_allocator_arena_or_allocator_tlsf, - reportNode.range + reportNode.range, "memory.allocate" ); return module.createUnreachable(); } - if (allocatePrototype.kind != ElementKind.FUNCTION_PROTOTYPE) { - program.error( - DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures, - reportNode.range, allocatePrototype.internalName - ); - return module.createUnreachable(); - } - - var allocateInstance = compiler.resolver.resolveFunction(allocatePrototype, null); - if (!(allocateInstance && compiler.compileFunction(allocateInstance))) return module.createUnreachable(); + if (!compiler.compileFunction(allocateInstance)) return module.createUnreachable(); compiler.currentType = classInstance.type; return module.createCall( @@ -2863,8 +2941,6 @@ export function compileAllocate( ); } -const abortInternalName = "abort"; - /** Compiles an abort wired to the conditionally imported 'abort' function. */ export function compileAbort( compiler: Compiler, @@ -2874,13 +2950,10 @@ export function compileAbort( var program = compiler.program; var module = compiler.module; - var stringType = program.typesLookup.get("string"); // might be intended + var stringType = program.typesLookup.get("string"); if (!stringType) return module.createUnreachable(); - var abortPrototype = program.elementsLookup.get(abortInternalName); // might be intended - if (!abortPrototype || abortPrototype.kind != ElementKind.FUNCTION_PROTOTYPE) return module.createUnreachable(); - - var abortInstance = compiler.resolver.resolveFunction(abortPrototype, null); + var abortInstance = program.abortInstance; if (!(abortInstance && compiler.compileFunction(abortInstance))) return module.createUnreachable(); var messageArg = message != null diff --git a/src/compiler.ts b/src/compiler.ts index f38cc229..8b01df00 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -32,7 +32,6 @@ import { getConstValueI64High, getConstValueF32, getConstValueF64, - getFunctionBody, getGetLocalIndex, getBlockChildCount, getBlockChild, @@ -404,9 +403,172 @@ export class Compiler extends DiagnosticEmitter { if (!functionTableExported) module.addTableExport("0", "table"); } + // set up module exports + for (let [name, moduleExport] of program.moduleLevelExports) { + this.makeModuleExport(name, moduleExport.element); + } + return module; } + /** Applies the respective module export(s) for the specified element. */ + private makeModuleExport(name: string, element: Element, prefix: string = ""): void { + + // traverse members + var members = element.members; + if (members) { + let subPrefix = prefix + name + (element.kind == ElementKind.CLASS + ? INSTANCE_DELIMITER + : STATIC_DELIMITER + ); + if (element.kind == ElementKind.NAMESPACE) { + for (let member of members.values()) { + if (!member.is(CommonFlags.EXPORT)) continue; + this.makeModuleExport(member.simpleName, member, subPrefix); + } + } else { + for (let member of members.values()) { + if (member.is(CommonFlags.PRIVATE)) continue; + this.makeModuleExport(member.simpleName, member, subPrefix); + } + } + } + + switch (element.kind) { + + // export global + case ElementKind.GLOBAL: { + let isConst = element.is(CommonFlags.CONST) || element.is(CommonFlags.STATIC | CommonFlags.READONLY); + if (!isConst && !this.options.hasFeature(Feature.MUTABLE_GLOBAL)) { + let declaration = (element).declaration; + if (declaration) { + this.error( + DiagnosticCode.Cannot_export_a_mutable_global, + declaration.name.range + ); + } + } else { + this.module.addGlobalExport(element.internalName, prefix + name); + } + break; + } + case ElementKind.ENUMVALUE: { + if (!assert(element.parent).is(CommonFlags.CONST) && !this.options.hasFeature(Feature.MUTABLE_GLOBAL)) { + let declaration = (element).declaration; + if (declaration) { + this.error( + DiagnosticCode.Cannot_export_a_mutable_global, + declaration.name.range + ); + } + } else { + this.module.addGlobalExport(element.internalName, prefix + name); + } + break; + } + + // export function + case ElementKind.FUNCTION: { + let instance = element; + let signature = instance.signature; + if (signature.requiredParameters < signature.parameterTypes.length) { + // utilize trampoline to fill in omitted arguments + instance = this.ensureTrampoline(instance); + this.ensureArgcSet(); + } + if (instance.is(CommonFlags.COMPILED)) this.module.addFunctionExport(instance.internalName, prefix + name); + break; + } + + // export getter and setter + case ElementKind.PROPERTY: { + let getter = assert((element).getterPrototype); + this.makeModuleExport(GETTER_PREFIX + name, getter, prefix); + let setter = (element).setterPrototype; + if (setter) this.makeModuleExport(SETTER_PREFIX + name, setter, prefix); + break; + } + + // export a getter and a setter + case ElementKind.FIELD: { + let module = this.module; + let type = (element).type; + let nativeType = type.toNativeType(); + let offset = (element).memoryOffset; + let usizeType = this.options.usizeType; + let nativeSizeType = this.options.nativeSizeType; + + // make a getter + let getterName = prefix + GETTER_PREFIX + name; + module.addFunction( + getterName, + this.ensureFunctionType(null, type, usizeType), + null, + module.createLoad( + type.byteSize, + type.is(TypeFlags.SIGNED), + module.createGetLocal(0, nativeSizeType), + nativeType, + offset + ) + ); + module.addFunctionExport(getterName, getterName); + + // make a setter + if (!element.is(CommonFlags.READONLY)) { + let setterName = prefix + SETTER_PREFIX + name; + module.addFunction( + setterName, + this.ensureFunctionType([ type ], Type.void, usizeType), + null, + module.createStore( + type.byteSize, + module.createGetLocal(0, nativeSizeType), + module.createGetLocal(1, nativeType), + nativeType, + offset + ) + ); + module.addFunctionExport(setterName, setterName); + } + break; + } + + // skip prototype and export instances + case ElementKind.FUNCTION_PROTOTYPE: { + for (let instance of (element).instances.values()) { + let instanceName = name; + if (instance.is(CommonFlags.GENERIC)) { + let fullName = instance.internalName; + instanceName += fullName.substring(fullName.lastIndexOf("<")); + } + this.makeModuleExport(instanceName, instance, prefix); + } + break; + } + case ElementKind.CLASS_PROTOTYPE: { + for (let instance of (element).instances.values()) { + let instanceName = name; + if (instance.is(CommonFlags.GENERIC)) { + let fullName = instance.internalName; + instanceName += fullName.substring(fullName.lastIndexOf("<")); + } + let ctor = instance.constructorInstance; + if (ctor) this.makeModuleExport(instanceName + INSTANCE_DELIMITER + ctor.simpleName, ctor, prefix); + this.makeModuleExport(instanceName, instance, prefix); + } + break; + } + + // all possible members already handled above + case ElementKind.ENUM: + case ElementKind.CLASS: + case ElementKind.NAMESPACE: break; + + default: assert(false); + } + } + // sources /** Compiles a source by looking it up by path first. */ @@ -568,13 +730,13 @@ export class Compiler extends DiagnosticEmitter { if (global.is(CommonFlags.AMBIENT | CommonFlags.BUILTIN)) return true; var nativeType = global.type.toNativeType(); - var isConstant = global.isAny(CommonFlags.CONST) || global.is(CommonFlags.STATIC | CommonFlags.READONLY); + var isDeclaredConstant = global.is(CommonFlags.CONST) || global.is(CommonFlags.STATIC | CommonFlags.READONLY); // handle imports if (global.is(CommonFlags.AMBIENT)) { // constant global - if (isConstant || this.options.hasFeature(Feature.MUTABLE_GLOBAL)) { + if (isDeclaredConstant || this.options.hasFeature(Feature.MUTABLE_GLOBAL)) { global.set(CommonFlags.MODULE_IMPORT); if (declaration) { mangleImportName(global, declaration, global.parent); @@ -601,49 +763,77 @@ export class Compiler extends DiagnosticEmitter { return false; } - // the MVP does not yet support initializer expressions other than constant values (and + // the MVP does not yet support initializer expressions other than constant values (and constant // get_globals), hence such initializations must be performed in the start function for now. var initializeInStart = false; - // inlined constant can be compiled as-is - if (global.is(CommonFlags.INLINED)) { - initExpr = this.compileInlineConstant(global, global.type, true); + // evaluate initializer if present + if (declaration !== null && declaration.initializer !== null) { + if (!initExpr) { + initExpr = this.compileExpression( + declaration.initializer, + global.type, + ConversionKind.IMPLICIT, + WrapMode.WRAP + ); + } - } else { - - // evaluate initializer if present - if (declaration && declaration.initializer) { - if (!initExpr) { - initExpr = this.compileExpression( - declaration.initializer, - global.type, - ConversionKind.IMPLICIT, - WrapMode.WRAP - ); - } - - // check if the initializer is constant - if (getExpressionId(initExpr) != ExpressionId.Const) { - - // if a constant global, check if the initializer becomes constant after precompute - if (isConstant) { - initExpr = this.precomputeExpressionRef(initExpr); - if (getExpressionId(initExpr) != ExpressionId.Const) { - this.warning( - DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable, - declaration.range - ); - initializeInStart = true; - } - } else { + if (getExpressionId(initExpr) != ExpressionId.Const) { + if (isDeclaredConstant) { + initExpr = module.precomputeExpression(initExpr); + if (getExpressionId(initExpr) != ExpressionId.Const) { + this.warning( + DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable, + declaration.range + ); initializeInStart = true; } + } else { + initializeInStart = true; } - - // initialize to zero if there's no initializer - } else { - initExpr = global.type.toNativeZero(module); } + + // explicitly inline if annotated + if (global.hasDecorator(DecoratorFlags.INLINE)) { + if (!initializeInStart) { // reported above + assert(getExpressionId(initExpr) == ExpressionId.Const); + let exprType = getExpressionType(initExpr); + switch (exprType) { + case NativeType.I32: { + global.constantValueKind = ConstantValueKind.INTEGER; + global.constantIntegerValue = i64_new(getConstValueI32(initExpr), 0); + break; + } + case NativeType.I64: { + global.constantValueKind = ConstantValueKind.INTEGER; + global.constantIntegerValue = i64_new( + getConstValueI64Low(initExpr), + getConstValueI64High(initExpr) + ); + break; + } + case NativeType.F32: { + global.constantValueKind = ConstantValueKind.FLOAT; + global.constantFloatValue = getConstValueF32(initExpr); + break; + } + case NativeType.F64: { + global.constantValueKind = ConstantValueKind.FLOAT; + global.constantFloatValue = getConstValueF64(initExpr); + break; + } + default: { + assert(false); + return false; + } + } + global.set(CommonFlags.INLINED); // inline the value from now on + } + } + + // initialize to zero if there's no initializer + } else { + initExpr = global.type.toNativeZero(module); } var internalName = global.internalName; @@ -652,50 +842,8 @@ export class Compiler extends DiagnosticEmitter { module.addGlobal(internalName, nativeType, true, global.type.toNativeZero(module)); this.startFunctionBody.push(module.createSetGlobal(internalName, initExpr)); - } else { // compile as-is - - if (isConstant) { - let exprType = getExpressionType(initExpr); - switch (exprType) { - case NativeType.I32: { - global.constantValueKind = ConstantValueKind.INTEGER; - global.constantIntegerValue = i64_new(getConstValueI32(initExpr), 0); - break; - } - case NativeType.I64: { - global.constantValueKind = ConstantValueKind.INTEGER; - global.constantIntegerValue = i64_new( - getConstValueI64Low(initExpr), - getConstValueI64High(initExpr) - ); - break; - } - case NativeType.F32: { - global.constantValueKind = ConstantValueKind.FLOAT; - global.constantFloatValue = getConstValueF32(initExpr); - break; - } - case NativeType.F64: { - global.constantValueKind = ConstantValueKind.FLOAT; - global.constantFloatValue = getConstValueF64(initExpr); - break; - } - default: { - assert(false); - return false; - } - } - global.set(CommonFlags.INLINED); // inline the value from now on - if (global.is(CommonFlags.MODULE_EXPORT)) { - module.addGlobal(internalName, nativeType, false, initExpr); - module.addGlobalExport(internalName, mangleExportName(global)); - } else if (declaration && declaration.isTopLevel) { // might become re-exported - module.addGlobal(internalName, nativeType, false, initExpr); - } - - } else /* mutable */ { - module.addGlobal(internalName, nativeType, !isConstant, initExpr); - } + } else { // compile normally + module.addGlobal(internalName, nativeType, !isDeclaredConstant, initExpr); } return true; } @@ -716,6 +864,7 @@ export class Compiler extends DiagnosticEmitter { var module = this.module; this.currentEnum = element; var previousValue: EnumValue | null = null; + var previousValueIsMut = false; if (element.members) { for (let member of element.members.values()) { @@ -724,86 +873,61 @@ export class Compiler extends DiagnosticEmitter { let val = member; let valueDeclaration = val.declaration; val.set(CommonFlags.COMPILED); - if (val.is(CommonFlags.INLINED)) { - if (element.declaration.isTopLevelExport) { - module.addGlobal( - val.internalName, - NativeType.I32, - false, // constant - module.createI32(val.constantValue) - ); - } - } else { - let initExpr: ExpressionRef; - if (valueDeclaration.value) { - initExpr = this.compileExpression( - valueDeclaration.value, - Type.i32, - ConversionKind.IMPLICIT, - WrapMode.NONE - ); - if (getExpressionId(initExpr) != ExpressionId.Const) { - initExpr = this.precomputeExpressionRef(initExpr); + let initExpr: ExpressionRef; + if (valueDeclaration.value) { + initExpr = this.compileExpression( + valueDeclaration.value, + Type.i32, + ConversionKind.IMPLICIT, + WrapMode.NONE + ); + if (getExpressionId(initExpr) != ExpressionId.Const) { + if (element.is(CommonFlags.CONST)) { + initExpr = module.precomputeExpression(initExpr); if (getExpressionId(initExpr) != ExpressionId.Const) { - if (element.is(CommonFlags.CONST)) { - this.warning( - DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable, - valueDeclaration.range - ); - } + this.error( + DiagnosticCode.In_const_enum_declarations_member_initializer_must_be_constant_expression, + valueDeclaration.value.range + ); initInStart = true; } + } else { + initInStart = true; } - } else if (previousValue == null) { - initExpr = module.createI32(0); - } else if (previousValue.is(CommonFlags.INLINED)) { - initExpr = module.createI32(previousValue.constantValue + 1); - } else { - // in TypeScript this errors with TS1061, but actually we can do: - initExpr = module.createBinary(BinaryOp.AddI32, - module.createGetGlobal(previousValue.internalName, NativeType.I32), - module.createI32(1) + } + } else if (previousValue == null) { + initExpr = module.createI32(0); + } else { + if (previousValueIsMut) { + this.error( + DiagnosticCode.Enum_member_must_have_initializer, + valueDeclaration.range ); + } + initExpr = module.createBinary(BinaryOp.AddI32, + module.createGetGlobal(previousValue.internalName, NativeType.I32), + module.createI32(1) + ); + initExpr = module.precomputeExpression(initExpr); + if (getExpressionId(initExpr) != ExpressionId.Const) { if (element.is(CommonFlags.CONST)) { - this.warning( - DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable, + this.error( + DiagnosticCode.In_const_enum_declarations_member_initializer_must_be_constant_expression, valueDeclaration.range ); } initInStart = true; } - if (initInStart) { - module.addGlobal( - val.internalName, - NativeType.I32, - true, // mutable - module.createI32(0) - ); - this.startFunctionBody.push(module.createSetGlobal(val.internalName, initExpr)); - } else { - module.addGlobal(val.internalName, NativeType.I32, false, initExpr); - if (getExpressionType(initExpr) == NativeType.I32) { - val.constantValue = getConstValueI32(initExpr); - val.set(CommonFlags.INLINED); - } else { - assert(false); - val.constantValue = 0; - } - } + } + if (initInStart) { + module.addGlobal(val.internalName, NativeType.I32, true, module.createI32(0)); + this.startFunctionBody.push(module.createSetGlobal(val.internalName, initExpr)); + previousValueIsMut = true; + } else { + module.addGlobal(val.internalName, NativeType.I32, !element.is(CommonFlags.CONST), initExpr); + previousValueIsMut = false; } previousValue = val; - - // export values if the enum is exported - if (element.is(CommonFlags.MODULE_EXPORT)) { - if (member.is(CommonFlags.INLINED) || this.options.hasFeature(Feature.MUTABLE_GLOBAL)) { - module.addGlobalExport(member.internalName, mangleExportName(member)); - } else if (valueDeclaration) { - this.warning( - DiagnosticCode.Cannot_export_a_mutable_global, - valueDeclaration.range - ); - } - } } } this.currentEnum = null; @@ -1015,16 +1139,6 @@ export class Compiler extends DiagnosticEmitter { ); } - // check module-level export - if (instance.is(CommonFlags.MODULE_EXPORT)) { - if (signature.requiredParameters < signature.parameterTypes.length) { - // export the trampoline if the function takes optional parameters - instance = this.ensureTrampoline(instance); - this.ensureArgcSet(); - } - module.addFunctionExport(instance.internalName, mangleExportName(instance)); - } - instance.finalize(module, ref); return true; } @@ -1140,18 +1254,14 @@ export class Compiler extends DiagnosticEmitter { // exports compileExportStatement(statement: ExportStatement): void { - var module = this.module; var fileLevelExports = this.program.fileLevelExports; var members = statement.members; if (!members) return; // filespace for (let i = 0, k = members.length; i < k; ++i) { let member = members[i]; - let internalExportName = ( - statement.range.source.internalPath + - PATH_DELIMITER + - member.externalName.text + let element = fileLevelExports.get( + statement.range.source.internalPath + PATH_DELIMITER + member.externalName.text ); - let element = fileLevelExports.get(internalExportName); if (!element) continue; // reported in Program#initialize switch (element.kind) { case ElementKind.CLASS_PROTOTYPE: { @@ -1169,36 +1279,18 @@ export class Compiler extends DiagnosticEmitter { !(element).is(CommonFlags.GENERIC) && statement.range.source.isEntry ) { - let functionInstance = this.compileFunctionUsingTypeArguments( + this.compileFunctionUsingTypeArguments( element, [], null, // no contextual type arguments null, // no outer scope (element).declaration.name ); - if (functionInstance) { - let functionDeclaration = functionInstance.prototype.declaration; - if (functionDeclaration && functionDeclaration.needsExplicitExport(member)) { - module.addFunctionExport(functionInstance.internalName, member.externalName.text); - } - } } break; } case ElementKind.GLOBAL: { - if (this.compileGlobal(element) && statement.range.source.isEntry) { - let globalDeclaration = (element).declaration; - if (globalDeclaration && globalDeclaration.needsExplicitExport(member)) { - if ((element).is(CommonFlags.INLINED)) { - module.addGlobalExport(element.internalName, member.externalName.text); - } else { - this.warning( - DiagnosticCode.Cannot_export_a_mutable_global, - member.range - ); - } - } - } + this.compileGlobal(element); break; } case ElementKind.NAMESPACE: { @@ -1310,47 +1402,6 @@ export class Compiler extends DiagnosticEmitter { } case ElementKind.FIELD: { element.set(CommonFlags.COMPILED); - if (!instance.is(CommonFlags.MODULE_EXPORT) || element.is(CommonFlags.PRIVATE)) break; - let module = this.module; - let name = (element).simpleName; - let type = (element).type; - let nativeType = type.toNativeType(); - let offset = (element).memoryOffset; - let usizeType = this.options.usizeType; - let nativeSizeType = this.options.nativeSizeType; - - // export an implicit getter: get:fieldName(this: usize) -> fieldType - let getterName = mangleExportName(element, GETTER_PREFIX + name); - module.addFunction( - getterName, - this.ensureFunctionType(null, type, usizeType), - null, - module.createLoad( - type.byteSize, - type.is(TypeFlags.SIGNED), - module.createGetLocal(0, nativeSizeType), - nativeType, - offset - ) - ); - module.addFunctionExport(getterName, getterName); - - // export an implicit setter: set:fieldName(this: usize, value: fieldType) -> void - if (element.is(CommonFlags.READONLY)) break; - let setterName = mangleExportName(element, SETTER_PREFIX + name); - module.addFunction( - setterName, - this.ensureFunctionType([ type ], Type.void, usizeType), - null, - module.createStore( - type.byteSize, - module.createGetLocal(0, nativeSizeType), - module.createGetLocal(1, nativeType), - nativeType, - offset - ) - ); - module.addFunctionExport(setterName, setterName); break; } case ElementKind.PROPERTY: { @@ -1676,7 +1727,7 @@ export class Compiler extends DiagnosticEmitter { this.currentType ); // check if the condition is always true - let condPre = this.precomputeExpressionRef(condExpr); + let condPre = module.precomputeExpression(condExpr); if (getExpressionId(condPre) == ExpressionId.Const) { assert(getExpressionType(condPre) == NativeType.I32); if (getConstValueI32(condPre) != 0) alwaysTrue = true; @@ -1766,7 +1817,7 @@ export class Compiler extends DiagnosticEmitter { this.currentFunction.isAny(CommonFlags.GENERIC | CommonFlags.GENERIC_CONTEXT) ) { // Try to eliminate unnecesssary branches if the condition is constant - let condExprPrecomp = this.precomputeExpressionRef(condExpr); + let condExprPrecomp = module.precomputeExpression(condExpr); if ( getExpressionId(condExprPrecomp) == ExpressionId.Const && getExpressionType(condExprPrecomp) == NativeType.I32 @@ -2057,7 +2108,7 @@ export class Compiler extends DiagnosticEmitter { let isInlined = false; if (declaration.is(CommonFlags.CONST)) { if (initExpr) { - initExpr = this.precomputeExpressionRef(initExpr); + initExpr = this.module.precomputeExpression(initExpr); if (getExpressionId(initExpr) == ExpressionId.Const) { let local = new Local(program, name, -1, type); switch (getExpressionType(initExpr)) { @@ -2162,7 +2213,7 @@ export class Compiler extends DiagnosticEmitter { this.currentFunction.isAny(CommonFlags.GENERIC | CommonFlags.GENERIC_CONTEXT) ) { // Try to eliminate unnecesssary loops if the condition is constant - let condExprPrecomp = this.precomputeExpressionRef(condExpr); + let condExprPrecomp = module.precomputeExpression(condExpr); if ( getExpressionId(condExprPrecomp) == ExpressionId.Const && getExpressionType(condExprPrecomp) == NativeType.I32 @@ -2432,22 +2483,11 @@ export class Compiler extends DiagnosticEmitter { conversionKind: ConversionKind, wrapMode: WrapMode ): ExpressionRef { - return this.precomputeExpressionRef( + return this.module.precomputeExpression( this.compileExpression(expression, contextualType, conversionKind, wrapMode) ); } - precomputeExpressionRef(expr: ExpressionRef): ExpressionRef { - var module = this.module; - var type = this.currentType; - var nativeType = type.toNativeType(); - var funcRef = module.addTemporaryFunction(nativeType, null, expr); - module.runPasses([ "precompute" ], funcRef); - var ret = getFunctionBody(funcRef); - module.removeTemporaryFunction(); - return ret; - } - convertExpression( expr: ExpressionRef, fromType: Type, @@ -5497,8 +5537,8 @@ export class Compiler extends DiagnosticEmitter { names[i] = label; } var body = module.createBlock(names[0], [ - module.createBlock("oob", [ - module.createSwitch(names, "oob", + module.createBlock("outOfRange", [ + module.createSwitch(names, "outOfRange", // condition is number of provided optional arguments, so subtract required arguments minArguments ? module.createBinary( @@ -5946,10 +5986,11 @@ export class Compiler extends DiagnosticEmitter { switch (target.kind) { case ElementKind.LOCAL: { + let localType = (target).type; + assert(localType != Type.void); if ((target).is(CommonFlags.INLINED)) { return this.compileInlineConstant(target, contextualType, retainConstantType); } - let localType = (target).type; let localIndex = (target).index; assert(localIndex >= 0); this.currentType = localType; @@ -6252,7 +6293,7 @@ export class Compiler extends DiagnosticEmitter { ? this.compileExpression(expressions[i], elementType, ConversionKind.IMPLICIT, WrapMode.NONE) : elementType.toNativeZero(module); if (isStatic) { - expr = this.precomputeExpressionRef(exprs[i]); + expr = module.precomputeExpression(exprs[i]); if (getExpressionId(expr) == ExpressionId.Const) { assert(getExpressionType(expr) == nativeElementType); switch (nativeElementType) { @@ -6601,6 +6642,7 @@ export class Compiler extends DiagnosticEmitter { let parent = (target).parent; assert(parent !== null && parent.kind == ElementKind.ENUM); if (!this.compileEnum(parent)) { + this.currentType = Type.i32; return this.module.createUnreachable(); } this.currentType = Type.i32; @@ -6688,7 +6730,7 @@ export class Compiler extends DiagnosticEmitter { this.currentFunction.isAny(CommonFlags.GENERIC | CommonFlags.GENERIC_CONTEXT) ) { // Try to eliminate unnecesssary branches if the condition is constant - let condExprPrecomp = this.precomputeExpressionRef(condExpr); + let condExprPrecomp = this.module.precomputeExpression(condExpr); if ( getExpressionId(condExprPrecomp) == ExpressionId.Const && getExpressionType(condExprPrecomp) == NativeType.I32 @@ -7536,47 +7578,6 @@ export class Compiler extends DiagnosticEmitter { // helpers -function mangleExportName(element: Element, simpleName: string = element.simpleName): string { - switch (element.kind) { - case ElementKind.FUNCTION: { - let parent = (element).parent || (element).prototype.parent; - return parent - ? mangleExportName(parent) - + (element.is(CommonFlags.INSTANCE) ? INSTANCE_DELIMITER : STATIC_DELIMITER) - + simpleName - : simpleName; - } - case ElementKind.FIELD: { - let parent = assert((element).parent); - return mangleExportName(parent) - + (element.is(CommonFlags.INSTANCE) ? INSTANCE_DELIMITER : STATIC_DELIMITER) - + simpleName; - } - case ElementKind.ENUMVALUE: { - let parent = assert((element).parent); - return mangleExportName(parent) - + (element.is(CommonFlags.INSTANCE) ? INSTANCE_DELIMITER : STATIC_DELIMITER) - + simpleName; - } - case ElementKind.CLASS: { - let parent = (element).prototype.parent; - return parent - ? mangleExportName(parent) - + STATIC_DELIMITER - + simpleName - : simpleName; - } - default: { - let parent = element.parent; - return parent - ? mangleExportName(parent) - + STATIC_DELIMITER - + simpleName - : simpleName; - } - } -} - function mangleImportName( element: Element, declaration: DeclarationStatement, diff --git a/src/decompiler.ts b/src/decompiler.ts index e0c5bb2a..044aedc0 100644 --- a/src/decompiler.ts +++ b/src/decompiler.ts @@ -834,11 +834,11 @@ export class Decompiler { case ExpressionId.Host: { switch (getHostOp(expr)) { case HostOp.CurrentMemory: { - this.push("current_memory()"); + this.push("memory.size()"); return; } case HostOp.GrowMemory: { - this.push("grow_memory("); + this.push("memory.grow("); this.decompileExpression(getHostOperand(expr, 0)); this.push(")"); return; diff --git a/src/definitions.ts b/src/definitions.ts index 02091e01..593fc058 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -54,7 +54,10 @@ abstract class ExportsWalker { /** Walks all exports and calls the respective handlers. */ walk(): void { - for (let element of this.program.moduleLevelExports.values()) this.visitElement(element); + for (let moduleExport of this.program.moduleLevelExports.values()) { + // FIXME: doesn't honor the actual externally visible name + this.visitElement(moduleExport.element); + } var todo = this.todo; for (let i = 0; i < todo.length; ) this.visitElement(todo[i]); } diff --git a/src/diagnosticMessages.generated.ts b/src/diagnosticMessages.generated.ts index 66cb654d..a9672b63 100644 --- a/src/diagnosticMessages.generated.ts +++ b/src/diagnosticMessages.generated.ts @@ -9,6 +9,7 @@ export enum DiagnosticCode { Operation_not_supported = 100, Operation_is_unsafe = 101, + User_defined_0 = 102, Conversion_from_type_0_to_1_requires_an_explicit_cast = 200, Conversion_from_type_0_to_1_will_require_an_explicit_cast_when_switching_between_32_64_bit = 201, Type_0_cannot_be_changed_to_type_1 = 202, @@ -36,7 +37,6 @@ export enum DiagnosticCode { A_rest_parameter_must_be_last_in_a_parameter_list = 1014, Parameter_cannot_have_question_mark_and_initializer = 1015, A_required_parameter_cannot_follow_an_optional_parameter = 1016, - Enum_member_must_have_initializer = 1061, Statements_are_not_allowed_in_ambient_contexts = 1036, Initializers_are_not_allowed_in_ambient_contexts = 1039, _0_modifier_cannot_be_used_here = 1042, @@ -45,6 +45,7 @@ export enum DiagnosticCode { A_set_accessor_must_have_exactly_one_parameter = 1049, A_set_accessor_parameter_cannot_have_an_initializer = 1052, A_get_accessor_cannot_have_parameters = 1054, + Enum_member_must_have_initializer = 1061, Type_parameters_cannot_appear_on_a_constructor_declaration = 1092, Type_annotation_cannot_appear_on_a_constructor_declaration = 1093, An_accessor_cannot_have_type_parameters = 1094, @@ -105,6 +106,7 @@ export enum DiagnosticCode { Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local = 2395, Type_0_has_no_property_1 = 2460, The_0_operator_cannot_be_applied_to_type_1 = 2469, + In_const_enum_declarations_member_initializer_must_be_constant_expression = 2474, Export_declaration_conflicts_with_exported_declaration_of_0 = 2484, Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property = 2540, The_target_of_an_assignment_must_be_a_variable_or_a_property_access = 2541, @@ -126,6 +128,7 @@ export function diagnosticCodeToString(code: DiagnosticCode): string { switch (code) { case 100: return "Operation not supported."; case 101: return "Operation is unsafe."; + case 102: return "User-defined: {0}"; case 200: return "Conversion from type '{0}' to '{1}' requires an explicit cast."; case 201: return "Conversion from type '{0}' to '{1}' will require an explicit cast when switching between 32/64-bit."; case 202: return "Type '{0}' cannot be changed to type '{1}'."; @@ -153,7 +156,6 @@ export function diagnosticCodeToString(code: DiagnosticCode): string { case 1014: return "A rest parameter must be last in a parameter list."; case 1015: return "Parameter cannot have question mark and initializer."; case 1016: return "A required parameter cannot follow an optional parameter."; - case 1061: return "Enum member must have initializer."; case 1036: return "Statements are not allowed in ambient contexts."; case 1039: return "Initializers are not allowed in ambient contexts."; case 1042: return "'{0}' modifier cannot be used here."; @@ -162,6 +164,7 @@ export function diagnosticCodeToString(code: DiagnosticCode): string { case 1049: return "A 'set' accessor must have exactly one parameter."; case 1052: return "A 'set' accessor parameter cannot have an initializer."; case 1054: return "A 'get' accessor cannot have parameters."; + case 1061: return "Enum member must have initializer."; case 1092: return "Type parameters cannot appear on a constructor declaration."; case 1093: return "Type annotation cannot appear on a constructor declaration."; case 1094: return "An accessor cannot have type parameters."; @@ -222,6 +225,7 @@ export function diagnosticCodeToString(code: DiagnosticCode): string { case 2395: return "Individual declarations in merged declaration '{0}' must be all exported or all local."; case 2460: return "Type '{0}' has no property '{1}'."; case 2469: return "The '{0}' operator cannot be applied to type '{1}'."; + case 2474: return "In 'const' enum declarations member initializer must be constant expression."; case 2484: return "Export declaration conflicts with exported declaration of '{0}'."; case 2540: return "Cannot assign to '{0}' because it is a constant or a read-only property."; case 2541: return "The target of an assignment must be a variable or a property access."; diff --git a/src/diagnosticMessages.json b/src/diagnosticMessages.json index 26f18e3a..fca90852 100644 --- a/src/diagnosticMessages.json +++ b/src/diagnosticMessages.json @@ -1,6 +1,7 @@ { "Operation not supported.": 100, "Operation is unsafe.": 101, + "User-defined: {0}": 102, "Conversion from type '{0}' to '{1}' requires an explicit cast.": 200, "Conversion from type '{0}' to '{1}' will require an explicit cast when switching between 32/64-bit.": 201, "Type '{0}' cannot be changed to type '{1}'.": 202, @@ -29,7 +30,6 @@ "A rest parameter must be last in a parameter list.": 1014, "Parameter cannot have question mark and initializer.": 1015, "A required parameter cannot follow an optional parameter.": 1016, - "Enum member must have initializer.": 1061, "Statements are not allowed in ambient contexts.": 1036, "Initializers are not allowed in ambient contexts.": 1039, "'{0}' modifier cannot be used here.": 1042, @@ -38,6 +38,7 @@ "A 'set' accessor must have exactly one parameter.": 1049, "A 'set' accessor parameter cannot have an initializer.": 1052, "A 'get' accessor cannot have parameters.": 1054, + "Enum member must have initializer.": 1061, "Type parameters cannot appear on a constructor declaration.": 1092, "Type annotation cannot appear on a constructor declaration.": 1093, "An accessor cannot have type parameters.": 1094, @@ -99,6 +100,7 @@ "Individual declarations in merged declaration '{0}' must be all exported or all local.": 2395, "Type '{0}' has no property '{1}'.": 2460, "The '{0}' operator cannot be applied to type '{1}'.": 2469, + "In 'const' enum declarations member initializer must be constant expression.": 2474, "Export declaration conflicts with exported declaration of '{0}'.": 2484, "Cannot assign to '{0}' because it is a constant or a read-only property.": 2540, "The target of an assignment must be a variable or a property access.": 2541, diff --git a/src/glue/js/binaryen.d.ts b/src/glue/js/binaryen.d.ts index 3909bf78..f56f249c 100644 --- a/src/glue/js/binaryen.d.ts +++ b/src/glue/js/binaryen.d.ts @@ -2,5 +2,10 @@ /// -declare function allocate_memory(size: usize): usize; -declare function free_memory(ptr: usize): void; +declare namespace binaryen { + class Module { + constructor(ref: number); + emitText(): string; + emitAsmjs(): string; + } +} diff --git a/src/glue/js/binaryen.js b/src/glue/js/binaryen.js index ae009be9..d3083b7e 100644 --- a/src/glue/js/binaryen.js +++ b/src/glue/js/binaryen.js @@ -1,42 +1,16 @@ // Copy Binaryen exports to global scope const binaryen = global.Binaryen || require("binaryen"); +global.binaryen = binaryen; -for (var key in binaryen) - if (key.startsWith("_Binaryen") || key.startsWith("_Relooper")) - global[key] = binaryen[key]; +for (var key in binaryen) { + if (key.startsWith("_Binaryen") || key.startsWith("_Relooper")) global[key] = binaryen[key]; +} // Utilize Binaryen's heap -global.allocate_memory = function(size) { - if (!size) return 0; // should be safe in our case - return binaryen._malloc(size); -}; - -global.free_memory = function(ptr) { - if (ptr) binaryen._free(ptr); -}; - -global.move_memory = function(dest, src, n) { - return binaryen._memmove(dest, src, n); -}; - -global.store = function(ptr, val) { - binaryen.HEAPU8[ptr] = val; -}; - -global.load = function(ptr) { - return binaryen.HEAPU8[ptr]; -}; - -// Implement module stubs - -const Module = require("../../module").Module; - -Module.prototype.toText = function() { - return new binaryen.Module(this.ref).emitText(); -}; - -Module.prototype.toAsmjs = function() { - return new binaryen.Module(this.ref).emitAsmjs(); -}; +global.__memory_allocate = binaryen._malloc; +global.__memory_free = binaryen._free; +global.__memory_copy = binaryen._memmove; +global.__store = function(ptr, val) { binaryen.HEAPU8[ptr] = val; }; +global.__load = function(ptr) { return binaryen.HEAPU8[ptr]; }; diff --git a/src/glue/js/index.ts b/src/glue/js/index.ts index b6c95550..f2276c47 100644 --- a/src/glue/js/index.ts +++ b/src/glue/js/index.ts @@ -6,7 +6,17 @@ /// +import "./binaryen"; // must be first so portable can pick up the memory implementation import "../../../std/portable/index"; -import "./binaryen"; import "./float"; import "./i64"; + +import { Module } from "../../module"; + +Module.prototype.toText = function(this: Module) { + return new binaryen.Module(this.ref).emitText(); +}; + +Module.prototype.toAsmjs = function(this: Module) { + return new binaryen.Module(this.ref).emitAsmjs(); +}; diff --git a/src/module.ts b/src/module.ts index dbe6977e..ec8a4521 100644 --- a/src/module.ts +++ b/src/module.ts @@ -251,7 +251,7 @@ export class Module { static create(): Module { var module = new Module(); module.ref = _BinaryenModuleCreate(); - module.cachedByValue = allocate_memory(16); + module.cachedByValue = memory.allocate(16); return module; } @@ -260,10 +260,10 @@ export class Module { try { let module = new Module(); module.ref = _BinaryenModuleRead(cArr, buffer.length); - module.cachedByValue = allocate_memory(3 * 8); // LLVM C-ABI, max used is 3 * usize + module.cachedByValue = memory.allocate(3 * 8); // LLVM C-ABI, max used is 3 * usize return module; } finally { - free_memory(changetype(cArr)); + memory.free(changetype(cArr)); } } @@ -281,8 +281,8 @@ export class Module { try { return _BinaryenAddFunctionType(this.ref, cStr, result, cArr, paramTypes ? paramTypes.length : 0); } finally { - free_memory(cArr); - free_memory(cStr); + memory.free(cArr); + memory.free(cStr); } } @@ -294,7 +294,7 @@ export class Module { try { return _BinaryenGetFunctionTypeBySignature(this.ref, result, cArr, paramTypes ? paramTypes.length : 0); } finally { - free_memory(cArr); + memory.free(cArr); } } @@ -303,7 +303,7 @@ export class Module { try { _BinaryenRemoveFunctionType(this.ref, cStr); } finally { - free_memory(cStr); + memory.free(cStr); } } @@ -360,8 +360,8 @@ export class Module { try { return _BinaryenHost(this.ref, op, cStr, cArr, operands ? (operands).length : 0); } finally { - free_memory(cArr); - free_memory(cStr); + memory.free(cArr); + memory.free(cStr); } } @@ -387,7 +387,7 @@ export class Module { try { return _BinaryenGetGlobal(this.ref, cStr, type); } finally { - free_memory(cStr); + memory.free(cStr); } } @@ -485,7 +485,7 @@ export class Module { try { return _BinaryenSetGlobal(this.ref, cStr, value); } finally { - free_memory(cStr); + memory.free(cStr); } } @@ -499,8 +499,8 @@ export class Module { try { return _BinaryenBlock(this.ref, cStr, cArr, children.length, type); } finally { - free_memory(cArr); - free_memory(cStr); + memory.free(cArr); + memory.free(cStr); } } @@ -513,7 +513,7 @@ export class Module { try { return _BinaryenBreak(this.ref, cStr, condition, value); } finally { - free_memory(cStr); + memory.free(cStr); } } @@ -531,7 +531,7 @@ export class Module { try { return _BinaryenLoop(this.ref, cStr, body); } finally { - free_memory(cStr); + memory.free(cStr); } } @@ -577,9 +577,9 @@ export class Module { try { return _BinaryenSwitch(this.ref, cArr, numNames, cStr, condition, value); } finally { - free_memory(cStr); - free_memory(cArr); - for (let i = numNames - 1; i >= 0; --i) free_memory(strs[i]); + memory.free(cStr); + memory.free(cArr); + for (let i = numNames - 1; i >= 0; --i) memory.free(strs[i]); } } @@ -593,8 +593,8 @@ export class Module { try { return _BinaryenCall(this.ref, cStr, cArr, operands && operands.length || 0, returnType); } finally { - free_memory(cArr); - free_memory(cStr); + memory.free(cArr); + memory.free(cStr); } } @@ -608,8 +608,8 @@ export class Module { try { return _BinaryenCallImport(this.ref, cStr, cArr, operands && operands.length || 0, returnType); } finally { - free_memory(cArr); - free_memory(cStr); + memory.free(cArr); + memory.free(cStr); } } @@ -623,8 +623,8 @@ export class Module { try { return _BinaryenCallIndirect(this.ref, index, cArr, operands && operands.length || 0, cStr); } finally { - free_memory(cStr); - free_memory(cArr); + memory.free(cStr); + memory.free(cArr); } } @@ -644,7 +644,7 @@ export class Module { try { return _BinaryenAddGlobal(this.ref, cStr, type, mutable ? 1 : 0, initializer); } finally { - free_memory(cStr); + memory.free(cStr); } } @@ -659,8 +659,8 @@ export class Module { try { return _BinaryenAddFunction(this.ref, cStr, type, cArr, varTypes ? varTypes.length : 0, body); } finally { - free_memory(cArr); - free_memory(cStr); + memory.free(cArr); + memory.free(cStr); } } @@ -669,7 +669,7 @@ export class Module { try { _BinaryenRemoveFunction(this.ref, cStr); } finally { - free_memory(cStr); + memory.free(cStr); } } @@ -685,7 +685,7 @@ export class Module { let typeRef = _BinaryenAddFunctionType(this.ref, tempName, result, cArr, paramTypes ? paramTypes.length : 0); return _BinaryenAddFunction(this.ref, tempName, typeRef, 0, 0, body); } finally { - free_memory(cArr); + memory.free(cArr); } } @@ -705,8 +705,8 @@ export class Module { try { return _BinaryenAddFunctionExport(this.ref, cStr1, cStr2); } finally { - free_memory(cStr2); - free_memory(cStr1); + memory.free(cStr2); + memory.free(cStr1); } } @@ -719,8 +719,8 @@ export class Module { try { return _BinaryenAddTableExport(this.ref, cStr1, cStr2); } finally { - free_memory(cStr2); - free_memory(cStr1); + memory.free(cStr2); + memory.free(cStr1); } } @@ -733,8 +733,8 @@ export class Module { try { return _BinaryenAddMemoryExport(this.ref, cStr1, cStr2); } finally { - free_memory(cStr2); - free_memory(cStr1); + memory.free(cStr2); + memory.free(cStr1); } } @@ -747,8 +747,8 @@ export class Module { try { return _BinaryenAddGlobalExport(this.ref, cStr1, cStr2); } finally { - free_memory(cStr2); - free_memory(cStr1); + memory.free(cStr2); + memory.free(cStr1); } } @@ -757,7 +757,7 @@ export class Module { try { _BinaryenRemoveExport(this.ref, cStr); } finally { - free_memory(cStr); + memory.free(cStr); } } @@ -773,9 +773,9 @@ export class Module { try { return _BinaryenAddFunctionImport(this.ref, cStr1, cStr2, cStr3, functionType); } finally { - free_memory(cStr3); - free_memory(cStr2); - free_memory(cStr1); + memory.free(cStr3); + memory.free(cStr2); + memory.free(cStr1); } } @@ -790,9 +790,9 @@ export class Module { try { return _BinaryenAddTableImport(this.ref, cStr1, cStr2, cStr3); } finally { - free_memory(cStr3); - free_memory(cStr2); - free_memory(cStr1); + memory.free(cStr3); + memory.free(cStr2); + memory.free(cStr1); } } @@ -807,9 +807,9 @@ export class Module { try { return _BinaryenAddMemoryImport(this.ref, cStr1, cStr2, cStr3); } finally { - free_memory(cStr3); - free_memory(cStr2); - free_memory(cStr1); + memory.free(cStr3); + memory.free(cStr2); + memory.free(cStr1); } } @@ -825,9 +825,9 @@ export class Module { try { return _BinaryenAddGlobalImport(this.ref, cStr1, cStr2, cStr3, globalType); } finally { - free_memory(cStr3); - free_memory(cStr2); - free_memory(cStr1); + memory.free(cStr3); + memory.free(cStr2); + memory.free(cStr1); } } @@ -836,7 +836,7 @@ export class Module { try { _BinaryenRemoveImport(this.ref, cStr); } finally { - free_memory(cStr); + memory.free(cStr); } } @@ -867,11 +867,11 @@ export class Module { try { _BinaryenSetMemory(this.ref, initial, maximum, cStr, cArr1, cArr2, cArr3, k); } finally { - free_memory(cArr3); - free_memory(cArr2); - free_memory(cArr1); - for (let i = k - 1; i >= 0; --i) free_memory(segs[i]); - free_memory(cStr); + memory.free(cArr3); + memory.free(cArr2); + memory.free(cArr1); + for (let i = k - 1; i >= 0; --i) memory.free(segs[i]); + memory.free(cStr); } } @@ -880,7 +880,7 @@ export class Module { try { _BinaryenSetFunctionTable(this.ref, cArr, funcs.length); } finally { - free_memory(cArr); + memory.free(cArr); } } @@ -888,10 +888,18 @@ export class Module { _BinaryenSetStart(this.ref, func); } + getOptimizeLevel(): i32 { + return _BinaryenGetOptimizeLevel(); + } + setOptimizeLevel(level: i32 = 2): void { _BinaryenSetOptimizeLevel(level); } + getShrinkLevel(): i32 { + return _BinaryenGetShrinkLevel(); + } + setShrinkLevel(level: i32 = 1): void { _BinaryenSetShrinkLevel(level); } @@ -922,17 +930,26 @@ export class Module { _BinaryenModuleRunPasses(this.ref, cArr, numNames); } } finally { - free_memory(cArr); - for (let i = numNames; i >= 0; --i) { - free_memory(names[i]); - } + memory.free(cArr); + for (let i = numNames; i >= 0; --i) memory.free(names[i]); } } - private cachedPrecomputeName: usize = 0; + private cachedPrecomputeName: usize = 0; // for free'ing private cachedPrecomputeNames: usize = 0; - precomputeFunction(func: FunctionRef): void { + precomputeExpression(expr: ExpressionRef): ExpressionRef { + // remember the previous optimize levels and set to max instead, to be sure + var previousOptimizeLevel = _BinaryenGetOptimizeLevel(); + var previousShrinkLevel = _BinaryenGetShrinkLevel(); + var previousDebugInfo = _BinaryenGetDebugInfo(); + _BinaryenSetOptimizeLevel(4); + _BinaryenSetShrinkLevel(0); + _BinaryenSetDebugInfo(false); + + // wrap the expression in a temp. function and run the precompute pass on it + var type = _BinaryenExpressionGetType(expr); + var func = this.addTemporaryFunction(type, null, expr); var names = this.cachedPrecomputeNames; if (!names) { let name = allocString("precompute"); @@ -940,6 +957,14 @@ export class Module { this.cachedPrecomputeNames = names = allocI32Array([ name ]); } _BinaryenFunctionRunPasses(func, this.ref, names, 1); + expr = _BinaryenFunctionGetBody(func); + this.removeTemporaryFunction(); + + // reset optimize levels to previous + _BinaryenSetOptimizeLevel(previousOptimizeLevel); + _BinaryenSetShrinkLevel(previousShrinkLevel); + _BinaryenSetDebugInfo(previousDebugInfo); + return expr; } validate(): bool { @@ -965,9 +990,9 @@ export class Module { ret.sourceMap = readString(sourceMapPtr); return ret; } finally { - if (cStr) free_memory(cStr); - if (binaryPtr) free_memory(binaryPtr); - if (sourceMapPtr) free_memory(sourceMapPtr); + if (cStr) memory.free(cStr); + if (binaryPtr) memory.free(binaryPtr); + if (sourceMapPtr) memory.free(sourceMapPtr); } } @@ -981,10 +1006,10 @@ export class Module { dispose(): void { assert(this.ref); - free_memory(this.cachedByValue); - free_memory(this.cachedTemporaryName); - free_memory(this.cachedPrecomputeName); - free_memory(this.cachedPrecomputeNames); + memory.free(this.cachedByValue); + memory.free(this.cachedTemporaryName); + memory.free(this.cachedPrecomputeName); + memory.free(this.cachedPrecomputeNames); _BinaryenModuleDispose(this.ref); this.ref = 0; } @@ -1086,7 +1111,7 @@ export class Module { try { return _BinaryenModuleAddDebugInfoFileName(this.ref, cStr); } finally { - free_memory(cStr); + memory.free(cStr); } } @@ -1336,7 +1361,7 @@ export class Relooper { try { _RelooperAddBranchForSwitch(from, to, cArr, indexes.length, code); } finally { - free_memory(cArr); + memory.free(cArr); } } @@ -1390,7 +1415,7 @@ export class Relooper { function allocU8Array(u8s: Uint8Array | null): usize { if (!u8s) return 0; var numValues = u8s.length; - var ptr = allocate_memory(numValues); + var ptr = memory.allocate(numValues); var idx = ptr; for (let i = 0; i < numValues; ++i) { store(idx++, u8s[i]); @@ -1400,7 +1425,7 @@ function allocU8Array(u8s: Uint8Array | null): usize { function allocI32Array(i32s: i32[] | null): usize { if (!i32s) return 0; - var ptr = allocate_memory(i32s.length << 2); + var ptr = memory.allocate(i32s.length << 2); var idx = ptr; for (let i = 0, k = i32s.length; i < k; ++i) { let val = i32s[i]; @@ -1444,7 +1469,7 @@ function stringLengthUTF8(str: string): usize { function allocString(str: string | null): usize { if (str == null) return 0; - var ptr = allocate_memory(stringLengthUTF8(str) + 1); + var ptr = memory.allocate(stringLengthUTF8(str) + 1); // the following is based on Emscripten's stringToUTF8Array var idx = ptr; for (let i = 0, k = str.length; i < k; ++i) { diff --git a/src/program.ts b/src/program.ts index b967b77b..249a0d92 100644 --- a/src/program.ts +++ b/src/program.ts @@ -132,6 +132,12 @@ class TypeAlias { type: CommonTypeNode; } +/** Represents a module-level export. */ +class ModuleExport { + element: Element; + identifier: IdentifierExpression; +} + /** Represents the kind of an operator overload. */ export enum OperatorKind { INVALID, @@ -319,7 +325,7 @@ export class Program extends DiagnosticEmitter { /** File-level exports by exported name. */ fileLevelExports: Map = new Map(); /** Module-level exports by exported name. */ - moduleLevelExports: Map = new Map(); + moduleLevelExports: Map = new Map(); /** Array prototype reference. */ arrayPrototype: ClassPrototype | null = null; @@ -329,6 +335,10 @@ export class Program extends DiagnosticEmitter { startFunction: FunctionPrototype; /** Main function reference, if present. */ mainFunction: FunctionPrototype | null = null; + /** Abort function reference, if present. */ + abortInstance: Function | null = null; + /** Memory allocation function. */ + memoryAllocateInstance: Function | null = null; /** Currently processing filespace. */ currentFilespace: Filespace; @@ -569,52 +579,54 @@ export class Program extends DiagnosticEmitter { } // set up global aliases - var globalAliases = options.globalAliases; - if (globalAliases) { - for (let [alias, name] of globalAliases) { - if (!name.length) continue; // explicitly disabled - let element = this.elementsLookup.get(name); - if (element) this.elementsLookup.set(alias, element); - else throw new Error("element not found: " + name); + { + let globalAliases = options.globalAliases; + if (globalAliases) { + for (let [alias, name] of globalAliases) { + if (!name.length) continue; // explicitly disabled + let element = this.elementsLookup.get(name); + if (element) this.elementsLookup.set(alias, element); + else throw new Error("element not found: " + name); + } } } // register 'Array' - var arrayPrototype = this.elementsLookup.get("Array"); - if (arrayPrototype) { - assert(arrayPrototype.kind == ElementKind.CLASS_PROTOTYPE); - this.arrayPrototype = arrayPrototype; + if (this.elementsLookup.has("Array")) { + let element = assert(this.elementsLookup.get("Array")); + assert(element.kind == ElementKind.CLASS_PROTOTYPE); + this.arrayPrototype = element; } // register 'String' - var stringPrototype = this.elementsLookup.get("String"); - if (stringPrototype) { - assert(stringPrototype.kind == ElementKind.CLASS_PROTOTYPE); - let stringInstance = resolver.resolveClass(stringPrototype, null); - if (stringInstance) { + if (this.elementsLookup.has("String")) { + let element = assert(this.elementsLookup.get("String")); + assert(element.kind == ElementKind.CLASS_PROTOTYPE); + let instance = resolver.resolveClass(element, null); + if (instance) { if (this.typesLookup.has("string")) { - let declaration = (stringPrototype).declaration; + let declaration = (element).declaration; this.error( DiagnosticCode.Duplicate_identifier_0, declaration.name.range, declaration.programLevelInternalName ); } else { - this.stringInstance = stringInstance; - this.typesLookup.set("string", stringInstance.type); + this.stringInstance = instance; + this.typesLookup.set("string", instance.type); } } } // register 'start' { - let element = assert(this.elementsLookup.get("start")); + let element = assert(this.elementsLookup.get("start")); assert(element.kind == ElementKind.FUNCTION_PROTOTYPE); this.startFunction = element; } // register 'main' if present - if (this.moduleLevelExports.has("main")) { - let element = this.moduleLevelExports.get("main"); + if (this.elementsLookup.has("main")) { + let element = this.elementsLookup.get("main"); if ( element.kind == ElementKind.FUNCTION_PROTOTYPE && !(element).isAny(CommonFlags.GENERIC | CommonFlags.AMBIENT) @@ -623,6 +635,28 @@ export class Program extends DiagnosticEmitter { this.mainFunction = element; } } + + // register 'abort' if present + if (this.elementsLookup.has("abort")) { + let element = this.elementsLookup.get("abort"); + assert(element.kind == ElementKind.FUNCTION_PROTOTYPE); + let instance = this.resolver.resolveFunction(element, null); + if (instance) this.abortInstance = instance; + } + + // register 'memory.allocate' if present + if (this.elementsLookup.has("memory")) { + let element = this.elementsLookup.get("memory"); + let members = element.members; + if (members) { + if (members.has("allocate")) { + element = assert(members.get("allocate")); + assert(element.kind == ElementKind.FUNCTION_PROTOTYPE); + let instance = this.resolver.resolveFunction(element, null); + if (instance) this.memoryAllocateInstance = instance; + } + } + } } /** Sets a constant integer value. */ @@ -824,14 +858,18 @@ export class Program extends DiagnosticEmitter { this.currentFilespace.members.set(simpleName, prototype); if (prototype.is(CommonFlags.EXPORT) && declaration.range.source.isEntry) { if (this.moduleLevelExports.has(simpleName)) { + let existingExport = this.moduleLevelExports.get(simpleName); this.error( DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0, - declaration.name.range, (this.moduleLevelExports.get(simpleName)).internalName + declaration.name.range, existingExport.element.internalName ); return; } prototype.set(CommonFlags.MODULE_EXPORT); - this.moduleLevelExports.set(simpleName, prototype); + this.moduleLevelExports.set(simpleName, { + element: prototype, + identifier: declaration.name + }); } } @@ -1269,14 +1307,18 @@ export class Program extends DiagnosticEmitter { this.currentFilespace.members.set(simpleName, element); if (declaration.range.source.isEntry) { if (this.moduleLevelExports.has(simpleName)) { + let existingExport = this.moduleLevelExports.get(simpleName); this.error( DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0, - declaration.name.range, (this.moduleLevelExports.get(simpleName)).internalName + declaration.name.range, existingExport.element.internalName ); return; } element.set(CommonFlags.MODULE_EXPORT); - this.moduleLevelExports.set(simpleName, element); + this.moduleLevelExports.set(simpleName, { + element, + identifier: declaration.name + }); } } @@ -1332,31 +1374,39 @@ export class Program extends DiagnosticEmitter { private setExportAndCheckLibrary( internalName: string, element: Element, - identifier: IdentifierExpression + externalIdentifier: IdentifierExpression ): void { // add to file-level exports this.fileLevelExports.set(internalName, element); // add to filespace - var internalPath = identifier.range.source.internalPath; + var internalPath = externalIdentifier.range.source.internalPath; var prefix = FILESPACE_PREFIX + internalPath; var filespace = this.elementsLookup.get(prefix); if (!filespace) filespace = assert(this.elementsLookup.get(prefix + PATH_DELIMITER + "index")); assert(filespace.kind == ElementKind.FILESPACE); - var simpleName = identifier.text; + var simpleName = externalIdentifier.text; (filespace).members.set(simpleName, element); - // add global alias if from a library file - if (identifier.range.source.isLibrary) { + // add global alias if a top-level export of a library file + var source = externalIdentifier.range.source; + if (source.isLibrary) { if (this.elementsLookup.has(simpleName)) { this.error( DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0, - identifier.range, simpleName + externalIdentifier.range, simpleName ); } else { element.internalName = simpleName; this.elementsLookup.set(simpleName, element); } + + // add module level export if a top-level export of an entry file + } else if (source.isEntry) { + this.moduleLevelExports.set(externalIdentifier.text, { + element, + identifier: externalIdentifier + }); } } @@ -1382,10 +1432,10 @@ export class Program extends DiagnosticEmitter { referencedName = member.range.source.internalPath + PATH_DELIMITER + member.name.text; // resolve right away if the element exists - if (referencedElement = this.elementsLookup.get(referencedName)) { + if (this.elementsLookup.has(referencedName)) { this.setExportAndCheckLibrary( externalName, - referencedElement, + this.elementsLookup.get(referencedName), member.externalName ); return; @@ -1526,14 +1576,18 @@ export class Program extends DiagnosticEmitter { this.currentFilespace.members.set(simpleName, prototype); if (declaration.range.source.isEntry) { if (this.moduleLevelExports.has(simpleName)) { + let existingExport = this.moduleLevelExports.get(simpleName); this.error( DiagnosticCode.Duplicate_identifier_0, - declaration.name.range, (this.moduleLevelExports.get(simpleName)).internalName + declaration.name.range, existingExport.element.internalName ); return; } prototype.set(CommonFlags.MODULE_EXPORT); - this.moduleLevelExports.set(simpleName, prototype); + this.moduleLevelExports.set(simpleName, { + element: prototype, + identifier: declaration.name + }); } } @@ -1687,14 +1741,18 @@ export class Program extends DiagnosticEmitter { this.currentFilespace.members.set(simpleName, prototype); if (declaration.range.source.isEntry) { if (this.moduleLevelExports.has(simpleName)) { + let existingExport = this.moduleLevelExports.get(simpleName); this.error( DiagnosticCode.Duplicate_identifier_0, - declaration.name.range, (this.moduleLevelExports.get(simpleName)).internalName + declaration.name.range, existingExport.element.internalName ); return; } prototype.set(CommonFlags.MODULE_EXPORT); - this.moduleLevelExports.set(simpleName, prototype); + this.moduleLevelExports.set(simpleName, { + element: prototype, + identifier: declaration.name + }); } } @@ -1772,15 +1830,19 @@ export class Program extends DiagnosticEmitter { this.currentFilespace.members.set(simpleName, namespace); if (declaration.range.source.isEntry) { if (this.moduleLevelExports.has(simpleName)) { - if (this.moduleLevelExports.get(simpleName) !== namespace) { // not merged + let existingExport = this.moduleLevelExports.get(simpleName); + if (existingExport.element !== namespace) { // not merged this.error( DiagnosticCode.Duplicate_identifier_0, - declaration.name.range, (this.moduleLevelExports.get(simpleName)).internalName + declaration.name.range, existingExport.element.internalName ); return; } } else { - this.moduleLevelExports.set(simpleName, namespace); + this.moduleLevelExports.set(simpleName, { + element: namespace, + identifier: declaration.name + }); } namespace.set(CommonFlags.MODULE_EXPORT); } @@ -1869,6 +1931,7 @@ export class Program extends DiagnosticEmitter { decorators ? this.checkDecorators(decorators, DecoratorFlags.GLOBAL | + DecoratorFlags.INLINE | DecoratorFlags.EXTERNAL ) : DecoratorFlags.NONE @@ -1904,14 +1967,18 @@ export class Program extends DiagnosticEmitter { this.currentFilespace.members.set(simpleName, global); if (declaration.range.source.isEntry) { if (this.moduleLevelExports.has(simpleName)) { + let existingExport = this.moduleLevelExports.get(simpleName); this.error( DiagnosticCode.Duplicate_identifier_0, - declaration.name.range, (this.moduleLevelExports.get(simpleName)).internalName + declaration.name.range, existingExport.element.internalName ); continue; } global.set(CommonFlags.MODULE_EXPORT); - this.moduleLevelExports.set(simpleName, global); + this.moduleLevelExports.set(simpleName, { + element: global, + identifier: declaration.name + }); } } this.checkGlobal(global, declaration); diff --git a/std/assembly/allocator/arena.ts b/std/assembly/allocator/arena.ts index 3c31800d..8adb8485 100644 --- a/std/assembly/allocator/arena.ts +++ b/std/assembly/allocator/arena.ts @@ -1,7 +1,7 @@ /** * Arena Memory Allocator * - * Provides a `reset_memory` function to reset the heap to its initial state. A user has to make + * Provides a `memory.reset` function to reset the heap to its initial state. A user has to make * sure that there are no more references to cleared memory afterwards. Always aligns to 8 bytes. * * @module std/assembly/allocator/arena @@ -13,17 +13,17 @@ var startOffset: usize = (HEAP_BASE + AL_MASK) & ~AL_MASK; var offset: usize = startOffset; @global -export function allocate_memory(size: usize): usize { +export function __memory_allocate(size: usize): usize { if (size) { if (size > MAX_SIZE_32) unreachable(); let ptr = offset; let newPtr = (ptr + size + AL_MASK) & ~AL_MASK; - let pagesBefore = current_memory(); + let pagesBefore = memory.size(); if (newPtr > pagesBefore << 16) { let pagesNeeded = ((newPtr - ptr + 0xffff) & ~0xffff) >>> 16; let pagesWanted = max(pagesBefore, pagesNeeded); // double memory - if (grow_memory(pagesWanted) < 0) { - if (grow_memory(pagesNeeded) < 0) { + if (memory.grow(pagesWanted) < 0) { + if (memory.grow(pagesNeeded) < 0) { unreachable(); // out of memory } } @@ -35,11 +35,11 @@ export function allocate_memory(size: usize): usize { } @global -export function free_memory(ptr: usize): void { +export function __memory_free(ptr: usize): void { // nop } @global -export function reset_memory(): void { +export function __memory_reset(): void { offset = startOffset; } diff --git a/std/assembly/allocator/buddy.ts b/std/assembly/allocator/buddy.ts index 481bab08..7157dd83 100644 --- a/std/assembly/allocator/buddy.ts +++ b/std/assembly/allocator/buddy.ts @@ -176,10 +176,10 @@ function update_max_ptr(new_value: usize): i32 { // if (brk(new_value)) { // return 0; // } - let oldPages = current_memory(); - let newPages = (((new_value + 0xffff) & ~0xffff) >> 16); + let oldPages = memory.size(); + let newPages = (((new_value + 0xffff) & ~0xffff) >>> 16); assert(newPages > oldPages); - if (grow_memory(newPages - oldPages) < 0) { + if (memory.grow(newPages - oldPages) < 0) { return 0; } // max_ptr = new_value; @@ -339,7 +339,7 @@ function lower_bucket_limit(bucket: usize): u32 { } @global -export function allocate_memory(request: usize): usize { +export function __memory_allocate(request: usize): usize { var original_bucket: usize, bucket: usize; /* @@ -357,7 +357,7 @@ export function allocate_memory(request: usize): usize { if (base_ptr == 0) { // base_ptr = max_ptr = (uint8_t *)sbrk(0); base_ptr = (NODE_IS_SPLIT_END + 7) & ~7; // must be aligned - max_ptr = current_memory() << 16; // must grow first + max_ptr = memory.size() << 16; // must grow first bucket_limit = BUCKET_COUNT - 1; if (!update_max_ptr(base_ptr + List.SIZE)) { return 0; @@ -474,7 +474,7 @@ export function allocate_memory(request: usize): usize { } @global -export function free_memory(ptr: usize): void { +export function __memory_free(ptr: usize): void { var bucket: usize, i: usize; /* @@ -540,6 +540,6 @@ export function free_memory(ptr: usize): void { } @global -export function reset_memory(): void { +export function __memory_reset(): void { unreachable(); } diff --git a/std/assembly/allocator/emscripten.ts b/std/assembly/allocator/emscripten.ts index c44e7765..f3c63f44 100644 --- a/std/assembly/allocator/emscripten.ts +++ b/std/assembly/allocator/emscripten.ts @@ -12,16 +12,16 @@ declare function _malloc(size: usize): usize; declare function _free(ptr: usize): void; @global -export function allocate_memory(size: usize): usize { +export function __memory_allocate(size: usize): usize { return _malloc(size); } @global -export function free_memory(ptr: usize): void { +export function __memory_free(ptr: usize): void { _free(ptr); } @global -export function reset_memory(): void { +export function __memory_reset(): void { unreachable(); } diff --git a/std/assembly/allocator/system.ts b/std/assembly/allocator/system.ts index 4f52ff63..eeaf552f 100644 --- a/std/assembly/allocator/system.ts +++ b/std/assembly/allocator/system.ts @@ -11,16 +11,16 @@ declare function malloc(size: usize): usize; declare function free(ptr: usize): void; @global -export function allocate_memory(size: usize): usize { +export function __memory_allocate(size: usize): usize { return malloc(size); } @global -export function free_memory(ptr: usize): void { +export function __memory_free(ptr: usize): void { free(ptr); } @global -export function reset_memory(): void { +export function __memory_reset(): void { unreachable(); } diff --git a/std/assembly/allocator/tlsf.ts b/std/assembly/allocator/tlsf.ts index 93e82035..bf040141 100644 --- a/std/assembly/allocator/tlsf.ts +++ b/std/assembly/allocator/tlsf.ts @@ -437,15 +437,15 @@ var ROOT: Root = changetype(0); /** Allocates a chunk of memory. */ @global -export function allocate_memory(size: usize): usize { +export function __memory_allocate(size: usize): usize { // initialize if necessary var root = ROOT; if (!root) { let rootOffset = (HEAP_BASE + AL_MASK) & ~AL_MASK; - let pagesBefore = current_memory(); + let pagesBefore = memory.size(); let pagesNeeded = ((((rootOffset + Root.SIZE) + 0xffff) & ~0xffff) >>> 16); - if (pagesNeeded > pagesBefore && grow_memory(pagesNeeded - pagesBefore) < 0) unreachable(); + if (pagesNeeded > pagesBefore && memory.grow(pagesNeeded - pagesBefore) < 0) unreachable(); ROOT = root = changetype(rootOffset); root.tailRef = 0; root.flMap = 0; @@ -455,7 +455,7 @@ export function allocate_memory(size: usize): usize { root.setHead(fl, sl, null); } } - root.addMemory((rootOffset + Root.SIZE + AL_MASK) & ~AL_MASK, current_memory() << 16); + root.addMemory((rootOffset + Root.SIZE + AL_MASK) & ~AL_MASK, memory.size() << 16); } // search for a suitable block @@ -469,15 +469,15 @@ export function allocate_memory(size: usize): usize { if (!block) { // request more memory - let pagesBefore = current_memory(); + let pagesBefore = memory.size(); let pagesNeeded = (((size + 0xffff) & ~0xffff) >>> 16); let pagesWanted = max(pagesBefore, pagesNeeded); // double memory - if (grow_memory(pagesWanted) < 0) { - if (grow_memory(pagesNeeded) < 0) { + if (memory.grow(pagesWanted) < 0) { + if (memory.grow(pagesNeeded) < 0) { unreachable(); // out of memory } } - let pagesAfter = current_memory(); + let pagesAfter = memory.size(); root.addMemory(pagesBefore << 16, pagesAfter << 16); block = assert(root.search(size)); // must be found now } @@ -491,7 +491,7 @@ export function allocate_memory(size: usize): usize { /** Frees the chunk of memory at the specified address. */ @global -export function free_memory(data: usize): void { +export function __memory_free(data: usize): void { if (data) { let root = ROOT; if (root) { @@ -505,6 +505,6 @@ export function free_memory(data: usize): void { } @global -export function reset_memory(): void { +export function __memory_reset(): void { unreachable(); } diff --git a/std/assembly/array.ts b/std/assembly/array.ts index bb70d76e..45a6c375 100644 --- a/std/assembly/array.ts +++ b/std/assembly/array.ts @@ -25,7 +25,7 @@ export class Array { var buffer = allocUnsafe(byteLength); this.buffer_ = buffer; this.length_ = length; - set_memory( + memory.fill( changetype(buffer) + HEADER_SIZE_AB, 0, byteLength @@ -216,7 +216,7 @@ export class Array { var buffer = this.buffer_; var element = loadUnsafe(buffer, 0); var lastIndex = length - 1; - move_memory( + memory.copy( changetype(buffer) + HEADER_SIZE_AB, changetype(buffer) + HEADER_SIZE_AB + sizeof(), lastIndex << alignof() @@ -246,7 +246,7 @@ export class Array { capacity = buffer.byteLength >>> alignof(); this.buffer_ = buffer; } - move_memory( + memory.copy( changetype(buffer) + HEADER_SIZE_AB + sizeof(), changetype(buffer) + HEADER_SIZE_AB, (capacity - 1) << alignof() @@ -267,7 +267,7 @@ export class Array { assert(newLength >= 0); var sliced = new Array(newLength); if (newLength) { - move_memory( + memory.copy( changetype(sliced.buffer_) + HEADER_SIZE_AB, changetype(this.buffer_) + HEADER_SIZE_AB + (begin << alignof()), newLength << alignof() @@ -283,7 +283,7 @@ export class Array { if (start >= length) return; deleteCount = min(deleteCount, length - start); var buffer = this.buffer_; - move_memory( + memory.copy( changetype(buffer) + HEADER_SIZE_AB + (start << alignof()), changetype(buffer) + HEADER_SIZE_AB + ((start + deleteCount) << alignof()), deleteCount << alignof() diff --git a/std/assembly/arraybuffer.ts b/std/assembly/arraybuffer.ts index 5db2e200..d165960f 100644 --- a/std/assembly/arraybuffer.ts +++ b/std/assembly/arraybuffer.ts @@ -12,7 +12,7 @@ export class ArrayBuffer { constructor(length: i32, unsafe: bool = false) { if (length > MAX_BLENGTH) throw new RangeError("Invalid array buffer length"); var buffer = allocUnsafe(length); - if (!unsafe) set_memory(changetype(buffer) + HEADER_SIZE, 0, length); + if (!unsafe) memory.fill(changetype(buffer) + HEADER_SIZE, 0, length); return buffer; } @@ -24,7 +24,7 @@ export class ArrayBuffer { else end = min(end, len); var newLen = max(end - begin, 0); var buffer = allocUnsafe(newLen); - move_memory(changetype(buffer) + HEADER_SIZE, changetype(this) + HEADER_SIZE + begin, newLen); + memory.copy(changetype(buffer) + HEADER_SIZE, changetype(this) + HEADER_SIZE + begin, newLen); return buffer; } } diff --git a/std/assembly/builtins.ts b/std/assembly/builtins.ts index 570ad83d..dc5815cd 100644 --- a/std/assembly/builtins.ts +++ b/std/assembly/builtins.ts @@ -1,89 +1,43 @@ +@inline export const NaN: f64 = 0 / 0; +@inline export const Infinity: f64 = 1 / 0; +export declare const HEAP_BASE: usize; + export declare function isInteger(value?: T): bool; - export declare function isFloat(value?: T): bool; - export declare function isSigned(value?: T): bool; - export declare function isReference(value?: T): bool; - export declare function isString(value?: T): bool; - export declare function isArray(value?: T): bool; - export declare function isDefined(expression: void): bool; - export declare function isConstant(expression: void): bool; - -export const NaN: f64 = 0 / 0; - -export const Infinity: f64 = 1 / 0; - -export function isNaN(value: T): bool { - return value != value; -} - -export function isFinite(value: T): bool { - return value - value == 0; -} +export function isNaN(value: T): bool { return value != value; } +export function isFinite(value: T): bool { return value - value == 0; } export declare function clz(value: T): T; - export declare function ctz(value: T): T; - export declare function popcnt(value: T): T; - export declare function rotl(value: T, shift: T): T; - export declare function rotr(value: T, shift: T): T; - export declare function abs(value: T): T; - export declare function max(left: T, right: T): T; - export declare function min(left: T, right: T): T; - export declare function ceil(value: T): T; - export declare function floor(value: T): T; - export declare function copysign(left: T, right: T): T; - export declare function nearest(value: T): T; - export declare function reinterpret(value: void): T; - export declare function sqrt(value: T): T; - export declare function trunc(value: T): T; - export declare function load(offset: usize, constantOffset?: usize): T; - export declare function store(offset: usize, value: void, constantOffset?: usize): void; - export declare function sizeof(): usize; // | u32 / u64 - export declare function alignof(): usize; // | u32 / u64 - export declare function offsetof(fieldName?: string): usize; // | u32 / u64 - export declare function select(ifTrue: T, ifFalse: T, condition: bool): T; - export declare function unreachable(): void; - -export declare function current_memory(): i32; - -export declare function grow_memory(pages: i32): i32; - -// export declare function move_memory(dest: usize, src: usize: n: usize): void; - -// export declare function set_memory(dest: usize, value: u32, n: usize): void; - export declare function changetype(value: void): T; - export declare function assert(isTrueish: T, message?: string): T; - export declare function unchecked(expr: T): T; - export declare function call_indirect(target: void, ...args: void[]): T; export declare function i8(value: void): i8; @@ -233,6 +187,15 @@ export namespace f64 { export declare function trunc(value: f64): f64; } -export declare const HEAP_BASE: usize; - export declare function start(): void; + +export declare function ERROR(message?: void): void; +export declare function WARNING(message?: void): void; +export declare function INFO(message?: void): void; + +export declare function __memory_size(): i32; +export declare function __memory_grow(pages: i32): i32; +// export declare function __memory_copy(dest: usize, src: usize: n: usize): void; +// export declare function __memory_fill(dest: usize, value: u32, n: usize): void; + +export declare function __gc_iterate_roots(fn: (ref: usize) => void): void; diff --git a/std/assembly/collector/itcm.ts b/std/assembly/collector/itcm.ts index 31483c75..4bbef614 100644 --- a/std/assembly/collector/itcm.ts +++ b/std/assembly/collector/itcm.ts @@ -11,6 +11,10 @@ import { MAX_SIZE_32 } from "../internal/allocator"; +import { + __gc_iterate_roots +} from "../builtins"; + // ╒═══════════════ Managed object layout (32-bit) ════════════════╕ // 3 2 1 // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 bits @@ -78,6 +82,11 @@ class ManagedObject { prev.next = next; } + clear(): void { + this.nextWithFlags = changetype(this); + this.prev = this; + } + /** Tests if this object is white, that is unreachable (so far). */ get isWhite(): bool { return (this.nextWithFlags & Flags.MASK) == Flags.WHITE; @@ -107,7 +116,7 @@ class ManagedObject { makeGray(): void { if (this != iter) { this.remove(); - to.insert(this); + set2.insert(this); } else { iter = iter.prev; } @@ -131,8 +140,8 @@ const enum State { var state = State.INIT; // From and to spaces -var from: ManagedObject; -var to: ManagedObject; +var set1: ManagedObject; +var set2: ManagedObject; var iter: ManagedObject; /** Performs a single step according to the current state. */ @@ -140,34 +149,40 @@ function gc_step(): void { var obj: ManagedObject; switch (state) { case State.INIT: { - from = changetype(allocate_memory(ManagedObject.SIZE)); - from.nextWithFlags = changetype(from); - from.prev = from; - to = changetype(allocate_memory(ManagedObject.SIZE)); - to.nextWithFlags = changetype(to); - to.prev = to; - iter = to; + set1 = changetype(memory.allocate(ManagedObject.SIZE)); + set1.clear(); + set2 = changetype(memory.allocate(ManagedObject.SIZE)); + set2.clear(); + iter = set2; // fall-through } case State.IDLE: { + // start by marking roots + __gc_iterate_roots(function mark_root(ref: usize): void { + if (ref) { + let obj = changetype(ref - ManagedObject.SIZE); + obj.makeBlack(); + obj.visitFn(ref); + } + }); state = State.MARK; break; } case State.MARK: { obj = iter.next; - if (obj != to) { + if (obj != set2) { iter = obj; obj.makeBlack(); obj.visitFn(changetype(obj) + ManagedObject.SIZE); } else { obj = iter.next; - if (obj == to) { - let temp = from; - from = to; - to = temp; + if (obj == set2) { + let set1_ = set1; + set1 = set2; + set2 = set1_; Flags.WHITE ^= 1; Flags.BLACK ^= 1; - iter = from.next; + iter = set1.next; state = State.SWEEP; } } @@ -175,12 +190,11 @@ function gc_step(): void { } case State.SWEEP: { obj = iter; - if (obj != to) { + if (obj !== set2) { iter = obj.next; - free_memory(changetype(obj)); + memory.free(changetype(obj)); } else { - to.nextWithFlags = changetype(to); - to.prev = to; + set2.clear(); state = State.IDLE; } break; @@ -188,66 +202,42 @@ function gc_step(): void { } } -/** Allocates a managed object. */ +/** Garbage collector interface. */ @global -export function gc_allocate( - size: usize, - visitFn: (obj: usize) => void -): usize { - assert(size <= MAX_SIZE_32 - ManagedObject.SIZE); - var obj = changetype(allocate_memory(ManagedObject.SIZE + size)); - obj.makeWhite(); - obj.visitFn = visitFn; - from.insert(obj); - return changetype(obj) + ManagedObject.SIZE; -} +export namespace gc { -/** Visits a reachable object. Called from the visitFn functions. */ -@global -export function gc_visit(obj: ManagedObject): void { - if (state == State.SWEEP) return; - if (obj.isWhite) obj.makeGray(); -} - -/** Registers a managed child object with its parent object. */ -@global -export function gc_register(parent: ManagedObject, child: ManagedObject): void { - if (parent.isBlack && child.isWhite) parent.makeGray(); -} - -/** Iterates the root set. Provided by the compiler according to the program. */ -@global -export declare function gc_roots(): void; - -/** Performs a full garbage collection cycle. */ -@global -export function gc_collect(): void { - // begin collecting if not yet collecting - switch (state) { - case State.INIT: - case State.IDLE: gc_step(); + /** Allocates a managed object. */ + export function alloc( + size: usize, + visitFn: (ref: usize) => void + ): usize { + assert(size <= MAX_SIZE_32 - ManagedObject.SIZE); + var obj = changetype(memory.allocate(ManagedObject.SIZE + size)); + obj.makeWhite(); + obj.visitFn = visitFn; + set1.insert(obj); + return changetype(obj) + ManagedObject.SIZE; + } + + /** Visits a reachable object. Called from the visitFn functions. */ + export function visit(obj: ManagedObject): void { + if (state == State.SWEEP) return; + if (obj.isWhite) obj.makeGray(); + } + + /** References a managed child object from its parent object. */ + export function ref(parent: ManagedObject, child: ManagedObject): void { + if (parent.isBlack && child.isWhite) parent.makeGray(); + } + + /** Performs a full garbage collection cycle. */ + export function collect(): void { + // begin collecting if not yet collecting + switch (state) { + case State.INIT: + case State.IDLE: gc_step(); + } + // finish the cycle + while (state != State.IDLE) gc_step(); } - // finish the cycle - while (state != State.IDLE) gc_step(); } - -declare function allocate_memory(size: usize): usize; -declare function free_memory(ptr: usize): void; - -// Considerations -// -// - An API that consists mostly of just replacing `allocate_memory` would be ideal, possibly taking -// any additional number of parameters that are necessary, like the parent and the visitor. -// -// - Not having to generate a helper function for iterating globals but instead marking specific -// nodes as roots could simplify the embedding, but whether this is feasible or not depends on its -// performance characteristics and the possibility of tracking root status accross assignments. -// For example, root status could be implemented as some sort of referenced-by-globals counting -// and a dedicated list of root objects. -// -// - In 32-bit specifically, there is some free space in TLSF object headers due to alignment that -// could be repurposed to store some GC information, like a class id. Certainly, this somewhat -// depends on the efficiency of the used mechanism to detect this at compile time, including when -// a different allocator is used. -// -// - Think about generations. diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 36c7f6e9..9a0b1096 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -34,6 +34,8 @@ declare type f32 = number; /** A 64-bit float. */ declare type f64 = number; +// Compiler hints + /** Compiler target. 0 = JS, 1 = WASM32, 2 = WASM64. */ declare const ASC_TARGET: i32; /** Provided noTreeshaking option. */ @@ -51,6 +53,100 @@ declare const ASC_FEATURE_MUTABLE_GLOBAL: bool; /** Whether the sign extension feature is enabled. */ declare const ASC_FEATURE_SIGN_EXTENSION: bool; +// Builtins + +/** Performs the sign-agnostic count leading zero bits operation on a 32-bit or 64-bit integer. All zero bits are considered leading if the value is zero. */ +declare function clz(value: T): T; +/** Performs the sign-agnostic count tailing zero bits operation on a 32-bit or 64-bit integer. All zero bits are considered trailing if the value is zero. */ +declare function ctz(value: T): T; +/** Performs the sign-agnostic count number of one bits operation on a 32-bit or 64-bit integer. */ +declare function popcnt(value: T): T; +/** Performs the sign-agnostic rotate left operation on a 32-bit or 64-bit integer. */ +declare function rotl(value: T, shift: T): T; +/** Performs the sign-agnostic rotate right operation on a 32-bit or 64-bit integer. */ +declare function rotr(value: T, shift: T): T; +/** Computes the absolute value of an integer or float. */ +declare function abs(value: T): T; +/** Determines the maximum of two integers or floats. If either operand is `NaN`, returns `NaN`. */ +declare function max(left: T, right: T): T; +/** Determines the minimum of two integers or floats. If either operand is `NaN`, returns `NaN`. */ +declare function min(left: T, right: T): T; +/** Performs the ceiling operation on a 32-bit or 64-bit float. */ +declare function ceil(value: T): T; +/** Composes a 32-bit or 64-bit float from the magnitude of `x` and the sign of `y`. */ +declare function copysign(x: T, y: T): T; +/** Performs the floor operation on a 32-bit or 64-bit float. */ +declare function floor(value: T): T; +/** Rounds to the nearest integer tied to even of a 32-bit or 64-bit float. */ +declare function nearest(value: T): T; +/** Reinterprets the bits of the specified value as type `T`. Valid reinterpretations are u32/i32 to/from f32 and u64/i64 to/from f64. */ +declare function reinterpret(value: number): T; +/** Selects one of two pre-evaluated values depending on the condition. */ +declare function select(ifTrue: T, ifFalse: T, condition: bool): T; +/** Calculates the square root of a 32-bit or 64-bit float. */ +declare function sqrt(value: T): T; +/** Rounds to the nearest integer towards zero of a 32-bit or 64-bit float. */ +declare function trunc(value: T): T; +/** Loads a value of the specified type from memory. Equivalent to dereferncing a pointer in other languages. */ +declare function load(ptr: usize, constantOffset?: usize): T; +/** Stores a value of the specified type to memory. Equivalent to dereferencing a pointer in other languages when assigning a value. */ +declare function store(ptr: usize, value: any, constantOffset?: usize): void; +/** Emits an unreachable operation that results in a runtime error when executed. Both a statement and an expression of any type. */ +declare function unreachable(): any; // sic + +/** NaN (not a number) as a 32-bit or 64-bit float depending on context. */ +declare const NaN: f32 | f64; +/** Positive infinity as a 32-bit or 64-bit float depending on context. */ +declare const Infinity: f32 | f64; +/** Heap base offset. */ +declare const HEAP_BASE: usize; +/** Determines the byte size of the specified underlying core type. Compiles to a constant. */ +declare function sizeof(): usize; +/** Determines the alignment (log2) of the specified underlying core type. Compiles to a constant. */ +declare function alignof(): usize; +/** Determines the offset of the specified field within the given class type. Returns the class type's end offset if field name has been omitted. Compiles to a constant. */ +declare function offsetof(fieldName?: string): usize; +/** Changes the type of any value of `usize` kind to another one of `usize` kind. Useful for casting class instances to their pointer values and vice-versa. Beware that this is unsafe.*/ +declare function changetype(value: any): T; +/** Explicitly requests no bounds checks on the provided expression. Useful for array accesses. */ +declare function unchecked(value: T): T; +/** Emits a `call_indirect` instruction, calling the specified function in the function table by index with the specified arguments. Does result in a runtime error if the arguments do not match the called function. */ +declare function call_indirect(target: Function | u32, ...args: any[]): T; +/** Tests if a 32-bit or 64-bit float is `NaN`. */ +declare function isNaN(value: T): bool; +/** Tests if a 32-bit or 64-bit float is finite, that is not `NaN` or +/-`Infinity`. */ +declare function isFinite(value: T): bool; +/** Tests if the specified type *or* expression is of an integer type and not a reference. Compiles to a constant. */ +declare function isInteger(value?: any): value is number; +/** Tests if the specified type *or* expression is of a float type. Compiles to a constant. */ +declare function isFloat(value?: any): value is number; +/** Tests if the specified type *or* expression can represent negative numbers. Compiles to a constant. */ +declare function isSigned(value?: any): value is number; +/** Tests if the specified type *or* expression is of a reference type. Compiles to a constant. */ +declare function isReference(value?: any): value is object | string; +/** Tests if the specified type *or* expression can be used as a string. Compiles to a constant. */ +declare function isString(value?: any): value is string | String; +/** Tests if the specified type *or* expression can be used as an array. Compiles to a constant. */ +declare function isArray(value?: any): value is Array; +/** Tests if the specified expression resolves to a defined element. Compiles to a constant. */ +declare function isDefined(expression: any): bool; +/** Tests if the specified expression evaluates to a constant value. Compiles to a constant. */ +declare function isConstant(expression: any): bool; +/** Traps if the specified value is not true-ish, otherwise returns the (non-nullable) value. */ +declare function assert(isTrueish: T, message?: string): T & object; // any better way to model `: T != null`? +/** Parses an integer string to a 64-bit float. */ +declare function parseInt(str: string, radix?: i32): f64; +/** Parses an integer string to a 32-bit integer. */ +declare function parseI32(str: string, radix?: i32): i32; +/** Parses an integer string to a 64-bit integer. */ +declare function parseI64(str: string, radix?: i32): i64; +/** Parses a string to a 64-bit float. */ +declare function parseFloat(str: string): f64; +/** Returns the 64-bit floating-point remainder of `x/y`. */ +declare function fmod(x: f64, y: f64): f64; +/** Returns the 32-bit floating-point remainder of `x/y`. */ +declare function fmodf(x: f32, y: f32): f32; + /** Converts any other numeric value to an 8-bit signed integer. */ declare function i8(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): i8; declare namespace i8 { @@ -210,121 +306,58 @@ declare namespace f64 { export function store(offset: usize, value: f64, constantOffset?: usize): void; } -// Built-ins +// User-defined diagnostic macros -/** Performs the sign-agnostic count leading zero bits operation on a 32-bit or 64-bit integer. All zero bits are considered leading if the value is zero. */ -declare function clz(value: T): T; -/** Performs the sign-agnostic count tailing zero bits operation on a 32-bit or 64-bit integer. All zero bits are considered trailing if the value is zero. */ -declare function ctz(value: T): T; -/** Performs the sign-agnostic count number of one bits operation on a 32-bit or 64-bit integer. */ -declare function popcnt(value: T): T; -/** Performs the sign-agnostic rotate left operation on a 32-bit or 64-bit integer. */ -declare function rotl(value: T, shift: T): T; -/** Performs the sign-agnostic rotate right operation on a 32-bit or 64-bit integer. */ -declare function rotr(value: T, shift: T): T; -/** Computes the absolute value of an integer or float. */ -declare function abs(value: T): T; -/** Determines the maximum of two integers or floats. If either operand is `NaN`, returns `NaN`. */ -declare function max(left: T, right: T): T; -/** Determines the minimum of two integers or floats. If either operand is `NaN`, returns `NaN`. */ -declare function min(left: T, right: T): T; -/** Performs the ceiling operation on a 32-bit or 64-bit float. */ -declare function ceil(value: T): T; -/** Composes a 32-bit or 64-bit float from the magnitude of `x` and the sign of `y`. */ -declare function copysign(x: T, y: T): T; -/** Performs the floor operation on a 32-bit or 64-bit float. */ -declare function floor(value: T): T; -/** Rounds to the nearest integer tied to even of a 32-bit or 64-bit float. */ -declare function nearest(value: T): T; -/** Reinterprets the bits of the specified value as type `T`. Valid reinterpretations are u32/i32 to/from f32 and u64/i64 to/from f64. */ -declare function reinterpret(value: number): T; -/** Selects one of two pre-evaluated values depending on the condition. */ -declare function select(ifTrue: T, ifFalse: T, condition: bool): T; -/** Calculates the square root of a 32-bit or 64-bit float. */ -declare function sqrt(value: T): T; -/** Rounds to the nearest integer towards zero of a 32-bit or 64-bit float. */ -declare function trunc(value: T): T; -/** Loads a value of the specified type from memory. Equivalent to dereferncing a pointer in other languages. */ -declare function load(ptr: usize, constantOffset?: usize): T; -/** Stores a value of the specified type to memory. Equivalent to dereferencing a pointer in other languages when assigning a value. */ -declare function store(ptr: usize, value: any, constantOffset?: usize): void; -/** Returns the current memory size in units of pages. One page is 64kb. */ -declare function current_memory(): i32; -/** Grows linear memory by a given unsigned delta of pages. One page is 64kb. Returns the previous memory size in units of pages or `-1` on failure. */ -declare function grow_memory(value: i32): i32; -/** Copies n bytes from the specified source to the specified destination in memory. These regions may overlap. */ -declare function move_memory(destination: usize, source: usize, n: usize): void; -/** Sets n bytes beginning at the specified destination in memory to the specified byte value. */ -declare function set_memory(destination: usize, value: u8, count: usize): void; -/** Compares two chunks of memory. Returns `0` if equal, otherwise the difference of the first differing bytes. */ -declare function compare_memory(vl: usize, vr: usize, n: usize): i32; -/** Allocates a chunk of memory of the specified size and returns a pointer to it. */ -declare function allocate_memory(size: usize): usize; -/** Disposes a chunk of memory by its pointer. */ -declare function free_memory(ptr: usize): void; -/** Emits an unreachable operation that results in a runtime error when executed. Both a statement and an expression of any type. */ -declare function unreachable(): any; // sic +/** Emits a user-defined diagnostic error when encountered. */ +declare function ERROR(message?: any): void; +/** Emits a user-defined diagnostic warning when encountered. */ +declare function WARNING(message?: any): void; +/** Emits a user-defined diagnostic info when encountered. */ +declare function INFO(message?: any): void; -/** [Polyfill] Performs the sign-agnostic reverse bytes **/ +// Polyfills + +/** Performs the sign-agnostic reverse bytes **/ declare function bswap(value: T): T; -/** [Polyfill] Performs the sign-agnostic reverse bytes only for last 16-bit **/ +/** Performs the sign-agnostic reverse bytes only for last 16-bit **/ declare function bswap16(value: T): T; -/** NaN (not a number) as a 32-bit or 64-bit float depending on context. */ -declare const NaN: f32 | f64; -/** Positive infinity as a 32-bit or 64-bit float depending on context. */ -declare const Infinity: f32 | f64; -/** Heap base offset. */ -declare const HEAP_BASE: usize; -/** Determines the byte size of the specified underlying core type. Compiles to a constant. */ -declare function sizeof(): usize; -/** Determines the alignment (log2) of the specified underlying core type. Compiles to a constant. */ -declare function alignof(): usize; -/** Determines the offset of the specified field within the given class type. Returns the class type's end offset if field name has been omitted. Compiles to a constant. */ -declare function offsetof(fieldName?: string): usize; -/** Changes the type of any value of `usize` kind to another one of `usize` kind. Useful for casting class instances to their pointer values and vice-versa. Beware that this is unsafe.*/ -declare function changetype(value: any): T; -/** Explicitly requests no bounds checks on the provided expression. Useful for array accesses. */ -declare function unchecked(value: T): T; -/** Emits a `call_indirect` instruction, calling the specified function in the function table by index with the specified arguments. Does result in a runtime error if the arguments do not match the called function. */ -declare function call_indirect(target: Function | u32, ...args: any[]): T; -/** Tests if a 32-bit or 64-bit float is `NaN`. */ -declare function isNaN(value: T): bool; -/** Tests if a 32-bit or 64-bit float is finite, that is not `NaN` or +/-`Infinity`. */ -declare function isFinite(value: T): bool; -/** Tests if the specified type *or* expression is of an integer type and not a reference. Compiles to a constant. */ -declare function isInteger(value?: any): value is number; -/** Tests if the specified type *or* expression is of a float type. Compiles to a constant. */ -declare function isFloat(value?: any): value is number; -/** Tests if the specified type *or* expression can represent negative numbers. Compiles to a constant. */ -declare function isSigned(value?: any): value is number; -/** Tests if the specified type *or* expression is of a reference type. Compiles to a constant. */ -declare function isReference(value?: any): value is object | string; -/** Tests if the specified type *or* expression can be used as a string. Compiles to a constant. */ -declare function isString(value?: any): value is string | String; -/** Tests if the specified type *or* expression can be used as an array. Compiles to a constant. */ -declare function isArray(value?: any): value is Array; -/** Tests if the specified expression resolves to a defined element. Compiles to a constant. */ -declare function isDefined(expression: any): bool; -/** Tests if the specified expression evaluates to a constant value. Compiles to a constant. */ -declare function isConstant(expression: any): bool; -/** Traps if the specified value is not true-ish, otherwise returns the (non-nullable) value. */ -declare function assert(isTrueish: T, message?: string): T & object; // any better way to model `: T != null`? -/** Parses an integer string to a 64-bit float. */ -declare function parseInt(str: string, radix?: i32): f64; -/** Parses an integer string to a 32-bit integer. */ -declare function parseI32(str: string, radix?: i32): i32; -/** Parses an integer string to a 64-bit integer. */ -declare function parseI64(str: string, radix?: i32): i64; -/** Parses a string to a 64-bit float. */ -declare function parseFloat(str: string): f64; -/** Returns the 64-bit floating-point remainder of `x/y`. */ -declare function fmod(x: f64, y: f64): f64; -/** Returns the 32-bit floating-point remainder of `x/y`. */ -declare function fmodf(x: f32, y: f32): f32; - // Standard library +/** Memory operations. */ +declare namespace memory { + /** Returns the current memory size in units of pages. One page is 64kb. */ + export function size(): i32; + /** Grows linear memory by a given unsigned delta of pages. One page is 64kb. Returns the previous memory size in units of pages or `-1` on failure. */ + export function grow(value: i32): i32; + /** Sets n bytes beginning at the specified destination in memory to the specified byte value. */ + export function fill(dst: usize, value: u8, count: usize): void; + /** Copies n bytes from the specified source to the specified destination in memory. These regions may overlap. */ + export function copy(dst: usize, src: usize, n: usize): void; + /** Copies elements from a passive element segment to a table. */ + // export function init(segmentIndex: u32, srcOffset: usize, dstOffset: usize, n: usize): void; + /** Prevents further use of a passive element segment. */ + // export function drop(segmentIndex: u32): void; + /** Copies elements from one region of a table to another region. */ + export function allocate(size: usize): usize; + /** Disposes a chunk of memory by its pointer. */ + export function free(ptr: usize): void; + /** Compares two chunks of memory. Returns `0` if equal, otherwise the difference of the first differing bytes. */ + export function compare(vl: usize, vr: usize, n: usize): i32; + /** Resets the allocator to its initial state, if supported. */ + export function reset(): void; +} + +/** Table operations. */ +declare namespace table { + /** Copies elements from a passive element segment to a table. */ + // export function init(elementIndex: u32, srcOffset: u32, dstOffset: u32, n: u32): void; + /** Prevents further use of a passive element segment. */ + // export function drop(elementIndex: u32): void; + /** Copies elements from one region of a table to another region. */ + // export function copy(dest: u32, src: u32, n: u32): void; +} + /** Class representing a generic, fixed-length raw binary data buffer. */ declare class ArrayBuffer { /** The size, in bytes, of the array. */ @@ -607,7 +640,7 @@ declare const Math: IMath; /** Alias of {@link NativeMathf} or {@link JSMath} respectively. Defaults to `NativeMathf`. */ declare const Mathf: IMath; -// Internal decorators +// Decorators /** Annotates an element as a program global. */ declare function global(target: Function, propertyKey: string, descriptor: any): void; diff --git a/std/assembly/internal/array.ts b/std/assembly/internal/array.ts index 7678f8dd..ef0a46a7 100644 --- a/std/assembly/internal/array.ts +++ b/std/assembly/internal/array.ts @@ -36,8 +36,8 @@ export function weakHeapSort(arr: Array, comparator: (a: T, b: T) => i32): var length = arr.length; var bitsetSize = (length + 31) >> 5 << shift32; - var bitset = allocate_memory(bitsetSize); // indexed in 32-bit chunks below - set_memory(bitset, 0, bitsetSize); + var bitset = memory.allocate(bitsetSize); // indexed in 32-bit chunks below + memory.fill(bitset, 0, bitsetSize); // see: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.21.1863&rep=rep1&type=pdf @@ -83,7 +83,7 @@ export function weakHeapSort(arr: Array, comparator: (a: T, b: T) => i32): } } - free_memory(bitset); + memory.free(bitset); var t = loadUnsafe(buffer, 1); // t = arr[1] storeUnsafe(buffer, 1, loadUnsafe(buffer, 0)); // arr[1] = arr[0] diff --git a/std/assembly/internal/arraybuffer.ts b/std/assembly/internal/arraybuffer.ts index 93b50ddc..266e27fe 100644 --- a/std/assembly/internal/arraybuffer.ts +++ b/std/assembly/internal/arraybuffer.ts @@ -20,7 +20,7 @@ export function computeSize(byteLength: i32): usize { /** Allocates a raw ArrayBuffer. Contents remain uninitialized. */ export function allocUnsafe(byteLength: i32): ArrayBuffer { assert(byteLength <= MAX_BLENGTH); - var buffer = allocate_memory(computeSize(byteLength)); + var buffer = memory.allocate(computeSize(byteLength)); store(buffer, byteLength, offsetof("byteLength")); return changetype(buffer); } @@ -32,19 +32,19 @@ export function reallocUnsafe(buffer: ArrayBuffer, newByteLength: i32): ArrayBuf assert(newByteLength <= MAX_BLENGTH); if (newByteLength <= (computeSize(oldByteLength) - HEADER_SIZE)) { // fast path: zero out additional space store(changetype(buffer), newByteLength, offsetof("byteLength")); - set_memory( + memory.fill( changetype(buffer) + HEADER_SIZE + oldByteLength, 0, (newByteLength - oldByteLength) ); } else { // slow path: copy to new buffer let newBuffer = allocUnsafe(newByteLength); - move_memory( + memory.copy( changetype(newBuffer) + HEADER_SIZE, changetype(buffer) + HEADER_SIZE, oldByteLength ); - set_memory( + memory.fill( changetype(newBuffer) + HEADER_SIZE + oldByteLength, 0, (newByteLength - oldByteLength) diff --git a/std/assembly/internal/string.ts b/std/assembly/internal/string.ts index 35d3ebe4..b551b2c4 100644 --- a/std/assembly/internal/string.ts +++ b/std/assembly/internal/string.ts @@ -23,7 +23,7 @@ export function clamp(val: T, lo: T, hi: T): T { /** Allocates a raw String with uninitialized contents. */ export function allocate(length: i32): String { assert(length > 0 && length <= MAX_LENGTH); - var buffer = allocate_memory(HEADER_SIZE + (length << 1)); + var buffer = memory.allocate(HEADER_SIZE + (length << 1)); store(buffer, length); return changetype(buffer); } diff --git a/std/assembly/internal/typedarray.ts b/std/assembly/internal/typedarray.ts index e11da391..a2d653bd 100644 --- a/std/assembly/internal/typedarray.ts +++ b/std/assembly/internal/typedarray.ts @@ -18,7 +18,7 @@ export abstract class TypedArray { if (length > MAX_LENGTH) throw new RangeError("Invalid typed array length"); var byteLength = length << alignof(); var buffer = allocUnsafe(byteLength); - set_memory(changetype(buffer) + HEADER_SIZE_AB, 0, byteLength); + memory.fill(changetype(buffer) + HEADER_SIZE_AB, 0, byteLength); this.buffer = buffer; this.byteOffset = 0; this.byteLength = byteLength; @@ -64,7 +64,7 @@ export abstract class TypedArray { else begin = min(begin, length); if (end < 0) end = max(length + end, begin); else end = max(min(end, length), begin); - var slice = allocate_memory(offsetof()); + var slice = memory.allocate(offsetof()); store(slice, this.buffer, offsetof("buffer")); store(slice, begin << alignof(), offsetof("byteOffset")); store(slice, end << alignof(), offsetof("byteLength")); diff --git a/std/assembly/memory.ts b/std/assembly/memory.ts index 967d8efc..f05705b2 100644 --- a/std/assembly/memory.ts +++ b/std/assembly/memory.ts @@ -1,7 +1,60 @@ -function copy_memory(dest: usize, src: usize, n: usize): void { - // based on musl's implementation of memcpy - // not a future instruction and sufficiently covered by the upcoming move_memory intrinsic +export namespace memory { + export function size(): i32 { + return __memory_size(); // tslint:disable-line + } + + export function grow(pages: i32): i32 { + return __memory_grow(pages); // tslint:disable-line + } + + export function fill(dest: usize, c: u8, n: usize): void { // see: musl/src/string/memset + if (isDefined(__memory_fill)) { __memory_fill(dest, c, n); return; } // tslint:disable-line + memset(dest, c, n); + } + + export function copy(dest: usize, src: usize, n: usize): void { // see: musl/src/string/memmove.c + if (isDefined(__memory_copy)) { __memory_copy(dest, src, n); return; } // tslint:disable-line + memmove(dest, src, n); + } + + export function compare(vl: usize, vr: usize, n: usize): i32 { // see: musl/src/string/memcmp.c + if (isDefined(__memory_compare)) return __memory_compare(vl, vr, n); // tslint:disable-line + return memcmp(vl, vr, n); + } + + // Passive segments + + // export function init(segmentIndex: u32, srcOffset: usize, dstOffset: usize, n: usize): void { + // __memory_init(segmentIndex, srcOffset, dstOffset); + // } + + // export function drop(segmentIndex: u32): void { + // __memory_drop(segmentIndex); + // } + + // Allocator + + export function allocate(size: usize): usize { + if (isDefined(__memory_allocate)) return __memory_allocate(size); // tslint:disable-line + WARNING("Calling 'memory.allocate' requires a memory manager to be present."); + return unreachable(); + } + + export function free(ptr: usize): void { + if (isDefined(__memory_free)) { __memory_free(ptr); return; } // tslint:disable-line + WARNING("Calling 'memory.free' requires a memory manager to be present."); + unreachable(); + } + + export function reset(): void { + if (isDefined(__memory_reset)) { __memory_reset(); return; } // tslint:disable-line + unreachable(); + } +} + +// this function will go away once `memory.copy` becomes an intrinsic +function memcpy(dest: usize, src: usize, n: usize): void { // see: musl/src/string/memcpy.c var w: u32, x: u32; // copy 1 byte each until src is aligned to 4 bytes @@ -144,13 +197,11 @@ function copy_memory(dest: usize, src: usize, n: usize): void { } } -export function move_memory(dest: usize, src: usize, n: usize): void { - // based on musl's implementation of memmove - // becomes obsolete once https://github.com/WebAssembly/bulk-memory-operations lands - +// this function will go away once `memory.copy` becomes an intrinsic +function memmove(dest: usize, src: usize, n: usize): void { // see: musl/src/string/memmove.c if (dest == src) return; if (src + n <= dest || dest + n <= src) { - copy_memory(dest, src, n); + memcpy(dest, src, n); return; } if (dest < src) { @@ -188,9 +239,8 @@ export function move_memory(dest: usize, src: usize, n: usize): void { } } -export function set_memory(dest: usize, c: u8, n: usize): void { - // based on musl's implementation of memset - // becomes obsolete once https://github.com/WebAssembly/bulk-memory-operations lands +// this function will go away once `memory.fill` becomes an intrinsic +function memset(dest: usize, c: u8, n: usize): void { // see: musl/src/string/memset // fill head and tail with minimal branching if (!n) return; @@ -250,14 +300,10 @@ export function set_memory(dest: usize, c: u8, n: usize): void { } } -export function compare_memory(vl: usize, vr: usize, n: usize): i32 { - // based on musl's implementation of memcmp - // provided because there's no proposed alternative +function memcmp(vl: usize, vr: usize, n: usize): i32 { // see: musl/src/string/memcmp.c if (vl == vr) return 0; - while (n && load(vl) == load(vr)) { - n--; - vl++; - vr++; + while (n != 0 && load(vl) == load(vr)) { + n--; vl++; vr++; } return n ? load(vl) - load(vr) : 0; } diff --git a/std/assembly/string.ts b/std/assembly/string.ts index 2b67bafc..759093ea 100644 --- a/std/assembly/string.ts +++ b/std/assembly/string.ts @@ -90,13 +90,13 @@ export class String { if (outLen == 0) return EMPTY; var out = allocate(outLen); - move_memory( + memory.copy( changetype(out) + HEADER_SIZE, changetype(this) + HEADER_SIZE, thisLen << 1 ); - move_memory( + memory.copy( changetype(out) + HEADER_SIZE + (thisLen << 1), changetype(other) + HEADER_SIZE, otherLen << 1 @@ -112,7 +112,7 @@ export class String { var searchLength: isize = searchString.length; var start: isize = end - searchLength; if (start < 0) return false; - return !compare_memory( + return !memory.compare( changetype(this) + HEADER_SIZE + (start << 1), changetype(searchString) + HEADER_SIZE, searchLength << 1 @@ -127,7 +127,7 @@ export class String { var leftLength = left.length; if (leftLength != right.length) return false; - return !compare_memory( + return !memory.compare( changetype(left) + HEADER_SIZE, changetype(right) + HEADER_SIZE, (leftLength << 1) @@ -150,7 +150,7 @@ export class String { if (!rightLength) return true; var length = min(leftLength, rightLength); - return compare_memory( + return memory.compare( changetype(left) + HEADER_SIZE, changetype(right) + HEADER_SIZE, length << 1 @@ -169,7 +169,7 @@ export class String { if (!rightLength) return true; var length = min(leftLength, rightLength); - return compare_memory( + return memory.compare( changetype(left) + HEADER_SIZE, changetype(right) + HEADER_SIZE, length << 1 @@ -187,7 +187,7 @@ export class String { if (!leftLength) return true; var length = min(leftLength, rightLength); - return compare_memory( + return memory.compare( changetype(left) + HEADER_SIZE, changetype(right) + HEADER_SIZE, length << 1 @@ -206,7 +206,7 @@ export class String { if (!leftLength) return true; var length = min(leftLength, rightLength); - return compare_memory( + return memory.compare( changetype(left) + HEADER_SIZE, changetype(right) + HEADER_SIZE, length << 1 @@ -228,7 +228,7 @@ export class String { len -= searchLen; // TODO: multiple char codes for (let k: isize = start; k <= len; ++k) { - if (!compare_memory( + if (!memory.compare( changetype(this) + HEADER_SIZE + (k << 1), changetype(searchString) + HEADER_SIZE, searchLen << 1 @@ -250,7 +250,7 @@ export class String { // TODO: multiple char codes for (let k = start; k >= 0; --k) { - if (!compare_memory( + if (!memory.compare( changetype(this) + HEADER_SIZE + (k << 1), changetype(searchString) + HEADER_SIZE, searchLen << 1 @@ -272,7 +272,7 @@ export class String { if (searchLength + start > len) { return false; } - return !compare_memory( + return !memory.compare( changetype(this) + HEADER_SIZE + (start << 1), changetype(searchString) + HEADER_SIZE, searchLength << 1 @@ -292,7 +292,7 @@ export class String { return EMPTY; } var out = allocate(resultLength); - move_memory( + memory.copy( changetype(out) + HEADER_SIZE, changetype(this) + HEADER_SIZE + (intStart << 1), resultLength << 1 @@ -315,7 +315,7 @@ export class String { return this; } var out = allocate(len); - move_memory( + memory.copy( changetype(out) + HEADER_SIZE, changetype(this) + HEADER_SIZE + (from << 1), len << 1 @@ -351,7 +351,7 @@ export class String { return this; } var out = allocate(length); - move_memory( + memory.copy( changetype(out) + HEADER_SIZE, changetype(this) + HEADER_SIZE + (start << 1), length << 1 @@ -379,7 +379,7 @@ export class String { return EMPTY; } var out = allocate(outLen); - move_memory( + memory.copy( changetype(out) + HEADER_SIZE, changetype(this) + HEADER_SIZE + (start << 1), outLen << 1 @@ -405,7 +405,7 @@ export class String { return this; } var out = allocate(len); - move_memory( + memory.copy( changetype(out) + HEADER_SIZE, changetype(this) + HEADER_SIZE, len << 1 @@ -433,7 +433,7 @@ export class String { * 'a' + 'a' => 'aa' + 'aa' => 'aaaa' + 'aaaa' etc */ for (let offset = 0, len = strLen * count; offset < len; offset += strLen) { - move_memory( + memory.copy( changetype(result) + HEADER_SIZE + offset, changetype(this) + HEADER_SIZE, strLen @@ -472,7 +472,7 @@ export class String { } toUTF8(): usize { - var buf = allocate_memory(this.lengthUTF8); + var buf = memory.allocate(this.lengthUTF8); var pos: usize = 0; var end = this.length; var off: usize = 0; diff --git a/std/assembly/table.ts b/std/assembly/table.ts new file mode 100644 index 00000000..b0f9c1cd --- /dev/null +++ b/std/assembly/table.ts @@ -0,0 +1,16 @@ +export namespace table { + + // export function copy(dst: u32, src: u32, n: u32): void { + // __table_copy(dst, src, n); + // } + + // Passive elements + + // export function init(elementIndex: u32, srcOffset: u32, dstOffset: u32, n: u32): void { + // __table_init(elementIndex, srcOffset, dstOffset, n); + // } + + // export function drop(elementIndex: u32): void { + // __table_drop(elementIndex); + // } +} diff --git a/std/portable/index.d.ts b/std/portable/index.d.ts index 186f2320..1e05b355 100644 --- a/std/portable/index.d.ts +++ b/std/portable/index.d.ts @@ -14,7 +14,7 @@ /// -// Portable types +// Types declare type i8 = number; declare type i16 = number; @@ -28,9 +28,85 @@ declare type usize = number; declare type f32 = number; declare type f64 = number; +// Compiler hints + /** Compiler target. 0 = JS, 1 = WASM32, 2 = WASM64. */ declare const ASC_TARGET: i32; +// Builtins + +/** Performs the sign-agnostic count leading zero bits operation on a 32-bit integer. All zero bits are considered leading if the value is zero. */ +declare function clz(value: T): T; +/** Performs the sign-agnostic count tailing zero bits operation on a 32-bit integer. All zero bits are considered trailing if the value is zero. */ +declare function ctz(value: T): T; +/** Performs the sign-agnostic count number of one bits operation on a 32-bit integer. */ +declare function popcnt(value: T): T; +/** Performs the sign-agnostic rotate left operation on a 32-bit integer. */ +declare function rotl(value: T, shift: T): T; +/** Performs the sign-agnostic rotate right operation on a 32-bit integer. */ +declare function rotr(value: T, shift: T): T; +/** Computes the absolute value of an integer or float. */ +declare function abs(value: T): T; +/** Determines the maximum of two integers or floats. If either operand is `NaN`, returns `NaN`. */ +declare function max(left: T, right: T): T; +/** Determines the minimum of two integers or floats. If either operand is `NaN`, returns `NaN`. */ +declare function min(left: T, right: T): T; +/** Composes a 32-bit or 64-bit float from the magnitude of `x` and the sign of `y`. */ +declare function copysign(x: T, y: T): T; +/** Performs the ceiling operation on a 32-bit or 64-bit float. */ +declare function ceil(value: T): T; +/** Performs the floor operation on a 32-bit or 64-bit float. */ +declare function floor(value: T): T; +/** Rounds to the nearest integer tied to even of a 32-bit or 64-bit float. */ +declare function nearest(value: T): T; +/** Selects one of two pre-evaluated values depending on the condition. */ +declare function select(ifTrue: T, ifFalse: T, condition: bool): T; +/** Calculates the square root of a 32-bit or 64-bit float. */ +declare function sqrt(value: T): T; +/** Rounds to the nearest integer towards zero of a 32-bit or 64-bit float. */ +declare function trunc(value: T): T; +/** Loads a value of the specified type from memory. Type must be `u8`. */ +declare function load(ptr: usize, constantOffset?: usize): T; +/** Stores a value of the specified type to memory. Type must be `u8`. */ +declare function store(ptr: usize, value: T, constantOffset?: usize): void; +/** Emits an unreachable operation that results in a runtime error when executed. */ +declare function unreachable(): any; // sic + +/** NaN (not a number) as a 32-bit or 64-bit float depending on context. */ +declare const NaN: f32 | f64; +/** Positive infinity as a 32-bit or 64-bit float depending on context. */ +declare const Infinity: f32 | f64; +/** Changes the type of any value of `usize` kind to another one of `usize` kind. Useful for casting class instances to their pointer values and vice-versa. Beware that this is unsafe.*/ +declare function changetype(value: any): T; +/** Explicitly requests no bounds checks on the provided expression. Useful for array accesses. */ +declare function unchecked(value: T): T; +/** Tests if a 32-bit or 64-bit float is `NaN`. */ +declare function isNaN(value: T): bool; +/** Tests if a 32-bit or 64-bit float is finite, that is not `NaN` or +/-`Infinity`. */ +declare function isFinite(value: T): bool; +/** Tests if the specified value is a valid integer. Can't distinguish an integer from an integral float. */ +declare function isInteger(value: any): value is number; +/** Tests if the specified value is a valid float. Can't distinguish a float from an integer. */ +declare function isFloat(value: any): value is number; +/** Tests if the specified value is of a reference type. */ +declare function isReference(value: any): value is object | string; +/** Tests if the specified value can be used as a string. */ +declare function isString(value: any): value is string | String; +/** Tests if the specified value can be used as an array. */ +declare function isArray(value: any): value is Array; +/** Traps if the specified value is not true-ish, otherwise returns the value. */ +declare function assert(isTrueish: T | null, message?: string): T; +/** Parses an integer string to a 64-bit float. */ +declare function parseInt(str: string, radix?: i32): f64; +/** Parses an integer string to a 32-bit integer. */ +declare function parseI32(str: string, radix?: i32): i32; +/** Parses a floating point string to a 64-bit float. */ +declare function parseFloat(str: string): f64; +/** Returns the 64-bit floating-point remainder of `x/y`. */ +declare function fmod(x: f64, y: f64): f64; +/** Returns the 32-bit floating-point remainder of `x/y`. */ +declare function fmodf(x: f32, y: f32): f32; + /** Converts any other numeric value to an 8-bit signed integer. */ declare function i8(value: i8 | i16 | i32 | isize | u8 | u16 | u32 | usize | bool | f32 | f64): i8; declare namespace i8 { @@ -136,92 +212,26 @@ declare namespace f64 { export const EPSILON: f64; } -// Portable built-ins - -/** Performs the sign-agnostic count leading zero bits operation on a 32-bit integer. All zero bits are considered leading if the value is zero. */ -declare function clz(value: T): T; -/** Performs the sign-agnostic count tailing zero bits operation on a 32-bit integer. All zero bits are considered trailing if the value is zero. */ -declare function ctz(value: T): T; -/** Performs the sign-agnostic count number of one bits operation on a 32-bit integer. */ -declare function popcnt(value: T): T; -/** Performs the sign-agnostic rotate left operation on a 32-bit integer. */ -declare function rotl(value: T, shift: T): T; -/** Performs the sign-agnostic rotate right operation on a 32-bit integer. */ -declare function rotr(value: T, shift: T): T; -/** Computes the absolute value of an integer or float. */ -declare function abs(value: T): T; -/** Determines the maximum of two integers or floats. If either operand is `NaN`, returns `NaN`. */ -declare function max(left: T, right: T): T; -/** Determines the minimum of two integers or floats. If either operand is `NaN`, returns `NaN`. */ -declare function min(left: T, right: T): T; -/** Composes a 32-bit or 64-bit float from the magnitude of `x` and the sign of `y`. */ -declare function copysign(x: T, y: T): T; -/** Performs the ceiling operation on a 32-bit or 64-bit float. */ -declare function ceil(value: T): T; -/** Performs the floor operation on a 32-bit or 64-bit float. */ -declare function floor(value: T): T; -/** Rounds to the nearest integer tied to even of a 32-bit or 64-bit float. */ -declare function nearest(value: T): T; -/** Selects one of two pre-evaluated values depending on the condition. */ -declare function select(ifTrue: T, ifFalse: T, condition: bool): T; -/** Calculates the square root of a 32-bit or 64-bit float. */ -declare function sqrt(value: T): T; -/** Rounds to the nearest integer towards zero of a 32-bit or 64-bit float. */ -declare function trunc(value: T): T; -/** Allocates a chunk of memory of the specified size and returns a pointer to it. */ -declare function allocate_memory(size: usize): usize; -/** Disposes a chunk of memory by its pointer. */ -declare function free_memory(ptr: usize): void; -/** Copies n bytes from the specified source to the specified destination in memory. These regions may overlap. */ -declare function move_memory(destination: usize, source: usize, n: usize): void; -/** Loads a value of the specified type from memory. Type must be `u8`. */ -declare function load(ptr: usize, constantOffset?: usize): T; -/** Stores a value of the specified type to memory. Type must be `u8`. */ -declare function store(ptr: usize, value: T, constantOffset?: usize): void; -/** Emits an unreachable operation that results in a runtime error when executed. */ -declare function unreachable(): any; // sic +// Polyfills /** [Polyfill] Performs the sign-agnostic reverse bytes **/ declare function bswap(value: T): T; /** [Polyfill] Performs the sign-agnostic reverse bytes only for last 16-bit **/ declare function bswap16(value: T): T; -/** Changes the type of any value of `usize` kind to another one of `usize` kind. Useful for casting class instances to their pointer values and vice-versa. Beware that this is unsafe.*/ -declare function changetype(value: any): T; -/** Explicitly requests no bounds checks on the provided expression. Useful for array accesses. */ -declare function unchecked(value: T): T; -/** Tests if a 32-bit or 64-bit float is `NaN`. */ -declare function isNaN(value: T): bool; -/** Tests if a 32-bit or 64-bit float is finite, that is not `NaN` or +/-`Infinity`. */ -declare function isFinite(value: T): bool; -/** Tests if the specified value is a valid integer. Can't distinguish an integer from an integral float. */ -declare function isInteger(value: any): value is number; -/** Tests if the specified value is a valid float. Can't distinguish a float from an integer. */ -declare function isFloat(value: any): value is number; -/** Tests if the specified value is of a reference type. */ -declare function isReference(value: any): value is object | string; -/** Tests if the specified value can be used as a string. */ -declare function isString(value: any): value is string | String; -/** Tests if the specified value can be used as an array. */ -declare function isArray(value: any): value is Array; -/** Traps if the specified value is not true-ish, otherwise returns the value. */ -declare function assert(isTrueish: T | null, message?: string): T; -/** Parses an integer string to a 64-bit float. */ -declare function parseInt(str: string, radix?: i32): f64; -/** Parses an integer string to a 32-bit integer. */ -declare function parseI32(str: string, radix?: i32): i32; -/** Parses a floating point string to a 64-bit float. */ -declare function parseFloat(str: string): f64; -/** Returns the 64-bit floating-point remainder of `x/y`. */ -declare function fmod(x: f64, y: f64): f64; -/** Returns the 32-bit floating-point remainder of `x/y`. */ -declare function fmodf(x: f32, y: f32): f32; +// Standard library -// Portable standard library -// Everything marked @deprecated is a temporary filler. Do not use. - -declare const NaN: f32 | f64; -declare const Infinity: f32 | f64; +/** Memory operations. */ +declare namespace memory { + /** Allocates a chunk of memory of the specified size and returns a pointer to it. */ + function allocate(size: usize): usize; + /** Disposes a chunk of memory by its pointer. */ + function free(ptr: usize): void; + /** Copies n bytes from the specified source to the specified destination in memory. These regions may overlap. */ + function copy(dst: usize, src: usize, n: usize): void; + /** Resets the allocator to its initial state, if supported. */ + function reset(): void; +} /** Class representing a generic, fixed-length raw binary data buffer. */ declare class ArrayBuffer { diff --git a/std/portable/index.js b/std/portable/index.js index 39da63de..ebef68bf 100644 --- a/std/portable/index.js +++ b/std/portable/index.js @@ -218,4 +218,32 @@ globalScope["fmodf"] = function fmodf(x, y) { globalScope["JSMath"] = Math; -require("./memory")(globalScope); +globalScope["memory"] = (() => { + var HEAP = new Uint8Array(0); + var HEAP_OFFSET = 0; + return { + allocate: globalScope["__memory_allocate"] || function allocate(size) { + if (!(size >>>= 0)) return 0; + if (HEAP_OFFSET + size > HEAP.length) { + var oldHeap = HEAP; + HEAP = new Uint8Array(Math.max(65536, HEAP.length + size, HEAP.length * 2)); + HEAP.set(oldHeap); + } + var ptr = HEAP_OFFSET; + if ((HEAP_OFFSET += size) & 7) HEAP_OFFSET = (HEAP_OFFSET | 7) + 1; + return ptr; + }, + free: globalScope["__memory_free"] || function free(ptr) { }, + copy: globalScope["__memory_copy"] || function copy(dest, src, size) { + HEAP.copyWithin(dest, src, src + size); + } + }; +})(); + +globalScope["store"] = globalScope["__store"] || function store(ptr, value, offset) { + HEAP[ptr + (offset | 0)] = value; +}; + +globalScope["load"] = globalScope["__load"] || function load(ptr, offset) { + return HEAP[ptr + (offset | 0)]; +}; diff --git a/std/portable/memory.js b/std/portable/memory.js deleted file mode 100644 index 3362a60f..00000000 --- a/std/portable/memory.js +++ /dev/null @@ -1,36 +0,0 @@ -module.exports = globalScope => { - var HEAP = new Uint8Array(0); - var HEAP_OFFSET = 0; - - globalScope["allocate_memory"] = function allocate_memory(size) { - if (!(size >>>= 0)) return 0; - - if (HEAP_OFFSET + size > HEAP.length) { - var oldHeap = HEAP; - HEAP = new Uint8Array(Math.max(65536, HEAP.length + size, HEAP.length * 2)); - HEAP.set(oldHeap); - } - - var ptr = HEAP_OFFSET; - if ((HEAP_OFFSET += size) & 7) - HEAP_OFFSET = (HEAP_OFFSET | 7) + 1; - - return ptr; - }; - - globalScope["free_memory"] = function free_memory(ptr) { - // TODO - }; - - globalScope["move_memory"] = function move_memory(dest, src, size) { - HEAP.copyWithin(dest, src, src + size); - }; - - globalScope["store"] = function store(ptr, value, offset) { - HEAP[ptr + (offset | 0)] = value; - }; - - globalScope["load"] = function load(ptr, offset) { - return HEAP[ptr + (offset | 0)]; - }; -}; diff --git a/tests/allocators/arena/assembly/index.ts b/tests/allocators/arena/assembly/index.ts index b156406b..5d2618bb 100644 --- a/tests/allocators/arena/assembly/index.ts +++ b/tests/allocators/arena/assembly/index.ts @@ -1,3 +1,2 @@ import "allocator/arena"; -export { allocate_memory, free_memory, reset_memory }; -// export { set_memory }; +export { memory }; diff --git a/tests/allocators/arena/optimized.wat b/tests/allocators/arena/optimized.wat index e585d9a2..5c47d70a 100644 --- a/tests/allocators/arena/optimized.wat +++ b/tests/allocators/arena/optimized.wat @@ -1,17 +1,3024 @@ (module + (type $i (func (result i32))) (type $ii (func (param i32) (result i32))) + (type $iiiv (func (param i32 i32 i32))) + (type $iiii (func (param i32 i32 i32) (result i32))) (type $iv (func (param i32))) (type $v (func)) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) - (export "allocate_memory" (func $~lib/allocator/arena/allocate_memory)) - (export "free_memory" (func $~lib/allocator/arena/free_memory)) - (export "reset_memory" (func $~lib/allocator/arena/reset_memory)) + (export "memory.size" (func $~lib/memory/memory.size)) + (export "memory.grow" (func $~lib/memory/memory.grow)) + (export "memory.fill" (func $~lib/memory/memory.fill)) + (export "memory.copy" (func $~lib/memory/memory.copy)) + (export "memory.compare" (func $~lib/memory/memory.compare)) + (export "memory.allocate" (func $~lib/memory/memory.allocate)) + (export "memory.free" (func $~lib/memory/memory.free)) + (export "memory.reset" (func $~lib/memory/memory.reset)) (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 0 ;) (type $i) (result i32) + ;;@ ~lib/memory.ts:4:25 + (current_memory) + ) + (func $~lib/memory/memory.grow (; 1 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:8:30 + (grow_memory + ;;@ ~lib/memory.ts:8:25 + (get_local $0) + ) + ) + (func $~lib/memory/memory.fill (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i64) + (local $4 i32) + ;;@ ~lib/memory.ts:17:4 + (if + ;;@ ~lib/memory.ts:17:8 + (i32.eqz + ;;@ ~lib/memory.ts:17:9 + (get_local $2) + ) + ;;@ ~lib/memory.ts:17:12 + (return) + ) + ;;@ ~lib/memory.ts:18:4 + (i32.store8 + ;;@ ~lib/memory.ts:18:14 + (get_local $0) + ;;@ ~lib/memory.ts:18:20 + (get_local $1) + ) + ;;@ ~lib/memory.ts:19:4 + (i32.store8 + ;;@ ~lib/memory.ts:19:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:19:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:19:25 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:19:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:20:4 + (if + ;;@ ~lib/memory.ts:20:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:20:13 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:20:16 + (return) + ) + ;;@ ~lib/memory.ts:22:4 + (i32.store8 + ;;@ ~lib/memory.ts:22:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:22:21 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:22:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:23:4 + (i32.store8 + ;;@ ~lib/memory.ts:23:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:23:21 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:23:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:24:4 + (i32.store8 + ;;@ ~lib/memory.ts:24:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:24:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:24:25 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:24:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:25:4 + (i32.store8 + ;;@ ~lib/memory.ts:25:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:25:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:25:25 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:25:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:26:4 + (if + ;;@ ~lib/memory.ts:26:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:26:13 + (i32.const 6) + ) + ;;@ ~lib/memory.ts:26:16 + (return) + ) + ;;@ ~lib/memory.ts:27:4 + (i32.store8 + ;;@ ~lib/memory.ts:27:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:27:21 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:27:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:28:4 + (i32.store8 + ;;@ ~lib/memory.ts:28:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:28:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:28:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:28:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:29:4 + (if + ;;@ ~lib/memory.ts:29:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:29:13 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:29:16 + (return) + ) + ;;@ ~lib/memory.ts:40:4 + (i32.store + ;;@ ~lib/memory.ts:33:4 + (tee_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:32:4 + (tee_local $4 + ;;@ ~lib/memory.ts:32:19 + (i32.and + (i32.sub + (i32.const 0) + ;;@ ~lib/memory.ts:32:20 + (get_local $0) + ) + ;;@ ~lib/memory.ts:32:27 + (i32.const 3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:37:4 + (tee_local $1 + ;;@ ~lib/memory.ts:37:19 + (i32.mul + (i32.and + ;;@ ~lib/memory.ts:37:35 + (get_local $1) + (i32.const 255) + ) + (i32.const 16843009) + ) + ) + ) + ;;@ ~lib/memory.ts:41:4 + (i32.store + ;;@ ~lib/memory.ts:41:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:35:4 + (tee_local $2 + (i32.and + (i32.sub + ;;@ ~lib/memory.ts:34:4 + (get_local $2) + ;;@ ~lib/memory.ts:34:9 + (get_local $4) + ) + ;;@ ~lib/memory.ts:35:9 + (i32.const -4) + ) + ) + ) + ;;@ ~lib/memory.ts:41:26 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:41:29 + (get_local $1) + ) + ;;@ ~lib/memory.ts:42:4 + (if + ;;@ ~lib/memory.ts:42:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:42:13 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:42:16 + (return) + ) + ;;@ ~lib/memory.ts:43:4 + (i32.store + ;;@ ~lib/memory.ts:43:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:43:22 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:43:25 + (get_local $1) + ) + ;;@ ~lib/memory.ts:44:4 + (i32.store + ;;@ ~lib/memory.ts:44:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:44:22 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:44:25 + (get_local $1) + ) + ;;@ ~lib/memory.ts:45:4 + (i32.store + ;;@ ~lib/memory.ts:45:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:45:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:45:26 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:45:30 + (get_local $1) + ) + ;;@ ~lib/memory.ts:46:4 + (i32.store + ;;@ ~lib/memory.ts:46:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:46:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:46:26 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:46:29 + (get_local $1) + ) + ;;@ ~lib/memory.ts:47:4 + (if + ;;@ ~lib/memory.ts:47:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:47:13 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:47:17 + (return) + ) + ;;@ ~lib/memory.ts:48:4 + (i32.store + ;;@ ~lib/memory.ts:48:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:48:22 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:48:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:49:4 + (i32.store + ;;@ ~lib/memory.ts:49:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:49:22 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:49:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:50:4 + (i32.store + ;;@ ~lib/memory.ts:50:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:50:22 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:50:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:51:4 + (i32.store + ;;@ ~lib/memory.ts:51:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:51:22 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:51:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:52:4 + (i32.store + ;;@ ~lib/memory.ts:52:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:52:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:52:26 + (i32.const 28) + ) + ;;@ ~lib/memory.ts:52:30 + (get_local $1) + ) + ;;@ ~lib/memory.ts:53:4 + (i32.store + ;;@ ~lib/memory.ts:53:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:53:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:53:26 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:53:30 + (get_local $1) + ) + ;;@ ~lib/memory.ts:54:4 + (i32.store + ;;@ ~lib/memory.ts:54:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:54:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:54:26 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:54:30 + (get_local $1) + ) + ;;@ ~lib/memory.ts:55:4 + (i32.store + ;;@ ~lib/memory.ts:55:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:55:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:55:26 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:55:30 + (get_local $1) + ) + ;;@ ~lib/memory.ts:59:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:58:4 + (tee_local $4 + ;;@ ~lib/memory.ts:58:8 + (i32.add + ;;@ ~lib/memory.ts:58:13 + (i32.and + ;;@ ~lib/memory.ts:58:14 + (get_local $0) + ;;@ ~lib/memory.ts:58:21 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:58:8 + (i32.const 24) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:60:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:60:9 + (get_local $4) + ) + ) + ;;@ ~lib/memory.ts:63:4 + (set_local $3 + ;;@ ~lib/memory.ts:63:19 + (i64.or + (i64.extend_u/i32 + (get_local $1) + ) + ;;@ ~lib/memory.ts:63:30 + (i64.shl + ;;@ ~lib/memory.ts:63:31 + (i64.extend_u/i32 + (get_local $1) + ) + ;;@ ~lib/memory.ts:63:43 + (i64.const 32) + ) + ) + ) + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:64:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:64:16 + (i32.const 32) + ) + (block + ;;@ ~lib/memory.ts:65:6 + (i64.store + ;;@ ~lib/memory.ts:65:17 + (get_local $0) + ;;@ ~lib/memory.ts:65:23 + (get_local $3) + ) + ;;@ ~lib/memory.ts:66:6 + (i64.store + ;;@ ~lib/memory.ts:66:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:66:24 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:66:27 + (get_local $3) + ) + ;;@ ~lib/memory.ts:67:6 + (i64.store + ;;@ ~lib/memory.ts:67:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:67:24 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:67:28 + (get_local $3) + ) + ;;@ ~lib/memory.ts:68:6 + (i64.store + ;;@ ~lib/memory.ts:68:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:68:24 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:68:28 + (get_local $3) + ) + ;;@ ~lib/memory.ts:69:6 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:69:11 + (i32.const 32) + ) + ) + ;;@ ~lib/memory.ts:70:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:70:14 + (i32.const 32) + ) + ) + (br $continue|0) + ) + ) + ) + ) + (func $~lib/memory/memcpy (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (loop $continue|0 + (if + (select + ;;@ ~lib/memory.ts:164:14 + (i32.and + ;;@ ~lib/memory.ts:164:15 + (get_local $1) + ;;@ ~lib/memory.ts:164:21 + (i32.const 3) + ) + (get_local $2) + ;;@ ~lib/memory.ts:164:9 + (get_local $2) + ) + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:165:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:165:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:165:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:165:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:166:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ;;@ ~lib/memory.ts:170:2 + (if + (i32.eqz + ;;@ ~lib/memory.ts:170:6 + (i32.and + ;;@ ~lib/memory.ts:170:7 + (get_local $0) + ;;@ ~lib/memory.ts:170:14 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:170:23 + (block + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:171:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:171:16 + (i32.const 16) + ) + (block + ;;@ ~lib/memory.ts:172:6 + (i32.store + ;;@ ~lib/memory.ts:172:17 + (get_local $0) + ;;@ ~lib/memory.ts:172:28 + (i32.load + ;;@ ~lib/memory.ts:172:38 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:173:6 + (i32.store + ;;@ ~lib/memory.ts:173:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:173:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:173:28 + (i32.load + ;;@ ~lib/memory.ts:173:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:173:45 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:174:6 + (i32.store + ;;@ ~lib/memory.ts:174:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:174:25 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:174:28 + (i32.load + ;;@ ~lib/memory.ts:174:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:174:45 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:175:6 + (i32.store + ;;@ ~lib/memory.ts:175:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:175:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:175:28 + (i32.load + ;;@ ~lib/memory.ts:175:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:175:44 + (i32.const 12) + ) + ) + ) + ;;@ ~lib/memory.ts:176:6 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:176:13 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:176:17 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:176:25 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:176:29 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:176:34 + (i32.const 16) + ) + ) + (br $continue|1) + ) + ) + ) + ;;@ ~lib/memory.ts:178:4 + (if + ;;@ ~lib/memory.ts:178:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:178:12 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:178:15 + (block + ;;@ ~lib/memory.ts:179:6 + (i32.store + ;;@ ~lib/memory.ts:179:17 + (get_local $0) + ;;@ ~lib/memory.ts:179:27 + (i32.load + ;;@ ~lib/memory.ts:179:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:180:6 + (i32.store + ;;@ ~lib/memory.ts:180:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:180:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:180:27 + (i32.load + ;;@ ~lib/memory.ts:180:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:180:43 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:181:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:181:14 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:181:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:181:24 + (i32.const 8) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:183:4 + (if + ;;@ ~lib/memory.ts:183:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:183:12 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:183:15 + (block + ;;@ ~lib/memory.ts:184:6 + (i32.store + ;;@ ~lib/memory.ts:184:17 + (get_local $0) + ;;@ ~lib/memory.ts:184:23 + (i32.load + ;;@ ~lib/memory.ts:184:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:185:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:185:14 + (i32.const 4) + ) + ) + ;;@ ~lib/memory.ts:185:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:185:24 + (i32.const 4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:187:4 + (if + ;;@ ~lib/memory.ts:187:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:187:12 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:187:15 + (block + ;;@ ~lib/memory.ts:188:6 + (i32.store16 + ;;@ ~lib/memory.ts:188:17 + (get_local $0) + ;;@ ~lib/memory.ts:188:23 + (i32.load16_u + ;;@ ~lib/memory.ts:188:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:189:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:189:14 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:189:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:189:24 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:191:4 + (if + ;;@ ~lib/memory.ts:191:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:191:12 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:192:16 + (block + (set_local $3 + (get_local $0) + ) + ;;@ ~lib/memory.ts:191:15 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:192:33 + (block (result i32) + (set_local $3 + (get_local $1) + ) + ;;@ ~lib/memory.ts:192:24 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:194:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:199:2 + (if + ;;@ ~lib/memory.ts:199:6 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:199:11 + (i32.const 32) + ) + ;;@ ~lib/memory.ts:199:15 + (block $break|2 + (block $case2|2 + (block $case1|2 + (block $case0|2 + (block $tablify|0 + (br_table $case0|2 $case1|2 $case2|2 $tablify|0 + (i32.sub + ;;@ ~lib/memory.ts:200:12 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:200:19 + (i32.const 3) + ) + (i32.const 1) + ) + ) + ) + (br $break|2) + ) + ;;@ ~lib/memory.ts:203:8 + (set_local $4 + ;;@ ~lib/memory.ts:203:12 + (i32.load + ;;@ ~lib/memory.ts:203:22 + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:204:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:204:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:204:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:204:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:205:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:205:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:205:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:205:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:206:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:206:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:206:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:206:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:207:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:207:13 + (i32.const 3) + ) + ) + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:208:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:208:20 + (i32.const 17) + ) + (block + ;;@ ~lib/memory.ts:210:10 + (i32.store + ;;@ ~lib/memory.ts:210:21 + (get_local $0) + ;;@ ~lib/memory.ts:210:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:210:32 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:210:37 + (i32.shl + ;;@ ~lib/memory.ts:209:10 + (tee_local $3 + ;;@ ~lib/memory.ts:209:14 + (i32.load + ;;@ ~lib/memory.ts:209:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:209:30 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:210:42 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:212:10 + (i32.store + ;;@ ~lib/memory.ts:212:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:212:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:212:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:212:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:212:41 + (i32.shl + ;;@ ~lib/memory.ts:211:10 + (tee_local $4 + ;;@ ~lib/memory.ts:211:14 + (i32.load + ;;@ ~lib/memory.ts:211:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:211:30 + (i32.const 5) + ) + ) + ) + ;;@ ~lib/memory.ts:212:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:214:10 + (i32.store + ;;@ ~lib/memory.ts:214:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:214:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:214:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:214:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:214:41 + (i32.shl + ;;@ ~lib/memory.ts:213:10 + (tee_local $3 + ;;@ ~lib/memory.ts:213:14 + (i32.load + ;;@ ~lib/memory.ts:213:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:213:30 + (i32.const 9) + ) + ) + ) + ;;@ ~lib/memory.ts:214:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:216:10 + (i32.store + ;;@ ~lib/memory.ts:216:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:216:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:216:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:216:37 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:216:42 + (i32.shl + ;;@ ~lib/memory.ts:215:10 + (tee_local $4 + ;;@ ~lib/memory.ts:215:14 + (i32.load + ;;@ ~lib/memory.ts:215:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:215:30 + (i32.const 13) + ) + ) + ) + ;;@ ~lib/memory.ts:216:47 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:217:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:217:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:217:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:217:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:217:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:217:38 + (i32.const 16) + ) + ) + (br $continue|3) + ) + ) + ) + ;;@ ~lib/memory.ts:219:8 + (br $break|2) + ) + ;;@ ~lib/memory.ts:222:8 + (set_local $4 + ;;@ ~lib/memory.ts:222:12 + (i32.load + ;;@ ~lib/memory.ts:222:22 + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:223:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:223:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:223:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:223:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:224:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:224:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:224:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:224:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:225:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:225:13 + (i32.const 2) + ) + ) + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:226:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:226:20 + (i32.const 18) + ) + (block + ;;@ ~lib/memory.ts:228:10 + (i32.store + ;;@ ~lib/memory.ts:228:21 + (get_local $0) + ;;@ ~lib/memory.ts:228:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:228:32 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:228:37 + (i32.shl + ;;@ ~lib/memory.ts:227:10 + (tee_local $3 + ;;@ ~lib/memory.ts:227:14 + (i32.load + ;;@ ~lib/memory.ts:227:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:227:30 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/memory.ts:228:42 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:230:10 + (i32.store + ;;@ ~lib/memory.ts:230:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:230:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:230:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:230:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:230:41 + (i32.shl + ;;@ ~lib/memory.ts:229:10 + (tee_local $4 + ;;@ ~lib/memory.ts:229:14 + (i32.load + ;;@ ~lib/memory.ts:229:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:229:30 + (i32.const 6) + ) + ) + ) + ;;@ ~lib/memory.ts:230:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:232:10 + (i32.store + ;;@ ~lib/memory.ts:232:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:232:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:232:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:232:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:232:41 + (i32.shl + ;;@ ~lib/memory.ts:231:10 + (tee_local $3 + ;;@ ~lib/memory.ts:231:14 + (i32.load + ;;@ ~lib/memory.ts:231:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:231:30 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/memory.ts:232:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:234:10 + (i32.store + ;;@ ~lib/memory.ts:234:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:234:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:234:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:234:37 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:234:42 + (i32.shl + ;;@ ~lib/memory.ts:233:10 + (tee_local $4 + ;;@ ~lib/memory.ts:233:14 + (i32.load + ;;@ ~lib/memory.ts:233:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:233:30 + (i32.const 14) + ) + ) + ) + ;;@ ~lib/memory.ts:234:47 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:235:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:235:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:235:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:235:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:235:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:235:38 + (i32.const 16) + ) + ) + (br $continue|4) + ) + ) + ) + ;;@ ~lib/memory.ts:237:8 + (br $break|2) + ) + ;;@ ~lib/memory.ts:240:8 + (set_local $4 + ;;@ ~lib/memory.ts:240:12 + (i32.load + ;;@ ~lib/memory.ts:240:22 + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:241:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:241:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:241:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:241:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:242:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:242:13 + (i32.const 1) + ) + ) + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:243:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:243:20 + (i32.const 19) + ) + (block + ;;@ ~lib/memory.ts:245:10 + (i32.store + ;;@ ~lib/memory.ts:245:21 + (get_local $0) + ;;@ ~lib/memory.ts:245:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:245:32 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:245:36 + (i32.shl + ;;@ ~lib/memory.ts:244:10 + (tee_local $3 + ;;@ ~lib/memory.ts:244:14 + (i32.load + ;;@ ~lib/memory.ts:244:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:244:30 + (i32.const 3) + ) + ) + ) + ;;@ ~lib/memory.ts:245:41 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:247:10 + (i32.store + ;;@ ~lib/memory.ts:247:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:247:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:247:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:247:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:247:40 + (i32.shl + ;;@ ~lib/memory.ts:246:10 + (tee_local $4 + ;;@ ~lib/memory.ts:246:14 + (i32.load + ;;@ ~lib/memory.ts:246:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:246:30 + (i32.const 7) + ) + ) + ) + ;;@ ~lib/memory.ts:247:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:249:10 + (i32.store + ;;@ ~lib/memory.ts:249:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:249:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:249:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:249:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:249:40 + (i32.shl + ;;@ ~lib/memory.ts:248:10 + (tee_local $3 + ;;@ ~lib/memory.ts:248:14 + (i32.load + ;;@ ~lib/memory.ts:248:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:248:30 + (i32.const 11) + ) + ) + ) + ;;@ ~lib/memory.ts:249:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:251:10 + (i32.store + ;;@ ~lib/memory.ts:251:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:251:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:251:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:251:37 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:251:41 + (i32.shl + ;;@ ~lib/memory.ts:250:10 + (tee_local $4 + ;;@ ~lib/memory.ts:250:14 + (i32.load + ;;@ ~lib/memory.ts:250:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:250:30 + (i32.const 15) + ) + ) + ) + ;;@ ~lib/memory.ts:251:46 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:252:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:252:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:252:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:252:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:252:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:252:38 + (i32.const 16) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:260:2 + (if + ;;@ ~lib/memory.ts:260:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:260:10 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:260:14 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:261:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:261:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:261:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:261:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:262:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:262:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:262:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:262:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:263:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:263:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:263:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:263:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:264:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:264:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:264:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:264:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:265:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:265:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:265:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:265:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:266:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:266:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:266:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:266:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:267:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:267:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:267:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:267:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:268:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:268:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:268:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:268:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:269:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:269:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:269:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:269:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:270:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:270:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:270:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:270:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:271:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:271:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:271:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:271:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:272:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:272:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:272:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:272:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:273:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:273:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:273:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:273:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:274:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:274:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:274:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:274:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:275:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:275:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:275:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:275:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:276:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:276:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:276:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:276:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:278:2 + (if + ;;@ ~lib/memory.ts:278:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:278:10 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:278:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:279:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:279:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:279:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:279:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:280:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:280:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:280:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:280:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:281:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:281:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:281:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:281:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:282:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:282:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:282:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:282:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:283:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:283:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:283:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:283:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:284:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:284:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:284:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:284:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:285:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:285:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:285:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:285:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:286:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:286:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:286:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:286:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:288:2 + (if + ;;@ ~lib/memory.ts:288:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:288:10 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:288:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:289:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:289:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:289:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:289:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:290:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:290:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:290:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:290:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:291:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:291:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:291:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:291:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:292:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:292:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:292:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:292:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:294:2 + (if + ;;@ ~lib/memory.ts:294:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:294:10 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:294:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:295:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:295:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:295:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:295:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:296:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:296:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:296:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:296:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:298:2 + (if + ;;@ ~lib/memory.ts:298:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:298:10 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:299:14 + (block + (set_local $3 + (get_local $0) + ) + ;;@ ~lib/memory.ts:298:13 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:299:31 + (block (result i32) + (set_local $3 + (get_local $1) + ) + ;;@ ~lib/memory.ts:299:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.copy (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + ;;@ ~lib/memory.ts:79:4 + (if + ;;@ ~lib/memory.ts:79:8 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:79:16 + (get_local $1) + ) + ;;@ ~lib/memory.ts:79:21 + (return) + ) + ;;@ ~lib/memory.ts:80:4 + (if + ;;@ ~lib/memory.ts:80:8 + (if (result i32) + (tee_local $3 + (i32.le_u + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:80:14 + (get_local $2) + ) + ;;@ ~lib/memory.ts:80:19 + (get_local $0) + ) + ) + (get_local $3) + ;;@ ~lib/memory.ts:80:27 + (i32.le_u + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:80:34 + (get_local $2) + ) + ;;@ ~lib/memory.ts:80:39 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:80:44 + (block + ;;@ ~lib/memory.ts:81:6 + (call $~lib/memory/memcpy + ;;@ ~lib/memory.ts:81:13 + (get_local $0) + ;;@ ~lib/memory.ts:81:19 + (get_local $1) + ;;@ ~lib/memory.ts:81:24 + (get_local $2) + ) + ;;@ ~lib/memory.ts:82:6 + (return) + ) + ) + ;;@ ~lib/memory.ts:84:4 + (if + ;;@ ~lib/memory.ts:84:8 + (i32.lt_u + (get_local $0) + ;;@ ~lib/memory.ts:84:15 + (get_local $1) + ) + ;;@ ~lib/memory.ts:84:20 + (block + ;;@ ~lib/memory.ts:85:6 + (if + ;;@ ~lib/memory.ts:85:10 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:85:11 + (get_local $1) + ;;@ ~lib/memory.ts:85:17 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:85:23 + (i32.and + ;;@ ~lib/memory.ts:85:24 + (get_local $0) + ;;@ ~lib/memory.ts:85:31 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:85:35 + (block + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:86:15 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:86:22 + (i32.const 7) + ) + (block + ;;@ ~lib/memory.ts:87:10 + (if + ;;@ ~lib/memory.ts:87:14 + (i32.eqz + ;;@ ~lib/memory.ts:87:15 + (get_local $2) + ) + ;;@ ~lib/memory.ts:87:18 + (return) + ) + ;;@ ~lib/memory.ts:88:10 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:88:12 + (get_local $2) + (i32.const 1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:89:20 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:89:10 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:89:37 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:89:28 + (i32.load8_u + (get_local $3) + ) + ) + ) + (br $continue|0) + ) + ) + ) + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:91:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:91:20 + (i32.const 8) + ) + (block + ;;@ ~lib/memory.ts:92:10 + (i64.store + ;;@ ~lib/memory.ts:92:21 + (get_local $0) + ;;@ ~lib/memory.ts:92:27 + (i64.load + ;;@ ~lib/memory.ts:92:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:93:10 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:93:18 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:94:10 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:94:18 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:95:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:95:18 + (i32.const 8) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ) + (loop $continue|2 + (if + ;;@ ~lib/memory.ts:98:13 + (get_local $2) + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:99:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:99:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:99:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:99:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:100:8 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:100:10 + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:102:11 + (block + ;;@ ~lib/memory.ts:103:6 + (if + ;;@ ~lib/memory.ts:103:10 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:103:11 + (get_local $1) + ;;@ ~lib/memory.ts:103:17 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:103:23 + (i32.and + ;;@ ~lib/memory.ts:103:24 + (get_local $0) + ;;@ ~lib/memory.ts:103:31 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:103:35 + (block + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:104:15 + (i32.and + (i32.add + ;;@ ~lib/memory.ts:104:16 + (get_local $0) + ;;@ ~lib/memory.ts:104:23 + (get_local $2) + ) + ;;@ ~lib/memory.ts:104:28 + (i32.const 7) + ) + (block + ;;@ ~lib/memory.ts:105:10 + (if + ;;@ ~lib/memory.ts:105:14 + (i32.eqz + ;;@ ~lib/memory.ts:105:15 + (get_local $2) + ) + ;;@ ~lib/memory.ts:105:18 + (return) + ) + ;;@ ~lib/memory.ts:106:10 + (i32.store8 + ;;@ ~lib/memory.ts:106:20 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:106:27 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:106:29 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:106:32 + (i32.load8_u + ;;@ ~lib/memory.ts:106:41 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:106:47 + (get_local $2) + ) + ) + ) + (br $continue|3) + ) + ) + ) + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:108:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:108:20 + (i32.const 8) + ) + (block + ;;@ ~lib/memory.ts:110:10 + (i64.store + ;;@ ~lib/memory.ts:110:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:109:10 + (tee_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:109:15 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:110:31 + (i64.load + ;;@ ~lib/memory.ts:110:41 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:110:47 + (get_local $2) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ) + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:113:13 + (get_local $2) + (block + ;;@ ~lib/memory.ts:113:16 + (i32.store8 + ;;@ ~lib/memory.ts:114:18 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:114:25 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:114:27 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:114:30 + (i32.load8_u + ;;@ ~lib/memory.ts:114:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:114:45 + (get_local $2) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.compare (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + ;;@ ~lib/memory.ts:122:4 + (if + ;;@ ~lib/memory.ts:122:8 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:122:14 + (get_local $1) + ) + ;;@ ~lib/memory.ts:122:25 + (return + (i32.const 0) + ) + ) + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:123:11 + (if (result i32) + (tee_local $3 + (i32.ne + (get_local $2) + ;;@ ~lib/memory.ts:123:16 + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:123:21 + (i32.eq + (i32.load8_u + ;;@ ~lib/memory.ts:123:30 + (get_local $0) + ) + ;;@ ~lib/memory.ts:123:37 + (i32.load8_u + ;;@ ~lib/memory.ts:123:46 + (get_local $1) + ) + ) + (get_local $3) + ) + (block + ;;@ ~lib/memory.ts:124:6 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:124:11 + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:124:17 + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ;;@ ~lib/memory.ts:126:55 + (if (result i32) + ;;@ ~lib/memory.ts:126:11 + (get_local $2) + ;;@ ~lib/memory.ts:126:15 + (i32.sub + (i32.load8_u + ;;@ ~lib/memory.ts:126:29 + (get_local $0) + ) + ;;@ ~lib/memory.ts:126:35 + (i32.load8_u + ;;@ ~lib/memory.ts:126:49 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:126:55 + (i32.const 0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -62,7 +3069,6 @@ (i32.shl ;;@ ~lib/allocator/arena.ts:21:4 (tee_local $2 - ;;@ ~lib/allocator/arena.ts:21:22 (current_memory) ) ;;@ ~lib/allocator/arena.ts:22:39 @@ -141,17 +3147,22 @@ ;;@ ~lib/allocator/arena.ts:34:9 (i32.const 0) ) - (func $~lib/allocator/arena/free_memory (; 1 ;) (type $iv) (param $0 i32) + (func $~lib/memory/memory.allocate (; 7 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:142:45 + (call $~lib/allocator/arena/__memory_allocate + ;;@ ~lib/memory.ts:142:63 + (get_local $0) + ) + ) + (func $~lib/memory/memory.free (; 8 ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/allocator/arena/reset_memory (; 2 ;) (type $v) - ;;@ ~lib/allocator/arena.ts:44:2 + (func $~lib/memory/memory.reset (; 9 ;) (type $v) (set_global $~lib/allocator/arena/offset - ;;@ ~lib/allocator/arena.ts:44:11 (get_global $~lib/allocator/arena/startOffset) ) ) - (func $start (; 3 ;) (type $v) + (func $start (; 10 ;) (type $v) (set_global $~lib/allocator/arena/startOffset ;;@ ~lib/allocator/arena.ts:12:25 (i32.and diff --git a/tests/allocators/arena/untouched.wat b/tests/allocators/arena/untouched.wat index 069c399f..543ab5ec 100644 --- a/tests/allocators/arena/untouched.wat +++ b/tests/allocators/arena/untouched.wat @@ -1,5 +1,8 @@ (module + (type $i (func (result i32))) (type $ii (func (param i32) (result i32))) + (type $iiiv (func (param i32 i32 i32))) + (type $iiii (func (param i32 i32 i32) (result i32))) (type $iv (func (param i32))) (type $v (func)) (global $~lib/internal/allocator/AL_BITS i32 (i32.const 3)) @@ -10,12 +13,3317 @@ (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) - (export "allocate_memory" (func $~lib/allocator/arena/allocate_memory)) - (export "free_memory" (func $~lib/allocator/arena/free_memory)) - (export "reset_memory" (func $~lib/allocator/arena/reset_memory)) + (export "memory.size" (func $~lib/memory/memory.size)) + (export "memory.grow" (func $~lib/memory/memory.grow)) + (export "memory.fill" (func $~lib/memory/memory.fill)) + (export "memory.copy" (func $~lib/memory/memory.copy)) + (export "memory.compare" (func $~lib/memory/memory.compare)) + (export "memory.allocate" (func $~lib/memory/memory.allocate)) + (export "memory.free" (func $~lib/memory/memory.free)) + (export "memory.reset" (func $~lib/memory/memory.reset)) (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 0 ;) (type $i) (result i32) + ;;@ ~lib/memory.ts:4:25 + (current_memory) + ) + (func $~lib/memory/memory.grow (; 1 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:8:30 + (grow_memory + ;;@ ~lib/memory.ts:8:25 + (get_local $0) + ) + ) + (func $~lib/memory/memory.fill (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i64) + ;;@ ~lib/memory.ts:17:4 + (if + ;;@ ~lib/memory.ts:17:8 + (i32.eqz + ;;@ ~lib/memory.ts:17:9 + (get_local $2) + ) + ;;@ ~lib/memory.ts:17:12 + (return) + ) + ;;@ ~lib/memory.ts:18:4 + (i32.store8 + ;;@ ~lib/memory.ts:18:14 + (get_local $0) + ;;@ ~lib/memory.ts:18:20 + (get_local $1) + ) + ;;@ ~lib/memory.ts:19:4 + (i32.store8 + ;;@ ~lib/memory.ts:19:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:19:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:19:25 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:19:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:20:4 + (if + ;;@ ~lib/memory.ts:20:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:20:13 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:20:16 + (return) + ) + ;;@ ~lib/memory.ts:22:4 + (i32.store8 + ;;@ ~lib/memory.ts:22:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:22:21 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:22:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:23:4 + (i32.store8 + ;;@ ~lib/memory.ts:23:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:23:21 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:23:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:24:4 + (i32.store8 + ;;@ ~lib/memory.ts:24:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:24:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:24:25 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:24:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:25:4 + (i32.store8 + ;;@ ~lib/memory.ts:25:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:25:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:25:25 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:25:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:26:4 + (if + ;;@ ~lib/memory.ts:26:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:26:13 + (i32.const 6) + ) + ;;@ ~lib/memory.ts:26:16 + (return) + ) + ;;@ ~lib/memory.ts:27:4 + (i32.store8 + ;;@ ~lib/memory.ts:27:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:27:21 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:27:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:28:4 + (i32.store8 + ;;@ ~lib/memory.ts:28:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:28:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:28:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:28:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:29:4 + (if + ;;@ ~lib/memory.ts:29:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:29:13 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:29:16 + (return) + ) + ;;@ ~lib/memory.ts:32:4 + (set_local $3 + ;;@ ~lib/memory.ts:32:19 + (i32.and + (i32.sub + (i32.const 0) + ;;@ ~lib/memory.ts:32:20 + (get_local $0) + ) + ;;@ ~lib/memory.ts:32:27 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:33:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:33:12 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:34:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:34:9 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:35:4 + (set_local $2 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:35:9 + (i32.const -4) + ) + ) + ;;@ ~lib/memory.ts:37:4 + (set_local $4 + ;;@ ~lib/memory.ts:37:19 + (i32.mul + (i32.div_u + (i32.const -1) + ;;@ ~lib/memory.ts:37:29 + (i32.const 255) + ) + (i32.and + ;;@ ~lib/memory.ts:37:35 + (get_local $1) + (i32.const 255) + ) + ) + ) + ;;@ ~lib/memory.ts:40:4 + (i32.store + ;;@ ~lib/memory.ts:40:15 + (get_local $0) + ;;@ ~lib/memory.ts:40:21 + (get_local $4) + ) + ;;@ ~lib/memory.ts:41:4 + (i32.store + ;;@ ~lib/memory.ts:41:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:41:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:41:26 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:41:29 + (get_local $4) + ) + ;;@ ~lib/memory.ts:42:4 + (if + ;;@ ~lib/memory.ts:42:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:42:13 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:42:16 + (return) + ) + ;;@ ~lib/memory.ts:43:4 + (i32.store + ;;@ ~lib/memory.ts:43:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:43:22 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:43:25 + (get_local $4) + ) + ;;@ ~lib/memory.ts:44:4 + (i32.store + ;;@ ~lib/memory.ts:44:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:44:22 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:44:25 + (get_local $4) + ) + ;;@ ~lib/memory.ts:45:4 + (i32.store + ;;@ ~lib/memory.ts:45:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:45:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:45:26 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:45:30 + (get_local $4) + ) + ;;@ ~lib/memory.ts:46:4 + (i32.store + ;;@ ~lib/memory.ts:46:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:46:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:46:26 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:46:29 + (get_local $4) + ) + ;;@ ~lib/memory.ts:47:4 + (if + ;;@ ~lib/memory.ts:47:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:47:13 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:47:17 + (return) + ) + ;;@ ~lib/memory.ts:48:4 + (i32.store + ;;@ ~lib/memory.ts:48:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:48:22 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:48:26 + (get_local $4) + ) + ;;@ ~lib/memory.ts:49:4 + (i32.store + ;;@ ~lib/memory.ts:49:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:49:22 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:49:26 + (get_local $4) + ) + ;;@ ~lib/memory.ts:50:4 + (i32.store + ;;@ ~lib/memory.ts:50:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:50:22 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:50:26 + (get_local $4) + ) + ;;@ ~lib/memory.ts:51:4 + (i32.store + ;;@ ~lib/memory.ts:51:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:51:22 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:51:26 + (get_local $4) + ) + ;;@ ~lib/memory.ts:52:4 + (i32.store + ;;@ ~lib/memory.ts:52:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:52:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:52:26 + (i32.const 28) + ) + ;;@ ~lib/memory.ts:52:30 + (get_local $4) + ) + ;;@ ~lib/memory.ts:53:4 + (i32.store + ;;@ ~lib/memory.ts:53:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:53:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:53:26 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:53:30 + (get_local $4) + ) + ;;@ ~lib/memory.ts:54:4 + (i32.store + ;;@ ~lib/memory.ts:54:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:54:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:54:26 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:54:30 + (get_local $4) + ) + ;;@ ~lib/memory.ts:55:4 + (i32.store + ;;@ ~lib/memory.ts:55:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:55:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:55:26 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:55:30 + (get_local $4) + ) + ;;@ ~lib/memory.ts:58:4 + (set_local $3 + ;;@ ~lib/memory.ts:58:8 + (i32.add + (i32.const 24) + ;;@ ~lib/memory.ts:58:13 + (i32.and + ;;@ ~lib/memory.ts:58:14 + (get_local $0) + ;;@ ~lib/memory.ts:58:21 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:59:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:59:12 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:60:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:60:9 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:63:4 + (set_local $5 + ;;@ ~lib/memory.ts:63:19 + (i64.or + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/memory.ts:63:30 + (i64.shl + ;;@ ~lib/memory.ts:63:31 + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/memory.ts:63:43 + (i64.const 32) + ) + ) + ) + ;;@ ~lib/memory.ts:64:4 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:64:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:64:16 + (i32.const 32) + ) + (block + (block + ;;@ ~lib/memory.ts:65:6 + (i64.store + ;;@ ~lib/memory.ts:65:17 + (get_local $0) + ;;@ ~lib/memory.ts:65:23 + (get_local $5) + ) + ;;@ ~lib/memory.ts:66:6 + (i64.store + ;;@ ~lib/memory.ts:66:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:66:24 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:66:27 + (get_local $5) + ) + ;;@ ~lib/memory.ts:67:6 + (i64.store + ;;@ ~lib/memory.ts:67:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:67:24 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:67:28 + (get_local $5) + ) + ;;@ ~lib/memory.ts:68:6 + (i64.store + ;;@ ~lib/memory.ts:68:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:68:24 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:68:28 + (get_local $5) + ) + ;;@ ~lib/memory.ts:69:6 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:69:11 + (i32.const 32) + ) + ) + ;;@ ~lib/memory.ts:70:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:70:14 + (i32.const 32) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ) + (func $~lib/memory/memcpy (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + ;;@ ~lib/memory.ts:164:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:164:9 + (if (result i32) + (get_local $2) + ;;@ ~lib/memory.ts:164:14 + (i32.and + ;;@ ~lib/memory.ts:164:15 + (get_local $1) + ;;@ ~lib/memory.ts:164:21 + (i32.const 3) + ) + (get_local $2) + ) + (block + (block + ;;@ ~lib/memory.ts:165:4 + (i32.store8 + ;;@ ~lib/memory.ts:165:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:165:22 + (i32.load8_u + ;;@ ~lib/memory.ts:165:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:166:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:170:2 + (if + ;;@ ~lib/memory.ts:170:6 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:170:7 + (get_local $0) + ;;@ ~lib/memory.ts:170:14 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:170:20 + (i32.const 0) + ) + ;;@ ~lib/memory.ts:170:23 + (block + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:171:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:171:16 + (i32.const 16) + ) + (block + (block + ;;@ ~lib/memory.ts:172:6 + (i32.store + ;;@ ~lib/memory.ts:172:17 + (get_local $0) + ;;@ ~lib/memory.ts:172:28 + (i32.load + ;;@ ~lib/memory.ts:172:38 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:173:6 + (i32.store + ;;@ ~lib/memory.ts:173:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:173:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:173:28 + (i32.load + ;;@ ~lib/memory.ts:173:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:173:45 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:174:6 + (i32.store + ;;@ ~lib/memory.ts:174:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:174:25 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:174:28 + (i32.load + ;;@ ~lib/memory.ts:174:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:174:45 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:175:6 + (i32.store + ;;@ ~lib/memory.ts:175:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:175:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:175:28 + (i32.load + ;;@ ~lib/memory.ts:175:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:175:44 + (i32.const 12) + ) + ) + ) + ;;@ ~lib/memory.ts:176:6 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:176:13 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:176:17 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:176:25 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:176:29 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:176:34 + (i32.const 16) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:178:4 + (if + ;;@ ~lib/memory.ts:178:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:178:12 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:178:15 + (block + ;;@ ~lib/memory.ts:179:6 + (i32.store + ;;@ ~lib/memory.ts:179:17 + (get_local $0) + ;;@ ~lib/memory.ts:179:27 + (i32.load + ;;@ ~lib/memory.ts:179:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:180:6 + (i32.store + ;;@ ~lib/memory.ts:180:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:180:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:180:27 + (i32.load + ;;@ ~lib/memory.ts:180:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:180:43 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:181:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:181:14 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:181:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:181:24 + (i32.const 8) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:183:4 + (if + ;;@ ~lib/memory.ts:183:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:183:12 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:183:15 + (block + ;;@ ~lib/memory.ts:184:6 + (i32.store + ;;@ ~lib/memory.ts:184:17 + (get_local $0) + ;;@ ~lib/memory.ts:184:23 + (i32.load + ;;@ ~lib/memory.ts:184:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:185:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:185:14 + (i32.const 4) + ) + ) + ;;@ ~lib/memory.ts:185:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:185:24 + (i32.const 4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:187:4 + (if + ;;@ ~lib/memory.ts:187:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:187:12 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:187:15 + (block + ;;@ ~lib/memory.ts:188:6 + (i32.store16 + ;;@ ~lib/memory.ts:188:17 + (get_local $0) + ;;@ ~lib/memory.ts:188:23 + (i32.load16_u + ;;@ ~lib/memory.ts:188:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:189:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:189:14 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:189:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:189:24 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:191:4 + (if + ;;@ ~lib/memory.ts:191:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:191:12 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:191:15 + (i32.store8 + ;;@ ~lib/memory.ts:192:16 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:192:24 + (i32.load8_u + ;;@ ~lib/memory.ts:192:33 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:194:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:199:2 + (if + ;;@ ~lib/memory.ts:199:6 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:199:11 + (i32.const 32) + ) + ;;@ ~lib/memory.ts:199:15 + (block $break|2 + (block $case2|2 + (block $case1|2 + (block $case0|2 + (set_local $5 + ;;@ ~lib/memory.ts:200:12 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:200:19 + (i32.const 3) + ) + ) + (br_if $case0|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:202:11 + (i32.const 1) + ) + ) + (br_if $case1|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:221:11 + (i32.const 2) + ) + ) + (br_if $case2|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:239:11 + (i32.const 3) + ) + ) + (br $break|2) + ) + ;;@ ~lib/memory.ts:202:14 + (block + ;;@ ~lib/memory.ts:203:8 + (set_local $3 + ;;@ ~lib/memory.ts:203:12 + (i32.load + ;;@ ~lib/memory.ts:203:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:204:8 + (i32.store8 + ;;@ ~lib/memory.ts:204:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:204:26 + (i32.load8_u + ;;@ ~lib/memory.ts:204:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:205:8 + (i32.store8 + ;;@ ~lib/memory.ts:205:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:205:26 + (i32.load8_u + ;;@ ~lib/memory.ts:205:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:206:8 + (i32.store8 + ;;@ ~lib/memory.ts:206:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:206:26 + (i32.load8_u + ;;@ ~lib/memory.ts:206:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:207:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:207:13 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:208:8 + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:208:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:208:20 + (i32.const 17) + ) + (block + (block + ;;@ ~lib/memory.ts:209:10 + (set_local $4 + ;;@ ~lib/memory.ts:209:14 + (i32.load + ;;@ ~lib/memory.ts:209:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:209:30 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:210:10 + (i32.store + ;;@ ~lib/memory.ts:210:21 + (get_local $0) + ;;@ ~lib/memory.ts:210:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:210:32 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:210:37 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:210:42 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:211:10 + (set_local $3 + ;;@ ~lib/memory.ts:211:14 + (i32.load + ;;@ ~lib/memory.ts:211:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:211:30 + (i32.const 5) + ) + ) + ) + ;;@ ~lib/memory.ts:212:10 + (i32.store + ;;@ ~lib/memory.ts:212:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:212:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:212:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:212:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:212:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:212:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:213:10 + (set_local $4 + ;;@ ~lib/memory.ts:213:14 + (i32.load + ;;@ ~lib/memory.ts:213:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:213:30 + (i32.const 9) + ) + ) + ) + ;;@ ~lib/memory.ts:214:10 + (i32.store + ;;@ ~lib/memory.ts:214:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:214:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:214:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:214:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:214:41 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:214:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:215:10 + (set_local $3 + ;;@ ~lib/memory.ts:215:14 + (i32.load + ;;@ ~lib/memory.ts:215:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:215:30 + (i32.const 13) + ) + ) + ) + ;;@ ~lib/memory.ts:216:10 + (i32.store + ;;@ ~lib/memory.ts:216:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:216:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:216:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:216:37 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:216:42 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:216:47 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:217:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:217:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:217:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:217:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:217:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:217:38 + (i32.const 16) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:219:8 + (br $break|2) + ) + ) + ;;@ ~lib/memory.ts:221:14 + (block + ;;@ ~lib/memory.ts:222:8 + (set_local $3 + ;;@ ~lib/memory.ts:222:12 + (i32.load + ;;@ ~lib/memory.ts:222:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:223:8 + (i32.store8 + ;;@ ~lib/memory.ts:223:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:223:26 + (i32.load8_u + ;;@ ~lib/memory.ts:223:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:224:8 + (i32.store8 + ;;@ ~lib/memory.ts:224:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:224:26 + (i32.load8_u + ;;@ ~lib/memory.ts:224:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:225:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:225:13 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:226:8 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:226:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:226:20 + (i32.const 18) + ) + (block + (block + ;;@ ~lib/memory.ts:227:10 + (set_local $4 + ;;@ ~lib/memory.ts:227:14 + (i32.load + ;;@ ~lib/memory.ts:227:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:227:30 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/memory.ts:228:10 + (i32.store + ;;@ ~lib/memory.ts:228:21 + (get_local $0) + ;;@ ~lib/memory.ts:228:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:228:32 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:228:37 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:228:42 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:229:10 + (set_local $3 + ;;@ ~lib/memory.ts:229:14 + (i32.load + ;;@ ~lib/memory.ts:229:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:229:30 + (i32.const 6) + ) + ) + ) + ;;@ ~lib/memory.ts:230:10 + (i32.store + ;;@ ~lib/memory.ts:230:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:230:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:230:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:230:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:230:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:230:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:231:10 + (set_local $4 + ;;@ ~lib/memory.ts:231:14 + (i32.load + ;;@ ~lib/memory.ts:231:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:231:30 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/memory.ts:232:10 + (i32.store + ;;@ ~lib/memory.ts:232:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:232:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:232:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:232:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:232:41 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:232:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:233:10 + (set_local $3 + ;;@ ~lib/memory.ts:233:14 + (i32.load + ;;@ ~lib/memory.ts:233:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:233:30 + (i32.const 14) + ) + ) + ) + ;;@ ~lib/memory.ts:234:10 + (i32.store + ;;@ ~lib/memory.ts:234:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:234:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:234:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:234:37 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:234:42 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:234:47 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:235:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:235:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:235:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:235:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:235:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:235:38 + (i32.const 16) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:237:8 + (br $break|2) + ) + ) + ;;@ ~lib/memory.ts:239:14 + (block + ;;@ ~lib/memory.ts:240:8 + (set_local $3 + ;;@ ~lib/memory.ts:240:12 + (i32.load + ;;@ ~lib/memory.ts:240:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:241:8 + (i32.store8 + ;;@ ~lib/memory.ts:241:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:241:26 + (i32.load8_u + ;;@ ~lib/memory.ts:241:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:242:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:242:13 + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:243:8 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:243:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:243:20 + (i32.const 19) + ) + (block + (block + ;;@ ~lib/memory.ts:244:10 + (set_local $4 + ;;@ ~lib/memory.ts:244:14 + (i32.load + ;;@ ~lib/memory.ts:244:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:244:30 + (i32.const 3) + ) + ) + ) + ;;@ ~lib/memory.ts:245:10 + (i32.store + ;;@ ~lib/memory.ts:245:21 + (get_local $0) + ;;@ ~lib/memory.ts:245:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:245:32 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:245:36 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:245:41 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:246:10 + (set_local $3 + ;;@ ~lib/memory.ts:246:14 + (i32.load + ;;@ ~lib/memory.ts:246:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:246:30 + (i32.const 7) + ) + ) + ) + ;;@ ~lib/memory.ts:247:10 + (i32.store + ;;@ ~lib/memory.ts:247:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:247:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:247:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:247:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:247:40 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:247:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:248:10 + (set_local $4 + ;;@ ~lib/memory.ts:248:14 + (i32.load + ;;@ ~lib/memory.ts:248:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:248:30 + (i32.const 11) + ) + ) + ) + ;;@ ~lib/memory.ts:249:10 + (i32.store + ;;@ ~lib/memory.ts:249:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:249:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:249:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:249:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:249:40 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:249:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:250:10 + (set_local $3 + ;;@ ~lib/memory.ts:250:14 + (i32.load + ;;@ ~lib/memory.ts:250:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:250:30 + (i32.const 15) + ) + ) + ) + ;;@ ~lib/memory.ts:251:10 + (i32.store + ;;@ ~lib/memory.ts:251:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:251:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:251:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:251:37 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:251:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:251:46 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:252:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:252:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:252:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:252:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:252:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:252:38 + (i32.const 16) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:254:8 + (br $break|2) + ) + ) + ) + ;;@ ~lib/memory.ts:260:2 + (if + ;;@ ~lib/memory.ts:260:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:260:10 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:260:14 + (block + ;;@ ~lib/memory.ts:261:4 + (i32.store8 + ;;@ ~lib/memory.ts:261:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:261:22 + (i32.load8_u + ;;@ ~lib/memory.ts:261:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:262:4 + (i32.store8 + ;;@ ~lib/memory.ts:262:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:262:22 + (i32.load8_u + ;;@ ~lib/memory.ts:262:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:263:4 + (i32.store8 + ;;@ ~lib/memory.ts:263:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:263:22 + (i32.load8_u + ;;@ ~lib/memory.ts:263:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:264:4 + (i32.store8 + ;;@ ~lib/memory.ts:264:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:264:22 + (i32.load8_u + ;;@ ~lib/memory.ts:264:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:265:4 + (i32.store8 + ;;@ ~lib/memory.ts:265:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:265:22 + (i32.load8_u + ;;@ ~lib/memory.ts:265:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:266:4 + (i32.store8 + ;;@ ~lib/memory.ts:266:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:266:22 + (i32.load8_u + ;;@ ~lib/memory.ts:266:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:267:4 + (i32.store8 + ;;@ ~lib/memory.ts:267:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:267:22 + (i32.load8_u + ;;@ ~lib/memory.ts:267:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:268:4 + (i32.store8 + ;;@ ~lib/memory.ts:268:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:268:22 + (i32.load8_u + ;;@ ~lib/memory.ts:268:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:269:4 + (i32.store8 + ;;@ ~lib/memory.ts:269:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:269:22 + (i32.load8_u + ;;@ ~lib/memory.ts:269:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:270:4 + (i32.store8 + ;;@ ~lib/memory.ts:270:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:270:22 + (i32.load8_u + ;;@ ~lib/memory.ts:270:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:271:4 + (i32.store8 + ;;@ ~lib/memory.ts:271:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:271:22 + (i32.load8_u + ;;@ ~lib/memory.ts:271:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:272:4 + (i32.store8 + ;;@ ~lib/memory.ts:272:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:272:22 + (i32.load8_u + ;;@ ~lib/memory.ts:272:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:273:4 + (i32.store8 + ;;@ ~lib/memory.ts:273:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:273:22 + (i32.load8_u + ;;@ ~lib/memory.ts:273:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:274:4 + (i32.store8 + ;;@ ~lib/memory.ts:274:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:274:22 + (i32.load8_u + ;;@ ~lib/memory.ts:274:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:275:4 + (i32.store8 + ;;@ ~lib/memory.ts:275:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:275:22 + (i32.load8_u + ;;@ ~lib/memory.ts:275:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:276:4 + (i32.store8 + ;;@ ~lib/memory.ts:276:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:276:22 + (i32.load8_u + ;;@ ~lib/memory.ts:276:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:278:2 + (if + ;;@ ~lib/memory.ts:278:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:278:10 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:278:13 + (block + ;;@ ~lib/memory.ts:279:4 + (i32.store8 + ;;@ ~lib/memory.ts:279:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:279:22 + (i32.load8_u + ;;@ ~lib/memory.ts:279:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:280:4 + (i32.store8 + ;;@ ~lib/memory.ts:280:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:280:22 + (i32.load8_u + ;;@ ~lib/memory.ts:280:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:281:4 + (i32.store8 + ;;@ ~lib/memory.ts:281:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:281:22 + (i32.load8_u + ;;@ ~lib/memory.ts:281:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:282:4 + (i32.store8 + ;;@ ~lib/memory.ts:282:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:282:22 + (i32.load8_u + ;;@ ~lib/memory.ts:282:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:283:4 + (i32.store8 + ;;@ ~lib/memory.ts:283:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:283:22 + (i32.load8_u + ;;@ ~lib/memory.ts:283:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:284:4 + (i32.store8 + ;;@ ~lib/memory.ts:284:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:284:22 + (i32.load8_u + ;;@ ~lib/memory.ts:284:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:285:4 + (i32.store8 + ;;@ ~lib/memory.ts:285:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:285:22 + (i32.load8_u + ;;@ ~lib/memory.ts:285:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:286:4 + (i32.store8 + ;;@ ~lib/memory.ts:286:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:286:22 + (i32.load8_u + ;;@ ~lib/memory.ts:286:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:288:2 + (if + ;;@ ~lib/memory.ts:288:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:288:10 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:288:13 + (block + ;;@ ~lib/memory.ts:289:4 + (i32.store8 + ;;@ ~lib/memory.ts:289:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:289:22 + (i32.load8_u + ;;@ ~lib/memory.ts:289:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:290:4 + (i32.store8 + ;;@ ~lib/memory.ts:290:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:290:22 + (i32.load8_u + ;;@ ~lib/memory.ts:290:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:291:4 + (i32.store8 + ;;@ ~lib/memory.ts:291:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:291:22 + (i32.load8_u + ;;@ ~lib/memory.ts:291:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:292:4 + (i32.store8 + ;;@ ~lib/memory.ts:292:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:292:22 + (i32.load8_u + ;;@ ~lib/memory.ts:292:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:294:2 + (if + ;;@ ~lib/memory.ts:294:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:294:10 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:294:13 + (block + ;;@ ~lib/memory.ts:295:4 + (i32.store8 + ;;@ ~lib/memory.ts:295:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:295:22 + (i32.load8_u + ;;@ ~lib/memory.ts:295:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:296:4 + (i32.store8 + ;;@ ~lib/memory.ts:296:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:296:22 + (i32.load8_u + ;;@ ~lib/memory.ts:296:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:298:2 + (if + ;;@ ~lib/memory.ts:298:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:298:10 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:298:13 + (i32.store8 + ;;@ ~lib/memory.ts:299:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:299:22 + (i32.load8_u + ;;@ ~lib/memory.ts:299:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.copy (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + ;;@ ~lib/memory.ts:79:4 + (if + ;;@ ~lib/memory.ts:79:8 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:79:16 + (get_local $1) + ) + ;;@ ~lib/memory.ts:79:21 + (return) + ) + ;;@ ~lib/memory.ts:80:4 + (if + ;;@ ~lib/memory.ts:80:8 + (if (result i32) + (tee_local $3 + (i32.le_u + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:80:14 + (get_local $2) + ) + ;;@ ~lib/memory.ts:80:19 + (get_local $0) + ) + ) + (get_local $3) + ;;@ ~lib/memory.ts:80:27 + (i32.le_u + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:80:34 + (get_local $2) + ) + ;;@ ~lib/memory.ts:80:39 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:80:44 + (block + ;;@ ~lib/memory.ts:81:6 + (call $~lib/memory/memcpy + ;;@ ~lib/memory.ts:81:13 + (get_local $0) + ;;@ ~lib/memory.ts:81:19 + (get_local $1) + ;;@ ~lib/memory.ts:81:24 + (get_local $2) + ) + ;;@ ~lib/memory.ts:82:6 + (return) + ) + ) + ;;@ ~lib/memory.ts:84:4 + (if + ;;@ ~lib/memory.ts:84:8 + (i32.lt_u + (get_local $0) + ;;@ ~lib/memory.ts:84:15 + (get_local $1) + ) + ;;@ ~lib/memory.ts:84:20 + (block + ;;@ ~lib/memory.ts:85:6 + (if + ;;@ ~lib/memory.ts:85:10 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:85:11 + (get_local $1) + ;;@ ~lib/memory.ts:85:17 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:85:23 + (i32.and + ;;@ ~lib/memory.ts:85:24 + (get_local $0) + ;;@ ~lib/memory.ts:85:31 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:85:35 + (block + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:86:15 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:86:22 + (i32.const 7) + ) + (block + (block + ;;@ ~lib/memory.ts:87:10 + (if + ;;@ ~lib/memory.ts:87:14 + (i32.eqz + ;;@ ~lib/memory.ts:87:15 + (get_local $2) + ) + ;;@ ~lib/memory.ts:87:18 + (return) + ) + ;;@ ~lib/memory.ts:88:10 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:88:12 + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:89:10 + (i32.store8 + ;;@ ~lib/memory.ts:89:20 + (block (result i32) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ;;@ ~lib/memory.ts:89:28 + (i32.load8_u + ;;@ ~lib/memory.ts:89:37 + (block (result i32) + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:91:8 + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:91:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:91:20 + (i32.const 8) + ) + (block + (block + ;;@ ~lib/memory.ts:92:10 + (i64.store + ;;@ ~lib/memory.ts:92:21 + (get_local $0) + ;;@ ~lib/memory.ts:92:27 + (i64.load + ;;@ ~lib/memory.ts:92:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:93:10 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:93:18 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:94:10 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:94:18 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:95:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:95:18 + (i32.const 8) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:98:6 + (block $break|2 + (loop $continue|2 + (if + ;;@ ~lib/memory.ts:98:13 + (get_local $2) + (block + (block + ;;@ ~lib/memory.ts:99:8 + (i32.store8 + ;;@ ~lib/memory.ts:99:18 + (block (result i32) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ;;@ ~lib/memory.ts:99:26 + (i32.load8_u + ;;@ ~lib/memory.ts:99:35 + (block (result i32) + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:100:8 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:100:10 + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|2) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:102:11 + (block + ;;@ ~lib/memory.ts:103:6 + (if + ;;@ ~lib/memory.ts:103:10 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:103:11 + (get_local $1) + ;;@ ~lib/memory.ts:103:17 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:103:23 + (i32.and + ;;@ ~lib/memory.ts:103:24 + (get_local $0) + ;;@ ~lib/memory.ts:103:31 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:103:35 + (block + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:104:15 + (i32.and + (i32.add + ;;@ ~lib/memory.ts:104:16 + (get_local $0) + ;;@ ~lib/memory.ts:104:23 + (get_local $2) + ) + ;;@ ~lib/memory.ts:104:28 + (i32.const 7) + ) + (block + (block + ;;@ ~lib/memory.ts:105:10 + (if + ;;@ ~lib/memory.ts:105:14 + (i32.eqz + ;;@ ~lib/memory.ts:105:15 + (get_local $2) + ) + ;;@ ~lib/memory.ts:105:18 + (return) + ) + ;;@ ~lib/memory.ts:106:10 + (i32.store8 + ;;@ ~lib/memory.ts:106:20 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:106:27 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:106:29 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:106:32 + (i32.load8_u + ;;@ ~lib/memory.ts:106:41 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:106:47 + (get_local $2) + ) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:108:8 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:108:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:108:20 + (i32.const 8) + ) + (block + (block + ;;@ ~lib/memory.ts:109:10 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:109:15 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:110:10 + (i64.store + ;;@ ~lib/memory.ts:110:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:110:28 + (get_local $2) + ) + ;;@ ~lib/memory.ts:110:31 + (i64.load + ;;@ ~lib/memory.ts:110:41 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:110:47 + (get_local $2) + ) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:113:6 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:113:13 + (get_local $2) + (block + ;;@ ~lib/memory.ts:113:16 + (i32.store8 + ;;@ ~lib/memory.ts:114:18 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:114:25 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:114:27 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:114:30 + (i32.load8_u + ;;@ ~lib/memory.ts:114:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:114:45 + (get_local $2) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.compare (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + ;;@ ~lib/memory.ts:122:4 + (if + ;;@ ~lib/memory.ts:122:8 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:122:14 + (get_local $1) + ) + ;;@ ~lib/memory.ts:122:25 + (return + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:123:4 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:123:11 + (if (result i32) + (tee_local $3 + (i32.ne + (get_local $2) + ;;@ ~lib/memory.ts:123:16 + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:123:21 + (i32.eq + (i32.load8_u + ;;@ ~lib/memory.ts:123:30 + (get_local $0) + ) + ;;@ ~lib/memory.ts:123:37 + (i32.load8_u + ;;@ ~lib/memory.ts:123:46 + (get_local $1) + ) + ) + (get_local $3) + ) + (block + (block + ;;@ ~lib/memory.ts:124:6 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:124:11 + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:124:17 + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:126:55 + (if (result i32) + ;;@ ~lib/memory.ts:126:11 + (get_local $2) + ;;@ ~lib/memory.ts:126:15 + (i32.sub + (i32.load8_u + ;;@ ~lib/memory.ts:126:29 + (get_local $0) + ) + ;;@ ~lib/memory.ts:126:35 + (i32.load8_u + ;;@ ~lib/memory.ts:126:49 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:126:55 + (i32.const 0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -68,8 +3376,8 @@ ) ;;@ ~lib/allocator/arena.ts:21:4 (set_local $3 - ;;@ ~lib/allocator/arena.ts:21:22 - (current_memory) + ;;@ ~lib/allocator/arena.ts:21:29 + (call $~lib/memory/memory.size) ) ;;@ ~lib/allocator/arena.ts:22:4 (if @@ -134,7 +3442,8 @@ (if ;;@ ~lib/allocator/arena.ts:25:10 (i32.lt_s - (grow_memory + ;;@ ~lib/allocator/arena.ts:25:17 + (call $~lib/memory/memory.grow ;;@ ~lib/allocator/arena.ts:25:22 (get_local $5) ) @@ -145,7 +3454,8 @@ (if ;;@ ~lib/allocator/arena.ts:26:12 (i32.lt_s - (grow_memory + ;;@ ~lib/allocator/arena.ts:26:19 + (call $~lib/memory/memory.grow ;;@ ~lib/allocator/arena.ts:26:24 (get_local $4) ) @@ -172,17 +3482,42 @@ ;;@ ~lib/allocator/arena.ts:34:9 (i32.const 0) ) - (func $~lib/allocator/arena/free_memory (; 1 ;) (type $iv) (param $0 i32) + (func $~lib/memory/memory.allocate (; 7 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:142:4 + (return + ;;@ ~lib/memory.ts:142:45 + (call $~lib/allocator/arena/__memory_allocate + ;;@ ~lib/memory.ts:142:63 + (get_local $0) + ) + ) + ) + (func $~lib/allocator/arena/__memory_free (; 8 ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/allocator/arena/reset_memory (; 2 ;) (type $v) + (func $~lib/memory/memory.free (; 9 ;) (type $iv) (param $0 i32) + ;;@ ~lib/memory.ts:148:36 + (call $~lib/allocator/arena/__memory_free + ;;@ ~lib/memory.ts:148:50 + (get_local $0) + ) + ;;@ ~lib/memory.ts:148:56 + (return) + ) + (func $~lib/allocator/arena/__memory_reset (; 10 ;) (type $v) ;;@ ~lib/allocator/arena.ts:44:2 (set_global $~lib/allocator/arena/offset ;;@ ~lib/allocator/arena.ts:44:11 (get_global $~lib/allocator/arena/startOffset) ) ) - (func $start (; 3 ;) (type $v) + (func $~lib/memory/memory.reset (; 11 ;) (type $v) + ;;@ ~lib/memory.ts:154:37 + (call $~lib/allocator/arena/__memory_reset) + ;;@ ~lib/memory.ts:154:55 + (return) + ) + (func $start (; 12 ;) (type $v) (set_global $~lib/allocator/arena/startOffset ;;@ ~lib/allocator/arena.ts:12:25 (i32.and diff --git a/tests/allocators/buddy/assembly/index.ts b/tests/allocators/buddy/assembly/index.ts index 48c7be7e..2fe5eda0 100644 --- a/tests/allocators/buddy/assembly/index.ts +++ b/tests/allocators/buddy/assembly/index.ts @@ -1,3 +1,2 @@ import "allocator/buddy"; -export { allocate_memory, free_memory }; -// export { set_memory }; +export { memory }; diff --git a/tests/allocators/buddy/optimized.wat b/tests/allocators/buddy/optimized.wat index fcef4606..c604eee0 100644 --- a/tests/allocators/buddy/optimized.wat +++ b/tests/allocators/buddy/optimized.wat @@ -1,5 +1,8 @@ (module + (type $i (func (result i32))) (type $ii (func (param i32) (result i32))) + (type $iiiv (func (param i32 i32 i32))) + (type $iiii (func (param i32 i32 i32) (result i32))) (type $iv (func (param i32))) (type $iiv (func (param i32 i32))) (type $iii (func (param i32 i32) (result i32))) @@ -13,11 +16,3016 @@ (global $~lib/allocator/buddy/max_ptr (mut i32) (i32.const 0)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) - (export "allocate_memory" (func $~lib/allocator/buddy/allocate_memory)) - (export "free_memory" (func $~lib/allocator/buddy/free_memory)) + (export "memory.size" (func $~lib/memory/memory.size)) + (export "memory.grow" (func $~lib/memory/memory.grow)) + (export "memory.fill" (func $~lib/memory/memory.fill)) + (export "memory.copy" (func $~lib/memory/memory.copy)) + (export "memory.compare" (func $~lib/memory/memory.compare)) + (export "memory.allocate" (func $~lib/memory/memory.allocate)) + (export "memory.free" (func $~lib/memory/memory.free)) + (export "memory.reset" (func $~lib/memory/memory.reset)) (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/buddy/update_max_ptr (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 0 ;) (type $i) (result i32) + ;;@ ~lib/memory.ts:4:25 + (current_memory) + ) + (func $~lib/memory/memory.grow (; 1 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:8:30 + (grow_memory + ;;@ ~lib/memory.ts:8:25 + (get_local $0) + ) + ) + (func $~lib/memory/memory.fill (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i64) + (local $4 i32) + ;;@ ~lib/memory.ts:17:4 + (if + ;;@ ~lib/memory.ts:17:8 + (i32.eqz + ;;@ ~lib/memory.ts:17:9 + (get_local $2) + ) + ;;@ ~lib/memory.ts:17:12 + (return) + ) + ;;@ ~lib/memory.ts:18:4 + (i32.store8 + ;;@ ~lib/memory.ts:18:14 + (get_local $0) + ;;@ ~lib/memory.ts:18:20 + (get_local $1) + ) + ;;@ ~lib/memory.ts:19:4 + (i32.store8 + ;;@ ~lib/memory.ts:19:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:19:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:19:25 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:19:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:20:4 + (if + ;;@ ~lib/memory.ts:20:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:20:13 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:20:16 + (return) + ) + ;;@ ~lib/memory.ts:22:4 + (i32.store8 + ;;@ ~lib/memory.ts:22:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:22:21 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:22:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:23:4 + (i32.store8 + ;;@ ~lib/memory.ts:23:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:23:21 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:23:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:24:4 + (i32.store8 + ;;@ ~lib/memory.ts:24:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:24:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:24:25 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:24:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:25:4 + (i32.store8 + ;;@ ~lib/memory.ts:25:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:25:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:25:25 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:25:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:26:4 + (if + ;;@ ~lib/memory.ts:26:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:26:13 + (i32.const 6) + ) + ;;@ ~lib/memory.ts:26:16 + (return) + ) + ;;@ ~lib/memory.ts:27:4 + (i32.store8 + ;;@ ~lib/memory.ts:27:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:27:21 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:27:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:28:4 + (i32.store8 + ;;@ ~lib/memory.ts:28:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:28:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:28:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:28:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:29:4 + (if + ;;@ ~lib/memory.ts:29:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:29:13 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:29:16 + (return) + ) + ;;@ ~lib/memory.ts:40:4 + (i32.store + ;;@ ~lib/memory.ts:33:4 + (tee_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:32:4 + (tee_local $4 + ;;@ ~lib/memory.ts:32:19 + (i32.and + (i32.sub + (i32.const 0) + ;;@ ~lib/memory.ts:32:20 + (get_local $0) + ) + ;;@ ~lib/memory.ts:32:27 + (i32.const 3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:37:4 + (tee_local $1 + ;;@ ~lib/memory.ts:37:19 + (i32.mul + (i32.and + ;;@ ~lib/memory.ts:37:35 + (get_local $1) + (i32.const 255) + ) + (i32.const 16843009) + ) + ) + ) + ;;@ ~lib/memory.ts:41:4 + (i32.store + ;;@ ~lib/memory.ts:41:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:35:4 + (tee_local $2 + (i32.and + (i32.sub + ;;@ ~lib/memory.ts:34:4 + (get_local $2) + ;;@ ~lib/memory.ts:34:9 + (get_local $4) + ) + ;;@ ~lib/memory.ts:35:9 + (i32.const -4) + ) + ) + ) + ;;@ ~lib/memory.ts:41:26 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:41:29 + (get_local $1) + ) + ;;@ ~lib/memory.ts:42:4 + (if + ;;@ ~lib/memory.ts:42:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:42:13 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:42:16 + (return) + ) + ;;@ ~lib/memory.ts:43:4 + (i32.store + ;;@ ~lib/memory.ts:43:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:43:22 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:43:25 + (get_local $1) + ) + ;;@ ~lib/memory.ts:44:4 + (i32.store + ;;@ ~lib/memory.ts:44:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:44:22 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:44:25 + (get_local $1) + ) + ;;@ ~lib/memory.ts:45:4 + (i32.store + ;;@ ~lib/memory.ts:45:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:45:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:45:26 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:45:30 + (get_local $1) + ) + ;;@ ~lib/memory.ts:46:4 + (i32.store + ;;@ ~lib/memory.ts:46:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:46:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:46:26 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:46:29 + (get_local $1) + ) + ;;@ ~lib/memory.ts:47:4 + (if + ;;@ ~lib/memory.ts:47:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:47:13 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:47:17 + (return) + ) + ;;@ ~lib/memory.ts:48:4 + (i32.store + ;;@ ~lib/memory.ts:48:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:48:22 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:48:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:49:4 + (i32.store + ;;@ ~lib/memory.ts:49:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:49:22 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:49:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:50:4 + (i32.store + ;;@ ~lib/memory.ts:50:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:50:22 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:50:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:51:4 + (i32.store + ;;@ ~lib/memory.ts:51:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:51:22 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:51:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:52:4 + (i32.store + ;;@ ~lib/memory.ts:52:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:52:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:52:26 + (i32.const 28) + ) + ;;@ ~lib/memory.ts:52:30 + (get_local $1) + ) + ;;@ ~lib/memory.ts:53:4 + (i32.store + ;;@ ~lib/memory.ts:53:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:53:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:53:26 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:53:30 + (get_local $1) + ) + ;;@ ~lib/memory.ts:54:4 + (i32.store + ;;@ ~lib/memory.ts:54:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:54:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:54:26 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:54:30 + (get_local $1) + ) + ;;@ ~lib/memory.ts:55:4 + (i32.store + ;;@ ~lib/memory.ts:55:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:55:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:55:26 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:55:30 + (get_local $1) + ) + ;;@ ~lib/memory.ts:59:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:58:4 + (tee_local $4 + ;;@ ~lib/memory.ts:58:8 + (i32.add + ;;@ ~lib/memory.ts:58:13 + (i32.and + ;;@ ~lib/memory.ts:58:14 + (get_local $0) + ;;@ ~lib/memory.ts:58:21 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:58:8 + (i32.const 24) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:60:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:60:9 + (get_local $4) + ) + ) + ;;@ ~lib/memory.ts:63:4 + (set_local $3 + ;;@ ~lib/memory.ts:63:19 + (i64.or + (i64.extend_u/i32 + (get_local $1) + ) + ;;@ ~lib/memory.ts:63:30 + (i64.shl + ;;@ ~lib/memory.ts:63:31 + (i64.extend_u/i32 + (get_local $1) + ) + ;;@ ~lib/memory.ts:63:43 + (i64.const 32) + ) + ) + ) + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:64:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:64:16 + (i32.const 32) + ) + (block + ;;@ ~lib/memory.ts:65:6 + (i64.store + ;;@ ~lib/memory.ts:65:17 + (get_local $0) + ;;@ ~lib/memory.ts:65:23 + (get_local $3) + ) + ;;@ ~lib/memory.ts:66:6 + (i64.store + ;;@ ~lib/memory.ts:66:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:66:24 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:66:27 + (get_local $3) + ) + ;;@ ~lib/memory.ts:67:6 + (i64.store + ;;@ ~lib/memory.ts:67:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:67:24 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:67:28 + (get_local $3) + ) + ;;@ ~lib/memory.ts:68:6 + (i64.store + ;;@ ~lib/memory.ts:68:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:68:24 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:68:28 + (get_local $3) + ) + ;;@ ~lib/memory.ts:69:6 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:69:11 + (i32.const 32) + ) + ) + ;;@ ~lib/memory.ts:70:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:70:14 + (i32.const 32) + ) + ) + (br $continue|0) + ) + ) + ) + ) + (func $~lib/memory/memcpy (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (loop $continue|0 + (if + (select + ;;@ ~lib/memory.ts:164:14 + (i32.and + ;;@ ~lib/memory.ts:164:15 + (get_local $1) + ;;@ ~lib/memory.ts:164:21 + (i32.const 3) + ) + (get_local $2) + ;;@ ~lib/memory.ts:164:9 + (get_local $2) + ) + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:165:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:165:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:165:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:165:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:166:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ;;@ ~lib/memory.ts:170:2 + (if + (i32.eqz + ;;@ ~lib/memory.ts:170:6 + (i32.and + ;;@ ~lib/memory.ts:170:7 + (get_local $0) + ;;@ ~lib/memory.ts:170:14 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:170:23 + (block + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:171:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:171:16 + (i32.const 16) + ) + (block + ;;@ ~lib/memory.ts:172:6 + (i32.store + ;;@ ~lib/memory.ts:172:17 + (get_local $0) + ;;@ ~lib/memory.ts:172:28 + (i32.load + ;;@ ~lib/memory.ts:172:38 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:173:6 + (i32.store + ;;@ ~lib/memory.ts:173:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:173:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:173:28 + (i32.load + ;;@ ~lib/memory.ts:173:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:173:45 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:174:6 + (i32.store + ;;@ ~lib/memory.ts:174:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:174:25 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:174:28 + (i32.load + ;;@ ~lib/memory.ts:174:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:174:45 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:175:6 + (i32.store + ;;@ ~lib/memory.ts:175:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:175:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:175:28 + (i32.load + ;;@ ~lib/memory.ts:175:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:175:44 + (i32.const 12) + ) + ) + ) + ;;@ ~lib/memory.ts:176:6 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:176:13 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:176:17 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:176:25 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:176:29 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:176:34 + (i32.const 16) + ) + ) + (br $continue|1) + ) + ) + ) + ;;@ ~lib/memory.ts:178:4 + (if + ;;@ ~lib/memory.ts:178:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:178:12 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:178:15 + (block + ;;@ ~lib/memory.ts:179:6 + (i32.store + ;;@ ~lib/memory.ts:179:17 + (get_local $0) + ;;@ ~lib/memory.ts:179:27 + (i32.load + ;;@ ~lib/memory.ts:179:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:180:6 + (i32.store + ;;@ ~lib/memory.ts:180:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:180:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:180:27 + (i32.load + ;;@ ~lib/memory.ts:180:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:180:43 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:181:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:181:14 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:181:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:181:24 + (i32.const 8) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:183:4 + (if + ;;@ ~lib/memory.ts:183:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:183:12 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:183:15 + (block + ;;@ ~lib/memory.ts:184:6 + (i32.store + ;;@ ~lib/memory.ts:184:17 + (get_local $0) + ;;@ ~lib/memory.ts:184:23 + (i32.load + ;;@ ~lib/memory.ts:184:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:185:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:185:14 + (i32.const 4) + ) + ) + ;;@ ~lib/memory.ts:185:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:185:24 + (i32.const 4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:187:4 + (if + ;;@ ~lib/memory.ts:187:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:187:12 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:187:15 + (block + ;;@ ~lib/memory.ts:188:6 + (i32.store16 + ;;@ ~lib/memory.ts:188:17 + (get_local $0) + ;;@ ~lib/memory.ts:188:23 + (i32.load16_u + ;;@ ~lib/memory.ts:188:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:189:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:189:14 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:189:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:189:24 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:191:4 + (if + ;;@ ~lib/memory.ts:191:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:191:12 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:192:16 + (block + (set_local $3 + (get_local $0) + ) + ;;@ ~lib/memory.ts:191:15 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:192:33 + (block (result i32) + (set_local $3 + (get_local $1) + ) + ;;@ ~lib/memory.ts:192:24 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:194:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:199:2 + (if + ;;@ ~lib/memory.ts:199:6 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:199:11 + (i32.const 32) + ) + ;;@ ~lib/memory.ts:199:15 + (block $break|2 + (block $case2|2 + (block $case1|2 + (block $case0|2 + (block $tablify|0 + (br_table $case0|2 $case1|2 $case2|2 $tablify|0 + (i32.sub + ;;@ ~lib/memory.ts:200:12 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:200:19 + (i32.const 3) + ) + (i32.const 1) + ) + ) + ) + (br $break|2) + ) + ;;@ ~lib/memory.ts:203:8 + (set_local $4 + ;;@ ~lib/memory.ts:203:12 + (i32.load + ;;@ ~lib/memory.ts:203:22 + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:204:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:204:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:204:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:204:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:205:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:205:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:205:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:205:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:206:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:206:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:206:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:206:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:207:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:207:13 + (i32.const 3) + ) + ) + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:208:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:208:20 + (i32.const 17) + ) + (block + ;;@ ~lib/memory.ts:210:10 + (i32.store + ;;@ ~lib/memory.ts:210:21 + (get_local $0) + ;;@ ~lib/memory.ts:210:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:210:32 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:210:37 + (i32.shl + ;;@ ~lib/memory.ts:209:10 + (tee_local $3 + ;;@ ~lib/memory.ts:209:14 + (i32.load + ;;@ ~lib/memory.ts:209:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:209:30 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:210:42 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:212:10 + (i32.store + ;;@ ~lib/memory.ts:212:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:212:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:212:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:212:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:212:41 + (i32.shl + ;;@ ~lib/memory.ts:211:10 + (tee_local $4 + ;;@ ~lib/memory.ts:211:14 + (i32.load + ;;@ ~lib/memory.ts:211:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:211:30 + (i32.const 5) + ) + ) + ) + ;;@ ~lib/memory.ts:212:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:214:10 + (i32.store + ;;@ ~lib/memory.ts:214:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:214:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:214:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:214:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:214:41 + (i32.shl + ;;@ ~lib/memory.ts:213:10 + (tee_local $3 + ;;@ ~lib/memory.ts:213:14 + (i32.load + ;;@ ~lib/memory.ts:213:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:213:30 + (i32.const 9) + ) + ) + ) + ;;@ ~lib/memory.ts:214:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:216:10 + (i32.store + ;;@ ~lib/memory.ts:216:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:216:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:216:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:216:37 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:216:42 + (i32.shl + ;;@ ~lib/memory.ts:215:10 + (tee_local $4 + ;;@ ~lib/memory.ts:215:14 + (i32.load + ;;@ ~lib/memory.ts:215:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:215:30 + (i32.const 13) + ) + ) + ) + ;;@ ~lib/memory.ts:216:47 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:217:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:217:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:217:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:217:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:217:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:217:38 + (i32.const 16) + ) + ) + (br $continue|3) + ) + ) + ) + ;;@ ~lib/memory.ts:219:8 + (br $break|2) + ) + ;;@ ~lib/memory.ts:222:8 + (set_local $4 + ;;@ ~lib/memory.ts:222:12 + (i32.load + ;;@ ~lib/memory.ts:222:22 + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:223:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:223:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:223:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:223:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:224:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:224:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:224:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:224:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:225:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:225:13 + (i32.const 2) + ) + ) + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:226:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:226:20 + (i32.const 18) + ) + (block + ;;@ ~lib/memory.ts:228:10 + (i32.store + ;;@ ~lib/memory.ts:228:21 + (get_local $0) + ;;@ ~lib/memory.ts:228:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:228:32 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:228:37 + (i32.shl + ;;@ ~lib/memory.ts:227:10 + (tee_local $3 + ;;@ ~lib/memory.ts:227:14 + (i32.load + ;;@ ~lib/memory.ts:227:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:227:30 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/memory.ts:228:42 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:230:10 + (i32.store + ;;@ ~lib/memory.ts:230:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:230:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:230:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:230:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:230:41 + (i32.shl + ;;@ ~lib/memory.ts:229:10 + (tee_local $4 + ;;@ ~lib/memory.ts:229:14 + (i32.load + ;;@ ~lib/memory.ts:229:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:229:30 + (i32.const 6) + ) + ) + ) + ;;@ ~lib/memory.ts:230:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:232:10 + (i32.store + ;;@ ~lib/memory.ts:232:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:232:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:232:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:232:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:232:41 + (i32.shl + ;;@ ~lib/memory.ts:231:10 + (tee_local $3 + ;;@ ~lib/memory.ts:231:14 + (i32.load + ;;@ ~lib/memory.ts:231:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:231:30 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/memory.ts:232:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:234:10 + (i32.store + ;;@ ~lib/memory.ts:234:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:234:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:234:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:234:37 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:234:42 + (i32.shl + ;;@ ~lib/memory.ts:233:10 + (tee_local $4 + ;;@ ~lib/memory.ts:233:14 + (i32.load + ;;@ ~lib/memory.ts:233:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:233:30 + (i32.const 14) + ) + ) + ) + ;;@ ~lib/memory.ts:234:47 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:235:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:235:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:235:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:235:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:235:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:235:38 + (i32.const 16) + ) + ) + (br $continue|4) + ) + ) + ) + ;;@ ~lib/memory.ts:237:8 + (br $break|2) + ) + ;;@ ~lib/memory.ts:240:8 + (set_local $4 + ;;@ ~lib/memory.ts:240:12 + (i32.load + ;;@ ~lib/memory.ts:240:22 + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:241:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:241:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:241:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:241:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:242:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:242:13 + (i32.const 1) + ) + ) + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:243:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:243:20 + (i32.const 19) + ) + (block + ;;@ ~lib/memory.ts:245:10 + (i32.store + ;;@ ~lib/memory.ts:245:21 + (get_local $0) + ;;@ ~lib/memory.ts:245:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:245:32 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:245:36 + (i32.shl + ;;@ ~lib/memory.ts:244:10 + (tee_local $3 + ;;@ ~lib/memory.ts:244:14 + (i32.load + ;;@ ~lib/memory.ts:244:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:244:30 + (i32.const 3) + ) + ) + ) + ;;@ ~lib/memory.ts:245:41 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:247:10 + (i32.store + ;;@ ~lib/memory.ts:247:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:247:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:247:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:247:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:247:40 + (i32.shl + ;;@ ~lib/memory.ts:246:10 + (tee_local $4 + ;;@ ~lib/memory.ts:246:14 + (i32.load + ;;@ ~lib/memory.ts:246:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:246:30 + (i32.const 7) + ) + ) + ) + ;;@ ~lib/memory.ts:247:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:249:10 + (i32.store + ;;@ ~lib/memory.ts:249:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:249:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:249:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:249:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:249:40 + (i32.shl + ;;@ ~lib/memory.ts:248:10 + (tee_local $3 + ;;@ ~lib/memory.ts:248:14 + (i32.load + ;;@ ~lib/memory.ts:248:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:248:30 + (i32.const 11) + ) + ) + ) + ;;@ ~lib/memory.ts:249:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:251:10 + (i32.store + ;;@ ~lib/memory.ts:251:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:251:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:251:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:251:37 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:251:41 + (i32.shl + ;;@ ~lib/memory.ts:250:10 + (tee_local $4 + ;;@ ~lib/memory.ts:250:14 + (i32.load + ;;@ ~lib/memory.ts:250:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:250:30 + (i32.const 15) + ) + ) + ) + ;;@ ~lib/memory.ts:251:46 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:252:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:252:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:252:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:252:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:252:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:252:38 + (i32.const 16) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:260:2 + (if + ;;@ ~lib/memory.ts:260:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:260:10 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:260:14 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:261:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:261:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:261:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:261:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:262:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:262:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:262:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:262:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:263:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:263:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:263:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:263:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:264:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:264:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:264:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:264:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:265:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:265:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:265:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:265:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:266:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:266:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:266:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:266:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:267:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:267:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:267:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:267:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:268:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:268:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:268:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:268:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:269:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:269:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:269:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:269:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:270:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:270:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:270:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:270:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:271:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:271:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:271:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:271:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:272:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:272:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:272:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:272:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:273:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:273:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:273:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:273:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:274:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:274:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:274:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:274:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:275:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:275:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:275:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:275:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:276:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:276:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:276:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:276:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:278:2 + (if + ;;@ ~lib/memory.ts:278:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:278:10 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:278:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:279:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:279:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:279:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:279:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:280:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:280:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:280:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:280:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:281:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:281:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:281:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:281:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:282:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:282:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:282:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:282:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:283:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:283:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:283:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:283:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:284:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:284:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:284:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:284:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:285:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:285:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:285:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:285:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:286:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:286:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:286:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:286:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:288:2 + (if + ;;@ ~lib/memory.ts:288:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:288:10 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:288:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:289:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:289:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:289:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:289:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:290:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:290:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:290:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:290:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:291:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:291:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:291:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:291:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:292:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:292:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:292:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:292:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:294:2 + (if + ;;@ ~lib/memory.ts:294:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:294:10 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:294:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:295:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:295:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:295:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:295:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:296:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:296:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:296:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:296:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:298:2 + (if + ;;@ ~lib/memory.ts:298:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:298:10 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:299:14 + (block + (set_local $3 + (get_local $0) + ) + ;;@ ~lib/memory.ts:298:13 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:299:31 + (block (result i32) + (set_local $3 + (get_local $1) + ) + ;;@ ~lib/memory.ts:299:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.copy (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + ;;@ ~lib/memory.ts:79:4 + (if + ;;@ ~lib/memory.ts:79:8 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:79:16 + (get_local $1) + ) + ;;@ ~lib/memory.ts:79:21 + (return) + ) + ;;@ ~lib/memory.ts:80:4 + (if + ;;@ ~lib/memory.ts:80:8 + (if (result i32) + (tee_local $3 + (i32.le_u + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:80:14 + (get_local $2) + ) + ;;@ ~lib/memory.ts:80:19 + (get_local $0) + ) + ) + (get_local $3) + ;;@ ~lib/memory.ts:80:27 + (i32.le_u + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:80:34 + (get_local $2) + ) + ;;@ ~lib/memory.ts:80:39 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:80:44 + (block + ;;@ ~lib/memory.ts:81:6 + (call $~lib/memory/memcpy + ;;@ ~lib/memory.ts:81:13 + (get_local $0) + ;;@ ~lib/memory.ts:81:19 + (get_local $1) + ;;@ ~lib/memory.ts:81:24 + (get_local $2) + ) + ;;@ ~lib/memory.ts:82:6 + (return) + ) + ) + ;;@ ~lib/memory.ts:84:4 + (if + ;;@ ~lib/memory.ts:84:8 + (i32.lt_u + (get_local $0) + ;;@ ~lib/memory.ts:84:15 + (get_local $1) + ) + ;;@ ~lib/memory.ts:84:20 + (block + ;;@ ~lib/memory.ts:85:6 + (if + ;;@ ~lib/memory.ts:85:10 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:85:11 + (get_local $1) + ;;@ ~lib/memory.ts:85:17 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:85:23 + (i32.and + ;;@ ~lib/memory.ts:85:24 + (get_local $0) + ;;@ ~lib/memory.ts:85:31 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:85:35 + (block + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:86:15 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:86:22 + (i32.const 7) + ) + (block + ;;@ ~lib/memory.ts:87:10 + (if + ;;@ ~lib/memory.ts:87:14 + (i32.eqz + ;;@ ~lib/memory.ts:87:15 + (get_local $2) + ) + ;;@ ~lib/memory.ts:87:18 + (return) + ) + ;;@ ~lib/memory.ts:88:10 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:88:12 + (get_local $2) + (i32.const 1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:89:20 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:89:10 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:89:37 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:89:28 + (i32.load8_u + (get_local $3) + ) + ) + ) + (br $continue|0) + ) + ) + ) + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:91:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:91:20 + (i32.const 8) + ) + (block + ;;@ ~lib/memory.ts:92:10 + (i64.store + ;;@ ~lib/memory.ts:92:21 + (get_local $0) + ;;@ ~lib/memory.ts:92:27 + (i64.load + ;;@ ~lib/memory.ts:92:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:93:10 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:93:18 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:94:10 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:94:18 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:95:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:95:18 + (i32.const 8) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ) + (loop $continue|2 + (if + ;;@ ~lib/memory.ts:98:13 + (get_local $2) + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:99:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:99:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:99:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:99:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:100:8 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:100:10 + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:102:11 + (block + ;;@ ~lib/memory.ts:103:6 + (if + ;;@ ~lib/memory.ts:103:10 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:103:11 + (get_local $1) + ;;@ ~lib/memory.ts:103:17 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:103:23 + (i32.and + ;;@ ~lib/memory.ts:103:24 + (get_local $0) + ;;@ ~lib/memory.ts:103:31 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:103:35 + (block + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:104:15 + (i32.and + (i32.add + ;;@ ~lib/memory.ts:104:16 + (get_local $0) + ;;@ ~lib/memory.ts:104:23 + (get_local $2) + ) + ;;@ ~lib/memory.ts:104:28 + (i32.const 7) + ) + (block + ;;@ ~lib/memory.ts:105:10 + (if + ;;@ ~lib/memory.ts:105:14 + (i32.eqz + ;;@ ~lib/memory.ts:105:15 + (get_local $2) + ) + ;;@ ~lib/memory.ts:105:18 + (return) + ) + ;;@ ~lib/memory.ts:106:10 + (i32.store8 + ;;@ ~lib/memory.ts:106:20 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:106:27 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:106:29 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:106:32 + (i32.load8_u + ;;@ ~lib/memory.ts:106:41 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:106:47 + (get_local $2) + ) + ) + ) + (br $continue|3) + ) + ) + ) + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:108:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:108:20 + (i32.const 8) + ) + (block + ;;@ ~lib/memory.ts:110:10 + (i64.store + ;;@ ~lib/memory.ts:110:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:109:10 + (tee_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:109:15 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:110:31 + (i64.load + ;;@ ~lib/memory.ts:110:41 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:110:47 + (get_local $2) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ) + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:113:13 + (get_local $2) + (block + ;;@ ~lib/memory.ts:113:16 + (i32.store8 + ;;@ ~lib/memory.ts:114:18 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:114:25 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:114:27 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:114:30 + (i32.load8_u + ;;@ ~lib/memory.ts:114:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:114:45 + (get_local $2) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.compare (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + ;;@ ~lib/memory.ts:122:4 + (if + ;;@ ~lib/memory.ts:122:8 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:122:14 + (get_local $1) + ) + ;;@ ~lib/memory.ts:122:25 + (return + (i32.const 0) + ) + ) + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:123:11 + (if (result i32) + (tee_local $3 + (i32.ne + (get_local $2) + ;;@ ~lib/memory.ts:123:16 + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:123:21 + (i32.eq + (i32.load8_u + ;;@ ~lib/memory.ts:123:30 + (get_local $0) + ) + ;;@ ~lib/memory.ts:123:37 + (i32.load8_u + ;;@ ~lib/memory.ts:123:46 + (get_local $1) + ) + ) + (get_local $3) + ) + (block + ;;@ ~lib/memory.ts:124:6 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:124:11 + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:124:17 + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ;;@ ~lib/memory.ts:126:55 + (if (result i32) + ;;@ ~lib/memory.ts:126:11 + (get_local $2) + ;;@ ~lib/memory.ts:126:15 + (i32.sub + (i32.load8_u + ;;@ ~lib/memory.ts:126:29 + (get_local $0) + ) + ;;@ ~lib/memory.ts:126:35 + (i32.load8_u + ;;@ ~lib/memory.ts:126:49 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:126:55 + (i32.const 0) + ) + ) + (func $~lib/allocator/buddy/update_max_ptr (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) ;;@ ~lib/allocator/buddy.ts:175:2 (if @@ -51,11 +3059,10 @@ ) (i32.const -65536) ) - ;;@ ~lib/allocator/buddy.ts:180:61 + ;;@ ~lib/allocator/buddy.ts:180:62 (i32.const 16) ) ) - ;;@ ~lib/allocator/buddy.ts:179:19 (current_memory) ) ) @@ -82,7 +3089,7 @@ ;;@ ~lib/allocator/buddy.ts:188:9 (i32.const 1) ) - (func $~lib/allocator/buddy/buckets$get (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/buckets$get (; 7 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:102:59 (i32.add ;;@ ~lib/allocator/buddy.ts:102:26 @@ -95,7 +3102,7 @@ ) ) ) - (func $~lib/allocator/buddy/list_init (; 2 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/buddy/list_init (; 8 ;) (type $iv) (param $0 i32) ;;@ ~lib/allocator/buddy.ts:197:2 (i32.store (get_local $0) @@ -109,7 +3116,7 @@ (get_local $0) ) ) - (func $~lib/allocator/buddy/list_push (; 3 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/allocator/buddy/list_push (; 9 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:207:2 (i32.store @@ -141,7 +3148,7 @@ (get_local $1) ) ) - (func $~lib/allocator/buddy/bucket_for_request (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/bucket_for_request (; 10 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:279:2 @@ -185,7 +3192,7 @@ ;;@ ~lib/allocator/buddy.ts:287:9 (get_local $1) ) - (func $~lib/allocator/buddy/node_for_ptr (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/allocator/buddy/node_for_ptr (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:252:75 (i32.sub ;;@ ~lib/allocator/buddy.ts:252:9 @@ -218,7 +3225,7 @@ (i32.const 1) ) ) - (func $~lib/allocator/buddy/node_is_split$get (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/node_is_split$get (; 12 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:148:45 (i32.load8_u ;;@ ~lib/allocator/buddy.ts:148:18 @@ -229,7 +3236,7 @@ ) ) ) - (func $~lib/allocator/buddy/parent_is_split (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/parent_is_split (; 13 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:260:70 (i32.eq ;;@ ~lib/allocator/buddy.ts:260:9 @@ -273,7 +3280,7 @@ (i32.const 1) ) ) - (func $~lib/allocator/buddy/list_remove (; 8 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/buddy/list_remove (; 14 ;) (type $iv) (param $0 i32) (local $1 i32) ;;@ ~lib/allocator/buddy.ts:222:2 (i32.store offset=4 @@ -299,7 +3306,7 @@ (get_local $1) ) ) - (func $~lib/allocator/buddy/ptr_for_node (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/allocator/buddy/ptr_for_node (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:243:77 (i32.add ;;@ ~lib/allocator/buddy.ts:243:9 @@ -332,7 +3339,7 @@ ) ) ) - (func $~lib/allocator/buddy/flip_parent_is_split (; 10 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/buddy/flip_parent_is_split (; 16 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) (set_local $2 @@ -388,7 +3395,7 @@ (get_local $0) ) ) - (func $~lib/allocator/buddy/lower_bucket_limit (; 11 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/lower_bucket_limit (; 17 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (loop $continue|0 @@ -545,7 +3552,7 @@ ;;@ ~lib/allocator/buddy.ts:338:9 (i32.const 1) ) - (func $~lib/allocator/buddy/list_pop (; 12 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/list_pop (; 18 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) ;;@ ~lib/allocator/buddy.ts:231:2 (if @@ -574,7 +3581,7 @@ ;;@ ~lib/allocator/buddy.ts:233:9 (get_local $1) ) - (func $~lib/allocator/buddy/allocate_memory (; 13 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/__memory_allocate (; 19 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -616,7 +3623,7 @@ ;;@ ~lib/allocator/buddy.ts:360:14 (i32.shl (current_memory) - ;;@ ~lib/allocator/buddy.ts:360:41 + ;;@ ~lib/allocator/buddy.ts:360:38 (i32.const 16) ) ) @@ -944,7 +3951,14 @@ ;;@ ~lib/allocator/buddy.ts:473:9 (i32.const 0) ) - (func $~lib/allocator/buddy/free_memory (; 14 ;) (type $iv) (param $0 i32) + (func $~lib/memory/memory.allocate (; 20 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:142:45 + (call $~lib/allocator/buddy/__memory_allocate + ;;@ ~lib/memory.ts:142:63 + (get_local $0) + ) + ) + (func $~lib/allocator/buddy/__memory_free (; 21 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:483:2 @@ -1086,7 +4100,17 @@ ) ) ) - (func $start (; 15 ;) (type $v) + (func $~lib/memory/memory.free (; 22 ;) (type $iv) (param $0 i32) + ;;@ ~lib/memory.ts:148:36 + (call $~lib/allocator/buddy/__memory_free + ;;@ ~lib/memory.ts:148:50 + (get_local $0) + ) + ) + (func $~lib/memory/memory.reset (; 23 ;) (type $v) + (unreachable) + ) + (func $start (; 24 ;) (type $v) (set_global $~lib/allocator/buddy/BUCKETS_START ;;@ ~lib/allocator/buddy.ts:97:27 (get_global $HEAP_BASE) diff --git a/tests/allocators/buddy/untouched.wat b/tests/allocators/buddy/untouched.wat index b1352d06..09ac75c5 100644 --- a/tests/allocators/buddy/untouched.wat +++ b/tests/allocators/buddy/untouched.wat @@ -1,5 +1,8 @@ (module + (type $i (func (result i32))) (type $ii (func (param i32) (result i32))) + (type $iiiv (func (param i32 i32 i32))) + (type $iiii (func (param i32 i32 i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $iv (func (param i32))) (type $iiv (func (param i32 i32))) @@ -23,11 +26,3317 @@ (global $HEAP_BASE i32 (i32.const 60)) (memory $0 1) (data (i32.const 8) "\17\00\00\00~\00l\00i\00b\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00/\00b\00u\00d\00d\00y\00.\00t\00s\00") - (export "allocate_memory" (func $~lib/allocator/buddy/allocate_memory)) - (export "free_memory" (func $~lib/allocator/buddy/free_memory)) + (export "memory.size" (func $~lib/memory/memory.size)) + (export "memory.grow" (func $~lib/memory/memory.grow)) + (export "memory.fill" (func $~lib/memory/memory.fill)) + (export "memory.copy" (func $~lib/memory/memory.copy)) + (export "memory.compare" (func $~lib/memory/memory.compare)) + (export "memory.allocate" (func $~lib/memory/memory.allocate)) + (export "memory.free" (func $~lib/memory/memory.free)) + (export "memory.reset" (func $~lib/memory/memory.reset)) (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/buddy/update_max_ptr (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 1 ;) (type $i) (result i32) + ;;@ ~lib/memory.ts:4:25 + (current_memory) + ) + (func $~lib/memory/memory.grow (; 2 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:8:30 + (grow_memory + ;;@ ~lib/memory.ts:8:25 + (get_local $0) + ) + ) + (func $~lib/memory/memory.fill (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i64) + ;;@ ~lib/memory.ts:17:4 + (if + ;;@ ~lib/memory.ts:17:8 + (i32.eqz + ;;@ ~lib/memory.ts:17:9 + (get_local $2) + ) + ;;@ ~lib/memory.ts:17:12 + (return) + ) + ;;@ ~lib/memory.ts:18:4 + (i32.store8 + ;;@ ~lib/memory.ts:18:14 + (get_local $0) + ;;@ ~lib/memory.ts:18:20 + (get_local $1) + ) + ;;@ ~lib/memory.ts:19:4 + (i32.store8 + ;;@ ~lib/memory.ts:19:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:19:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:19:25 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:19:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:20:4 + (if + ;;@ ~lib/memory.ts:20:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:20:13 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:20:16 + (return) + ) + ;;@ ~lib/memory.ts:22:4 + (i32.store8 + ;;@ ~lib/memory.ts:22:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:22:21 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:22:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:23:4 + (i32.store8 + ;;@ ~lib/memory.ts:23:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:23:21 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:23:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:24:4 + (i32.store8 + ;;@ ~lib/memory.ts:24:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:24:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:24:25 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:24:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:25:4 + (i32.store8 + ;;@ ~lib/memory.ts:25:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:25:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:25:25 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:25:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:26:4 + (if + ;;@ ~lib/memory.ts:26:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:26:13 + (i32.const 6) + ) + ;;@ ~lib/memory.ts:26:16 + (return) + ) + ;;@ ~lib/memory.ts:27:4 + (i32.store8 + ;;@ ~lib/memory.ts:27:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:27:21 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:27:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:28:4 + (i32.store8 + ;;@ ~lib/memory.ts:28:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:28:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:28:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:28:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:29:4 + (if + ;;@ ~lib/memory.ts:29:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:29:13 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:29:16 + (return) + ) + ;;@ ~lib/memory.ts:32:4 + (set_local $3 + ;;@ ~lib/memory.ts:32:19 + (i32.and + (i32.sub + (i32.const 0) + ;;@ ~lib/memory.ts:32:20 + (get_local $0) + ) + ;;@ ~lib/memory.ts:32:27 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:33:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:33:12 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:34:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:34:9 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:35:4 + (set_local $2 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:35:9 + (i32.const -4) + ) + ) + ;;@ ~lib/memory.ts:37:4 + (set_local $4 + ;;@ ~lib/memory.ts:37:19 + (i32.mul + (i32.div_u + (i32.const -1) + ;;@ ~lib/memory.ts:37:29 + (i32.const 255) + ) + (i32.and + ;;@ ~lib/memory.ts:37:35 + (get_local $1) + (i32.const 255) + ) + ) + ) + ;;@ ~lib/memory.ts:40:4 + (i32.store + ;;@ ~lib/memory.ts:40:15 + (get_local $0) + ;;@ ~lib/memory.ts:40:21 + (get_local $4) + ) + ;;@ ~lib/memory.ts:41:4 + (i32.store + ;;@ ~lib/memory.ts:41:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:41:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:41:26 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:41:29 + (get_local $4) + ) + ;;@ ~lib/memory.ts:42:4 + (if + ;;@ ~lib/memory.ts:42:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:42:13 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:42:16 + (return) + ) + ;;@ ~lib/memory.ts:43:4 + (i32.store + ;;@ ~lib/memory.ts:43:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:43:22 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:43:25 + (get_local $4) + ) + ;;@ ~lib/memory.ts:44:4 + (i32.store + ;;@ ~lib/memory.ts:44:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:44:22 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:44:25 + (get_local $4) + ) + ;;@ ~lib/memory.ts:45:4 + (i32.store + ;;@ ~lib/memory.ts:45:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:45:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:45:26 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:45:30 + (get_local $4) + ) + ;;@ ~lib/memory.ts:46:4 + (i32.store + ;;@ ~lib/memory.ts:46:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:46:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:46:26 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:46:29 + (get_local $4) + ) + ;;@ ~lib/memory.ts:47:4 + (if + ;;@ ~lib/memory.ts:47:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:47:13 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:47:17 + (return) + ) + ;;@ ~lib/memory.ts:48:4 + (i32.store + ;;@ ~lib/memory.ts:48:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:48:22 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:48:26 + (get_local $4) + ) + ;;@ ~lib/memory.ts:49:4 + (i32.store + ;;@ ~lib/memory.ts:49:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:49:22 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:49:26 + (get_local $4) + ) + ;;@ ~lib/memory.ts:50:4 + (i32.store + ;;@ ~lib/memory.ts:50:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:50:22 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:50:26 + (get_local $4) + ) + ;;@ ~lib/memory.ts:51:4 + (i32.store + ;;@ ~lib/memory.ts:51:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:51:22 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:51:26 + (get_local $4) + ) + ;;@ ~lib/memory.ts:52:4 + (i32.store + ;;@ ~lib/memory.ts:52:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:52:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:52:26 + (i32.const 28) + ) + ;;@ ~lib/memory.ts:52:30 + (get_local $4) + ) + ;;@ ~lib/memory.ts:53:4 + (i32.store + ;;@ ~lib/memory.ts:53:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:53:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:53:26 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:53:30 + (get_local $4) + ) + ;;@ ~lib/memory.ts:54:4 + (i32.store + ;;@ ~lib/memory.ts:54:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:54:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:54:26 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:54:30 + (get_local $4) + ) + ;;@ ~lib/memory.ts:55:4 + (i32.store + ;;@ ~lib/memory.ts:55:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:55:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:55:26 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:55:30 + (get_local $4) + ) + ;;@ ~lib/memory.ts:58:4 + (set_local $3 + ;;@ ~lib/memory.ts:58:8 + (i32.add + (i32.const 24) + ;;@ ~lib/memory.ts:58:13 + (i32.and + ;;@ ~lib/memory.ts:58:14 + (get_local $0) + ;;@ ~lib/memory.ts:58:21 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:59:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:59:12 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:60:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:60:9 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:63:4 + (set_local $5 + ;;@ ~lib/memory.ts:63:19 + (i64.or + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/memory.ts:63:30 + (i64.shl + ;;@ ~lib/memory.ts:63:31 + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/memory.ts:63:43 + (i64.const 32) + ) + ) + ) + ;;@ ~lib/memory.ts:64:4 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:64:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:64:16 + (i32.const 32) + ) + (block + (block + ;;@ ~lib/memory.ts:65:6 + (i64.store + ;;@ ~lib/memory.ts:65:17 + (get_local $0) + ;;@ ~lib/memory.ts:65:23 + (get_local $5) + ) + ;;@ ~lib/memory.ts:66:6 + (i64.store + ;;@ ~lib/memory.ts:66:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:66:24 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:66:27 + (get_local $5) + ) + ;;@ ~lib/memory.ts:67:6 + (i64.store + ;;@ ~lib/memory.ts:67:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:67:24 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:67:28 + (get_local $5) + ) + ;;@ ~lib/memory.ts:68:6 + (i64.store + ;;@ ~lib/memory.ts:68:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:68:24 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:68:28 + (get_local $5) + ) + ;;@ ~lib/memory.ts:69:6 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:69:11 + (i32.const 32) + ) + ) + ;;@ ~lib/memory.ts:70:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:70:14 + (i32.const 32) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ) + (func $~lib/memory/memcpy (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + ;;@ ~lib/memory.ts:164:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:164:9 + (if (result i32) + (get_local $2) + ;;@ ~lib/memory.ts:164:14 + (i32.and + ;;@ ~lib/memory.ts:164:15 + (get_local $1) + ;;@ ~lib/memory.ts:164:21 + (i32.const 3) + ) + (get_local $2) + ) + (block + (block + ;;@ ~lib/memory.ts:165:4 + (i32.store8 + ;;@ ~lib/memory.ts:165:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:165:22 + (i32.load8_u + ;;@ ~lib/memory.ts:165:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:166:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:170:2 + (if + ;;@ ~lib/memory.ts:170:6 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:170:7 + (get_local $0) + ;;@ ~lib/memory.ts:170:14 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:170:20 + (i32.const 0) + ) + ;;@ ~lib/memory.ts:170:23 + (block + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:171:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:171:16 + (i32.const 16) + ) + (block + (block + ;;@ ~lib/memory.ts:172:6 + (i32.store + ;;@ ~lib/memory.ts:172:17 + (get_local $0) + ;;@ ~lib/memory.ts:172:28 + (i32.load + ;;@ ~lib/memory.ts:172:38 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:173:6 + (i32.store + ;;@ ~lib/memory.ts:173:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:173:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:173:28 + (i32.load + ;;@ ~lib/memory.ts:173:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:173:45 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:174:6 + (i32.store + ;;@ ~lib/memory.ts:174:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:174:25 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:174:28 + (i32.load + ;;@ ~lib/memory.ts:174:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:174:45 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:175:6 + (i32.store + ;;@ ~lib/memory.ts:175:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:175:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:175:28 + (i32.load + ;;@ ~lib/memory.ts:175:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:175:44 + (i32.const 12) + ) + ) + ) + ;;@ ~lib/memory.ts:176:6 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:176:13 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:176:17 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:176:25 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:176:29 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:176:34 + (i32.const 16) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:178:4 + (if + ;;@ ~lib/memory.ts:178:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:178:12 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:178:15 + (block + ;;@ ~lib/memory.ts:179:6 + (i32.store + ;;@ ~lib/memory.ts:179:17 + (get_local $0) + ;;@ ~lib/memory.ts:179:27 + (i32.load + ;;@ ~lib/memory.ts:179:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:180:6 + (i32.store + ;;@ ~lib/memory.ts:180:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:180:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:180:27 + (i32.load + ;;@ ~lib/memory.ts:180:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:180:43 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:181:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:181:14 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:181:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:181:24 + (i32.const 8) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:183:4 + (if + ;;@ ~lib/memory.ts:183:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:183:12 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:183:15 + (block + ;;@ ~lib/memory.ts:184:6 + (i32.store + ;;@ ~lib/memory.ts:184:17 + (get_local $0) + ;;@ ~lib/memory.ts:184:23 + (i32.load + ;;@ ~lib/memory.ts:184:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:185:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:185:14 + (i32.const 4) + ) + ) + ;;@ ~lib/memory.ts:185:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:185:24 + (i32.const 4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:187:4 + (if + ;;@ ~lib/memory.ts:187:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:187:12 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:187:15 + (block + ;;@ ~lib/memory.ts:188:6 + (i32.store16 + ;;@ ~lib/memory.ts:188:17 + (get_local $0) + ;;@ ~lib/memory.ts:188:23 + (i32.load16_u + ;;@ ~lib/memory.ts:188:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:189:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:189:14 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:189:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:189:24 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:191:4 + (if + ;;@ ~lib/memory.ts:191:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:191:12 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:191:15 + (i32.store8 + ;;@ ~lib/memory.ts:192:16 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:192:24 + (i32.load8_u + ;;@ ~lib/memory.ts:192:33 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:194:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:199:2 + (if + ;;@ ~lib/memory.ts:199:6 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:199:11 + (i32.const 32) + ) + ;;@ ~lib/memory.ts:199:15 + (block $break|2 + (block $case2|2 + (block $case1|2 + (block $case0|2 + (set_local $5 + ;;@ ~lib/memory.ts:200:12 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:200:19 + (i32.const 3) + ) + ) + (br_if $case0|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:202:11 + (i32.const 1) + ) + ) + (br_if $case1|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:221:11 + (i32.const 2) + ) + ) + (br_if $case2|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:239:11 + (i32.const 3) + ) + ) + (br $break|2) + ) + ;;@ ~lib/memory.ts:202:14 + (block + ;;@ ~lib/memory.ts:203:8 + (set_local $3 + ;;@ ~lib/memory.ts:203:12 + (i32.load + ;;@ ~lib/memory.ts:203:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:204:8 + (i32.store8 + ;;@ ~lib/memory.ts:204:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:204:26 + (i32.load8_u + ;;@ ~lib/memory.ts:204:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:205:8 + (i32.store8 + ;;@ ~lib/memory.ts:205:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:205:26 + (i32.load8_u + ;;@ ~lib/memory.ts:205:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:206:8 + (i32.store8 + ;;@ ~lib/memory.ts:206:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:206:26 + (i32.load8_u + ;;@ ~lib/memory.ts:206:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:207:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:207:13 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:208:8 + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:208:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:208:20 + (i32.const 17) + ) + (block + (block + ;;@ ~lib/memory.ts:209:10 + (set_local $4 + ;;@ ~lib/memory.ts:209:14 + (i32.load + ;;@ ~lib/memory.ts:209:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:209:30 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:210:10 + (i32.store + ;;@ ~lib/memory.ts:210:21 + (get_local $0) + ;;@ ~lib/memory.ts:210:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:210:32 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:210:37 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:210:42 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:211:10 + (set_local $3 + ;;@ ~lib/memory.ts:211:14 + (i32.load + ;;@ ~lib/memory.ts:211:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:211:30 + (i32.const 5) + ) + ) + ) + ;;@ ~lib/memory.ts:212:10 + (i32.store + ;;@ ~lib/memory.ts:212:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:212:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:212:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:212:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:212:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:212:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:213:10 + (set_local $4 + ;;@ ~lib/memory.ts:213:14 + (i32.load + ;;@ ~lib/memory.ts:213:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:213:30 + (i32.const 9) + ) + ) + ) + ;;@ ~lib/memory.ts:214:10 + (i32.store + ;;@ ~lib/memory.ts:214:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:214:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:214:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:214:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:214:41 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:214:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:215:10 + (set_local $3 + ;;@ ~lib/memory.ts:215:14 + (i32.load + ;;@ ~lib/memory.ts:215:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:215:30 + (i32.const 13) + ) + ) + ) + ;;@ ~lib/memory.ts:216:10 + (i32.store + ;;@ ~lib/memory.ts:216:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:216:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:216:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:216:37 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:216:42 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:216:47 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:217:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:217:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:217:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:217:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:217:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:217:38 + (i32.const 16) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:219:8 + (br $break|2) + ) + ) + ;;@ ~lib/memory.ts:221:14 + (block + ;;@ ~lib/memory.ts:222:8 + (set_local $3 + ;;@ ~lib/memory.ts:222:12 + (i32.load + ;;@ ~lib/memory.ts:222:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:223:8 + (i32.store8 + ;;@ ~lib/memory.ts:223:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:223:26 + (i32.load8_u + ;;@ ~lib/memory.ts:223:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:224:8 + (i32.store8 + ;;@ ~lib/memory.ts:224:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:224:26 + (i32.load8_u + ;;@ ~lib/memory.ts:224:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:225:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:225:13 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:226:8 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:226:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:226:20 + (i32.const 18) + ) + (block + (block + ;;@ ~lib/memory.ts:227:10 + (set_local $4 + ;;@ ~lib/memory.ts:227:14 + (i32.load + ;;@ ~lib/memory.ts:227:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:227:30 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/memory.ts:228:10 + (i32.store + ;;@ ~lib/memory.ts:228:21 + (get_local $0) + ;;@ ~lib/memory.ts:228:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:228:32 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:228:37 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:228:42 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:229:10 + (set_local $3 + ;;@ ~lib/memory.ts:229:14 + (i32.load + ;;@ ~lib/memory.ts:229:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:229:30 + (i32.const 6) + ) + ) + ) + ;;@ ~lib/memory.ts:230:10 + (i32.store + ;;@ ~lib/memory.ts:230:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:230:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:230:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:230:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:230:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:230:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:231:10 + (set_local $4 + ;;@ ~lib/memory.ts:231:14 + (i32.load + ;;@ ~lib/memory.ts:231:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:231:30 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/memory.ts:232:10 + (i32.store + ;;@ ~lib/memory.ts:232:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:232:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:232:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:232:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:232:41 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:232:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:233:10 + (set_local $3 + ;;@ ~lib/memory.ts:233:14 + (i32.load + ;;@ ~lib/memory.ts:233:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:233:30 + (i32.const 14) + ) + ) + ) + ;;@ ~lib/memory.ts:234:10 + (i32.store + ;;@ ~lib/memory.ts:234:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:234:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:234:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:234:37 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:234:42 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:234:47 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:235:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:235:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:235:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:235:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:235:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:235:38 + (i32.const 16) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:237:8 + (br $break|2) + ) + ) + ;;@ ~lib/memory.ts:239:14 + (block + ;;@ ~lib/memory.ts:240:8 + (set_local $3 + ;;@ ~lib/memory.ts:240:12 + (i32.load + ;;@ ~lib/memory.ts:240:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:241:8 + (i32.store8 + ;;@ ~lib/memory.ts:241:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:241:26 + (i32.load8_u + ;;@ ~lib/memory.ts:241:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:242:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:242:13 + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:243:8 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:243:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:243:20 + (i32.const 19) + ) + (block + (block + ;;@ ~lib/memory.ts:244:10 + (set_local $4 + ;;@ ~lib/memory.ts:244:14 + (i32.load + ;;@ ~lib/memory.ts:244:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:244:30 + (i32.const 3) + ) + ) + ) + ;;@ ~lib/memory.ts:245:10 + (i32.store + ;;@ ~lib/memory.ts:245:21 + (get_local $0) + ;;@ ~lib/memory.ts:245:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:245:32 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:245:36 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:245:41 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:246:10 + (set_local $3 + ;;@ ~lib/memory.ts:246:14 + (i32.load + ;;@ ~lib/memory.ts:246:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:246:30 + (i32.const 7) + ) + ) + ) + ;;@ ~lib/memory.ts:247:10 + (i32.store + ;;@ ~lib/memory.ts:247:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:247:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:247:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:247:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:247:40 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:247:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:248:10 + (set_local $4 + ;;@ ~lib/memory.ts:248:14 + (i32.load + ;;@ ~lib/memory.ts:248:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:248:30 + (i32.const 11) + ) + ) + ) + ;;@ ~lib/memory.ts:249:10 + (i32.store + ;;@ ~lib/memory.ts:249:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:249:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:249:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:249:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:249:40 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:249:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:250:10 + (set_local $3 + ;;@ ~lib/memory.ts:250:14 + (i32.load + ;;@ ~lib/memory.ts:250:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:250:30 + (i32.const 15) + ) + ) + ) + ;;@ ~lib/memory.ts:251:10 + (i32.store + ;;@ ~lib/memory.ts:251:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:251:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:251:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:251:37 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:251:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:251:46 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:252:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:252:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:252:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:252:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:252:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:252:38 + (i32.const 16) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:254:8 + (br $break|2) + ) + ) + ) + ;;@ ~lib/memory.ts:260:2 + (if + ;;@ ~lib/memory.ts:260:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:260:10 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:260:14 + (block + ;;@ ~lib/memory.ts:261:4 + (i32.store8 + ;;@ ~lib/memory.ts:261:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:261:22 + (i32.load8_u + ;;@ ~lib/memory.ts:261:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:262:4 + (i32.store8 + ;;@ ~lib/memory.ts:262:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:262:22 + (i32.load8_u + ;;@ ~lib/memory.ts:262:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:263:4 + (i32.store8 + ;;@ ~lib/memory.ts:263:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:263:22 + (i32.load8_u + ;;@ ~lib/memory.ts:263:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:264:4 + (i32.store8 + ;;@ ~lib/memory.ts:264:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:264:22 + (i32.load8_u + ;;@ ~lib/memory.ts:264:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:265:4 + (i32.store8 + ;;@ ~lib/memory.ts:265:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:265:22 + (i32.load8_u + ;;@ ~lib/memory.ts:265:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:266:4 + (i32.store8 + ;;@ ~lib/memory.ts:266:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:266:22 + (i32.load8_u + ;;@ ~lib/memory.ts:266:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:267:4 + (i32.store8 + ;;@ ~lib/memory.ts:267:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:267:22 + (i32.load8_u + ;;@ ~lib/memory.ts:267:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:268:4 + (i32.store8 + ;;@ ~lib/memory.ts:268:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:268:22 + (i32.load8_u + ;;@ ~lib/memory.ts:268:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:269:4 + (i32.store8 + ;;@ ~lib/memory.ts:269:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:269:22 + (i32.load8_u + ;;@ ~lib/memory.ts:269:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:270:4 + (i32.store8 + ;;@ ~lib/memory.ts:270:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:270:22 + (i32.load8_u + ;;@ ~lib/memory.ts:270:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:271:4 + (i32.store8 + ;;@ ~lib/memory.ts:271:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:271:22 + (i32.load8_u + ;;@ ~lib/memory.ts:271:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:272:4 + (i32.store8 + ;;@ ~lib/memory.ts:272:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:272:22 + (i32.load8_u + ;;@ ~lib/memory.ts:272:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:273:4 + (i32.store8 + ;;@ ~lib/memory.ts:273:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:273:22 + (i32.load8_u + ;;@ ~lib/memory.ts:273:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:274:4 + (i32.store8 + ;;@ ~lib/memory.ts:274:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:274:22 + (i32.load8_u + ;;@ ~lib/memory.ts:274:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:275:4 + (i32.store8 + ;;@ ~lib/memory.ts:275:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:275:22 + (i32.load8_u + ;;@ ~lib/memory.ts:275:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:276:4 + (i32.store8 + ;;@ ~lib/memory.ts:276:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:276:22 + (i32.load8_u + ;;@ ~lib/memory.ts:276:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:278:2 + (if + ;;@ ~lib/memory.ts:278:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:278:10 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:278:13 + (block + ;;@ ~lib/memory.ts:279:4 + (i32.store8 + ;;@ ~lib/memory.ts:279:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:279:22 + (i32.load8_u + ;;@ ~lib/memory.ts:279:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:280:4 + (i32.store8 + ;;@ ~lib/memory.ts:280:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:280:22 + (i32.load8_u + ;;@ ~lib/memory.ts:280:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:281:4 + (i32.store8 + ;;@ ~lib/memory.ts:281:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:281:22 + (i32.load8_u + ;;@ ~lib/memory.ts:281:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:282:4 + (i32.store8 + ;;@ ~lib/memory.ts:282:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:282:22 + (i32.load8_u + ;;@ ~lib/memory.ts:282:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:283:4 + (i32.store8 + ;;@ ~lib/memory.ts:283:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:283:22 + (i32.load8_u + ;;@ ~lib/memory.ts:283:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:284:4 + (i32.store8 + ;;@ ~lib/memory.ts:284:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:284:22 + (i32.load8_u + ;;@ ~lib/memory.ts:284:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:285:4 + (i32.store8 + ;;@ ~lib/memory.ts:285:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:285:22 + (i32.load8_u + ;;@ ~lib/memory.ts:285:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:286:4 + (i32.store8 + ;;@ ~lib/memory.ts:286:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:286:22 + (i32.load8_u + ;;@ ~lib/memory.ts:286:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:288:2 + (if + ;;@ ~lib/memory.ts:288:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:288:10 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:288:13 + (block + ;;@ ~lib/memory.ts:289:4 + (i32.store8 + ;;@ ~lib/memory.ts:289:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:289:22 + (i32.load8_u + ;;@ ~lib/memory.ts:289:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:290:4 + (i32.store8 + ;;@ ~lib/memory.ts:290:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:290:22 + (i32.load8_u + ;;@ ~lib/memory.ts:290:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:291:4 + (i32.store8 + ;;@ ~lib/memory.ts:291:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:291:22 + (i32.load8_u + ;;@ ~lib/memory.ts:291:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:292:4 + (i32.store8 + ;;@ ~lib/memory.ts:292:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:292:22 + (i32.load8_u + ;;@ ~lib/memory.ts:292:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:294:2 + (if + ;;@ ~lib/memory.ts:294:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:294:10 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:294:13 + (block + ;;@ ~lib/memory.ts:295:4 + (i32.store8 + ;;@ ~lib/memory.ts:295:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:295:22 + (i32.load8_u + ;;@ ~lib/memory.ts:295:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:296:4 + (i32.store8 + ;;@ ~lib/memory.ts:296:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:296:22 + (i32.load8_u + ;;@ ~lib/memory.ts:296:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:298:2 + (if + ;;@ ~lib/memory.ts:298:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:298:10 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:298:13 + (i32.store8 + ;;@ ~lib/memory.ts:299:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:299:22 + (i32.load8_u + ;;@ ~lib/memory.ts:299:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.copy (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + ;;@ ~lib/memory.ts:79:4 + (if + ;;@ ~lib/memory.ts:79:8 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:79:16 + (get_local $1) + ) + ;;@ ~lib/memory.ts:79:21 + (return) + ) + ;;@ ~lib/memory.ts:80:4 + (if + ;;@ ~lib/memory.ts:80:8 + (if (result i32) + (tee_local $3 + (i32.le_u + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:80:14 + (get_local $2) + ) + ;;@ ~lib/memory.ts:80:19 + (get_local $0) + ) + ) + (get_local $3) + ;;@ ~lib/memory.ts:80:27 + (i32.le_u + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:80:34 + (get_local $2) + ) + ;;@ ~lib/memory.ts:80:39 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:80:44 + (block + ;;@ ~lib/memory.ts:81:6 + (call $~lib/memory/memcpy + ;;@ ~lib/memory.ts:81:13 + (get_local $0) + ;;@ ~lib/memory.ts:81:19 + (get_local $1) + ;;@ ~lib/memory.ts:81:24 + (get_local $2) + ) + ;;@ ~lib/memory.ts:82:6 + (return) + ) + ) + ;;@ ~lib/memory.ts:84:4 + (if + ;;@ ~lib/memory.ts:84:8 + (i32.lt_u + (get_local $0) + ;;@ ~lib/memory.ts:84:15 + (get_local $1) + ) + ;;@ ~lib/memory.ts:84:20 + (block + ;;@ ~lib/memory.ts:85:6 + (if + ;;@ ~lib/memory.ts:85:10 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:85:11 + (get_local $1) + ;;@ ~lib/memory.ts:85:17 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:85:23 + (i32.and + ;;@ ~lib/memory.ts:85:24 + (get_local $0) + ;;@ ~lib/memory.ts:85:31 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:85:35 + (block + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:86:15 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:86:22 + (i32.const 7) + ) + (block + (block + ;;@ ~lib/memory.ts:87:10 + (if + ;;@ ~lib/memory.ts:87:14 + (i32.eqz + ;;@ ~lib/memory.ts:87:15 + (get_local $2) + ) + ;;@ ~lib/memory.ts:87:18 + (return) + ) + ;;@ ~lib/memory.ts:88:10 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:88:12 + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:89:10 + (i32.store8 + ;;@ ~lib/memory.ts:89:20 + (block (result i32) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ;;@ ~lib/memory.ts:89:28 + (i32.load8_u + ;;@ ~lib/memory.ts:89:37 + (block (result i32) + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:91:8 + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:91:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:91:20 + (i32.const 8) + ) + (block + (block + ;;@ ~lib/memory.ts:92:10 + (i64.store + ;;@ ~lib/memory.ts:92:21 + (get_local $0) + ;;@ ~lib/memory.ts:92:27 + (i64.load + ;;@ ~lib/memory.ts:92:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:93:10 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:93:18 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:94:10 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:94:18 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:95:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:95:18 + (i32.const 8) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:98:6 + (block $break|2 + (loop $continue|2 + (if + ;;@ ~lib/memory.ts:98:13 + (get_local $2) + (block + (block + ;;@ ~lib/memory.ts:99:8 + (i32.store8 + ;;@ ~lib/memory.ts:99:18 + (block (result i32) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ;;@ ~lib/memory.ts:99:26 + (i32.load8_u + ;;@ ~lib/memory.ts:99:35 + (block (result i32) + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:100:8 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:100:10 + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|2) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:102:11 + (block + ;;@ ~lib/memory.ts:103:6 + (if + ;;@ ~lib/memory.ts:103:10 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:103:11 + (get_local $1) + ;;@ ~lib/memory.ts:103:17 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:103:23 + (i32.and + ;;@ ~lib/memory.ts:103:24 + (get_local $0) + ;;@ ~lib/memory.ts:103:31 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:103:35 + (block + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:104:15 + (i32.and + (i32.add + ;;@ ~lib/memory.ts:104:16 + (get_local $0) + ;;@ ~lib/memory.ts:104:23 + (get_local $2) + ) + ;;@ ~lib/memory.ts:104:28 + (i32.const 7) + ) + (block + (block + ;;@ ~lib/memory.ts:105:10 + (if + ;;@ ~lib/memory.ts:105:14 + (i32.eqz + ;;@ ~lib/memory.ts:105:15 + (get_local $2) + ) + ;;@ ~lib/memory.ts:105:18 + (return) + ) + ;;@ ~lib/memory.ts:106:10 + (i32.store8 + ;;@ ~lib/memory.ts:106:20 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:106:27 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:106:29 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:106:32 + (i32.load8_u + ;;@ ~lib/memory.ts:106:41 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:106:47 + (get_local $2) + ) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:108:8 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:108:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:108:20 + (i32.const 8) + ) + (block + (block + ;;@ ~lib/memory.ts:109:10 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:109:15 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:110:10 + (i64.store + ;;@ ~lib/memory.ts:110:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:110:28 + (get_local $2) + ) + ;;@ ~lib/memory.ts:110:31 + (i64.load + ;;@ ~lib/memory.ts:110:41 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:110:47 + (get_local $2) + ) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:113:6 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:113:13 + (get_local $2) + (block + ;;@ ~lib/memory.ts:113:16 + (i32.store8 + ;;@ ~lib/memory.ts:114:18 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:114:25 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:114:27 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:114:30 + (i32.load8_u + ;;@ ~lib/memory.ts:114:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:114:45 + (get_local $2) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.compare (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + ;;@ ~lib/memory.ts:122:4 + (if + ;;@ ~lib/memory.ts:122:8 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:122:14 + (get_local $1) + ) + ;;@ ~lib/memory.ts:122:25 + (return + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:123:4 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:123:11 + (if (result i32) + (tee_local $3 + (i32.ne + (get_local $2) + ;;@ ~lib/memory.ts:123:16 + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:123:21 + (i32.eq + (i32.load8_u + ;;@ ~lib/memory.ts:123:30 + (get_local $0) + ) + ;;@ ~lib/memory.ts:123:37 + (i32.load8_u + ;;@ ~lib/memory.ts:123:46 + (get_local $1) + ) + ) + (get_local $3) + ) + (block + (block + ;;@ ~lib/memory.ts:124:6 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:124:11 + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:124:17 + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:126:55 + (if (result i32) + ;;@ ~lib/memory.ts:126:11 + (get_local $2) + ;;@ ~lib/memory.ts:126:15 + (i32.sub + (i32.load8_u + ;;@ ~lib/memory.ts:126:29 + (get_local $0) + ) + ;;@ ~lib/memory.ts:126:35 + (i32.load8_u + ;;@ ~lib/memory.ts:126:49 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:126:55 + (i32.const 0) + ) + ) + (func $~lib/allocator/buddy/update_max_ptr (; 7 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:175:2 @@ -43,7 +3352,7 @@ ;;@ ~lib/allocator/buddy.ts:179:4 (set_local $1 ;;@ ~lib/allocator/buddy.ts:179:19 - (current_memory) + (call $~lib/memory/memory.size) ) ;;@ ~lib/allocator/buddy.ts:180:4 (set_local $2 @@ -65,7 +3374,7 @@ (i32.const -1) ) ) - ;;@ ~lib/allocator/buddy.ts:180:61 + ;;@ ~lib/allocator/buddy.ts:180:62 (i32.const 16) ) ) @@ -73,7 +3382,7 @@ (if (i32.eqz ;;@ ~lib/allocator/buddy.ts:181:11 - (i32.gt_u + (i32.gt_s (get_local $2) ;;@ ~lib/allocator/buddy.ts:181:22 (get_local $1) @@ -93,7 +3402,8 @@ (if ;;@ ~lib/allocator/buddy.ts:182:8 (i32.lt_s - (grow_memory + ;;@ ~lib/allocator/buddy.ts:182:15 + (call $~lib/memory/memory.grow ;;@ ~lib/allocator/buddy.ts:182:20 (i32.sub (get_local $2) @@ -124,7 +3434,7 @@ ;;@ ~lib/allocator/buddy.ts:188:9 (i32.const 1) ) - (func $~lib/allocator/buddy/buckets$get (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/buckets$get (; 8 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:101:2 (if (i32.eqz @@ -157,7 +3467,7 @@ ) ) ) - (func $~lib/allocator/buddy/list_init (; 3 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/buddy/list_init (; 9 ;) (type $iv) (param $0 i32) ;;@ ~lib/allocator/buddy.ts:197:2 (i32.store (get_local $0) @@ -171,7 +3481,7 @@ (get_local $0) ) ) - (func $~lib/allocator/buddy/list_push (; 4 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/allocator/buddy/list_push (; 10 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:206:2 (set_local $2 @@ -205,7 +3515,7 @@ (get_local $1) ) ) - (func $~lib/allocator/buddy/bucket_for_request (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/bucket_for_request (; 11 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:279:2 @@ -258,7 +3568,7 @@ ;;@ ~lib/allocator/buddy.ts:287:9 (get_local $1) ) - (func $~lib/allocator/buddy/node_for_ptr (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/allocator/buddy/node_for_ptr (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:252:75 (i32.sub ;;@ ~lib/allocator/buddy.ts:252:9 @@ -291,7 +3601,7 @@ (i32.const 1) ) ) - (func $~lib/allocator/buddy/node_is_split$get (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/node_is_split$get (; 13 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:147:2 (if (i32.eqz @@ -322,7 +3632,7 @@ ) ) ) - (func $~lib/allocator/buddy/parent_is_split (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/parent_is_split (; 14 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:259:2 (set_local $0 ;;@ ~lib/allocator/buddy.ts:259:10 @@ -367,7 +3677,7 @@ (i32.const 1) ) ) - (func $~lib/allocator/buddy/list_remove (; 9 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/buddy/list_remove (; 15 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:220:2 @@ -397,7 +3707,7 @@ (get_local $1) ) ) - (func $~lib/allocator/buddy/ptr_for_node (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/allocator/buddy/ptr_for_node (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:243:77 (i32.add ;;@ ~lib/allocator/buddy.ts:243:9 @@ -430,7 +3740,7 @@ ) ) ) - (func $~lib/allocator/buddy/node_is_split$set (; 11 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/allocator/buddy/node_is_split$set (; 17 ;) (type $iiv) (param $0 i32) (param $1 i32) ;;@ ~lib/allocator/buddy.ts:152:2 (if (i32.eqz @@ -463,7 +3773,7 @@ (get_local $1) ) ) - (func $~lib/allocator/buddy/flip_parent_is_split (; 12 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/buddy/flip_parent_is_split (; 18 ;) (type $iv) (param $0 i32) (local $1 i32) ;;@ ~lib/allocator/buddy.ts:267:2 (set_local $0 @@ -513,7 +3823,7 @@ ) ) ) - (func $~lib/allocator/buddy/lower_bucket_limit (; 13 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/lower_bucket_limit (; 19 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:296:2 @@ -684,7 +3994,7 @@ ;;@ ~lib/allocator/buddy.ts:338:9 (i32.const 1) ) - (func $~lib/allocator/buddy/list_pop (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/list_pop (; 20 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) ;;@ ~lib/allocator/buddy.ts:230:2 (set_local $1 @@ -714,7 +4024,7 @@ ;;@ ~lib/allocator/buddy.ts:233:9 (get_local $1) ) - (func $~lib/allocator/buddy/allocate_memory (; 15 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/__memory_allocate (; 21 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -769,8 +4079,8 @@ (set_global $~lib/allocator/buddy/max_ptr ;;@ ~lib/allocator/buddy.ts:360:14 (i32.shl - (current_memory) - ;;@ ~lib/allocator/buddy.ts:360:41 + (call $~lib/memory/memory.size) + ;;@ ~lib/allocator/buddy.ts:360:38 (i32.const 16) ) ) @@ -1143,7 +4453,17 @@ ;;@ ~lib/allocator/buddy.ts:473:9 (i32.const 0) ) - (func $~lib/allocator/buddy/free_memory (; 16 ;) (type $iv) (param $0 i32) + (func $~lib/memory/memory.allocate (; 22 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:142:4 + (return + ;;@ ~lib/memory.ts:142:45 + (call $~lib/allocator/buddy/__memory_allocate + ;;@ ~lib/memory.ts:142:63 + (get_local $0) + ) + ) + ) + (func $~lib/allocator/buddy/__memory_free (; 23 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -1296,7 +4616,26 @@ ) ) ) - (func $start (; 17 ;) (type $v) + (func $~lib/memory/memory.free (; 24 ;) (type $iv) (param $0 i32) + ;;@ ~lib/memory.ts:148:36 + (call $~lib/allocator/buddy/__memory_free + ;;@ ~lib/memory.ts:148:50 + (get_local $0) + ) + ;;@ ~lib/memory.ts:148:56 + (return) + ) + (func $~lib/allocator/buddy/__memory_reset (; 25 ;) (type $v) + ;;@ ~lib/allocator/buddy.ts:544:2 + (unreachable) + ) + (func $~lib/memory/memory.reset (; 26 ;) (type $v) + ;;@ ~lib/memory.ts:154:37 + (call $~lib/allocator/buddy/__memory_reset) + ;;@ ~lib/memory.ts:154:55 + (return) + ) + (func $start (; 27 ;) (type $v) (set_global $~lib/allocator/buddy/BUCKETS_START ;;@ ~lib/allocator/buddy.ts:97:27 (get_global $HEAP_BASE) diff --git a/tests/allocators/index.js b/tests/allocators/index.js index 8f82bd8c..f87bd13e 100644 --- a/tests/allocators/index.js +++ b/tests/allocators/index.js @@ -25,14 +25,18 @@ function test(file) { console.log("mem final: " + exports.memory.buffer.byteLength); console.log(); + const alloc = exports["memory.allocate"]; + var overflow = false; try { - exports.allocate_memory(COMMON_MAX + 1); // unreachable - throw Error("allocation is allowed to overflow MAX_SIZE"); + alloc(COMMON_MAX + 1); // unreachable + overflow = true; } catch (e) {} + if (overflow) throw Error("allocation can overflow COMMON_MAX + 1"); try { - exports.allocate_memory(0xffffffff); // unreachable - throw Error("allocation is allowed to overflow INT_MAX"); + alloc(0xffffffff); // unreachable + overflow = true; } catch (e) {} + if (overflow) throw Error("allocation can overflow 0xffffffff"); } if (process.argv.length > 2) { diff --git a/tests/allocators/runner.js b/tests/allocators/runner.js index 8458de8b..1a7bdaa5 100644 --- a/tests/allocators/runner.js +++ b/tests/allocators/runner.js @@ -1,19 +1,22 @@ -function runner(allocator, runs, allocs) { - var hasReset = !!allocator.reset_memory; - var useSet = !!allocator.set_memory; - console.log("hasReset=" + hasReset + ", useSet=" + useSet); - var ptrs = []; +const useFill = false; + +function runner(exports, runs, allocs) { + const alloc = exports["memory.allocate"]; + const free = exports["memory.free"]; + const fill = exports["memory.fill"]; + const reset = exports["memory.reset"]; + + const ptrs = []; function randomAlloc(maxSize) { if (!maxSize) maxSize = 8192; var size = ((Math.random() * maxSize) >>> 0) + 1; size = (size + 3) & ~3; - var ptr = allocator.allocate_memory(size); + var ptr = alloc(size); if (!ptr) throw Error(); if ((ptr & 7) != 0) throw Error("invalid alignment: " + (ptr & 7) + " on " + ptr); if (ptrs.indexOf(ptr) >= 0) throw Error("duplicate pointer"); - if (useSet) - allocator.set_memory(ptr, 0xdc, size); + if (useFill) fill(ptr, 0xdc, size); ptrs.push(ptr); return ptr; } @@ -24,7 +27,7 @@ function runner(allocator, runs, allocs) { var ptr = ptrs[idx]; ptrs.splice(idx, 1); if (typeof ptr !== "number") throw Error(); - allocator.free_memory(ptr); + free(ptr); } function randomFree() { @@ -32,22 +35,22 @@ function runner(allocator, runs, allocs) { var ptr = ptrs[idx]; if (typeof ptr !== "number") throw Error(); ptrs.splice(idx, 1); - allocator.free_memory(ptr); + free(ptr); } // remember the smallest possible memory address - var base = allocator.allocate_memory(64); + var base = alloc(64); console.log("base: " + base); - if (hasReset) { - allocator.reset_memory(); - } else { - allocator.free_memory(base); + try { + reset(); + } catch (e) { + free(base); } - var currentMem = allocator.memory.buffer.byteLength; + var currentMem = exports.memory.buffer.byteLength; console.log("mem initial: " + currentMem); function testMemChanged() { - var actualMem = allocator.memory.buffer.byteLength; + var actualMem = exports.memory.buffer.byteLength; if (actualMem > currentMem) { console.log("mem changed: " + currentMem + " -> " + actualMem); currentMem = actualMem; @@ -72,23 +75,20 @@ function runner(allocator, runs, allocs) { // free the rest, randomly while (ptrs.length) randomFree(); - if (hasReset) { - allocator.reset_memory(); - var ptr = allocator.allocate_memory(64); - if (ptr !== base) - throw Error("expected " + base + " but got " + ptr); - allocator.reset_memory(); - } else { + try { + reset(); + var ptr = alloc(64); + if (ptr !== base) throw Error("expected " + base + " but got " + ptr); + reset(); + } catch (e) { // should now be possible to reuse the entire memory // just try a large portion of the memory here, for example because of // SL+1 for allocations in TLSF - var size = ((allocator.memory.buffer.byteLength - base) * 9 / 10) >>> 0; - var ptr = allocator.allocate_memory(size); - if (useSet) - allocator.set_memory(ptr, 0xac, size); - if (ptr !== base) - throw Error("expected " + base + " but got " + ptr); - allocator.free_memory(ptr); + var size = ((exports.memory.buffer.byteLength - base) * 9 / 10) >>> 0; + var ptr = alloc(size); + if (useFill) fill(ptr, 0xac, size); + if (ptr !== base) throw Error("expected " + base + " but got " + ptr); + free(ptr); } testMemChanged(); } @@ -116,5 +116,4 @@ function mem(memory, offset, count) { console.log(hex.join(" ") + " ..."); } -if (typeof module === "object" && typeof exports === "object") - module.exports = runner; +if (typeof module === "object" && typeof exports === "object") module.exports = runner; diff --git a/tests/allocators/tlsf/assembly/index.ts b/tests/allocators/tlsf/assembly/index.ts index 92bad4b2..19faa6f7 100644 --- a/tests/allocators/tlsf/assembly/index.ts +++ b/tests/allocators/tlsf/assembly/index.ts @@ -1,3 +1,2 @@ import "allocator/tlsf"; -export { allocate_memory, free_memory }; -// export { set_memory }; +export { memory }; diff --git a/tests/allocators/tlsf/optimized.wat b/tests/allocators/tlsf/optimized.wat index 0910cc5c..6ed4b593 100644 --- a/tests/allocators/tlsf/optimized.wat +++ b/tests/allocators/tlsf/optimized.wat @@ -1,18 +1,3025 @@ (module + (type $i (func (result i32))) (type $ii (func (param i32) (result i32))) - (type $iiv (func (param i32 i32))) (type $iiiv (func (param i32 i32 i32))) - (type $iiiiv (func (param i32 i32 i32 i32))) (type $iiii (func (param i32 i32 i32) (result i32))) + (type $iiv (func (param i32 i32))) + (type $iiiiv (func (param i32 i32 i32 i32))) (type $iii (func (param i32 i32) (result i32))) (type $iv (func (param i32))) + (type $v (func)) (global $~lib/allocator/tlsf/ROOT (mut i32) (i32.const 0)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) - (export "allocate_memory" (func $~lib/allocator/tlsf/allocate_memory)) - (export "free_memory" (func $~lib/allocator/tlsf/free_memory)) + (export "memory.size" (func $~lib/memory/memory.size)) + (export "memory.grow" (func $~lib/memory/memory.grow)) + (export "memory.fill" (func $~lib/memory/memory.fill)) + (export "memory.copy" (func $~lib/memory/memory.copy)) + (export "memory.compare" (func $~lib/memory/memory.compare)) + (export "memory.allocate" (func $~lib/memory/memory.allocate)) + (export "memory.free" (func $~lib/memory/memory.free)) + (export "memory.reset" (func $~lib/memory/memory.reset)) (export "memory" (memory $0)) - (func $~lib/allocator/tlsf/Root#set:tailRef (; 0 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/memory/memory.size (; 0 ;) (type $i) (result i32) + ;;@ ~lib/memory.ts:4:25 + (current_memory) + ) + (func $~lib/memory/memory.grow (; 1 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:8:30 + (grow_memory + ;;@ ~lib/memory.ts:8:25 + (get_local $0) + ) + ) + (func $~lib/memory/memory.fill (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i64) + (local $4 i32) + ;;@ ~lib/memory.ts:17:4 + (if + ;;@ ~lib/memory.ts:17:8 + (i32.eqz + ;;@ ~lib/memory.ts:17:9 + (get_local $2) + ) + ;;@ ~lib/memory.ts:17:12 + (return) + ) + ;;@ ~lib/memory.ts:18:4 + (i32.store8 + ;;@ ~lib/memory.ts:18:14 + (get_local $0) + ;;@ ~lib/memory.ts:18:20 + (get_local $1) + ) + ;;@ ~lib/memory.ts:19:4 + (i32.store8 + ;;@ ~lib/memory.ts:19:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:19:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:19:25 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:19:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:20:4 + (if + ;;@ ~lib/memory.ts:20:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:20:13 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:20:16 + (return) + ) + ;;@ ~lib/memory.ts:22:4 + (i32.store8 + ;;@ ~lib/memory.ts:22:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:22:21 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:22:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:23:4 + (i32.store8 + ;;@ ~lib/memory.ts:23:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:23:21 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:23:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:24:4 + (i32.store8 + ;;@ ~lib/memory.ts:24:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:24:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:24:25 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:24:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:25:4 + (i32.store8 + ;;@ ~lib/memory.ts:25:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:25:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:25:25 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:25:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:26:4 + (if + ;;@ ~lib/memory.ts:26:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:26:13 + (i32.const 6) + ) + ;;@ ~lib/memory.ts:26:16 + (return) + ) + ;;@ ~lib/memory.ts:27:4 + (i32.store8 + ;;@ ~lib/memory.ts:27:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:27:21 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:27:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:28:4 + (i32.store8 + ;;@ ~lib/memory.ts:28:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:28:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:28:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:28:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:29:4 + (if + ;;@ ~lib/memory.ts:29:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:29:13 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:29:16 + (return) + ) + ;;@ ~lib/memory.ts:40:4 + (i32.store + ;;@ ~lib/memory.ts:33:4 + (tee_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:32:4 + (tee_local $4 + ;;@ ~lib/memory.ts:32:19 + (i32.and + (i32.sub + (i32.const 0) + ;;@ ~lib/memory.ts:32:20 + (get_local $0) + ) + ;;@ ~lib/memory.ts:32:27 + (i32.const 3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:37:4 + (tee_local $1 + ;;@ ~lib/memory.ts:37:19 + (i32.mul + (i32.and + ;;@ ~lib/memory.ts:37:35 + (get_local $1) + (i32.const 255) + ) + (i32.const 16843009) + ) + ) + ) + ;;@ ~lib/memory.ts:41:4 + (i32.store + ;;@ ~lib/memory.ts:41:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:35:4 + (tee_local $2 + (i32.and + (i32.sub + ;;@ ~lib/memory.ts:34:4 + (get_local $2) + ;;@ ~lib/memory.ts:34:9 + (get_local $4) + ) + ;;@ ~lib/memory.ts:35:9 + (i32.const -4) + ) + ) + ) + ;;@ ~lib/memory.ts:41:26 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:41:29 + (get_local $1) + ) + ;;@ ~lib/memory.ts:42:4 + (if + ;;@ ~lib/memory.ts:42:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:42:13 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:42:16 + (return) + ) + ;;@ ~lib/memory.ts:43:4 + (i32.store + ;;@ ~lib/memory.ts:43:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:43:22 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:43:25 + (get_local $1) + ) + ;;@ ~lib/memory.ts:44:4 + (i32.store + ;;@ ~lib/memory.ts:44:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:44:22 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:44:25 + (get_local $1) + ) + ;;@ ~lib/memory.ts:45:4 + (i32.store + ;;@ ~lib/memory.ts:45:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:45:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:45:26 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:45:30 + (get_local $1) + ) + ;;@ ~lib/memory.ts:46:4 + (i32.store + ;;@ ~lib/memory.ts:46:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:46:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:46:26 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:46:29 + (get_local $1) + ) + ;;@ ~lib/memory.ts:47:4 + (if + ;;@ ~lib/memory.ts:47:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:47:13 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:47:17 + (return) + ) + ;;@ ~lib/memory.ts:48:4 + (i32.store + ;;@ ~lib/memory.ts:48:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:48:22 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:48:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:49:4 + (i32.store + ;;@ ~lib/memory.ts:49:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:49:22 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:49:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:50:4 + (i32.store + ;;@ ~lib/memory.ts:50:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:50:22 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:50:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:51:4 + (i32.store + ;;@ ~lib/memory.ts:51:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:51:22 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:51:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:52:4 + (i32.store + ;;@ ~lib/memory.ts:52:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:52:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:52:26 + (i32.const 28) + ) + ;;@ ~lib/memory.ts:52:30 + (get_local $1) + ) + ;;@ ~lib/memory.ts:53:4 + (i32.store + ;;@ ~lib/memory.ts:53:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:53:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:53:26 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:53:30 + (get_local $1) + ) + ;;@ ~lib/memory.ts:54:4 + (i32.store + ;;@ ~lib/memory.ts:54:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:54:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:54:26 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:54:30 + (get_local $1) + ) + ;;@ ~lib/memory.ts:55:4 + (i32.store + ;;@ ~lib/memory.ts:55:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:55:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:55:26 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:55:30 + (get_local $1) + ) + ;;@ ~lib/memory.ts:59:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:58:4 + (tee_local $4 + ;;@ ~lib/memory.ts:58:8 + (i32.add + ;;@ ~lib/memory.ts:58:13 + (i32.and + ;;@ ~lib/memory.ts:58:14 + (get_local $0) + ;;@ ~lib/memory.ts:58:21 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:58:8 + (i32.const 24) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:60:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:60:9 + (get_local $4) + ) + ) + ;;@ ~lib/memory.ts:63:4 + (set_local $3 + ;;@ ~lib/memory.ts:63:19 + (i64.or + (i64.extend_u/i32 + (get_local $1) + ) + ;;@ ~lib/memory.ts:63:30 + (i64.shl + ;;@ ~lib/memory.ts:63:31 + (i64.extend_u/i32 + (get_local $1) + ) + ;;@ ~lib/memory.ts:63:43 + (i64.const 32) + ) + ) + ) + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:64:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:64:16 + (i32.const 32) + ) + (block + ;;@ ~lib/memory.ts:65:6 + (i64.store + ;;@ ~lib/memory.ts:65:17 + (get_local $0) + ;;@ ~lib/memory.ts:65:23 + (get_local $3) + ) + ;;@ ~lib/memory.ts:66:6 + (i64.store + ;;@ ~lib/memory.ts:66:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:66:24 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:66:27 + (get_local $3) + ) + ;;@ ~lib/memory.ts:67:6 + (i64.store + ;;@ ~lib/memory.ts:67:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:67:24 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:67:28 + (get_local $3) + ) + ;;@ ~lib/memory.ts:68:6 + (i64.store + ;;@ ~lib/memory.ts:68:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:68:24 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:68:28 + (get_local $3) + ) + ;;@ ~lib/memory.ts:69:6 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:69:11 + (i32.const 32) + ) + ) + ;;@ ~lib/memory.ts:70:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:70:14 + (i32.const 32) + ) + ) + (br $continue|0) + ) + ) + ) + ) + (func $~lib/memory/memcpy (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (loop $continue|0 + (if + (select + ;;@ ~lib/memory.ts:164:14 + (i32.and + ;;@ ~lib/memory.ts:164:15 + (get_local $1) + ;;@ ~lib/memory.ts:164:21 + (i32.const 3) + ) + (get_local $2) + ;;@ ~lib/memory.ts:164:9 + (get_local $2) + ) + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:165:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:165:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:165:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:165:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:166:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ;;@ ~lib/memory.ts:170:2 + (if + (i32.eqz + ;;@ ~lib/memory.ts:170:6 + (i32.and + ;;@ ~lib/memory.ts:170:7 + (get_local $0) + ;;@ ~lib/memory.ts:170:14 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:170:23 + (block + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:171:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:171:16 + (i32.const 16) + ) + (block + ;;@ ~lib/memory.ts:172:6 + (i32.store + ;;@ ~lib/memory.ts:172:17 + (get_local $0) + ;;@ ~lib/memory.ts:172:28 + (i32.load + ;;@ ~lib/memory.ts:172:38 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:173:6 + (i32.store + ;;@ ~lib/memory.ts:173:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:173:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:173:28 + (i32.load + ;;@ ~lib/memory.ts:173:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:173:45 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:174:6 + (i32.store + ;;@ ~lib/memory.ts:174:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:174:25 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:174:28 + (i32.load + ;;@ ~lib/memory.ts:174:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:174:45 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:175:6 + (i32.store + ;;@ ~lib/memory.ts:175:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:175:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:175:28 + (i32.load + ;;@ ~lib/memory.ts:175:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:175:44 + (i32.const 12) + ) + ) + ) + ;;@ ~lib/memory.ts:176:6 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:176:13 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:176:17 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:176:25 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:176:29 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:176:34 + (i32.const 16) + ) + ) + (br $continue|1) + ) + ) + ) + ;;@ ~lib/memory.ts:178:4 + (if + ;;@ ~lib/memory.ts:178:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:178:12 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:178:15 + (block + ;;@ ~lib/memory.ts:179:6 + (i32.store + ;;@ ~lib/memory.ts:179:17 + (get_local $0) + ;;@ ~lib/memory.ts:179:27 + (i32.load + ;;@ ~lib/memory.ts:179:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:180:6 + (i32.store + ;;@ ~lib/memory.ts:180:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:180:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:180:27 + (i32.load + ;;@ ~lib/memory.ts:180:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:180:43 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:181:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:181:14 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:181:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:181:24 + (i32.const 8) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:183:4 + (if + ;;@ ~lib/memory.ts:183:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:183:12 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:183:15 + (block + ;;@ ~lib/memory.ts:184:6 + (i32.store + ;;@ ~lib/memory.ts:184:17 + (get_local $0) + ;;@ ~lib/memory.ts:184:23 + (i32.load + ;;@ ~lib/memory.ts:184:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:185:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:185:14 + (i32.const 4) + ) + ) + ;;@ ~lib/memory.ts:185:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:185:24 + (i32.const 4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:187:4 + (if + ;;@ ~lib/memory.ts:187:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:187:12 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:187:15 + (block + ;;@ ~lib/memory.ts:188:6 + (i32.store16 + ;;@ ~lib/memory.ts:188:17 + (get_local $0) + ;;@ ~lib/memory.ts:188:23 + (i32.load16_u + ;;@ ~lib/memory.ts:188:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:189:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:189:14 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:189:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:189:24 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:191:4 + (if + ;;@ ~lib/memory.ts:191:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:191:12 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:192:16 + (block + (set_local $3 + (get_local $0) + ) + ;;@ ~lib/memory.ts:191:15 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:192:33 + (block (result i32) + (set_local $3 + (get_local $1) + ) + ;;@ ~lib/memory.ts:192:24 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:194:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:199:2 + (if + ;;@ ~lib/memory.ts:199:6 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:199:11 + (i32.const 32) + ) + ;;@ ~lib/memory.ts:199:15 + (block $break|2 + (block $case2|2 + (block $case1|2 + (block $case0|2 + (block $tablify|0 + (br_table $case0|2 $case1|2 $case2|2 $tablify|0 + (i32.sub + ;;@ ~lib/memory.ts:200:12 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:200:19 + (i32.const 3) + ) + (i32.const 1) + ) + ) + ) + (br $break|2) + ) + ;;@ ~lib/memory.ts:203:8 + (set_local $4 + ;;@ ~lib/memory.ts:203:12 + (i32.load + ;;@ ~lib/memory.ts:203:22 + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:204:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:204:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:204:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:204:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:205:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:205:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:205:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:205:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:206:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:206:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:206:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:206:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:207:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:207:13 + (i32.const 3) + ) + ) + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:208:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:208:20 + (i32.const 17) + ) + (block + ;;@ ~lib/memory.ts:210:10 + (i32.store + ;;@ ~lib/memory.ts:210:21 + (get_local $0) + ;;@ ~lib/memory.ts:210:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:210:32 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:210:37 + (i32.shl + ;;@ ~lib/memory.ts:209:10 + (tee_local $3 + ;;@ ~lib/memory.ts:209:14 + (i32.load + ;;@ ~lib/memory.ts:209:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:209:30 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:210:42 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:212:10 + (i32.store + ;;@ ~lib/memory.ts:212:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:212:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:212:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:212:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:212:41 + (i32.shl + ;;@ ~lib/memory.ts:211:10 + (tee_local $4 + ;;@ ~lib/memory.ts:211:14 + (i32.load + ;;@ ~lib/memory.ts:211:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:211:30 + (i32.const 5) + ) + ) + ) + ;;@ ~lib/memory.ts:212:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:214:10 + (i32.store + ;;@ ~lib/memory.ts:214:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:214:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:214:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:214:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:214:41 + (i32.shl + ;;@ ~lib/memory.ts:213:10 + (tee_local $3 + ;;@ ~lib/memory.ts:213:14 + (i32.load + ;;@ ~lib/memory.ts:213:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:213:30 + (i32.const 9) + ) + ) + ) + ;;@ ~lib/memory.ts:214:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:216:10 + (i32.store + ;;@ ~lib/memory.ts:216:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:216:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:216:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:216:37 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:216:42 + (i32.shl + ;;@ ~lib/memory.ts:215:10 + (tee_local $4 + ;;@ ~lib/memory.ts:215:14 + (i32.load + ;;@ ~lib/memory.ts:215:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:215:30 + (i32.const 13) + ) + ) + ) + ;;@ ~lib/memory.ts:216:47 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:217:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:217:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:217:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:217:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:217:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:217:38 + (i32.const 16) + ) + ) + (br $continue|3) + ) + ) + ) + ;;@ ~lib/memory.ts:219:8 + (br $break|2) + ) + ;;@ ~lib/memory.ts:222:8 + (set_local $4 + ;;@ ~lib/memory.ts:222:12 + (i32.load + ;;@ ~lib/memory.ts:222:22 + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:223:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:223:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:223:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:223:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:224:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:224:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:224:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:224:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:225:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:225:13 + (i32.const 2) + ) + ) + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:226:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:226:20 + (i32.const 18) + ) + (block + ;;@ ~lib/memory.ts:228:10 + (i32.store + ;;@ ~lib/memory.ts:228:21 + (get_local $0) + ;;@ ~lib/memory.ts:228:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:228:32 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:228:37 + (i32.shl + ;;@ ~lib/memory.ts:227:10 + (tee_local $3 + ;;@ ~lib/memory.ts:227:14 + (i32.load + ;;@ ~lib/memory.ts:227:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:227:30 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/memory.ts:228:42 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:230:10 + (i32.store + ;;@ ~lib/memory.ts:230:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:230:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:230:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:230:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:230:41 + (i32.shl + ;;@ ~lib/memory.ts:229:10 + (tee_local $4 + ;;@ ~lib/memory.ts:229:14 + (i32.load + ;;@ ~lib/memory.ts:229:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:229:30 + (i32.const 6) + ) + ) + ) + ;;@ ~lib/memory.ts:230:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:232:10 + (i32.store + ;;@ ~lib/memory.ts:232:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:232:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:232:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:232:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:232:41 + (i32.shl + ;;@ ~lib/memory.ts:231:10 + (tee_local $3 + ;;@ ~lib/memory.ts:231:14 + (i32.load + ;;@ ~lib/memory.ts:231:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:231:30 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/memory.ts:232:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:234:10 + (i32.store + ;;@ ~lib/memory.ts:234:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:234:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:234:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:234:37 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:234:42 + (i32.shl + ;;@ ~lib/memory.ts:233:10 + (tee_local $4 + ;;@ ~lib/memory.ts:233:14 + (i32.load + ;;@ ~lib/memory.ts:233:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:233:30 + (i32.const 14) + ) + ) + ) + ;;@ ~lib/memory.ts:234:47 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:235:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:235:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:235:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:235:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:235:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:235:38 + (i32.const 16) + ) + ) + (br $continue|4) + ) + ) + ) + ;;@ ~lib/memory.ts:237:8 + (br $break|2) + ) + ;;@ ~lib/memory.ts:240:8 + (set_local $4 + ;;@ ~lib/memory.ts:240:12 + (i32.load + ;;@ ~lib/memory.ts:240:22 + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:241:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:241:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:241:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:241:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:242:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:242:13 + (i32.const 1) + ) + ) + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:243:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:243:20 + (i32.const 19) + ) + (block + ;;@ ~lib/memory.ts:245:10 + (i32.store + ;;@ ~lib/memory.ts:245:21 + (get_local $0) + ;;@ ~lib/memory.ts:245:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:245:32 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:245:36 + (i32.shl + ;;@ ~lib/memory.ts:244:10 + (tee_local $3 + ;;@ ~lib/memory.ts:244:14 + (i32.load + ;;@ ~lib/memory.ts:244:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:244:30 + (i32.const 3) + ) + ) + ) + ;;@ ~lib/memory.ts:245:41 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:247:10 + (i32.store + ;;@ ~lib/memory.ts:247:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:247:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:247:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:247:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:247:40 + (i32.shl + ;;@ ~lib/memory.ts:246:10 + (tee_local $4 + ;;@ ~lib/memory.ts:246:14 + (i32.load + ;;@ ~lib/memory.ts:246:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:246:30 + (i32.const 7) + ) + ) + ) + ;;@ ~lib/memory.ts:247:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:249:10 + (i32.store + ;;@ ~lib/memory.ts:249:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:249:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:249:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:249:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:249:40 + (i32.shl + ;;@ ~lib/memory.ts:248:10 + (tee_local $3 + ;;@ ~lib/memory.ts:248:14 + (i32.load + ;;@ ~lib/memory.ts:248:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:248:30 + (i32.const 11) + ) + ) + ) + ;;@ ~lib/memory.ts:249:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:251:10 + (i32.store + ;;@ ~lib/memory.ts:251:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:251:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:251:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:251:37 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:251:41 + (i32.shl + ;;@ ~lib/memory.ts:250:10 + (tee_local $4 + ;;@ ~lib/memory.ts:250:14 + (i32.load + ;;@ ~lib/memory.ts:250:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:250:30 + (i32.const 15) + ) + ) + ) + ;;@ ~lib/memory.ts:251:46 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:252:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:252:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:252:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:252:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:252:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:252:38 + (i32.const 16) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:260:2 + (if + ;;@ ~lib/memory.ts:260:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:260:10 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:260:14 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:261:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:261:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:261:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:261:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:262:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:262:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:262:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:262:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:263:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:263:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:263:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:263:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:264:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:264:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:264:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:264:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:265:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:265:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:265:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:265:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:266:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:266:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:266:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:266:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:267:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:267:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:267:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:267:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:268:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:268:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:268:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:268:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:269:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:269:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:269:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:269:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:270:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:270:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:270:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:270:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:271:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:271:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:271:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:271:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:272:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:272:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:272:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:272:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:273:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:273:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:273:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:273:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:274:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:274:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:274:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:274:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:275:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:275:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:275:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:275:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:276:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:276:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:276:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:276:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:278:2 + (if + ;;@ ~lib/memory.ts:278:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:278:10 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:278:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:279:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:279:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:279:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:279:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:280:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:280:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:280:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:280:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:281:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:281:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:281:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:281:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:282:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:282:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:282:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:282:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:283:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:283:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:283:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:283:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:284:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:284:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:284:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:284:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:285:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:285:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:285:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:285:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:286:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:286:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:286:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:286:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:288:2 + (if + ;;@ ~lib/memory.ts:288:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:288:10 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:288:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:289:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:289:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:289:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:289:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:290:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:290:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:290:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:290:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:291:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:291:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:291:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:291:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:292:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:292:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:292:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:292:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:294:2 + (if + ;;@ ~lib/memory.ts:294:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:294:10 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:294:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:295:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:295:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:295:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:295:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:296:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:296:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:296:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:296:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:298:2 + (if + ;;@ ~lib/memory.ts:298:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:298:10 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:299:14 + (block + (set_local $3 + (get_local $0) + ) + ;;@ ~lib/memory.ts:298:13 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:299:31 + (block (result i32) + (set_local $3 + (get_local $1) + ) + ;;@ ~lib/memory.ts:299:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.copy (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + ;;@ ~lib/memory.ts:79:4 + (if + ;;@ ~lib/memory.ts:79:8 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:79:16 + (get_local $1) + ) + ;;@ ~lib/memory.ts:79:21 + (return) + ) + ;;@ ~lib/memory.ts:80:4 + (if + ;;@ ~lib/memory.ts:80:8 + (if (result i32) + (tee_local $3 + (i32.le_u + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:80:14 + (get_local $2) + ) + ;;@ ~lib/memory.ts:80:19 + (get_local $0) + ) + ) + (get_local $3) + ;;@ ~lib/memory.ts:80:27 + (i32.le_u + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:80:34 + (get_local $2) + ) + ;;@ ~lib/memory.ts:80:39 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:80:44 + (block + ;;@ ~lib/memory.ts:81:6 + (call $~lib/memory/memcpy + ;;@ ~lib/memory.ts:81:13 + (get_local $0) + ;;@ ~lib/memory.ts:81:19 + (get_local $1) + ;;@ ~lib/memory.ts:81:24 + (get_local $2) + ) + ;;@ ~lib/memory.ts:82:6 + (return) + ) + ) + ;;@ ~lib/memory.ts:84:4 + (if + ;;@ ~lib/memory.ts:84:8 + (i32.lt_u + (get_local $0) + ;;@ ~lib/memory.ts:84:15 + (get_local $1) + ) + ;;@ ~lib/memory.ts:84:20 + (block + ;;@ ~lib/memory.ts:85:6 + (if + ;;@ ~lib/memory.ts:85:10 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:85:11 + (get_local $1) + ;;@ ~lib/memory.ts:85:17 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:85:23 + (i32.and + ;;@ ~lib/memory.ts:85:24 + (get_local $0) + ;;@ ~lib/memory.ts:85:31 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:85:35 + (block + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:86:15 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:86:22 + (i32.const 7) + ) + (block + ;;@ ~lib/memory.ts:87:10 + (if + ;;@ ~lib/memory.ts:87:14 + (i32.eqz + ;;@ ~lib/memory.ts:87:15 + (get_local $2) + ) + ;;@ ~lib/memory.ts:87:18 + (return) + ) + ;;@ ~lib/memory.ts:88:10 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:88:12 + (get_local $2) + (i32.const 1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:89:20 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:89:10 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:89:37 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:89:28 + (i32.load8_u + (get_local $3) + ) + ) + ) + (br $continue|0) + ) + ) + ) + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:91:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:91:20 + (i32.const 8) + ) + (block + ;;@ ~lib/memory.ts:92:10 + (i64.store + ;;@ ~lib/memory.ts:92:21 + (get_local $0) + ;;@ ~lib/memory.ts:92:27 + (i64.load + ;;@ ~lib/memory.ts:92:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:93:10 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:93:18 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:94:10 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:94:18 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:95:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:95:18 + (i32.const 8) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ) + (loop $continue|2 + (if + ;;@ ~lib/memory.ts:98:13 + (get_local $2) + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:99:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:99:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:99:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:99:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:100:8 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:100:10 + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:102:11 + (block + ;;@ ~lib/memory.ts:103:6 + (if + ;;@ ~lib/memory.ts:103:10 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:103:11 + (get_local $1) + ;;@ ~lib/memory.ts:103:17 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:103:23 + (i32.and + ;;@ ~lib/memory.ts:103:24 + (get_local $0) + ;;@ ~lib/memory.ts:103:31 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:103:35 + (block + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:104:15 + (i32.and + (i32.add + ;;@ ~lib/memory.ts:104:16 + (get_local $0) + ;;@ ~lib/memory.ts:104:23 + (get_local $2) + ) + ;;@ ~lib/memory.ts:104:28 + (i32.const 7) + ) + (block + ;;@ ~lib/memory.ts:105:10 + (if + ;;@ ~lib/memory.ts:105:14 + (i32.eqz + ;;@ ~lib/memory.ts:105:15 + (get_local $2) + ) + ;;@ ~lib/memory.ts:105:18 + (return) + ) + ;;@ ~lib/memory.ts:106:10 + (i32.store8 + ;;@ ~lib/memory.ts:106:20 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:106:27 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:106:29 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:106:32 + (i32.load8_u + ;;@ ~lib/memory.ts:106:41 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:106:47 + (get_local $2) + ) + ) + ) + (br $continue|3) + ) + ) + ) + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:108:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:108:20 + (i32.const 8) + ) + (block + ;;@ ~lib/memory.ts:110:10 + (i64.store + ;;@ ~lib/memory.ts:110:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:109:10 + (tee_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:109:15 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:110:31 + (i64.load + ;;@ ~lib/memory.ts:110:41 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:110:47 + (get_local $2) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ) + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:113:13 + (get_local $2) + (block + ;;@ ~lib/memory.ts:113:16 + (i32.store8 + ;;@ ~lib/memory.ts:114:18 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:114:25 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:114:27 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:114:30 + (i32.load8_u + ;;@ ~lib/memory.ts:114:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:114:45 + (get_local $2) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.compare (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + ;;@ ~lib/memory.ts:122:4 + (if + ;;@ ~lib/memory.ts:122:8 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:122:14 + (get_local $1) + ) + ;;@ ~lib/memory.ts:122:25 + (return + (i32.const 0) + ) + ) + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:123:11 + (if (result i32) + (tee_local $3 + (i32.ne + (get_local $2) + ;;@ ~lib/memory.ts:123:16 + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:123:21 + (i32.eq + (i32.load8_u + ;;@ ~lib/memory.ts:123:30 + (get_local $0) + ) + ;;@ ~lib/memory.ts:123:37 + (i32.load8_u + ;;@ ~lib/memory.ts:123:46 + (get_local $1) + ) + ) + (get_local $3) + ) + (block + ;;@ ~lib/memory.ts:124:6 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:124:11 + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:124:17 + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ;;@ ~lib/memory.ts:126:55 + (if (result i32) + ;;@ ~lib/memory.ts:126:11 + (get_local $2) + ;;@ ~lib/memory.ts:126:15 + (i32.sub + (i32.load8_u + ;;@ ~lib/memory.ts:126:29 + (get_local $0) + ) + ;;@ ~lib/memory.ts:126:35 + (i32.load8_u + ;;@ ~lib/memory.ts:126:49 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:126:55 + (i32.const 0) + ) + ) + (func $~lib/allocator/tlsf/Root#set:tailRef (; 6 ;) (type $iiv) (param $0 i32) (param $1 i32) ;;@ ~lib/allocator/tlsf.ts:181:30 (i32.store ;;@ ~lib/allocator/tlsf.ts:181:43 @@ -21,7 +3028,7 @@ (get_local $1) ) ) - (func $~lib/allocator/tlsf/Root#setSLMap (; 1 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/allocator/tlsf/Root#setSLMap (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) ;;@ ~lib/allocator/tlsf.ts:145:4 (i32.store offset=4 ;;@ ~lib/allocator/tlsf.ts:145:15 @@ -38,7 +3045,7 @@ (get_local $2) ) ) - (func $~lib/allocator/tlsf/Root#setHead (; 2 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/allocator/tlsf/Root#setHead (; 8 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) ;;@ ~lib/allocator/tlsf.ts:169:4 (i32.store offset=96 ;;@ ~lib/allocator/tlsf.ts:170:6 @@ -64,7 +3071,7 @@ (get_local $3) ) ) - (func $~lib/allocator/tlsf/Block#get:right (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/Block#get:right (; 9 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:94:4 (i32.add ;;@ ~lib/allocator/tlsf.ts:92:8 @@ -83,7 +3090,7 @@ ) ) ) - (func $~lib/allocator/tlsf/fls (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/fls (; 10 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:430:26 (i32.sub ;;@ ~lib/allocator/tlsf.ts:430:9 @@ -95,7 +3102,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Root#getHead (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/allocator/tlsf/Root#getHead (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:162:20 (i32.load offset=96 ;;@ ~lib/allocator/tlsf.ts:161:6 @@ -119,7 +3126,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Root#getSLMap (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/allocator/tlsf/Root#getSLMap (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:139:68 (i32.load offset=4 ;;@ ~lib/allocator/tlsf.ts:139:21 @@ -134,7 +3141,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Root#remove (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/allocator/tlsf/Root#remove (; 13 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -343,7 +3350,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Root#insert (; 8 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/allocator/tlsf/Root#insert (; 14 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -655,7 +3662,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Root#addMemory (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/allocator/tlsf/Root#addMemory (; 15 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) ;;@ ~lib/allocator/tlsf.ts:383:4 @@ -790,7 +3797,7 @@ ;;@ ~lib/allocator/tlsf.ts:416:11 (i32.const 1) ) - (func $~lib/allocator/tlsf/Root#search (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/allocator/tlsf/Root#search (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $1 ;;@ ~lib/allocator/tlsf.ts:300:4 @@ -960,7 +3967,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Root#use (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/allocator/tlsf/Root#use (; 17 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) ;;@ ~lib/allocator/tlsf.ts:347:4 @@ -1089,7 +4096,7 @@ (i32.const 8) ) ) - (func $~lib/allocator/tlsf/allocate_memory (; 12 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/__memory_allocate (; 18 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -1143,7 +4150,6 @@ ) ;;@ ~lib/allocator/tlsf.ts:446:4 (tee_local $5 - ;;@ ~lib/allocator/tlsf.ts:446:22 (current_memory) ) ) @@ -1277,7 +4283,7 @@ ;;@ ~lib/allocator/tlsf.ts:458:66 (i32.shl (current_memory) - ;;@ ~lib/allocator/tlsf.ts:458:86 + ;;@ ~lib/allocator/tlsf.ts:458:83 (i32.const 16) ) ) @@ -1332,13 +4338,11 @@ (i32.const -8) ) ) - (tee_local $5 - ;;@ ~lib/allocator/tlsf.ts:466:51 - (i32.const 16) - ) + ;;@ ~lib/allocator/tlsf.ts:466:51 + (i32.const 16) (i32.gt_u (get_local $1) - (get_local $5) + (i32.const 16) ) ) ) @@ -1357,7 +4361,6 @@ (tee_local $3 ;;@ ~lib/allocator/tlsf.ts:472:6 (tee_local $5 - ;;@ ~lib/allocator/tlsf.ts:472:24 (current_memory) ) ) @@ -1419,7 +4422,6 @@ ) ;;@ ~lib/allocator/tlsf.ts:481:47 (i32.shl - ;;@ ~lib/allocator/tlsf.ts:480:23 (current_memory) ;;@ ~lib/allocator/tlsf.ts:481:68 (i32.const 16) @@ -1455,7 +4457,14 @@ ;;@ ~lib/allocator/tlsf.ts:489:9 (get_local $4) ) - (func $~lib/allocator/tlsf/free_memory (; 13 ;) (type $iv) (param $0 i32) + (func $~lib/memory/memory.allocate (; 19 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:142:45 + (call $~lib/allocator/tlsf/__memory_allocate + ;;@ ~lib/memory.ts:142:63 + (get_local $0) + ) + ) + (func $~lib/allocator/tlsf/__memory_free (; 20 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) ;;@ ~lib/allocator/tlsf.ts:495:2 @@ -1509,4 +4518,14 @@ ) ) ) + (func $~lib/memory/memory.free (; 21 ;) (type $iv) (param $0 i32) + ;;@ ~lib/memory.ts:148:36 + (call $~lib/allocator/tlsf/__memory_free + ;;@ ~lib/memory.ts:148:50 + (get_local $0) + ) + ) + (func $~lib/memory/memory.reset (; 22 ;) (type $v) + (unreachable) + ) ) diff --git a/tests/allocators/tlsf/untouched.wat b/tests/allocators/tlsf/untouched.wat index a096f818..6359b3cd 100644 --- a/tests/allocators/tlsf/untouched.wat +++ b/tests/allocators/tlsf/untouched.wat @@ -1,9 +1,10 @@ (module (type $iiiiv (func (param i32 i32 i32 i32))) + (type $i (func (result i32))) (type $ii (func (param i32) (result i32))) - (type $iiv (func (param i32 i32))) (type $iiiv (func (param i32 i32 i32))) (type $iiii (func (param i32 i32 i32) (result i32))) + (type $iiv (func (param i32 i32))) (type $iii (func (param i32 i32) (result i32))) (type $iv (func (param i32))) (type $v (func)) @@ -24,11 +25,3317 @@ (global $HEAP_BASE i32 (i32.const 56)) (memory $0 1) (data (i32.const 8) "\16\00\00\00~\00l\00i\00b\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00/\00t\00l\00s\00f\00.\00t\00s\00") - (export "allocate_memory" (func $~lib/allocator/tlsf/allocate_memory)) - (export "free_memory" (func $~lib/allocator/tlsf/free_memory)) + (export "memory.size" (func $~lib/memory/memory.size)) + (export "memory.grow" (func $~lib/memory/memory.grow)) + (export "memory.fill" (func $~lib/memory/memory.fill)) + (export "memory.copy" (func $~lib/memory/memory.copy)) + (export "memory.compare" (func $~lib/memory/memory.compare)) + (export "memory.allocate" (func $~lib/memory/memory.allocate)) + (export "memory.free" (func $~lib/memory/memory.free)) + (export "memory.reset" (func $~lib/memory/memory.reset)) (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/tlsf/Root#set:tailRef (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/memory/memory.size (; 1 ;) (type $i) (result i32) + ;;@ ~lib/memory.ts:4:25 + (current_memory) + ) + (func $~lib/memory/memory.grow (; 2 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:8:30 + (grow_memory + ;;@ ~lib/memory.ts:8:25 + (get_local $0) + ) + ) + (func $~lib/memory/memory.fill (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i64) + ;;@ ~lib/memory.ts:17:4 + (if + ;;@ ~lib/memory.ts:17:8 + (i32.eqz + ;;@ ~lib/memory.ts:17:9 + (get_local $2) + ) + ;;@ ~lib/memory.ts:17:12 + (return) + ) + ;;@ ~lib/memory.ts:18:4 + (i32.store8 + ;;@ ~lib/memory.ts:18:14 + (get_local $0) + ;;@ ~lib/memory.ts:18:20 + (get_local $1) + ) + ;;@ ~lib/memory.ts:19:4 + (i32.store8 + ;;@ ~lib/memory.ts:19:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:19:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:19:25 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:19:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:20:4 + (if + ;;@ ~lib/memory.ts:20:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:20:13 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:20:16 + (return) + ) + ;;@ ~lib/memory.ts:22:4 + (i32.store8 + ;;@ ~lib/memory.ts:22:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:22:21 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:22:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:23:4 + (i32.store8 + ;;@ ~lib/memory.ts:23:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:23:21 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:23:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:24:4 + (i32.store8 + ;;@ ~lib/memory.ts:24:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:24:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:24:25 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:24:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:25:4 + (i32.store8 + ;;@ ~lib/memory.ts:25:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:25:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:25:25 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:25:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:26:4 + (if + ;;@ ~lib/memory.ts:26:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:26:13 + (i32.const 6) + ) + ;;@ ~lib/memory.ts:26:16 + (return) + ) + ;;@ ~lib/memory.ts:27:4 + (i32.store8 + ;;@ ~lib/memory.ts:27:14 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:27:21 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:27:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:28:4 + (i32.store8 + ;;@ ~lib/memory.ts:28:14 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:28:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:28:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:28:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:29:4 + (if + ;;@ ~lib/memory.ts:29:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:29:13 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:29:16 + (return) + ) + ;;@ ~lib/memory.ts:32:4 + (set_local $3 + ;;@ ~lib/memory.ts:32:19 + (i32.and + (i32.sub + (i32.const 0) + ;;@ ~lib/memory.ts:32:20 + (get_local $0) + ) + ;;@ ~lib/memory.ts:32:27 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:33:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:33:12 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:34:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:34:9 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:35:4 + (set_local $2 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:35:9 + (i32.const -4) + ) + ) + ;;@ ~lib/memory.ts:37:4 + (set_local $4 + ;;@ ~lib/memory.ts:37:19 + (i32.mul + (i32.div_u + (i32.const -1) + ;;@ ~lib/memory.ts:37:29 + (i32.const 255) + ) + (i32.and + ;;@ ~lib/memory.ts:37:35 + (get_local $1) + (i32.const 255) + ) + ) + ) + ;;@ ~lib/memory.ts:40:4 + (i32.store + ;;@ ~lib/memory.ts:40:15 + (get_local $0) + ;;@ ~lib/memory.ts:40:21 + (get_local $4) + ) + ;;@ ~lib/memory.ts:41:4 + (i32.store + ;;@ ~lib/memory.ts:41:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:41:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:41:26 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:41:29 + (get_local $4) + ) + ;;@ ~lib/memory.ts:42:4 + (if + ;;@ ~lib/memory.ts:42:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:42:13 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:42:16 + (return) + ) + ;;@ ~lib/memory.ts:43:4 + (i32.store + ;;@ ~lib/memory.ts:43:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:43:22 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:43:25 + (get_local $4) + ) + ;;@ ~lib/memory.ts:44:4 + (i32.store + ;;@ ~lib/memory.ts:44:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:44:22 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:44:25 + (get_local $4) + ) + ;;@ ~lib/memory.ts:45:4 + (i32.store + ;;@ ~lib/memory.ts:45:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:45:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:45:26 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:45:30 + (get_local $4) + ) + ;;@ ~lib/memory.ts:46:4 + (i32.store + ;;@ ~lib/memory.ts:46:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:46:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:46:26 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:46:29 + (get_local $4) + ) + ;;@ ~lib/memory.ts:47:4 + (if + ;;@ ~lib/memory.ts:47:8 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:47:13 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:47:17 + (return) + ) + ;;@ ~lib/memory.ts:48:4 + (i32.store + ;;@ ~lib/memory.ts:48:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:48:22 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:48:26 + (get_local $4) + ) + ;;@ ~lib/memory.ts:49:4 + (i32.store + ;;@ ~lib/memory.ts:49:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:49:22 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:49:26 + (get_local $4) + ) + ;;@ ~lib/memory.ts:50:4 + (i32.store + ;;@ ~lib/memory.ts:50:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:50:22 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:50:26 + (get_local $4) + ) + ;;@ ~lib/memory.ts:51:4 + (i32.store + ;;@ ~lib/memory.ts:51:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:51:22 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:51:26 + (get_local $4) + ) + ;;@ ~lib/memory.ts:52:4 + (i32.store + ;;@ ~lib/memory.ts:52:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:52:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:52:26 + (i32.const 28) + ) + ;;@ ~lib/memory.ts:52:30 + (get_local $4) + ) + ;;@ ~lib/memory.ts:53:4 + (i32.store + ;;@ ~lib/memory.ts:53:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:53:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:53:26 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:53:30 + (get_local $4) + ) + ;;@ ~lib/memory.ts:54:4 + (i32.store + ;;@ ~lib/memory.ts:54:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:54:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:54:26 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:54:30 + (get_local $4) + ) + ;;@ ~lib/memory.ts:55:4 + (i32.store + ;;@ ~lib/memory.ts:55:15 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:55:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:55:26 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:55:30 + (get_local $4) + ) + ;;@ ~lib/memory.ts:58:4 + (set_local $3 + ;;@ ~lib/memory.ts:58:8 + (i32.add + (i32.const 24) + ;;@ ~lib/memory.ts:58:13 + (i32.and + ;;@ ~lib/memory.ts:58:14 + (get_local $0) + ;;@ ~lib/memory.ts:58:21 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:59:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:59:12 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:60:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:60:9 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:63:4 + (set_local $5 + ;;@ ~lib/memory.ts:63:19 + (i64.or + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/memory.ts:63:30 + (i64.shl + ;;@ ~lib/memory.ts:63:31 + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/memory.ts:63:43 + (i64.const 32) + ) + ) + ) + ;;@ ~lib/memory.ts:64:4 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:64:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:64:16 + (i32.const 32) + ) + (block + (block + ;;@ ~lib/memory.ts:65:6 + (i64.store + ;;@ ~lib/memory.ts:65:17 + (get_local $0) + ;;@ ~lib/memory.ts:65:23 + (get_local $5) + ) + ;;@ ~lib/memory.ts:66:6 + (i64.store + ;;@ ~lib/memory.ts:66:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:66:24 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:66:27 + (get_local $5) + ) + ;;@ ~lib/memory.ts:67:6 + (i64.store + ;;@ ~lib/memory.ts:67:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:67:24 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:67:28 + (get_local $5) + ) + ;;@ ~lib/memory.ts:68:6 + (i64.store + ;;@ ~lib/memory.ts:68:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:68:24 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:68:28 + (get_local $5) + ) + ;;@ ~lib/memory.ts:69:6 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:69:11 + (i32.const 32) + ) + ) + ;;@ ~lib/memory.ts:70:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:70:14 + (i32.const 32) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ) + (func $~lib/memory/memcpy (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + ;;@ ~lib/memory.ts:164:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:164:9 + (if (result i32) + (get_local $2) + ;;@ ~lib/memory.ts:164:14 + (i32.and + ;;@ ~lib/memory.ts:164:15 + (get_local $1) + ;;@ ~lib/memory.ts:164:21 + (i32.const 3) + ) + (get_local $2) + ) + (block + (block + ;;@ ~lib/memory.ts:165:4 + (i32.store8 + ;;@ ~lib/memory.ts:165:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:165:22 + (i32.load8_u + ;;@ ~lib/memory.ts:165:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:166:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:170:2 + (if + ;;@ ~lib/memory.ts:170:6 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:170:7 + (get_local $0) + ;;@ ~lib/memory.ts:170:14 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:170:20 + (i32.const 0) + ) + ;;@ ~lib/memory.ts:170:23 + (block + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:171:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:171:16 + (i32.const 16) + ) + (block + (block + ;;@ ~lib/memory.ts:172:6 + (i32.store + ;;@ ~lib/memory.ts:172:17 + (get_local $0) + ;;@ ~lib/memory.ts:172:28 + (i32.load + ;;@ ~lib/memory.ts:172:38 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:173:6 + (i32.store + ;;@ ~lib/memory.ts:173:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:173:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:173:28 + (i32.load + ;;@ ~lib/memory.ts:173:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:173:45 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:174:6 + (i32.store + ;;@ ~lib/memory.ts:174:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:174:25 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:174:28 + (i32.load + ;;@ ~lib/memory.ts:174:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:174:45 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:175:6 + (i32.store + ;;@ ~lib/memory.ts:175:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:175:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:175:28 + (i32.load + ;;@ ~lib/memory.ts:175:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:175:44 + (i32.const 12) + ) + ) + ) + ;;@ ~lib/memory.ts:176:6 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:176:13 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:176:17 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:176:25 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:176:29 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:176:34 + (i32.const 16) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:178:4 + (if + ;;@ ~lib/memory.ts:178:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:178:12 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:178:15 + (block + ;;@ ~lib/memory.ts:179:6 + (i32.store + ;;@ ~lib/memory.ts:179:17 + (get_local $0) + ;;@ ~lib/memory.ts:179:27 + (i32.load + ;;@ ~lib/memory.ts:179:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:180:6 + (i32.store + ;;@ ~lib/memory.ts:180:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:180:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:180:27 + (i32.load + ;;@ ~lib/memory.ts:180:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:180:43 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:181:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:181:14 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:181:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:181:24 + (i32.const 8) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:183:4 + (if + ;;@ ~lib/memory.ts:183:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:183:12 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:183:15 + (block + ;;@ ~lib/memory.ts:184:6 + (i32.store + ;;@ ~lib/memory.ts:184:17 + (get_local $0) + ;;@ ~lib/memory.ts:184:23 + (i32.load + ;;@ ~lib/memory.ts:184:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:185:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:185:14 + (i32.const 4) + ) + ) + ;;@ ~lib/memory.ts:185:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:185:24 + (i32.const 4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:187:4 + (if + ;;@ ~lib/memory.ts:187:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:187:12 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:187:15 + (block + ;;@ ~lib/memory.ts:188:6 + (i32.store16 + ;;@ ~lib/memory.ts:188:17 + (get_local $0) + ;;@ ~lib/memory.ts:188:23 + (i32.load16_u + ;;@ ~lib/memory.ts:188:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:189:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:189:14 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:189:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:189:24 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:191:4 + (if + ;;@ ~lib/memory.ts:191:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:191:12 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:191:15 + (i32.store8 + ;;@ ~lib/memory.ts:192:16 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:192:24 + (i32.load8_u + ;;@ ~lib/memory.ts:192:33 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:194:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:199:2 + (if + ;;@ ~lib/memory.ts:199:6 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:199:11 + (i32.const 32) + ) + ;;@ ~lib/memory.ts:199:15 + (block $break|2 + (block $case2|2 + (block $case1|2 + (block $case0|2 + (set_local $5 + ;;@ ~lib/memory.ts:200:12 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:200:19 + (i32.const 3) + ) + ) + (br_if $case0|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:202:11 + (i32.const 1) + ) + ) + (br_if $case1|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:221:11 + (i32.const 2) + ) + ) + (br_if $case2|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:239:11 + (i32.const 3) + ) + ) + (br $break|2) + ) + ;;@ ~lib/memory.ts:202:14 + (block + ;;@ ~lib/memory.ts:203:8 + (set_local $3 + ;;@ ~lib/memory.ts:203:12 + (i32.load + ;;@ ~lib/memory.ts:203:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:204:8 + (i32.store8 + ;;@ ~lib/memory.ts:204:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:204:26 + (i32.load8_u + ;;@ ~lib/memory.ts:204:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:205:8 + (i32.store8 + ;;@ ~lib/memory.ts:205:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:205:26 + (i32.load8_u + ;;@ ~lib/memory.ts:205:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:206:8 + (i32.store8 + ;;@ ~lib/memory.ts:206:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:206:26 + (i32.load8_u + ;;@ ~lib/memory.ts:206:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:207:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:207:13 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:208:8 + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:208:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:208:20 + (i32.const 17) + ) + (block + (block + ;;@ ~lib/memory.ts:209:10 + (set_local $4 + ;;@ ~lib/memory.ts:209:14 + (i32.load + ;;@ ~lib/memory.ts:209:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:209:30 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:210:10 + (i32.store + ;;@ ~lib/memory.ts:210:21 + (get_local $0) + ;;@ ~lib/memory.ts:210:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:210:32 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:210:37 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:210:42 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:211:10 + (set_local $3 + ;;@ ~lib/memory.ts:211:14 + (i32.load + ;;@ ~lib/memory.ts:211:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:211:30 + (i32.const 5) + ) + ) + ) + ;;@ ~lib/memory.ts:212:10 + (i32.store + ;;@ ~lib/memory.ts:212:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:212:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:212:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:212:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:212:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:212:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:213:10 + (set_local $4 + ;;@ ~lib/memory.ts:213:14 + (i32.load + ;;@ ~lib/memory.ts:213:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:213:30 + (i32.const 9) + ) + ) + ) + ;;@ ~lib/memory.ts:214:10 + (i32.store + ;;@ ~lib/memory.ts:214:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:214:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:214:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:214:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:214:41 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:214:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:215:10 + (set_local $3 + ;;@ ~lib/memory.ts:215:14 + (i32.load + ;;@ ~lib/memory.ts:215:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:215:30 + (i32.const 13) + ) + ) + ) + ;;@ ~lib/memory.ts:216:10 + (i32.store + ;;@ ~lib/memory.ts:216:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:216:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:216:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:216:37 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:216:42 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:216:47 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:217:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:217:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:217:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:217:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:217:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:217:38 + (i32.const 16) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:219:8 + (br $break|2) + ) + ) + ;;@ ~lib/memory.ts:221:14 + (block + ;;@ ~lib/memory.ts:222:8 + (set_local $3 + ;;@ ~lib/memory.ts:222:12 + (i32.load + ;;@ ~lib/memory.ts:222:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:223:8 + (i32.store8 + ;;@ ~lib/memory.ts:223:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:223:26 + (i32.load8_u + ;;@ ~lib/memory.ts:223:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:224:8 + (i32.store8 + ;;@ ~lib/memory.ts:224:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:224:26 + (i32.load8_u + ;;@ ~lib/memory.ts:224:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:225:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:225:13 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:226:8 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:226:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:226:20 + (i32.const 18) + ) + (block + (block + ;;@ ~lib/memory.ts:227:10 + (set_local $4 + ;;@ ~lib/memory.ts:227:14 + (i32.load + ;;@ ~lib/memory.ts:227:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:227:30 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/memory.ts:228:10 + (i32.store + ;;@ ~lib/memory.ts:228:21 + (get_local $0) + ;;@ ~lib/memory.ts:228:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:228:32 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:228:37 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:228:42 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:229:10 + (set_local $3 + ;;@ ~lib/memory.ts:229:14 + (i32.load + ;;@ ~lib/memory.ts:229:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:229:30 + (i32.const 6) + ) + ) + ) + ;;@ ~lib/memory.ts:230:10 + (i32.store + ;;@ ~lib/memory.ts:230:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:230:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:230:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:230:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:230:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:230:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:231:10 + (set_local $4 + ;;@ ~lib/memory.ts:231:14 + (i32.load + ;;@ ~lib/memory.ts:231:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:231:30 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/memory.ts:232:10 + (i32.store + ;;@ ~lib/memory.ts:232:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:232:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:232:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:232:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:232:41 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:232:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:233:10 + (set_local $3 + ;;@ ~lib/memory.ts:233:14 + (i32.load + ;;@ ~lib/memory.ts:233:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:233:30 + (i32.const 14) + ) + ) + ) + ;;@ ~lib/memory.ts:234:10 + (i32.store + ;;@ ~lib/memory.ts:234:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:234:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:234:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:234:37 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:234:42 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:234:47 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:235:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:235:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:235:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:235:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:235:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:235:38 + (i32.const 16) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:237:8 + (br $break|2) + ) + ) + ;;@ ~lib/memory.ts:239:14 + (block + ;;@ ~lib/memory.ts:240:8 + (set_local $3 + ;;@ ~lib/memory.ts:240:12 + (i32.load + ;;@ ~lib/memory.ts:240:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:241:8 + (i32.store8 + ;;@ ~lib/memory.ts:241:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:241:26 + (i32.load8_u + ;;@ ~lib/memory.ts:241:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:242:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:242:13 + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:243:8 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:243:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:243:20 + (i32.const 19) + ) + (block + (block + ;;@ ~lib/memory.ts:244:10 + (set_local $4 + ;;@ ~lib/memory.ts:244:14 + (i32.load + ;;@ ~lib/memory.ts:244:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:244:30 + (i32.const 3) + ) + ) + ) + ;;@ ~lib/memory.ts:245:10 + (i32.store + ;;@ ~lib/memory.ts:245:21 + (get_local $0) + ;;@ ~lib/memory.ts:245:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:245:32 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:245:36 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:245:41 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:246:10 + (set_local $3 + ;;@ ~lib/memory.ts:246:14 + (i32.load + ;;@ ~lib/memory.ts:246:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:246:30 + (i32.const 7) + ) + ) + ) + ;;@ ~lib/memory.ts:247:10 + (i32.store + ;;@ ~lib/memory.ts:247:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:247:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:247:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:247:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:247:40 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:247:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:248:10 + (set_local $4 + ;;@ ~lib/memory.ts:248:14 + (i32.load + ;;@ ~lib/memory.ts:248:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:248:30 + (i32.const 11) + ) + ) + ) + ;;@ ~lib/memory.ts:249:10 + (i32.store + ;;@ ~lib/memory.ts:249:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:249:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:249:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:249:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:249:40 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:249:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:250:10 + (set_local $3 + ;;@ ~lib/memory.ts:250:14 + (i32.load + ;;@ ~lib/memory.ts:250:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:250:30 + (i32.const 15) + ) + ) + ) + ;;@ ~lib/memory.ts:251:10 + (i32.store + ;;@ ~lib/memory.ts:251:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:251:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:251:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:251:37 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:251:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:251:46 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:252:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:252:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:252:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:252:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:252:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:252:38 + (i32.const 16) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:254:8 + (br $break|2) + ) + ) + ) + ;;@ ~lib/memory.ts:260:2 + (if + ;;@ ~lib/memory.ts:260:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:260:10 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:260:14 + (block + ;;@ ~lib/memory.ts:261:4 + (i32.store8 + ;;@ ~lib/memory.ts:261:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:261:22 + (i32.load8_u + ;;@ ~lib/memory.ts:261:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:262:4 + (i32.store8 + ;;@ ~lib/memory.ts:262:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:262:22 + (i32.load8_u + ;;@ ~lib/memory.ts:262:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:263:4 + (i32.store8 + ;;@ ~lib/memory.ts:263:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:263:22 + (i32.load8_u + ;;@ ~lib/memory.ts:263:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:264:4 + (i32.store8 + ;;@ ~lib/memory.ts:264:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:264:22 + (i32.load8_u + ;;@ ~lib/memory.ts:264:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:265:4 + (i32.store8 + ;;@ ~lib/memory.ts:265:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:265:22 + (i32.load8_u + ;;@ ~lib/memory.ts:265:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:266:4 + (i32.store8 + ;;@ ~lib/memory.ts:266:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:266:22 + (i32.load8_u + ;;@ ~lib/memory.ts:266:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:267:4 + (i32.store8 + ;;@ ~lib/memory.ts:267:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:267:22 + (i32.load8_u + ;;@ ~lib/memory.ts:267:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:268:4 + (i32.store8 + ;;@ ~lib/memory.ts:268:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:268:22 + (i32.load8_u + ;;@ ~lib/memory.ts:268:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:269:4 + (i32.store8 + ;;@ ~lib/memory.ts:269:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:269:22 + (i32.load8_u + ;;@ ~lib/memory.ts:269:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:270:4 + (i32.store8 + ;;@ ~lib/memory.ts:270:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:270:22 + (i32.load8_u + ;;@ ~lib/memory.ts:270:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:271:4 + (i32.store8 + ;;@ ~lib/memory.ts:271:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:271:22 + (i32.load8_u + ;;@ ~lib/memory.ts:271:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:272:4 + (i32.store8 + ;;@ ~lib/memory.ts:272:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:272:22 + (i32.load8_u + ;;@ ~lib/memory.ts:272:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:273:4 + (i32.store8 + ;;@ ~lib/memory.ts:273:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:273:22 + (i32.load8_u + ;;@ ~lib/memory.ts:273:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:274:4 + (i32.store8 + ;;@ ~lib/memory.ts:274:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:274:22 + (i32.load8_u + ;;@ ~lib/memory.ts:274:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:275:4 + (i32.store8 + ;;@ ~lib/memory.ts:275:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:275:22 + (i32.load8_u + ;;@ ~lib/memory.ts:275:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:276:4 + (i32.store8 + ;;@ ~lib/memory.ts:276:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:276:22 + (i32.load8_u + ;;@ ~lib/memory.ts:276:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:278:2 + (if + ;;@ ~lib/memory.ts:278:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:278:10 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:278:13 + (block + ;;@ ~lib/memory.ts:279:4 + (i32.store8 + ;;@ ~lib/memory.ts:279:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:279:22 + (i32.load8_u + ;;@ ~lib/memory.ts:279:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:280:4 + (i32.store8 + ;;@ ~lib/memory.ts:280:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:280:22 + (i32.load8_u + ;;@ ~lib/memory.ts:280:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:281:4 + (i32.store8 + ;;@ ~lib/memory.ts:281:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:281:22 + (i32.load8_u + ;;@ ~lib/memory.ts:281:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:282:4 + (i32.store8 + ;;@ ~lib/memory.ts:282:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:282:22 + (i32.load8_u + ;;@ ~lib/memory.ts:282:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:283:4 + (i32.store8 + ;;@ ~lib/memory.ts:283:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:283:22 + (i32.load8_u + ;;@ ~lib/memory.ts:283:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:284:4 + (i32.store8 + ;;@ ~lib/memory.ts:284:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:284:22 + (i32.load8_u + ;;@ ~lib/memory.ts:284:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:285:4 + (i32.store8 + ;;@ ~lib/memory.ts:285:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:285:22 + (i32.load8_u + ;;@ ~lib/memory.ts:285:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:286:4 + (i32.store8 + ;;@ ~lib/memory.ts:286:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:286:22 + (i32.load8_u + ;;@ ~lib/memory.ts:286:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:288:2 + (if + ;;@ ~lib/memory.ts:288:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:288:10 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:288:13 + (block + ;;@ ~lib/memory.ts:289:4 + (i32.store8 + ;;@ ~lib/memory.ts:289:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:289:22 + (i32.load8_u + ;;@ ~lib/memory.ts:289:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:290:4 + (i32.store8 + ;;@ ~lib/memory.ts:290:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:290:22 + (i32.load8_u + ;;@ ~lib/memory.ts:290:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:291:4 + (i32.store8 + ;;@ ~lib/memory.ts:291:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:291:22 + (i32.load8_u + ;;@ ~lib/memory.ts:291:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:292:4 + (i32.store8 + ;;@ ~lib/memory.ts:292:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:292:22 + (i32.load8_u + ;;@ ~lib/memory.ts:292:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:294:2 + (if + ;;@ ~lib/memory.ts:294:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:294:10 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:294:13 + (block + ;;@ ~lib/memory.ts:295:4 + (i32.store8 + ;;@ ~lib/memory.ts:295:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:295:22 + (i32.load8_u + ;;@ ~lib/memory.ts:295:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/memory.ts:296:4 + (i32.store8 + ;;@ ~lib/memory.ts:296:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:296:22 + (i32.load8_u + ;;@ ~lib/memory.ts:296:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:298:2 + (if + ;;@ ~lib/memory.ts:298:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:298:10 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:298:13 + (i32.store8 + ;;@ ~lib/memory.ts:299:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/memory.ts:299:22 + (i32.load8_u + ;;@ ~lib/memory.ts:299:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.copy (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + ;;@ ~lib/memory.ts:79:4 + (if + ;;@ ~lib/memory.ts:79:8 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:79:16 + (get_local $1) + ) + ;;@ ~lib/memory.ts:79:21 + (return) + ) + ;;@ ~lib/memory.ts:80:4 + (if + ;;@ ~lib/memory.ts:80:8 + (if (result i32) + (tee_local $3 + (i32.le_u + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:80:14 + (get_local $2) + ) + ;;@ ~lib/memory.ts:80:19 + (get_local $0) + ) + ) + (get_local $3) + ;;@ ~lib/memory.ts:80:27 + (i32.le_u + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:80:34 + (get_local $2) + ) + ;;@ ~lib/memory.ts:80:39 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:80:44 + (block + ;;@ ~lib/memory.ts:81:6 + (call $~lib/memory/memcpy + ;;@ ~lib/memory.ts:81:13 + (get_local $0) + ;;@ ~lib/memory.ts:81:19 + (get_local $1) + ;;@ ~lib/memory.ts:81:24 + (get_local $2) + ) + ;;@ ~lib/memory.ts:82:6 + (return) + ) + ) + ;;@ ~lib/memory.ts:84:4 + (if + ;;@ ~lib/memory.ts:84:8 + (i32.lt_u + (get_local $0) + ;;@ ~lib/memory.ts:84:15 + (get_local $1) + ) + ;;@ ~lib/memory.ts:84:20 + (block + ;;@ ~lib/memory.ts:85:6 + (if + ;;@ ~lib/memory.ts:85:10 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:85:11 + (get_local $1) + ;;@ ~lib/memory.ts:85:17 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:85:23 + (i32.and + ;;@ ~lib/memory.ts:85:24 + (get_local $0) + ;;@ ~lib/memory.ts:85:31 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:85:35 + (block + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:86:15 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:86:22 + (i32.const 7) + ) + (block + (block + ;;@ ~lib/memory.ts:87:10 + (if + ;;@ ~lib/memory.ts:87:14 + (i32.eqz + ;;@ ~lib/memory.ts:87:15 + (get_local $2) + ) + ;;@ ~lib/memory.ts:87:18 + (return) + ) + ;;@ ~lib/memory.ts:88:10 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:88:12 + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:89:10 + (i32.store8 + ;;@ ~lib/memory.ts:89:20 + (block (result i32) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ;;@ ~lib/memory.ts:89:28 + (i32.load8_u + ;;@ ~lib/memory.ts:89:37 + (block (result i32) + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:91:8 + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:91:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:91:20 + (i32.const 8) + ) + (block + (block + ;;@ ~lib/memory.ts:92:10 + (i64.store + ;;@ ~lib/memory.ts:92:21 + (get_local $0) + ;;@ ~lib/memory.ts:92:27 + (i64.load + ;;@ ~lib/memory.ts:92:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:93:10 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:93:18 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:94:10 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:94:18 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:95:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:95:18 + (i32.const 8) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:98:6 + (block $break|2 + (loop $continue|2 + (if + ;;@ ~lib/memory.ts:98:13 + (get_local $2) + (block + (block + ;;@ ~lib/memory.ts:99:8 + (i32.store8 + ;;@ ~lib/memory.ts:99:18 + (block (result i32) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ;;@ ~lib/memory.ts:99:26 + (i32.load8_u + ;;@ ~lib/memory.ts:99:35 + (block (result i32) + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:100:8 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:100:10 + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|2) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:102:11 + (block + ;;@ ~lib/memory.ts:103:6 + (if + ;;@ ~lib/memory.ts:103:10 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:103:11 + (get_local $1) + ;;@ ~lib/memory.ts:103:17 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:103:23 + (i32.and + ;;@ ~lib/memory.ts:103:24 + (get_local $0) + ;;@ ~lib/memory.ts:103:31 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:103:35 + (block + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:104:15 + (i32.and + (i32.add + ;;@ ~lib/memory.ts:104:16 + (get_local $0) + ;;@ ~lib/memory.ts:104:23 + (get_local $2) + ) + ;;@ ~lib/memory.ts:104:28 + (i32.const 7) + ) + (block + (block + ;;@ ~lib/memory.ts:105:10 + (if + ;;@ ~lib/memory.ts:105:14 + (i32.eqz + ;;@ ~lib/memory.ts:105:15 + (get_local $2) + ) + ;;@ ~lib/memory.ts:105:18 + (return) + ) + ;;@ ~lib/memory.ts:106:10 + (i32.store8 + ;;@ ~lib/memory.ts:106:20 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:106:27 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:106:29 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:106:32 + (i32.load8_u + ;;@ ~lib/memory.ts:106:41 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:106:47 + (get_local $2) + ) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:108:8 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:108:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:108:20 + (i32.const 8) + ) + (block + (block + ;;@ ~lib/memory.ts:109:10 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:109:15 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:110:10 + (i64.store + ;;@ ~lib/memory.ts:110:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:110:28 + (get_local $2) + ) + ;;@ ~lib/memory.ts:110:31 + (i64.load + ;;@ ~lib/memory.ts:110:41 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:110:47 + (get_local $2) + ) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:113:6 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:113:13 + (get_local $2) + (block + ;;@ ~lib/memory.ts:113:16 + (i32.store8 + ;;@ ~lib/memory.ts:114:18 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:114:25 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:114:27 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:114:30 + (i32.load8_u + ;;@ ~lib/memory.ts:114:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:114:45 + (get_local $2) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.compare (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + ;;@ ~lib/memory.ts:122:4 + (if + ;;@ ~lib/memory.ts:122:8 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:122:14 + (get_local $1) + ) + ;;@ ~lib/memory.ts:122:25 + (return + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:123:4 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:123:11 + (if (result i32) + (tee_local $3 + (i32.ne + (get_local $2) + ;;@ ~lib/memory.ts:123:16 + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:123:21 + (i32.eq + (i32.load8_u + ;;@ ~lib/memory.ts:123:30 + (get_local $0) + ) + ;;@ ~lib/memory.ts:123:37 + (i32.load8_u + ;;@ ~lib/memory.ts:123:46 + (get_local $1) + ) + ) + (get_local $3) + ) + (block + (block + ;;@ ~lib/memory.ts:124:6 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:124:11 + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:124:17 + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:126:55 + (if (result i32) + ;;@ ~lib/memory.ts:126:11 + (get_local $2) + ;;@ ~lib/memory.ts:126:15 + (i32.sub + (i32.load8_u + ;;@ ~lib/memory.ts:126:29 + (get_local $0) + ) + ;;@ ~lib/memory.ts:126:35 + (i32.load8_u + ;;@ ~lib/memory.ts:126:49 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:126:55 + (i32.const 0) + ) + ) + (func $~lib/allocator/tlsf/Root#set:tailRef (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32) ;;@ ~lib/allocator/tlsf.ts:181:30 (i32.store offset=2912 ;;@ ~lib/allocator/tlsf.ts:181:43 @@ -37,7 +3344,7 @@ (get_local $1) ) ) - (func $~lib/allocator/tlsf/Root#setSLMap (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/allocator/tlsf/Root#setSLMap (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) ;;@ ~lib/allocator/tlsf.ts:144:4 (if (i32.eqz @@ -74,7 +3381,7 @@ (get_local $2) ) ) - (func $~lib/allocator/tlsf/Root#setHead (; 3 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/allocator/tlsf/Root#setHead (; 9 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) ;;@ ~lib/allocator/tlsf.ts:167:4 (if (i32.eqz @@ -140,14 +3447,14 @@ (get_local $3) ) ) - (func $~lib/allocator/tlsf/Root#get:tailRef (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/Root#get:tailRef (; 10 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:180:58 (i32.load offset=2912 ;;@ ~lib/allocator/tlsf.ts:180:44 (i32.const 0) ) ) - (func $~lib/allocator/tlsf/Block#get:right (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/Block#get:right (; 11 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) ;;@ ~lib/allocator/tlsf.ts:89:4 (if @@ -215,7 +3522,7 @@ (get_local $1) ) ) - (func $~lib/allocator/tlsf/fls (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/fls (; 12 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:428:2 (if (i32.eqz @@ -247,7 +3554,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Root#getHead (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/allocator/tlsf/Root#getHead (; 13 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:158:4 (if (i32.eqz @@ -311,7 +3618,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Root#getSLMap (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/allocator/tlsf/Root#getSLMap (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:138:4 (if (i32.eqz @@ -346,7 +3653,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Root#remove (; 9 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/allocator/tlsf/Root#remove (; 15 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -640,7 +3947,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Block#get:left (; 10 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/Block#get:left (; 16 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) ;;@ ~lib/allocator/tlsf.ts:81:4 (if @@ -691,7 +3998,7 @@ (get_local $1) ) ) - (func $~lib/allocator/tlsf/Root#setJump (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/allocator/tlsf/Root#setJump (; 17 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) ;;@ ~lib/allocator/tlsf.ts:334:4 (if (i32.eqz @@ -770,7 +4077,7 @@ (get_local $1) ) ) - (func $~lib/allocator/tlsf/Root#insert (; 12 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/allocator/tlsf/Root#insert (; 18 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1288,7 +4595,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Root#addMemory (; 13 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/allocator/tlsf/Root#addMemory (; 19 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1582,7 +4889,7 @@ ;;@ ~lib/allocator/tlsf.ts:416:11 (i32.const 1) ) - (func $~lib/allocator/tlsf/ffs (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/ffs (; 20 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:422:2 (if (i32.eqz @@ -1609,7 +4916,7 @@ (get_local $0) ) ) - (func $~lib/allocator/tlsf/ffs (; 15 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/ffs (; 21 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:422:2 (if (i32.eqz @@ -1636,7 +4943,7 @@ (get_local $0) ) ) - (func $~lib/allocator/tlsf/Root#search (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/allocator/tlsf/Root#search (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1927,7 +5234,7 @@ ;;@ ~lib/allocator/tlsf.ts:329:11 (get_local $6) ) - (func $~lib/allocator/tlsf/Root#use (; 17 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/allocator/tlsf/Root#use (; 23 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2169,7 +5476,7 @@ (i32.const 8) ) ) - (func $~lib/allocator/tlsf/allocate_memory (; 18 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/__memory_allocate (; 24 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -2212,8 +5519,8 @@ ) ;;@ ~lib/allocator/tlsf.ts:446:4 (set_local $3 - ;;@ ~lib/allocator/tlsf.ts:446:22 - (current_memory) + ;;@ ~lib/allocator/tlsf.ts:446:29 + (call $~lib/memory/memory.size) ) ;;@ ~lib/allocator/tlsf.ts:447:4 (set_local $4 @@ -2257,7 +5564,8 @@ ) ;;@ ~lib/allocator/tlsf.ts:448:37 (i32.lt_s - (grow_memory + ;;@ ~lib/allocator/tlsf.ts:448:44 + (call $~lib/memory/memory.grow ;;@ ~lib/allocator/tlsf.ts:448:49 (i32.sub (get_local $4) @@ -2400,8 +5708,9 @@ ) ;;@ ~lib/allocator/tlsf.ts:458:66 (i32.shl - (current_memory) - ;;@ ~lib/allocator/tlsf.ts:458:86 + ;;@ ~lib/allocator/tlsf.ts:458:73 + (call $~lib/memory/memory.size) + ;;@ ~lib/allocator/tlsf.ts:458:83 (i32.const 16) ) ) @@ -2482,8 +5791,8 @@ (block ;;@ ~lib/allocator/tlsf.ts:472:6 (set_local $3 - ;;@ ~lib/allocator/tlsf.ts:472:24 - (current_memory) + ;;@ ~lib/allocator/tlsf.ts:472:31 + (call $~lib/memory/memory.size) ) ;;@ ~lib/allocator/tlsf.ts:473:6 (set_local $2 @@ -2531,7 +5840,8 @@ (if ;;@ ~lib/allocator/tlsf.ts:475:10 (i32.lt_s - (grow_memory + ;;@ ~lib/allocator/tlsf.ts:475:17 + (call $~lib/memory/memory.grow ;;@ ~lib/allocator/tlsf.ts:475:22 (get_local $5) ) @@ -2542,7 +5852,8 @@ (if ;;@ ~lib/allocator/tlsf.ts:476:12 (i32.lt_s - (grow_memory + ;;@ ~lib/allocator/tlsf.ts:476:19 + (call $~lib/memory/memory.grow ;;@ ~lib/allocator/tlsf.ts:476:24 (get_local $2) ) @@ -2555,8 +5866,8 @@ ) ;;@ ~lib/allocator/tlsf.ts:480:6 (set_local $6 - ;;@ ~lib/allocator/tlsf.ts:480:23 - (current_memory) + ;;@ ~lib/allocator/tlsf.ts:480:30 + (call $~lib/memory/memory.size) ) ;;@ ~lib/allocator/tlsf.ts:481:11 (drop @@ -2654,7 +5965,17 @@ ;;@ ~lib/allocator/tlsf.ts:489:9 (get_local $7) ) - (func $~lib/allocator/tlsf/free_memory (; 19 ;) (type $iv) (param $0 i32) + (func $~lib/memory/memory.allocate (; 25 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:142:4 + (return + ;;@ ~lib/memory.ts:142:45 + (call $~lib/allocator/tlsf/__memory_allocate + ;;@ ~lib/memory.ts:142:63 + (get_local $0) + ) + ) + ) + (func $~lib/allocator/tlsf/__memory_free (; 26 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -2743,7 +6064,26 @@ ) ) ) - (func $start (; 20 ;) (type $v) + (func $~lib/memory/memory.free (; 27 ;) (type $iv) (param $0 i32) + ;;@ ~lib/memory.ts:148:36 + (call $~lib/allocator/tlsf/__memory_free + ;;@ ~lib/memory.ts:148:50 + (get_local $0) + ) + ;;@ ~lib/memory.ts:148:56 + (return) + ) + (func $~lib/allocator/tlsf/__memory_reset (; 28 ;) (type $v) + ;;@ ~lib/allocator/tlsf.ts:509:2 + (unreachable) + ) + (func $~lib/memory/memory.reset (; 29 ;) (type $v) + ;;@ ~lib/memory.ts:154:37 + (call $~lib/allocator/tlsf/__memory_reset) + ;;@ ~lib/memory.ts:154:55 + (return) + ) + (func $start (; 30 ;) (type $v) ;;@ ~lib/allocator/tlsf.ts:122:0 (if (i32.eqz diff --git a/tests/binaryen/const-global.js b/tests/binaryen/const-global.js new file mode 100644 index 00000000..bd10d398 --- /dev/null +++ b/tests/binaryen/const-global.js @@ -0,0 +1,18 @@ +var binaryen = require("binaryen"); + +var mod = new binaryen.Module(); + +mod.addGlobal("testGlobal", binaryen.i32, false, mod.i32.const(2)); +var funcType = mod.addFunctionType("i", binaryen.i32, []); +mod.addFunction("test", funcType, [], + mod.get_global("testGlobal", binaryen.i32) +); +mod.addFunctionExport("test", "test"); + +binaryen.setOptimizeLevel(4); +binaryen.setShrinkLevel(0); +binaryen.setDebugInfo(false); +mod.optimize(); +if (!mod.validate()) + console.log("-> does not validate"); +console.log(mod.emitText()); diff --git a/tests/binaryen/const-global.wat b/tests/binaryen/const-global.wat new file mode 100644 index 00000000..5b91d25a --- /dev/null +++ b/tests/binaryen/const-global.wat @@ -0,0 +1,8 @@ +(module + (type $i (func (result i32))) + (global $testGlobal i32 (i32.const 2)) + (export "test" (func $test)) + (func $test (; 0 ;) (type $i) (result i32) + (get_global $testGlobal) + ) +) \ No newline at end of file diff --git a/tests/binaryen/const-local.js b/tests/binaryen/const-local.js new file mode 100644 index 00000000..3592282a --- /dev/null +++ b/tests/binaryen/const-local.js @@ -0,0 +1,18 @@ +var binaryen = require("binaryen"); + +var mod = new binaryen.Module(); + +var funcType = mod.addFunctionType("i", binaryen.i32, [ binaryen.i32 ]); +mod.addFunction("test", funcType, [], mod.block("", [ + mod.setLocal(0, mod.i32.const(2)), + mod.getLocal(0, binaryen.i32) +], binaryen.i32)); +mod.addFunctionExport("test", "test"); + +binaryen.setOptimizeLevel(4); +binaryen.setShrinkLevel(0); +binaryen.setDebugInfo(false); +mod.optimize(); +if (!mod.validate()) + console.log("-> does not validate"); +console.log(mod.emitText()); diff --git a/tests/compiler/abi.optimized.wat b/tests/compiler/abi.optimized.wat index 31fb7d50..5243f3b6 100644 --- a/tests/compiler/abi.optimized.wat +++ b/tests/compiler/abi.optimized.wat @@ -7,10 +7,10 @@ (global $abi/y (mut i32) (i32.const 0)) (memory $0 1) (data (i32.const 8) "\06\00\00\00a\00b\00i\00.\00t\00s") + (export "memory" (memory $0)) (export "exported" (func $abi/exported)) (export "exportedExported" (func $abi/exportedExported)) (export "exportedInternal" (func $abi/exportedInternal)) - (export "memory" (memory $0)) (start $start) (func $abi/exported (; 1 ;) (type $i) (result i32) (i32.const -128) diff --git a/tests/compiler/abi.untouched.wat b/tests/compiler/abi.untouched.wat index de002c78..c384a93a 100644 --- a/tests/compiler/abi.untouched.wat +++ b/tests/compiler/abi.untouched.wat @@ -8,10 +8,10 @@ (global $HEAP_BASE i32 (i32.const 24)) (memory $0 1) (data (i32.const 8) "\06\00\00\00a\00b\00i\00.\00t\00s\00") + (export "memory" (memory $0)) (export "exported" (func $abi/exported)) (export "exportedExported" (func $abi/exportedExported)) (export "exportedInternal" (func $abi/exportedInternal)) - (export "memory" (memory $0)) (start $start) (func $abi/exported (; 1 ;) (type $i) (result i32) (i32.shr_s diff --git a/tests/compiler/asc-constants.untouched.wat b/tests/compiler/asc-constants.untouched.wat index cf0ff27f..e8516c58 100644 --- a/tests/compiler/asc-constants.untouched.wat +++ b/tests/compiler/asc-constants.untouched.wat @@ -1,5 +1,13 @@ (module (type $v (func)) + (global $ASC_TARGET i32 (i32.const 0)) + (global $ASC_NO_TREESHAKING i32 (i32.const 0)) + (global $ASC_NO_ASSERT i32 (i32.const 0)) + (global $ASC_MEMORY_BASE i32 (i32.const 0)) + (global $ASC_OPTIMIZE_LEVEL i32 (i32.const 0)) + (global $ASC_SHRINK_LEVEL i32 (i32.const 0)) + (global $ASC_FEATURE_MUTABLE_GLOBAL i32 (i32.const 0)) + (global $ASC_FEATURE_SIGN_EXTENSION i32 (i32.const 0)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) (export "memory" (memory $0)) diff --git a/tests/compiler/builtins.optimized.wat b/tests/compiler/builtins.optimized.wat index d3cc2769..17c4c586 100644 --- a/tests/compiler/builtins.optimized.wat +++ b/tests/compiler/builtins.optimized.wat @@ -2,6 +2,8 @@ (type $iiiiv (func (param i32 i32 i32 i32))) (type $fi (func (param f32) (result i32))) (type $Fi (func (param f64) (result i32))) + (type $i (func (result i32))) + (type $ii (func (param i32) (result i32))) (type $iiv (func (param i32 i32))) (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) @@ -19,9 +21,9 @@ (memory $0 1) (data (i32.const 8) "\0b\00\00\00b\00u\00i\00l\00t\00i\00n\00s\00.\00t\00s") (data (i32.const 36) "\01\00\00\001") - (export "test" (func $builtins/test)) (export "memory" (memory $0)) (export "table" (table $0)) + (export "test" (func $builtins/test)) (start $start) (func $isNaN (; 1 ;) (type $fi) (param $0 f32) (result i32) (f32.ne @@ -53,13 +55,21 @@ (f64.const 0) ) ) - (func $start~anonymous|0 (; 5 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/memory/memory.size (; 5 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 6 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $start~anonymous|0 (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32) (nop) ) - (func $builtins/test (; 6 ;) (type $v) + (func $builtins/test (; 8 ;) (type $v) (nop) ) - (func $start (; 7 ;) (type $v) + (func $start (; 9 ;) (type $v) (set_global $builtins/i (i32.const 31) ) @@ -729,18 +739,18 @@ (f64.const 1.24e-322) ) (drop - (current_memory) + (call $~lib/memory/memory.size) ) (drop - (grow_memory + (call $~lib/memory/memory.grow (i32.const 1) ) ) (set_global $builtins/s - (current_memory) + (call $~lib/memory/memory.size) ) (set_global $builtins/s - (grow_memory + (call $~lib/memory/memory.grow (i32.const 1) ) ) diff --git a/tests/compiler/builtins.ts b/tests/compiler/builtins.ts index 5ef2f6e2..0e91c786 100644 --- a/tests/compiler/builtins.ts +++ b/tests/compiler/builtins.ts @@ -219,11 +219,11 @@ F = reinterpret(25); var s: usize; -current_memory(); -grow_memory(1); // also necessary for load/store tests below +memory.size(); +memory.grow(1); // also necessary for load/store tests below -s = current_memory(); -s = grow_memory(1); +s = memory.size(); +s = memory.grow(1); // other diff --git a/tests/compiler/builtins.untouched.wat b/tests/compiler/builtins.untouched.wat index 5501486e..338c2e40 100644 --- a/tests/compiler/builtins.untouched.wat +++ b/tests/compiler/builtins.untouched.wat @@ -2,6 +2,8 @@ (type $iiiiv (func (param i32 i32 i32 i32))) (type $fi (func (param f32) (result i32))) (type $Fi (func (param f64) (result i32))) + (type $i (func (result i32))) + (type $ii (func (param i32) (result i32))) (type $iiv (func (param i32 i32))) (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) @@ -17,15 +19,43 @@ (global $builtins/U (mut i64) (i64.const 0)) (global $builtins/s (mut i32) (i32.const 0)) (global $builtins/fn (mut i32) (i32.const 0)) + (global $i8.MIN_VALUE i32 (i32.const -128)) + (global $i8.MAX_VALUE i32 (i32.const 127)) + (global $i16.MIN_VALUE i32 (i32.const -32768)) + (global $i16.MAX_VALUE i32 (i32.const 32767)) + (global $i32.MIN_VALUE i32 (i32.const -2147483648)) + (global $i32.MAX_VALUE i32 (i32.const 2147483647)) + (global $i64.MIN_VALUE i64 (i64.const -9223372036854775808)) + (global $i64.MAX_VALUE i64 (i64.const 9223372036854775807)) + (global $u8.MIN_VALUE i32 (i32.const 0)) + (global $u8.MAX_VALUE i32 (i32.const 255)) + (global $u16.MIN_VALUE i32 (i32.const 0)) + (global $u16.MAX_VALUE i32 (i32.const 65535)) + (global $u32.MIN_VALUE i32 (i32.const 0)) + (global $u32.MAX_VALUE i32 (i32.const -1)) + (global $u64.MIN_VALUE i64 (i64.const 0)) + (global $u64.MAX_VALUE i64 (i64.const -1)) + (global $bool.MIN_VALUE i32 (i32.const 0)) + (global $bool.MAX_VALUE i32 (i32.const 1)) + (global $f32.MIN_VALUE f32 (f32.const -3402823466385288598117041e14)) + (global $f32.MAX_VALUE f32 (f32.const 3402823466385288598117041e14)) + (global $f32.MIN_SAFE_INTEGER f32 (f32.const -16777215)) + (global $f32.MAX_SAFE_INTEGER f32 (f32.const 16777215)) + (global $f32.EPSILON f32 (f32.const 1.1920928955078125e-07)) + (global $f64.MIN_VALUE f64 (f64.const -1797693134862315708145274e284)) + (global $f64.MAX_VALUE f64 (f64.const 1797693134862315708145274e284)) + (global $f64.MIN_SAFE_INTEGER f64 (f64.const -9007199254740991)) + (global $f64.MAX_SAFE_INTEGER f64 (f64.const 9007199254740991)) + (global $f64.EPSILON f64 (f64.const 2.220446049250313e-16)) (global $HEAP_BASE i32 (i32.const 44)) (table 1 1 anyfunc) (elem (i32.const 0) $start~anonymous|0) (memory $0 1) (data (i32.const 8) "\0b\00\00\00b\00u\00i\00l\00t\00i\00n\00s\00.\00t\00s\00") (data (i32.const 36) "\01\00\00\001\00") - (export "test" (func $builtins/test)) (export "memory" (memory $0)) (export "table" (table $0)) + (export "test" (func $builtins/test)) (start $start) (func $isNaN (; 1 ;) (type $fi) (param $0 f32) (result i32) (f32.ne @@ -57,13 +87,21 @@ (f64.const 0) ) ) - (func $start~anonymous|0 (; 5 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/memory/memory.size (; 5 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 6 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $start~anonymous|0 (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32) (nop) ) - (func $builtins/test (; 6 ;) (type $v) + (func $builtins/test (; 8 ;) (type $v) (nop) ) - (func $start (; 7 ;) (type $v) + (func $start (; 9 ;) (type $v) (local $0 i32) (local $1 i32) (local $2 i64) @@ -1521,18 +1559,18 @@ ) ) (drop - (current_memory) + (call $~lib/memory/memory.size) ) (drop - (grow_memory + (call $~lib/memory/memory.grow (i32.const 1) ) ) (set_global $builtins/s - (current_memory) + (call $~lib/memory/memory.size) ) (set_global $builtins/s - (grow_memory + (call $~lib/memory/memory.grow (i32.const 1) ) ) @@ -2054,7 +2092,7 @@ (if (i32.eqz (i32.eq - (i32.const -128) + (get_global $i8.MIN_VALUE) (i32.shr_s (i32.shl (i32.const 128) @@ -2077,7 +2115,7 @@ (if (i32.eqz (i32.eq - (i32.const 127) + (get_global $i8.MAX_VALUE) (i32.const 127) ) ) @@ -2094,7 +2132,7 @@ (if (i32.eqz (i32.eq - (i32.const -32768) + (get_global $i16.MIN_VALUE) (i32.shr_s (i32.shl (i32.const 32768) @@ -2117,7 +2155,7 @@ (if (i32.eqz (i32.eq - (i32.const 32767) + (get_global $i16.MAX_VALUE) (i32.const 32767) ) ) @@ -2134,7 +2172,7 @@ (if (i32.eqz (i32.eq - (i32.const -2147483648) + (get_global $i32.MIN_VALUE) (i32.const -2147483648) ) ) @@ -2151,7 +2189,7 @@ (if (i32.eqz (i32.eq - (i32.const 2147483647) + (get_global $i32.MAX_VALUE) (i32.const 2147483647) ) ) @@ -2168,7 +2206,7 @@ (if (i32.eqz (i64.eq - (i64.const -9223372036854775808) + (get_global $i64.MIN_VALUE) (i64.const -9223372036854775808) ) ) @@ -2185,7 +2223,7 @@ (if (i32.eqz (i64.eq - (i64.const 9223372036854775807) + (get_global $i64.MAX_VALUE) (i64.const 9223372036854775807) ) ) @@ -2202,7 +2240,7 @@ (if (i32.eqz (i32.eq - (i32.const 0) + (get_global $u8.MIN_VALUE) (i32.const 0) ) ) @@ -2219,7 +2257,7 @@ (if (i32.eqz (i32.eq - (i32.const 255) + (get_global $u8.MAX_VALUE) (i32.const 255) ) ) @@ -2236,7 +2274,7 @@ (if (i32.eqz (i32.eq - (i32.const 0) + (get_global $u16.MIN_VALUE) (i32.const 0) ) ) @@ -2253,7 +2291,7 @@ (if (i32.eqz (i32.eq - (i32.const 65535) + (get_global $u16.MAX_VALUE) (i32.const 65535) ) ) @@ -2270,7 +2308,7 @@ (if (i32.eqz (i32.eq - (i32.const 0) + (get_global $u32.MIN_VALUE) (i32.const 0) ) ) @@ -2287,7 +2325,7 @@ (if (i32.eqz (i32.eq - (i32.const -1) + (get_global $u32.MAX_VALUE) (i32.const -1) ) ) @@ -2304,7 +2342,7 @@ (if (i32.eqz (i64.eq - (i64.const 0) + (get_global $u64.MIN_VALUE) (i64.const 0) ) ) @@ -2321,7 +2359,7 @@ (if (i32.eqz (i64.eq - (i64.const -1) + (get_global $u64.MAX_VALUE) (i64.const -1) ) ) @@ -2338,7 +2376,7 @@ (if (i32.eqz (i32.eq - (i32.const 0) + (get_global $bool.MIN_VALUE) (i32.const 0) ) ) @@ -2355,7 +2393,7 @@ (if (i32.eqz (i32.eq - (i32.const 0) + (get_global $bool.MIN_VALUE) (i32.const 0) ) ) @@ -2372,7 +2410,7 @@ (if (i32.eqz (i32.eq - (i32.const 1) + (get_global $bool.MAX_VALUE) (i32.const 1) ) ) @@ -2389,7 +2427,7 @@ (if (i32.eqz (i32.eq - (i32.const 1) + (get_global $bool.MAX_VALUE) (i32.const 1) ) ) @@ -2406,7 +2444,7 @@ (if (i32.eqz (f32.eq - (f32.const -3402823466385288598117041e14) + (get_global $f32.MIN_VALUE) (f32.const -3402823466385288598117041e14) ) ) @@ -2423,7 +2461,7 @@ (if (i32.eqz (f32.eq - (f32.const 3402823466385288598117041e14) + (get_global $f32.MAX_VALUE) (f32.const 3402823466385288598117041e14) ) ) @@ -2440,7 +2478,7 @@ (if (i32.eqz (f32.eq - (f32.const -16777215) + (get_global $f32.MIN_SAFE_INTEGER) (f32.const -16777215) ) ) @@ -2457,7 +2495,7 @@ (if (i32.eqz (f32.eq - (f32.const 16777215) + (get_global $f32.MAX_SAFE_INTEGER) (f32.const 16777215) ) ) @@ -2474,7 +2512,7 @@ (if (i32.eqz (f32.eq - (f32.const 1.1920928955078125e-07) + (get_global $f32.EPSILON) (f32.const 1.1920928955078125e-07) ) ) @@ -2491,7 +2529,7 @@ (if (i32.eqz (f64.eq - (f64.const -1797693134862315708145274e284) + (get_global $f64.MIN_VALUE) (f64.const -1797693134862315708145274e284) ) ) @@ -2508,7 +2546,7 @@ (if (i32.eqz (f64.eq - (f64.const 1797693134862315708145274e284) + (get_global $f64.MAX_VALUE) (f64.const 1797693134862315708145274e284) ) ) @@ -2525,7 +2563,7 @@ (if (i32.eqz (f64.eq - (f64.const -9007199254740991) + (get_global $f64.MIN_SAFE_INTEGER) (f64.const -9007199254740991) ) ) @@ -2542,7 +2580,7 @@ (if (i32.eqz (f64.eq - (f64.const 9007199254740991) + (get_global $f64.MAX_SAFE_INTEGER) (f64.const 9007199254740991) ) ) @@ -2559,7 +2597,7 @@ (if (i32.eqz (f64.eq - (f64.const 2.220446049250313e-16) + (get_global $f64.EPSILON) (f64.const 2.220446049250313e-16) ) ) diff --git a/tests/compiler/call-optional.optimized.wat b/tests/compiler/call-optional.optimized.wat index 4d2f0fe2..60742a0a 100644 --- a/tests/compiler/call-optional.optimized.wat +++ b/tests/compiler/call-optional.optimized.wat @@ -25,8 +25,8 @@ (block $2of2 (block $1of2 (block $0of2 - (block $oob - (br_table $0of2 $1of2 $2of2 $oob + (block $outOfRange + (br_table $0of2 $1of2 $2of2 $outOfRange (i32.sub (get_global $~argc) (i32.const 1) diff --git a/tests/compiler/call-optional.untouched.wat b/tests/compiler/call-optional.untouched.wat index 9aeaeeef..6674ad76 100644 --- a/tests/compiler/call-optional.untouched.wat +++ b/tests/compiler/call-optional.untouched.wat @@ -26,8 +26,8 @@ (block $2of2 (block $1of2 (block $0of2 - (block $oob - (br_table $0of2 $1of2 $2of2 $oob + (block $outOfRange + (br_table $0of2 $1of2 $2of2 $outOfRange (i32.sub (get_global $~argc) (i32.const 1) diff --git a/tests/compiler/class-extends.optimized.wat b/tests/compiler/class-extends.optimized.wat index 64667443..ae544a7c 100644 --- a/tests/compiler/class-extends.optimized.wat +++ b/tests/compiler/class-extends.optimized.wat @@ -1,8 +1,8 @@ (module (type $iv (func (param i32))) (memory $0 0) - (export "test" (func $class-extends/test)) (export "memory" (memory $0)) + (export "test" (func $class-extends/test)) (func $class-extends/test (; 0 ;) (type $iv) (param $0 i32) (drop (i32.load diff --git a/tests/compiler/class-extends.untouched.wat b/tests/compiler/class-extends.untouched.wat index 6348b95f..41b70fc7 100644 --- a/tests/compiler/class-extends.untouched.wat +++ b/tests/compiler/class-extends.untouched.wat @@ -2,8 +2,8 @@ (type $iv (func (param i32))) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) - (export "test" (func $class-extends/test)) (export "memory" (memory $0)) + (export "test" (func $class-extends/test)) (func $class-extends/test (; 0 ;) (type $iv) (param $0 i32) (drop (i32.load diff --git a/tests/compiler/class-overloading.optimized.wat b/tests/compiler/class-overloading.optimized.wat index 0f23ed29..0ab6aa4c 100644 --- a/tests/compiler/class-overloading.optimized.wat +++ b/tests/compiler/class-overloading.optimized.wat @@ -2,8 +2,8 @@ (type $iv (func (param i32))) (type $v (func)) (memory $0 0) - (export "test" (func $class-overloading/test)) (export "memory" (memory $0)) + (export "test" (func $class-overloading/test)) (start $start) (func $class-overloading/Foo#baz (; 0 ;) (type $iv) (param $0 i32) (nop) diff --git a/tests/compiler/class-overloading.untouched.wat b/tests/compiler/class-overloading.untouched.wat index ab40251b..de4434bd 100644 --- a/tests/compiler/class-overloading.untouched.wat +++ b/tests/compiler/class-overloading.untouched.wat @@ -3,8 +3,8 @@ (type $v (func)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) - (export "test" (func $class-overloading/test)) (export "memory" (memory $0)) + (export "test" (func $class-overloading/test)) (start $start) (func $class-overloading/Foo#baz (; 0 ;) (type $iv) (param $0 i32) (nop) diff --git a/tests/compiler/class-with-boolean-field.optimized.wat b/tests/compiler/class-with-boolean-field.optimized.wat index 067ab067..1ac77525 100644 --- a/tests/compiler/class-with-boolean-field.optimized.wat +++ b/tests/compiler/class-with-boolean-field.optimized.wat @@ -1,8 +1,8 @@ (module (type $i (func (result i32))) (memory $0 0) - (export "test" (func $class-with-boolean-field/test)) (export "memory" (memory $0)) + (export "test" (func $class-with-boolean-field/test)) (func $class-with-boolean-field/test (; 0 ;) (type $i) (result i32) (i32.store8 (i32.const 0) diff --git a/tests/compiler/class-with-boolean-field.untouched.wat b/tests/compiler/class-with-boolean-field.untouched.wat index 56fc1020..12dfb9d5 100644 --- a/tests/compiler/class-with-boolean-field.untouched.wat +++ b/tests/compiler/class-with-boolean-field.untouched.wat @@ -2,8 +2,8 @@ (type $i (func (result i32))) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) - (export "test" (func $class-with-boolean-field/test)) (export "memory" (memory $0)) + (export "test" (func $class-with-boolean-field/test)) (func $class-with-boolean-field/test (; 0 ;) (type $i) (result i32) (local $0 i32) (i32.store8 diff --git a/tests/compiler/class.optimized.wat b/tests/compiler/class.optimized.wat index b096559c..6a341863 100644 --- a/tests/compiler/class.optimized.wat +++ b/tests/compiler/class.optimized.wat @@ -8,8 +8,8 @@ (global $class/Animal.ONE (mut i32) (i32.const 1)) (memory $0 1) (data (i32.const 8) "\08\00\00\00c\00l\00a\00s\00s\00.\00t\00s") - (export "test" (func $class/test)) (export "memory" (memory $0)) + (export "test" (func $class/test)) (start $start) (func $class/Animal.add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add diff --git a/tests/compiler/class.untouched.wat b/tests/compiler/class.untouched.wat index 454f3924..ae04d5bf 100644 --- a/tests/compiler/class.untouched.wat +++ b/tests/compiler/class.untouched.wat @@ -11,8 +11,8 @@ (global $HEAP_BASE i32 (i32.const 28)) (memory $0 1) (data (i32.const 8) "\08\00\00\00c\00l\00a\00s\00s\00.\00t\00s\00") - (export "test" (func $class/test)) (export "memory" (memory $0)) + (export "test" (func $class/test)) (start $start) (func $class/Animal.add (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add diff --git a/tests/compiler/enum.optimized.wat b/tests/compiler/enum.optimized.wat index c0751c00..4a2facd2 100644 --- a/tests/compiler/enum.optimized.wat +++ b/tests/compiler/enum.optimized.wat @@ -18,6 +18,7 @@ (global $enum/SelfReference.ZERO i32 (i32.const 0)) (global $enum/SelfReference.ONE i32 (i32.const 1)) (memory $0 0) + (export "memory" (memory $0)) (export "Implicit.ZERO" (global $enum/Implicit.ZERO)) (export "Implicit.ONE" (global $enum/Implicit.ONE)) (export "Implicit.TWO" (global $enum/Implicit.TWO)) @@ -32,7 +33,6 @@ (export "Mixed.FOUR" (global $enum/Mixed.FOUR)) (export "SelfReference.ZERO" (global $enum/SelfReference.ZERO)) (export "SelfReference.ONE" (global $enum/SelfReference.ONE)) - (export "memory" (memory $0)) (start $start) (func $enum/getZero (; 0 ;) (type $i) (result i32) (i32.const 0) @@ -43,7 +43,7 @@ ) (set_global $enum/NonConstant.ONE (i32.add - (get_global $enum/NonConstant.ZERO) + (call $enum/getZero) (i32.const 1) ) ) diff --git a/tests/compiler/enum.ts b/tests/compiler/enum.ts index 839b190f..93771d3b 100644 --- a/tests/compiler/enum.ts +++ b/tests/compiler/enum.ts @@ -1,18 +1,18 @@ -export enum Implicit { +export const enum Implicit { ZERO, ONE, TWO, THREE } -export enum Explicit { +export const enum Explicit { ZERO = 0, ONE = 0 + 1, TWO = 1 + 1, THREE = 3 } -export enum Mixed { +export const enum Mixed { ZERO, ONE, THREE = 3, @@ -23,12 +23,15 @@ function getZero(): i32 { return 0; } -export enum NonConstant { - ZERO = getZero(), // cannot export a mutable global - ONE // cannot export a mutable global (tsc doesn't allow this) +enum NonConstant { + ZERO = getZero(), + ONE = getZero() + 1 } -export enum SelfReference { +NonConstant.ZERO; +NonConstant.ONE; + +export const enum SelfReference { ZERO, ONE = ZERO + 1 } diff --git a/tests/compiler/enum.untouched.wat b/tests/compiler/enum.untouched.wat index eb49ab01..f24bb03f 100644 --- a/tests/compiler/enum.untouched.wat +++ b/tests/compiler/enum.untouched.wat @@ -20,6 +20,7 @@ (global $enum/enumType (mut i32) (i32.const 0)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) + (export "memory" (memory $0)) (export "Implicit.ZERO" (global $enum/Implicit.ZERO)) (export "Implicit.ONE" (global $enum/Implicit.ONE)) (export "Implicit.TWO" (global $enum/Implicit.TWO)) @@ -34,7 +35,6 @@ (export "Mixed.FOUR" (global $enum/Mixed.FOUR)) (export "SelfReference.ZERO" (global $enum/SelfReference.ZERO)) (export "SelfReference.ONE" (global $enum/SelfReference.ONE)) - (export "memory" (memory $0)) (start $start) (func $enum/getZero (; 0 ;) (type $i) (result i32) (i32.const 0) @@ -45,9 +45,15 @@ ) (set_global $enum/NonConstant.ONE (i32.add - (get_global $enum/NonConstant.ZERO) + (call $enum/getZero) (i32.const 1) ) ) + (drop + (get_global $enum/NonConstant.ZERO) + ) + (drop + (get_global $enum/NonConstant.ONE) + ) ) ) diff --git a/tests/compiler/export.optimized.wat b/tests/compiler/export.optimized.wat index 893386cc..92e0f921 100644 --- a/tests/compiler/export.optimized.wat +++ b/tests/compiler/export.optimized.wat @@ -5,6 +5,7 @@ (global $export/b i32 (i32.const 2)) (global $export/c i32 (i32.const 3)) (memory $0 0) + (export "memory" (memory $0)) (export "add" (func $export/add)) (export "sub" (func $export/sub)) (export "renamed_mul" (func $export/mul)) @@ -12,7 +13,6 @@ (export "b" (global $export/b)) (export "renamed_c" (global $export/c)) (export "ns.two" (func $export/ns.two)) - (export "memory" (memory $0)) (func $export/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add (get_local $0) diff --git a/tests/compiler/export.untouched.wat b/tests/compiler/export.untouched.wat index 329bd6c3..9eec390e 100644 --- a/tests/compiler/export.untouched.wat +++ b/tests/compiler/export.untouched.wat @@ -6,6 +6,7 @@ (global $export/c i32 (i32.const 3)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) + (export "memory" (memory $0)) (export "add" (func $export/add)) (export "sub" (func $export/sub)) (export "renamed_mul" (func $export/mul)) @@ -13,7 +14,6 @@ (export "b" (global $export/b)) (export "renamed_c" (global $export/c)) (export "ns.two" (func $export/ns.two)) - (export "memory" (memory $0)) (func $export/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add (get_local $0) diff --git a/tests/compiler/exports.optimized.wat b/tests/compiler/exports.optimized.wat index 0efed823..943c8a64 100644 --- a/tests/compiler/exports.optimized.wat +++ b/tests/compiler/exports.optimized.wat @@ -1,13 +1,12 @@ (module (type $iii (func (param i32 i32) (result i32))) - (type $iv (func (param i32))) (type $i (func (result i32))) (type $ii (func (param i32) (result i32))) (type $iiv (func (param i32 i32))) + (type $iv (func (param i32))) (type $v (func)) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) - (global $~argc (mut i32) (i32.const 0)) (global $exports/Animal.CAT i32 (i32.const 0)) (global $exports/Animal.DOG i32 (i32.const 1)) (global $exports/animals.Animal.CAT i32 (i32.const 0)) @@ -15,8 +14,9 @@ (global $exports/Car.TIRES i32 (i32.const 4)) (global $exports/vehicles.Car.TIRES i32 (i32.const 4)) (global $exports/outer.inner.a i32 (i32.const 42)) - (global $HEAP_BASE i32 (i32.const 8)) + (global $~argc (mut i32) (i32.const 0)) (memory $0 0) + (export "memory" (memory $0)) (export "add" (func $exports/add)) (export "_setargc" (func $~setargc)) (export "subOpt" (func $exports/subOpt|trampoline)) @@ -28,21 +28,20 @@ (export "Car.TIRES" (global $exports/Car.TIRES)) (export "Car.getNumTires" (func $exports/Car.getNumTires)) (export "Car#constructor" (func $exports/Car#constructor|trampoline)) - (export "Car#get:doors" (func $Car#get:doors)) - (export "Car#set:doors" (func $Car#set:doors)) - (export "Car#get:numDoors" (func $Car#get:doors)) - (export "Car#set:numDoors" (func $Car#set:doors)) + (export "Car#get:doors" (func $exports/Car#get:numDoors)) + (export "Car#set:doors" (func $exports/Car#set:numDoors)) + (export "Car#get:numDoors" (func $exports/Car#get:numDoors)) + (export "Car#set:numDoors" (func $exports/Car#set:numDoors)) (export "Car#openDoors" (func $exports/Car#openDoors)) (export "vehicles.Car.TIRES" (global $exports/vehicles.Car.TIRES)) (export "vehicles.Car.getNumTires" (func $exports/Car.getNumTires)) (export "vehicles.Car#constructor" (func $exports/Car#constructor|trampoline)) - (export "vehicles.Car#get:doors" (func $Car#get:doors)) - (export "vehicles.Car#set:doors" (func $Car#set:doors)) - (export "vehicles.Car#get:numDoors" (func $Car#get:doors)) - (export "vehicles.Car#set:numDoors" (func $Car#set:doors)) + (export "vehicles.Car#get:doors" (func $exports/Car#get:numDoors)) + (export "vehicles.Car#set:doors" (func $exports/Car#set:numDoors)) + (export "vehicles.Car#get:numDoors" (func $exports/Car#get:numDoors)) + (export "vehicles.Car#set:numDoors" (func $exports/Car#set:numDoors)) (export "vehicles.Car#openDoors" (func $exports/Car#openDoors)) (export "outer.inner.a" (global $exports/outer.inner.a)) - (export "memory" (memory $0)) (start $start) (func $exports/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add @@ -56,37 +55,18 @@ (get_local $1) ) ) - (func $exports/subOpt|trampoline (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) - (block $1of1 - (block $0of1 - (block $oob - (br_table $0of1 $1of1 $oob - (i32.sub - (get_global $~argc) - (i32.const 1) - ) - ) - ) - (unreachable) - ) - (set_local $1 - (i32.const 0) - ) - ) - (call $exports/subOpt - (get_local $0) - (get_local $1) - ) - ) - (func $~setargc (; 3 ;) (type $iv) (param $0 i32) - (set_global $~argc - (get_local $0) - ) - ) - (func $exports/Car.getNumTires (; 4 ;) (type $i) (result i32) + (func $exports/Car.getNumTires (; 2 ;) (type $i) (result i32) (i32.const 4) ) - (func $~lib/allocator/arena/allocate_memory (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 3 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 4 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -118,14 +98,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -153,7 +133,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -172,14 +152,19 @@ ) (i32.const 0) ) - (func $exports/Car#constructor (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.allocate (; 6 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $exports/Car#constructor (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) ) (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) @@ -192,11 +177,60 @@ ) (get_local $0) ) - (func $exports/Car#constructor|trampoline (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $exports/Car#get:numDoors (; 8 ;) (type $ii) (param $0 i32) (result i32) + (i32.load + (get_local $0) + ) + ) + (func $exports/Car#set:numDoors (; 9 ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store + (get_local $0) + (get_local $1) + ) + ) + (func $exports/Car#openDoors (; 10 ;) (type $iv) (param $0 i32) + (nop) + ) + (func $start (; 11 ;) (type $v) + (set_global $~lib/allocator/arena/startOffset + (i32.const 8) + ) + (set_global $~lib/allocator/arena/offset + (get_global $~lib/allocator/arena/startOffset) + ) + ) + (func $exports/subOpt|trampoline (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (block $1of1 (block $0of1 - (block $oob - (br_table $0of1 $1of1 $oob + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange + (i32.sub + (get_global $~argc) + (i32.const 1) + ) + ) + ) + (unreachable) + ) + (set_local $1 + (i32.const 0) + ) + ) + (call $exports/subOpt + (get_local $0) + (get_local $1) + ) + ) + (func $~setargc (; 13 ;) (type $iv) (param $0 i32) + (set_global $~argc + (get_local $0) + ) + ) + (func $exports/Car#constructor|trampoline (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (block $1of1 + (block $0of1 + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange (get_global $~argc) ) ) @@ -211,32 +245,4 @@ (get_local $1) ) ) - (func $Car#get:doors (; 8 ;) (type $ii) (param $0 i32) (result i32) - (i32.load - (get_local $0) - ) - ) - (func $Car#set:doors (; 9 ;) (type $iiv) (param $0 i32) (param $1 i32) - (i32.store - (get_local $0) - (get_local $1) - ) - ) - (func $exports/Car#openDoors (; 10 ;) (type $iv) (param $0 i32) - (nop) - ) - (func $start (; 11 ;) (type $v) - (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) - ) - (set_global $~lib/allocator/arena/offset - (get_global $~lib/allocator/arena/startOffset) - ) - ) ) diff --git a/tests/compiler/exports.ts b/tests/compiler/exports.ts index 54b8ed0e..eb4c58f8 100644 --- a/tests/compiler/exports.ts +++ b/tests/compiler/exports.ts @@ -17,14 +17,14 @@ export namespace math { } // top-level enum -export enum Animal { +export const enum Animal { CAT, DOG } // namespaced enum export namespace animals { - export enum Animal { + export const enum Animal { CAT, DOG } diff --git a/tests/compiler/exports.untouched.wat b/tests/compiler/exports.untouched.wat index 01939ff4..9f99de87 100644 --- a/tests/compiler/exports.untouched.wat +++ b/tests/compiler/exports.untouched.wat @@ -1,9 +1,9 @@ (module (type $iii (func (param i32 i32) (result i32))) - (type $iv (func (param i32))) (type $i (func (result i32))) (type $ii (func (param i32) (result i32))) (type $iiv (func (param i32 i32))) + (type $iv (func (param i32))) (type $v (func)) (global $~lib/internal/allocator/AL_BITS i32 (i32.const 3)) (global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8)) @@ -11,7 +11,6 @@ (global $~lib/internal/allocator/MAX_SIZE_32 i32 (i32.const 1073741824)) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) - (global $~argc (mut i32) (i32.const 0)) (global $exports/Animal.CAT i32 (i32.const 0)) (global $exports/Animal.DOG i32 (i32.const 1)) (global $exports/animals.Animal.CAT i32 (i32.const 0)) @@ -20,7 +19,9 @@ (global $exports/vehicles.Car.TIRES i32 (i32.const 4)) (global $exports/outer.inner.a i32 (i32.const 42)) (global $HEAP_BASE i32 (i32.const 8)) + (global $~argc (mut i32) (i32.const 0)) (memory $0 0) + (export "memory" (memory $0)) (export "add" (func $exports/add)) (export "_setargc" (func $~setargc)) (export "subOpt" (func $exports/subOpt|trampoline)) @@ -46,7 +47,6 @@ (export "vehicles.Car#set:numDoors" (func $exports/vehicles.Car#set:numDoors)) (export "vehicles.Car#openDoors" (func $exports/vehicles.Car#openDoors)) (export "outer.inner.a" (global $exports/outer.inner.a)) - (export "memory" (memory $0)) (start $start) (func $exports/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add @@ -60,43 +60,24 @@ (get_local $1) ) ) - (func $exports/subOpt|trampoline (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) - (block $1of1 - (block $0of1 - (block $oob - (br_table $0of1 $1of1 $oob - (i32.sub - (get_global $~argc) - (i32.const 1) - ) - ) - ) - (unreachable) - ) - (set_local $1 - (i32.const 0) - ) - ) - (call $exports/subOpt - (get_local $0) - (get_local $1) - ) - ) - (func $~setargc (; 3 ;) (type $iv) (param $0 i32) - (set_global $~argc - (get_local $0) - ) - ) - (func $exports/math.sub (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $exports/math.sub (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $exports/Car.getNumTires (; 5 ;) (type $i) (result i32) - (i32.const 4) + (func $exports/Car.getNumTires (; 3 ;) (type $i) (result i32) + (get_global $exports/Car.TIRES) ) - (func $~lib/allocator/arena/allocate_memory (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 4 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 5 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -109,7 +90,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -123,16 +104,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -177,14 +158,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -204,7 +185,14 @@ ) (i32.const 0) ) - (func $exports/Car#constructor (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.allocate (; 7 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $exports/Car#constructor (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (i32.store (tee_local $0 @@ -214,7 +202,7 @@ (tee_local $0 (block (result i32) (set_local $2 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) @@ -231,11 +219,113 @@ ) (get_local $0) ) - (func $exports/Car#constructor|trampoline (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $exports/Car#get:numDoors (; 9 ;) (type $ii) (param $0 i32) (result i32) + (i32.load + (get_local $0) + ) + ) + (func $exports/Car#set:numDoors (; 10 ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store + (get_local $0) + (get_local $1) + ) + ) + (func $exports/Car#openDoors (; 11 ;) (type $iv) (param $0 i32) + (nop) + ) + (func $exports/vehicles.Car.getNumTires (; 12 ;) (type $i) (result i32) + (get_global $exports/vehicles.Car.TIRES) + ) + (func $exports/vehicles.Car#constructor (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (i32.store + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $2 + (call $~lib/memory/memory.allocate + (i32.const 4) + ) + ) + (i32.store + (get_local $2) + (get_local $1) + ) + (get_local $2) + ) + ) + ) + ) + (get_local $1) + ) + (get_local $0) + ) + (func $exports/vehicles.Car#get:numDoors (; 14 ;) (type $ii) (param $0 i32) (result i32) + (i32.load + (get_local $0) + ) + ) + (func $exports/vehicles.Car#set:numDoors (; 15 ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store + (get_local $0) + (get_local $1) + ) + ) + (func $exports/vehicles.Car#openDoors (; 16 ;) (type $iv) (param $0 i32) + (nop) + ) + (func $start (; 17 ;) (type $v) + (set_global $~lib/allocator/arena/startOffset + (i32.and + (i32.add + (get_global $HEAP_BASE) + (get_global $~lib/internal/allocator/AL_MASK) + ) + (i32.xor + (get_global $~lib/internal/allocator/AL_MASK) + (i32.const -1) + ) + ) + ) + (set_global $~lib/allocator/arena/offset + (get_global $~lib/allocator/arena/startOffset) + ) + ) + (func $exports/subOpt|trampoline (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (block $1of1 (block $0of1 - (block $oob - (br_table $0of1 $1of1 $oob + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange + (i32.sub + (get_global $~argc) + (i32.const 1) + ) + ) + ) + (unreachable) + ) + (set_local $1 + (i32.const 0) + ) + ) + (call $exports/subOpt + (get_local $0) + (get_local $1) + ) + ) + (func $~setargc (; 19 ;) (type $iv) (param $0 i32) + (set_global $~argc + (get_local $0) + ) + ) + (func $exports/Car#constructor|trampoline (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (block $1of1 + (block $0of1 + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange (get_global $~argc) ) ) @@ -250,66 +340,22 @@ (get_local $1) ) ) - (func $Car#get:doors (; 9 ;) (type $ii) (param $0 i32) (result i32) + (func $Car#get:doors (; 21 ;) (type $ii) (param $0 i32) (result i32) (i32.load (get_local $0) ) ) - (func $Car#set:doors (; 10 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $Car#set:doors (; 22 ;) (type $iiv) (param $0 i32) (param $1 i32) (i32.store (get_local $0) (get_local $1) ) ) - (func $exports/Car#get:numDoors (; 11 ;) (type $ii) (param $0 i32) (result i32) - (i32.load - (get_local $0) - ) - ) - (func $exports/Car#set:numDoors (; 12 ;) (type $iiv) (param $0 i32) (param $1 i32) - (i32.store - (get_local $0) - (get_local $1) - ) - ) - (func $exports/Car#openDoors (; 13 ;) (type $iv) (param $0 i32) - (nop) - ) - (func $exports/vehicles.Car.getNumTires (; 14 ;) (type $i) (result i32) - (i32.const 4) - ) - (func $exports/vehicles.Car#constructor (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (i32.store - (tee_local $0 - (if (result i32) - (get_local $0) - (get_local $0) - (tee_local $0 - (block (result i32) - (set_local $2 - (call $~lib/allocator/arena/allocate_memory - (i32.const 4) - ) - ) - (i32.store - (get_local $2) - (get_local $1) - ) - (get_local $2) - ) - ) - ) - ) - (get_local $1) - ) - (get_local $0) - ) - (func $exports/vehicles.Car#constructor|trampoline (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $exports/vehicles.Car#constructor|trampoline (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (block $1of1 (block $0of1 - (block $oob - (br_table $0of1 $1of1 $oob + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange (get_global $~argc) ) ) @@ -324,46 +370,15 @@ (get_local $1) ) ) - (func $vehicles.Car#get:doors (; 17 ;) (type $ii) (param $0 i32) (result i32) + (func $vehicles.Car#get:doors (; 24 ;) (type $ii) (param $0 i32) (result i32) (i32.load (get_local $0) ) ) - (func $vehicles.Car#set:doors (; 18 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $vehicles.Car#set:doors (; 25 ;) (type $iiv) (param $0 i32) (param $1 i32) (i32.store (get_local $0) (get_local $1) ) ) - (func $exports/vehicles.Car#get:numDoors (; 19 ;) (type $ii) (param $0 i32) (result i32) - (i32.load - (get_local $0) - ) - ) - (func $exports/vehicles.Car#set:numDoors (; 20 ;) (type $iiv) (param $0 i32) (param $1 i32) - (i32.store - (get_local $0) - (get_local $1) - ) - ) - (func $exports/vehicles.Car#openDoors (; 21 ;) (type $iv) (param $0 i32) - (nop) - ) - (func $start (; 22 ;) (type $v) - (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.xor - (i32.const 7) - (i32.const -1) - ) - ) - ) - (set_global $~lib/allocator/arena/offset - (get_global $~lib/allocator/arena/startOffset) - ) - ) ) diff --git a/tests/compiler/external.optimized.wat b/tests/compiler/external.optimized.wat index 143a9a73..92f96cb4 100644 --- a/tests/compiler/external.optimized.wat +++ b/tests/compiler/external.optimized.wat @@ -4,10 +4,12 @@ (import "foo" "bar" (func $external/foo.bar)) (import "external" "bar" (func $external/two)) (import "foo" "baz" (func $external/three)) + (import "foo" "var" (global $external/var_ i32)) (memory $0 0) - (export "foo" (func $external/foo)) + (export "memory" (memory $0)) (export "foo.bar" (func $external/foo.bar)) + (export "foo" (func $external/foo)) (export "two" (func $external/two)) (export "three" (func $external/three)) - (export "memory" (memory $0)) + (export "var_" (global $external/var_)) ) diff --git a/tests/compiler/external.untouched.wat b/tests/compiler/external.untouched.wat index e1dd7459..65db8e44 100644 --- a/tests/compiler/external.untouched.wat +++ b/tests/compiler/external.untouched.wat @@ -7,9 +7,10 @@ (import "foo" "var" (global $external/var_ i32)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) - (export "foo" (func $external/foo)) + (export "memory" (memory $0)) (export "foo.bar" (func $external/foo.bar)) + (export "foo" (func $external/foo)) (export "two" (func $external/two)) (export "three" (func $external/three)) - (export "memory" (memory $0)) + (export "var_" (global $external/var_)) ) diff --git a/tests/compiler/function-types.optimized.wat b/tests/compiler/function-types.optimized.wat index 6716f652..94f99c3d 100644 --- a/tests/compiler/function-types.optimized.wat +++ b/tests/compiler/function-types.optimized.wat @@ -67,8 +67,8 @@ (func $function-types/makeAndAdd|trampoline (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $1of1 (block $0of1 - (block $oob - (br_table $0of1 $1of1 $oob + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange (i32.sub (get_global $~argc) (i32.const 2) diff --git a/tests/compiler/function-types.untouched.wat b/tests/compiler/function-types.untouched.wat index 472bb0fc..60c412e3 100644 --- a/tests/compiler/function-types.untouched.wat +++ b/tests/compiler/function-types.untouched.wat @@ -84,8 +84,8 @@ (func $function-types/makeAndAdd|trampoline (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $1of1 (block $0of1 - (block $oob - (br_table $0of1 $1of1 $oob + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange (i32.sub (get_global $~argc) (i32.const 2) diff --git a/tests/compiler/i64-polyfill.optimized.wat b/tests/compiler/i64-polyfill.optimized.wat index e76a9f0f..784568a3 100644 --- a/tests/compiler/i64-polyfill.optimized.wat +++ b/tests/compiler/i64-polyfill.optimized.wat @@ -5,6 +5,7 @@ (global $../../examples/i64-polyfill/assembly/i64/lo (mut i32) (i32.const 0)) (global $../../examples/i64-polyfill/assembly/i64/hi (mut i32) (i32.const 0)) (memory $0 0) + (export "memory" (memory $0)) (export "getHi" (func $../../examples/i64-polyfill/assembly/i64/getHi)) (export "getLo" (func $../../examples/i64-polyfill/assembly/i64/getLo)) (export "clz" (func $../../examples/i64-polyfill/assembly/i64/clz)) @@ -36,7 +37,6 @@ (export "gt_u" (func $../../examples/i64-polyfill/assembly/i64/gt_u)) (export "ge_s" (func $../../examples/i64-polyfill/assembly/i64/ge_s)) (export "ge_u" (func $../../examples/i64-polyfill/assembly/i64/ge_u)) - (export "memory" (memory $0)) (func $../../examples/i64-polyfill/assembly/i64/getHi (; 0 ;) (type $i) (result i32) (get_global $../../examples/i64-polyfill/assembly/i64/hi) ) diff --git a/tests/compiler/i64-polyfill.untouched.wat b/tests/compiler/i64-polyfill.untouched.wat index 6341cc66..7512dc00 100644 --- a/tests/compiler/i64-polyfill.untouched.wat +++ b/tests/compiler/i64-polyfill.untouched.wat @@ -8,6 +8,7 @@ (global $Infinity f64 (f64.const inf)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) + (export "memory" (memory $0)) (export "getHi" (func $../../examples/i64-polyfill/assembly/i64/getHi)) (export "getLo" (func $../../examples/i64-polyfill/assembly/i64/getLo)) (export "clz" (func $../../examples/i64-polyfill/assembly/i64/clz)) @@ -39,7 +40,6 @@ (export "gt_u" (func $../../examples/i64-polyfill/assembly/i64/gt_u)) (export "ge_s" (func $../../examples/i64-polyfill/assembly/i64/ge_s)) (export "ge_u" (func $../../examples/i64-polyfill/assembly/i64/ge_u)) - (export "memory" (memory $0)) (func $../../examples/i64-polyfill/assembly/i64/getHi (; 0 ;) (type $i) (result i32) (get_global $../../examples/i64-polyfill/assembly/i64/hi) ) diff --git a/tests/compiler/if.optimized.wat b/tests/compiler/if.optimized.wat index 0009ddeb..9c8f90fa 100644 --- a/tests/compiler/if.optimized.wat +++ b/tests/compiler/if.optimized.wat @@ -5,11 +5,11 @@ (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 8) "\05\00\00\00i\00f\00.\00t\00s") + (export "memory" (memory $0)) (export "ifThenElse" (func $if/ifThenElse)) (export "ifThen" (func $if/ifThen)) (export "ifThenElseBlock" (func $if/ifThenElse)) (export "ifAlwaysReturns" (func $if/ifAlwaysReturns)) - (export "memory" (memory $0)) (start $start) (func $if/ifThenElse (; 1 ;) (type $ii) (param $0 i32) (result i32) (if (result i32) diff --git a/tests/compiler/if.untouched.wat b/tests/compiler/if.untouched.wat index c2347f60..e2d68e8c 100644 --- a/tests/compiler/if.untouched.wat +++ b/tests/compiler/if.untouched.wat @@ -6,11 +6,11 @@ (global $HEAP_BASE i32 (i32.const 24)) (memory $0 1) (data (i32.const 8) "\05\00\00\00i\00f\00.\00t\00s\00") + (export "memory" (memory $0)) (export "ifThenElse" (func $if/ifThenElse)) (export "ifThen" (func $if/ifThen)) (export "ifThenElseBlock" (func $if/ifThenElseBlock)) (export "ifAlwaysReturns" (func $if/ifAlwaysReturns)) - (export "memory" (memory $0)) (start $start) (func $if/ifThenElse (; 1 ;) (type $ii) (param $0 i32) (result i32) (if diff --git a/tests/compiler/import.untouched.wat b/tests/compiler/import.untouched.wat index 3927e069..719db233 100644 --- a/tests/compiler/import.untouched.wat +++ b/tests/compiler/import.untouched.wat @@ -34,17 +34,17 @@ (i32.add (i32.add (call $export/add - (i32.const 1) - (i32.const 2) + (get_global $export/a) + (get_global $export/b) ) (call $export/sub - (i32.const 2) - (i32.const 3) + (get_global $export/b) + (get_global $export/c) ) ) (call $export/mul - (i32.const 3) - (i32.const 1) + (get_global $export/c) + (get_global $export/a) ) ) ) @@ -53,17 +53,17 @@ (i32.add (i32.add (call $export/add - (i32.const 1) - (i32.const 2) + (get_global $export/a) + (get_global $export/b) ) (call $export/sub - (i32.const 2) - (i32.const 3) + (get_global $export/b) + (get_global $export/c) ) ) (call $export/mul - (i32.const 3) - (i32.const 1) + (get_global $export/c) + (get_global $export/a) ) ) ) diff --git a/tests/compiler/infer-type.untouched.wat b/tests/compiler/infer-type.untouched.wat index 060fcbe4..9dd2cfa3 100644 --- a/tests/compiler/infer-type.untouched.wat +++ b/tests/compiler/infer-type.untouched.wat @@ -37,13 +37,13 @@ (f64.const 1.5) ) (set_local $3 - (i32.const 10) + (get_global $infer-type/i) ) (set_local $4 - (i64.const 4294967296) + (get_global $infer-type/I) ) (set_local $5 - (f64.const 1.5) + (get_global $infer-type/F) ) ) (func $infer-type/reti (; 2 ;) (type $i) (result i32) @@ -62,13 +62,13 @@ (local $0 i32) (local $1 i32) (drop - (i32.const 10) + (get_global $infer-type/i) ) (drop - (i64.const 4294967296) + (get_global $infer-type/I) ) (drop - (f64.const 1.5) + (get_global $infer-type/F) ) (call $infer-type/locals) (set_global $infer-type/ri diff --git a/tests/compiler/inlining-recursive.optimized.wat b/tests/compiler/inlining-recursive.optimized.wat index 5930ed18..8625fdd3 100644 --- a/tests/compiler/inlining-recursive.optimized.wat +++ b/tests/compiler/inlining-recursive.optimized.wat @@ -1,10 +1,10 @@ (module (type $v (func)) (memory $0 0) - (export "foo" (func $inlining-recursive/foo)) - (export "baz" (func $inlining-recursive/baz)) - (export "bar" (func $inlining-recursive/bar)) (export "memory" (memory $0)) + (export "foo" (func $inlining-recursive/foo)) + (export "bar" (func $inlining-recursive/bar)) + (export "baz" (func $inlining-recursive/baz)) (func $inlining-recursive/foo (; 0 ;) (type $v) (call $inlining-recursive/foo) ) diff --git a/tests/compiler/inlining-recursive.untouched.wat b/tests/compiler/inlining-recursive.untouched.wat index d168467c..3499062f 100644 --- a/tests/compiler/inlining-recursive.untouched.wat +++ b/tests/compiler/inlining-recursive.untouched.wat @@ -2,10 +2,10 @@ (type $v (func)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) - (export "foo" (func $inlining-recursive/foo)) - (export "baz" (func $inlining-recursive/baz)) - (export "bar" (func $inlining-recursive/bar)) (export "memory" (memory $0)) + (export "foo" (func $inlining-recursive/foo)) + (export "bar" (func $inlining-recursive/bar)) + (export "baz" (func $inlining-recursive/baz)) (func $inlining-recursive/foo (; 0 ;) (type $v) (block $inlining-recursive/foo|inlined.0 (call $inlining-recursive/foo) diff --git a/tests/compiler/inlining.optimized.wat b/tests/compiler/inlining.optimized.wat index 3ef5ad91..08575cb7 100644 --- a/tests/compiler/inlining.optimized.wat +++ b/tests/compiler/inlining.optimized.wat @@ -9,9 +9,9 @@ (elem (i32.const 0) $inlining/test_funcs~anonymous|0) (memory $0 1) (data (i32.const 8) "\0b\00\00\00i\00n\00l\00i\00n\00i\00n\00g\00.\00t\00s") - (export "test" (func $inlining/test)) (export "memory" (memory $0)) (export "table" (table $0)) + (export "test" (func $inlining/test)) (start $start) (func $inlining/test (; 1 ;) (type $i) (result i32) (i32.const 3) diff --git a/tests/compiler/inlining.untouched.wat b/tests/compiler/inlining.untouched.wat index 99418772..526b757a 100644 --- a/tests/compiler/inlining.untouched.wat +++ b/tests/compiler/inlining.untouched.wat @@ -11,13 +11,13 @@ (elem (i32.const 0) $inlining/test_funcs~anonymous|0) (memory $0 1) (data (i32.const 8) "\0b\00\00\00i\00n\00l\00i\00n\00i\00n\00g\00.\00t\00s\00") - (export "test" (func $inlining/test)) (export "memory" (memory $0)) (export "table" (table $0)) + (export "test" (func $inlining/test)) (start $start) (func $inlining/test (; 1 ;) (type $i) (result i32) (i32.add - (i32.const 1) + (get_global $inlining/constantGlobal) (i32.const 2) ) ) diff --git a/tests/compiler/limits.untouched.wat b/tests/compiler/limits.untouched.wat index 4fd6a6ae..296accfd 100644 --- a/tests/compiler/limits.untouched.wat +++ b/tests/compiler/limits.untouched.wat @@ -1,87 +1,113 @@ (module (type $v (func)) + (global $i8.MIN_VALUE i32 (i32.const -128)) + (global $i8.MAX_VALUE i32 (i32.const 127)) + (global $i16.MIN_VALUE i32 (i32.const -32768)) + (global $i16.MAX_VALUE i32 (i32.const 32767)) + (global $i32.MIN_VALUE i32 (i32.const -2147483648)) + (global $i32.MAX_VALUE i32 (i32.const 2147483647)) + (global $i64.MIN_VALUE i64 (i64.const -9223372036854775808)) + (global $i64.MAX_VALUE i64 (i64.const 9223372036854775807)) + (global $isize.MIN_VALUE i32 (i32.const -2147483648)) + (global $isize.MAX_VALUE i32 (i32.const 2147483647)) + (global $u8.MIN_VALUE i32 (i32.const 0)) + (global $u8.MAX_VALUE i32 (i32.const 255)) + (global $u16.MIN_VALUE i32 (i32.const 0)) + (global $u16.MAX_VALUE i32 (i32.const 65535)) + (global $u32.MIN_VALUE i32 (i32.const 0)) + (global $u32.MAX_VALUE i32 (i32.const -1)) + (global $u64.MIN_VALUE i64 (i64.const 0)) + (global $u64.MAX_VALUE i64 (i64.const -1)) + (global $usize.MIN_VALUE i32 (i32.const 0)) + (global $usize.MAX_VALUE i32 (i32.const -1)) + (global $bool.MIN_VALUE i32 (i32.const 0)) + (global $bool.MAX_VALUE i32 (i32.const 1)) + (global $f32.MIN_SAFE_INTEGER f32 (f32.const -16777215)) + (global $f32.MAX_SAFE_INTEGER f32 (f32.const 16777215)) + (global $f64.MIN_SAFE_INTEGER f64 (f64.const -9007199254740991)) + (global $f64.MAX_SAFE_INTEGER f64 (f64.const 9007199254740991)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) (export "memory" (memory $0)) (start $start) (func $start (; 0 ;) (type $v) (drop - (i32.const -128) + (get_global $i8.MIN_VALUE) ) (drop - (i32.const 127) + (get_global $i8.MAX_VALUE) ) (drop - (i32.const -32768) + (get_global $i16.MIN_VALUE) ) (drop - (i32.const 32767) + (get_global $i16.MAX_VALUE) ) (drop - (i32.const -2147483648) + (get_global $i32.MIN_VALUE) ) (drop - (i32.const 2147483647) + (get_global $i32.MAX_VALUE) ) (drop - (i64.const -9223372036854775808) + (get_global $i64.MIN_VALUE) ) (drop - (i64.const 9223372036854775807) + (get_global $i64.MAX_VALUE) ) (drop - (i32.const -2147483648) + (get_global $isize.MIN_VALUE) ) (drop - (i32.const 2147483647) + (get_global $isize.MAX_VALUE) ) (drop - (i32.const 0) + (get_global $u8.MIN_VALUE) ) (drop - (i32.const 255) + (get_global $u8.MAX_VALUE) ) (drop - (i32.const 0) + (get_global $u16.MIN_VALUE) ) (drop - (i32.const 65535) + (get_global $u16.MAX_VALUE) ) (drop - (i32.const 0) + (get_global $u32.MIN_VALUE) ) (drop - (i32.const -1) + (get_global $u32.MAX_VALUE) ) (drop - (i64.const 0) + (get_global $u64.MIN_VALUE) ) (drop - (i64.const -1) + (get_global $u64.MAX_VALUE) ) (drop - (i32.const 0) + (get_global $usize.MIN_VALUE) ) (drop - (i32.const -1) + (get_global $usize.MAX_VALUE) ) (drop - (i32.const 0) + (get_global $bool.MIN_VALUE) ) (drop - (i32.const 1) + (get_global $bool.MAX_VALUE) ) (drop - (f32.const -16777215) + (get_global $f32.MIN_SAFE_INTEGER) ) (drop - (f32.const 16777215) + (get_global $f32.MAX_SAFE_INTEGER) ) (drop - (f64.const -9007199254740991) + (get_global $f64.MIN_SAFE_INTEGER) ) (drop - (f64.const 9007199254740991) + (get_global $f64.MAX_SAFE_INTEGER) ) ) ) diff --git a/tests/compiler/main.optimized.wat b/tests/compiler/main.optimized.wat index f4422d67..452f9eae 100644 --- a/tests/compiler/main.optimized.wat +++ b/tests/compiler/main.optimized.wat @@ -2,22 +2,11 @@ (type $iii (func (param i32 i32) (result i32))) (type $v (func)) (global $main/code (mut i32) (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) (memory $0 0) - (export "main" (func $main/main)) (export "memory" (memory $0)) + (export "main" (func $main/main)) + (start $start) (func $main/main (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) - (if - (i32.eqz - (get_global $~started) - ) - (block - (call $start) - (set_global $~started - (i32.const 1) - ) - ) - ) (get_global $main/code) ) (func $start (; 1 ;) (type $v) diff --git a/tests/compiler/main.untouched.wat b/tests/compiler/main.untouched.wat index 3826d542..d3e5c620 100644 --- a/tests/compiler/main.untouched.wat +++ b/tests/compiler/main.untouched.wat @@ -2,23 +2,12 @@ (type $iii (func (param i32 i32) (result i32))) (type $v (func)) (global $main/code (mut i32) (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) - (export "main" (func $main/main)) (export "memory" (memory $0)) + (export "main" (func $main/main)) + (start $start) (func $main/main (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) - (if - (i32.eqz - (get_global $~started) - ) - (block - (call $start) - (set_global $~started - (i32.const 1) - ) - ) - ) (get_global $main/code) ) (func $start (; 1 ;) (type $v) diff --git a/tests/compiler/mandelbrot.optimized.wat b/tests/compiler/mandelbrot.optimized.wat index 517a32a7..3a5007dd 100644 --- a/tests/compiler/mandelbrot.optimized.wat +++ b/tests/compiler/mandelbrot.optimized.wat @@ -4,8 +4,8 @@ (type $Fi (func (param f64) (result i32))) (type $FFFF (func (param f64 f64 f64) (result f64))) (memory $0 0) - (export "computeLine" (func $../../examples/mandelbrot/assembly/index/computeLine)) (export "memory" (memory $0)) + (export "computeLine" (func $../../examples/mandelbrot/assembly/index/computeLine)) (func $~lib/math/NativeMath.log (; 0 ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 i32) diff --git a/tests/compiler/mandelbrot.untouched.wat b/tests/compiler/mandelbrot.untouched.wat index ef264043..685f8bde 100644 --- a/tests/compiler/mandelbrot.untouched.wat +++ b/tests/compiler/mandelbrot.untouched.wat @@ -4,10 +4,11 @@ (type $Fi (func (param f64) (result i32))) (type $FFFF (func (param f64 f64 f64) (result f64))) (global $../../examples/mandelbrot/assembly/index/NUM_COLORS i32 (i32.const 2048)) + (global $~lib/math/NativeMath.LN2 f64 (f64.const 0.6931471805599453)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) - (export "computeLine" (func $../../examples/mandelbrot/assembly/index/computeLine)) (export "memory" (memory $0)) + (export "computeLine" (func $../../examples/mandelbrot/assembly/index/computeLine)) (func $~lib/math/NativeMath.log (; 0 ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 i32) @@ -571,7 +572,7 @@ ) ) ) - (f64.const 0.6931471805599453) + (get_global $~lib/math/NativeMath.LN2) ) ) (set_local $17 @@ -583,7 +584,7 @@ (f64.mul (f64.convert_s/i32 (i32.sub - (i32.const 2048) + (get_global $../../examples/mandelbrot/assembly/index/NUM_COLORS) (i32.const 1) ) ) @@ -608,7 +609,7 @@ ) ) (i32.sub - (i32.const 2048) + (get_global $../../examples/mandelbrot/assembly/index/NUM_COLORS) (i32.const 1) ) ) diff --git a/tests/compiler/many-locals.optimized.wat b/tests/compiler/many-locals.optimized.wat index 287f94b9..2564ad0c 100644 --- a/tests/compiler/many-locals.optimized.wat +++ b/tests/compiler/many-locals.optimized.wat @@ -5,9 +5,9 @@ (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 8) "\0e\00\00\00m\00a\00n\00y\00-\00l\00o\00c\00a\00l\00s\00.\00t\00s") + (export "memory" (memory $0)) (export "testI32" (func $many-locals/testI32)) (export "testI8" (func $many-locals/testI8)) - (export "memory" (memory $0)) (start $start) (func $many-locals/testI32 (; 1 ;) (type $ii) (param $0 i32) (result i32) (get_local $0) diff --git a/tests/compiler/many-locals.untouched.wat b/tests/compiler/many-locals.untouched.wat index e405d44a..4698a4c9 100644 --- a/tests/compiler/many-locals.untouched.wat +++ b/tests/compiler/many-locals.untouched.wat @@ -6,9 +6,9 @@ (global $HEAP_BASE i32 (i32.const 40)) (memory $0 1) (data (i32.const 8) "\0e\00\00\00m\00a\00n\00y\00-\00l\00o\00c\00a\00l\00s\00.\00t\00s\00") + (export "memory" (memory $0)) (export "testI32" (func $many-locals/testI32)) (export "testI8" (func $many-locals/testI8)) - (export "memory" (memory $0)) (start $start) (func $many-locals/testI32 (; 1 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) diff --git a/tests/compiler/memcpy.optimized.wat b/tests/compiler/memcpy.optimized.wat index 164140e2..49033b3d 100644 --- a/tests/compiler/memcpy.optimized.wat +++ b/tests/compiler/memcpy.optimized.wat @@ -6,8 +6,8 @@ (global $memcpy/dest (mut i32) (i32.const 0)) (memory $0 1) (data (i32.const 8) "\t\00\00\00m\00e\00m\00c\00p\00y\00.\00t\00s") - (export "memcpy" (func $memcpy/memcpy)) (export "memory" (memory $0)) + (export "memcpy" (func $memcpy/memcpy)) (start $start) (func $memcpy/memcpy (; 1 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) diff --git a/tests/compiler/memcpy.untouched.wat b/tests/compiler/memcpy.untouched.wat index 68512188..7426f46c 100644 --- a/tests/compiler/memcpy.untouched.wat +++ b/tests/compiler/memcpy.untouched.wat @@ -8,8 +8,8 @@ (global $HEAP_BASE i32 (i32.const 32)) (memory $0 1) (data (i32.const 8) "\t\00\00\00m\00e\00m\00c\00p\00y\00.\00t\00s\00") - (export "memcpy" (func $memcpy/memcpy)) (export "memory" (memory $0)) + (export "memcpy" (func $memcpy/memcpy)) (start $start) (func $memcpy/memcpy (; 1 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) @@ -1816,26 +1816,26 @@ ) (func $start (; 2 ;) (type $v) (i64.store - (i32.const 8) + (get_global $memcpy/base) (i64.const 1229782938247303441) ) (i64.store (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 8) ) (i64.const 2459565876494606882) ) (i64.store (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 16) ) (i64.const 3689348814741910323) ) (i64.store (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 24) ) (i64.const 4919131752989213764) @@ -1843,11 +1843,11 @@ (set_global $memcpy/dest (call $memcpy/memcpy (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 1) ) (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 16) ) (i32.const 4) @@ -1858,7 +1858,7 @@ (i32.eq (get_global $memcpy/dest) (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 1) ) ) @@ -1877,7 +1877,7 @@ (i32.eqz (i64.eq (i64.load - (i32.const 8) + (get_global $memcpy/base) ) (i64.const 1229783084848853777) ) @@ -1894,8 +1894,8 @@ ) (set_global $memcpy/dest (call $memcpy/memcpy - (i32.const 8) - (i32.const 8) + (get_global $memcpy/base) + (get_global $memcpy/base) (i32.const 32) ) ) @@ -1903,7 +1903,7 @@ (i32.eqz (i32.eq (get_global $memcpy/dest) - (i32.const 8) + (get_global $memcpy/base) ) ) (block @@ -1920,7 +1920,7 @@ (i32.eqz (i64.eq (i64.load - (i32.const 8) + (get_global $memcpy/base) ) (i64.const 1229783084848853777) ) @@ -1940,7 +1940,7 @@ (i64.eq (i64.load (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 8) ) ) @@ -1962,7 +1962,7 @@ (i64.eq (i64.load (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 16) ) ) @@ -1984,7 +1984,7 @@ (i64.eq (i64.load (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 24) ) ) @@ -2004,11 +2004,11 @@ (set_global $memcpy/dest (call $memcpy/memcpy (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 5) ) (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 28) ) (i32.const 3) @@ -2018,7 +2018,7 @@ (i32.eqz (i64.eq (i64.load - (i32.const 8) + (get_global $memcpy/base) ) (i64.const 4919131679688438545) ) @@ -2036,11 +2036,11 @@ (set_global $memcpy/dest (call $memcpy/memcpy (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 8) ) (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 16) ) (i32.const 15) @@ -2050,7 +2050,7 @@ (i32.eqz (i64.eq (i64.load - (i32.const 8) + (get_global $memcpy/base) ) (i64.const 4919131679688438545) ) @@ -2070,7 +2070,7 @@ (i64.eq (i64.load (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 8) ) ) @@ -2092,7 +2092,7 @@ (i64.eq (i64.load (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 16) ) ) @@ -2114,7 +2114,7 @@ (i64.eq (i64.load (i32.add - (i32.const 8) + (get_global $memcpy/base) (i32.const 24) ) ) diff --git a/tests/compiler/memmove.untouched.wat b/tests/compiler/memmove.untouched.wat index fad75e9f..a90da823 100644 --- a/tests/compiler/memmove.untouched.wat +++ b/tests/compiler/memmove.untouched.wat @@ -312,26 +312,26 @@ ) (func $start (; 2 ;) (type $v) (i64.store - (i32.const 8) + (get_global $memmove/base) (i64.const 1229782938247303441) ) (i64.store (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 8) ) (i64.const 2459565876494606882) ) (i64.store (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 16) ) (i64.const 3689348814741910323) ) (i64.store (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 24) ) (i64.const 4919131752989213764) @@ -339,11 +339,11 @@ (set_global $memmove/dest (call $memmove/memmove (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 1) ) (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 16) ) (i32.const 4) @@ -354,7 +354,7 @@ (i32.eq (get_global $memmove/dest) (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 1) ) ) @@ -373,7 +373,7 @@ (i32.eqz (i64.eq (i64.load - (i32.const 8) + (get_global $memmove/base) ) (i64.const 1229783084848853777) ) @@ -390,8 +390,8 @@ ) (set_global $memmove/dest (call $memmove/memmove - (i32.const 8) - (i32.const 8) + (get_global $memmove/base) + (get_global $memmove/base) (i32.const 32) ) ) @@ -399,7 +399,7 @@ (i32.eqz (i32.eq (get_global $memmove/dest) - (i32.const 8) + (get_global $memmove/base) ) ) (block @@ -416,7 +416,7 @@ (i32.eqz (i64.eq (i64.load - (i32.const 8) + (get_global $memmove/base) ) (i64.const 1229783084848853777) ) @@ -436,7 +436,7 @@ (i64.eq (i64.load (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 8) ) ) @@ -458,7 +458,7 @@ (i64.eq (i64.load (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 16) ) ) @@ -480,7 +480,7 @@ (i64.eq (i64.load (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 24) ) ) @@ -500,11 +500,11 @@ (set_global $memmove/dest (call $memmove/memmove (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 5) ) (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 28) ) (i32.const 3) @@ -514,7 +514,7 @@ (i32.eqz (i64.eq (i64.load - (i32.const 8) + (get_global $memmove/base) ) (i64.const 4919131679688438545) ) @@ -532,11 +532,11 @@ (set_global $memmove/dest (call $memmove/memmove (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 8) ) (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 16) ) (i32.const 15) @@ -546,7 +546,7 @@ (i32.eqz (i64.eq (i64.load - (i32.const 8) + (get_global $memmove/base) ) (i64.const 4919131679688438545) ) @@ -566,7 +566,7 @@ (i64.eq (i64.load (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 8) ) ) @@ -588,7 +588,7 @@ (i64.eq (i64.load (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 16) ) ) @@ -610,7 +610,7 @@ (i64.eq (i64.load (i32.add - (i32.const 8) + (get_global $memmove/base) (i32.const 24) ) ) diff --git a/tests/compiler/memset.optimized.wat b/tests/compiler/memset.optimized.wat index e93948fe..e195fca9 100644 --- a/tests/compiler/memset.optimized.wat +++ b/tests/compiler/memset.optimized.wat @@ -4,7 +4,6 @@ (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (global $memset/dest (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 32)) (memory $0 1) (data (i32.const 8) "\t\00\00\00m\00e\00m\00s\00e\00t\00.\00t\00s") (export "memory" (memory $0)) @@ -345,7 +344,7 @@ ) (func $start (; 2 ;) (type $v) (set_global $memset/dest - (get_global $HEAP_BASE) + (i32.const 32) ) (drop (call $memset/memset diff --git a/tests/compiler/named-export-default.optimized.wat b/tests/compiler/named-export-default.optimized.wat index 43e9c7fa..e346a7d9 100644 --- a/tests/compiler/named-export-default.optimized.wat +++ b/tests/compiler/named-export-default.optimized.wat @@ -1,8 +1,8 @@ (module (type $i (func (result i32))) (memory $0 0) - (export "default" (func $named-export-default/get3)) (export "memory" (memory $0)) + (export "default" (func $named-export-default/get3)) (func $named-export-default/get3 (; 0 ;) (type $i) (result i32) (i32.const 3) ) diff --git a/tests/compiler/named-export-default.untouched.wat b/tests/compiler/named-export-default.untouched.wat index db34dc01..25dae6f0 100644 --- a/tests/compiler/named-export-default.untouched.wat +++ b/tests/compiler/named-export-default.untouched.wat @@ -2,8 +2,8 @@ (type $i (func (result i32))) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) - (export "default" (func $named-export-default/get3)) (export "memory" (memory $0)) + (export "default" (func $named-export-default/get3)) (func $named-export-default/get3 (; 0 ;) (type $i) (result i32) (i32.const 3) ) diff --git a/tests/compiler/named-import-default.optimized.wat b/tests/compiler/named-import-default.optimized.wat index d79c11ff..f4a6b6b8 100644 --- a/tests/compiler/named-import-default.optimized.wat +++ b/tests/compiler/named-import-default.optimized.wat @@ -1,8 +1,8 @@ (module (type $i (func (result i32))) (memory $0 0) - (export "getValue" (func $named-import-default/getValue)) (export "memory" (memory $0)) + (export "getValue" (func $named-import-default/getValue)) (func $named-export-default/get3 (; 0 ;) (type $i) (result i32) (i32.const 3) ) diff --git a/tests/compiler/named-import-default.untouched.wat b/tests/compiler/named-import-default.untouched.wat index 5c219c96..2e9ffcb4 100644 --- a/tests/compiler/named-import-default.untouched.wat +++ b/tests/compiler/named-import-default.untouched.wat @@ -2,8 +2,8 @@ (type $i (func (result i32))) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) - (export "getValue" (func $named-import-default/getValue)) (export "memory" (memory $0)) + (export "getValue" (func $named-import-default/getValue)) (func $named-export-default/get3 (; 0 ;) (type $i) (result i32) (i32.const 3) ) diff --git a/tests/compiler/namespace.ts b/tests/compiler/namespace.ts index 91ccc25b..755c999e 100644 --- a/tests/compiler/namespace.ts +++ b/tests/compiler/namespace.ts @@ -2,7 +2,7 @@ namespace Outer { export namespace Inner { export var aVar: i32 = 0; export function aFunc(): i32 { return aVar; } - export enum anEnum { ONE = 1, TWO = 2 } + export const enum anEnum { ONE = 1, TWO = 2 } } } @@ -10,7 +10,7 @@ Outer.Inner.aVar; Outer.Inner.aFunc(); Outer.Inner.anEnum.ONE; -enum Joined { +const enum Joined { // FIXME: tsc doesn't accept this when 'const'? THREE = 3 } namespace Joined { diff --git a/tests/compiler/namespace.untouched.wat b/tests/compiler/namespace.untouched.wat index 2085a0d1..2fe53477 100644 --- a/tests/compiler/namespace.untouched.wat +++ b/tests/compiler/namespace.untouched.wat @@ -13,7 +13,7 @@ (get_global $namespace/Outer.Inner.aVar) ) (func $namespace/Joined.anotherFunc (; 1 ;) (type $i) (result i32) - (i32.const 3) + (get_global $namespace/Joined.THREE) ) (func $start (; 2 ;) (type $v) (drop @@ -23,7 +23,7 @@ (call $namespace/Outer.Inner.aFunc) ) (drop - (i32.const 1) + (get_global $namespace/Outer.Inner.anEnum.ONE) ) (drop (call $namespace/Joined.anotherFunc) diff --git a/tests/compiler/new-without-allocator.optimized.wat b/tests/compiler/new-without-allocator.optimized.wat new file mode 100644 index 00000000..bc318bb0 --- /dev/null +++ b/tests/compiler/new-without-allocator.optimized.wat @@ -0,0 +1,18 @@ +(module + (type $i (func (result i32))) + (type $ii (func (param i32) (result i32))) + (memory $0 0) + (export "memory" (memory $0)) + (export "test" (func $new-without-allocator/test)) + (func $~lib/memory/memory.allocate (; 0 ;) (type $ii) (param $0 i32) (result i32) + (unreachable) + ) + (func $new-without-allocator/test (; 1 ;) (type $i) (result i32) + (drop + (call $~lib/memory/memory.allocate + (i32.const 0) + ) + ) + (i32.const 3) + ) +) diff --git a/tests/compiler/new-without-allocator.ts b/tests/compiler/new-without-allocator.ts index 6463ff33..ff9548d5 100644 --- a/tests/compiler/new-without-allocator.ts +++ b/tests/compiler/new-without-allocator.ts @@ -1,5 +1,3 @@ -// Expect error: TS2304: Cannot find name 'allocate_memory'. -// Expect error: AS214: An allocator must be declared to allocate memory. Try importing allocator/arena or allocator/tlsf. class A {} export function test(): i32 { diff --git a/tests/compiler/new-without-allocator.untouched.wat b/tests/compiler/new-without-allocator.untouched.wat new file mode 100644 index 00000000..517133ed --- /dev/null +++ b/tests/compiler/new-without-allocator.untouched.wat @@ -0,0 +1,26 @@ +(module + (type $i (func (result i32))) + (type $ii (func (param i32) (result i32))) + (global $HEAP_BASE i32 (i32.const 8)) + (memory $0 0) + (export "memory" (memory $0)) + (export "test" (func $new-without-allocator/test)) + (func $~lib/memory/memory.allocate (; 0 ;) (type $ii) (param $0 i32) (result i32) + (unreachable) + ) + (func $new-without-allocator/test (; 1 ;) (type $i) (result i32) + (local $0 i32) + (local $1 i32) + (set_local $1 + (block (result i32) + (set_local $0 + (call $~lib/memory/memory.allocate + (i32.const 0) + ) + ) + (get_local $0) + ) + ) + (i32.const 3) + ) +) diff --git a/tests/compiler/object-literal.optimized.wat b/tests/compiler/object-literal.optimized.wat index d0ec4291..169018d1 100644 --- a/tests/compiler/object-literal.optimized.wat +++ b/tests/compiler/object-literal.optimized.wat @@ -1,5 +1,6 @@ (module (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iv (func (param i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $iii (func (param i32 i32) (result i32))) @@ -8,13 +9,20 @@ (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 76)) (memory $0 1) (data (i32.const 8) "\0b\00\00\00h\00e\00l\00l\00o\00 \00w\00o\00r\00l\00d") (data (i32.const 36) "\11\00\00\00o\00b\00j\00e\00c\00t\00-\00l\00i\00t\00e\00r\00a\00l\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 1 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 2 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -46,14 +54,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -81,7 +89,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -100,7 +108,13 @@ ) (i32.const 0) ) - (func $~lib/memory/compare_memory (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/memory/memcmp (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -112,8 +126,13 @@ ) (loop $continue|0 (if - (if (result i32) - (get_local $2) + (tee_local $3 + (i32.ne + (get_local $2) + (i32.const 0) + ) + ) + (set_local $3 (i32.eq (i32.load8_u (get_local $0) @@ -122,8 +141,10 @@ (get_local $1) ) ) - (get_local $2) ) + ) + (if + (get_local $3) (block (set_local $2 (i32.sub @@ -162,7 +183,14 @@ ) ) ) - (func $~lib/string/String.__eq (; 3 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.compare (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (call $~lib/memory/memcmp + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/string/String.__eq (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eq @@ -209,7 +237,7 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -225,7 +253,7 @@ ) ) ) - (func $object-literal/bar (; 4 ;) (type $iv) (param $0 i32) + (func $object-literal/bar (; 8 ;) (type $iv) (param $0 i32) (if (i32.ne (i32.load @@ -263,7 +291,7 @@ ) ) ) - (func $object-literal/bar2 (; 5 ;) (type $iv) (param $0 i32) + (func $object-literal/bar2 (; 9 ;) (type $iv) (param $0 i32) (if (i32.ne (i32.load @@ -282,7 +310,7 @@ ) ) ) - (func $object-literal/Foo2#test (; 6 ;) (type $iv) (param $0 i32) + (func $object-literal/Foo2#test (; 10 ;) (type $iv) (param $0 i32) (if (i32.ne (i32.load @@ -301,23 +329,17 @@ ) ) ) - (func $start (; 7 ;) (type $v) + (func $start (; 11 ;) (type $v) (local $0 i32) (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 80) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) ) (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -332,7 +354,7 @@ ) (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) @@ -343,7 +365,7 @@ ) (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) diff --git a/tests/compiler/object-literal.untouched.wat b/tests/compiler/object-literal.untouched.wat index 672cae49..4c34a267 100644 --- a/tests/compiler/object-literal.untouched.wat +++ b/tests/compiler/object-literal.untouched.wat @@ -1,5 +1,6 @@ (module (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iv (func (param i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $iii (func (param i32 i32) (result i32))) @@ -19,7 +20,15 @@ (data (i32.const 36) "\11\00\00\00o\00b\00j\00e\00c\00t\00-\00l\00i\00t\00e\00r\00a\00l\00.\00t\00s\00") (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 1 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 2 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -32,7 +41,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -46,16 +55,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -100,14 +109,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -127,7 +136,15 @@ ) (i32.const 0) ) - (func $~lib/memory/compare_memory (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/memory/memcmp (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -141,7 +158,12 @@ (loop $continue|0 (if (if (result i32) - (get_local $2) + (tee_local $3 + (i32.ne + (get_local $2) + (i32.const 0) + ) + ) (i32.eq (i32.load8_u (get_local $0) @@ -150,7 +172,7 @@ (get_local $1) ) ) - (get_local $2) + (get_local $3) ) (block (block @@ -191,7 +213,14 @@ (i32.const 0) ) ) - (func $~lib/string/String.__eq (; 3 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.compare (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (call $~lib/memory/memcmp + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/string/String.__eq (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -238,14 +267,14 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $3) @@ -254,7 +283,7 @@ ) ) ) - (func $object-literal/bar (; 4 ;) (type $iv) (param $0 i32) + (func $object-literal/bar (; 8 ;) (type $iv) (param $0 i32) (if (i32.eqz (i32.eq @@ -294,7 +323,7 @@ ) ) ) - (func $object-literal/bar2 (; 5 ;) (type $iv) (param $0 i32) + (func $object-literal/bar2 (; 9 ;) (type $iv) (param $0 i32) (if (i32.eqz (i32.eq @@ -315,7 +344,7 @@ ) ) ) - (func $object-literal/Foo2#test (; 6 ;) (type $iv) (param $0 i32) + (func $object-literal/Foo2#test (; 10 ;) (type $iv) (param $0 i32) (if (i32.eqz (i32.eq @@ -336,7 +365,7 @@ ) ) ) - (func $start (; 7 ;) (type $v) + (func $start (; 11 ;) (type $v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -344,10 +373,10 @@ (i32.and (i32.add (get_global $HEAP_BASE) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) @@ -358,7 +387,7 @@ (call $object-literal/bar (block (result i32) (set_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -376,7 +405,7 @@ (call $object-literal/bar2 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) @@ -390,7 +419,7 @@ (call $object-literal/Foo2#test (block (result i32) (set_local $2 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) diff --git a/tests/compiler/recursive.optimized.wat b/tests/compiler/recursive.optimized.wat index d27373df..4d69d845 100644 --- a/tests/compiler/recursive.optimized.wat +++ b/tests/compiler/recursive.optimized.wat @@ -1,8 +1,8 @@ (module (type $ii (func (param i32) (result i32))) (memory $0 0) - (export "fib" (func $recursive/fib)) (export "memory" (memory $0)) + (export "fib" (func $recursive/fib)) (func $recursive/fib (; 0 ;) (type $ii) (param $0 i32) (result i32) (if (i32.le_s diff --git a/tests/compiler/recursive.untouched.wat b/tests/compiler/recursive.untouched.wat index 25e4c122..92a85392 100644 --- a/tests/compiler/recursive.untouched.wat +++ b/tests/compiler/recursive.untouched.wat @@ -2,8 +2,8 @@ (type $ii (func (param i32) (result i32))) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) - (export "fib" (func $recursive/fib)) (export "memory" (memory $0)) + (export "fib" (func $recursive/fib)) (func $recursive/fib (; 0 ;) (type $ii) (param $0 i32) (result i32) (if (i32.le_s diff --git a/tests/compiler/reexport.optimized.wat b/tests/compiler/reexport.optimized.wat index 0024bcc2..61849584 100644 --- a/tests/compiler/reexport.optimized.wat +++ b/tests/compiler/reexport.optimized.wat @@ -5,6 +5,7 @@ (global $export/b i32 (i32.const 2)) (global $export/c i32 (i32.const 3)) (memory $0 0) + (export "memory" (memory $0)) (export "add" (func $export/add)) (export "renamed_sub" (func $export/sub)) (export "renamed_mul" (func $export/mul)) @@ -15,7 +16,7 @@ (export "rerenamed_c" (global $export/c)) (export "renamed_add" (func $export/add)) (export "rerenamed_sub" (func $export/mul)) - (export "memory" (memory $0)) + (export "renamed_ns.two" (func $export/ns.two)) (start $start) (func $export/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add @@ -35,7 +36,10 @@ (get_local $1) ) ) - (func $start (; 3 ;) (type $v) + (func $export/ns.two (; 3 ;) (type $v) + (nop) + ) + (func $start (; 4 ;) (type $v) (drop (i32.add (call $export/add diff --git a/tests/compiler/reexport.untouched.wat b/tests/compiler/reexport.untouched.wat index 60be42a0..099943f9 100644 --- a/tests/compiler/reexport.untouched.wat +++ b/tests/compiler/reexport.untouched.wat @@ -6,6 +6,7 @@ (global $export/c i32 (i32.const 3)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) + (export "memory" (memory $0)) (export "add" (func $export/add)) (export "renamed_sub" (func $export/sub)) (export "renamed_mul" (func $export/mul)) @@ -16,7 +17,7 @@ (export "rerenamed_c" (global $export/c)) (export "renamed_add" (func $export/add)) (export "rerenamed_sub" (func $export/mul)) - (export "memory" (memory $0)) + (export "renamed_ns.two" (func $export/ns.two)) (start $start) (func $export/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add diff --git a/tests/compiler/retain-i32.untouched.wat b/tests/compiler/retain-i32.untouched.wat index cdba194d..0cdccdf7 100644 --- a/tests/compiler/retain-i32.untouched.wat +++ b/tests/compiler/retain-i32.untouched.wat @@ -3,6 +3,15 @@ (type $iiiiv (func (param i32 i32 i32 i32))) (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) + (global $i8.MAX_VALUE i32 (i32.const 127)) + (global $i8.MIN_VALUE i32 (i32.const -128)) + (global $u8.MAX_VALUE i32 (i32.const 255)) + (global $i16.MIN_VALUE i32 (i32.const -32768)) + (global $i16.MAX_VALUE i32 (i32.const 32767)) + (global $u16.MAX_VALUE i32 (i32.const 65535)) + (global $i32.MAX_VALUE i32 (i32.const 2147483647)) + (global $i32.MIN_VALUE i32 (i32.const -2147483648)) + (global $u32.MAX_VALUE i32 (i32.const -1)) (global $retain-i32/si (mut i32) (i32.const 0)) (global $retain-i32/ui (mut i32) (i32.const 0)) (global $HEAP_BASE i32 (i32.const 40)) @@ -464,106 +473,106 @@ (local $0 i32) (call $retain-i32/test (i32.const 0) - (i32.const 127) + (get_global $i8.MAX_VALUE) ) (call $retain-i32/test - (i32.const 127) + (get_global $i8.MAX_VALUE) (i32.const 0) ) (call $retain-i32/test (i32.const 1) - (i32.const 127) + (get_global $i8.MAX_VALUE) ) (call $retain-i32/test - (i32.const 127) + (get_global $i8.MAX_VALUE) (i32.const 1) ) (call $retain-i32/test (i32.const -1) - (i32.const 127) + (get_global $i8.MAX_VALUE) ) (call $retain-i32/test - (i32.const 127) + (get_global $i8.MAX_VALUE) (i32.const -1) ) (call $retain-i32/test (i32.const 0) - (i32.const -128) + (get_global $i8.MIN_VALUE) ) (call $retain-i32/test - (i32.const -128) + (get_global $i8.MIN_VALUE) (i32.const 0) ) (call $retain-i32/test (i32.const 1) - (i32.const -128) + (get_global $i8.MIN_VALUE) ) (call $retain-i32/test - (i32.const -128) + (get_global $i8.MIN_VALUE) (i32.const 1) ) (call $retain-i32/test (i32.const -1) - (i32.const -128) + (get_global $i8.MIN_VALUE) ) (call $retain-i32/test - (i32.const -128) + (get_global $i8.MIN_VALUE) (i32.const -1) ) (call $retain-i32/test - (i32.const 127) - (i32.const 127) + (get_global $i8.MAX_VALUE) + (get_global $i8.MAX_VALUE) ) (call $retain-i32/test - (i32.const -128) - (i32.const -128) + (get_global $i8.MIN_VALUE) + (get_global $i8.MIN_VALUE) ) (call $retain-i32/test - (i32.const 127) - (i32.const -128) + (get_global $i8.MAX_VALUE) + (get_global $i8.MIN_VALUE) ) (call $retain-i32/test - (i32.const -128) - (i32.const 127) + (get_global $i8.MIN_VALUE) + (get_global $i8.MAX_VALUE) ) (call $retain-i32/test (i32.const 0) - (i32.const 255) + (get_global $u8.MAX_VALUE) ) (call $retain-i32/test - (i32.const 255) + (get_global $u8.MAX_VALUE) (i32.const 0) ) (call $retain-i32/test (i32.const 1) - (i32.const 255) + (get_global $u8.MAX_VALUE) ) (call $retain-i32/test - (i32.const 255) + (get_global $u8.MAX_VALUE) (i32.const 1) ) (call $retain-i32/test (i32.const -1) - (i32.const 255) + (get_global $u8.MAX_VALUE) ) (call $retain-i32/test - (i32.const 255) + (get_global $u8.MAX_VALUE) (i32.const -1) ) (call $retain-i32/test - (i32.const 255) - (i32.const 255) + (get_global $u8.MAX_VALUE) + (get_global $u8.MAX_VALUE) ) (block $break|0 (set_local $0 - (i32.const -128) + (get_global $i8.MIN_VALUE) ) (loop $repeat|0 (br_if $break|0 (i32.eqz (i32.le_s (get_local $0) - (i32.const 255) + (get_global $u8.MAX_VALUE) ) ) ) @@ -581,39 +590,39 @@ (get_local $0) ) (call $retain-i32/test - (i32.const -128) + (get_global $i8.MIN_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const 127) + (get_global $i8.MAX_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const 255) + (get_global $u8.MAX_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const -32768) + (get_global $i16.MIN_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const 32767) + (get_global $i16.MAX_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const 65535) + (get_global $u16.MAX_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const 2147483647) + (get_global $i32.MAX_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const -2147483648) + (get_global $i32.MIN_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const -1) + (get_global $u32.MAX_VALUE) (get_local $0) ) ) diff --git a/tests/compiler/std/allocator_arena.optimized.wat b/tests/compiler/std/allocator_arena.optimized.wat index 92696825..dd6c13a9 100644 --- a/tests/compiler/std/allocator_arena.optimized.wat +++ b/tests/compiler/std/allocator_arena.optimized.wat @@ -1,5 +1,6 @@ (module (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $iiiv (func (param i32 i32 i32))) (type $iiii (func (param i32 i32 i32) (result i32))) @@ -11,12 +12,19 @@ (global $std/allocator_arena/ptr1 (mut i32) (i32.const 0)) (global $std/allocator_arena/ptr2 (mut i32) (i32.const 0)) (global $std/allocator_arena/i (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 56)) (memory $0 1) (data (i32.const 8) "\16\00\00\00s\00t\00d\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00_\00a\00r\00e\00n\00a\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 1 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 2 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -48,14 +56,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -83,7 +91,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -102,7 +110,12 @@ ) (i32.const 0) ) - (func $~lib/memory/set_memory (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/memory/memset (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -432,7 +445,14 @@ ) ) ) - (func $~lib/memory/copy_memory (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memory.fill (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/memory/memcpy (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1818,7 +1838,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -1853,7 +1873,7 @@ (if (get_local $3) (block - (call $~lib/memory/copy_memory + (call $~lib/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2110,7 +2130,15 @@ ) ) ) - (func $~lib/memory/compare_memory (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.copy (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memmove + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/memory/memcmp (; 10 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -2122,8 +2150,13 @@ ) (loop $continue|0 (if - (if (result i32) - (get_local $2) + (tee_local $3 + (i32.ne + (get_local $2) + (i32.const 0) + ) + ) + (set_local $3 (i32.eq (i32.load8_u (get_local $0) @@ -2132,8 +2165,10 @@ (get_local $1) ) ) - (get_local $2) ) + ) + (if + (get_local $3) (block (set_local $2 (i32.sub @@ -2172,34 +2207,43 @@ ) ) ) - (func $~lib/allocator/arena/free_memory (; 6 ;) (type $iv) (param $0 i32) + (func $~lib/memory/memory.compare (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (call $~lib/memory/memcmp + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/allocator/arena/__memory_free (; 12 ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/allocator/arena/reset_memory (; 7 ;) (type $v) + (func $~lib/memory/memory.free (; 13 ;) (type $iv) (param $0 i32) + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_reset (; 14 ;) (type $v) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) ) ) - (func $start (; 8 ;) (type $v) + (func $~lib/memory/memory.reset (; 15 ;) (type $v) + (call $~lib/allocator/arena/__memory_reset) + ) + (func $start (; 16 ;) (type $v) (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 56) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) ) (set_global $std/allocator_arena/ptr1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 42) ) ) (set_global $std/allocator_arena/ptr2 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 42) ) ) @@ -2218,7 +2262,7 @@ (unreachable) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (get_global $std/allocator_arena/ptr1) (i32.const 18) (i32.const 42) @@ -2248,8 +2292,8 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 13) - (i32.const 2) + (i32.const 12) + (i32.const 27) ) (unreachable) ) @@ -2265,7 +2309,7 @@ ) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (get_global $std/allocator_arena/ptr2) (get_global $std/allocator_arena/ptr1) (i32.const 42) @@ -2295,8 +2339,8 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 18) - (i32.const 2) + (i32.const 16) + (i32.const 27) ) (unreachable) ) @@ -2313,7 +2357,7 @@ ) ) (if - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (get_global $std/allocator_arena/ptr1) (get_global $std/allocator_arena/ptr2) (i32.const 42) @@ -2322,40 +2366,34 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 20) + (i32.const 18) (i32.const 0) ) (unreachable) ) ) - (call $~lib/allocator/arena/free_memory + (call $~lib/memory/memory.free (get_global $std/allocator_arena/ptr1) ) - (call $~lib/allocator/arena/free_memory + (call $~lib/memory/memory.free (get_global $std/allocator_arena/ptr2) ) - (call $~lib/allocator/arena/reset_memory) + (call $~lib/memory/memory.reset) (set_global $std/allocator_arena/ptr1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 42) ) ) (if (i32.ne (get_global $std/allocator_arena/ptr1) - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 56) ) (block (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 27) + (i32.const 25) (i32.const 0) ) (unreachable) diff --git a/tests/compiler/std/allocator_arena.ts b/tests/compiler/std/allocator_arena.ts index 5dbe5252..a38971ea 100644 --- a/tests/compiler/std/allocator_arena.ts +++ b/tests/compiler/std/allocator_arena.ts @@ -1,27 +1,25 @@ import "allocator/arena"; const size: usize = 42; -let ptr1: usize = allocate_memory(size); -let ptr2: usize = allocate_memory(size); +var ptr1: usize = memory.allocate(size); +var ptr2: usize = memory.allocate(size); assert(ptr1 != ptr2); -set_memory(ptr1, 0x12, size); +memory.fill(ptr1, 0x12, size); -let i: usize; -for (i = 0; i < size; ++i) - assert(load(ptr1 + i) == 0x12); +var i: usize; +for (i = 0; i < size; ++i) assert(load(ptr1 + i) == 0x12); -move_memory(ptr2, ptr1, size); +memory.copy(ptr2, ptr1, size); -for (i = 0; i < size; ++i) - assert(load(ptr2 + i) == 0x12); +for (i = 0; i < size; ++i) assert(load(ptr2 + i) == 0x12); -assert(compare_memory(ptr1, ptr2, size) == 0); +assert(memory.compare(ptr1, ptr2, size) == 0); -free_memory(ptr1); -free_memory(ptr2); +memory.free(ptr1); +memory.free(ptr2); -reset_memory(); -ptr1 = allocate_memory(size); +memory.reset(); +ptr1 = memory.allocate(size); assert(ptr1 == ((HEAP_BASE + 7) & ~7)); diff --git a/tests/compiler/std/allocator_arena.untouched.wat b/tests/compiler/std/allocator_arena.untouched.wat index bc994cff..cd1ba09b 100644 --- a/tests/compiler/std/allocator_arena.untouched.wat +++ b/tests/compiler/std/allocator_arena.untouched.wat @@ -1,5 +1,6 @@ (module (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $iiiv (func (param i32 i32 i32))) (type $iiii (func (param i32 i32 i32) (result i32))) @@ -21,7 +22,15 @@ (data (i32.const 8) "\16\00\00\00s\00t\00d\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00_\00a\00r\00e\00n\00a\00.\00t\00s\00") (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 1 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 2 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -34,7 +43,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -48,16 +57,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -102,14 +111,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -129,7 +138,14 @@ ) (i32.const 0) ) - (func $~lib/memory/set_memory (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/memory/memset (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -481,7 +497,14 @@ ) ) ) - (func $~lib/memory/copy_memory (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memory.fill (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/memory/memcpy (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2283,7 +2306,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.eq @@ -2313,7 +2336,7 @@ ) ) (block - (call $~lib/memory/copy_memory + (call $~lib/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2601,7 +2624,15 @@ ) ) ) - (func $~lib/memory/compare_memory (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.copy (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memmove + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/memory/memcmp (; 10 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -2615,7 +2646,12 @@ (loop $continue|0 (if (if (result i32) - (get_local $2) + (tee_local $3 + (i32.ne + (get_local $2) + (i32.const 0) + ) + ) (i32.eq (i32.load8_u (get_local $0) @@ -2624,7 +2660,7 @@ (get_local $1) ) ) - (get_local $2) + (get_local $3) ) (block (block @@ -2665,23 +2701,40 @@ (i32.const 0) ) ) - (func $~lib/allocator/arena/free_memory (; 6 ;) (type $iv) (param $0 i32) + (func $~lib/memory/memory.compare (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (call $~lib/memory/memcmp + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/allocator/arena/__memory_free (; 12 ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/allocator/arena/reset_memory (; 7 ;) (type $v) + (func $~lib/memory/memory.free (; 13 ;) (type $iv) (param $0 i32) + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + (return) + ) + (func $~lib/allocator/arena/__memory_reset (; 14 ;) (type $v) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) ) ) - (func $start (; 8 ;) (type $v) + (func $~lib/memory/memory.reset (; 15 ;) (type $v) + (call $~lib/allocator/arena/__memory_reset) + (return) + ) + (func $start (; 16 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add (get_global $HEAP_BASE) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) @@ -2690,13 +2743,13 @@ (get_global $~lib/allocator/arena/startOffset) ) (set_global $std/allocator_arena/ptr1 - (call $~lib/allocator/arena/allocate_memory - (i32.const 42) + (call $~lib/memory/memory.allocate + (get_global $std/allocator_arena/size) ) ) (set_global $std/allocator_arena/ptr2 - (call $~lib/allocator/arena/allocate_memory - (i32.const 42) + (call $~lib/memory/memory.allocate + (get_global $std/allocator_arena/size) ) ) (if @@ -2716,10 +2769,10 @@ (unreachable) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (get_global $std/allocator_arena/ptr1) (i32.const 18) - (i32.const 42) + (get_global $std/allocator_arena/size) ) (block $break|0 (set_global $std/allocator_arena/i @@ -2730,7 +2783,7 @@ (i32.eqz (i32.lt_u (get_global $std/allocator_arena/i) - (i32.const 42) + (get_global $std/allocator_arena/size) ) ) ) @@ -2750,8 +2803,8 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 13) - (i32.const 2) + (i32.const 12) + (i32.const 27) ) (unreachable) ) @@ -2765,10 +2818,10 @@ (br $repeat|0) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (get_global $std/allocator_arena/ptr2) (get_global $std/allocator_arena/ptr1) - (i32.const 42) + (get_global $std/allocator_arena/size) ) (block $break|1 (set_global $std/allocator_arena/i @@ -2779,7 +2832,7 @@ (i32.eqz (i32.lt_u (get_global $std/allocator_arena/i) - (i32.const 42) + (get_global $std/allocator_arena/size) ) ) ) @@ -2799,8 +2852,8 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 18) - (i32.const 2) + (i32.const 16) + (i32.const 27) ) (unreachable) ) @@ -2817,10 +2870,10 @@ (if (i32.eqz (i32.eq - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (get_global $std/allocator_arena/ptr1) (get_global $std/allocator_arena/ptr2) - (i32.const 42) + (get_global $std/allocator_arena/size) ) (i32.const 0) ) @@ -2829,22 +2882,22 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 20) + (i32.const 18) (i32.const 0) ) (unreachable) ) ) - (call $~lib/allocator/arena/free_memory + (call $~lib/memory/memory.free (get_global $std/allocator_arena/ptr1) ) - (call $~lib/allocator/arena/free_memory + (call $~lib/memory/memory.free (get_global $std/allocator_arena/ptr2) ) - (call $~lib/allocator/arena/reset_memory) + (call $~lib/memory/memory.reset) (set_global $std/allocator_arena/ptr1 - (call $~lib/allocator/arena/allocate_memory - (i32.const 42) + (call $~lib/memory/memory.allocate + (get_global $std/allocator_arena/size) ) ) (if @@ -2867,7 +2920,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 27) + (i32.const 25) (i32.const 0) ) (unreachable) diff --git a/tests/compiler/std/array-access.optimized.wat b/tests/compiler/std/array-access.optimized.wat index 47e89026..5edc1412 100644 --- a/tests/compiler/std/array-access.optimized.wat +++ b/tests/compiler/std/array-access.optimized.wat @@ -7,12 +7,12 @@ (memory $0 1) (data (i32.const 12) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") (data (i32.const 44) "\04\00\00\00n\00u\00l\00l") + (export "memory" (memory $0)) (export "i32ArrayArrayElementAccess" (func $std/array-access/i32ArrayArrayElementAccess)) (export "stringArrayPropertyAccess" (func $std/array-access/stringArrayPropertyAccess)) (export "stringArrayMethodCall" (func $std/array-access/stringArrayMethodCall)) (export "stringArrayArrayPropertyAccess" (func $std/array-access/stringArrayArrayPropertyAccess)) (export "stringArrayArrayMethodCall" (func $std/array-access/stringArrayArrayMethodCall)) - (export "memory" (memory $0)) (func $~lib/array/Array>#__get (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) @@ -59,7 +59,8 @@ ) ) ) - (func $~lib/memory/compare_memory (; 4 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memcmp (; 4 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -71,8 +72,13 @@ ) (loop $continue|0 (if - (if (result i32) - (get_local $2) + (tee_local $3 + (i32.ne + (get_local $2) + (i32.const 0) + ) + ) + (set_local $3 (i32.eq (i32.load8_u (get_local $0) @@ -81,8 +87,10 @@ (get_local $1) ) ) - (get_local $2) ) + ) + (if + (get_local $3) (block (set_local $2 (i32.sub @@ -121,7 +129,14 @@ ) ) ) - (func $~lib/string/String#startsWith (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.compare (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (call $~lib/memory/memcmp + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/string/String#startsWith (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (if @@ -185,7 +200,7 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (i32.add (get_local $0) @@ -207,7 +222,7 @@ ) ) ) - (func $std/array-access/stringArrayMethodCall (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array-access/stringArrayMethodCall (; 7 ;) (type $ii) (param $0 i32) (result i32) (call $~lib/string/String#startsWith (call $~lib/array/Array>#__get (get_local $0) @@ -217,7 +232,7 @@ (i32.const 0) ) ) - (func $std/array-access/stringArrayArrayPropertyAccess (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array-access/stringArrayArrayPropertyAccess (; 8 ;) (type $ii) (param $0 i32) (result i32) (i32.load (call $~lib/array/Array>#__get (call $~lib/array/Array>#__get @@ -228,7 +243,7 @@ ) ) ) - (func $std/array-access/stringArrayArrayMethodCall (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array-access/stringArrayArrayMethodCall (; 9 ;) (type $ii) (param $0 i32) (result i32) (call $~lib/string/String#startsWith (call $~lib/array/Array>#__get (call $~lib/array/Array>#__get diff --git a/tests/compiler/std/array-access.untouched.wat b/tests/compiler/std/array-access.untouched.wat index 7352c055..507939b5 100644 --- a/tests/compiler/std/array-access.untouched.wat +++ b/tests/compiler/std/array-access.untouched.wat @@ -14,12 +14,12 @@ (data (i32.const 8) "\00\00\00\00") (data (i32.const 12) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") (data (i32.const 44) "\04\00\00\00n\00u\00l\00l\00") + (export "memory" (memory $0)) (export "i32ArrayArrayElementAccess" (func $std/array-access/i32ArrayArrayElementAccess)) (export "stringArrayPropertyAccess" (func $std/array-access/stringArrayPropertyAccess)) (export "stringArrayMethodCall" (func $std/array-access/stringArrayMethodCall)) (export "stringArrayArrayPropertyAccess" (func $std/array-access/stringArrayArrayPropertyAccess)) (export "stringArrayArrayMethodCall" (func $std/array-access/stringArrayArrayMethodCall)) - (export "memory" (memory $0)) (func $~lib/array/Array>#__get (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 @@ -130,7 +130,8 @@ ) ) ) - (func $~lib/memory/compare_memory (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memcmp (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -144,7 +145,12 @@ (loop $continue|0 (if (if (result i32) - (get_local $2) + (tee_local $3 + (i32.ne + (get_local $2) + (i32.const 0) + ) + ) (i32.eq (i32.load8_u (get_local $0) @@ -153,7 +159,7 @@ (get_local $1) ) ) - (get_local $2) + (get_local $3) ) (block (block @@ -194,7 +200,14 @@ (i32.const 0) ) ) - (func $~lib/string/String#startsWith (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.compare (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (call $~lib/memory/memcmp + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/string/String#startsWith (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -284,11 +297,11 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $8) @@ -297,7 +310,7 @@ ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $9) @@ -306,7 +319,7 @@ ) ) ) - (func $std/array-access/stringArrayMethodCall (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array-access/stringArrayMethodCall (; 9 ;) (type $ii) (param $0 i32) (result i32) (call $~lib/string/String#startsWith (call $~lib/array/Array#__get (get_local $0) @@ -316,7 +329,7 @@ (i32.const 0) ) ) - (func $~lib/array/Array>#__get (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#__get (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -347,7 +360,7 @@ (unreachable) ) ) - (func $std/array-access/stringArrayArrayPropertyAccess (; 10 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array-access/stringArrayArrayPropertyAccess (; 11 ;) (type $ii) (param $0 i32) (result i32) (i32.load (call $~lib/array/Array#__get (call $~lib/array/Array>#__get @@ -358,7 +371,7 @@ ) ) ) - (func $std/array-access/stringArrayArrayMethodCall (; 11 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array-access/stringArrayArrayMethodCall (; 12 ;) (type $ii) (param $0 i32) (result i32) (call $~lib/string/String#startsWith (call $~lib/array/Array#__get (call $~lib/array/Array>#__get diff --git a/tests/compiler/std/array-literal.optimized.wat b/tests/compiler/std/array-literal.optimized.wat index 8e312f51..0e7de69b 100644 --- a/tests/compiler/std/array-literal.optimized.wat +++ b/tests/compiler/std/array-literal.optimized.wat @@ -2,6 +2,7 @@ (type $ii (func (param i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $iii (func (param i32 i32) (result i32))) + (type $i (func (result i32))) (type $iiiv (func (param i32 i32 i32))) (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) @@ -10,7 +11,6 @@ (global $std/array-literal/emptyArray (mut i32) (i32.const 0)) (global $std/array-literal/i (mut i32) (i32.const 0)) (global $std/array-literal/dynamicArray (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 184)) (memory $0 1) (data (i32.const 8) "\10\00\00\00\03\00\00\00\0c") (data (i32.const 28) "\01\00\00\00\02") @@ -67,7 +67,15 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 4 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 5 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -99,14 +107,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -134,7 +142,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -153,7 +161,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 7 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/internal/arraybuffer/allocUnsafe (; 8 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -172,7 +185,7 @@ ) (i32.store (tee_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -182,7 +195,7 @@ ) (get_local $1) ) - (func $~lib/memory/set_memory (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -512,7 +525,14 @@ ) ) ) - (func $~lib/array/Array#constructor (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.fill (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/array/Array#constructor (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -547,7 +567,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -567,7 +587,7 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $2) (i32.const 8) @@ -577,7 +597,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#__unchecked_set (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__unchecked_set (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (i32.store offset=8 (i32.add (i32.load @@ -591,16 +611,10 @@ (get_local $2) ) ) - (func $start (; 9 ;) (type $v) + (func $start (; 13 ;) (type $v) (local $0 i32) (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 184) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) diff --git a/tests/compiler/std/array-literal.untouched.wat b/tests/compiler/std/array-literal.untouched.wat index 7db5d81b..a3dcf114 100644 --- a/tests/compiler/std/array-literal.untouched.wat +++ b/tests/compiler/std/array-literal.untouched.wat @@ -2,6 +2,7 @@ (type $ii (func (param i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $iii (func (param i32 i32) (result i32))) + (type $i (func (result i32))) (type $iiiv (func (param i32 i32 i32))) (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) @@ -70,7 +71,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -78,7 +79,15 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 4 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 5 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -91,7 +100,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -105,16 +114,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -159,14 +168,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -186,13 +195,20 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 7 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/internal/arraybuffer/allocUnsafe (; 8 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.eqz (i32.le_u (get_local $0) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) ) (block @@ -206,7 +222,7 @@ ) ) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -218,7 +234,7 @@ ) (get_local $1) ) - (func $~lib/memory/set_memory (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -570,7 +586,14 @@ ) ) ) - (func $~lib/array/Array#constructor (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.fill (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/array/Array#constructor (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -608,7 +631,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -631,17 +654,17 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) ) (get_local $0) ) - (func $~lib/array/Array#__unchecked_set (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__unchecked_set (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 (set_local $3 @@ -661,16 +684,16 @@ ) ) ) - (func $start (; 9 ;) (type $v) + (func $start (; 13 ;) (type $v) (local $0 i32) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add (get_global $HEAP_BASE) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) @@ -682,7 +705,7 @@ (i32.eqz (i32.eq (call $~lib/array/Array#get:length - (i32.const 8) + (get_global $std/array-literal/staticArray) ) (i32.const 3) ) @@ -701,7 +724,7 @@ (i32.eqz (i32.eq (call $~lib/array/Array#__get - (i32.const 8) + (get_global $std/array-literal/staticArray) (i32.const 0) ) (i32.const 0) @@ -721,7 +744,7 @@ (i32.eqz (i32.eq (call $~lib/array/Array#__get - (i32.const 8) + (get_global $std/array-literal/staticArray) (i32.const 1) ) (i32.const 1) @@ -741,7 +764,7 @@ (i32.eqz (i32.eq (call $~lib/array/Array#__get - (i32.const 8) + (get_global $std/array-literal/staticArray) (i32.const 2) ) (i32.const 2) diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index e6a98665..a9a2df34 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -2,6 +2,7 @@ (type $iii (func (param i32 i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iiiv (func (param i32 i32 i32))) (type $iiii (func (param i32 i32 i32) (result i32))) (type $iiv (func (param i32 i32))) @@ -46,7 +47,6 @@ (global $std/array/randomStringsActual (mut i32) (i32.const 552)) (global $std/array/randomStringsExpected (mut i32) (i32.const 624)) (global $std/array/randomStrings400 (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 792)) (table 51 51 anyfunc) (elem (i32.const 0) $start~anonymous|0 $start~anonymous|1 $start~anonymous|2 $start~anonymous|3 $start~anonymous|2 $start~anonymous|5 $start~anonymous|6 $start~anonymous|7 $start~anonymous|8 $start~anonymous|9 $start~anonymous|10 $start~anonymous|11 $start~anonymous|12 $start~anonymous|13 $start~anonymous|14 $start~anonymous|15 $start~anonymous|16 $start~anonymous|17 $start~anonymous|16 $start~anonymous|19 $start~anonymous|20 $start~anonymous|21 $start~anonymous|22 $start~anonymous|23 $start~anonymous|24 $start~anonymous|25 $start~anonymous|26 $start~anonymous|27 $start~anonymous|28 $start~anonymous|28 $start~anonymous|30 $start~anonymous|31 $start~anonymous|32 $start~anonymous|28 $start~anonymous|34 $start~anonymous|28 $start~anonymous|28 $start~anonymous|30 $start~anonymous|31 $start~anonymous|32 $start~anonymous|28 $start~anonymous|34 $std/array/assertSortedDefault~anonymous|42 $start~anonymous|43 $start~anonymous|44 $start~anonymous|43 $start~anonymous|44 $start~anonymous|47 $start~anonymous|48 $start~anonymous|49 $start~anonymous|49) (memory $0 1) @@ -89,7 +89,15 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 3 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 4 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -121,14 +129,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -156,7 +164,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -175,7 +183,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 6 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/internal/arraybuffer/allocUnsafe (; 7 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -194,7 +207,7 @@ ) (i32.store (tee_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -204,7 +217,7 @@ ) (get_local $1) ) - (func $~lib/memory/set_memory (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -534,7 +547,14 @@ ) ) ) - (func $~lib/array/Array#constructor (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.fill (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/array/Array#constructor (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -569,7 +589,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -589,7 +609,7 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $2) (i32.const 8) @@ -599,12 +619,12 @@ ) (get_local $0) ) - (func $~lib/array/Array#get:length (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 11 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $std/array/internalCapacity (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/internalCapacity (; 12 ;) (type $ii) (param $0 i32) (result i32) (i32.shr_s (i32.load (i32.load @@ -614,7 +634,7 @@ (i32.const 2) ) ) - (func $~lib/memory/copy_memory (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memcpy (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2000,7 +2020,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -2035,7 +2055,7 @@ (if (get_local $3) (block - (call $~lib/memory/copy_memory + (call $~lib/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2292,10 +2312,16 @@ ) ) ) - (func $~lib/internal/arraybuffer/reallocUnsafe (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.copy (; 15 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memmove + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/internal/arraybuffer/reallocUnsafe (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) - (local $4 i32) (if (i32.gt_s (get_local $1) @@ -2336,7 +2362,7 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (i32.add (get_local $0) @@ -2352,16 +2378,14 @@ ) ) (block - (call $~lib/memory/move_memory - (tee_local $4 - (i32.add - (tee_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe - (get_local $1) - ) + (call $~lib/memory/memory.copy + (i32.add + (tee_local $3 + (call $~lib/internal/arraybuffer/allocUnsafe + (get_local $1) ) - (i32.const 8) ) + (i32.const 8) ) (i32.add (get_local $0) @@ -2369,9 +2393,12 @@ ) (get_local $2) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add - (get_local $4) + (i32.add + (get_local $3) + (i32.const 8) + ) (get_local $2) ) (i32.const 0) @@ -2416,7 +2443,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#push (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#push (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2490,7 +2517,7 @@ ) (get_local $3) ) - (func $~lib/array/Array#__get (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__get (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (i32.lt_u @@ -2519,7 +2546,7 @@ ) ) ) - (func $~lib/array/Array#pop (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#pop (; 19 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -2565,14 +2592,14 @@ ) (get_local $2) ) - (func $~lib/array/Array#unshift (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#unshift (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - (set_local $4 + (set_local $3 (i32.add - (tee_local $3 + (tee_local $4 (i32.load offset=4 (get_local $0) ) @@ -2582,7 +2609,7 @@ ) (if (i32.ge_u - (get_local $3) + (get_local $4) (tee_local $5 (i32.shr_u (i32.load @@ -2599,7 +2626,7 @@ (block (if (i32.ge_u - (get_local $3) + (get_local $4) (i32.const 268435454) ) (block @@ -2619,7 +2646,7 @@ (call $~lib/internal/arraybuffer/reallocUnsafe (get_local $2) (i32.shl - (get_local $4) + (get_local $3) (i32.const 2) ) ) @@ -2634,17 +2661,15 @@ ) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add - (tee_local $3 - (i32.add - (get_local $2) - (i32.const 8) - ) - ) - (i32.const 4) + (get_local $2) + (i32.const 12) + ) + (i32.add + (get_local $2) + (i32.const 8) ) - (get_local $3) (i32.shl (i32.sub (get_local $5) @@ -2659,11 +2684,11 @@ ) (i32.store offset=4 (get_local $0) - (get_local $4) + (get_local $3) ) - (get_local $4) + (get_local $3) ) - (func $~lib/array/Array#shift (; 16 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#shift (; 21 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -2687,27 +2712,25 @@ (unreachable) ) ) - (set_local $4 + (set_local $3 (i32.load offset=8 - (tee_local $3 + (tee_local $2 (i32.load (get_local $0) ) ) ) ) - (call $~lib/memory/move_memory - (tee_local $2 - (i32.add - (get_local $3) - (i32.const 8) - ) + (call $~lib/memory/memory.copy + (i32.add + (get_local $2) + (i32.const 8) ) (i32.add (get_local $2) - (i32.const 4) + (i32.const 12) ) - (tee_local $2 + (tee_local $4 (i32.shl (tee_local $1 (i32.sub @@ -2721,8 +2744,8 @@ ) (i32.store offset=8 (i32.add - (get_local $3) (get_local $2) + (get_local $4) ) (i32.const 0) ) @@ -2730,9 +2753,9 @@ (get_local $0) (get_local $1) ) - (get_local $4) + (get_local $3) ) - (func $~lib/array/Array#reverse (; 17 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#reverse (; 22 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -2814,7 +2837,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#indexOf (; 18 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#indexOf (; 23 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (if @@ -2904,7 +2927,7 @@ ) (i32.const -1) ) - (func $~lib/array/Array#includes (; 19 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#includes (; 24 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (if @@ -2994,7 +3017,7 @@ ) (i32.const 0) ) - (func $~lib/array/Array#splice (; 20 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#splice (; 25 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -3040,15 +3063,15 @@ (set_local $4 (get_local $2) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add - (tee_local $2 - (i32.add + (i32.add + (tee_local $2 (i32.load (get_local $0) ) - (i32.const 8) ) + (i32.const 8) ) (i32.shl (get_local $1) @@ -3056,7 +3079,10 @@ ) ) (i32.add - (get_local $2) + (i32.add + (get_local $2) + (i32.const 8) + ) (i32.shl (i32.add (get_local $1) @@ -3092,7 +3118,7 @@ ) ) ) - (func $~lib/array/Array#__set (; 21 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__set (; 26 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -3159,12 +3185,12 @@ (get_local $2) ) ) - (func $start~anonymous|0 (; 22 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|0 (; 27 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.eqz (get_local $0) ) ) - (func $~lib/array/Array#findIndex (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#findIndex (; 28 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3240,19 +3266,19 @@ ) (i32.const -1) ) - (func $start~anonymous|1 (; 24 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|1 (; 29 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.eq (get_local $0) (i32.const 1) ) ) - (func $start~anonymous|2 (; 25 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|2 (; 30 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.eq (get_local $0) (i32.const 100) ) ) - (func $start~anonymous|3 (; 26 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|3 (; 31 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3264,7 +3290,7 @@ (i32.const 100) ) ) - (func $start~anonymous|5 (; 27 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|5 (; 32 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3275,13 +3301,13 @@ (i32.const 100) ) ) - (func $start~anonymous|6 (; 28 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|6 (; 33 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ge_s (get_local $0) (i32.const 0) ) ) - (func $~lib/array/Array#every (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#every (; 34 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3357,13 +3383,13 @@ ) (i32.const 1) ) - (func $start~anonymous|7 (; 30 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|7 (; 35 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.le_s (get_local $0) (i32.const 0) ) ) - (func $start~anonymous|8 (; 31 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|8 (; 36 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3375,13 +3401,13 @@ (i32.const 10) ) ) - (func $start~anonymous|9 (; 32 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|9 (; 37 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.lt_s (get_local $0) (i32.const 10) ) ) - (func $start~anonymous|10 (; 33 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|10 (; 38 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3392,13 +3418,13 @@ (i32.const 3) ) ) - (func $start~anonymous|11 (; 34 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|11 (; 39 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ge_s (get_local $0) (i32.const 3) ) ) - (func $~lib/array/Array#some (; 35 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#some (; 40 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3474,13 +3500,13 @@ ) (i32.const 0) ) - (func $start~anonymous|12 (; 36 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|12 (; 41 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.le_s (get_local $0) (i32.const -1) ) ) - (func $start~anonymous|13 (; 37 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|13 (; 42 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3492,13 +3518,13 @@ (i32.const 10) ) ) - (func $start~anonymous|14 (; 38 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|14 (; 43 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.gt_s (get_local $0) (i32.const 10) ) ) - (func $start~anonymous|15 (; 39 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|15 (; 44 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3509,7 +3535,7 @@ (i32.const 3) ) ) - (func $start~anonymous|16 (; 40 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|16 (; 45 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (set_global $std/array/i (i32.add (get_global $std/array/i) @@ -3517,7 +3543,7 @@ ) ) ) - (func $~lib/array/Array#forEach (; 41 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/array/Array#forEach (; 46 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3582,7 +3608,7 @@ ) ) ) - (func $start~anonymous|17 (; 42 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|17 (; 47 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3596,7 +3622,7 @@ ) ) ) - (func $start~anonymous|19 (; 43 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|19 (; 48 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3609,12 +3635,12 @@ ) ) ) - (func $start~anonymous|20 (; 44 ;) (type $iiif) (param $0 i32) (param $1 i32) (param $2 i32) (result f32) + (func $start~anonymous|20 (; 49 ;) (type $iiif) (param $0 i32) (param $1 i32) (param $2 i32) (result f32) (f32.convert_s/i32 (get_local $0) ) ) - (func $~lib/array/Array#map (; 45 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#map (; 50 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3700,7 +3726,7 @@ ) (get_local $6) ) - (func $~lib/array/Array#__get (; 46 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) + (func $~lib/array/Array#__get (; 51 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) (if (result f32) (i32.lt_u (get_local $1) @@ -3727,7 +3753,7 @@ (unreachable) ) ) - (func $start~anonymous|21 (; 47 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|21 (; 52 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3742,7 +3768,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#map (; 48 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#map (; 53 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3828,7 +3854,7 @@ ) (get_local $6) ) - (func $start~anonymous|22 (; 49 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|22 (; 54 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_global $std/array/i (i32.add (get_global $std/array/i) @@ -3837,7 +3863,7 @@ ) (get_local $0) ) - (func $start~anonymous|23 (; 50 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|23 (; 55 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3851,13 +3877,13 @@ ) (get_local $0) ) - (func $start~anonymous|24 (; 51 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|24 (; 56 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ge_s (get_local $0) (i32.const 2) ) ) - (func $~lib/array/Array#filter (; 52 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#filter (; 57 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3944,7 +3970,7 @@ ) (get_local $4) ) - (func $start~anonymous|25 (; 53 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|25 (; 58 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3962,7 +3988,7 @@ (i32.const 2) ) ) - (func $start~anonymous|26 (; 54 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|26 (; 59 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_global $std/array/i (i32.add (get_global $std/array/i) @@ -3974,7 +4000,7 @@ (i32.const 2) ) ) - (func $start~anonymous|27 (; 55 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|27 (; 60 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3991,13 +4017,13 @@ (i32.const 2) ) ) - (func $start~anonymous|28 (; 56 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|28 (; 61 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $~lib/array/Array#reduce (; 57 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#reduce (; 62 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4066,7 +4092,7 @@ ) (get_local $2) ) - (func $start~anonymous|30 (; 58 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|30 (; 63 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (if (result i32) (i32.and (get_local $0) @@ -4079,7 +4105,7 @@ ) ) ) - (func $start~anonymous|31 (; 59 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|31 (; 64 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (if (result i32) (i32.and (get_local $0) @@ -4092,7 +4118,7 @@ ) ) ) - (func $start~anonymous|32 (; 60 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|32 (; 65 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $3) @@ -4104,7 +4130,7 @@ (get_local $1) ) ) - (func $start~anonymous|34 (; 61 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|34 (; 66 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $3) @@ -4115,7 +4141,7 @@ (get_local $1) ) ) - (func $~lib/array/Array#reduceRight (; 62 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#reduceRight (; 67 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $4 @@ -4170,7 +4196,7 @@ ) (get_local $2) ) - (func $~lib/math/murmurHash3 (; 63 ;) (type $II) (param $0 i64) (result i64) + (func $~lib/math/murmurHash3 (; 68 ;) (type $II) (param $0 i64) (result i64) (i64.xor (tee_local $0 (i64.mul @@ -4201,7 +4227,7 @@ ) ) ) - (func $~lib/math/NativeMath.seedRandom (; 64 ;) (type $Iv) (param $0 i64) + (func $~lib/math/NativeMath.seedRandom (; 69 ;) (type $Iv) (param $0 i64) (if (i64.eqz (get_local $0) @@ -4230,7 +4256,7 @@ ) ) ) - (func $std/array/createReverseOrderedArray (; 65 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedArray (; 70 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (call $~lib/array/Array#constructor @@ -4275,7 +4301,7 @@ ) (get_local $1) ) - (func $~lib/math/NativeMath.random (; 66 ;) (type $F) (result f64) + (func $~lib/math/NativeMath.random (; 71 ;) (type $F) (result f64) (local $0 i64) (local $1 i64) (if @@ -4344,7 +4370,7 @@ (f64.const 1) ) ) - (func $std/array/createRandomOrderedArray (; 67 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomOrderedArray (; 72 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $0 (call $~lib/array/Array#constructor @@ -4387,7 +4413,7 @@ ) (get_local $0) ) - (func $std/array/assertSortedDefault~anonymous|42 (; 68 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/assertSortedDefault~anonymous|42 (; 73 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.gt_s (get_local $0) @@ -4399,7 +4425,7 @@ ) ) ) - (func $~lib/internal/array/insertionSort (; 69 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/insertionSort (; 74 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4526,10 +4552,15 @@ ) (get_local $0) ) - (func $~lib/allocator/arena/free_memory (; 70 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 75 ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/internal/array/weakHeapSort (; 71 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.free (; 76 ;) (type $iv) (param $0 i32) + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + ) + (func $~lib/internal/array/weakHeapSort (; 77 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4538,9 +4569,9 @@ (local $7 i32) (local $8 i32) (local $9 i32) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (tee_local $7 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (tee_local $6 (i32.shl (i32.shr_s @@ -4907,7 +4938,7 @@ (br $repeat|2) ) ) - (call $~lib/allocator/arena/free_memory + (call $~lib/memory/memory.free (get_local $7) ) (set_local $1 @@ -4933,7 +4964,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#sort (; 72 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort (; 78 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5036,7 +5067,7 @@ ) ) ) - (func $std/array/isSorted (; 73 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted (; 79 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -5093,7 +5124,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted (; 74 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted (; 80 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -5115,13 +5146,13 @@ ) ) ) - (func $std/array/assertSortedDefault (; 75 ;) (type $iv) (param $0 i32) + (func $std/array/assertSortedDefault (; 81 ;) (type $iv) (param $0 i32) (call $std/array/assertSorted (get_local $0) (i32.const 42) ) ) - (func $std/array/isArraysEqual (; 76 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/array/isArraysEqual (; 82 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -5184,19 +5215,19 @@ ) (i32.const 1) ) - (func $start~anonymous|43 (; 77 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|43 (; 83 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $start~anonymous|44 (; 78 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|44 (; 84 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $1) (get_local $0) ) ) - (func $std/array/createReverseOrderedNestedArray (; 79 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedNestedArray (; 85 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (call $~lib/array/Array#constructor @@ -5252,7 +5283,7 @@ ) (get_local $1) ) - (func $start~anonymous|47 (; 80 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|47 (; 86 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/array/Array#__get (get_local $0) @@ -5264,7 +5295,7 @@ ) ) ) - (func $~lib/array/Array>#sort (; 81 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#sort (; 87 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5355,7 +5386,7 @@ (get_local $1) ) ) - (func $std/array/assertSorted> (; 82 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted> (; 88 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -5377,14 +5408,14 @@ ) ) ) - (func $std/array/Proxy#constructor (; 83 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/Proxy#constructor (; 89 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) ) (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) @@ -5393,7 +5424,7 @@ ) (get_local $0) ) - (func $std/array/createReverseOrderedElementsArray (; 84 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedElementsArray (; 90 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (call $~lib/array/Array#constructor @@ -5441,7 +5472,7 @@ ) (get_local $1) ) - (func $start~anonymous|48 (; 85 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|48 (; 91 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.load (get_local $0) @@ -5451,7 +5482,8 @@ ) ) ) - (func $~lib/memory/compare_memory (; 86 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memcmp (; 92 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -5463,8 +5495,13 @@ ) (loop $continue|0 (if - (if (result i32) - (get_local $2) + (tee_local $3 + (i32.ne + (get_local $2) + (i32.const 0) + ) + ) + (set_local $3 (i32.eq (i32.load8_u (get_local $0) @@ -5473,8 +5510,10 @@ (get_local $1) ) ) - (get_local $2) ) + ) + (if + (get_local $3) (block (set_local $2 (i32.sub @@ -5513,7 +5552,14 @@ ) ) ) - (func $~lib/string/String.__gt (; 87 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.compare (; 93 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (call $~lib/memory/memcmp + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/string/String.__gt (; 94 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -5573,7 +5619,7 @@ ) ) (i32.gt_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -5597,7 +5643,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__lt (; 88 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__lt (; 95 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -5657,7 +5703,7 @@ ) ) (i32.lt_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -5681,7 +5727,7 @@ (i32.const 0) ) ) - (func $start~anonymous|49 (; 89 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|49 (; 96 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/string/String.__gt (get_local $0) @@ -5693,7 +5739,7 @@ ) ) ) - (func $~lib/string/String.__eq (; 90 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 97 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eq @@ -5740,7 +5786,7 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -5756,7 +5802,7 @@ ) ) ) - (func $~lib/string/String.__ne (; 91 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__ne (; 98 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.eqz (call $~lib/string/String.__eq (get_local $0) @@ -5764,7 +5810,7 @@ ) ) ) - (func $std/array/isArraysEqual (; 92 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/array/isArraysEqual (; 99 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -5827,7 +5873,7 @@ ) (i32.const 1) ) - (func $~lib/internal/string/allocate (; 93 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/string/allocate (; 100 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (tee_local $1 @@ -5859,7 +5905,7 @@ ) (i32.store (tee_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.add (i32.shl (get_local $0) @@ -5873,7 +5919,7 @@ ) (get_local $1) ) - (func $~lib/string/String#charAt (; 94 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#charAt (; 101 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -5918,11 +5964,10 @@ ) (get_local $2) ) - (func $~lib/string/String#concat (; 95 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#concat (; 102 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) - (local $5 i32) (if (i32.eqz (get_local $0) @@ -5966,16 +6011,14 @@ (i32.const 544) ) ) - (call $~lib/memory/move_memory - (tee_local $5 - (i32.add - (tee_local $2 - (call $~lib/internal/string/allocate - (get_local $2) - ) + (call $~lib/memory/memory.copy + (i32.add + (tee_local $2 + (call $~lib/internal/string/allocate + (get_local $2) ) - (i32.const 4) ) + (i32.const 4) ) (i32.add (get_local $0) @@ -5988,9 +6031,12 @@ ) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add - (get_local $5) + (i32.add + (get_local $2) + (i32.const 4) + ) (get_local $0) ) (i32.add @@ -6004,7 +6050,7 @@ ) (get_local $2) ) - (func $~lib/string/String.__concat (; 96 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__concat (; 103 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) @@ -6018,7 +6064,7 @@ (get_local $1) ) ) - (func $std/array/createRandomString (; 97 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomString (; 104 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -6063,7 +6109,7 @@ ) (get_local $1) ) - (func $std/array/createRandomStringArray (; 98 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomStringArray (; 105 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (call $~lib/array/Array#constructor @@ -6107,15 +6153,9 @@ ) (get_local $1) ) - (func $start (; 99 ;) (type $v) + (func $start (; 106 ;) (type $v) (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 792) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index 584853b4..81c42a41 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -2,6 +2,7 @@ (type $iii (func (param i32 i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iiiv (func (param i32 i32 i32))) (type $iiii (func (param i32 i32 i32) (result i32))) (type $iiv (func (param i32 i32))) @@ -93,7 +94,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -101,7 +102,15 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 3 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 4 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -114,7 +123,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -128,16 +137,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -182,14 +191,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -209,13 +218,20 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 6 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/internal/arraybuffer/allocUnsafe (; 7 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.eqz (i32.le_u (get_local $0) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) ) (block @@ -229,7 +245,7 @@ ) ) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -241,7 +257,7 @@ ) (get_local $1) ) - (func $~lib/memory/set_memory (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -593,7 +609,14 @@ ) ) ) - (func $~lib/array/Array#constructor (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.fill (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/array/Array#constructor (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -631,7 +654,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -654,22 +677,22 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) ) (get_local $0) ) - (func $~lib/array/Array#get:length (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 11 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $std/array/internalCapacity (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/internalCapacity (; 12 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (i32.load @@ -683,7 +706,7 @@ (i32.const 2) ) ) - (func $~lib/memory/copy_memory (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memcpy (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2485,7 +2508,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.eq @@ -2515,7 +2538,7 @@ ) ) (block - (call $~lib/memory/copy_memory + (call $~lib/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2803,7 +2826,14 @@ ) ) ) - (func $~lib/internal/arraybuffer/reallocUnsafe (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.copy (; 15 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memmove + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/internal/arraybuffer/reallocUnsafe (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (set_local $2 @@ -2821,7 +2851,7 @@ (i32.eqz (i32.le_s (get_local $1) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) ) (block @@ -2841,7 +2871,7 @@ (call $~lib/internal/arraybuffer/computeSize (get_local $2) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block @@ -2849,11 +2879,11 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (get_local $2) ) @@ -2870,22 +2900,22 @@ (get_local $1) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (get_local $2) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (get_local $2) ) @@ -2933,7 +2963,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#push (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#push (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3016,7 +3046,7 @@ ) (get_local $5) ) - (func $~lib/array/Array#__get (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__get (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -3047,7 +3077,7 @@ (unreachable) ) ) - (func $~lib/array/Array#pop (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#pop (; 19 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -3104,7 +3134,7 @@ ) (get_local $4) ) - (func $~lib/array/Array#unshift (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#unshift (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3178,17 +3208,17 @@ ) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add (i32.add (get_local $2) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 4) ) (i32.add (get_local $2) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.shl (i32.sub @@ -3219,7 +3249,7 @@ ) (get_local $5) ) - (func $~lib/array/Array#shift (; 16 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#shift (; 21 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -3272,15 +3302,15 @@ (i32.const 1) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add (get_local $2) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.add (i32.add (get_local $2) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 4) ) @@ -3310,7 +3340,7 @@ ) (get_local $4) ) - (func $~lib/array/Array#reverse (; 17 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#reverse (; 22 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -3415,7 +3445,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#indexOf (; 18 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#indexOf (; 23 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3513,7 +3543,7 @@ ) (i32.const -1) ) - (func $~lib/array/Array#includes (; 19 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#includes (; 24 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3611,7 +3641,7 @@ ) (i32.const 0) ) - (func $~lib/array/Array#splice (; 20 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#splice (; 25 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3680,11 +3710,11 @@ (get_local $0) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add (i32.add (get_local $6) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.shl (get_local $1) @@ -3694,7 +3724,7 @@ (i32.add (i32.add (get_local $6) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.shl (i32.add @@ -3717,7 +3747,7 @@ ) ) ) - (func $~lib/array/Array#__set (; 21 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__set (; 26 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -3792,13 +3822,13 @@ ) ) ) - (func $start~anonymous|0 (; 22 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|0 (; 27 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.eq (get_local $0) (i32.const 0) ) ) - (func $~lib/array/Array#findIndex (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#findIndex (; 28 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3879,19 +3909,19 @@ ) (i32.const -1) ) - (func $start~anonymous|1 (; 24 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|1 (; 29 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.eq (get_local $0) (i32.const 1) ) ) - (func $start~anonymous|2 (; 25 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|2 (; 30 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.eq (get_local $0) (i32.const 100) ) ) - (func $start~anonymous|3 (; 26 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|3 (; 31 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3903,13 +3933,13 @@ (i32.const 100) ) ) - (func $start~anonymous|4 (; 27 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|4 (; 32 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.eq (get_local $0) (i32.const 100) ) ) - (func $start~anonymous|5 (; 28 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|5 (; 33 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3920,13 +3950,13 @@ (i32.const 100) ) ) - (func $start~anonymous|6 (; 29 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|6 (; 34 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ge_s (get_local $0) (i32.const 0) ) ) - (func $~lib/array/Array#every (; 30 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#every (; 35 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4009,13 +4039,13 @@ ) (i32.const 1) ) - (func $start~anonymous|7 (; 31 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|7 (; 36 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.le_s (get_local $0) (i32.const 0) ) ) - (func $start~anonymous|8 (; 32 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|8 (; 37 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -4027,13 +4057,13 @@ (i32.const 10) ) ) - (func $start~anonymous|9 (; 33 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|9 (; 38 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.lt_s (get_local $0) (i32.const 10) ) ) - (func $start~anonymous|10 (; 34 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|10 (; 39 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -4044,13 +4074,13 @@ (i32.const 3) ) ) - (func $start~anonymous|11 (; 35 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|11 (; 40 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ge_s (get_local $0) (i32.const 3) ) ) - (func $~lib/array/Array#some (; 36 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#some (; 41 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4131,13 +4161,13 @@ ) (i32.const 0) ) - (func $start~anonymous|12 (; 37 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|12 (; 42 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.le_s (get_local $0) (i32.const -1) ) ) - (func $start~anonymous|13 (; 38 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|13 (; 43 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -4149,13 +4179,13 @@ (i32.const 10) ) ) - (func $start~anonymous|14 (; 39 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|14 (; 44 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.gt_s (get_local $0) (i32.const 10) ) ) - (func $start~anonymous|15 (; 40 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|15 (; 45 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -4166,7 +4196,7 @@ (i32.const 3) ) ) - (func $start~anonymous|16 (; 41 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|16 (; 46 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (set_global $std/array/i (i32.add (get_global $std/array/i) @@ -4174,7 +4204,7 @@ ) ) ) - (func $~lib/array/Array#forEach (; 42 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/array/Array#forEach (; 47 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4246,7 +4276,7 @@ ) ) ) - (func $start~anonymous|17 (; 43 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|17 (; 48 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -4260,7 +4290,7 @@ ) ) ) - (func $start~anonymous|18 (; 44 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|18 (; 49 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (set_global $std/array/i (i32.add (get_global $std/array/i) @@ -4268,7 +4298,7 @@ ) ) ) - (func $start~anonymous|19 (; 45 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|19 (; 50 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -4281,12 +4311,12 @@ ) ) ) - (func $start~anonymous|20 (; 46 ;) (type $iiif) (param $0 i32) (param $1 i32) (param $2 i32) (result f32) + (func $start~anonymous|20 (; 51 ;) (type $iiif) (param $0 i32) (param $1 i32) (param $2 i32) (result f32) (f32.convert_s/i32 (get_local $0) ) ) - (func $~lib/array/Array#constructor (; 47 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#constructor (; 52 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4324,7 +4354,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -4347,17 +4377,17 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) ) (get_local $0) ) - (func $~lib/array/Array#map (; 48 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#map (; 53 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4456,12 +4486,12 @@ ) (get_local $4) ) - (func $~lib/array/Array#get:length (; 49 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 54 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $~lib/array/Array#__get (; 50 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) + (func $~lib/array/Array#__get (; 55 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) (set_local $2 (i32.load @@ -4492,7 +4522,7 @@ (unreachable) ) ) - (func $start~anonymous|21 (; 51 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|21 (; 56 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -4507,7 +4537,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#map (; 52 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#map (; 57 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4605,7 +4635,7 @@ ) (get_local $4) ) - (func $start~anonymous|22 (; 53 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|22 (; 58 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_global $std/array/i (i32.add (get_global $std/array/i) @@ -4614,7 +4644,7 @@ ) (get_local $0) ) - (func $start~anonymous|23 (; 54 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|23 (; 59 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -4628,13 +4658,13 @@ ) (get_local $0) ) - (func $start~anonymous|24 (; 55 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|24 (; 60 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ge_s (get_local $0) (i32.const 2) ) ) - (func $~lib/array/Array#filter (; 56 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#filter (; 61 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4728,7 +4758,7 @@ ) (get_local $4) ) - (func $start~anonymous|25 (; 57 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|25 (; 62 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -4746,7 +4776,7 @@ (i32.const 2) ) ) - (func $start~anonymous|26 (; 58 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|26 (; 63 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_global $std/array/i (i32.add (get_global $std/array/i) @@ -4758,7 +4788,7 @@ (i32.const 2) ) ) - (func $start~anonymous|27 (; 59 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|27 (; 64 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -4775,13 +4805,13 @@ (i32.const 2) ) ) - (func $start~anonymous|28 (; 60 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|28 (; 65 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $~lib/array/Array#reduce (; 61 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#reduce (; 66 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4861,13 +4891,13 @@ ) (get_local $3) ) - (func $start~anonymous|29 (; 62 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|29 (; 67 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $start~anonymous|30 (; 63 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|30 (; 68 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (if (result i32) (i32.and (get_local $0) @@ -4880,7 +4910,7 @@ ) ) ) - (func $~lib/array/Array#reduce (; 64 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#reduce (; 69 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4960,7 +4990,7 @@ ) (get_local $3) ) - (func $start~anonymous|31 (; 65 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|31 (; 70 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (if (result i32) (i32.and (get_local $0) @@ -4973,7 +5003,7 @@ ) ) ) - (func $start~anonymous|32 (; 66 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|32 (; 71 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $3) @@ -4985,13 +5015,13 @@ (get_local $1) ) ) - (func $start~anonymous|33 (; 67 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|33 (; 72 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $start~anonymous|34 (; 68 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|34 (; 73 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $3) @@ -5002,13 +5032,13 @@ (get_local $1) ) ) - (func $start~anonymous|35 (; 69 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|35 (; 74 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $~lib/array/Array#reduceRight (; 70 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#reduceRight (; 75 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -5073,13 +5103,13 @@ ) (get_local $3) ) - (func $start~anonymous|36 (; 71 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|36 (; 76 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $start~anonymous|37 (; 72 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|37 (; 77 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (if (result i32) (i32.and (get_local $0) @@ -5092,7 +5122,7 @@ ) ) ) - (func $~lib/array/Array#reduceRight (; 73 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#reduceRight (; 78 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -5157,7 +5187,7 @@ ) (get_local $3) ) - (func $start~anonymous|38 (; 74 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|38 (; 79 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (if (result i32) (i32.and (get_local $0) @@ -5170,7 +5200,7 @@ ) ) ) - (func $start~anonymous|39 (; 75 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|39 (; 80 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $3) @@ -5182,13 +5212,13 @@ (get_local $1) ) ) - (func $start~anonymous|40 (; 76 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|40 (; 81 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $start~anonymous|41 (; 77 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|41 (; 82 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $3) @@ -5199,7 +5229,7 @@ (get_local $1) ) ) - (func $~lib/math/murmurHash3 (; 78 ;) (type $II) (param $0 i64) (result i64) + (func $~lib/math/murmurHash3 (; 83 ;) (type $II) (param $0 i64) (result i64) (set_local $0 (i64.xor (get_local $0) @@ -5241,7 +5271,7 @@ ) (get_local $0) ) - (func $~lib/math/NativeMath.seedRandom (; 79 ;) (type $Iv) (param $0 i64) + (func $~lib/math/NativeMath.seedRandom (; 84 ;) (type $Iv) (param $0 i64) (if (i64.eqz (get_local $0) @@ -5270,7 +5300,7 @@ ) ) ) - (func $std/array/createReverseOrderedArray (; 80 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedArray (; 85 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -5318,7 +5348,7 @@ ) (get_local $1) ) - (func $~lib/math/NativeMath.random (; 81 ;) (type $F) (result f64) + (func $~lib/math/NativeMath.random (; 86 ;) (type $F) (result f64) (local $0 i64) (local $1 i64) (local $2 i64) @@ -5400,7 +5430,7 @@ (f64.const 1) ) ) - (func $std/array/createRandomOrderedArray (; 82 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomOrderedArray (; 87 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -5449,7 +5479,7 @@ ) (get_local $1) ) - (func $std/array/assertSortedDefault~anonymous|42 (; 83 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/assertSortedDefault~anonymous|42 (; 88 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.gt_s (get_local $0) @@ -5461,7 +5491,7 @@ ) ) ) - (func $~lib/internal/array/insertionSort (; 84 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/insertionSort (; 89 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5617,10 +5647,16 @@ ) (get_local $0) ) - (func $~lib/allocator/arena/free_memory (; 85 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 90 ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/internal/array/weakHeapSort (; 86 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.free (; 91 ;) (type $iv) (param $0 i32) + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + (return) + ) + (func $~lib/internal/array/weakHeapSort (; 92 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5650,11 +5686,11 @@ ) ) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (get_local $3) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (get_local $4) (i32.const 0) (get_local $3) @@ -6102,7 +6138,7 @@ (br $repeat|2) ) ) - (call $~lib/allocator/arena/free_memory + (call $~lib/memory/memory.free (get_local $4) ) (set_local $12 @@ -6169,7 +6205,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#sort (; 87 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort (; 93 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6315,7 +6351,7 @@ ) ) ) - (func $std/array/isSorted (; 88 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted (; 94 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -6376,7 +6412,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted (; 89 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted (; 95 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -6398,7 +6434,7 @@ ) ) ) - (func $std/array/assertSortedDefault (; 90 ;) (type $iv) (param $0 i32) + (func $std/array/assertSortedDefault (; 96 ;) (type $iv) (param $0 i32) (call $std/array/assertSorted (get_local $0) (block $~lib/internal/array/defaultComparator|inlined.0 (result i32) @@ -6406,7 +6442,7 @@ ) ) ) - (func $std/array/isArraysEqual (; 91 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/array/isArraysEqual (; 97 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -6472,31 +6508,31 @@ ) (i32.const 1) ) - (func $start~anonymous|43 (; 92 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|43 (; 98 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $start~anonymous|44 (; 93 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|44 (; 99 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $1) (get_local $0) ) ) - (func $start~anonymous|45 (; 94 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|45 (; 100 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $start~anonymous|46 (; 95 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|46 (; 101 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $1) (get_local $0) ) ) - (func $~lib/array/Array>#constructor (; 96 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#constructor (; 102 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6534,7 +6570,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -6557,22 +6593,22 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) ) (get_local $0) ) - (func $~lib/array/Array>#get:length (; 97 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array>#get:length (; 103 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $~lib/array/Array>#__set (; 98 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array>#__set (; 104 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -6647,7 +6683,7 @@ ) ) ) - (func $~lib/array/Array>#__get (; 99 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#__get (; 105 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -6678,7 +6714,7 @@ (unreachable) ) ) - (func $std/array/createReverseOrderedNestedArray (; 100 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedNestedArray (; 106 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -6739,7 +6775,7 @@ ) (get_local $1) ) - (func $start~anonymous|47 (; 101 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|47 (; 107 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/array/Array#__get (get_local $0) @@ -6751,7 +6787,7 @@ ) ) ) - (func $~lib/internal/array/insertionSort> (; 102 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/insertionSort> (; 108 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6907,7 +6943,7 @@ ) (get_local $0) ) - (func $~lib/array/Array>#sort (; 103 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#sort (; 109 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7043,7 +7079,7 @@ ) ) ) - (func $std/array/isSorted> (; 104 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted> (; 110 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -7104,7 +7140,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted> (; 105 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted> (; 111 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted> @@ -7126,7 +7162,7 @@ ) ) ) - (func $~lib/array/Array>#constructor (; 106 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#constructor (; 112 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7164,7 +7200,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -7187,22 +7223,22 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) ) (get_local $0) ) - (func $~lib/array/Array>#get:length (; 107 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array>#get:length (; 113 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $std/array/Proxy#constructor (; 108 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/Proxy#constructor (; 114 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (tee_local $0 (if (result i32) @@ -7211,7 +7247,7 @@ (tee_local $0 (block (result i32) (set_local $2 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) @@ -7225,7 +7261,7 @@ ) ) ) - (func $~lib/array/Array>#__set (; 109 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array>#__set (; 115 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -7300,7 +7336,7 @@ ) ) ) - (func $std/array/createReverseOrderedElementsArray (; 110 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedElementsArray (; 116 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -7351,7 +7387,7 @@ ) (get_local $1) ) - (func $start~anonymous|48 (; 111 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|48 (; 117 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.load (get_local $0) @@ -7361,7 +7397,7 @@ ) ) ) - (func $~lib/internal/array/insertionSort> (; 112 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/insertionSort> (; 118 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7517,7 +7553,7 @@ ) (get_local $0) ) - (func $~lib/array/Array>#sort (; 113 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#sort (; 119 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7653,7 +7689,7 @@ ) ) ) - (func $~lib/array/Array>#__get (; 114 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#__get (; 120 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -7684,7 +7720,7 @@ (unreachable) ) ) - (func $std/array/isSorted> (; 115 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted> (; 121 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -7745,7 +7781,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted> (; 116 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted> (; 122 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted> @@ -7767,7 +7803,8 @@ ) ) ) - (func $~lib/memory/compare_memory (; 117 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memcmp (; 123 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -7781,7 +7818,12 @@ (loop $continue|0 (if (if (result i32) - (get_local $2) + (tee_local $3 + (i32.ne + (get_local $2) + (i32.const 0) + ) + ) (i32.eq (i32.load8_u (get_local $0) @@ -7790,7 +7832,7 @@ (get_local $1) ) ) - (get_local $2) + (get_local $3) ) (block (block @@ -7831,7 +7873,14 @@ (i32.const 0) ) ) - (func $~lib/string/String.__gt (; 118 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.compare (; 124 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (call $~lib/memory/memcmp + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/string/String.__gt (; 125 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7905,14 +7954,14 @@ ) ) (i32.gt_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $6) @@ -7922,7 +7971,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__lt (; 119 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__lt (; 126 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7996,14 +8045,14 @@ ) ) (i32.lt_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $6) @@ -8013,7 +8062,7 @@ (i32.const 0) ) ) - (func $start~anonymous|49 (; 120 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|49 (; 127 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/string/String.__gt (get_local $0) @@ -8025,12 +8074,12 @@ ) ) ) - (func $~lib/array/Array#get:length (; 121 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 128 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $~lib/internal/array/insertionSort (; 122 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/insertionSort (; 129 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8186,7 +8235,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#sort (; 123 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort (; 130 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8322,7 +8371,7 @@ ) ) ) - (func $~lib/array/Array#__get (; 124 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__get (; 131 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -8353,7 +8402,7 @@ (unreachable) ) ) - (func $std/array/isSorted (; 125 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted (; 132 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -8414,7 +8463,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted (; 126 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted (; 133 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -8436,7 +8485,7 @@ ) ) ) - (func $~lib/string/String.__eq (; 127 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 134 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -8483,14 +8532,14 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $3) @@ -8499,7 +8548,7 @@ ) ) ) - (func $~lib/string/String.__ne (; 128 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__ne (; 135 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.eqz (call $~lib/string/String.__eq (get_local $0) @@ -8507,7 +8556,7 @@ ) ) ) - (func $std/array/isArraysEqual (; 129 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/array/isArraysEqual (; 136 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -8573,7 +8622,7 @@ ) (i32.const 1) ) - (func $~lib/array/Array#constructor (; 130 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#constructor (; 137 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8611,7 +8660,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -8634,17 +8683,17 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) ) (get_local $0) ) - (func $~lib/internal/string/allocate (; 131 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/string/allocate (; 138 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -8658,7 +8707,7 @@ ) (i32.le_s (get_local $0) - (i32.const 536870910) + (get_global $~lib/internal/string/MAX_LENGTH) ) (get_local $1) ) @@ -8674,9 +8723,9 @@ ) ) (set_local $2 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.add - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) (i32.shl (get_local $0) (i32.const 1) @@ -8690,7 +8739,7 @@ ) (get_local $2) ) - (func $~lib/string/String#charAt (; 132 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#charAt (; 139 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -8717,7 +8766,7 @@ ) ) (return - (i32.const 544) + (get_global $~lib/internal/string/EMPTY) ) ) (set_local $2 @@ -8739,7 +8788,7 @@ ) (get_local $2) ) - (func $~lib/string/String#concat (; 133 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#concat (; 140 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8792,7 +8841,7 @@ (i32.const 0) ) (return - (i32.const 544) + (get_global $~lib/internal/string/EMPTY) ) ) (set_local $5 @@ -8800,25 +8849,25 @@ (get_local $4) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add (get_local $5) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $2) (i32.const 1) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add (i32.add (get_local $5) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $2) @@ -8827,7 +8876,7 @@ ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $3) @@ -8836,7 +8885,7 @@ ) (get_local $5) ) - (func $~lib/string/String.__concat (; 134 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__concat (; 141 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) @@ -8850,7 +8899,7 @@ (get_local $1) ) ) - (func $std/array/createRandomString (; 135 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomString (; 142 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 f64) @@ -8874,7 +8923,7 @@ (call $~lib/string/String.__concat (get_local $1) (call $~lib/string/String#charAt - (i32.const 156) + (get_global $std/array/charset) (i32.trunc_s/f64 (block $~lib/math/NativeMath.floor|inlined.0 (result f64) (set_local $3 @@ -8882,7 +8931,7 @@ (call $~lib/math/NativeMath.random) (f64.convert_s/i32 (i32.load - (i32.const 156) + (get_global $std/array/charset) ) ) ) @@ -8906,7 +8955,7 @@ ) (get_local $1) ) - (func $~lib/array/Array#__set (; 136 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__set (; 143 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -8981,7 +9030,7 @@ ) ) ) - (func $std/array/createRandomStringArray (; 137 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomStringArray (; 144 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -9028,7 +9077,7 @@ ) (get_local $1) ) - (func $start~anonymous|50 (; 138 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|50 (; 145 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/string/String.__gt (get_local $0) @@ -9040,15 +9089,15 @@ ) ) ) - (func $start (; 139 ;) (type $v) + (func $start (; 146 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add (get_global $HEAP_BASE) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) diff --git a/tests/compiler/std/arraybuffer.optimized.wat b/tests/compiler/std/arraybuffer.optimized.wat index b3a315bb..be174a73 100644 --- a/tests/compiler/std/arraybuffer.optimized.wat +++ b/tests/compiler/std/arraybuffer.optimized.wat @@ -2,6 +2,7 @@ (type $iiii (func (param i32 i32 i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iiiv (func (param i32 i32 i32))) (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) @@ -10,7 +11,6 @@ (global $std/arraybuffer/buffer (mut i32) (i32.const 0)) (global $~argc (mut i32) (i32.const 0)) (global $std/arraybuffer/sliced (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 152)) (memory $0 1) (data (i32.const 8) "\13\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (data (i32.const 52) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") @@ -31,7 +31,15 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 2 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 3 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -63,14 +71,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -98,7 +106,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -117,7 +125,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/internal/arraybuffer/allocUnsafe (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -136,7 +149,7 @@ ) (i32.store (tee_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -146,7 +159,7 @@ ) (get_local $1) ) - (func $~lib/memory/set_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -476,7 +489,14 @@ ) ) ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.fill (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u @@ -505,7 +525,7 @@ (i32.const 1) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) (i32.const 8) @@ -516,7 +536,7 @@ ) (get_local $3) ) - (func $~lib/memory/copy_memory (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memcpy (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1902,7 +1922,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -1937,7 +1957,7 @@ (if (get_local $3) (block - (call $~lib/memory/copy_memory + (call $~lib/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2194,7 +2214,14 @@ ) ) ) - (func $~lib/arraybuffer/ArrayBuffer#slice (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.copy (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memmove + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/arraybuffer/ArrayBuffer#slice (; 13 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $4 @@ -2233,7 +2260,7 @@ ) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add (tee_local $2 (call $~lib/internal/arraybuffer/allocUnsafe @@ -2297,12 +2324,12 @@ ) (get_local $2) ) - (func $~lib/arraybuffer/ArrayBuffer#slice|trampoline (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/arraybuffer/ArrayBuffer#slice|trampoline (; 14 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $2of2 (block $1of2 (block $0of2 - (block $oob - (br_table $0of2 $1of2 $2of2 $oob + (block $outOfRange + (br_table $0of2 $1of2 $2of2 $outOfRange (get_global $~argc) ) ) @@ -2322,15 +2349,9 @@ (get_local $2) ) ) - (func $start (; 10 ;) (type $v) + (func $start (; 15 ;) (type $v) (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 152) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) diff --git a/tests/compiler/std/arraybuffer.untouched.wat b/tests/compiler/std/arraybuffer.untouched.wat index f91b3061..f8bf6103 100644 --- a/tests/compiler/std/arraybuffer.untouched.wat +++ b/tests/compiler/std/arraybuffer.untouched.wat @@ -2,6 +2,7 @@ (type $iiii (func (param i32 i32 i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iiiv (func (param i32 i32 i32))) (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) @@ -32,7 +33,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -40,7 +41,15 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 2 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 3 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -53,7 +62,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -67,16 +76,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -121,14 +130,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -148,13 +157,20 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/internal/arraybuffer/allocUnsafe (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.eqz (i32.le_u (get_local $0) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) ) (block @@ -168,7 +184,7 @@ ) ) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -180,7 +196,7 @@ ) (get_local $1) ) - (func $~lib/memory/set_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -532,12 +548,19 @@ ) ) ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.fill (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u (get_local $1) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) (block (call $~lib/env/abort @@ -561,10 +584,10 @@ (i32.const 1) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $1) @@ -572,7 +595,7 @@ ) (get_local $3) ) - (func $~lib/memory/copy_memory (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memcpy (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2374,7 +2397,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.eq @@ -2404,7 +2427,7 @@ ) ) (block - (call $~lib/memory/copy_memory + (call $~lib/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2692,7 +2715,14 @@ ) ) ) - (func $~lib/arraybuffer/ArrayBuffer#slice (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.copy (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memmove + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/arraybuffer/ArrayBuffer#slice (; 13 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2799,15 +2829,15 @@ (get_local $6) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add (get_local $7) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.add (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (get_local $1) ) @@ -2815,12 +2845,12 @@ ) (get_local $7) ) - (func $~lib/arraybuffer/ArrayBuffer#slice|trampoline (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/arraybuffer/ArrayBuffer#slice|trampoline (; 14 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $2of2 (block $1of2 (block $0of2 - (block $oob - (br_table $0of2 $1of2 $2of2 $oob + (block $outOfRange + (br_table $0of2 $1of2 $2of2 $outOfRange (get_global $~argc) ) ) @@ -2831,7 +2861,7 @@ ) ) (set_local $2 - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) ) (call $~lib/arraybuffer/ArrayBuffer#slice @@ -2840,15 +2870,15 @@ (get_local $2) ) ) - (func $start (; 10 ;) (type $v) + (func $start (; 15 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add (get_global $HEAP_BASE) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) diff --git a/tests/compiler/std/constructor.optimized.wat b/tests/compiler/std/constructor.optimized.wat index ad64639d..6093c75c 100644 --- a/tests/compiler/std/constructor.optimized.wat +++ b/tests/compiler/std/constructor.optimized.wat @@ -1,5 +1,6 @@ (module (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $v (func)) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) @@ -14,11 +15,18 @@ (global $std/constructor/ctorConditionallyReturns (mut i32) (i32.const 0)) (global $std/constructor/ctorAllocates (mut i32) (i32.const 0)) (global $std/constructor/ctorConditionallyAllocates (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 0 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 1 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -50,14 +58,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -85,7 +93,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -104,23 +112,28 @@ ) (i32.const 0) ) - (func $std/constructor/EmptyCtor#constructor (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $std/constructor/EmptyCtor#constructor (; 4 ;) (type $ii) (param $0 i32) (result i32) (if (result i32) (get_local $0) (get_local $0) - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 0) ) ) ) - (func $std/constructor/EmptyCtorWithFieldInit#constructor (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/EmptyCtorWithFieldInit#constructor (; 5 ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) ) (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) @@ -129,14 +142,14 @@ ) (get_local $0) ) - (func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) ) (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) @@ -145,16 +158,16 @@ ) (get_local $0) ) - (func $std/constructor/CtorReturns#constructor (; 4 ;) (type $ii) (param $0 i32) (result i32) - (call $~lib/allocator/arena/allocate_memory + (func $std/constructor/CtorReturns#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/memory/memory.allocate (i32.const 0) ) ) - (func $std/constructor/CtorConditionallyReturns#constructor (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/CtorConditionallyReturns#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32) (if (get_global $std/constructor/b) (return - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 0) ) ) @@ -162,12 +175,12 @@ (if (result i32) (get_local $0) (get_local $0) - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 0) ) ) ) - (func $std/constructor/CtorConditionallyAllocates#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/CtorConditionallyAllocates#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32) (if (get_global $std/constructor/b) (if @@ -175,7 +188,7 @@ (get_local $0) ) (set_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 0) ) ) @@ -186,23 +199,17 @@ (get_local $0) ) (set_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 0) ) ) ) (get_local $0) ) - (func $start (; 7 ;) (type $v) + (func $start (; 10 ;) (type $v) (local $0 i32) (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 8) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) @@ -223,13 +230,13 @@ ) ) (set_global $std/constructor/none - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 0) ) ) (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) @@ -240,7 +247,7 @@ ) (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) diff --git a/tests/compiler/std/constructor.ts b/tests/compiler/std/constructor.ts index ddde43a2..c039c677 100644 --- a/tests/compiler/std/constructor.ts +++ b/tests/compiler/std/constructor.ts @@ -46,7 +46,7 @@ var justFieldNoInit = new JustFieldNoInit(); // explicit allocation with no extra checks class CtorReturns { constructor() { - return changetype(allocate_memory(0)); + return changetype(memory.allocate(0)); } } @@ -58,7 +58,7 @@ var b: bool = true; class CtorConditionallyReturns { constructor() { if (b) { - return changetype(allocate_memory(0)); + return changetype(memory.allocate(0)); } } } diff --git a/tests/compiler/std/constructor.untouched.wat b/tests/compiler/std/constructor.untouched.wat index 97f1e516..e78d598c 100644 --- a/tests/compiler/std/constructor.untouched.wat +++ b/tests/compiler/std/constructor.untouched.wat @@ -1,5 +1,6 @@ (module (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $v (func)) (global $~lib/internal/allocator/AL_BITS i32 (i32.const 3)) (global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8)) @@ -22,7 +23,15 @@ (memory $0 0) (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 0 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 1 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -35,7 +44,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -49,16 +58,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -103,14 +112,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -130,7 +139,14 @@ ) (i32.const 0) ) - (func $std/constructor/EmptyCtor#constructor (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $std/constructor/EmptyCtor#constructor (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (tee_local $0 (if (result i32) @@ -139,7 +155,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 0) ) ) @@ -149,7 +165,7 @@ ) ) ) - (func $std/constructor/EmptyCtorWithFieldInit#constructor (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/EmptyCtorWithFieldInit#constructor (; 5 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (tee_local $0 (if (result i32) @@ -158,7 +174,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) @@ -172,7 +188,7 @@ ) ) ) - (func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (tee_local $0 (if (result i32) @@ -181,7 +197,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) @@ -195,17 +211,17 @@ ) ) ) - (func $std/constructor/CtorReturns#constructor (; 4 ;) (type $ii) (param $0 i32) (result i32) - (call $~lib/allocator/arena/allocate_memory + (func $std/constructor/CtorReturns#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/memory/memory.allocate (i32.const 0) ) ) - (func $std/constructor/CtorConditionallyReturns#constructor (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/CtorConditionallyReturns#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (get_global $std/constructor/b) (return - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 0) ) ) @@ -217,7 +233,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 0) ) ) @@ -227,7 +243,7 @@ ) ) ) - (func $std/constructor/CtorAllocates#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/CtorAllocates#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (drop (tee_local $0 @@ -237,7 +253,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 0) ) ) @@ -249,7 +265,7 @@ ) (get_local $0) ) - (func $std/constructor/CtorConditionallyAllocates#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/CtorConditionallyAllocates#constructor (; 10 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (get_global $std/constructor/b) @@ -261,7 +277,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 0) ) ) @@ -279,7 +295,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 0) ) ) @@ -289,16 +305,16 @@ ) ) ) - (func $start (; 8 ;) (type $v) + (func $start (; 11 ;) (type $v) (local $0 i32) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add (get_global $HEAP_BASE) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) @@ -324,7 +340,7 @@ (set_global $std/constructor/none (block (result i32) (set_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 0) ) ) @@ -334,7 +350,7 @@ (set_global $std/constructor/justFieldInit (block (result i32) (set_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) @@ -348,7 +364,7 @@ (set_global $std/constructor/justFieldNoInit (block (result i32) (set_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) diff --git a/tests/compiler/std/gc-integration.optimized.wat b/tests/compiler/std/gc-integration.optimized.wat new file mode 100644 index 00000000..93881603 --- /dev/null +++ b/tests/compiler/std/gc-integration.optimized.wat @@ -0,0 +1,76 @@ +(module + (type $iv (func (param i32))) + (type $iiiiv (func (param i32 i32 i32 i32))) + (type $v (func)) + (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) + (global $std/gc-integration/B.d (mut i32) (i32.const 16)) + (global $std/gc-integration/a_ref (mut i32) (i32.const 24)) + (global $std/gc-integration/b_ref (mut i32) (i32.const 32)) + (global $std/gc-integration/i (mut i32) (i32.const 0)) + (table 1 1 anyfunc) + (elem (i32.const 0) $start~anonymous|0) + (memory $0 1) + (data (i32.const 8) "\15\00\00\00s\00t\00d\00/\00g\00c\00-\00i\00n\00t\00e\00g\00r\00a\00t\00i\00o\00n\00.\00t\00s") + (export "memory" (memory $0)) + (export "table" (table $0)) + (start $start) + (func $start~anonymous|0 (; 1 ;) (type $iv) (param $0 i32) + (set_global $std/gc-integration/i + (i32.add + (get_global $std/gc-integration/i) + (i32.const 1) + ) + ) + (if + (i32.ne + (get_local $0) + (i32.shl + (get_global $std/gc-integration/i) + (i32.const 3) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 14) + (i32.const 43) + ) + (unreachable) + ) + ) + ) + (func $start (; 2 ;) (type $v) + (call_indirect (type $iv) + (i32.const 8) + (i32.const 0) + ) + (call_indirect (type $iv) + (get_global $std/gc-integration/B.d) + (i32.const 0) + ) + (call_indirect (type $iv) + (get_global $std/gc-integration/a_ref) + (i32.const 0) + ) + (call_indirect (type $iv) + (get_global $std/gc-integration/b_ref) + (i32.const 0) + ) + (if + (i32.ne + (get_global $std/gc-integration/i) + (i32.const 4) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 15) + (i32.const 0) + ) + (unreachable) + ) + ) + ) +) diff --git a/tests/compiler/std/gc-integration.ts b/tests/compiler/std/gc-integration.ts new file mode 100644 index 00000000..9dd6095b --- /dev/null +++ b/tests/compiler/std/gc-integration.ts @@ -0,0 +1,15 @@ +class A {} +class B { + static readonly c: B = changetype(8); + static d: A = changetype(16); +} +B.c; +B.d; + +var no_ref: usize = 64; +var a_ref: A | null = changetype(24); +var b_ref: B = changetype(32); + +var i: i32 = 0; +__gc_iterate_roots((ref: usize): void => { assert(ref == ++i << 3); }); +assert(i == 4); diff --git a/tests/compiler/std/gc-integration.untouched.wat b/tests/compiler/std/gc-integration.untouched.wat new file mode 100644 index 00000000..12a96718 --- /dev/null +++ b/tests/compiler/std/gc-integration.untouched.wat @@ -0,0 +1,93 @@ +(module + (type $iv (func (param i32))) + (type $iiiiv (func (param i32 i32 i32 i32))) + (type $v (func)) + (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) + (global $std/gc-integration/B.c i32 (i32.const 8)) + (global $std/gc-integration/B.d (mut i32) (i32.const 16)) + (global $std/gc-integration/no_ref (mut i32) (i32.const 64)) + (global $std/gc-integration/a_ref (mut i32) (i32.const 24)) + (global $std/gc-integration/b_ref (mut i32) (i32.const 32)) + (global $std/gc-integration/i (mut i32) (i32.const 0)) + (global $HEAP_BASE i32 (i32.const 56)) + (table 1 1 anyfunc) + (elem (i32.const 0) $start~anonymous|0) + (memory $0 1) + (data (i32.const 8) "\15\00\00\00s\00t\00d\00/\00g\00c\00-\00i\00n\00t\00e\00g\00r\00a\00t\00i\00o\00n\00.\00t\00s\00") + (export "memory" (memory $0)) + (export "table" (table $0)) + (start $start) + (func $start~anonymous|0 (; 1 ;) (type $iv) (param $0 i32) + (if + (i32.eqz + (i32.eq + (get_local $0) + (i32.shl + (block (result i32) + (set_global $std/gc-integration/i + (i32.add + (get_global $std/gc-integration/i) + (i32.const 1) + ) + ) + (get_global $std/gc-integration/i) + ) + (i32.const 3) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 14) + (i32.const 43) + ) + (unreachable) + ) + ) + ) + (func $start (; 2 ;) (type $v) + (drop + (get_global $std/gc-integration/B.c) + ) + (drop + (get_global $std/gc-integration/B.d) + ) + (block + (call_indirect (type $iv) + (get_global $std/gc-integration/B.c) + (i32.const 0) + ) + (call_indirect (type $iv) + (get_global $std/gc-integration/B.d) + (i32.const 0) + ) + (call_indirect (type $iv) + (get_global $std/gc-integration/a_ref) + (i32.const 0) + ) + (call_indirect (type $iv) + (get_global $std/gc-integration/b_ref) + (i32.const 0) + ) + ) + (if + (i32.eqz + (i32.eq + (get_global $std/gc-integration/i) + (i32.const 4) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 15) + (i32.const 0) + ) + (unreachable) + ) + ) + ) +) diff --git a/tests/compiler/std/gc.optimized.wat b/tests/compiler/std/gc.optimized.wat new file mode 100644 index 00000000..8bf08b20 --- /dev/null +++ b/tests/compiler/std/gc.optimized.wat @@ -0,0 +1,319 @@ +(module + (type $iv (func (param i32))) + (type $iii (func (param i32 i32) (result i32))) + (type $iiiiv (func (param i32 i32 i32 i32))) + (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) + (type $iiv (func (param i32 i32))) + (type $v (func)) + (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) + (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) + (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/state (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/set1 (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/Flags.WHITE (mut i32) (i32.const 0)) + (global $std/gc/obj (mut i32) (i32.const 0)) + (global $std/gc/head (mut i32) (i32.const 0)) + (table 1 1 anyfunc) + (elem (i32.const 0) $std/gc/MyObject_visit) + (memory $0 1) + (data (i32.const 8) "\16\00\00\00~\00l\00i\00b\00/\00c\00o\00l\00l\00e\00c\00t\00o\00r\00/\00i\00t\00c\00m\00.\00t\00s") + (data (i32.const 56) "\t\00\00\00s\00t\00d\00/\00g\00c\00.\00t\00s") + (export "memory" (memory $0)) + (export "table" (table $0)) + (start $start) + (func $std/gc/MyObject_visit (; 1 ;) (type $iv) (param $0 i32) + (nop) + ) + (func $~lib/memory/memory.size (; 2 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 3 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (if + (get_local $0) + (block + (if + (i32.gt_u + (get_local $0) + (i32.const 1073741824) + ) + (unreachable) + ) + (if + (i32.gt_u + (tee_local $0 + (i32.and + (i32.add + (i32.add + (tee_local $1 + (get_global $~lib/allocator/arena/offset) + ) + (get_local $0) + ) + (i32.const 7) + ) + (i32.const -8) + ) + ) + (i32.shl + (tee_local $2 + (call $~lib/memory/memory.size) + ) + (i32.const 16) + ) + ) + (if + (i32.lt_s + (call $~lib/memory/memory.grow + (select + (get_local $2) + (tee_local $3 + (i32.shr_u + (i32.and + (i32.add + (i32.sub + (get_local $0) + (get_local $1) + ) + (i32.const 65535) + ) + (i32.const -65536) + ) + (i32.const 16) + ) + ) + (i32.gt_s + (get_local $2) + (get_local $3) + ) + ) + ) + (i32.const 0) + ) + (if + (i32.lt_s + (call $~lib/memory/memory.grow + (get_local $3) + ) + (i32.const 0) + ) + (unreachable) + ) + ) + ) + (set_global $~lib/allocator/arena/offset + (get_local $0) + ) + (return + (get_local $1) + ) + ) + ) + (i32.const 0) + ) + (func $~lib/memory/memory.allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/collector/itcm/ManagedObject#makeWhite (; 6 ;) (type $iv) (param $0 i32) + (i32.store + (get_local $0) + (i32.or + (i32.and + (i32.load + (get_local $0) + ) + (i32.const -8) + ) + (get_global $~lib/collector/itcm/Flags.WHITE) + ) + ) + ) + (func $~lib/collector/itcm/ManagedObject#set:next (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store + (get_local $0) + (i32.or + (get_local $1) + (i32.and + (i32.load + (get_local $0) + ) + (i32.const 7) + ) + ) + ) + ) + (func $~lib/collector/itcm/ManagedObject#insert (; 8 ;) (type $iiv) (param $0 i32) (param $1 i32) + (local $2 i32) + (set_local $2 + (i32.load offset=4 + (get_local $0) + ) + ) + (call $~lib/collector/itcm/ManagedObject#set:next + (get_local $1) + (get_local $0) + ) + (i32.store offset=4 + (get_local $1) + (get_local $2) + ) + (call $~lib/collector/itcm/ManagedObject#set:next + (get_local $2) + (get_local $1) + ) + (i32.store offset=4 + (get_local $0) + (get_local $1) + ) + ) + (func $~lib/collector/itcm/gc.alloc (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (if + (i32.gt_u + (get_local $0) + (i32.const 1073741808) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 214) + (i32.const 4) + ) + (unreachable) + ) + ) + (call $~lib/collector/itcm/ManagedObject#makeWhite + (tee_local $2 + (call $~lib/memory/memory.allocate + (i32.add + (get_local $0) + (i32.const 16) + ) + ) + ) + ) + (i32.store offset=8 + (get_local $2) + (get_local $1) + ) + (call $~lib/collector/itcm/ManagedObject#insert + (get_global $~lib/collector/itcm/set1) + (get_local $2) + ) + (i32.add + (get_local $2) + (i32.const 16) + ) + ) + (func $start (; 10 ;) (type $v) + (set_global $~lib/allocator/arena/startOffset + (i32.const 80) + ) + (set_global $~lib/allocator/arena/offset + (get_global $~lib/allocator/arena/startOffset) + ) + (set_global $~lib/collector/itcm/state + (i32.const 0) + ) + (set_global $std/gc/obj + (call $~lib/collector/itcm/gc.alloc + (i32.const 4) + (i32.const 0) + ) + ) + (i32.store + (get_global $std/gc/obj) + (i32.const 123) + ) + (set_global $std/gc/head + (i32.sub + (get_global $std/gc/obj) + (i32.const 16) + ) + ) + (if + (i32.load + (get_global $std/gc/head) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 56) + (i32.const 16) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.load offset=4 + (get_global $std/gc/head) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 56) + (i32.const 17) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.load offset=8 + (get_global $std/gc/head) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 56) + (i32.const 18) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.load offset=12 + (get_global $std/gc/head) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 56) + (i32.const 19) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.ne + (i32.load offset=16 + (get_global $std/gc/head) + ) + (i32.const 123) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 56) + (i32.const 21) + (i32.const 0) + ) + (unreachable) + ) + ) + ) +) diff --git a/tests/compiler/std/gc.ts b/tests/compiler/std/gc.ts new file mode 100644 index 00000000..4d0a5778 --- /dev/null +++ b/tests/compiler/std/gc.ts @@ -0,0 +1,23 @@ +import "allocator/arena"; +import { gc } from "collector/itcm"; + +// a class to test with +class MyObject { + a: u32; +} +function MyObject_visit(ref: usize): void { } + +// allocate a managed instance +var obj = changetype(gc.alloc(offsetof(), MyObject_visit)); +obj.a = 123; +var head = changetype(obj) - 16; + +// header +assert(load(head, 0) == 0); // nextWithFlags +assert(load(head, 4) == 0); // prev +assert(load(head, 8) == changetype(MyObject_visit)); // visitFn +assert(load(head, 12) == 0); // unused +// contents +assert(load(head, 16) == 123); // Obj#a + +// gc.collect(); // FIXME: endless loop diff --git a/tests/compiler/std/gc.untouched.wat b/tests/compiler/std/gc.untouched.wat new file mode 100644 index 00000000..d118f8f2 --- /dev/null +++ b/tests/compiler/std/gc.untouched.wat @@ -0,0 +1,398 @@ +(module + (type $iv (func (param i32))) + (type $iii (func (param i32 i32) (result i32))) + (type $iiiiv (func (param i32 i32 i32 i32))) + (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) + (type $iiv (func (param i32 i32))) + (type $v (func)) + (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) + (global $~lib/internal/allocator/AL_BITS i32 (i32.const 3)) + (global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8)) + (global $~lib/internal/allocator/AL_MASK i32 (i32.const 7)) + (global $~lib/internal/allocator/MAX_SIZE_32 i32 (i32.const 1073741824)) + (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) + (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) + (global $NaN f64 (f64.const nan:0x8000000000000)) + (global $Infinity f64 (f64.const inf)) + (global $~lib/collector/itcm/State.INIT i32 (i32.const 0)) + (global $~lib/collector/itcm/State.IDLE i32 (i32.const 1)) + (global $~lib/collector/itcm/State.MARK i32 (i32.const 2)) + (global $~lib/collector/itcm/State.SWEEP i32 (i32.const 3)) + (global $~lib/collector/itcm/state (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/set1 (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/set2 (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/iter (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/ManagedObject.SIZE i32 (i32.const 16)) + (global $~lib/collector/itcm/Flags.MASK i32 (i32.const 7)) + (global $~lib/collector/itcm/Flags.WHITE (mut i32) (i32.const 0)) + (global $std/gc/obj (mut i32) (i32.const 0)) + (global $std/gc/head (mut i32) (i32.const 0)) + (global $HEAP_BASE i32 (i32.const 80)) + (table 1 1 anyfunc) + (elem (i32.const 0) $std/gc/MyObject_visit) + (memory $0 1) + (data (i32.const 8) "\16\00\00\00~\00l\00i\00b\00/\00c\00o\00l\00l\00e\00c\00t\00o\00r\00/\00i\00t\00c\00m\00.\00t\00s\00") + (data (i32.const 56) "\t\00\00\00s\00t\00d\00/\00g\00c\00.\00t\00s\00") + (export "memory" (memory $0)) + (export "table" (table $0)) + (start $start) + (func $std/gc/MyObject_visit (; 1 ;) (type $iv) (param $0 i32) + (nop) + ) + (func $~lib/memory/memory.size (; 2 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 3 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (if + (get_local $0) + (block + (if + (i32.gt_u + (get_local $0) + (get_global $~lib/internal/allocator/MAX_SIZE_32) + ) + (unreachable) + ) + (set_local $1 + (get_global $~lib/allocator/arena/offset) + ) + (set_local $2 + (i32.and + (i32.add + (i32.add + (get_local $1) + (get_local $0) + ) + (get_global $~lib/internal/allocator/AL_MASK) + ) + (i32.xor + (get_global $~lib/internal/allocator/AL_MASK) + (i32.const -1) + ) + ) + ) + (set_local $3 + (call $~lib/memory/memory.size) + ) + (if + (i32.gt_u + (get_local $2) + (i32.shl + (get_local $3) + (i32.const 16) + ) + ) + (block + (set_local $4 + (i32.shr_u + (i32.and + (i32.add + (i32.sub + (get_local $2) + (get_local $1) + ) + (i32.const 65535) + ) + (i32.xor + (i32.const 65535) + (i32.const -1) + ) + ) + (i32.const 16) + ) + ) + (set_local $5 + (select + (tee_local $5 + (get_local $3) + ) + (tee_local $6 + (get_local $4) + ) + (i32.gt_s + (get_local $5) + (get_local $6) + ) + ) + ) + (if + (i32.lt_s + (call $~lib/memory/memory.grow + (get_local $5) + ) + (i32.const 0) + ) + (if + (i32.lt_s + (call $~lib/memory/memory.grow + (get_local $4) + ) + (i32.const 0) + ) + (unreachable) + ) + ) + ) + ) + (set_global $~lib/allocator/arena/offset + (get_local $2) + ) + (return + (get_local $1) + ) + ) + ) + (i32.const 0) + ) + (func $~lib/memory/memory.allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/collector/itcm/ManagedObject#makeWhite (; 6 ;) (type $iv) (param $0 i32) + (i32.store + (get_local $0) + (i32.or + (i32.and + (i32.load + (get_local $0) + ) + (i32.xor + (get_global $~lib/collector/itcm/Flags.MASK) + (i32.const -1) + ) + ) + (get_global $~lib/collector/itcm/Flags.WHITE) + ) + ) + ) + (func $~lib/collector/itcm/ManagedObject#set:next (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store + (get_local $0) + (i32.or + (get_local $1) + (i32.and + (i32.load + (get_local $0) + ) + (get_global $~lib/collector/itcm/Flags.MASK) + ) + ) + ) + ) + (func $~lib/collector/itcm/ManagedObject#insert (; 8 ;) (type $iiv) (param $0 i32) (param $1 i32) + (local $2 i32) + (set_local $2 + (i32.load offset=4 + (get_local $0) + ) + ) + (call $~lib/collector/itcm/ManagedObject#set:next + (get_local $1) + (get_local $0) + ) + (i32.store offset=4 + (get_local $1) + (get_local $2) + ) + (call $~lib/collector/itcm/ManagedObject#set:next + (get_local $2) + (get_local $1) + ) + (i32.store offset=4 + (get_local $0) + (get_local $1) + ) + ) + (func $~lib/collector/itcm/gc.alloc (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (if + (i32.eqz + (i32.le_u + (get_local $0) + (i32.sub + (get_global $~lib/internal/allocator/MAX_SIZE_32) + (get_global $~lib/collector/itcm/ManagedObject.SIZE) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 214) + (i32.const 4) + ) + (unreachable) + ) + ) + (set_local $2 + (call $~lib/memory/memory.allocate + (i32.add + (get_global $~lib/collector/itcm/ManagedObject.SIZE) + (get_local $0) + ) + ) + ) + (call $~lib/collector/itcm/ManagedObject#makeWhite + (get_local $2) + ) + (i32.store offset=8 + (get_local $2) + (get_local $1) + ) + (call $~lib/collector/itcm/ManagedObject#insert + (get_global $~lib/collector/itcm/set1) + (get_local $2) + ) + (i32.add + (get_local $2) + (get_global $~lib/collector/itcm/ManagedObject.SIZE) + ) + ) + (func $start (; 10 ;) (type $v) + (set_global $~lib/allocator/arena/startOffset + (i32.and + (i32.add + (get_global $HEAP_BASE) + (get_global $~lib/internal/allocator/AL_MASK) + ) + (i32.xor + (get_global $~lib/internal/allocator/AL_MASK) + (i32.const -1) + ) + ) + ) + (set_global $~lib/allocator/arena/offset + (get_global $~lib/allocator/arena/startOffset) + ) + (set_global $~lib/collector/itcm/state + (get_global $~lib/collector/itcm/State.INIT) + ) + (set_global $std/gc/obj + (call $~lib/collector/itcm/gc.alloc + (i32.const 4) + (i32.const 0) + ) + ) + (i32.store + (get_global $std/gc/obj) + (i32.const 123) + ) + (set_global $std/gc/head + (i32.sub + (get_global $std/gc/obj) + (i32.const 16) + ) + ) + (if + (i32.eqz + (i32.eq + (i32.load + (get_global $std/gc/head) + ) + (i32.const 0) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 56) + (i32.const 16) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (i32.load offset=4 + (get_global $std/gc/head) + ) + (i32.const 0) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 56) + (i32.const 17) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (i32.load offset=8 + (get_global $std/gc/head) + ) + (i32.const 0) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 56) + (i32.const 18) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (i32.load offset=12 + (get_global $std/gc/head) + ) + (i32.const 0) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 56) + (i32.const 19) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (i32.load offset=16 + (get_global $std/gc/head) + ) + (i32.const 123) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 56) + (i32.const 21) + (i32.const 0) + ) + (unreachable) + ) + ) + ) +) diff --git a/tests/compiler/std/hash.untouched.wat b/tests/compiler/std/hash.untouched.wat index d9ed3f4e..c09f890d 100644 --- a/tests/compiler/std/hash.untouched.wat +++ b/tests/compiler/std/hash.untouched.wat @@ -26,7 +26,7 @@ (local $2 i32) (local $3 i32) (set_local $1 - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) ) (block $break|0 (block @@ -62,7 +62,7 @@ ) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $2 @@ -82,7 +82,7 @@ (func $~lib/internal/hash/hash32 (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) ) (set_local $1 (i32.mul @@ -93,7 +93,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -108,7 +108,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -123,7 +123,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -135,7 +135,7 @@ (i32.const 24) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (get_local $1) @@ -158,7 +158,7 @@ ) ) (set_local $3 - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) ) (set_local $3 (i32.mul @@ -169,7 +169,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -184,7 +184,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -199,7 +199,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -211,7 +211,7 @@ (i32.const 24) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -223,7 +223,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -238,7 +238,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -253,7 +253,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -265,7 +265,7 @@ (i32.const 24) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (get_local $3) diff --git a/tests/compiler/std/libm.optimized.wat b/tests/compiler/std/libm.optimized.wat index 7dc0ed6d..7f78932e 100644 --- a/tests/compiler/std/libm.optimized.wat +++ b/tests/compiler/std/libm.optimized.wat @@ -13,6 +13,7 @@ (global $std/libm/SQRT1_2 f64 (f64.const 0.7071067811865476)) (global $std/libm/SQRT2 f64 (f64.const 1.4142135623730951)) (memory $0 0) + (export "memory" (memory $0)) (export "E" (global $std/libm/E)) (export "LN10" (global $std/libm/LN10)) (export "LN2" (global $std/libm/LN2)) @@ -55,7 +56,6 @@ (export "tan" (func $std/libm/cos)) (export "tanh" (func $std/libm/tanh)) (export "trunc" (func $std/libm/trunc)) - (export "memory" (memory $0)) (func $std/libm/abs (; 0 ;) (type $FF) (param $0 f64) (result f64) (f64.abs (get_local $0) diff --git a/tests/compiler/std/libm.untouched.wat b/tests/compiler/std/libm.untouched.wat index 229b833b..642e3ab7 100644 --- a/tests/compiler/std/libm.untouched.wat +++ b/tests/compiler/std/libm.untouched.wat @@ -4,17 +4,27 @@ (type $FFF (func (param f64 f64) (result f64))) (type $FiF (func (param f64 i32) (result f64))) (type $Ff (func (param f64) (result f32))) + (global $~lib/math/NativeMath.E f64 (f64.const 2.718281828459045)) (global $std/libm/E f64 (f64.const 2.718281828459045)) + (global $~lib/math/NativeMath.LN10 f64 (f64.const 2.302585092994046)) (global $std/libm/LN10 f64 (f64.const 2.302585092994046)) + (global $~lib/math/NativeMath.LN2 f64 (f64.const 0.6931471805599453)) (global $std/libm/LN2 f64 (f64.const 0.6931471805599453)) + (global $~lib/math/NativeMath.LOG10E f64 (f64.const 0.4342944819032518)) (global $std/libm/LOG10E f64 (f64.const 0.4342944819032518)) + (global $~lib/math/NativeMath.LOG2E f64 (f64.const 1.4426950408889634)) (global $std/libm/LOG2E f64 (f64.const 1.4426950408889634)) + (global $~lib/math/NativeMath.PI f64 (f64.const 3.141592653589793)) (global $std/libm/PI f64 (f64.const 3.141592653589793)) + (global $~lib/math/NativeMath.SQRT1_2 f64 (f64.const 0.7071067811865476)) (global $std/libm/SQRT1_2 f64 (f64.const 0.7071067811865476)) + (global $~lib/math/NativeMath.SQRT2 f64 (f64.const 1.4142135623730951)) (global $std/libm/SQRT2 f64 (f64.const 1.4142135623730951)) (global $NaN f64 (f64.const nan:0x8000000000000)) + (global $f64.EPSILON f64 (f64.const 2.220446049250313e-16)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) + (export "memory" (memory $0)) (export "E" (global $std/libm/E)) (export "LN10" (global $std/libm/LN10)) (export "LN2" (global $std/libm/LN2)) @@ -57,7 +67,6 @@ (export "tan" (func $std/libm/tan)) (export "tanh" (func $std/libm/tanh)) (export "trunc" (func $std/libm/trunc)) - (export "memory" (memory $0)) (func $std/libm/abs (; 0 ;) (type $FF) (param $0 f64) (result f64) (block $~lib/math/NativeMath.abs|inlined.0 (result f64) (f64.abs @@ -2183,12 +2192,12 @@ ) ) (return - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) ) (return (f64.neg - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) ) ) diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index dc882472..5fc7c4be 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -1,6 +1,7 @@ (module (type $v (func)) (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iv (func (param i32))) (type $iiii (func (param i32 i32 i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) @@ -20,14 +21,21 @@ (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 136)) (memory $0 1) (data (i32.const 8) "\13\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (data (i32.const 52) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (data (i32.const 112) "\n\00\00\00s\00t\00d\00/\00m\00a\00p\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 1 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 2 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -59,14 +67,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -94,7 +102,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -113,7 +121,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/computeSize (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/internal/arraybuffer/computeSize (; 5 ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -127,7 +140,7 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocUnsafe (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -146,7 +159,7 @@ ) (i32.store (tee_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -156,7 +169,7 @@ ) (get_local $1) ) - (func $~lib/memory/set_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -486,7 +499,14 @@ ) ) ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.fill (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u @@ -515,7 +535,7 @@ (i32.const 1) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) (i32.const 8) @@ -526,7 +546,7 @@ ) (get_local $3) ) - (func $~lib/map/Map#clear (; 6 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 10 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -560,7 +580,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 11 ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -568,7 +588,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -601,7 +621,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash8 (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash8 (; 12 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (get_local $0) @@ -610,7 +630,7 @@ (i32.const 16777619) ) ) - (func $~lib/map/Map#find (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 13 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -676,7 +696,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -694,7 +714,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 11 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 15 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -857,7 +877,7 @@ ) ) ) - (func $~lib/map/Map#set (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 16 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1000,7 +1020,7 @@ ) ) ) - (func $~lib/map/Map#get (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -1025,12 +1045,12 @@ ) ) ) - (func $~lib/map/Map#get:size (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 18 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -1131,7 +1151,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 16 ;) (type $v) + (func $std/map/test (; 20 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -1617,7 +1637,7 @@ ) ) ) - (func $~lib/map/Map#has (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -1632,7 +1652,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 18 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 22 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1795,7 +1815,7 @@ ) ) ) - (func $~lib/map/Map#set (; 19 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 23 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1935,7 +1955,7 @@ ) ) ) - (func $~lib/map/Map#get (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 24 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -1957,7 +1977,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -2055,7 +2075,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 22 ;) (type $v) + (func $std/map/test (; 26 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -2520,7 +2540,7 @@ ) ) ) - (func $~lib/internal/hash/hash16 (; 23 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash16 (; 27 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -2541,7 +2561,7 @@ (i32.const 16777619) ) ) - (func $~lib/map/Map#find (; 24 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 28 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -2607,7 +2627,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -2625,7 +2645,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 26 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 30 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2788,7 +2808,7 @@ ) ) ) - (func $~lib/map/Map#set (; 27 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 31 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2931,7 +2951,7 @@ ) ) ) - (func $~lib/map/Map#get (; 28 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 32 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -2956,7 +2976,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 33 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -3057,7 +3077,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 30 ;) (type $v) + (func $std/map/test (; 34 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -3543,7 +3563,7 @@ ) ) ) - (func $~lib/map/Map#has (; 31 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 35 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -3558,7 +3578,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 32 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 36 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3721,7 +3741,7 @@ ) ) ) - (func $~lib/map/Map#set (; 33 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 37 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3861,7 +3881,7 @@ ) ) ) - (func $~lib/map/Map#get (; 34 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 38 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -3883,7 +3903,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 35 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 39 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -3981,7 +4001,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 36 ;) (type $v) + (func $std/map/test (; 40 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -4446,7 +4466,7 @@ ) ) ) - (func $~lib/internal/hash/hash32 (; 37 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 41 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -4491,7 +4511,7 @@ (i32.const 16777619) ) ) - (func $~lib/map/Map#find (; 38 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 42 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -4554,7 +4574,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 39 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 43 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -4566,7 +4586,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 40 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 44 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4729,7 +4749,7 @@ ) ) ) - (func $~lib/map/Map#set (; 41 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 45 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4866,7 +4886,7 @@ ) ) ) - (func $~lib/map/Map#get (; 42 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 46 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -4885,7 +4905,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 43 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 47 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -4980,7 +5000,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 44 ;) (type $v) + (func $std/map/test (; 48 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -5424,7 +5444,7 @@ ) ) ) - (func $std/map/test (; 45 ;) (type $v) + (func $std/map/test (; 49 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -5868,7 +5888,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 46 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 50 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -5902,7 +5922,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 47 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 51 ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -5910,7 +5930,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -5943,7 +5963,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash64 (; 48 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash64 (; 52 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (i32.mul (i32.xor @@ -6042,7 +6062,7 @@ (i32.const 16777619) ) ) - (func $~lib/map/Map#find (; 49 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 53 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -6105,7 +6125,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 50 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#has (; 54 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -6117,7 +6137,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 51 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 55 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6280,7 +6300,7 @@ ) ) ) - (func $~lib/map/Map#set (; 52 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/map/Map#set (; 56 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6417,7 +6437,7 @@ ) ) ) - (func $~lib/map/Map#get (; 53 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#get (; 57 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -6436,7 +6456,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 54 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#delete (; 58 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (if @@ -6532,7 +6552,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 55 ;) (type $v) + (func $std/map/test (; 59 ;) (type $v) (local $0 i64) (local $1 i32) (set_local $1 @@ -6990,7 +7010,7 @@ ) ) ) - (func $std/map/test (; 56 ;) (type $v) + (func $std/map/test (; 60 ;) (type $v) (local $0 i64) (local $1 i32) (set_local $1 @@ -7448,7 +7468,7 @@ ) ) ) - (func $~lib/map/Map#find (; 57 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 61 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -7511,7 +7531,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 58 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/map/Map#has (; 62 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -7525,7 +7545,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 59 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 63 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7690,7 +7710,7 @@ ) ) ) - (func $~lib/map/Map#set (; 60 ;) (type $ifiv) (param $0 i32) (param $1 f32) (param $2 i32) + (func $~lib/map/Map#set (; 64 ;) (type $ifiv) (param $0 i32) (param $1 f32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -7829,7 +7849,7 @@ ) ) ) - (func $~lib/map/Map#get (; 61 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/map/Map#get (; 65 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -7850,7 +7870,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 62 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/map/Map#delete (; 66 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (local $3 i32) (if @@ -7948,7 +7968,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 63 ;) (type $v) + (func $std/map/test (; 67 ;) (type $v) (local $0 f32) (local $1 i32) (set_local $1 @@ -8414,7 +8434,7 @@ ) ) ) - (func $~lib/map/Map#find (; 64 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 68 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -8477,7 +8497,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 65 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/map/Map#has (; 69 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -8491,7 +8511,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 66 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 70 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8656,7 +8676,7 @@ ) ) ) - (func $~lib/map/Map#set (; 67 ;) (type $iFiv) (param $0 i32) (param $1 f64) (param $2 i32) + (func $~lib/map/Map#set (; 71 ;) (type $iFiv) (param $0 i32) (param $1 f64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -8795,7 +8815,7 @@ ) ) ) - (func $~lib/map/Map#get (; 68 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/map/Map#get (; 72 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -8816,7 +8836,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 69 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/map/Map#delete (; 73 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 i32) (if @@ -8914,7 +8934,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 70 ;) (type $v) + (func $std/map/test (; 74 ;) (type $v) (local $0 f64) (local $1 i32) (set_local $1 @@ -9380,15 +9400,9 @@ ) ) ) - (func $start (; 71 ;) (type $v) + (func $start (; 75 ;) (type $v) (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 136) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index 74a7ded0..f796c90b 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -1,6 +1,7 @@ (module (type $v (func)) (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iv (func (param i32))) (type $iiii (func (param i32 i32 i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) @@ -40,7 +41,15 @@ (data (i32.const 112) "\n\00\00\00s\00t\00d\00/\00m\00a\00p\00.\00t\00s\00") (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 1 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 2 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -53,7 +62,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -67,16 +76,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -121,14 +130,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -148,7 +157,14 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/computeSize (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/internal/arraybuffer/computeSize (; 5 ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -157,7 +173,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -165,13 +181,13 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocUnsafe (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.eqz (i32.le_u (get_local $0) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) ) (block @@ -185,7 +201,7 @@ ) ) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -197,7 +213,7 @@ ) (get_local $1) ) - (func $~lib/memory/set_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -549,12 +565,19 @@ ) ) ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.fill (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u (get_local $1) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) (block (call $~lib/env/abort @@ -578,10 +601,10 @@ (i32.const 1) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $1) @@ -589,7 +612,7 @@ ) (get_local $3) ) - (func $~lib/map/Map#clear (; 6 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 10 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -601,7 +624,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -615,7 +638,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -626,7 +649,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 11 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -636,7 +659,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -672,16 +695,16 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash8 (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash8 (; 12 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) (get_local $0) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) - (func $~lib/map/Map#find (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 13 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -697,7 +720,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -716,7 +739,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -744,7 +767,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -757,7 +780,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -779,7 +802,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 11 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 15 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -802,7 +825,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -813,7 +836,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -834,7 +857,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -853,7 +876,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -874,7 +897,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -915,7 +938,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -976,7 +999,7 @@ ) ) ) - (func $~lib/map/Map#set (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 16 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1033,7 +1056,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -1061,7 +1084,7 @@ (i32.add (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -1114,7 +1137,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1131,7 +1154,7 @@ ) ) ) - (func $~lib/map/Map#get (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -1160,12 +1183,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 18 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1203,7 +1226,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -1233,7 +1256,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -1258,7 +1281,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -1271,7 +1294,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 16 ;) (type $v) + (func $std/map/test (; 20 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -1805,7 +1828,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 17 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 21 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -1817,7 +1840,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -1831,7 +1854,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -1842,7 +1865,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 18 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 22 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -1852,7 +1875,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -1888,7 +1911,7 @@ ) (get_local $0) ) - (func $~lib/map/Map#find (; 19 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 23 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -1904,7 +1927,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1923,7 +1946,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -1948,7 +1971,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -1961,7 +1984,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 24 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -1980,7 +2003,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 21 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 25 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2003,7 +2026,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -2014,7 +2037,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -2035,7 +2058,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -2054,7 +2077,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -2075,7 +2098,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -2116,7 +2139,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -2177,7 +2200,7 @@ ) ) ) - (func $~lib/map/Map#set (; 22 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 26 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2231,7 +2254,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -2259,7 +2282,7 @@ (i32.add (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -2312,7 +2335,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -2329,7 +2352,7 @@ ) ) ) - (func $~lib/map/Map#get (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -2355,12 +2378,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 24 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 28 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2395,7 +2418,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -2425,7 +2448,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -2450,7 +2473,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -2463,7 +2486,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 26 ;) (type $v) + (func $std/map/test (; 30 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -2976,7 +2999,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 27 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 31 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -2988,7 +3011,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -3002,7 +3025,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -3013,7 +3036,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 28 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 32 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -3023,7 +3046,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -3059,10 +3082,10 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash16 (; 29 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash16 (; 33 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) ) (set_local $1 (i32.mul @@ -3073,7 +3096,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -3085,12 +3108,12 @@ (i32.const 8) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (get_local $1) ) - (func $~lib/map/Map#find (; 30 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 34 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -3106,7 +3129,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -3125,7 +3148,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -3153,7 +3176,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -3166,7 +3189,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 31 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 35 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -3188,7 +3211,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 32 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 36 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3211,7 +3234,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -3222,7 +3245,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -3243,7 +3266,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -3262,7 +3285,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -3283,7 +3306,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -3324,7 +3347,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -3385,7 +3408,7 @@ ) ) ) - (func $~lib/map/Map#set (; 33 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 37 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3442,7 +3465,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -3470,7 +3493,7 @@ (i32.add (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -3523,7 +3546,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -3540,7 +3563,7 @@ ) ) ) - (func $~lib/map/Map#get (; 34 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 38 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -3569,12 +3592,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 35 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 39 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 36 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 40 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3612,7 +3635,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -3642,7 +3665,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -3667,7 +3690,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -3680,7 +3703,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 37 ;) (type $v) + (func $std/map/test (; 41 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -4214,7 +4237,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 38 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 42 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -4226,7 +4249,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -4240,7 +4263,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -4251,7 +4274,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 39 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 43 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -4261,7 +4284,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -4297,7 +4320,7 @@ ) (get_local $0) ) - (func $~lib/map/Map#find (; 40 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 44 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -4313,7 +4336,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -4332,7 +4355,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -4357,7 +4380,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -4370,7 +4393,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 41 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 45 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -4389,7 +4412,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 42 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 46 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4412,7 +4435,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -4423,7 +4446,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -4444,7 +4467,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -4463,7 +4486,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -4484,7 +4507,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -4525,7 +4548,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -4586,7 +4609,7 @@ ) ) ) - (func $~lib/map/Map#set (; 43 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 47 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4640,7 +4663,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -4668,7 +4691,7 @@ (i32.add (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -4721,7 +4744,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -4738,7 +4761,7 @@ ) ) ) - (func $~lib/map/Map#get (; 44 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 48 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -4764,12 +4787,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 45 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 49 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 46 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 50 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4804,7 +4827,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -4834,7 +4857,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -4859,7 +4882,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -4872,7 +4895,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 47 ;) (type $v) + (func $std/map/test (; 51 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -5385,7 +5408,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 48 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 52 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -5397,7 +5420,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -5411,7 +5434,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -5422,7 +5445,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 49 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 53 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -5432,7 +5455,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -5468,10 +5491,10 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash32 (; 50 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 54 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) ) (set_local $1 (i32.mul @@ -5482,7 +5505,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -5497,7 +5520,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -5512,7 +5535,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -5524,12 +5547,12 @@ (i32.const 24) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (get_local $1) ) - (func $~lib/map/Map#find (; 51 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 55 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -5545,7 +5568,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -5564,7 +5587,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -5586,7 +5609,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -5599,7 +5622,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 52 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 56 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -5615,7 +5638,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 53 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 57 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5638,7 +5661,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -5649,7 +5672,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -5670,7 +5693,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -5689,7 +5712,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -5710,7 +5733,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -5751,7 +5774,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -5812,7 +5835,7 @@ ) ) ) - (func $~lib/map/Map#set (; 54 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 58 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -5863,7 +5886,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -5891,7 +5914,7 @@ (i32.add (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -5944,7 +5967,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -5961,7 +5984,7 @@ ) ) ) - (func $~lib/map/Map#get (; 55 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 59 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -5984,12 +6007,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 56 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 60 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 57 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 61 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6021,7 +6044,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -6051,7 +6074,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -6076,7 +6099,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -6089,7 +6112,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 58 ;) (type $v) + (func $std/map/test (; 62 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -6581,7 +6604,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 59 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 63 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -6593,7 +6616,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -6607,7 +6630,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -6618,7 +6641,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 60 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 64 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -6628,7 +6651,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -6664,7 +6687,7 @@ ) (get_local $0) ) - (func $~lib/map/Map#find (; 61 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 65 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -6680,7 +6703,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -6699,7 +6722,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -6721,7 +6744,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -6734,7 +6757,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 62 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 66 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -6750,7 +6773,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 63 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 67 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6773,7 +6796,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -6784,7 +6807,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -6805,7 +6828,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -6824,7 +6847,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -6845,7 +6868,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -6886,7 +6909,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -6947,7 +6970,7 @@ ) ) ) - (func $~lib/map/Map#set (; 64 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 68 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6998,7 +7021,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -7026,7 +7049,7 @@ (i32.add (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -7079,7 +7102,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -7096,7 +7119,7 @@ ) ) ) - (func $~lib/map/Map#get (; 65 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 69 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -7119,12 +7142,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 66 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 70 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 67 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 71 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7156,7 +7179,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -7186,7 +7209,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -7211,7 +7234,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -7224,7 +7247,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 68 ;) (type $v) + (func $std/map/test (; 72 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -7716,7 +7739,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 69 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 73 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -7728,7 +7751,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -7742,7 +7765,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -7753,7 +7776,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 70 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 74 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -7763,7 +7786,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -7799,7 +7822,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash64 (; 71 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash64 (; 75 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -7817,7 +7840,7 @@ ) ) (set_local $3 - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) ) (set_local $3 (i32.mul @@ -7828,7 +7851,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -7843,7 +7866,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -7858,7 +7881,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -7870,7 +7893,7 @@ (i32.const 24) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -7882,7 +7905,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -7897,7 +7920,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -7912,7 +7935,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -7924,12 +7947,12 @@ (i32.const 24) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (get_local $3) ) - (func $~lib/map/Map#find (; 72 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 76 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -7945,7 +7968,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -7964,7 +7987,7 @@ (i32.load offset=12 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -7986,7 +8009,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -7999,7 +8022,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 73 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#has (; 77 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -8015,7 +8038,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 74 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 78 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8039,7 +8062,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -8050,7 +8073,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -8071,7 +8094,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -8090,7 +8113,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -8111,7 +8134,7 @@ (i32.load offset=12 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -8152,7 +8175,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -8213,7 +8236,7 @@ ) ) ) - (func $~lib/map/Map#set (; 75 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/map/Map#set (; 79 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -8264,7 +8287,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -8292,7 +8315,7 @@ (i32.add (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -8345,7 +8368,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -8362,7 +8385,7 @@ ) ) ) - (func $~lib/map/Map#get (; 76 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#get (; 80 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -8385,12 +8408,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 77 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 81 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 78 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#delete (; 82 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8422,7 +8445,7 @@ (i32.load offset=12 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -8452,7 +8475,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -8477,7 +8500,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -8490,7 +8513,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 79 ;) (type $v) + (func $std/map/test (; 83 ;) (type $v) (local $0 i32) (local $1 i64) (set_local $0 @@ -8996,7 +9019,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 80 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 84 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -9008,7 +9031,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -9022,7 +9045,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -9033,7 +9056,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 81 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 85 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -9043,7 +9066,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -9079,7 +9102,7 @@ ) (get_local $0) ) - (func $~lib/map/Map#find (; 82 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 86 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -9095,7 +9118,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -9114,7 +9137,7 @@ (i32.load offset=12 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -9136,7 +9159,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -9149,7 +9172,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 83 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#has (; 87 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -9165,7 +9188,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 84 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 88 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9189,7 +9212,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -9200,7 +9223,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -9221,7 +9244,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -9240,7 +9263,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -9261,7 +9284,7 @@ (i32.load offset=12 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -9302,7 +9325,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -9363,7 +9386,7 @@ ) ) ) - (func $~lib/map/Map#set (; 85 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/map/Map#set (; 89 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -9414,7 +9437,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -9442,7 +9465,7 @@ (i32.add (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -9495,7 +9518,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -9512,7 +9535,7 @@ ) ) ) - (func $~lib/map/Map#get (; 86 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#get (; 90 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -9535,12 +9558,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 87 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 91 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 88 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#delete (; 92 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9572,7 +9595,7 @@ (i32.load offset=12 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -9602,7 +9625,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -9627,7 +9650,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -9640,7 +9663,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 89 ;) (type $v) + (func $std/map/test (; 93 ;) (type $v) (local $0 i32) (local $1 i64) (set_local $0 @@ -10146,7 +10169,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 90 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 94 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -10158,7 +10181,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -10172,7 +10195,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -10183,7 +10206,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 91 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 95 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -10193,7 +10216,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -10229,7 +10252,7 @@ ) (get_local $0) ) - (func $~lib/map/Map#find (; 92 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 96 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -10245,7 +10268,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -10264,7 +10287,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -10286,7 +10309,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -10299,7 +10322,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 93 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/map/Map#has (; 97 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -10317,7 +10340,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 94 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 98 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10341,7 +10364,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -10352,7 +10375,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -10373,7 +10396,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -10392,7 +10415,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -10413,7 +10436,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -10456,7 +10479,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -10517,7 +10540,7 @@ ) ) ) - (func $~lib/map/Map#set (; 95 ;) (type $ifiv) (param $0 i32) (param $1 f32) (param $2 i32) + (func $~lib/map/Map#set (; 99 ;) (type $ifiv) (param $0 i32) (param $1 f32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -10570,7 +10593,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -10598,7 +10621,7 @@ (i32.add (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -10651,7 +10674,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -10668,7 +10691,7 @@ ) ) ) - (func $~lib/map/Map#get (; 96 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/map/Map#get (; 100 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -10693,12 +10716,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 97 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 101 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 98 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/map/Map#delete (; 102 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10732,7 +10755,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -10762,7 +10785,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -10787,7 +10810,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -10800,7 +10823,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 99 ;) (type $v) + (func $std/map/test (; 103 ;) (type $v) (local $0 i32) (local $1 f32) (set_local $0 @@ -11306,7 +11329,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 100 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 104 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -11318,7 +11341,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -11332,7 +11355,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -11343,7 +11366,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 101 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 105 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -11353,7 +11376,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -11389,7 +11412,7 @@ ) (get_local $0) ) - (func $~lib/map/Map#find (; 102 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 106 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -11405,7 +11428,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -11424,7 +11447,7 @@ (i32.load offset=12 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -11446,7 +11469,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -11459,7 +11482,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 103 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/map/Map#has (; 107 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -11477,7 +11500,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 104 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 108 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -11501,7 +11524,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -11512,7 +11535,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -11533,7 +11556,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -11552,7 +11575,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -11573,7 +11596,7 @@ (i32.load offset=12 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -11616,7 +11639,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -11677,7 +11700,7 @@ ) ) ) - (func $~lib/map/Map#set (; 105 ;) (type $iFiv) (param $0 i32) (param $1 f64) (param $2 i32) + (func $~lib/map/Map#set (; 109 ;) (type $iFiv) (param $0 i32) (param $1 f64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -11730,7 +11753,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -11758,7 +11781,7 @@ (i32.add (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -11811,7 +11834,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -11828,7 +11851,7 @@ ) ) ) - (func $~lib/map/Map#get (; 106 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/map/Map#get (; 110 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -11853,12 +11876,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 107 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 111 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 108 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/map/Map#delete (; 112 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -11892,7 +11915,7 @@ (i32.load offset=12 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -11922,7 +11945,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -11947,7 +11970,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -11960,7 +11983,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 109 ;) (type $v) + (func $std/map/test (; 113 ;) (type $v) (local $0 i32) (local $1 f64) (set_local $0 @@ -12466,15 +12489,15 @@ ) ) ) - (func $start (; 110 ;) (type $v) + (func $start (; 114 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add (get_global $HEAP_BASE) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) diff --git a/tests/compiler/std/math.untouched.wat b/tests/compiler/std/math.untouched.wat index 3d2ce643..4ae21b42 100644 --- a/tests/compiler/std/math.untouched.wat +++ b/tests/compiler/std/math.untouched.wat @@ -64,11 +64,27 @@ (global $std/math/DIVBYZERO i32 (i32.const 4)) (global $std/math/UNDERFLOW i32 (i32.const 8)) (global $std/math/OVERFLOW i32 (i32.const 16)) + (global $~lib/math/NativeMath.E f64 (f64.const 2.718281828459045)) + (global $~lib/math/NativeMathf.E f32 (f32.const 2.7182817459106445)) (global $Infinity f64 (f64.const inf)) + (global $~lib/math/NativeMath.LN2 f64 (f64.const 0.6931471805599453)) + (global $~lib/math/NativeMath.LN10 f64 (f64.const 2.302585092994046)) + (global $~lib/math/NativeMath.LOG2E f64 (f64.const 1.4426950408889634)) + (global $~lib/math/NativeMath.PI f64 (f64.const 3.141592653589793)) + (global $~lib/math/NativeMath.SQRT1_2 f64 (f64.const 0.7071067811865476)) + (global $~lib/math/NativeMath.SQRT2 f64 (f64.const 1.4142135623730951)) + (global $~lib/math/NativeMathf.LN2 f32 (f32.const 0.6931471824645996)) + (global $~lib/math/NativeMathf.LN10 f32 (f32.const 2.3025851249694824)) + (global $~lib/math/NativeMathf.LOG2E f32 (f32.const 1.4426950216293335)) + (global $~lib/math/NativeMathf.PI f32 (f32.const 3.1415927410125732)) + (global $~lib/math/NativeMathf.SQRT1_2 f32 (f32.const 0.7071067690849304)) + (global $~lib/math/NativeMathf.SQRT2 f32 (f32.const 1.4142135381698608)) (global $NaN f64 (f64.const nan:0x8000000000000)) (global $~lib/math/random_seeded (mut i32) (i32.const 0)) (global $~lib/math/random_state0 (mut i64) (i64.const 0)) (global $~lib/math/random_state1 (mut i64) (i64.const 0)) + (global $f64.EPSILON f64 (f64.const 2.220446049250313e-16)) + (global $f32.EPSILON f32 (f32.const 1.1920928955078125e-07)) (global $HEAP_BASE i32 (i32.const 64)) (memory $0 1) (data (i32.const 8) "\0b\00\00\00s\00t\00d\00/\00m\00a\00t\00h\00.\00t\00s\00") @@ -711,7 +727,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -1054,7 +1070,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -2085,7 +2101,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -2999,7 +3015,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -3317,7 +3333,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -3896,7 +3912,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -4409,7 +4425,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -4695,12 +4711,12 @@ ) ) (return - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) ) (return (f64.neg - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) ) ) ) @@ -5023,7 +5039,7 @@ (if (result i32) (tee_local $5 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $5) @@ -5712,7 +5728,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -5928,7 +5944,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -6823,7 +6839,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -7655,7 +7671,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -7697,7 +7713,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -7741,7 +7757,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -8081,7 +8097,7 @@ (if (result i32) (tee_local $5 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $5) @@ -8317,7 +8333,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -8736,7 +8752,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -9064,7 +9080,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -9470,7 +9486,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -9793,7 +9809,7 @@ (if (result i32) (tee_local $5 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $5) @@ -9842,7 +9858,7 @@ (if (result i32) (tee_local $5 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $5) @@ -10329,7 +10345,7 @@ (if (result i32) (tee_local $5 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $5) @@ -12353,7 +12369,7 @@ (if (result i32) (tee_local $5 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $5) @@ -14227,7 +14243,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -15519,7 +15535,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -15683,7 +15699,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -15870,7 +15886,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -16046,7 +16062,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -16083,8 +16099,8 @@ (if (i32.eqz (f64.eq - (f64.const 2.718281828459045) - (f64.const 2.718281828459045) + (get_global $~lib/math/NativeMath.E) + (get_global $~lib/math/NativeMath.E) ) ) (block @@ -16100,8 +16116,8 @@ (if (i32.eqz (f32.eq - (f32.const 2.7182817459106445) - (f32.const 2.7182817459106445) + (get_global $~lib/math/NativeMathf.E) + (get_global $~lib/math/NativeMathf.E) ) ) (block @@ -16117,7 +16133,7 @@ (if (i32.eqz (call $std/math/check - (f64.const 2.718281828459045) + (get_global $~lib/math/NativeMath.E) (get_global $~lib/math/JSMath.E) (f64.const 0) (i32.const 0) @@ -16136,7 +16152,7 @@ (if (i32.eqz (call $std/math/check - (f64.const 0.6931471805599453) + (get_global $~lib/math/NativeMath.LN2) (get_global $~lib/math/JSMath.LN2) (f64.const 0) (i32.const 0) @@ -16155,7 +16171,7 @@ (if (i32.eqz (call $std/math/check - (f64.const 2.302585092994046) + (get_global $~lib/math/NativeMath.LN10) (get_global $~lib/math/JSMath.LN10) (f64.const 0) (i32.const 0) @@ -16174,7 +16190,7 @@ (if (i32.eqz (call $std/math/check - (f64.const 1.4426950408889634) + (get_global $~lib/math/NativeMath.LOG2E) (get_global $~lib/math/JSMath.LOG2E) (f64.const 0) (i32.const 0) @@ -16193,7 +16209,7 @@ (if (i32.eqz (call $std/math/check - (f64.const 3.141592653589793) + (get_global $~lib/math/NativeMath.PI) (get_global $~lib/math/JSMath.PI) (f64.const 0) (i32.const 0) @@ -16212,7 +16228,7 @@ (if (i32.eqz (call $std/math/check - (f64.const 0.7071067811865476) + (get_global $~lib/math/NativeMath.SQRT1_2) (get_global $~lib/math/JSMath.SQRT1_2) (f64.const 0) (i32.const 0) @@ -16231,7 +16247,7 @@ (if (i32.eqz (call $std/math/check - (f64.const 1.4142135623730951) + (get_global $~lib/math/NativeMath.SQRT2) (get_global $~lib/math/JSMath.SQRT2) (f64.const 0) (i32.const 0) @@ -16250,7 +16266,7 @@ (if (i32.eqz (call $std/math/check - (f32.const 2.7182817459106445) + (get_global $~lib/math/NativeMathf.E) (f32.demote/f64 (get_global $~lib/math/JSMath.E) ) @@ -16271,7 +16287,7 @@ (if (i32.eqz (call $std/math/check - (f32.const 0.6931471824645996) + (get_global $~lib/math/NativeMathf.LN2) (f32.demote/f64 (get_global $~lib/math/JSMath.LN2) ) @@ -16292,7 +16308,7 @@ (if (i32.eqz (call $std/math/check - (f32.const 2.3025851249694824) + (get_global $~lib/math/NativeMathf.LN10) (f32.demote/f64 (get_global $~lib/math/JSMath.LN10) ) @@ -16313,7 +16329,7 @@ (if (i32.eqz (call $std/math/check - (f32.const 1.4426950216293335) + (get_global $~lib/math/NativeMathf.LOG2E) (f32.demote/f64 (get_global $~lib/math/JSMath.LOG2E) ) @@ -16334,7 +16350,7 @@ (if (i32.eqz (call $std/math/check - (f32.const 3.1415927410125732) + (get_global $~lib/math/NativeMathf.PI) (f32.demote/f64 (get_global $~lib/math/JSMath.PI) ) @@ -16355,7 +16371,7 @@ (if (i32.eqz (call $std/math/check - (f32.const 0.7071067690849304) + (get_global $~lib/math/NativeMathf.SQRT1_2) (f32.demote/f64 (get_global $~lib/math/JSMath.SQRT1_2) ) @@ -16376,7 +16392,7 @@ (if (i32.eqz (call $std/math/check - (f32.const 1.4142135381698608) + (get_global $~lib/math/NativeMathf.SQRT2) (f32.demote/f64 (get_global $~lib/math/JSMath.SQRT2) ) @@ -16786,8 +16802,8 @@ (f64.const inf) (f64.const 0) (i32.or - (i32.const 1) - (i32.const 16) + (get_global $std/math/INEXACT) + (get_global $std/math/OVERFLOW) ) ) ) @@ -16933,8 +16949,8 @@ (f64.const 5e-324) (f64.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -16956,8 +16972,8 @@ (f64.const 5e-324) (f64.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -16979,8 +16995,8 @@ (f64.const 2.781342323134007e-309) (f64.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -17386,8 +17402,8 @@ (f32.const inf) (f32.const 0) (i32.or - (i32.const 1) - (i32.const 16) + (get_global $std/math/INEXACT) + (get_global $std/math/OVERFLOW) ) ) ) @@ -17533,8 +17549,8 @@ (f32.const 1.401298464324817e-45) (f32.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -17556,8 +17572,8 @@ (f32.const 1.401298464324817e-45) (f32.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -17579,8 +17595,8 @@ (f32.const 1.4693693398263237e-39) (f32.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -18250,7 +18266,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18269,7 +18285,7 @@ (f64.const 4.345239849338305) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18288,7 +18304,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18307,7 +18323,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18326,7 +18342,7 @@ (f64.const 9.267056966972586) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18345,7 +18361,7 @@ (f64.const 0.6619858980995045) (f64.const 0.8473310828433507) (f64.const -0.41553276777267456) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18364,7 +18380,7 @@ (f64.const -0.4066039223853553) (f64.const 1.989530071088669) (f64.const 0.4973946213722229) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18383,7 +18399,7 @@ (f64.const 0.5617597462207241) (f64.const 0.9742849645674904) (f64.const -0.4428897500038147) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18402,7 +18418,7 @@ (f64.const 0.7741522965913037) (f64.const 0.6854215158636222) (f64.const -0.12589527666568756) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18421,7 +18437,7 @@ (f64.const -0.6787637026394024) (f64.const 2.316874138205964) (f64.const -0.17284949123859406) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18440,7 +18456,7 @@ (f64.const 0) (f64.const 1.5707963267948966) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18459,7 +18475,7 @@ (f64.const -1) (f64.const 3.141592653589793) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18497,7 +18513,7 @@ (f64.const 1.0000000000000002) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18516,7 +18532,7 @@ (f64.const -1.0000000000000002) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18535,7 +18551,7 @@ (f64.const inf) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18556,7 +18572,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18594,7 +18610,7 @@ (f64.const -0.5309227209592985) (f64.const 2.1304853799705463) (f64.const 0.1391008496284485) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18613,7 +18629,7 @@ (f64.const 0.4939556746399746) (f64.const 1.0541629875851946) (f64.const 0.22054767608642578) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18632,7 +18648,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18651,7 +18667,7 @@ (f32.const 4.345239639282227) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18670,7 +18686,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18689,7 +18705,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18708,7 +18724,7 @@ (f32.const 9.267057418823242) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18727,7 +18743,7 @@ (f32.const 0.6619858741760254) (f32.const 0.8473311066627502) (f32.const -0.13588131964206696) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18746,7 +18762,7 @@ (f32.const -0.40660393238067627) (f32.const 1.989530086517334) (f32.const 0.03764917701482773) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18765,7 +18781,7 @@ (f32.const 0.5617597699165344) (f32.const 0.9742849469184875) (f32.const 0.18443739414215088) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18784,7 +18800,7 @@ (f32.const 0.7741522789001465) (f32.const 0.6854215264320374) (f32.const -0.29158344864845276) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18803,7 +18819,7 @@ (f32.const -0.6787636876106262) (f32.const 2.3168740272521973) (f32.const -0.3795364499092102) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18822,7 +18838,7 @@ (f32.const 0) (f32.const 1.5707963705062866) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18841,7 +18857,7 @@ (f32.const -1) (f32.const 3.1415927410125732) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18879,7 +18895,7 @@ (f32.const 1.0000001192092896) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18898,7 +18914,7 @@ (f32.const -1.0000001192092896) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18917,7 +18933,7 @@ (f32.const inf) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18938,7 +18954,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18976,7 +18992,7 @@ (f32.const 0.49965065717697144) (f32.const 1.0476008653640747) (f32.const -0.21161814033985138) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18995,7 +19011,7 @@ (f32.const -0.5051405429840088) (f32.const 2.1003410816192627) (f32.const -0.20852705836296082) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19014,7 +19030,7 @@ (f32.const -0.5189794898033142) (f32.const 2.116452932357788) (f32.const -0.14600826799869537) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19033,7 +19049,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19052,7 +19068,7 @@ (f64.const 4.345239849338305) (f64.const 2.1487163980597503) (f64.const -0.291634738445282) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19071,7 +19087,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19090,7 +19106,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19109,7 +19125,7 @@ (f64.const 9.267056966972586) (f64.const 2.91668914109908) (f64.const -0.24191908538341522) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19128,7 +19144,7 @@ (f64.const 0.6619858980995045) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19147,7 +19163,7 @@ (f64.const -0.4066039223853553) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19166,7 +19182,7 @@ (f64.const 0.5617597462207241) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19185,7 +19201,7 @@ (f64.const 0.7741522965913037) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19204,7 +19220,7 @@ (f64.const -0.6787637026394024) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19280,7 +19296,7 @@ (f64.const 0.9999923706054688) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19299,7 +19315,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19318,7 +19334,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19339,7 +19355,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19358,7 +19374,7 @@ (f64.const 1.1060831199926429) (f64.const 0.4566373404384803) (f64.const -0.29381608963012695) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19377,7 +19393,7 @@ (f64.const 1.1089809557628658) (f64.const 0.4627246859959428) (f64.const -0.3990095555782318) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19396,7 +19412,7 @@ (f64.const 1.1169429159875521) (f64.const 0.47902433134075284) (f64.const -0.321674108505249) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19415,7 +19431,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19434,7 +19450,7 @@ (f32.const 4.345239639282227) (f32.const 2.148716449737549) (f32.const 0.4251045286655426) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19453,7 +19469,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19472,7 +19488,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19491,7 +19507,7 @@ (f32.const 9.267057418823242) (f32.const 2.916689157485962) (f32.const -0.1369788944721222) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19510,7 +19526,7 @@ (f32.const 0.6619858741760254) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19529,7 +19545,7 @@ (f32.const -0.40660393238067627) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19548,7 +19564,7 @@ (f32.const 0.5617597699165344) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19567,7 +19583,7 @@ (f32.const 0.7741522789001465) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19586,7 +19602,7 @@ (f32.const -0.6787636876106262) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19662,7 +19678,7 @@ (f32.const 0.9999923706054688) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19681,7 +19697,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19700,7 +19716,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19721,7 +19737,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19740,7 +19756,7 @@ (f32.const -1125899906842624) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19759,7 +19775,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19778,7 +19794,7 @@ (f64.const 4.345239849338305) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19797,7 +19813,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19816,7 +19832,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19835,7 +19851,7 @@ (f64.const 9.267056966972586) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19854,7 +19870,7 @@ (f64.const 0.6619858980995045) (f64.const 0.7234652439515459) (f64.const -0.13599912822246552) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19873,7 +19889,7 @@ (f64.const -0.4066039223853553) (f64.const -0.41873374429377225) (f64.const -0.09264230728149414) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19892,7 +19908,7 @@ (f64.const 0.5617597462207241) (f64.const 0.5965113622274062) (f64.const -0.10864213854074478) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19911,7 +19927,7 @@ (f64.const 0.7741522965913037) (f64.const 0.8853748109312743) (f64.const -0.4256366193294525) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19930,7 +19946,7 @@ (f64.const -0.6787637026394024) (f64.const -0.7460778114110673) (f64.const 0.13986606895923615) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19949,7 +19965,7 @@ (f64.const 1) (f64.const 1.5707963267948966) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19968,7 +19984,7 @@ (f64.const -1) (f64.const -1.5707963267948966) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20025,7 +20041,7 @@ (f64.const 1.0000000000000002) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20044,7 +20060,7 @@ (f64.const -1.0000000000000002) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20063,7 +20079,7 @@ (f64.const inf) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20084,7 +20100,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20122,7 +20138,7 @@ (f64.const 0.5073043929119148) (f64.const 0.5320538997772349) (f64.const -0.16157317161560059) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20141,7 +20157,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20160,7 +20176,7 @@ (f32.const 4.345239639282227) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20179,7 +20195,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20198,7 +20214,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20217,7 +20233,7 @@ (f32.const 9.267057418823242) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20236,7 +20252,7 @@ (f32.const 0.6619858741760254) (f32.const 0.7234652042388916) (f32.const -0.1307632476091385) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20255,7 +20271,7 @@ (f32.const -0.40660393238067627) (f32.const -0.41873374581336975) (f32.const 0.3161141574382782) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20274,7 +20290,7 @@ (f32.const 0.5617597699165344) (f32.const 0.5965113639831543) (f32.const -0.4510819613933563) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20293,7 +20309,7 @@ (f32.const 0.7741522789001465) (f32.const 0.8853747844696045) (f32.const 0.02493886835873127) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20312,7 +20328,7 @@ (f32.const -0.6787636876106262) (f32.const -0.7460777759552002) (f32.const 0.2515012323856354) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20331,7 +20347,7 @@ (f32.const 1) (f32.const 1.5707963705062866) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20350,7 +20366,7 @@ (f32.const -1) (f32.const -1.5707963705062866) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20407,7 +20423,7 @@ (f32.const 1.0000001192092896) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20426,7 +20442,7 @@ (f32.const -1.0000001192092896) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20445,7 +20461,7 @@ (f32.const inf) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20466,7 +20482,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20504,7 +20520,7 @@ (f32.const 0.5004770159721375) (f32.const 0.5241496562957764) (f32.const -0.29427099227905273) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20523,7 +20539,7 @@ (f64.const -8.06684839057968) (f64.const -2.784729878387861) (f64.const -0.4762189984321594) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20542,7 +20558,7 @@ (f64.const 4.345239849338305) (f64.const 2.175213389013164) (f64.const -0.02728751301765442) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20561,7 +20577,7 @@ (f64.const -8.38143342755525) (f64.const -2.822706083697696) (f64.const 0.20985257625579834) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20580,7 +20596,7 @@ (f64.const -6.531673581913484) (f64.const -2.575619446591922) (f64.const 0.3113134205341339) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20599,7 +20615,7 @@ (f64.const 9.267056966972586) (f64.const 2.9225114951048674) (f64.const 0.4991756081581116) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20618,7 +20634,7 @@ (f64.const 0.6619858980995045) (f64.const 0.6212462762707166) (f64.const -0.4697347581386566) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20637,7 +20653,7 @@ (f64.const -0.4066039223853553) (f64.const -0.39615990393192035) (f64.const -0.40814438462257385) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20656,7 +20672,7 @@ (f64.const 0.5617597462207241) (f64.const 0.5357588870255474) (f64.const 0.3520713150501251) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20675,7 +20691,7 @@ (f64.const 0.7741522965913037) (f64.const 0.7123571263197349) (f64.const 0.13371451199054718) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20694,7 +20710,7 @@ (f64.const -0.6787637026394024) (f64.const -0.635182348903198) (f64.const 0.04749670997262001) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20812,7 +20828,7 @@ (f32.const -8.066848754882812) (f32.const -2.7847299575805664) (f32.const -0.14418013393878937) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20831,7 +20847,7 @@ (f32.const 4.345239639282227) (f32.const 2.17521333694458) (f32.const -0.020796965807676315) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20850,7 +20866,7 @@ (f32.const -8.381433486938477) (f32.const -2.8227059841156006) (f32.const 0.44718533754348755) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20869,7 +20885,7 @@ (f32.const -6.531673431396484) (f32.const -2.5756194591522217) (f32.const -0.14822272956371307) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20888,7 +20904,7 @@ (f32.const 9.267057418823242) (f32.const 2.922511577606201) (f32.const 0.14270681142807007) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20907,7 +20923,7 @@ (f32.const 0.6619858741760254) (f32.const 0.6212462782859802) (f32.const 0.3684912919998169) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20926,7 +20942,7 @@ (f32.const -0.40660393238067627) (f32.const -0.39615991711616516) (f32.const -0.13170306384563446) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20945,7 +20961,7 @@ (f32.const 0.5617597699165344) (f32.const 0.535758912563324) (f32.const 0.08184859901666641) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20964,7 +20980,7 @@ (f32.const 0.7741522789001465) (f32.const 0.7123571038246155) (f32.const -0.14270737767219543) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20983,7 +20999,7 @@ (f32.const -0.6787636876106262) (f32.const -0.6351823210716248) (f32.const 0.2583143711090088) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21101,7 +21117,7 @@ (f64.const -8.06684839057968) (f64.const -1.4474613762633468) (f64.const 0.14857111871242523) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21120,7 +21136,7 @@ (f64.const 4.345239849338305) (f64.const 1.344597927114538) (f64.const -0.08170335739850998) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21139,7 +21155,7 @@ (f64.const -8.38143342755525) (f64.const -1.4520463463295539) (f64.const -0.07505480200052261) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21158,7 +21174,7 @@ (f64.const -6.531673581913484) (f64.const -1.4188758658752532) (f64.const -0.057633496820926666) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21177,7 +21193,7 @@ (f64.const 9.267056966972586) (f64.const 1.463303145448706) (f64.const 0.1606956422328949) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21196,7 +21212,7 @@ (f64.const 0.6619858980995045) (f64.const 0.5847550670238325) (f64.const 0.4582556486129761) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21215,7 +21231,7 @@ (f64.const -0.4066039223853553) (f64.const -0.3861864177552131) (f64.const -0.2574281692504883) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21234,7 +21250,7 @@ (f64.const 0.5617597462207241) (f64.const 0.5118269531628881) (f64.const -0.11444277316331863) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21253,7 +21269,7 @@ (f64.const 0.7741522965913037) (f64.const 0.6587802431653822) (f64.const -0.11286488175392151) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21272,7 +21288,7 @@ (f64.const -0.6787637026394024) (f64.const -0.5963307826973472) (f64.const -0.2182842344045639) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21329,7 +21345,7 @@ (f64.const 1) (f64.const 0.7853981633974483) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21348,7 +21364,7 @@ (f64.const -1) (f64.const -0.7853981633974483) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21367,7 +21383,7 @@ (f64.const inf) (f64.const 1.5707963267948966) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21388,7 +21404,7 @@ ) (f64.const -1.5707963267948966) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21426,7 +21442,7 @@ (f64.const 0.6929821535674624) (f64.const 0.6060004555152562) (f64.const -0.17075790464878082) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21445,7 +21461,7 @@ (f32.const -8.066848754882812) (f32.const -1.4474613666534424) (f32.const 0.12686480581760406) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21464,7 +21480,7 @@ (f32.const 4.345239639282227) (f32.const 1.3445979356765747) (f32.const 0.16045434772968292) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21483,7 +21499,7 @@ (f32.const -8.381433486938477) (f32.const -1.4520463943481445) (f32.const -0.39581751823425293) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21502,7 +21518,7 @@ (f32.const -6.531673431396484) (f32.const -1.418875813484192) (f32.const 0.410570353269577) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21521,7 +21537,7 @@ (f32.const 9.267057418823242) (f32.const 1.4633032083511353) (f32.const 0.48403501510620117) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21540,7 +21556,7 @@ (f32.const 0.6619858741760254) (f32.const 0.5847550630569458) (f32.const 0.2125193476676941) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21559,7 +21575,7 @@ (f32.const -0.40660393238067627) (f32.const -0.386186420917511) (f32.const 0.18169628083705902) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21578,7 +21594,7 @@ (f32.const 0.5617597699165344) (f32.const 0.5118269920349121) (f32.const 0.3499770760536194) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21597,7 +21613,7 @@ (f32.const 0.7741522789001465) (f32.const 0.6587802171707153) (f32.const -0.2505330741405487) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21616,7 +21632,7 @@ (f32.const -0.6787636876106262) (f32.const -0.5963307619094849) (f32.const 0.17614826560020447) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21673,7 +21689,7 @@ (f32.const 1) (f32.const 0.7853981852531433) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21692,7 +21708,7 @@ (f32.const -1) (f32.const -0.7853981852531433) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21711,7 +21727,7 @@ (f32.const inf) (f32.const 1.5707963705062866) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21732,7 +21748,7 @@ ) (f32.const -1.5707963705062866) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21770,7 +21786,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -21789,7 +21805,7 @@ (f64.const 4.345239849338305) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -21808,7 +21824,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -21827,7 +21843,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -21846,7 +21862,7 @@ (f64.const 9.267056966972586) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -21865,7 +21881,7 @@ (f64.const 0.6619858980995045) (f64.const 0.7963404371347943) (f64.const 0.21338365972042084) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21884,7 +21900,7 @@ (f64.const -0.4066039223853553) (f64.const -0.43153570730602897) (f64.const -0.4325666129589081) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21903,7 +21919,7 @@ (f64.const 0.5617597462207241) (f64.const 0.6354006111644578) (f64.const -0.06527865678071976) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21922,7 +21938,7 @@ (f64.const 0.7741522965913037) (f64.const 1.0306085575277995) (f64.const 0.14632052183151245) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21941,7 +21957,7 @@ (f64.const -0.6787637026394024) (f64.const -0.8268179645205255) (f64.const 0.1397128701210022) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21979,7 +21995,7 @@ (f64.const inf) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22000,7 +22016,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22057,7 +22073,7 @@ (f64.const 1) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -22078,7 +22094,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -22097,7 +22113,7 @@ (f64.const 1.0000152587890625) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22116,7 +22132,7 @@ (f64.const -1.0000152587890625) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22135,7 +22151,7 @@ (f64.const 1.3552527156068805e-20) (f64.const 1.3552527156068805e-20) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22154,7 +22170,7 @@ (f64.const 9.332636185032189e-302) (f64.const 9.332636185032189e-302) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22174,8 +22190,8 @@ (f64.const 5.562684646268003e-309) (f64.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -22196,8 +22212,8 @@ (f64.const -5.562684646268003e-309) (f64.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -22217,7 +22233,7 @@ (f64.const 8988465674311579538646525e283) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22236,7 +22252,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22255,7 +22271,7 @@ (f32.const 4.345239639282227) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22274,7 +22290,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22293,7 +22309,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22312,7 +22328,7 @@ (f32.const 9.267057418823242) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22331,7 +22347,7 @@ (f32.const 0.6619858741760254) (f32.const 0.7963404059410095) (f32.const 0.19112196564674377) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22350,7 +22366,7 @@ (f32.const -0.40660393238067627) (f32.const -0.4315357208251953) (f32.const -0.05180925130844116) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22369,7 +22385,7 @@ (f32.const 0.5617597699165344) (f32.const 0.635400652885437) (f32.const 0.11911056190729141) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22388,7 +22404,7 @@ (f32.const 0.7741522789001465) (f32.const 1.0306085348129272) (f32.const 0.1798270344734192) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22407,7 +22423,7 @@ (f32.const -0.6787636876106262) (f32.const -0.8268179297447205) (f32.const 0.11588983237743378) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22445,7 +22461,7 @@ (f32.const inf) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22466,7 +22482,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22523,7 +22539,7 @@ (f32.const 1) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -22544,7 +22560,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -22563,7 +22579,7 @@ (f32.const 1.0000152587890625) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22582,7 +22598,7 @@ (f32.const -1.0000152587890625) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22601,7 +22617,7 @@ (f32.const 1.3552527156068805e-20) (f32.const 1.3552527156068805e-20) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22620,7 +22636,7 @@ (f32.const 7.888609052210118e-31) (f32.const 7.888609052210118e-31) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22640,8 +22656,8 @@ (f32.const 2.938735877055719e-39) (f32.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -22662,8 +22678,8 @@ (f32.const -2.938735877055719e-39) (f32.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -22683,7 +22699,7 @@ (f32.const 1701411834604692317316873e14) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22703,7 +22719,7 @@ (f64.const 4.535662560676869) (f64.const -1.0585895402489023) (f64.const 0.09766263514757156) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22723,7 +22739,7 @@ (f64.const -8.88799136300345) (f64.const 2.6868734126013067) (f64.const 0.35833948850631714) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22743,7 +22759,7 @@ (f64.const -2.763607337379588) (f64.const -1.889300091849528) (f64.const -0.46235957741737366) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22763,7 +22779,7 @@ (f64.const 4.567535276842744) (f64.const -0.9605469021111489) (f64.const -0.21524477005004883) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22783,7 +22799,7 @@ (f64.const 4.811392084359796) (f64.const 1.0919123946142109) (f64.const 0.3894443213939667) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22803,7 +22819,7 @@ (f64.const 0.6620717923376739) (f64.const -1.468508500616424) (f64.const -0.448591411113739) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22823,7 +22839,7 @@ (f64.const 0.05215452675006225) (f64.const 1.5641600512601268) (f64.const 0.3784842789173126) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22843,7 +22859,7 @@ (f64.const 7.67640268511754) (f64.const -0.10281658910678508) (f64.const -0.13993260264396667) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22863,7 +22879,7 @@ (f64.const 2.0119025790324803) (f64.const 0.29697974004493516) (f64.const 0.44753071665763855) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22883,7 +22899,7 @@ (f64.const 0.03223983060263804) (f64.const -1.5131612053303916) (f64.const 0.39708876609802246) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22923,7 +22939,7 @@ (f64.const -0) (f64.const 3.141592653589793) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22943,7 +22959,7 @@ (f64.const -1) (f64.const 3.141592653589793) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22965,7 +22981,7 @@ ) (f64.const 3.141592653589793) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23045,7 +23061,7 @@ (f64.const -0) (f64.const -3.141592653589793) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23065,7 +23081,7 @@ (f64.const -1) (f64.const -3.141592653589793) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23087,7 +23103,7 @@ ) (f64.const -3.141592653589793) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23147,7 +23163,7 @@ (f64.const 0) (f64.const -1.5707963267948966) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23167,7 +23183,7 @@ (f64.const -0) (f64.const -1.5707963267948966) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23187,7 +23203,7 @@ (f64.const 0) (f64.const 1.5707963267948966) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23207,7 +23223,7 @@ (f64.const -0) (f64.const 1.5707963267948966) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23269,7 +23285,7 @@ ) (f64.const -3.141592653589793) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23291,7 +23307,7 @@ ) (f64.const 3.141592653589793) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23311,7 +23327,7 @@ (f64.const 0) (f64.const 1.5707963267948966) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23333,7 +23349,7 @@ (f64.const 0) (f64.const -1.5707963267948966) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23353,7 +23369,7 @@ (f64.const inf) (f64.const 0.7853981633974483) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23375,7 +23391,7 @@ ) (f64.const 2.356194490192345) (f64.const -0.20682445168495178) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23397,7 +23413,7 @@ (f64.const inf) (f64.const -0.7853981633974483) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23421,7 +23437,7 @@ ) (f64.const -2.356194490192345) (f64.const 0.20682445168495178) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23442,8 +23458,8 @@ (f64.const 1.1125369292536007e-308) (f64.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -23465,8 +23481,8 @@ (f64.const 1.1125369292536007e-308) (f64.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -23488,8 +23504,8 @@ (f64.const 1.668805393880401e-308) (f64.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -23510,7 +23526,7 @@ (f64.const -8988465674311579538646525e283) (f64.const 3.141592653589793) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23530,7 +23546,7 @@ (f32.const 4.535662651062012) (f32.const -1.0585895776748657) (f32.const -0.22352588176727295) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23550,7 +23566,7 @@ (f32.const -8.887990951538086) (f32.const 2.686873435974121) (f32.const 0.09464472532272339) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23570,7 +23586,7 @@ (f32.const -2.7636072635650635) (f32.const -1.8893001079559326) (f32.const -0.21941901743412018) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23590,7 +23606,7 @@ (f32.const 4.567535400390625) (f32.const -0.9605468511581421) (f32.const 0.46015575528144836) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23610,7 +23626,7 @@ (f32.const 4.811392307281494) (f32.const 1.0919123888015747) (f32.const -0.05708503723144531) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23630,7 +23646,7 @@ (f32.const 0.6620717644691467) (f32.const -1.4685084819793701) (f32.const 0.19611206650733948) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23650,7 +23666,7 @@ (f32.const 0.052154526114463806) (f32.const 1.5641601085662842) (f32.const 0.48143187165260315) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23670,7 +23686,7 @@ (f32.const 7.676402568817139) (f32.const -0.10281659662723541) (f32.const -0.4216274917125702) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23690,7 +23706,7 @@ (f32.const 2.0119025707244873) (f32.const 0.29697975516319275) (f32.const 0.2322007566690445) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23710,7 +23726,7 @@ (f32.const 0.03223983198404312) (f32.const -1.5131611824035645) (f32.const 0.16620726883411407) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23750,7 +23766,7 @@ (f32.const -0) (f32.const 3.1415927410125732) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23770,7 +23786,7 @@ (f32.const -1) (f32.const 3.1415927410125732) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23792,7 +23808,7 @@ ) (f32.const 3.1415927410125732) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23872,7 +23888,7 @@ (f32.const -0) (f32.const -3.1415927410125732) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23892,7 +23908,7 @@ (f32.const -1) (f32.const -3.1415927410125732) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23914,7 +23930,7 @@ ) (f32.const -3.1415927410125732) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23974,7 +23990,7 @@ (f32.const 0) (f32.const -1.5707963705062866) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23994,7 +24010,7 @@ (f32.const -0) (f32.const -1.5707963705062866) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24014,7 +24030,7 @@ (f32.const 0) (f32.const 1.5707963705062866) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24034,7 +24050,7 @@ (f32.const -0) (f32.const 1.5707963705062866) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24096,7 +24112,7 @@ ) (f32.const -3.1415927410125732) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24118,7 +24134,7 @@ ) (f32.const 3.1415927410125732) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24138,7 +24154,7 @@ (f32.const 0) (f32.const 1.5707963705062866) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24160,7 +24176,7 @@ (f32.const 0) (f32.const -1.5707963705062866) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24180,7 +24196,7 @@ (f32.const inf) (f32.const 0.7853981852531433) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24202,7 +24218,7 @@ ) (f32.const 2.356194496154785) (f32.const 0.02500828728079796) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24224,7 +24240,7 @@ (f32.const inf) (f32.const -0.7853981852531433) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24248,7 +24264,7 @@ ) (f32.const -2.356194496154785) (f32.const -0.02500828728079796) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24269,8 +24285,8 @@ (f32.const 5.877471754111438e-39) (f32.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -24292,8 +24308,8 @@ (f32.const 5.877471754111438e-39) (f32.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -24313,7 +24329,7 @@ (f64.const -8.06684839057968) (f64.const -2.0055552545020245) (f64.const 0.46667951345443726) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24332,7 +24348,7 @@ (f64.const 4.345239849338305) (f64.const 1.6318162410515635) (f64.const -0.08160271495580673) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24351,7 +24367,7 @@ (f64.const -8.38143342755525) (f64.const -2.031293910673361) (f64.const -0.048101816326379776) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24370,7 +24386,7 @@ (f64.const -6.531673581913484) (f64.const -1.8692820012204925) (f64.const 0.08624018728733063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24389,7 +24405,7 @@ (f64.const 9.267056966972586) (f64.const 2.100457720859702) (f64.const -0.2722989022731781) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24408,7 +24424,7 @@ (f64.const 0.6619858980995045) (f64.const 0.8715311470455973) (f64.const 0.4414918124675751) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24427,7 +24443,7 @@ (f64.const -0.4066039223853553) (f64.const -0.740839030300223) (f64.const 0.016453813761472702) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24446,7 +24462,7 @@ (f64.const 0.5617597462207241) (f64.const 0.8251195400559286) (f64.const 0.30680638551712036) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24465,7 +24481,7 @@ (f64.const 0.7741522965913037) (f64.const 0.9182102478959914) (f64.const 0.06543998420238495) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24484,7 +24500,7 @@ (f64.const -0.6787637026394024) (f64.const -0.8788326906580094) (f64.const -0.2016713172197342) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24697,7 +24713,7 @@ (f32.const -8.066848754882812) (f32.const -2.0055553913116455) (f32.const -0.44719240069389343) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24716,7 +24732,7 @@ (f32.const 4.345239639282227) (f32.const 1.6318162679672241) (f32.const 0.44636252522468567) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24735,7 +24751,7 @@ (f32.const -8.381433486938477) (f32.const -2.0312938690185547) (f32.const 0.19483426213264465) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24754,7 +24770,7 @@ (f32.const -6.531673431396484) (f32.const -1.8692820072174072) (f32.const -0.17075514793395996) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24773,7 +24789,7 @@ (f32.const 9.267057418823242) (f32.const 2.1004576683044434) (f32.const -0.36362043023109436) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24792,7 +24808,7 @@ (f32.const 0.6619858741760254) (f32.const 0.8715311288833618) (f32.const -0.12857209146022797) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24811,7 +24827,7 @@ (f32.const -0.40660393238067627) (f32.const -0.7408390641212463) (f32.const -0.4655757546424866) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24830,7 +24846,7 @@ (f32.const 0.5617597699165344) (f32.const 0.8251195549964905) (f32.const 0.05601907894015312) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24849,7 +24865,7 @@ (f32.const 0.7741522789001465) (f32.const 0.9182102680206299) (f32.const 0.45498204231262207) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24868,7 +24884,7 @@ (f32.const -0.6787636876106262) (f32.const -0.8788326978683472) (f32.const -0.22978967428207397) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25081,7 +25097,7 @@ (f64.const -8.06684839057968) (f64.const -8) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25100,7 +25116,7 @@ (f64.const 4.345239849338305) (f64.const 5) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25119,7 +25135,7 @@ (f64.const -8.38143342755525) (f64.const -8) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25138,7 +25154,7 @@ (f64.const -6.531673581913484) (f64.const -6) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25157,7 +25173,7 @@ (f64.const 9.267056966972586) (f64.const 10) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25176,7 +25192,7 @@ (f64.const 0.6619858980995045) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25195,7 +25211,7 @@ (f64.const -0.4066039223853553) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25214,7 +25230,7 @@ (f64.const 0.5617597462207241) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25233,7 +25249,7 @@ (f64.const 0.7741522965913037) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25252,7 +25268,7 @@ (f64.const -0.6787637026394024) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25408,7 +25424,7 @@ (f64.const 0.5) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25427,7 +25443,7 @@ (f64.const -0.5) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25446,7 +25462,7 @@ (f64.const 1.0000152587890625) (f64.const 2) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25465,7 +25481,7 @@ (f64.const -1.0000152587890625) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25484,7 +25500,7 @@ (f64.const 0.9999923706054688) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25503,7 +25519,7 @@ (f64.const -0.9999923706054688) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25522,7 +25538,7 @@ (f64.const 7.888609052210118e-31) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25541,7 +25557,7 @@ (f64.const -7.888609052210118e-31) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25697,7 +25713,7 @@ (f64.const 0.5) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25716,7 +25732,7 @@ (f64.const -0.5) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25735,7 +25751,7 @@ (f64.const 1.0000152587890625) (f64.const 2) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25754,7 +25770,7 @@ (f64.const -1.0000152587890625) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25773,7 +25789,7 @@ (f64.const 0.9999923706054688) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25792,7 +25808,7 @@ (f64.const -0.9999923706054688) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25811,7 +25827,7 @@ (f64.const 7.888609052210118e-31) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25830,7 +25846,7 @@ (f64.const -7.888609052210118e-31) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25986,7 +26002,7 @@ (f64.const 0.5) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26005,7 +26021,7 @@ (f64.const -0.5) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26024,7 +26040,7 @@ (f64.const 1.0000152587890625) (f64.const 2) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26043,7 +26059,7 @@ (f64.const -1.0000152587890625) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26062,7 +26078,7 @@ (f64.const 0.9999923706054688) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26081,7 +26097,7 @@ (f64.const -0.9999923706054688) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26100,7 +26116,7 @@ (f64.const 7.888609052210118e-31) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26119,7 +26135,7 @@ (f64.const -7.888609052210118e-31) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26138,7 +26154,7 @@ (f32.const -8.066848754882812) (f32.const -8) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26157,7 +26173,7 @@ (f32.const 4.345239639282227) (f32.const 5) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26176,7 +26192,7 @@ (f32.const -8.381433486938477) (f32.const -8) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26195,7 +26211,7 @@ (f32.const -6.531673431396484) (f32.const -6) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26214,7 +26230,7 @@ (f32.const 9.267057418823242) (f32.const 10) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26233,7 +26249,7 @@ (f32.const 0.6619858741760254) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26252,7 +26268,7 @@ (f32.const -0.40660393238067627) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26271,7 +26287,7 @@ (f32.const 0.5617597699165344) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26290,7 +26306,7 @@ (f32.const 0.7741522789001465) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26309,7 +26325,7 @@ (f32.const -0.6787636876106262) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26465,7 +26481,7 @@ (f32.const 0.5) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26484,7 +26500,7 @@ (f32.const -0.5) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26503,7 +26519,7 @@ (f32.const 1.0000152587890625) (f32.const 2) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26522,7 +26538,7 @@ (f32.const -1.0000152587890625) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26541,7 +26557,7 @@ (f32.const 0.9999923706054688) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26560,7 +26576,7 @@ (f32.const -0.9999923706054688) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26579,7 +26595,7 @@ (f32.const 7.888609052210118e-31) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26598,7 +26614,7 @@ (f32.const -7.888609052210118e-31) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26754,7 +26770,7 @@ (f32.const 0.5) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26773,7 +26789,7 @@ (f32.const -0.5) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26792,7 +26808,7 @@ (f32.const 1.0000152587890625) (f32.const 2) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26811,7 +26827,7 @@ (f32.const -1.0000152587890625) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26830,7 +26846,7 @@ (f32.const 0.9999923706054688) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26849,7 +26865,7 @@ (f32.const -0.9999923706054688) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26868,7 +26884,7 @@ (f32.const 7.888609052210118e-31) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26887,7 +26903,7 @@ (f32.const -7.888609052210118e-31) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27043,7 +27059,7 @@ (f32.const 0.5) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27062,7 +27078,7 @@ (f32.const -0.5) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27081,7 +27097,7 @@ (f32.const 1.0000152587890625) (f32.const 2) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27100,7 +27116,7 @@ (f32.const -1.0000152587890625) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27119,7 +27135,7 @@ (f32.const 0.9999923706054688) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27138,7 +27154,7 @@ (f32.const -0.9999923706054688) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27157,7 +27173,7 @@ (f32.const 7.888609052210118e-31) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27176,7 +27192,7 @@ (f32.const -7.888609052210118e-31) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27195,7 +27211,7 @@ (f64.const -8.06684839057968) (f64.const 1593.5209938862329) (f64.const -0.38098856806755066) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27214,7 +27230,7 @@ (f64.const 4.345239849338305) (f64.const 38.56174928426729) (f64.const -0.2712278366088867) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27233,7 +27249,7 @@ (f64.const -8.38143342755525) (f64.const 2182.630979595893) (f64.const 0.0817827582359314) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27252,7 +27268,7 @@ (f64.const -6.531673581913484) (f64.const 343.273849250879) (f64.const -0.429940402507782) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27271,7 +27287,7 @@ (f64.const 9.267056966972586) (f64.const 5291.779170005587) (f64.const -0.1592995822429657) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27290,7 +27306,7 @@ (f64.const 0.6619858980995045) (f64.const 1.2272321957342842) (f64.const 0.23280741274356842) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27309,7 +27325,7 @@ (f64.const -0.4066039223853553) (f64.const 1.083808541871197) (f64.const -0.3960916996002197) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27328,7 +27344,7 @@ (f64.const 0.5617597462207241) (f64.const 1.1619803583175077) (f64.const 0.37748390436172485) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27347,7 +27363,7 @@ (f64.const 0.7741522965913037) (f64.const 1.3149236876276706) (f64.const 0.43587008118629456) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27366,7 +27382,7 @@ (f64.const -0.6787637026394024) (f64.const 1.2393413245934533) (f64.const 0.10201606154441833) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27482,7 +27498,7 @@ (f32.const -8.066848754882812) (f32.const 1593.5216064453125) (f32.const 0.26242581009864807) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27501,7 +27517,7 @@ (f32.const 4.345239639282227) (f32.const 38.56174087524414) (f32.const -0.08168885856866837) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27520,7 +27536,7 @@ (f32.const -8.381433486938477) (f32.const 2182.631103515625) (f32.const -0.02331414446234703) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27539,7 +27555,7 @@ (f32.const -6.531673431396484) (f32.const 343.2738037109375) (f32.const 0.20081493258476257) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27558,7 +27574,7 @@ (f32.const 9.267057418823242) (f32.const 5291.78173828125) (f32.const 0.36286723613739014) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27577,7 +27593,7 @@ (f32.const 0.6619858741760254) (f32.const 1.2272322177886963) (f32.const 0.32777416706085205) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27596,7 +27612,7 @@ (f32.const -0.40660393238067627) (f32.const 1.0838085412979126) (f32.const -0.039848703891038895) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27615,7 +27631,7 @@ (f32.const 0.5617597699165344) (f32.const 1.161980390548706) (f32.const 0.15274477005004883) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27634,7 +27650,7 @@ (f32.const 0.7741522789001465) (f32.const 1.314923644065857) (f32.const -0.2387111485004425) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27653,7 +27669,7 @@ (f32.const -0.6787636876106262) (f32.const 1.2393412590026855) (f32.const -0.45791932940483093) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27769,7 +27785,7 @@ (f64.const -8.06684839057968) (f64.const 3.137706068161745e-04) (f64.const -0.2599197328090668) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27788,7 +27804,7 @@ (f64.const 4.345239849338305) (f64.const 77.11053017112141) (f64.const -0.02792675793170929) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27807,7 +27823,7 @@ (f64.const -8.38143342755525) (f64.const 2.290813384916323e-04) (f64.const -0.24974334239959717) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27826,7 +27842,7 @@ (f64.const -6.531673581913484) (f64.const 1.4565661260931588e-03) (f64.const -0.4816822409629822) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27845,7 +27861,7 @@ (f64.const 9.267056966972586) (f64.const 10583.558245524993) (f64.const 0.17696762084960938) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27864,7 +27880,7 @@ (f64.const 0.6619858980995045) (f64.const 1.9386384525571998) (f64.const -0.4964246451854706) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27883,7 +27899,7 @@ (f64.const -0.4066039223853553) (f64.const 0.6659078892838025) (f64.const -0.10608318448066711) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27902,7 +27918,7 @@ (f64.const 0.5617597462207241) (f64.const 1.7537559518626311) (f64.const -0.39162111282348633) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27921,7 +27937,7 @@ (f64.const 0.7741522965913037) (f64.const 2.1687528885129246) (f64.const -0.2996125817298889) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27940,7 +27956,7 @@ (f64.const -0.6787637026394024) (f64.const 0.5072437089402843) (f64.const 0.47261738777160645) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27997,7 +28013,7 @@ (f64.const 1) (f64.const 2.718281828459045) (f64.const -0.3255307376384735) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28016,7 +28032,7 @@ (f64.const -1) (f64.const 0.36787944117144233) (f64.const 0.22389651834964752) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28094,7 +28110,7 @@ (f64.const 1.0397214889526365) (f64.const 2.828429155876411) (f64.const 0.18803080916404724) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28113,7 +28129,7 @@ (f64.const -1.0397214889526365) (f64.const 0.35355313670217847) (f64.const 0.2527272403240204) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28132,7 +28148,7 @@ (f64.const 1.0397210121154785) (f64.const 2.8284278071766122) (f64.const -0.4184139370918274) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28151,7 +28167,7 @@ (f64.const 1.0397214889526367) (f64.const 2.8284291558764116) (f64.const -0.22618377208709717) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28170,7 +28186,7 @@ (f32.const -8.066848754882812) (f32.const 3.1377049162983894e-04) (f32.const -0.030193336308002472) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28189,7 +28205,7 @@ (f32.const 4.345239639282227) (f32.const 77.11051177978516) (f32.const -0.2875460684299469) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28208,7 +28224,7 @@ (f32.const -8.381433486938477) (f32.const 2.2908132814336568e-04) (f32.const 0.2237040400505066) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28227,7 +28243,7 @@ (f32.const -6.531673431396484) (f32.const 1.4565663877874613e-03) (f32.const 0.36469703912734985) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28246,7 +28262,7 @@ (f32.const 9.267057418823242) (f32.const 10583.5634765625) (f32.const 0.45962104201316833) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28265,7 +28281,7 @@ (f32.const 0.6619858741760254) (f32.const 1.93863844871521) (f32.const 0.3568260967731476) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28284,7 +28300,7 @@ (f32.const -0.40660393238067627) (f32.const 0.6659078598022461) (f32.const -0.38294991850852966) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28303,7 +28319,7 @@ (f32.const 0.5617597699165344) (f32.const 1.753756046295166) (f32.const 0.44355490803718567) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28322,7 +28338,7 @@ (f32.const 0.7741522789001465) (f32.const 2.168752908706665) (f32.const 0.24562469124794006) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28341,7 +28357,7 @@ (f32.const -0.6787636876106262) (f32.const 0.5072436928749084) (f32.const -0.3974292278289795) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28398,7 +28414,7 @@ (f32.const 1) (f32.const 2.7182817459106445) (f32.const -0.3462330996990204) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28417,7 +28433,7 @@ (f32.const -1) (f32.const 0.3678794503211975) (f32.const 0.3070148527622223) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28495,7 +28511,7 @@ (f32.const 88.72283172607422) (f32.const 340279851902147610656242e15) (f32.const -0.09067153930664062) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28515,8 +28531,8 @@ (f32.const inf) (f32.const 0) (i32.or - (i32.const 1) - (i32.const 16) + (get_global $std/math/INEXACT) + (get_global $std/math/OVERFLOW) ) ) ) @@ -28537,8 +28553,8 @@ (f32.const 1.401298464324817e-45) (f32.const 0.49999967217445374) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -28559,8 +28575,8 @@ (f32.const 0) (f32.const -0.49999651312828064) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -28580,7 +28596,7 @@ (f32.const 0.3465735614299774) (f32.const 1.4142135381698608) (f32.const 0.13922421634197235) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28599,7 +28615,7 @@ (f32.const 0.3465735912322998) (f32.const 1.4142135381698608) (f32.const -0.21432916820049286) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28618,7 +28634,7 @@ (f32.const 0.3465736210346222) (f32.const 1.4142136573791504) (f32.const 0.43211743235588074) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28637,7 +28653,7 @@ (f64.const -8.06684839057968) (f64.const -0.9996862293931839) (f64.const -0.2760058343410492) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28656,7 +28672,7 @@ (f64.const 4.345239849338305) (f64.const 76.11053017112141) (f64.const -0.02792675793170929) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28675,7 +28691,7 @@ (f64.const -8.38143342755525) (f64.const -0.9997709186615084) (f64.const 0.10052496194839478) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28694,7 +28710,7 @@ (f64.const -6.531673581913484) (f64.const -0.9985434338739069) (f64.const -0.27437829971313477) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28713,7 +28729,7 @@ (f64.const 9.267056966972586) (f64.const 10582.558245524993) (f64.const 0.17696762084960938) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28732,7 +28748,7 @@ (f64.const 0.6619858980995045) (f64.const 0.9386384525571999) (f64.const 0.007150684483349323) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28751,7 +28767,7 @@ (f64.const -0.4066039223853553) (f64.const -0.3340921107161975) (f64.const -0.21216636896133423) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28770,7 +28786,7 @@ (f64.const 0.5617597462207241) (f64.const 0.7537559518626312) (f64.const 0.21675777435302734) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28789,7 +28805,7 @@ (f64.const 0.7741522965913037) (f64.const 1.1687528885129248) (f64.const 0.4007748067378998) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28808,7 +28824,7 @@ (f64.const -0.6787637026394024) (f64.const -0.4927562910597158) (f64.const -0.05476519837975502) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28865,7 +28881,7 @@ (f64.const 1) (f64.const 1.7182818284590453) (f64.const 0.348938524723053) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28884,7 +28900,7 @@ (f64.const -1) (f64.const -0.6321205588285577) (f64.const 0.11194825917482376) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28963,8 +28979,8 @@ (f64.const 2.225073858507201e-308) (f64.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -28985,8 +29001,8 @@ (f64.const -2.225073858507201e-308) (f64.const 0) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -29006,7 +29022,7 @@ (f32.const -8.066848754882812) (f32.const -0.9996862411499023) (f32.const -0.19532723724842072) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29025,7 +29041,7 @@ (f32.const 4.345239639282227) (f32.const 76.11051177978516) (f32.const -0.2875460684299469) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29044,7 +29060,7 @@ (f32.const -8.381433486938477) (f32.const -0.9997709393501282) (f32.const -0.34686920046806335) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29063,7 +29079,7 @@ (f32.const -6.531673431396484) (f32.const -0.9985434412956238) (f32.const -0.1281939446926117) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29082,7 +29098,7 @@ (f32.const 9.267057418823242) (f32.const 10582.5634765625) (f32.const 0.45962104201316833) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29101,7 +29117,7 @@ (f32.const 0.6619858741760254) (f32.const 0.9386383891105652) (f32.const -0.28634780645370483) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29120,7 +29136,7 @@ (f32.const -0.40660393238067627) (f32.const -0.3340921103954315) (f32.const 0.23410017788410187) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29139,7 +29155,7 @@ (f32.const 0.5617597699165344) (f32.const 0.7537559866905212) (f32.const -0.11289017647504807) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29158,7 +29174,7 @@ (f32.const 0.7741522789001465) (f32.const 1.168752908706665) (f32.const 0.4912493824958801) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29177,7 +29193,7 @@ (f32.const -0.6787636876106262) (f32.const -0.49275627732276917) (f32.const 0.20514154434204102) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29234,7 +29250,7 @@ (f32.const 1) (f32.const 1.718281865119934) (f32.const 0.3075338304042816) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29253,7 +29269,7 @@ (f32.const -1) (f32.const -0.6321205496788025) (f32.const 0.15350742638111115) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29331,7 +29347,7 @@ (f64.const -8.06684839057968) (f64.const -9) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29350,7 +29366,7 @@ (f64.const 4.345239849338305) (f64.const 4) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29369,7 +29385,7 @@ (f64.const -8.38143342755525) (f64.const -9) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29388,7 +29404,7 @@ (f64.const -6.531673581913484) (f64.const -7) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29407,7 +29423,7 @@ (f64.const 9.267056966972586) (f64.const 9) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29426,7 +29442,7 @@ (f64.const 0.6619858980995045) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29445,7 +29461,7 @@ (f64.const -0.4066039223853553) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29464,7 +29480,7 @@ (f64.const 0.5617597462207241) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29483,7 +29499,7 @@ (f64.const 0.7741522965913037) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29502,7 +29518,7 @@ (f64.const -0.6787637026394024) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29658,7 +29674,7 @@ (f64.const 0.5) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29677,7 +29693,7 @@ (f64.const -0.5) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29696,7 +29712,7 @@ (f64.const 1.0000152587890625) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29715,7 +29731,7 @@ (f64.const -1.0000152587890625) (f64.const -2) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29734,7 +29750,7 @@ (f64.const 0.9999923706054688) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29753,7 +29769,7 @@ (f64.const -0.9999923706054688) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29772,7 +29788,7 @@ (f64.const 7.888609052210118e-31) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29791,7 +29807,7 @@ (f64.const -7.888609052210118e-31) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29810,7 +29826,7 @@ (f32.const -8.066848754882812) (f32.const -9) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29829,7 +29845,7 @@ (f32.const 4.345239639282227) (f32.const 4) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29848,7 +29864,7 @@ (f32.const -8.381433486938477) (f32.const -9) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29867,7 +29883,7 @@ (f32.const -6.531673431396484) (f32.const -7) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29886,7 +29902,7 @@ (f32.const 9.267057418823242) (f32.const 9) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29905,7 +29921,7 @@ (f32.const 0.6619858741760254) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29924,7 +29940,7 @@ (f32.const -0.40660393238067627) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29943,7 +29959,7 @@ (f32.const 0.5617597699165344) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29962,7 +29978,7 @@ (f32.const 0.7741522789001465) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29981,7 +29997,7 @@ (f32.const -0.6787636876106262) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30137,7 +30153,7 @@ (f32.const 0.5) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30156,7 +30172,7 @@ (f32.const -0.5) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30175,7 +30191,7 @@ (f32.const 1.0000152587890625) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30194,7 +30210,7 @@ (f32.const -1.0000152587890625) (f32.const -2) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30213,7 +30229,7 @@ (f32.const 0.9999923706054688) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30232,7 +30248,7 @@ (f32.const -0.9999923706054688) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30251,7 +30267,7 @@ (f32.const 7.888609052210118e-31) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30270,7 +30286,7 @@ (f32.const -7.888609052210118e-31) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30290,7 +30306,7 @@ (f64.const 4.535662560676869) (f64.const 9.25452742288464) (f64.const -0.31188681721687317) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30310,7 +30326,7 @@ (f64.const -8.88799136300345) (f64.const 9.893305808328252) (f64.const 0.4593673348426819) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30330,7 +30346,7 @@ (f64.const -2.763607337379588) (f64.const 8.825301797432132) (f64.const -0.1701754331588745) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30350,7 +30366,7 @@ (f64.const 4.567535276842744) (f64.const 7.970265885519092) (f64.const -0.3176782727241516) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30370,7 +30386,7 @@ (f64.const 4.811392084359796) (f64.const 10.441639651824575) (f64.const -0.2693633437156677) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30390,7 +30406,7 @@ (f64.const 0.6620717923376739) (f64.const 6.483936052542593) (f64.const 0.35618898272514343) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30410,7 +30426,7 @@ (f64.const 0.05215452675006225) (f64.const 7.859063309581766) (f64.const 0.08044655621051788) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30430,7 +30446,7 @@ (f64.const 7.67640268511754) (f64.const 7.717156764899584) (f64.const 0.05178084969520569) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30450,7 +30466,7 @@ (f64.const 2.0119025790324803) (f64.const 2.104006123874314) (f64.const -0.0918039008975029) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30470,7 +30486,7 @@ (f64.const 0.03223983060263804) (f64.const 0.5596880129062913) (f64.const 0.1383407711982727) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30878,7 +30894,7 @@ (f32.const 4.535662651062012) (f32.const 9.254528045654297) (f32.const 0.2735958993434906) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30898,7 +30914,7 @@ (f32.const -8.887990951538086) (f32.const 9.893305778503418) (f32.const 0.4530770778656006) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30918,7 +30934,7 @@ (f32.const -2.7636072635650635) (f32.const 8.825302124023438) (f32.const 0.30755728483200073) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30938,7 +30954,7 @@ (f32.const 4.567535400390625) (f32.const 7.970265865325928) (f32.const 0.06785223633050919) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30958,7 +30974,7 @@ (f32.const 4.811392307281494) (f32.const 10.44163990020752) (f32.const -0.26776307821273804) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30978,7 +30994,7 @@ (f32.const 0.6620717644691467) (f32.const 6.483936309814453) (f32.const 0.48381292819976807) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30998,7 +31014,7 @@ (f32.const 0.052154526114463806) (f32.const 7.859063148498535) (f32.const 0.07413065433502197) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31018,7 +31034,7 @@ (f32.const 7.676402568817139) (f32.const 7.717156887054443) (f32.const 0.4940592646598816) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31038,7 +31054,7 @@ (f32.const 2.0119025707244873) (f32.const 2.104006052017212) (f32.const -0.287089467048645) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31058,7 +31074,7 @@ (f32.const 0.03223983198404312) (f32.const 0.5596880316734314) (f32.const 0.4191940724849701) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31465,7 +31481,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31484,7 +31500,7 @@ (f64.const 4.345239849338305) (f64.const 1.4690809584224322) (f64.const -0.3412533402442932) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31503,7 +31519,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31522,7 +31538,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31541,7 +31557,7 @@ (f64.const 9.267056966972586) (f64.const 2.2264658498795615) (f64.const 0.3638114035129547) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31560,7 +31576,7 @@ (f64.const 0.6619858980995045) (f64.const -0.4125110252365137) (f64.const -0.29108747839927673) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31579,7 +31595,7 @@ (f64.const -0.4066039223853553) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31598,7 +31614,7 @@ (f64.const 0.5617597462207241) (f64.const -0.5766810183195862) (f64.const -0.10983199626207352) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31617,7 +31633,7 @@ (f64.const 0.7741522965913037) (f64.const -0.2559866591263865) (f64.const -0.057990044355392456) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31636,7 +31652,7 @@ (f64.const -0.6787637026394024) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31657,7 +31673,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -31678,7 +31694,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -31697,7 +31713,7 @@ (f64.const -7.888609052210118e-31) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31735,7 +31751,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31775,7 +31791,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31815,7 +31831,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -31836,7 +31852,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -31855,7 +31871,7 @@ (f32.const -7.888609052210118e-31) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31893,7 +31909,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31933,7 +31949,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31973,7 +31989,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -31994,7 +32010,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -32013,7 +32029,7 @@ (f32.const -7.888609052210118e-31) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32051,7 +32067,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32091,7 +32107,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32129,7 +32145,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32148,7 +32164,7 @@ (f64.const 4.345239849338305) (f64.const 0.6380137537120029) (f64.const -0.2088824063539505) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32167,7 +32183,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32186,7 +32202,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32205,7 +32221,7 @@ (f64.const 9.267056966972586) (f64.const 0.9669418327487274) (f64.const -0.06120431795716286) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32224,7 +32240,7 @@ (f64.const 0.6619858980995045) (f64.const -0.17915126198447093) (f64.const 0.39090874791145325) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32243,7 +32259,7 @@ (f64.const -0.4066039223853553) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32262,7 +32278,7 @@ (f64.const 0.5617597462207241) (f64.const -0.25044938407454437) (f64.const -0.3046841621398926) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32281,7 +32297,7 @@ (f64.const 0.7741522965913037) (f64.const -0.11117359349943837) (f64.const -0.31503361463546753) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32300,7 +32316,7 @@ (f64.const -0.6787637026394024) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32321,7 +32337,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -32342,7 +32358,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -32361,7 +32377,7 @@ (f64.const -7.888609052210118e-31) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32399,7 +32415,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32439,7 +32455,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32477,7 +32493,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32496,7 +32512,7 @@ (f32.const 4.345239639282227) (f32.const 0.6380137205123901) (f32.const -0.20476758480072021) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32515,7 +32531,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32534,7 +32550,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32553,7 +32569,7 @@ (f32.const 9.267057418823242) (f32.const 0.9669418334960938) (f32.const -0.34273025393486023) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32572,7 +32588,7 @@ (f32.const 0.6619858741760254) (f32.const -0.1791512817144394) (f32.const -0.27078554034233093) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32591,7 +32607,7 @@ (f32.const -0.40660393238067627) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32610,7 +32626,7 @@ (f32.const 0.5617597699165344) (f32.const -0.25044935941696167) (f32.const 0.2126826047897339) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32629,7 +32645,7 @@ (f32.const 0.7741522789001465) (f32.const -0.1111735999584198) (f32.const 0.46515095233917236) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32648,7 +32664,7 @@ (f32.const -0.6787636876106262) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32669,7 +32685,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -32690,7 +32706,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -32709,7 +32725,7 @@ (f32.const -7.888609052210118e-31) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32747,7 +32763,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32787,7 +32803,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32825,7 +32841,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32844,7 +32860,7 @@ (f64.const 4.345239849338305) (f64.const 1.6762064170601734) (f64.const 0.46188199520111084) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32863,7 +32879,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32882,7 +32898,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32901,7 +32917,7 @@ (f64.const 9.267056966972586) (f64.const 2.3289404168523826) (f64.const -0.411114901304245) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32920,7 +32936,7 @@ (f64.const 0.6619858980995045) (f64.const 0.5080132114992477) (f64.const -0.29306045174598694) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32939,7 +32955,7 @@ (f64.const -0.4066039223853553) (f64.const -0.5218931811663979) (f64.const -0.25825726985931396) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32958,7 +32974,7 @@ (f64.const 0.5617597462207241) (f64.const 0.4458132279488102) (f64.const -0.13274887204170227) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32977,7 +32993,7 @@ (f64.const 0.7741522965913037) (f64.const 0.5733227294648414) (f64.const 0.02716583013534546) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32996,7 +33012,7 @@ (f64.const -0.6787637026394024) (f64.const -1.1355782978128564) (f64.const 0.2713092863559723) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33053,7 +33069,7 @@ (f64.const -7.888609052210118e-31) (f64.const -7.888609052210118e-31) (f64.const 1.7763568394002505e-15) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33072,7 +33088,7 @@ (f64.const 1) (f64.const 0.6931471805599453) (f64.const -0.2088811695575714) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33093,7 +33109,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -33133,7 +33149,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33171,7 +33187,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33190,7 +33206,7 @@ (f32.const 4.345239639282227) (f32.const 1.676206350326538) (f32.const -0.23014859855175018) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33209,7 +33225,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33228,7 +33244,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33247,7 +33263,7 @@ (f32.const 9.267057418823242) (f32.const 2.3289403915405273) (f32.const -0.29075589776039124) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33266,7 +33282,7 @@ (f32.const 0.6619858741760254) (f32.const 0.5080131888389587) (f32.const -0.1386766880750656) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33285,7 +33301,7 @@ (f32.const -0.40660393238067627) (f32.const -0.5218932032585144) (f32.const -0.08804433047771454) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33304,7 +33320,7 @@ (f32.const 0.5617597699165344) (f32.const 0.44581323862075806) (f32.const -0.15101368725299835) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33323,7 +33339,7 @@ (f32.const 0.7741522789001465) (f32.const 0.5733227133750916) (f32.const -0.10264533013105392) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33342,7 +33358,7 @@ (f32.const -0.6787636876106262) (f32.const -1.1355782747268677) (f32.const -0.19879481196403503) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33399,7 +33415,7 @@ (f32.const -7.888609052210118e-31) (f32.const -7.888609052210118e-31) (f32.const 3.308722450212111e-24) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33418,7 +33434,7 @@ (f32.const 1) (f32.const 0.6931471824645996) (f32.const 0.031954795122146606) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33439,7 +33455,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -33479,7 +33495,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33518,8 +33534,8 @@ (f32.const -1.1754942106924411e-38) (f32.const 4.930380657631324e-32) (i32.or - (i32.const 1) - (i32.const 8) + (get_global $std/math/INEXACT) + (get_global $std/math/UNDERFLOW) ) ) ) @@ -33539,7 +33555,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33558,7 +33574,7 @@ (f64.const 4.345239849338305) (f64.const 2.1194358133804485) (f64.const -0.10164877772331238) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33577,7 +33593,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33596,7 +33612,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33615,7 +33631,7 @@ (f64.const 9.267056966972586) (f64.const 3.2121112403298744) (f64.const -0.15739446878433228) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33634,7 +33650,7 @@ (f64.const 0.6619858980995045) (f64.const -0.5951276104207402) (f64.const 0.3321485221385956) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33653,7 +33669,7 @@ (f64.const -0.4066039223853553) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33672,7 +33688,7 @@ (f64.const 0.5617597462207241) (f64.const -0.8319748453044644) (f64.const 0.057555437088012695) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33691,7 +33707,7 @@ (f64.const 0.7741522965913037) (f64.const -0.36931068365537134) (f64.const -0.19838279485702515) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33710,7 +33726,7 @@ (f64.const -0.6787637026394024) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33731,7 +33747,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -33752,7 +33768,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -33771,7 +33787,7 @@ (f64.const -7.888609052210118e-31) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33809,7 +33825,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33849,7 +33865,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33887,7 +33903,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33906,7 +33922,7 @@ (f32.const 4.345239639282227) (f32.const 2.1194357872009277) (f32.const 0.18271538615226746) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33925,7 +33941,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33944,7 +33960,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33963,7 +33979,7 @@ (f32.const 9.267057418823242) (f32.const 3.212111234664917) (f32.const -0.3188050389289856) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33982,7 +33998,7 @@ (f32.const 0.6619858741760254) (f32.const -0.5951276421546936) (f32.const 0.34231460094451904) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -34001,7 +34017,7 @@ (f32.const -0.40660393238067627) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -34020,7 +34036,7 @@ (f32.const 0.5617597699165344) (f32.const -0.8319748044013977) (f32.const -0.33473604917526245) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -34039,7 +34055,7 @@ (f32.const 0.7741522789001465) (f32.const -0.3693107068538666) (f32.const 0.3278401792049408) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -34058,7 +34074,7 @@ (f32.const -0.6787636876106262) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -34079,7 +34095,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -34100,7 +34116,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -34119,7 +34135,7 @@ (f32.const -7.888609052210118e-31) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -34157,7 +34173,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -34197,7 +34213,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40252,7 +40268,7 @@ (f64.const 1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40274,7 +40290,7 @@ (f64.const 1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40514,7 +40530,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40536,7 +40552,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40576,7 +40592,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40596,7 +40612,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40678,7 +40694,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40698,7 +40714,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40780,7 +40796,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40800,7 +40816,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40820,7 +40836,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40842,7 +40858,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40882,7 +40898,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40902,7 +40918,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40924,7 +40940,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40964,7 +40980,7 @@ (f64.const 2) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40984,7 +41000,7 @@ (f64.const -0.5) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41026,7 +41042,7 @@ (f64.const 2) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41048,7 +41064,7 @@ (f64.const -0.5) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41190,7 +41206,7 @@ (f64.const inf) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41212,7 +41228,7 @@ (f64.const inf) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41278,7 +41294,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41302,7 +41318,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41802,7 +41818,7 @@ (f32.const 1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41824,7 +41840,7 @@ (f32.const 1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42064,7 +42080,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42086,7 +42102,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42126,7 +42142,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42146,7 +42162,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42228,7 +42244,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42248,7 +42264,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42330,7 +42346,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42350,7 +42366,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42370,7 +42386,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42392,7 +42408,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42432,7 +42448,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42452,7 +42468,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42474,7 +42490,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42514,7 +42530,7 @@ (f32.const 2) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42534,7 +42550,7 @@ (f32.const -0.5) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42576,7 +42592,7 @@ (f32.const 2) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42598,7 +42614,7 @@ (f32.const -0.5) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42740,7 +42756,7 @@ (f32.const inf) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42762,7 +42778,7 @@ (f32.const inf) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42828,7 +42844,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42852,7 +42868,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42952,7 +42968,7 @@ (f64.const 4.535662560676869) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42972,7 +42988,7 @@ (f64.const -8.88799136300345) (f64.const 2.1347118825587285e-06) (f64.const 0.3250160217285156) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -42992,7 +43008,7 @@ (f64.const -2.763607337379588) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -43012,7 +43028,7 @@ (f64.const 4.567535276842744) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -43032,7 +43048,7 @@ (f64.const 4.811392084359796) (f64.const 44909.29941512966) (f64.const -0.26659080386161804) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -43052,7 +43068,7 @@ (f64.const 0.6620717923376739) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -43072,7 +43088,7 @@ (f64.const 0.05215452675006225) (f64.const 1.1135177413458652) (f64.const -0.37168607115745544) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -43092,7 +43108,7 @@ (f64.const 7.67640268511754) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -43112,7 +43128,7 @@ (f64.const 2.0119025790324803) (f64.const 0.37690773521380183) (f64.const 0.32473301887512207) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -43132,7 +43148,7 @@ (f64.const 0.03223983060263804) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -43312,7 +43328,7 @@ (f64.const -0.5) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43332,7 +43348,7 @@ (f64.const -1) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43352,7 +43368,7 @@ (f64.const -2) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43372,7 +43388,7 @@ (f64.const -3) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43392,7 +43408,7 @@ (f64.const -4) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43594,7 +43610,7 @@ (f64.const -0.5) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43616,7 +43632,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43636,7 +43652,7 @@ (f64.const -2) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43658,7 +43674,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43678,7 +43694,7 @@ (f64.const -4) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -44106,7 +44122,7 @@ (f64.const 0.5) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -44268,7 +44284,7 @@ (f64.const 0.5) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -44288,7 +44304,7 @@ (f64.const 1.5) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -45042,7 +45058,7 @@ (f32.const 4.535662651062012) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -45062,7 +45078,7 @@ (f32.const -8.887990951538086) (f32.const 2.134714122803416e-06) (f32.const 0.1436440795660019) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -45082,7 +45098,7 @@ (f32.const -2.7636072635650635) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -45102,7 +45118,7 @@ (f32.const 4.567535400390625) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -45122,7 +45138,7 @@ (f32.const 4.811392307281494) (f32.const 44909.33203125) (f32.const -0.05356409028172493) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -45142,7 +45158,7 @@ (f32.const 0.6620717644691467) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -45162,7 +45178,7 @@ (f32.const 0.052154526114463806) (f32.const 1.1135177612304688) (f32.const 0.19122089445590973) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -45182,7 +45198,7 @@ (f32.const 7.676402568817139) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -45202,7 +45218,7 @@ (f32.const 2.0119025707244873) (f32.const 0.3769077658653259) (f32.const 0.337149053812027) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -45222,7 +45238,7 @@ (f32.const 0.03223983198404312) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -45402,7 +45418,7 @@ (f32.const -0.5) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45422,7 +45438,7 @@ (f32.const -1) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45442,7 +45458,7 @@ (f32.const -2) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45462,7 +45478,7 @@ (f32.const -3) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45482,7 +45498,7 @@ (f32.const -4) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45684,7 +45700,7 @@ (f32.const -0.5) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45706,7 +45722,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45726,7 +45742,7 @@ (f32.const -2) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45748,7 +45764,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45768,7 +45784,7 @@ (f32.const -4) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -46196,7 +46212,7 @@ (f32.const 0.5) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -46358,7 +46374,7 @@ (f32.const 0.5) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -46378,7 +46394,7 @@ (f32.const 1.5) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -47256,7 +47272,7 @@ (f64.const -8.06684839057968) (f64.const -8) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47275,7 +47291,7 @@ (f64.const 4.345239849338305) (f64.const 4) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47294,7 +47310,7 @@ (f64.const -8.38143342755525) (f64.const -8) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47313,7 +47329,7 @@ (f64.const -6.531673581913484) (f64.const -7) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47332,7 +47348,7 @@ (f64.const 9.267056966972586) (f64.const 9) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47351,7 +47367,7 @@ (f64.const 0.6619858980995045) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47370,7 +47386,7 @@ (f64.const -0.4066039223853553) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47389,7 +47405,7 @@ (f64.const 0.5617597462207241) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47408,7 +47424,7 @@ (f64.const 0.7741522965913037) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47427,7 +47443,7 @@ (f64.const -0.6787637026394024) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47583,7 +47599,7 @@ (f64.const 0.5) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47602,7 +47618,7 @@ (f64.const -0.5) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47621,7 +47637,7 @@ (f64.const 1.5) (f64.const 2) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47640,7 +47656,7 @@ (f64.const -1.5) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47659,7 +47675,7 @@ (f64.const 1.0000152587890625) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47678,7 +47694,7 @@ (f64.const -1.0000152587890625) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47697,7 +47713,7 @@ (f64.const 0.9999923706054688) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47716,7 +47732,7 @@ (f64.const -0.9999923706054688) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47735,7 +47751,7 @@ (f64.const 7.888609052210118e-31) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47754,7 +47770,7 @@ (f64.const -7.888609052210118e-31) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47773,7 +47789,7 @@ (f32.const -8.066848754882812) (f32.const -8) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47792,7 +47808,7 @@ (f32.const 4.345239639282227) (f32.const 4) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47811,7 +47827,7 @@ (f32.const -8.381433486938477) (f32.const -8) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47830,7 +47846,7 @@ (f32.const -6.531673431396484) (f32.const -7) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47849,7 +47865,7 @@ (f32.const 9.267057418823242) (f32.const 9) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47868,7 +47884,7 @@ (f32.const 0.6619858741760254) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47887,7 +47903,7 @@ (f32.const -0.40660393238067627) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47906,7 +47922,7 @@ (f32.const 0.5617597699165344) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47925,7 +47941,7 @@ (f32.const 0.7741522789001465) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47944,7 +47960,7 @@ (f32.const -0.6787636876106262) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48100,7 +48116,7 @@ (f32.const 0.5) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48119,7 +48135,7 @@ (f32.const -0.5) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48138,7 +48154,7 @@ (f64.const 1.5) (f64.const 2) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48157,7 +48173,7 @@ (f64.const -1.5) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48176,7 +48192,7 @@ (f32.const 1.0000152587890625) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48195,7 +48211,7 @@ (f32.const -1.0000152587890625) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48214,7 +48230,7 @@ (f32.const 0.9999923706054688) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48233,7 +48249,7 @@ (f32.const -0.9999923706054688) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48252,7 +48268,7 @@ (f32.const 7.888609052210118e-31) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48271,7 +48287,7 @@ (f32.const -7.888609052210118e-31) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -49037,7 +49053,7 @@ (f64.const 1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49059,7 +49075,7 @@ (f64.const 1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49299,7 +49315,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49321,7 +49337,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49361,7 +49377,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49381,7 +49397,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49463,7 +49479,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49483,7 +49499,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49565,7 +49581,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49585,7 +49601,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49605,7 +49621,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49627,7 +49643,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49667,7 +49683,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49687,7 +49703,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49709,7 +49725,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49749,7 +49765,7 @@ (f64.const 2) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49769,7 +49785,7 @@ (f64.const -0.5) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49811,7 +49827,7 @@ (f64.const 2) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49833,7 +49849,7 @@ (f64.const -0.5) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49975,7 +49991,7 @@ (f64.const inf) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49997,7 +50013,7 @@ (f64.const inf) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50063,7 +50079,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50087,7 +50103,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50607,7 +50623,7 @@ (f32.const 1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50629,7 +50645,7 @@ (f32.const 1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50869,7 +50885,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50891,7 +50907,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50931,7 +50947,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50951,7 +50967,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51033,7 +51049,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51053,7 +51069,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51135,7 +51151,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51155,7 +51171,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51175,7 +51191,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51197,7 +51213,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51237,7 +51253,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51257,7 +51273,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51279,7 +51295,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51319,7 +51335,7 @@ (f32.const 2) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51339,7 +51355,7 @@ (f32.const -0.5) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51381,7 +51397,7 @@ (f32.const 2) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51403,7 +51419,7 @@ (f32.const -0.5) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51545,7 +51561,7 @@ (f32.const inf) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51567,7 +51583,7 @@ (f32.const inf) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51633,7 +51649,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51657,7 +51673,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51776,7 +51792,7 @@ (f64.const -8.06684839057968) (f64.const -1593.5206801156262) (f64.const -0.2138727605342865) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51795,7 +51811,7 @@ (f64.const 4.345239849338305) (f64.const 38.54878088685412) (f64.const 0.21537430584430695) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51814,7 +51830,7 @@ (f64.const -8.38143342755525) (f64.const -2182.6307505145546) (f64.const 0.16213826835155487) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51833,7 +51849,7 @@ (f64.const -6.531673581913484) (f64.const -343.2723926847529) (f64.const 0.20479513704776764) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51852,7 +51868,7 @@ (f64.const 9.267056966972586) (f64.const 5291.7790755194055) (f64.const -0.48676517605781555) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51871,7 +51887,7 @@ (f64.const 0.6619858980995045) (f64.const 0.7114062568229157) (f64.const -0.4584641456604004) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51890,7 +51906,7 @@ (f64.const -0.4066039223853553) (f64.const -0.41790065258739445) (f64.const 0.37220045924186707) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51909,7 +51925,7 @@ (f64.const 0.5617597462207241) (f64.const 0.5917755935451237) (f64.const 0.46178996562957764) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51928,7 +51944,7 @@ (f64.const 0.7741522965913037) (f64.const 0.8538292008852542) (f64.const -0.07019051909446716) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51947,7 +51963,7 @@ (f64.const -0.6787637026394024) (f64.const -0.732097615653169) (f64.const 0.26858529448509216) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52065,7 +52081,7 @@ (f32.const -8.066848754882812) (f32.const -1593.521240234375) (f32.const 0.1671663224697113) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52084,7 +52100,7 @@ (f32.const 4.345239639282227) (f32.const 38.548770904541016) (f32.const -0.49340328574180603) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52103,7 +52119,7 @@ (f32.const -8.381433486938477) (f32.const -2182.630859375) (f32.const 0.0849970355629921) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52122,7 +52138,7 @@ (f32.const -6.531673431396484) (f32.const -343.2723388671875) (f32.const 0.0704190656542778) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52141,7 +52157,7 @@ (f32.const 9.267057418823242) (f32.const 5291.78125) (f32.const -0.44362515211105347) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52160,7 +52176,7 @@ (f32.const 0.6619858741760254) (f32.const 0.7114062309265137) (f32.const 0.058103885501623154) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52179,7 +52195,7 @@ (f32.const -0.40660393238067627) (f32.const -0.4179006516933441) (f32.const 0.39349499344825745) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52198,7 +52214,7 @@ (f32.const 0.5617597699165344) (f32.const 0.5917755961418152) (f32.const -0.4183797240257263) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52217,7 +52233,7 @@ (f32.const 0.7741522789001465) (f32.const 0.8538292050361633) (f32.const 0.45992106199264526) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52236,7 +52252,7 @@ (f32.const -0.6787636876106262) (f32.const -0.7320976257324219) (f32.const -0.48159059882164) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52354,7 +52370,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52373,7 +52389,7 @@ (f64.const 4.345239849338305) (f64.const 2.0845238903256313) (f64.const -0.07180261611938477) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52392,7 +52408,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52411,7 +52427,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52430,7 +52446,7 @@ (f64.const 9.267056966972586) (f64.const 3.0441841217266385) (f64.const -0.01546262577176094) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52449,7 +52465,7 @@ (f64.const 0.6619858980995045) (f64.const 0.8136251582267503) (f64.const -0.08618157356977463) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52468,7 +52484,7 @@ (f64.const -0.4066039223853553) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52487,7 +52503,7 @@ (f64.const 0.5617597462207241) (f64.const 0.7495063350104014) (f64.const -0.0981396734714508) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52506,7 +52522,7 @@ (f64.const 0.7741522965913037) (f64.const 0.879859248170583) (f64.const -0.37124353647232056) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52525,7 +52541,7 @@ (f64.const -0.6787637026394024) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52584,7 +52600,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52660,7 +52676,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52698,7 +52714,7 @@ (f64.const 1e-323) (f64.const 3.1434555694052576e-162) (f64.const 0.43537619709968567) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52717,7 +52733,7 @@ (f64.const 1.5e-323) (f64.const 3.849931087076416e-162) (f64.const -0.45194002985954285) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52755,7 +52771,7 @@ (f64.const -5e-324) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52774,7 +52790,7 @@ (f64.const 0.9999999999999999) (f64.const 0.9999999999999999) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52793,7 +52809,7 @@ (f64.const 1.9999999999999998) (f64.const 1.414213562373095) (f64.const -0.21107041835784912) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52812,7 +52828,7 @@ (f64.const 1.0000000000000002) (f64.const 1) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52831,7 +52847,7 @@ (f64.const 2.0000000000000004) (f64.const 1.4142135623730951) (f64.const -0.27173060178756714) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52850,7 +52866,7 @@ (f64.const 1.0000000000000002) (f64.const 1) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52869,7 +52885,7 @@ (f64.const 0.9999999999999999) (f64.const 0.9999999999999999) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52888,7 +52904,7 @@ (f64.const -1797693134862315708145274e284) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52907,7 +52923,7 @@ (f64.const 1797693134862315708145274e284) (f64.const 1340780792994259561100831e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52926,7 +52942,7 @@ (f64.const 179769313486231490980915e285) (f64.const 134078079299425926338769e131) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52945,7 +52961,7 @@ (f64.const 1797693134862314111473026e284) (f64.const 1340780792994258965674548e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52964,7 +52980,7 @@ (f64.const 1797693134862313313136902e284) (f64.const 1340780792994258667961407e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52983,7 +52999,7 @@ (f64.const 1797693134862312514800778e284) (f64.const 1340780792994258370248265e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53002,7 +53018,7 @@ (f64.const 1797693134862311716464655e284) (f64.const 1340780792994258072535124e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53021,7 +53037,7 @@ (f64.const 1797693134862310918128531e284) (f64.const 1340780792994257774821982e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53040,7 +53056,7 @@ (f64.const 1797693134862310119792407e284) (f64.const 1340780792994257477108841e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53059,7 +53075,7 @@ (f64.const 1797693134862309321456283e284) (f64.const 1340780792994257179395699e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53078,7 +53094,7 @@ (f64.const 1797693134862308523120159e284) (f64.const 1340780792994256881682558e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53097,7 +53113,7 @@ (f64.const 1797693134862307724784036e284) (f64.const 1340780792994256583969417e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53116,7 +53132,7 @@ (f64.const 2.225073858507203e-308) (f64.const 1.4916681462400417e-154) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53135,7 +53151,7 @@ (f64.const 2.225073858507205e-308) (f64.const 1.4916681462400423e-154) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53154,7 +53170,7 @@ (f64.const 2.225073858507207e-308) (f64.const 1.491668146240043e-154) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53173,7 +53189,7 @@ (f64.const 2.225073858507209e-308) (f64.const 1.4916681462400437e-154) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53192,7 +53208,7 @@ (f64.const 2.225073858507211e-308) (f64.const 1.4916681462400443e-154) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53211,7 +53227,7 @@ (f64.const 2.2250738585072127e-308) (f64.const 1.491668146240045e-154) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53230,7 +53246,7 @@ (f64.const 2.2250738585072147e-308) (f64.const 1.4916681462400457e-154) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53249,7 +53265,7 @@ (f64.const 2.2250738585072167e-308) (f64.const 1.4916681462400463e-154) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53268,7 +53284,7 @@ (f64.const 2.2250738585072187e-308) (f64.const 1.491668146240047e-154) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53287,7 +53303,7 @@ (f64.const 2.2250738585072207e-308) (f64.const 1.4916681462400476e-154) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53306,7 +53322,7 @@ (f64.const 2.2250738585072226e-308) (f64.const 1.4916681462400483e-154) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53325,7 +53341,7 @@ (f64.const 2.2250738585072246e-308) (f64.const 1.491668146240049e-154) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53344,7 +53360,7 @@ (f64.const 2.2250738585072266e-308) (f64.const 1.4916681462400496e-154) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53363,7 +53379,7 @@ (f64.const 2.2250738585072286e-308) (f64.const 1.4916681462400503e-154) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53382,7 +53398,7 @@ (f64.const 92.35130391890645) (f64.const 9.609958580499006) (f64.const 0.4998137056827545) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53401,7 +53417,7 @@ (f64.const 93.3599596388916) (f64.const 9.662295774757238) (f64.const -0.49979978799819946) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53420,7 +53436,7 @@ (f64.const 95.42049628886124) (f64.const 9.76834153215689) (f64.const -0.49997270107269287) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53439,7 +53455,7 @@ (f64.const 95.87916941885449) (f64.const 9.791790919890728) (f64.const 0.4998766779899597) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53458,7 +53474,7 @@ (f64.const 96.84804174884022) (f64.const 9.841140266698785) (f64.const 0.499801903963089) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53477,7 +53493,7 @@ (f64.const 97.43639050883155) (f64.const 9.87098731175517) (f64.const 0.4997696280479431) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53496,7 +53512,7 @@ (f64.const 97.50957979883047) (f64.const 9.874693909120955) (f64.const 0.49999818205833435) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53515,7 +53531,7 @@ (f64.const 97.80496893882612) (f64.const 9.88963947466368) (f64.const -0.4999580681324005) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53534,7 +53550,7 @@ (f64.const 98.2751822888192) (f64.const 9.913383997849534) (f64.const 0.49979931116104126) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53553,7 +53569,7 @@ (f64.const 99.47293564880155) (f64.const 9.973611966023219) (f64.const -0.4999540448188782) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53572,7 +53588,7 @@ (f64.const 100.57047130878539) (f64.const 10.028483001370914) (f64.const -0.49996453523635864) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53591,7 +53607,7 @@ (f64.const 100.60954608878481) (f64.const 10.030431002144665) (f64.const 0.49975672364234924) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53610,7 +53626,7 @@ (f64.const 100.67909109878379) (f64.const 10.033897104255344) (f64.const -0.4997771382331848) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53629,7 +53645,7 @@ (f64.const 101.12268095877725) (f64.const 10.055977374615422) (f64.const 0.49988678097724915) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53648,7 +53664,7 @@ (f64.const 101.3027691287746) (f64.const 10.064927676281366) (f64.const 0.4999105632305145) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53667,7 +53683,7 @@ (f64.const 2.45932313565507e-307) (f64.const 4.9591563149945874e-154) (f64.const -0.4998999834060669) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53686,7 +53702,7 @@ (f64.const 5.610957305180409e-307) (f64.const 7.490632353266584e-154) (f64.const -0.4999343752861023) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53705,7 +53721,7 @@ (f64.const 5.8073887977408524e-307) (f64.const 7.62062254526548e-154) (f64.const -0.49989569187164307) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53724,7 +53740,7 @@ (f64.const 7.026137080471427e-307) (f64.const 8.382205605013174e-154) (f64.const 0.49980640411376953) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53743,7 +53759,7 @@ (f64.const 8.438697769194972e-307) (f64.const 9.186238495268328e-154) (f64.const -0.4999065697193146) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53762,7 +53778,7 @@ (f64.const 1.1607792515836795e-306) (f64.const 1.0773946591586944e-153) (f64.const -0.49997684359550476) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53781,7 +53797,7 @@ (f64.const 1.2827413827423193e-306) (f64.const 1.1325817333606962e-153) (f64.const -0.4999513030052185) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53800,7 +53816,7 @@ (f64.const 1.7116604596087457e-306) (f64.const 1.3083044216117078e-153) (f64.const -0.49986395239830017) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53819,7 +53835,7 @@ (f64.const 2.038173251686994e-306) (f64.const 1.4276460526639628e-153) (f64.const 0.4998403787612915) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53838,7 +53854,7 @@ (f64.const 2.171572060856931e-306) (f64.const 1.4736254818836879e-153) (f64.const 0.4999290406703949) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53857,7 +53873,7 @@ (f64.const 2.4681399631804094e-306) (f64.const 1.5710314965589996e-153) (f64.const 0.49989044666290283) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53876,7 +53892,7 @@ (f64.const 2.5175533964200588e-306) (f64.const 1.5866799918131124e-153) (f64.const -0.4997701048851013) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53895,7 +53911,7 @@ (f64.const 2.6461505468829625e-306) (f64.const 1.6266992797941982e-153) (f64.const 0.4998672902584076) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53914,7 +53930,7 @@ (f64.const 3.8167076367720413e-306) (f64.const 1.9536395872248397e-153) (f64.const 0.49983471632003784) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53933,7 +53949,7 @@ (f64.const 4.5743220778562766e-306) (f64.const 2.1387664851161936e-153) (f64.const 0.49985939264297485) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53952,7 +53968,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -53971,7 +53987,7 @@ (f32.const 4.345239639282227) (f32.const 2.084523916244507) (f32.const 0.3200402557849884) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53990,7 +54006,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54009,7 +54025,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54028,7 +54044,7 @@ (f32.const 9.267057418823242) (f32.const 3.0441842079162598) (f32.const 0.05022354796528816) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54047,7 +54063,7 @@ (f32.const 0.6619858741760254) (f32.const 0.813625156879425) (f32.const 0.2240506112575531) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54066,7 +54082,7 @@ (f32.const -0.40660393238067627) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54085,7 +54101,7 @@ (f32.const 0.5617597699165344) (f32.const 0.7495063543319702) (f32.const 0.05895441770553589) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54104,7 +54120,7 @@ (f32.const 0.7741522789001465) (f32.const 0.879859209060669) (f32.const -0.4874873757362366) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54123,7 +54139,7 @@ (f32.const -0.6787636876106262) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54182,7 +54198,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54258,7 +54274,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54315,7 +54331,7 @@ (f32.const 4.203895392974451e-45) (f32.const 6.483745598763743e-23) (f32.const 0.37388554215431213) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54334,7 +54350,7 @@ (f32.const 1.401298464324817e-45) (f32.const 3.743392066509216e-23) (f32.const -0.20303145051002502) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54353,7 +54369,7 @@ (f32.const -1.401298464324817e-45) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54372,7 +54388,7 @@ (f32.const 3402823466385288598117041e14) (f32.const 18446742974197923840) (f32.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54391,7 +54407,7 @@ (f32.const -3402823466385288598117041e14) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54410,7 +54426,7 @@ (f32.const 0.9999998807907104) (f32.const 0.9999999403953552) (f32.const 2.980232594040899e-08) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54429,7 +54445,7 @@ (f32.const 0.9999999403953552) (f32.const 0.9999999403953552) (f32.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54448,7 +54464,7 @@ (f32.const 1.999999761581421) (f32.const 1.4142134189605713) (f32.const -0.4959246516227722) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54467,7 +54483,7 @@ (f32.const 1.9999998807907104) (f32.const 1.4142135381698608) (f32.const 0.15052194893360138) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54486,7 +54502,7 @@ (f32.const 1.0000001192092896) (f32.const 1) (f32.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54505,7 +54521,7 @@ (f32.const 1.000000238418579) (f32.const 1.0000001192092896) (f32.const 5.960463766996327e-08) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54524,7 +54540,7 @@ (f32.const 2.000000238418579) (f32.const 1.4142136573791504) (f32.const 0.08986179530620575) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54543,7 +54559,7 @@ (f32.const 2.000000476837158) (f32.const 1.41421377658844) (f32.const 0.3827550709247589) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54562,7 +54578,7 @@ (f64.const -8.06684839057968) (f64.const -0.999999803096032) (f64.const 0.012793331407010555) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54581,7 +54597,7 @@ (f64.const 4.345239849338305) (f64.const 0.9996636978961307) (f64.const 0.1573508232831955) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54600,7 +54616,7 @@ (f64.const -8.38143342755525) (f64.const -0.9999998950434862) (f64.const 0.27985066175460815) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54619,7 +54635,7 @@ (f64.const -6.531673581913484) (f64.const -0.9999957568392429) (f64.const -0.44285574555397034) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54638,7 +54654,7 @@ (f64.const 9.267056966972586) (f64.const 0.9999999821447234) (f64.const 0.4462755024433136) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54657,7 +54673,7 @@ (f64.const 0.6619858980995045) (f64.const 0.5796835018635275) (f64.const 0.4892043173313141) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54676,7 +54692,7 @@ (f64.const -0.4066039223853553) (f64.const -0.3855853099901652) (f64.const 0.35993871092796326) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54695,7 +54711,7 @@ (f64.const 0.5617597462207241) (f64.const 0.5092819248700439) (f64.const -0.39436522126197815) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54714,7 +54730,7 @@ (f64.const 0.7741522965913037) (f64.const 0.6493374550318555) (f64.const -0.4899396002292633) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54733,7 +54749,7 @@ (f64.const -0.6787637026394024) (f64.const -0.590715084799841) (f64.const -0.0145387789234519) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54849,7 +54865,7 @@ (f32.const -8.066848754882812) (f32.const -0.9999998211860657) (f32.const -0.3034979999065399) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54868,7 +54884,7 @@ (f32.const 4.345239639282227) (f32.const 0.9996637105941772) (f32.const 0.2154078334569931) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54887,7 +54903,7 @@ (f32.const -8.381433486938477) (f32.const -0.9999998807907104) (f32.const 0.23912210762500763) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54906,7 +54922,7 @@ (f32.const -6.531673431396484) (f32.const -0.999995768070221) (f32.const -0.18844597041606903) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54925,7 +54941,7 @@ (f32.const 9.267057418823242) (f32.const 1) (f32.const 0.1497807800769806) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54944,7 +54960,7 @@ (f32.const 0.6619858741760254) (f32.const 0.5796834826469421) (f32.const -0.05590476095676422) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54963,7 +54979,7 @@ (f32.const -0.40660393238067627) (f32.const -0.38558530807495117) (f32.const 0.349787175655365) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54982,7 +54998,7 @@ (f32.const 0.5617597699165344) (f32.const 0.5092819333076477) (f32.const -0.1528785079717636) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55001,7 +55017,7 @@ (f32.const 0.7741522789001465) (f32.const 0.6493374705314636) (f32.const 0.4317026138305664) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55020,7 +55036,7 @@ (f32.const -0.6787636876106262) (f32.const -0.5907150506973267) (f32.const 0.4079873859882355) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55136,7 +55152,7 @@ (f64.const -8.06684839057968) (f64.const -8) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55155,7 +55171,7 @@ (f64.const 4.345239849338305) (f64.const 4) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55174,7 +55190,7 @@ (f64.const -8.38143342755525) (f64.const -8) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55193,7 +55209,7 @@ (f64.const -6.531673581913484) (f64.const -6) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55212,7 +55228,7 @@ (f64.const 9.267056966972586) (f64.const 9) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55231,7 +55247,7 @@ (f64.const 0.6619858980995045) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55250,7 +55266,7 @@ (f64.const -0.4066039223853553) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55269,7 +55285,7 @@ (f64.const 0.5617597462207241) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55288,7 +55304,7 @@ (f64.const 0.7741522965913037) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55307,7 +55323,7 @@ (f64.const -0.6787637026394024) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55463,7 +55479,7 @@ (f64.const 0.5) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55482,7 +55498,7 @@ (f64.const -0.5) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55501,7 +55517,7 @@ (f64.const 1.0000152587890625) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55520,7 +55536,7 @@ (f64.const -1.0000152587890625) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55539,7 +55555,7 @@ (f64.const 0.9999923706054688) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55558,7 +55574,7 @@ (f64.const -0.9999923706054688) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55577,7 +55593,7 @@ (f64.const 7.888609052210118e-31) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55596,7 +55612,7 @@ (f64.const -7.888609052210118e-31) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55615,7 +55631,7 @@ (f32.const -8.066848754882812) (f32.const -8) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55634,7 +55650,7 @@ (f32.const 4.345239639282227) (f32.const 4) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55653,7 +55669,7 @@ (f32.const -8.381433486938477) (f32.const -8) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55672,7 +55688,7 @@ (f32.const -6.531673431396484) (f32.const -6) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55691,7 +55707,7 @@ (f32.const 9.267057418823242) (f32.const 9) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55710,7 +55726,7 @@ (f32.const 0.6619858741760254) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55729,7 +55745,7 @@ (f32.const -0.40660393238067627) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55748,7 +55764,7 @@ (f32.const 0.5617597699165344) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55767,7 +55783,7 @@ (f32.const 0.7741522789001465) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55786,7 +55802,7 @@ (f32.const -0.6787636876106262) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55942,7 +55958,7 @@ (f32.const 0.5) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55961,7 +55977,7 @@ (f32.const -0.5) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55980,7 +55996,7 @@ (f32.const 1.0000152587890625) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55999,7 +56015,7 @@ (f32.const -1.0000152587890625) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -56018,7 +56034,7 @@ (f32.const 0.9999923706054688) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -56037,7 +56053,7 @@ (f32.const -0.9999923706054688) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -56056,7 +56072,7 @@ (f32.const 7.888609052210118e-31) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -56075,7 +56091,7 @@ (f32.const -7.888609052210118e-31) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block diff --git a/tests/compiler/std/mod.untouched.wat b/tests/compiler/std/mod.untouched.wat index 0c6e03c3..87809bbd 100644 --- a/tests/compiler/std/mod.untouched.wat +++ b/tests/compiler/std/mod.untouched.wat @@ -516,7 +516,7 @@ (if (result i32) (tee_local $3 (i32.eqz - (i32.const 1) + (get_global $std/mod/js) ) ) (get_local $3) diff --git a/tests/compiler/std/new.optimized.wat b/tests/compiler/std/new.optimized.wat index 7e37c663..31c74d1a 100644 --- a/tests/compiler/std/new.optimized.wat +++ b/tests/compiler/std/new.optimized.wat @@ -1,15 +1,23 @@ (module (type $ifi (func (param i32 f32) (result i32))) (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $v (func)) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) (global $std/new/aClass (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 0 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 1 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -41,14 +49,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -76,7 +84,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -95,7 +103,12 @@ ) (i32.const 0) ) - (func $std/new/AClass#constructor (; 1 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $std/new/AClass#constructor (; 4 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (if (i32.eqz @@ -106,7 +119,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -133,15 +146,9 @@ ) (get_local $0) ) - (func $start (; 2 ;) (type $v) + (func $start (; 5 ;) (type $v) (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 8) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) diff --git a/tests/compiler/std/new.untouched.wat b/tests/compiler/std/new.untouched.wat index 6f6a1dda..e1a6b882 100644 --- a/tests/compiler/std/new.untouched.wat +++ b/tests/compiler/std/new.untouched.wat @@ -1,6 +1,7 @@ (module (type $ifi (func (param i32 f32) (result i32))) (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $v (func)) (global $~lib/internal/allocator/AL_BITS i32 (i32.const 3)) (global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8)) @@ -13,7 +14,15 @@ (memory $0 0) (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 0 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 1 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -26,7 +35,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -40,16 +49,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -94,14 +103,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -121,7 +130,14 @@ ) (i32.const 0) ) - (func $std/new/AClass#constructor (; 1 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $std/new/AClass#constructor (; 4 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (i32.store (get_local $0) @@ -134,7 +150,7 @@ (tee_local $0 (block (result i32) (set_local $2 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -161,15 +177,15 @@ ) (get_local $0) ) - (func $start (; 2 ;) (type $v) + (func $start (; 5 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add (get_global $HEAP_BASE) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) diff --git a/tests/compiler/std/operator-overloading.optimized.wat b/tests/compiler/std/operator-overloading.optimized.wat index a572591b..77d19125 100644 --- a/tests/compiler/std/operator-overloading.optimized.wat +++ b/tests/compiler/std/operator-overloading.optimized.wat @@ -1,6 +1,7 @@ (module (type $iiii (func (param i32 i32 i32) (result i32))) (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iii (func (param i32 i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $FFF (func (param f64 f64) (result f64))) @@ -74,12 +75,19 @@ (global $std/operator-overloading/aii1 (mut i32) (i32.const 0)) (global $std/operator-overloading/aii2 (mut i32) (i32.const 0)) (global $std/operator-overloading/aii (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 68)) (memory $0 1) (data (i32.const 8) "\1b\00\00\00s\00t\00d\00/\00o\00p\00e\00r\00a\00t\00o\00r\00-\00o\00v\00e\00r\00l\00o\00a\00d\00i\00n\00g\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 1 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 2 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -111,14 +119,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -146,7 +154,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -165,7 +173,12 @@ ) (i32.const 0) ) - (func $std/operator-overloading/Tester#constructor (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $std/operator-overloading/Tester#constructor (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (if (i32.eqz (get_local $0) @@ -173,7 +186,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -187,7 +200,7 @@ ) (get_local $0) ) - (func $std/operator-overloading/Tester.add (; 3 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.add (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.add @@ -208,7 +221,7 @@ ) ) ) - (func $std/operator-overloading/Tester.sub (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.sub (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.sub @@ -229,7 +242,7 @@ ) ) ) - (func $std/operator-overloading/Tester.mul (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.mul (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.mul @@ -250,7 +263,7 @@ ) ) ) - (func $std/operator-overloading/Tester.div (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.div (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.div_s @@ -271,7 +284,7 @@ ) ) ) - (func $std/operator-overloading/Tester.mod (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.mod (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.rem_s @@ -292,7 +305,7 @@ ) ) ) - (func $~lib/math/NativeMath.scalbn (; 8 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) + (func $~lib/math/NativeMath.scalbn (; 11 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) (local $2 f64) (set_local $2 (get_local $0) @@ -406,7 +419,7 @@ ) ) ) - (func $~lib/math/NativeMath.pow (; 9 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.pow (; 12 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 f64) (local $3 f64) (local $4 i32) @@ -1833,7 +1846,7 @@ (f64.const 1.e+300) ) ) - (func $std/operator-overloading/Tester.pow (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.pow (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.trunc_s/f64 @@ -1866,7 +1879,7 @@ ) ) ) - (func $std/operator-overloading/Tester.and (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.and (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.and @@ -1887,7 +1900,7 @@ ) ) ) - (func $std/operator-overloading/Tester.or (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.or (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.or @@ -1908,7 +1921,7 @@ ) ) ) - (func $std/operator-overloading/Tester.xor (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.xor (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.xor @@ -1929,7 +1942,7 @@ ) ) ) - (func $std/operator-overloading/Tester.equals (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.equals (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -1955,7 +1968,7 @@ ) (get_local $2) ) - (func $std/operator-overloading/Tester.notEquals (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.notEquals (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -1981,7 +1994,7 @@ ) (get_local $2) ) - (func $std/operator-overloading/Tester.greater (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.greater (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -2007,7 +2020,7 @@ ) (get_local $2) ) - (func $std/operator-overloading/Tester.greaterEquals (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.greaterEquals (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -2033,7 +2046,7 @@ ) (get_local $2) ) - (func $std/operator-overloading/Tester.less (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.less (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -2059,7 +2072,7 @@ ) (get_local $2) ) - (func $std/operator-overloading/Tester.lessEquals (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.lessEquals (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -2085,7 +2098,7 @@ ) (get_local $2) ) - (func $std/operator-overloading/Tester.shr (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.shr (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.shr_s @@ -2102,7 +2115,7 @@ ) ) ) - (func $std/operator-overloading/Tester.shu (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.shu (; 24 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.shr_u @@ -2119,7 +2132,7 @@ ) ) ) - (func $std/operator-overloading/Tester.shl (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.shl (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.shl @@ -2136,7 +2149,7 @@ ) ) ) - (func $std/operator-overloading/Tester.pos (; 23 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.pos (; 26 ;) (type $ii) (param $0 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.load @@ -2147,7 +2160,7 @@ ) ) ) - (func $std/operator-overloading/Tester.neg (; 24 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.neg (; 27 ;) (type $ii) (param $0 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.sub @@ -2164,7 +2177,7 @@ ) ) ) - (func $std/operator-overloading/Tester.not (; 25 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.not (; 28 ;) (type $ii) (param $0 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.xor @@ -2181,7 +2194,7 @@ ) ) ) - (func $std/operator-overloading/Tester.excl (; 26 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.excl (; 29 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (tee_local $1 @@ -2201,7 +2214,7 @@ ) (get_local $1) ) - (func $std/operator-overloading/Tester#inc (; 27 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester#inc (; 30 ;) (type $ii) (param $0 i32) (result i32) (i32.store (get_local $0) (i32.add @@ -2222,7 +2235,7 @@ ) (get_local $0) ) - (func $std/operator-overloading/Tester#dec (; 28 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester#dec (; 31 ;) (type $ii) (param $0 i32) (result i32) (i32.store (get_local $0) (i32.sub @@ -2243,17 +2256,11 @@ ) (get_local $0) ) - (func $start (; 29 ;) (type $v) + (func $start (; 32 ;) (type $v) (local $0 i32) (local $1 i32) (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 72) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) diff --git a/tests/compiler/std/operator-overloading.untouched.wat b/tests/compiler/std/operator-overloading.untouched.wat index 564f15ec..727d2cc5 100644 --- a/tests/compiler/std/operator-overloading.untouched.wat +++ b/tests/compiler/std/operator-overloading.untouched.wat @@ -1,6 +1,7 @@ (module (type $iiii (func (param i32 i32 i32) (result i32))) (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iii (func (param i32 i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $FFF (func (param f64 f64) (result f64))) @@ -47,6 +48,7 @@ (global $std/operator-overloading/eq3 (mut i32) (i32.const 0)) (global $std/operator-overloading/eq4 (mut i32) (i32.const 0)) (global $std/operator-overloading/eqf (mut i32) (i32.const 0)) + (global $i32.MAX_VALUE i32 (i32.const 2147483647)) (global $std/operator-overloading/gt1 (mut i32) (i32.const 0)) (global $std/operator-overloading/gt2 (mut i32) (i32.const 0)) (global $std/operator-overloading/gt (mut i32) (i32.const 0)) @@ -84,7 +86,15 @@ (data (i32.const 8) "\1b\00\00\00s\00t\00d\00/\00o\00p\00e\00r\00a\00t\00o\00r\00-\00o\00v\00e\00r\00l\00o\00a\00d\00i\00n\00g\00.\00t\00s\00") (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 1 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 2 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -97,7 +107,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -111,16 +121,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -165,14 +175,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -192,7 +202,14 @@ ) (i32.const 0) ) - (func $std/operator-overloading/Tester#constructor (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $std/operator-overloading/Tester#constructor (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (tee_local $0 (if (result i32) @@ -201,7 +218,7 @@ (tee_local $0 (block (result i32) (set_local $3 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -219,7 +236,7 @@ ) ) ) - (func $std/operator-overloading/Tester.add (; 3 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.add (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.add @@ -240,7 +257,7 @@ ) ) ) - (func $std/operator-overloading/Tester.sub (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.sub (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.sub @@ -261,7 +278,7 @@ ) ) ) - (func $std/operator-overloading/Tester.mul (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.mul (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.mul @@ -282,7 +299,7 @@ ) ) ) - (func $std/operator-overloading/Tester.div (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.div (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.div_s @@ -303,7 +320,7 @@ ) ) ) - (func $std/operator-overloading/Tester.mod (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.mod (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.rem_s @@ -324,7 +341,7 @@ ) ) ) - (func $~lib/math/NativeMath.scalbn (; 8 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) + (func $~lib/math/NativeMath.scalbn (; 11 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) (local $2 f64) (set_local $2 (get_local $0) @@ -442,7 +459,7 @@ ) ) ) - (func $~lib/math/NativeMath.pow (; 9 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.pow (; 12 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i32) (local $4 i32) @@ -2000,7 +2017,7 @@ (get_local $13) ) ) - (func $std/operator-overloading/Tester.pow (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.pow (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.trunc_s/f64 @@ -2033,7 +2050,7 @@ ) ) ) - (func $std/operator-overloading/Tester.and (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.and (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.and @@ -2054,7 +2071,7 @@ ) ) ) - (func $std/operator-overloading/Tester.or (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.or (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.or @@ -2075,7 +2092,7 @@ ) ) ) - (func $std/operator-overloading/Tester.xor (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.xor (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.xor @@ -2096,7 +2113,7 @@ ) ) ) - (func $std/operator-overloading/Tester.equals (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.equals (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (result i32) (tee_local $2 @@ -2120,7 +2137,7 @@ (get_local $2) ) ) - (func $std/operator-overloading/Tester.notEquals (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.notEquals (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (result i32) (tee_local $2 @@ -2144,7 +2161,7 @@ (get_local $2) ) ) - (func $std/operator-overloading/Tester.greater (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.greater (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (result i32) (tee_local $2 @@ -2168,7 +2185,7 @@ (get_local $2) ) ) - (func $std/operator-overloading/Tester.greaterEquals (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.greaterEquals (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (result i32) (tee_local $2 @@ -2192,7 +2209,7 @@ (get_local $2) ) ) - (func $std/operator-overloading/Tester.less (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.less (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (result i32) (tee_local $2 @@ -2216,7 +2233,7 @@ (get_local $2) ) ) - (func $std/operator-overloading/Tester.lessEquals (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.lessEquals (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (result i32) (tee_local $2 @@ -2240,7 +2257,7 @@ (get_local $2) ) ) - (func $std/operator-overloading/Tester.shr (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.shr (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.shr_s @@ -2257,7 +2274,7 @@ ) ) ) - (func $std/operator-overloading/Tester.shu (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.shu (; 24 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.shr_u @@ -2274,7 +2291,7 @@ ) ) ) - (func $std/operator-overloading/Tester.shl (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.shl (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.shl @@ -2291,7 +2308,7 @@ ) ) ) - (func $std/operator-overloading/Tester.pos (; 23 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.pos (; 26 ;) (type $ii) (param $0 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.load @@ -2302,7 +2319,7 @@ ) ) ) - (func $std/operator-overloading/Tester.neg (; 24 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.neg (; 27 ;) (type $ii) (param $0 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.sub @@ -2319,7 +2336,7 @@ ) ) ) - (func $std/operator-overloading/Tester.not (; 25 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.not (; 28 ;) (type $ii) (param $0 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.xor @@ -2336,7 +2353,7 @@ ) ) ) - (func $std/operator-overloading/Tester.excl (; 26 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.excl (; 29 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (result i32) (tee_local $1 @@ -2354,7 +2371,7 @@ (get_local $1) ) ) - (func $std/operator-overloading/Tester#inc (; 27 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester#inc (; 30 ;) (type $ii) (param $0 i32) (result i32) (i32.store (get_local $0) (i32.add @@ -2375,7 +2392,7 @@ ) (get_local $0) ) - (func $std/operator-overloading/Tester#dec (; 28 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester#dec (; 31 ;) (type $ii) (param $0 i32) (result i32) (i32.store (get_local $0) (i32.sub @@ -2396,7 +2413,7 @@ ) (get_local $0) ) - (func $std/operator-overloading/TesterInlineStatic#constructor (; 29 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/operator-overloading/TesterInlineStatic#constructor (; 32 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (tee_local $0 (if (result i32) @@ -2405,7 +2422,7 @@ (tee_local $0 (block (result i32) (set_local $3 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -2423,7 +2440,7 @@ ) ) ) - (func $std/operator-overloading/TesterInlineInstance#constructor (; 30 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/operator-overloading/TesterInlineInstance#constructor (; 33 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (tee_local $0 (if (result i32) @@ -2432,7 +2449,7 @@ (tee_local $0 (block (result i32) (set_local $3 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -2450,17 +2467,17 @@ ) ) ) - (func $start (; 31 ;) (type $v) + (func $start (; 34 ;) (type $v) (local $0 i32) (local $1 i32) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add (get_global $HEAP_BASE) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) @@ -3042,7 +3059,7 @@ (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.const 2) - (i32.const 2147483647) + (get_global $i32.MAX_VALUE) ) ) (set_global $std/operator-overloading/gt2 diff --git a/tests/compiler/std/pointer.optimized.wat b/tests/compiler/std/pointer.optimized.wat index bf8c91d1..407f031b 100644 --- a/tests/compiler/std/pointer.optimized.wat +++ b/tests/compiler/std/pointer.optimized.wat @@ -1,49 +1,25 @@ (module (type $iii (func (param i32 i32) (result i32))) - (type $iv (func (param i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $v (func)) + (type $iv (func (param i32))) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) - (global $~argc (mut i32) (i32.const 0)) (global $std/pointer/one (mut i32) (i32.const 0)) (global $std/pointer/two (mut i32) (i32.const 0)) (global $std/pointer/add (mut i32) (i32.const 0)) (global $std/pointer/sub (mut i32) (i32.const 0)) (global $std/pointer/nextOne (mut i32) (i32.const 0)) + (global $~argc (mut i32) (i32.const 0)) (memory $0 1) (data (i32.const 8) "\0e\00\00\00s\00t\00d\00/\00p\00o\00i\00n\00t\00e\00r\00.\00t\00s") + (export "memory" (memory $0)) (export "_setargc" (func $~setargc)) (export "Pointer#constructor" (func $std/pointer/Pointer#constructor|trampoline)) - (export "memory" (memory $0)) (start $start) (func $std/pointer/Pointer#constructor (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (get_local $1) ) - (func $std/pointer/Pointer#constructor|trampoline (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) - (block $1of1 - (block $0of1 - (block $oob - (br_table $0of1 $1of1 $oob - (get_global $~argc) - ) - ) - (unreachable) - ) - (set_local $1 - (i32.const 0) - ) - ) - (call $std/pointer/Pointer#constructor - (get_local $0) - (get_local $1) - ) - ) - (func $~setargc (; 3 ;) (type $iv) (param $0 i32) - (set_global $~argc - (get_local $0) - ) - ) - (func $start (; 4 ;) (type $v) + (func $start (; 2 ;) (type $v) (set_global $std/pointer/one (call $std/pointer/Pointer#constructor (i32.const 0) @@ -301,4 +277,28 @@ ) ) ) + (func $std/pointer/Pointer#constructor|trampoline (; 3 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (block $1of1 + (block $0of1 + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange + (get_global $~argc) + ) + ) + (unreachable) + ) + (set_local $1 + (i32.const 0) + ) + ) + (call $std/pointer/Pointer#constructor + (get_local $0) + (get_local $1) + ) + ) + (func $~setargc (; 4 ;) (type $iv) (param $0 i32) + (set_global $~argc + (get_local $0) + ) + ) ) diff --git a/tests/compiler/std/pointer.untouched.wat b/tests/compiler/std/pointer.untouched.wat index 484f7b88..766a9332 100644 --- a/tests/compiler/std/pointer.untouched.wat +++ b/tests/compiler/std/pointer.untouched.wat @@ -1,50 +1,26 @@ (module (type $iii (func (param i32 i32) (result i32))) - (type $iv (func (param i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $v (func)) + (type $iv (func (param i32))) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) - (global $~argc (mut i32) (i32.const 0)) (global $std/pointer/one (mut i32) (i32.const 0)) (global $std/pointer/two (mut i32) (i32.const 0)) (global $std/pointer/add (mut i32) (i32.const 0)) (global $std/pointer/sub (mut i32) (i32.const 0)) (global $std/pointer/nextOne (mut i32) (i32.const 0)) (global $HEAP_BASE i32 (i32.const 40)) + (global $~argc (mut i32) (i32.const 0)) (memory $0 1) (data (i32.const 8) "\0e\00\00\00s\00t\00d\00/\00p\00o\00i\00n\00t\00e\00r\00.\00t\00s\00") + (export "memory" (memory $0)) (export "_setargc" (func $~setargc)) (export "Pointer#constructor" (func $std/pointer/Pointer#constructor|trampoline)) - (export "memory" (memory $0)) (start $start) (func $std/pointer/Pointer#constructor (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (get_local $1) ) - (func $std/pointer/Pointer#constructor|trampoline (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) - (block $1of1 - (block $0of1 - (block $oob - (br_table $0of1 $1of1 $oob - (get_global $~argc) - ) - ) - (unreachable) - ) - (set_local $1 - (i32.const 0) - ) - ) - (call $std/pointer/Pointer#constructor - (get_local $0) - (get_local $1) - ) - ) - (func $~setargc (; 3 ;) (type $iv) (param $0 i32) - (set_global $~argc - (get_local $0) - ) - ) - (func $start (; 4 ;) (type $v) + (func $start (; 2 ;) (type $v) (local $0 i32) (local $1 i32) (set_global $std/pointer/one @@ -433,4 +409,28 @@ ) ) ) + (func $std/pointer/Pointer#constructor|trampoline (; 3 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (block $1of1 + (block $0of1 + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange + (get_global $~argc) + ) + ) + (unreachable) + ) + (set_local $1 + (i32.const 0) + ) + ) + (call $std/pointer/Pointer#constructor + (get_local $0) + (get_local $1) + ) + ) + (func $~setargc (; 4 ;) (type $iv) (param $0 i32) + (set_global $~argc + (get_local $0) + ) + ) ) diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index f3b9c064..eb2ede40 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -1,6 +1,7 @@ (module (type $v (func)) (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iv (func (param i32))) (type $iiii (func (param i32 i32 i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) @@ -22,14 +23,21 @@ (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 136)) (memory $0 1) (data (i32.const 8) "\13\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (data (i32.const 52) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (data (i32.const 112) "\n\00\00\00s\00t\00d\00/\00s\00e\00t\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 1 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 2 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -61,14 +69,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -96,7 +104,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -115,7 +123,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/computeSize (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/internal/arraybuffer/computeSize (; 5 ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -129,7 +142,7 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocUnsafe (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -148,7 +161,7 @@ ) (i32.store (tee_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -158,7 +171,7 @@ ) (get_local $1) ) - (func $~lib/memory/set_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -488,7 +501,14 @@ ) ) ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.fill (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u @@ -517,7 +537,7 @@ (i32.const 1) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) (i32.const 8) @@ -528,7 +548,7 @@ ) (get_local $3) ) - (func $~lib/set/Set#clear (; 6 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 10 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -562,7 +582,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 11 ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -570,7 +590,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -603,7 +623,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash8 (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash8 (; 12 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (get_local $0) @@ -612,7 +632,7 @@ (i32.const 16777619) ) ) - (func $~lib/internal/hash/hash (; 9 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 13 ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/hash/hash8 (i32.shr_s (i32.shl @@ -623,7 +643,7 @@ ) ) ) - (func $~lib/set/Set#find (; 10 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 14 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -689,7 +709,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -701,7 +721,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 12 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 16 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -858,7 +878,7 @@ ) ) ) - (func $~lib/set/Set#add (; 13 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 17 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -987,12 +1007,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 18 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -1093,7 +1113,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 16 ;) (type $v) + (func $std/set/test (; 20 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -1437,7 +1457,7 @@ ) ) ) - (func $~lib/internal/hash/hash (; 17 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 21 ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/hash/hash8 (i32.and (get_local $0) @@ -1445,7 +1465,7 @@ ) ) ) - (func $~lib/set/Set#has (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -1457,7 +1477,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 19 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 23 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1614,7 +1634,7 @@ ) ) ) - (func $~lib/set/Set#add (; 20 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 24 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1743,7 +1763,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -1841,7 +1861,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 22 ;) (type $v) + (func $std/set/test (; 26 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -2185,7 +2205,7 @@ ) ) ) - (func $~lib/internal/hash/hash16 (; 23 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash16 (; 27 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -2206,7 +2226,7 @@ (i32.const 16777619) ) ) - (func $~lib/internal/hash/hash (; 24 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 28 ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/hash/hash16 (i32.shr_s (i32.shl @@ -2217,7 +2237,7 @@ ) ) ) - (func $~lib/set/Set#find (; 25 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 29 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -2283,7 +2303,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 30 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -2295,7 +2315,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 27 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 31 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2452,7 +2472,7 @@ ) ) ) - (func $~lib/set/Set#add (; 28 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 32 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2581,7 +2601,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 33 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -2682,7 +2702,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 30 ;) (type $v) + (func $std/set/test (; 34 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -3026,7 +3046,7 @@ ) ) ) - (func $~lib/internal/hash/hash (; 31 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 35 ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/hash/hash16 (i32.and (get_local $0) @@ -3034,7 +3054,7 @@ ) ) ) - (func $~lib/set/Set#has (; 32 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 36 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -3046,7 +3066,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 33 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 37 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3203,7 +3223,7 @@ ) ) ) - (func $~lib/set/Set#add (; 34 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 38 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3332,7 +3352,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 35 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 39 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -3430,7 +3450,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 36 ;) (type $v) + (func $std/set/test (; 40 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -3774,7 +3794,7 @@ ) ) ) - (func $~lib/internal/hash/hash32 (; 37 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 41 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -3819,12 +3839,12 @@ (i32.const 16777619) ) ) - (func $~lib/internal/hash/hash (; 38 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 42 ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/hash/hash32 (get_local $0) ) ) - (func $~lib/set/Set#find (; 39 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 43 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -3887,7 +3907,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 40 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 44 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -3899,7 +3919,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 41 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 45 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4056,7 +4076,7 @@ ) ) ) - (func $~lib/set/Set#add (; 42 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 46 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4185,7 +4205,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 43 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 47 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -4280,7 +4300,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 44 ;) (type $v) + (func $std/set/test (; 48 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -4624,7 +4644,7 @@ ) ) ) - (func $std/set/test (; 45 ;) (type $v) + (func $std/set/test (; 49 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -4968,7 +4988,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 46 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 50 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -5002,7 +5022,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 47 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 51 ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -5010,7 +5030,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -5043,7 +5063,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash64 (; 48 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash64 (; 52 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (i32.mul (i32.xor @@ -5142,12 +5162,12 @@ (i32.const 16777619) ) ) - (func $~lib/internal/hash/hash (; 49 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash (; 53 ;) (type $Ii) (param $0 i64) (result i32) (call $~lib/internal/hash/hash64 (get_local $0) ) ) - (func $~lib/set/Set#find (; 50 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 54 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -5210,7 +5230,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 51 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#has (; 55 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -5222,7 +5242,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 52 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 56 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5379,7 +5399,7 @@ ) ) ) - (func $~lib/set/Set#add (; 53 ;) (type $iIv) (param $0 i32) (param $1 i64) + (func $~lib/set/Set#add (; 57 ;) (type $iIv) (param $0 i32) (param $1 i64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5508,7 +5528,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 54 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#delete (; 58 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (if @@ -5604,7 +5624,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 55 ;) (type $v) + (func $std/set/test (; 59 ;) (type $v) (local $0 i64) (local $1 i32) (set_local $1 @@ -5948,7 +5968,7 @@ ) ) ) - (func $std/set/test (; 56 ;) (type $v) + (func $std/set/test (; 60 ;) (type $v) (local $0 i64) (local $1 i32) (set_local $1 @@ -6292,14 +6312,14 @@ ) ) ) - (func $~lib/internal/hash/hash (; 57 ;) (type $fi) (param $0 f32) (result i32) + (func $~lib/internal/hash/hash (; 61 ;) (type $fi) (param $0 f32) (result i32) (call $~lib/internal/hash/hash32 (i32.reinterpret/f32 (get_local $0) ) ) ) - (func $~lib/set/Set#find (; 58 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 62 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -6362,7 +6382,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 59 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/set/Set#has (; 63 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -6374,7 +6394,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 60 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 64 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6533,7 +6553,7 @@ ) ) ) - (func $~lib/set/Set#add (; 61 ;) (type $ifv) (param $0 i32) (param $1 f32) + (func $~lib/set/Set#add (; 65 ;) (type $ifv) (param $0 i32) (param $1 f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6662,7 +6682,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 62 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/set/Set#delete (; 66 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (local $3 i32) (if @@ -6760,7 +6780,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 63 ;) (type $v) + (func $std/set/test (; 67 ;) (type $v) (local $0 f32) (local $1 i32) (set_local $1 @@ -7112,14 +7132,14 @@ ) ) ) - (func $~lib/internal/hash/hash (; 64 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/internal/hash/hash (; 68 ;) (type $Fi) (param $0 f64) (result i32) (call $~lib/internal/hash/hash64 (i64.reinterpret/f64 (get_local $0) ) ) ) - (func $~lib/set/Set#find (; 65 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 69 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -7182,7 +7202,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 66 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/set/Set#has (; 70 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -7194,7 +7214,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 67 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 71 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7353,7 +7373,7 @@ ) ) ) - (func $~lib/set/Set#add (; 68 ;) (type $iFv) (param $0 i32) (param $1 f64) + (func $~lib/set/Set#add (; 72 ;) (type $iFv) (param $0 i32) (param $1 f64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7482,7 +7502,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 69 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/set/Set#delete (; 73 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 i32) (if @@ -7580,7 +7600,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 70 ;) (type $v) + (func $std/set/test (; 74 ;) (type $v) (local $0 f64) (local $1 i32) (set_local $1 @@ -7932,15 +7952,9 @@ ) ) ) - (func $start (; 71 ;) (type $v) + (func $start (; 75 ;) (type $v) (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 136) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index 9ef09a5a..229d1b0d 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -1,6 +1,7 @@ (module (type $v (func)) (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iv (func (param i32))) (type $iiii (func (param i32 i32 i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) @@ -42,7 +43,15 @@ (data (i32.const 112) "\n\00\00\00s\00t\00d\00/\00s\00e\00t\00.\00t\00s\00") (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 1 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 2 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -55,7 +64,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -69,16 +78,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -123,14 +132,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -150,7 +159,14 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/computeSize (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/internal/arraybuffer/computeSize (; 5 ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -159,7 +175,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -167,13 +183,13 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocUnsafe (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.eqz (i32.le_u (get_local $0) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) ) (block @@ -187,7 +203,7 @@ ) ) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -199,7 +215,7 @@ ) (get_local $1) ) - (func $~lib/memory/set_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -551,12 +567,19 @@ ) ) ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.fill (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u (get_local $1) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) (block (call $~lib/env/abort @@ -580,10 +603,10 @@ (i32.const 1) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $1) @@ -591,7 +614,7 @@ ) (get_local $3) ) - (func $~lib/set/Set#clear (; 6 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 10 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -603,7 +626,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -617,7 +640,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -628,7 +651,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 11 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -638,7 +661,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -674,16 +697,16 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash8 (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash8 (; 12 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) (get_local $0) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) - (func $~lib/internal/hash/hash (; 9 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 13 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash8 (i32.shr_s @@ -696,7 +719,7 @@ ) ) ) - (func $~lib/set/Set#find (; 10 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 14 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -712,7 +735,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -731,7 +754,7 @@ (i32.load offset=4 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -759,7 +782,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -772,7 +795,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -784,7 +807,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 12 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 16 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -807,7 +830,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -818,7 +841,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -839,7 +862,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -858,7 +881,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -879,7 +902,7 @@ (i32.load offset=4 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -914,7 +937,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -975,7 +998,7 @@ ) ) ) - (func $~lib/set/Set#add (; 13 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 17 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1020,7 +1043,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -1048,7 +1071,7 @@ (i32.add (i32.add (get_local $4) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -1097,7 +1120,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -1114,12 +1137,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 18 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1157,7 +1180,7 @@ (i32.load offset=4 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -1187,7 +1210,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -1212,7 +1235,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -1225,7 +1248,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 16 ;) (type $v) + (func $std/set/test (; 20 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -1613,7 +1636,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 17 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 21 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -1625,7 +1648,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -1639,7 +1662,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -1650,7 +1673,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 18 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 22 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -1660,7 +1683,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -1696,7 +1719,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 19 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 23 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash8 (i32.and @@ -1706,7 +1729,7 @@ ) ) ) - (func $~lib/set/Set#find (; 20 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 24 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -1722,7 +1745,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -1741,7 +1764,7 @@ (i32.load offset=4 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -1766,7 +1789,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -1779,7 +1802,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -1791,7 +1814,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 22 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 26 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1814,7 +1837,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -1825,7 +1848,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -1846,7 +1869,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -1865,7 +1888,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -1886,7 +1909,7 @@ (i32.load offset=4 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -1921,7 +1944,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -1982,7 +2005,7 @@ ) ) ) - (func $~lib/set/Set#add (; 23 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 27 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2027,7 +2050,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -2055,7 +2078,7 @@ (i32.add (i32.add (get_local $4) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -2104,7 +2127,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -2121,12 +2144,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 24 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 28 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2161,7 +2184,7 @@ (i32.load offset=4 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -2191,7 +2214,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -2216,7 +2239,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -2229,7 +2252,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 26 ;) (type $v) + (func $std/set/test (; 30 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -2617,7 +2640,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 27 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 31 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -2629,7 +2652,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -2643,7 +2666,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -2654,7 +2677,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 28 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 32 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -2664,7 +2687,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -2700,10 +2723,10 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash16 (; 29 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash16 (; 33 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) ) (set_local $1 (i32.mul @@ -2714,7 +2737,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -2726,12 +2749,12 @@ (i32.const 8) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (get_local $1) ) - (func $~lib/internal/hash/hash (; 30 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 34 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash16 (i32.shr_s @@ -2744,7 +2767,7 @@ ) ) ) - (func $~lib/set/Set#find (; 31 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 35 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -2760,7 +2783,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -2779,7 +2802,7 @@ (i32.load offset=4 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -2807,7 +2830,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -2820,7 +2843,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 32 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 36 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -2832,7 +2855,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 33 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 37 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2855,7 +2878,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -2866,7 +2889,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -2887,7 +2910,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -2906,7 +2929,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -2927,7 +2950,7 @@ (i32.load offset=4 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -2962,7 +2985,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -3023,7 +3046,7 @@ ) ) ) - (func $~lib/set/Set#add (; 34 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 38 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3068,7 +3091,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -3096,7 +3119,7 @@ (i32.add (i32.add (get_local $4) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -3145,7 +3168,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -3162,12 +3185,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 35 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 39 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 36 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 40 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3205,7 +3228,7 @@ (i32.load offset=4 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -3235,7 +3258,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -3260,7 +3283,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -3273,7 +3296,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 37 ;) (type $v) + (func $std/set/test (; 41 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -3661,7 +3684,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 38 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 42 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -3673,7 +3696,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -3687,7 +3710,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -3698,7 +3721,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 39 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 43 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -3708,7 +3731,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -3744,7 +3767,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 40 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 44 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash16 (i32.and @@ -3754,7 +3777,7 @@ ) ) ) - (func $~lib/set/Set#find (; 41 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 45 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -3770,7 +3793,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -3789,7 +3812,7 @@ (i32.load offset=4 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -3814,7 +3837,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -3827,7 +3850,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 42 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 46 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -3839,7 +3862,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 43 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 47 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3862,7 +3885,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -3873,7 +3896,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -3894,7 +3917,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -3913,7 +3936,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -3934,7 +3957,7 @@ (i32.load offset=4 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -3969,7 +3992,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -4030,7 +4053,7 @@ ) ) ) - (func $~lib/set/Set#add (; 44 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 48 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4075,7 +4098,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -4103,7 +4126,7 @@ (i32.add (i32.add (get_local $4) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -4152,7 +4175,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -4169,12 +4192,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 45 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 49 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 46 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 50 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4209,7 +4232,7 @@ (i32.load offset=4 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -4239,7 +4262,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -4264,7 +4287,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -4277,7 +4300,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 47 ;) (type $v) + (func $std/set/test (; 51 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -4665,7 +4688,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 48 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 52 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -4677,7 +4700,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -4691,7 +4714,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -4702,7 +4725,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 49 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 53 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -4712,7 +4735,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -4748,10 +4771,10 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash32 (; 50 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 54 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) ) (set_local $1 (i32.mul @@ -4762,7 +4785,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -4777,7 +4800,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -4792,7 +4815,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -4804,19 +4827,19 @@ (i32.const 24) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (get_local $1) ) - (func $~lib/internal/hash/hash (; 51 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 55 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash32 (get_local $0) ) ) ) - (func $~lib/set/Set#find (; 52 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 56 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -4832,7 +4855,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -4851,7 +4874,7 @@ (i32.load offset=4 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -4873,7 +4896,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -4886,7 +4909,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 53 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 57 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -4898,7 +4921,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 54 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 58 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4921,7 +4944,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -4932,7 +4955,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -4953,7 +4976,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -4972,7 +4995,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -4993,7 +5016,7 @@ (i32.load offset=4 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -5028,7 +5051,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -5089,7 +5112,7 @@ ) ) ) - (func $~lib/set/Set#add (; 55 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 59 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5134,7 +5157,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -5162,7 +5185,7 @@ (i32.add (i32.add (get_local $4) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -5211,7 +5234,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -5228,12 +5251,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 56 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 60 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 57 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 61 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5265,7 +5288,7 @@ (i32.load offset=4 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -5295,7 +5318,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -5320,7 +5343,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -5333,7 +5356,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 58 ;) (type $v) + (func $std/set/test (; 62 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -5721,7 +5744,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 59 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 63 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -5733,7 +5756,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -5747,7 +5770,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -5758,7 +5781,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 60 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 64 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -5768,7 +5791,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -5804,14 +5827,14 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 61 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 65 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash32 (get_local $0) ) ) ) - (func $~lib/set/Set#find (; 62 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 66 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -5827,7 +5850,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -5846,7 +5869,7 @@ (i32.load offset=4 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -5868,7 +5891,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -5881,7 +5904,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 63 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 67 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -5893,7 +5916,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 64 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 68 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5916,7 +5939,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -5927,7 +5950,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -5948,7 +5971,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -5967,7 +5990,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -5988,7 +6011,7 @@ (i32.load offset=4 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -6023,7 +6046,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -6084,7 +6107,7 @@ ) ) ) - (func $~lib/set/Set#add (; 65 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 69 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6129,7 +6152,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -6157,7 +6180,7 @@ (i32.add (i32.add (get_local $4) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -6206,7 +6229,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -6223,12 +6246,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 66 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 70 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 67 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 71 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6260,7 +6283,7 @@ (i32.load offset=4 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -6290,7 +6313,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -6315,7 +6338,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -6328,7 +6351,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 68 ;) (type $v) + (func $std/set/test (; 72 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -6716,7 +6739,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 69 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 73 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -6728,7 +6751,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -6742,7 +6765,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -6753,7 +6776,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 70 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 74 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -6763,7 +6786,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -6799,7 +6822,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash64 (; 71 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash64 (; 75 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -6817,7 +6840,7 @@ ) ) (set_local $3 - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) ) (set_local $3 (i32.mul @@ -6828,7 +6851,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -6843,7 +6866,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -6858,7 +6881,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -6870,7 +6893,7 @@ (i32.const 24) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -6882,7 +6905,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -6897,7 +6920,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -6912,7 +6935,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -6924,19 +6947,19 @@ (i32.const 24) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (get_local $3) ) - (func $~lib/internal/hash/hash (; 72 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash (; 76 ;) (type $Ii) (param $0 i64) (result i32) (return (call $~lib/internal/hash/hash64 (get_local $0) ) ) ) - (func $~lib/set/Set#find (; 73 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 77 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -6952,7 +6975,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -6971,7 +6994,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -6993,7 +7016,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -7006,7 +7029,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 74 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#has (; 78 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -7018,7 +7041,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 75 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 79 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7042,7 +7065,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -7053,7 +7076,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -7074,7 +7097,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -7093,7 +7116,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -7114,7 +7137,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -7149,7 +7172,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -7210,7 +7233,7 @@ ) ) ) - (func $~lib/set/Set#add (; 76 ;) (type $iIv) (param $0 i32) (param $1 i64) + (func $~lib/set/Set#add (; 80 ;) (type $iIv) (param $0 i32) (param $1 i64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7255,7 +7278,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -7283,7 +7306,7 @@ (i32.add (i32.add (get_local $4) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -7332,7 +7355,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -7349,12 +7372,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 77 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 81 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 78 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#delete (; 82 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7386,7 +7409,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -7416,7 +7439,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -7441,7 +7464,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -7454,7 +7477,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 79 ;) (type $v) + (func $std/set/test (; 83 ;) (type $v) (local $0 i32) (local $1 i64) (set_local $0 @@ -7842,7 +7865,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 80 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 84 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -7854,7 +7877,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -7868,7 +7891,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -7879,7 +7902,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 81 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 85 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -7889,7 +7912,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -7925,14 +7948,14 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 82 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash (; 86 ;) (type $Ii) (param $0 i64) (result i32) (return (call $~lib/internal/hash/hash64 (get_local $0) ) ) ) - (func $~lib/set/Set#find (; 83 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 87 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -7948,7 +7971,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -7967,7 +7990,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -7989,7 +8012,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -8002,7 +8025,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 84 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#has (; 88 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -8014,7 +8037,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 85 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 89 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8038,7 +8061,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -8049,7 +8072,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -8070,7 +8093,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -8089,7 +8112,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -8110,7 +8133,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -8145,7 +8168,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -8206,7 +8229,7 @@ ) ) ) - (func $~lib/set/Set#add (; 86 ;) (type $iIv) (param $0 i32) (param $1 i64) + (func $~lib/set/Set#add (; 90 ;) (type $iIv) (param $0 i32) (param $1 i64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8251,7 +8274,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -8279,7 +8302,7 @@ (i32.add (i32.add (get_local $4) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -8328,7 +8351,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -8345,12 +8368,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 87 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 91 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 88 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#delete (; 92 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8382,7 +8405,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -8412,7 +8435,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -8437,7 +8460,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -8450,7 +8473,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 89 ;) (type $v) + (func $std/set/test (; 93 ;) (type $v) (local $0 i32) (local $1 i64) (set_local $0 @@ -8838,7 +8861,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 90 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 94 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -8850,7 +8873,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -8864,7 +8887,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -8875,7 +8898,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 91 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 95 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -8885,7 +8908,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -8921,7 +8944,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 92 ;) (type $fi) (param $0 f32) (result i32) + (func $~lib/internal/hash/hash (; 96 ;) (type $fi) (param $0 f32) (result i32) (return (call $~lib/internal/hash/hash32 (i32.reinterpret/f32 @@ -8930,7 +8953,7 @@ ) ) ) - (func $~lib/set/Set#find (; 93 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 97 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -8946,7 +8969,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -8965,7 +8988,7 @@ (i32.load offset=4 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -8987,7 +9010,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -9000,7 +9023,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 94 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/set/Set#has (; 98 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -9012,7 +9035,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 95 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 99 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9036,7 +9059,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -9047,7 +9070,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -9068,7 +9091,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -9087,7 +9110,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -9108,7 +9131,7 @@ (i32.load offset=4 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -9145,7 +9168,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -9206,7 +9229,7 @@ ) ) ) - (func $~lib/set/Set#add (; 96 ;) (type $ifv) (param $0 i32) (param $1 f32) + (func $~lib/set/Set#add (; 100 ;) (type $ifv) (param $0 i32) (param $1 f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9251,7 +9274,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -9279,7 +9302,7 @@ (i32.add (i32.add (get_local $4) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -9328,7 +9351,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -9345,12 +9368,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 97 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 101 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 98 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/set/Set#delete (; 102 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9384,7 +9407,7 @@ (i32.load offset=4 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -9414,7 +9437,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -9439,7 +9462,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -9452,7 +9475,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 99 ;) (type $v) + (func $std/set/test (; 103 ;) (type $v) (local $0 i32) (local $1 f32) (set_local $0 @@ -9840,7 +9863,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 100 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 104 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -9852,7 +9875,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -9866,7 +9889,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -9877,7 +9900,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 101 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 105 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -9887,7 +9910,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -9923,7 +9946,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 102 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/internal/hash/hash (; 106 ;) (type $Fi) (param $0 f64) (result i32) (return (call $~lib/internal/hash/hash64 (i64.reinterpret/f64 @@ -9932,7 +9955,7 @@ ) ) ) - (func $~lib/set/Set#find (; 103 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 107 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -9948,7 +9971,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -9967,7 +9990,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -9989,7 +10012,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -10002,7 +10025,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 104 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/set/Set#has (; 108 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -10014,7 +10037,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 105 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 109 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10038,7 +10061,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -10049,7 +10072,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -10070,7 +10093,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -10089,7 +10112,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -10110,7 +10133,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -10147,7 +10170,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -10208,7 +10231,7 @@ ) ) ) - (func $~lib/set/Set#add (; 106 ;) (type $iFv) (param $0 i32) (param $1 f64) + (func $~lib/set/Set#add (; 110 ;) (type $iFv) (param $0 i32) (param $1 f64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10253,7 +10276,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -10281,7 +10304,7 @@ (i32.add (i32.add (get_local $4) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -10330,7 +10353,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -10347,12 +10370,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 107 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 111 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 108 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/set/Set#delete (; 112 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10386,7 +10409,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -10416,7 +10439,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -10441,7 +10464,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -10454,7 +10477,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 109 ;) (type $v) + (func $std/set/test (; 113 ;) (type $v) (local $0 i32) (local $1 f64) (set_local $0 @@ -10842,15 +10865,15 @@ ) ) ) - (func $start (; 110 ;) (type $v) + (func $start (; 114 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add (get_global $HEAP_BASE) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) diff --git a/tests/compiler/std/static-array.optimized.wat b/tests/compiler/std/static-array.optimized.wat index f8fcab89..cd5e5d0a 100644 --- a/tests/compiler/std/static-array.optimized.wat +++ b/tests/compiler/std/static-array.optimized.wat @@ -3,6 +3,7 @@ (type $iiiiv (func (param i32 i32 i32 i32))) (type $iii (func (param i32 i32) (result i32))) (type $iiiv (func (param i32 i32 i32))) + (type $i (func (result i32))) (type $iiI (func (param i32 i32) (result i64))) (type $iiIv (func (param i32 i32 i64))) (type $iif (func (param i32 i32) (result f32))) @@ -13,7 +14,6 @@ (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 272)) (memory $0 1) (data (i32.const 8) "\10\00\00\00\02\00\00\00\08\00\00\00\00\00\00\00\01\00\00\00\02") (data (i32.const 32) "(\00\00\00\02\00\00\00\10\00\00\00\00\00\00\00\03\00\00\00\00\00\00\00\04") @@ -74,7 +74,7 @@ ) ) ) - (func $~lib/memory/set_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -404,7 +404,22 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.fill (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/memory/memory.size (; 6 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 7 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 8 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -436,14 +451,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -471,7 +486,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -490,7 +505,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 9 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/internal/arraybuffer/allocUnsafe (; 10 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -509,7 +529,7 @@ ) (i32.store (tee_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -519,7 +539,7 @@ ) (get_local $1) ) - (func $~lib/memory/copy_memory (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memcpy (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1905,7 +1925,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -1940,7 +1960,7 @@ (if (get_local $3) (block - (call $~lib/memory/copy_memory + (call $~lib/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2197,10 +2217,16 @@ ) ) ) - (func $~lib/internal/arraybuffer/reallocUnsafe (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.copy (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memmove + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/internal/arraybuffer/reallocUnsafe (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) - (local $4 i32) (if (i32.gt_s (get_local $1) @@ -2241,7 +2267,7 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (i32.add (get_local $0) @@ -2257,16 +2283,14 @@ ) ) (block - (call $~lib/memory/move_memory - (tee_local $4 - (i32.add - (tee_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe - (get_local $1) - ) + (call $~lib/memory/memory.copy + (i32.add + (tee_local $3 + (call $~lib/internal/arraybuffer/allocUnsafe + (get_local $1) ) - (i32.const 8) ) + (i32.const 8) ) (i32.add (get_local $0) @@ -2274,9 +2298,12 @@ ) (get_local $2) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add - (get_local $4) + (i32.add + (get_local $3) + (i32.const 8) + ) (get_local $2) ) (i32.const 0) @@ -2321,7 +2348,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#__set (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__set (; 15 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -2388,7 +2415,7 @@ (get_local $2) ) ) - (func $~lib/array/Array#__get (; 11 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64) + (func $~lib/array/Array#__get (; 16 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64) (if (result i64) (i32.lt_u (get_local $1) @@ -2415,7 +2442,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 12 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64) + (func $~lib/array/Array#__set (; 17 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (local $4 i32) (if @@ -2482,7 +2509,7 @@ (get_local $2) ) ) - (func $~lib/array/Array#__get (; 13 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) + (func $~lib/array/Array#__get (; 18 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) (if (result f32) (i32.lt_u (get_local $1) @@ -2509,7 +2536,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 14 ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32) + (func $~lib/array/Array#__set (; 19 ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32) (local $3 i32) (local $4 i32) (if @@ -2576,7 +2603,7 @@ (get_local $2) ) ) - (func $~lib/array/Array#__get (; 15 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/array/Array#__get (; 20 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (if (result f64) (i32.lt_u (get_local $1) @@ -2603,7 +2630,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 16 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64) + (func $~lib/array/Array#__set (; 21 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (local $4 i32) (if @@ -2670,15 +2697,9 @@ (get_local $2) ) ) - (func $start (; 17 ;) (type $v) + (func $start (; 22 ;) (type $v) (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 272) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) diff --git a/tests/compiler/std/static-array.untouched.wat b/tests/compiler/std/static-array.untouched.wat index b68eb241..bf7a272d 100644 --- a/tests/compiler/std/static-array.untouched.wat +++ b/tests/compiler/std/static-array.untouched.wat @@ -3,6 +3,7 @@ (type $iiiiv (func (param i32 i32 i32 i32))) (type $iii (func (param i32 i32) (result i32))) (type $iiiv (func (param i32 i32 i32))) + (type $i (func (result i32))) (type $iiI (func (param i32 i32) (result i64))) (type $iiIv (func (param i32 i32 i64))) (type $iif (func (param i32 i32) (result f32))) @@ -79,7 +80,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -87,7 +88,7 @@ ) ) ) - (func $~lib/memory/set_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -439,7 +440,22 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.fill (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/memory/memory.size (; 6 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 7 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 8 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -452,7 +468,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -466,16 +482,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -520,14 +536,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -547,13 +563,20 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 9 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/internal/arraybuffer/allocUnsafe (; 10 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.eqz (i32.le_u (get_local $0) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) ) (block @@ -567,7 +590,7 @@ ) ) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -579,7 +602,7 @@ ) (get_local $1) ) - (func $~lib/memory/copy_memory (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memcpy (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2381,7 +2404,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.eq @@ -2411,7 +2434,7 @@ ) ) (block - (call $~lib/memory/copy_memory + (call $~lib/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2699,7 +2722,14 @@ ) ) ) - (func $~lib/internal/arraybuffer/reallocUnsafe (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.copy (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memmove + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/internal/arraybuffer/reallocUnsafe (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (set_local $2 @@ -2717,7 +2747,7 @@ (i32.eqz (i32.le_s (get_local $1) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) ) (block @@ -2737,7 +2767,7 @@ (call $~lib/internal/arraybuffer/computeSize (get_local $2) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block @@ -2745,11 +2775,11 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (get_local $2) ) @@ -2766,22 +2796,22 @@ (get_local $1) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (get_local $2) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (get_local $2) ) @@ -2829,7 +2859,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#__set (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__set (; 15 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -2904,12 +2934,12 @@ ) ) ) - (func $~lib/array/Array#get:length (; 11 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 16 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $~lib/array/Array#__get (; 12 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64) + (func $~lib/array/Array#__get (; 17 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64) (local $2 i32) (set_local $2 (i32.load @@ -2940,7 +2970,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 13 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64) + (func $~lib/array/Array#__set (; 18 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (local $4 i32) (set_local $3 @@ -3015,12 +3045,12 @@ ) ) ) - (func $~lib/array/Array#get:length (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 19 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $~lib/array/Array#__get (; 15 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) + (func $~lib/array/Array#__get (; 20 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) (set_local $2 (i32.load @@ -3051,7 +3081,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 16 ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32) + (func $~lib/array/Array#__set (; 21 ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32) (local $3 i32) (local $4 i32) (set_local $3 @@ -3126,12 +3156,12 @@ ) ) ) - (func $~lib/array/Array#get:length (; 17 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 22 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $~lib/array/Array#__get (; 18 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/array/Array#__get (; 23 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.load @@ -3162,7 +3192,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 19 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64) + (func $~lib/array/Array#__set (; 24 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (local $4 i32) (set_local $3 @@ -3237,15 +3267,15 @@ ) ) ) - (func $start (; 20 ;) (type $v) + (func $start (; 25 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add (get_global $HEAP_BASE) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) @@ -3257,7 +3287,7 @@ (i32.eqz (i32.eq (call $~lib/array/Array#get:length - (i32.const 8) + (get_global $std/static-array/i) ) (i32.const 2) ) @@ -3276,7 +3306,7 @@ (i32.eqz (i32.eq (call $~lib/array/Array#__get - (i32.const 8) + (get_global $std/static-array/i) (i32.const 0) ) (i32.const 1) @@ -3296,7 +3326,7 @@ (i32.eqz (i32.eq (call $~lib/array/Array#__get - (i32.const 8) + (get_global $std/static-array/i) (i32.const 1) ) (i32.const 2) @@ -3313,7 +3343,7 @@ ) ) (call $~lib/array/Array#__set - (i32.const 8) + (get_global $std/static-array/i) (i32.const 0) (i32.const 2) ) @@ -3321,7 +3351,7 @@ (i32.eqz (i32.eq (call $~lib/array/Array#__get - (i32.const 8) + (get_global $std/static-array/i) (i32.const 0) ) (i32.const 2) @@ -3341,7 +3371,7 @@ (i32.eqz (i32.eq (call $~lib/array/Array#get:length - (i32.const 32) + (get_global $std/static-array/I) ) (i32.const 2) ) @@ -3360,7 +3390,7 @@ (i32.eqz (i64.eq (call $~lib/array/Array#__get - (i32.const 32) + (get_global $std/static-array/I) (i32.const 0) ) (i64.const 3) @@ -3380,7 +3410,7 @@ (i32.eqz (i64.eq (call $~lib/array/Array#__get - (i32.const 32) + (get_global $std/static-array/I) (i32.const 1) ) (i64.const 4) @@ -3397,7 +3427,7 @@ ) ) (call $~lib/array/Array#__set - (i32.const 32) + (get_global $std/static-array/I) (i32.const 0) (i64.const 4) ) @@ -3405,7 +3435,7 @@ (i32.eqz (i64.eq (call $~lib/array/Array#__get - (i32.const 32) + (get_global $std/static-array/I) (i32.const 0) ) (i64.const 4) @@ -3425,7 +3455,7 @@ (i32.eqz (i32.eq (call $~lib/array/Array#get:length - (i32.const 72) + (get_global $std/static-array/f) ) (i32.const 2) ) @@ -3444,7 +3474,7 @@ (i32.eqz (f32.eq (call $~lib/array/Array#__get - (i32.const 72) + (get_global $std/static-array/f) (i32.const 0) ) (f32.const 1.5) @@ -3464,7 +3494,7 @@ (i32.eqz (f32.eq (call $~lib/array/Array#__get - (i32.const 72) + (get_global $std/static-array/f) (i32.const 1) ) (f32.const 2.5) @@ -3481,7 +3511,7 @@ ) ) (call $~lib/array/Array#__set - (i32.const 72) + (get_global $std/static-array/f) (i32.const 0) (f32.const 2.5) ) @@ -3489,7 +3519,7 @@ (i32.eqz (f32.eq (call $~lib/array/Array#__get - (i32.const 72) + (get_global $std/static-array/f) (i32.const 0) ) (f32.const 2.5) @@ -3509,7 +3539,7 @@ (i32.eqz (i32.eq (call $~lib/array/Array#get:length - (i32.const 96) + (get_global $std/static-array/F) ) (i32.const 2) ) @@ -3528,7 +3558,7 @@ (i32.eqz (f64.eq (call $~lib/array/Array#__get - (i32.const 96) + (get_global $std/static-array/F) (i32.const 0) ) (f64.const 1.25) @@ -3548,7 +3578,7 @@ (i32.eqz (f64.eq (call $~lib/array/Array#__get - (i32.const 96) + (get_global $std/static-array/F) (i32.const 1) ) (f64.const 2.25) @@ -3565,7 +3595,7 @@ ) ) (call $~lib/array/Array#__set - (i32.const 96) + (get_global $std/static-array/F) (i32.const 0) (f64.const 2.25) ) @@ -3573,7 +3603,7 @@ (i32.eqz (f64.eq (call $~lib/array/Array#__get - (i32.const 96) + (get_global $std/static-array/F) (i32.const 0) ) (f64.const 2.25) diff --git a/tests/compiler/std/string-utf8.optimized.wat b/tests/compiler/std/string-utf8.optimized.wat index fab9b2dc..1ee1da84 100644 --- a/tests/compiler/std/string-utf8.optimized.wat +++ b/tests/compiler/std/string-utf8.optimized.wat @@ -1,6 +1,7 @@ (module (type $ii (func (param i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) + (type $i (func (result i32))) (type $iv (func (param i32))) (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) @@ -9,7 +10,6 @@ (global $std/string-utf8/str (mut i32) (i32.const 8)) (global $std/string-utf8/len (mut i32) (i32.const 0)) (global $std/string-utf8/ptr (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 64)) (memory $0 1) (data (i32.const 8) "\06\00\00\00\01\d87\dch\00i\00R\d8b\df") (data (i32.const 24) "\12\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00-\00u\00t\00f\008\00.\00t\00s") @@ -161,7 +161,15 @@ ) (get_local $1) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 2 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 3 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -193,14 +201,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -228,7 +236,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -247,7 +255,12 @@ ) (i32.const 0) ) - (func $~lib/string/String#toUTF8 (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/string/String#toUTF8 (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -256,7 +269,7 @@ (local $6 i32) (local $7 i32) (set_local $5 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/string/String#get:lengthUTF8 (get_local $0) ) @@ -533,18 +546,17 @@ ) (get_local $5) ) - (func $~lib/allocator/arena/free_memory (; 4 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 7 ;) (type $iv) (param $0 i32) (nop) ) - (func $start (; 5 ;) (type $v) + (func $~lib/memory/memory.free (; 8 ;) (type $iv) (param $0 i32) + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + ) + (func $start (; 9 ;) (type $v) (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 64) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) @@ -758,7 +770,7 @@ (unreachable) ) ) - (call $~lib/allocator/arena/free_memory + (call $~lib/memory/memory.free (get_global $std/string-utf8/ptr) ) ) diff --git a/tests/compiler/std/string-utf8.ts b/tests/compiler/std/string-utf8.ts index 3406cc86..0ce54e90 100644 --- a/tests/compiler/std/string-utf8.ts +++ b/tests/compiler/std/string-utf8.ts @@ -20,4 +20,4 @@ assert(load(ptr, 8) == 0xad); assert(load(ptr, 9) == 0xa2); assert(load(ptr, 10) == 0); -free_memory(ptr); +memory.free(ptr); diff --git a/tests/compiler/std/string-utf8.untouched.wat b/tests/compiler/std/string-utf8.untouched.wat index 569e8d45..9c9faa99 100644 --- a/tests/compiler/std/string-utf8.untouched.wat +++ b/tests/compiler/std/string-utf8.untouched.wat @@ -1,6 +1,7 @@ (module (type $ii (func (param i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) + (type $i (func (result i32))) (type $iv (func (param i32))) (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) @@ -177,7 +178,15 @@ ) (get_local $1) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 2 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 3 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -190,7 +199,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -204,16 +213,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -258,14 +267,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -285,7 +294,14 @@ ) (i32.const 0) ) - (func $~lib/string/String#toUTF8 (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/string/String#toUTF8 (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -294,7 +310,7 @@ (local $6 i32) (local $7 i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/string/String#get:lengthUTF8 (get_local $0) ) @@ -597,18 +613,24 @@ ) (get_local $1) ) - (func $~lib/allocator/arena/free_memory (; 4 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 7 ;) (type $iv) (param $0 i32) (nop) ) - (func $start (; 5 ;) (type $v) + (func $~lib/memory/memory.free (; 8 ;) (type $iv) (param $0 i32) + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + (return) + ) + (func $start (; 9 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add (get_global $HEAP_BASE) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) @@ -852,7 +874,7 @@ (unreachable) ) ) - (call $~lib/allocator/arena/free_memory + (call $~lib/memory/memory.free (get_global $std/string-utf8/ptr) ) ) diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index db2a6fe7..d0ac36a2 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -17,7 +17,6 @@ (global $std/string/nullStr (mut i32) (i32.const 0)) (global $~argc (mut i32) (i32.const 0)) (global $std/string/c (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 2516)) (memory $0 1) (data (i32.const 12) "\10\00\00\00h\00i\00,\00 \00I\00\'\00m\00 \00a\00 \00s\00t\00r\00i\00n\00g") (data (i32.const 48) "\0d\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") @@ -89,8 +88,8 @@ (data (i32.const 2388) "\12\00\00\00-\001\009\009\009\009\008\006\008\007\001\009\004\007\006\007\003\005") (data (i32.const 2428) "\13\00\00\009\002\002\003\003\007\002\000\003\006\008\005\004\007\007\005\008\000\007") (data (i32.const 2472) "\14\00\00\00-\009\002\002\003\003\007\002\000\003\006\008\005\004\007\007\005\008\000\008") - (export "getString" (func $std/string/getString)) (export "memory" (memory $0)) + (export "getString" (func $std/string/getString)) (start $start) (func $~lib/string/String#charCodeAt (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if @@ -128,7 +127,8 @@ ) ) ) - (func $~lib/memory/compare_memory (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memcmp (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -140,8 +140,13 @@ ) (loop $continue|0 (if - (if (result i32) - (get_local $2) + (tee_local $3 + (i32.ne + (get_local $2) + (i32.const 0) + ) + ) + (set_local $3 (i32.eq (i32.load8_u (get_local $0) @@ -150,8 +155,10 @@ (get_local $1) ) ) - (get_local $2) ) + ) + (if + (get_local $3) (block (set_local $2 (i32.sub @@ -190,7 +197,14 @@ ) ) ) - (func $~lib/string/String#startsWith (; 3 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.compare (; 3 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (call $~lib/memory/memcmp + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/string/String#startsWith (; 4 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (if @@ -254,7 +268,7 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (i32.add (get_local $0) @@ -276,7 +290,7 @@ ) ) ) - (func $~lib/string/String#endsWith (; 4 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#endsWith (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -339,7 +353,7 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (i32.add (get_local $0) @@ -361,11 +375,11 @@ ) ) ) - (func $~lib/string/String#endsWith|trampoline (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#endsWith|trampoline (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $1of1 (block $0of1 - (block $oob - (br_table $0of1 $1of1 $oob + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange (i32.sub (get_global $~argc) (i32.const 1) @@ -384,7 +398,7 @@ (get_local $2) ) ) - (func $~lib/string/String#indexOf (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#indexOf (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (if @@ -467,7 +481,7 @@ ) ) (if - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (i32.add (get_local $0) @@ -504,7 +518,7 @@ ) (i32.const -1) ) - (func $~lib/string/String#includes (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#includes (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ne (call $~lib/string/String#indexOf (get_local $0) @@ -514,7 +528,7 @@ (i32.const -1) ) ) - (func $~lib/string/String#lastIndexOf (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#lastIndexOf (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (if @@ -597,7 +611,7 @@ ) ) (if - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (i32.add (get_local $0) @@ -634,11 +648,11 @@ ) (i32.const -1) ) - (func $~lib/string/String#lastIndexOf|trampoline (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#lastIndexOf|trampoline (; 10 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $1of1 (block $0of1 - (block $oob - (br_table $0of1 $1of1 $oob + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange (i32.sub (get_global $~argc) (i32.const 1) @@ -657,10 +671,10 @@ (get_local $2) ) ) - (func $std/string/getString (; 10 ;) (type $i) (result i32) + (func $std/string/getString (; 11 ;) (type $i) (result i32) (get_global $std/string/str) ) - (func $~lib/internal/string/parse (; 11 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/internal/string/parse (; 12 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1023,13 +1037,13 @@ (get_local $5) ) ) - (func $~lib/string/parseInt (; 12 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/string/parseInt (; 13 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (call $~lib/internal/string/parse (get_local $0) (get_local $1) ) ) - (func $~lib/string/parseFloat (; 13 ;) (type $iF) (param $0 i32) (result f64) + (func $~lib/string/parseFloat (; 14 ;) (type $iF) (param $0 i32) (result f64) (local $1 i32) (local $2 i32) (local $3 i32) @@ -1279,7 +1293,15 @@ (get_local $4) ) ) - (func $~lib/allocator/arena/allocate_memory (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 15 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 16 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 17 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -1311,14 +1333,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -1346,7 +1368,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -1365,7 +1387,12 @@ ) (i32.const 0) ) - (func $~lib/internal/string/allocate (; 15 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 18 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/internal/string/allocate (; 19 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (tee_local $1 @@ -1397,7 +1424,7 @@ ) (i32.store (tee_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.add (i32.shl (get_local $0) @@ -1411,7 +1438,7 @@ ) (get_local $1) ) - (func $~lib/memory/copy_memory (; 16 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memcpy (; 20 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2797,7 +2824,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 17 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 21 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -2832,7 +2859,7 @@ (if (get_local $3) (block - (call $~lib/memory/copy_memory + (call $~lib/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -3089,11 +3116,17 @@ ) ) ) - (func $~lib/string/String#concat (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.copy (; 22 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memmove + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/string/String#concat (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) - (local $5 i32) (if (i32.eqz (get_local $0) @@ -3137,16 +3170,14 @@ (i32.const 8) ) ) - (call $~lib/memory/move_memory - (tee_local $5 - (i32.add - (tee_local $2 - (call $~lib/internal/string/allocate - (get_local $2) - ) + (call $~lib/memory/memory.copy + (i32.add + (tee_local $2 + (call $~lib/internal/string/allocate + (get_local $2) ) - (i32.const 4) ) + (i32.const 4) ) (i32.add (get_local $0) @@ -3159,9 +3190,12 @@ ) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add - (get_local $5) + (i32.add + (get_local $2) + (i32.const 4) + ) (get_local $0) ) (i32.add @@ -3175,7 +3209,7 @@ ) (get_local $2) ) - (func $~lib/string/String.__concat (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__concat (; 24 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) @@ -3189,7 +3223,7 @@ (get_local $1) ) ) - (func $~lib/string/String.__eq (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eq @@ -3236,7 +3270,7 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -3252,7 +3286,7 @@ ) ) ) - (func $~lib/string/String.__ne (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__ne (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.eqz (call $~lib/string/String.__eq (get_local $0) @@ -3260,7 +3294,7 @@ ) ) ) - (func $~lib/string/String.__gt (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__gt (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -3320,7 +3354,7 @@ ) ) (i32.gt_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -3344,7 +3378,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__gte (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__gte (; 28 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -3404,7 +3438,7 @@ ) ) (i32.ge_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -3428,7 +3462,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__lt (; 24 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__lt (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -3488,7 +3522,7 @@ ) ) (i32.lt_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -3512,7 +3546,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__lte (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__lte (; 30 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -3572,7 +3606,7 @@ ) ) (i32.le_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -3596,7 +3630,7 @@ (i32.const 0) ) ) - (func $~lib/string/String#repeat (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#repeat (; 31 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3709,7 +3743,7 @@ (get_local $1) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add (i32.add (get_local $4) @@ -3734,7 +3768,7 @@ ) (get_local $4) ) - (func $~lib/internal/itoa/decimalCountU32 (; 27 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/decimalCountU32 (; 32 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $2 @@ -3774,7 +3808,7 @@ (i32.const 1) ) ) - (func $~lib/internal/itoa/utoa32_lut (; 28 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/itoa/utoa32_lut (; 33 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -3935,7 +3969,7 @@ ) ) ) - (func $~lib/internal/itoa/itoa32 (; 29 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/itoa32 (; 34 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -3986,7 +4020,7 @@ ) (get_local $2) ) - (func $~lib/internal/itoa/utoa32 (; 30 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/utoa32 (; 35 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -4012,7 +4046,7 @@ ) (get_local $2) ) - (func $~lib/internal/itoa/decimalCountU64 (; 31 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/decimalCountU64 (; 36 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i64) (set_local $2 @@ -4060,7 +4094,7 @@ (i32.const 1) ) ) - (func $~lib/internal/itoa/utoa64_lut (; 32 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/internal/itoa/utoa64_lut (; 37 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4206,7 +4240,7 @@ (get_local $2) ) ) - (func $~lib/internal/itoa/utoa64 (; 33 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/utoa64 (; 38 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4256,7 +4290,7 @@ ) (get_local $2) ) - (func $~lib/internal/itoa/itoa64 (; 34 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/itoa64 (; 39 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4334,15 +4368,9 @@ ) (get_local $3) ) - (func $start (; 35 ;) (type $v) + (func $start (; 40 ;) (type $v) (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 2520) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) diff --git a/tests/compiler/std/string.untouched.wat b/tests/compiler/std/string.untouched.wat index b34550ed..6ad6076a 100644 --- a/tests/compiler/std/string.untouched.wat +++ b/tests/compiler/std/string.untouched.wat @@ -25,6 +25,7 @@ (global $std/string/str (mut i32) (i32.const 12)) (global $std/string/nullStr (mut i32) (i32.const 0)) (global $~argc (mut i32) (i32.const 0)) + (global $i32.MAX_VALUE i32 (i32.const 2147483647)) (global $NaN f64 (f64.const nan:0x8000000000000)) (global $~lib/internal/string/CharCode.PLUS i32 (i32.const 43)) (global $~lib/internal/string/CharCode.MINUS i32 (i32.const 45)) @@ -52,6 +53,11 @@ (global $~lib/internal/string/CharCode.x i32 (i32.const 120)) (global $~lib/internal/string/CharCode.z i32 (i32.const 122)) (global $std/string/c (mut i32) (i32.const 0)) + (global $ASC_SHRINK_LEVEL i32 (i32.const 0)) + (global $u32.MAX_VALUE i32 (i32.const -1)) + (global $u64.MAX_VALUE i64 (i64.const -1)) + (global $i64.MAX_VALUE i64 (i64.const 9223372036854775807)) + (global $i64.MIN_VALUE i64 (i64.const -9223372036854775808)) (global $HEAP_BASE i32 (i32.const 2516)) (memory $0 1) (data (i32.const 8) "\00\00\00\00") @@ -125,8 +131,8 @@ (data (i32.const 2388) "\12\00\00\00-\001\009\009\009\009\008\006\008\007\001\009\004\007\006\007\003\005\00") (data (i32.const 2428) "\13\00\00\009\002\002\003\003\007\002\000\003\006\008\005\004\007\007\005\008\000\007\00") (data (i32.const 2472) "\14\00\00\00-\009\002\002\003\003\007\002\000\003\006\008\005\004\007\007\005\008\000\008\00") - (export "getString" (func $std/string/getString)) (export "memory" (memory $0)) + (export "getString" (func $std/string/getString)) (start $start) (func $~lib/string/String#charCodeAt (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if @@ -167,7 +173,8 @@ ) ) ) - (func $~lib/memory/compare_memory (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memcmp (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -181,7 +188,12 @@ (loop $continue|0 (if (if (result i32) - (get_local $2) + (tee_local $3 + (i32.ne + (get_local $2) + (i32.const 0) + ) + ) (i32.eq (i32.load8_u (get_local $0) @@ -190,7 +202,7 @@ (get_local $1) ) ) - (get_local $2) + (get_local $3) ) (block (block @@ -231,7 +243,14 @@ (i32.const 0) ) ) - (func $~lib/string/String#startsWith (; 3 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.compare (; 3 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (call $~lib/memory/memcmp + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/string/String#startsWith (; 4 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -321,11 +340,11 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $8) @@ -334,7 +353,7 @@ ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $9) @@ -343,7 +362,7 @@ ) ) ) - (func $~lib/string/String#endsWith (; 4 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#endsWith (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -433,11 +452,11 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $9) @@ -446,7 +465,7 @@ ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $8) @@ -455,11 +474,11 @@ ) ) ) - (func $~lib/string/String#endsWith|trampoline (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#endsWith|trampoline (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $1of1 (block $0of1 - (block $oob - (br_table $0of1 $1of1 $oob + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange (i32.sub (get_global $~argc) (i32.const 1) @@ -469,7 +488,7 @@ (unreachable) ) (set_local $2 - (i32.const 536870910) + (get_global $~lib/internal/string/MAX_LENGTH) ) ) (call $~lib/string/String#endsWith @@ -478,7 +497,7 @@ (get_local $2) ) ) - (func $~lib/string/String#indexOf (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#indexOf (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -588,11 +607,11 @@ ) (if (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $5) @@ -601,7 +620,7 @@ ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $3) @@ -624,7 +643,7 @@ ) (i32.const -1) ) - (func $~lib/string/String#includes (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#includes (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ne (call $~lib/string/String#indexOf (get_local $0) @@ -634,7 +653,7 @@ (i32.const -1) ) ) - (func $~lib/string/String#lastIndexOf (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#lastIndexOf (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -745,11 +764,11 @@ ) (if (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $6) @@ -758,7 +777,7 @@ ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $4) @@ -781,11 +800,11 @@ ) (i32.const -1) ) - (func $~lib/string/String#lastIndexOf|trampoline (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#lastIndexOf|trampoline (; 10 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $1of1 (block $0of1 - (block $oob - (br_table $0of1 $1of1 $oob + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange (i32.sub (get_global $~argc) (i32.const 1) @@ -795,7 +814,7 @@ (unreachable) ) (set_local $2 - (i32.const 2147483647) + (get_global $i32.MAX_VALUE) ) ) (call $~lib/string/String#lastIndexOf @@ -804,10 +823,10 @@ (get_local $2) ) ) - (func $std/string/getString (; 10 ;) (type $i) (result i32) + (func $std/string/getString (; 11 ;) (type $i) (result i32) (get_global $std/string/str) ) - (func $~lib/internal/string/parse (; 11 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/internal/string/parse (; 12 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -838,7 +857,7 @@ (if (i32.eq (get_local $4) - (i32.const 45) + (get_global $~lib/internal/string/CharCode.MINUS) ) (block (if @@ -871,7 +890,7 @@ (if (i32.eq (get_local $4) - (i32.const 43) + (get_global $~lib/internal/string/CharCode.PLUS) ) (block (if @@ -915,7 +934,7 @@ (tee_local $6 (i32.eq (get_local $4) - (i32.const 48) + (get_global $~lib/internal/string/CharCode._0) ) ) (i32.gt_s @@ -943,37 +962,37 @@ (br_if $case0|0 (i32.eq (get_local $6) - (i32.const 66) + (get_global $~lib/internal/string/CharCode.B) ) ) (br_if $case1|0 (i32.eq (get_local $6) - (i32.const 98) + (get_global $~lib/internal/string/CharCode.b) ) ) (br_if $case2|0 (i32.eq (get_local $6) - (i32.const 79) + (get_global $~lib/internal/string/CharCode.O) ) ) (br_if $case3|0 (i32.eq (get_local $6) - (i32.const 111) + (get_global $~lib/internal/string/CharCode.o) ) ) (br_if $case4|0 (i32.eq (get_local $6) - (i32.const 88) + (get_global $~lib/internal/string/CharCode.X) ) ) (br_if $case5|0 (i32.eq (get_local $6) - (i32.const 120) + (get_global $~lib/internal/string/CharCode.x) ) ) (br $case6|0) @@ -1095,19 +1114,19 @@ (tee_local $6 (i32.ge_s (get_local $4) - (i32.const 48) + (get_global $~lib/internal/string/CharCode._0) ) ) (i32.le_s (get_local $4) - (i32.const 57) + (get_global $~lib/internal/string/CharCode._9) ) (get_local $6) ) (set_local $4 (i32.sub (get_local $4) - (i32.const 48) + (get_global $~lib/internal/string/CharCode._0) ) ) (if @@ -1115,12 +1134,12 @@ (tee_local $6 (i32.ge_s (get_local $4) - (i32.const 65) + (get_global $~lib/internal/string/CharCode.A) ) ) (i32.le_s (get_local $4) - (i32.const 90) + (get_global $~lib/internal/string/CharCode.Z) ) (get_local $6) ) @@ -1128,7 +1147,7 @@ (i32.sub (get_local $4) (i32.sub - (i32.const 65) + (get_global $~lib/internal/string/CharCode.A) (i32.const 10) ) ) @@ -1138,12 +1157,12 @@ (tee_local $6 (i32.ge_s (get_local $4) - (i32.const 97) + (get_global $~lib/internal/string/CharCode.a) ) ) (i32.le_s (get_local $4) - (i32.const 122) + (get_global $~lib/internal/string/CharCode.z) ) (get_local $6) ) @@ -1151,7 +1170,7 @@ (i32.sub (get_local $4) (i32.sub - (i32.const 97) + (get_global $~lib/internal/string/CharCode.a) (i32.const 10) ) ) @@ -1197,13 +1216,13 @@ (get_local $7) ) ) - (func $~lib/string/parseInt (; 12 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/string/parseInt (; 13 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (call $~lib/internal/string/parse (get_local $0) (get_local $1) ) ) - (func $~lib/string/parseFloat (; 13 ;) (type $iF) (param $0 i32) (result f64) + (func $~lib/string/parseFloat (; 14 ;) (type $iF) (param $0 i32) (result f64) (local $1 i32) (local $2 i32) (local $3 i32) @@ -1235,7 +1254,7 @@ (if (i32.eq (get_local $3) - (i32.const 45) + (get_global $~lib/internal/string/CharCode.MINUS) ) (block (if @@ -1268,7 +1287,7 @@ (if (i32.eq (get_local $3) - (i32.const 43) + (get_global $~lib/internal/string/CharCode.PLUS) ) (block (if @@ -1331,7 +1350,7 @@ (if (i32.eq (get_local $3) - (i32.const 46) + (get_global $~lib/internal/string/CharCode.DOT) ) (block (set_local $2 @@ -1370,13 +1389,13 @@ (tee_local $6 (i32.eq (get_local $3) - (i32.const 69) + (get_global $~lib/internal/string/CharCode.E) ) ) (get_local $6) (i32.eq (get_local $3) - (i32.const 101) + (get_global $~lib/internal/string/CharCode.e) ) ) (if @@ -1397,7 +1416,7 @@ (set_local $3 (i32.sub (get_local $3) - (i32.const 48) + (get_global $~lib/internal/string/CharCode._0) ) ) (if @@ -1442,7 +1461,7 @@ (set_local $3 (i32.sub (get_local $3) - (i32.const 48) + (get_global $~lib/internal/string/CharCode._0) ) ) (if @@ -1480,7 +1499,15 @@ (get_local $5) ) ) - (func $~lib/allocator/arena/allocate_memory (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 15 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 16 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 17 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -1493,7 +1520,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -1507,16 +1534,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -1561,14 +1588,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -1588,7 +1615,14 @@ ) (i32.const 0) ) - (func $~lib/internal/string/allocate (; 15 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 18 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/internal/string/allocate (; 19 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -1602,7 +1636,7 @@ ) (i32.le_s (get_local $0) - (i32.const 536870910) + (get_global $~lib/internal/string/MAX_LENGTH) ) (get_local $1) ) @@ -1618,9 +1652,9 @@ ) ) (set_local $2 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.add - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) (i32.shl (get_local $0) (i32.const 1) @@ -1634,7 +1668,7 @@ ) (get_local $2) ) - (func $~lib/memory/copy_memory (; 16 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memcpy (; 20 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3436,7 +3470,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 17 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 21 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.eq @@ -3466,7 +3500,7 @@ ) ) (block - (call $~lib/memory/copy_memory + (call $~lib/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -3754,7 +3788,14 @@ ) ) ) - (func $~lib/string/String#concat (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.copy (; 22 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memmove + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/string/String#concat (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3807,7 +3848,7 @@ (i32.const 0) ) (return - (i32.const 8) + (get_global $~lib/internal/string/EMPTY) ) ) (set_local $5 @@ -3815,25 +3856,25 @@ (get_local $4) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add (get_local $5) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $2) (i32.const 1) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add (i32.add (get_local $5) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $2) @@ -3842,7 +3883,7 @@ ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $3) @@ -3851,7 +3892,7 @@ ) (get_local $5) ) - (func $~lib/string/String.__concat (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__concat (; 24 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) @@ -3865,7 +3906,7 @@ (get_local $1) ) ) - (func $~lib/string/String.__eq (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -3912,14 +3953,14 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $3) @@ -3928,7 +3969,7 @@ ) ) ) - (func $~lib/string/String.__ne (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__ne (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.eqz (call $~lib/string/String.__eq (get_local $0) @@ -3936,7 +3977,7 @@ ) ) ) - (func $~lib/string/String.__gt (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__gt (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4010,14 +4051,14 @@ ) ) (i32.gt_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $6) @@ -4027,7 +4068,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__gte (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__gte (; 28 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4103,14 +4144,14 @@ ) ) (i32.ge_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $6) @@ -4120,7 +4161,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__lt (; 24 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__lt (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4194,14 +4235,14 @@ ) ) (i32.lt_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $6) @@ -4211,7 +4252,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__lte (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__lte (; 30 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4287,14 +4328,14 @@ ) ) (i32.le_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $6) @@ -4304,7 +4345,7 @@ (i32.const 0) ) ) - (func $~lib/string/String#repeat (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#repeat (; 31 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4376,7 +4417,7 @@ ) ) (return - (i32.const 8) + (get_global $~lib/internal/string/EMPTY) ) ) (if @@ -4423,17 +4464,17 @@ ) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add (i32.add (get_local $4) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (get_local $3) ) (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (get_local $5) ) @@ -4448,7 +4489,7 @@ ) (get_local $4) ) - (func $~lib/internal/itoa/decimalCountU32 (; 27 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/decimalCountU32 (; 32 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4504,7 +4545,7 @@ (i32.const 1) ) ) - (func $~lib/internal/itoa/utoa32_lut (; 28 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/itoa/utoa32_lut (; 33 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4706,7 +4747,7 @@ ) (set_local $5 (i32.add - (i32.const 48) + (get_global $~lib/internal/string/CharCode._0) (get_local $1) ) ) @@ -4723,7 +4764,7 @@ ) ) ) - (func $~lib/internal/itoa/itoa32 (; 29 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/itoa32 (; 34 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4774,12 +4815,12 @@ (get_local $1) (i32.store16 offset=4 (get_local $3) - (i32.const 45) + (get_global $~lib/internal/string/CharCode.MINUS) ) ) (get_local $3) ) - (func $~lib/internal/itoa/utoa32 (; 30 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/utoa32 (; 35 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -4809,7 +4850,7 @@ ) (get_local $2) ) - (func $~lib/internal/itoa/decimalCountU64 (; 31 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/decimalCountU64 (; 36 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4877,7 +4918,7 @@ (i32.const 1) ) ) - (func $~lib/internal/itoa/utoa64_lut (; 32 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/internal/itoa/utoa64_lut (; 37 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i64) (local $5 i32) @@ -5071,7 +5112,7 @@ (get_local $2) ) ) - (func $~lib/internal/itoa/utoa64 (; 33 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/utoa64 (; 38 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -5087,7 +5128,7 @@ (i64.le_u (get_local $0) (i64.extend_u/i32 - (i32.const -1) + (get_global $u32.MAX_VALUE) ) ) (block @@ -5136,7 +5177,7 @@ ) (get_local $1) ) - (func $~lib/internal/itoa/itoa64 (; 34 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/itoa64 (; 39 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -5167,7 +5208,9 @@ (if (i64.le_u (get_local $0) - (i64.const 4294967295) + (i64.extend_u/i32 + (get_global $u32.MAX_VALUE) + ) ) (block (set_local $3 @@ -5223,20 +5266,20 @@ (get_local $1) (i32.store16 offset=4 (get_local $2) - (i32.const 45) + (get_global $~lib/internal/string/CharCode.MINUS) ) ) (get_local $2) ) - (func $start (; 35 ;) (type $v) + (func $start (; 40 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add (get_global $HEAP_BASE) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) @@ -6967,7 +7010,7 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/internal/itoa/utoa32 - (i32.const -1) + (get_global $u32.MAX_VALUE) ) (i32.const 1372) ) @@ -7176,7 +7219,7 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/internal/itoa/utoa64 - (i64.const -1) + (get_global $u64.MAX_VALUE) ) (i32.const 2204) ) @@ -7366,7 +7409,7 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/internal/itoa/itoa64 - (i64.const 9223372036854775807) + (get_global $i64.MAX_VALUE) ) (i32.const 2428) ) @@ -7385,7 +7428,7 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/internal/itoa/itoa64 - (i64.const -9223372036854775808) + (get_global $i64.MIN_VALUE) ) (i32.const 2472) ) diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index 2b424471..1ef7adac 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -1,6 +1,7 @@ (module (type $ii (func (param i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) + (type $i (func (result i32))) (type $iv (func (param i32))) (type $iiii (func (param i32 i32 i32) (result i32))) (type $iiiv (func (param i32 i32 i32))) @@ -21,7 +22,6 @@ (global $std/symbol/key2 (mut i32) (i32.const 0)) (global $std/symbol/key3 (mut i32) (i32.const 0)) (global $std/symbol/key4 (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 156)) (memory $0 1) (data (i32.const 8) "\03\00\00\001\002\003") (data (i32.const 20) "\0d\00\00\00s\00t\00d\00/\00s\00y\00m\00b\00o\00l\00.\00t\00s") @@ -46,7 +46,15 @@ ) (get_local $0) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 2 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 3 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -78,14 +86,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -113,7 +121,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -132,7 +140,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/internal/arraybuffer/computeSize (; 6 ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -146,7 +159,7 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocUnsafe (; 7 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -165,7 +178,7 @@ ) (i32.store (tee_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -175,7 +188,7 @@ ) (get_local $1) ) - (func $~lib/memory/set_memory (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -505,7 +518,14 @@ ) ) ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.fill (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 10 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u @@ -534,7 +554,7 @@ (i32.const 1) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) (i32.const 8) @@ -545,7 +565,7 @@ ) (get_local $3) ) - (func $~lib/map/Map#clear (; 7 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 11 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -579,7 +599,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 12 ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -587,7 +607,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -620,7 +640,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hashStr (; 9 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hashStr (; 13 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -668,7 +688,8 @@ ) (get_local $2) ) - (func $~lib/memory/compare_memory (; 10 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memcmp (; 14 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -680,8 +701,13 @@ ) (loop $continue|0 (if - (if (result i32) - (get_local $2) + (tee_local $3 + (i32.ne + (get_local $2) + (i32.const 0) + ) + ) + (set_local $3 (i32.eq (i32.load8_u (get_local $0) @@ -690,8 +716,10 @@ (get_local $1) ) ) - (get_local $2) ) + ) + (if + (get_local $3) (block (set_local $2 (i32.sub @@ -730,7 +758,14 @@ ) ) ) - (func $~lib/string/String.__eq (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.compare (; 15 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (call $~lib/memory/memcmp + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/string/String.__eq (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eq @@ -777,7 +812,7 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -793,7 +828,7 @@ ) ) ) - (func $~lib/map/Map#find (; 12 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 17 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -856,7 +891,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -868,7 +903,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#get (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -887,7 +922,7 @@ ) ) ) - (func $~lib/map/Map#rehash (; 15 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 20 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1050,7 +1085,7 @@ ) ) ) - (func $~lib/map/Map#set (; 16 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 21 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1187,7 +1222,7 @@ ) ) ) - (func $~lib/internal/hash/hash32 (; 17 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 22 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -1232,7 +1267,7 @@ (i32.const 16777619) ) ) - (func $~lib/map/Map#find (; 18 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 23 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -1295,7 +1330,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#rehash (; 19 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 24 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1458,7 +1493,7 @@ ) ) ) - (func $~lib/map/Map#set (; 20 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 25 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1595,7 +1630,7 @@ ) ) ) - (func $~lib/symbol/Symbol.for (; 21 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/symbol/Symbol.for (; 26 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (get_global $~lib/symbol/stringToId) @@ -1650,7 +1685,7 @@ ) (get_local $1) ) - (func $~lib/map/Map#has (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -1662,7 +1697,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#get (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 28 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -1681,7 +1716,7 @@ ) ) ) - (func $~lib/symbol/Symbol.keyFor (; 24 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/symbol/Symbol.keyFor (; 29 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (tee_local $1 @@ -1708,15 +1743,9 @@ ) ) ) - (func $start (; 25 ;) (type $v) + (func $start (; 30 ;) (type $v) (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 160) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index c3ffdfed..9c7d2e61 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -1,6 +1,7 @@ (module (type $ii (func (param i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) + (type $i (func (result i32))) (type $iv (func (param i32))) (type $iiii (func (param i32 i32 i32) (result i32))) (type $iiiv (func (param i32 i32 i32))) @@ -35,6 +36,8 @@ (global $std/symbol/key2 (mut i32) (i32.const 0)) (global $std/symbol/key3 (mut i32) (i32.const 0)) (global $std/symbol/key4 (mut i32) (i32.const 0)) + (global $~lib/symbol/Symbol.hasInstance i32 (i32.const 1)) + (global $~lib/symbol/Symbol.concatSpreadable i32 (i32.const 2)) (global $HEAP_BASE i32 (i32.const 156)) (memory $0 1) (data (i32.const 8) "\03\00\00\001\002\003\00") @@ -68,7 +71,15 @@ ) (get_local $2) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 2 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 3 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -81,7 +92,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -95,16 +106,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -149,14 +160,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -176,7 +187,14 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/internal/arraybuffer/computeSize (; 6 ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -185,7 +203,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -193,13 +211,13 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocUnsafe (; 7 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.eqz (i32.le_u (get_local $0) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) ) (block @@ -213,7 +231,7 @@ ) ) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -225,7 +243,7 @@ ) (get_local $1) ) - (func $~lib/memory/set_memory (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -577,12 +595,19 @@ ) ) ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memory.fill (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 10 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u (get_local $1) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) (block (call $~lib/env/abort @@ -606,10 +631,10 @@ (i32.const 1) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $1) @@ -617,7 +642,7 @@ ) (get_local $3) ) - (func $~lib/map/Map#clear (; 7 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 11 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -629,7 +654,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -643,7 +668,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -654,7 +679,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 12 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -664,7 +689,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -700,7 +725,7 @@ ) (get_local $0) ) - (func $~lib/map/Map#clear (; 9 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 13 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -712,7 +737,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -726,7 +751,7 @@ ) (i32.store offset=12 (get_local $0) - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (i32.store offset=16 (get_local $0) @@ -737,7 +762,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 10 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 14 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -747,7 +772,7 @@ (tee_local $0 (block (result i32) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -783,12 +808,12 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hashStr (; 11 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hashStr (; 15 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) (set_local $1 - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) ) (block $break|0 (block @@ -824,7 +849,7 @@ ) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $2 @@ -838,7 +863,8 @@ ) (get_local $1) ) - (func $~lib/memory/compare_memory (; 12 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memcmp (; 16 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -852,7 +878,12 @@ (loop $continue|0 (if (if (result i32) - (get_local $2) + (tee_local $3 + (i32.ne + (get_local $2) + (i32.const 0) + ) + ) (i32.eq (i32.load8_u (get_local $0) @@ -861,7 +892,7 @@ (get_local $1) ) ) - (get_local $2) + (get_local $3) ) (block (block @@ -902,7 +933,14 @@ (i32.const 0) ) ) - (func $~lib/string/String.__eq (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.compare (; 17 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (call $~lib/memory/memcmp + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/string/String.__eq (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -949,14 +987,14 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $3) @@ -965,7 +1003,7 @@ ) ) ) - (func $~lib/map/Map#find (; 14 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 19 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -981,7 +1019,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1000,7 +1038,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -1022,7 +1060,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -1035,7 +1073,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -1051,7 +1089,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#get (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -1074,7 +1112,7 @@ (unreachable) ) ) - (func $~lib/map/Map#rehash (; 17 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 22 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1097,7 +1135,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -1108,7 +1146,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -1129,7 +1167,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -1148,7 +1186,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -1169,7 +1207,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -1210,7 +1248,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1271,7 +1309,7 @@ ) ) ) - (func $~lib/map/Map#set (; 18 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 23 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1322,7 +1360,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -1350,7 +1388,7 @@ (i32.add (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -1403,7 +1441,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1420,10 +1458,10 @@ ) ) ) - (func $~lib/internal/hash/hash32 (; 19 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 24 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) ) (set_local $1 (i32.mul @@ -1434,7 +1472,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -1449,7 +1487,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -1464,7 +1502,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -1476,12 +1514,12 @@ (i32.const 24) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (get_local $1) ) - (func $~lib/map/Map#find (; 20 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 25 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -1497,7 +1535,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1516,7 +1554,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -1538,7 +1576,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -1551,7 +1589,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#rehash (; 21 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 26 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1574,7 +1612,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -1585,7 +1623,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -1606,7 +1644,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -1625,7 +1663,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -1646,7 +1684,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -1687,7 +1725,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1748,7 +1786,7 @@ ) ) ) - (func $~lib/map/Map#set (; 22 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 27 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1799,7 +1837,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -1827,7 +1865,7 @@ (i32.add (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.mul (block (result i32) @@ -1880,7 +1918,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1897,7 +1935,7 @@ ) ) ) - (func $~lib/symbol/Symbol.for (; 23 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/symbol/Symbol.for (; 28 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -1961,7 +1999,7 @@ ) (get_local $2) ) - (func $~lib/map/Map#has (; 24 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -1977,7 +2015,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#get (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 30 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -2000,7 +2038,7 @@ (unreachable) ) ) - (func $~lib/symbol/Symbol.keyFor (; 26 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/symbol/Symbol.keyFor (; 31 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (result i32) (if (result i32) @@ -2023,15 +2061,15 @@ (i32.const 0) ) ) - (func $start (; 27 ;) (type $v) + (func $start (; 32 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add (get_global $HEAP_BASE) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) @@ -2182,10 +2220,10 @@ ) ) (drop - (i32.const 1) + (get_global $~lib/symbol/Symbol.hasInstance) ) (drop - (i32.const 2) + (get_global $~lib/symbol/Symbol.concatSpreadable) ) ) ) diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 5663d10e..741ad402 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -3,6 +3,7 @@ (type $iv (func (param i32))) (type $iii (func (param i32 i32) (result i32))) (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iiiv (func (param i32 i32 i32))) (type $iiii (func (param i32 i32 i32) (result i32))) (type $v (func)) @@ -11,7 +12,6 @@ (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) (global $std/typedarray/arr (mut i32) (i32.const 0)) (global $std/typedarray/clampedArr (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 168)) (memory $0 1) (data (i32.const 8) "\11\00\00\00s\00t\00d\00/\00t\00y\00p\00e\00d\00a\00r\00r\00a\00y\00.\00t\00s") (data (i32.const 48) "\1b\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00t\00y\00p\00e\00d\00a\00r\00r\00a\00y\00.\00t\00s") @@ -32,7 +32,15 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 2 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 3 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -64,14 +72,14 @@ ) (i32.shl (tee_local $2 - (current_memory) + (call $~lib/memory/memory.size) ) (i32.const 16) ) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (select (get_local $2) (tee_local $3 @@ -99,7 +107,7 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $3) ) (i32.const 0) @@ -118,7 +126,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/internal/arraybuffer/allocUnsafe (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -137,7 +150,7 @@ ) (i32.store (tee_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -147,7 +160,7 @@ ) (get_local $1) ) - (func $~lib/memory/set_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -477,7 +490,14 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.fill (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/internal/typedarray/TypedArray#constructor (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.gt_u @@ -494,7 +514,7 @@ (unreachable) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (tee_local $2 (call $~lib/internal/arraybuffer/allocUnsafe @@ -513,7 +533,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -543,7 +563,7 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.gt_u @@ -560,7 +580,7 @@ (unreachable) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (tee_local $2 (call $~lib/internal/arraybuffer/allocUnsafe @@ -584,7 +604,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -614,7 +634,7 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.gt_u @@ -631,7 +651,7 @@ (unreachable) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (tee_local $2 (call $~lib/internal/arraybuffer/allocUnsafe @@ -655,7 +675,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -685,7 +705,7 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.gt_u @@ -702,7 +722,7 @@ (unreachable) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (tee_local $2 (call $~lib/internal/arraybuffer/allocUnsafe @@ -726,7 +746,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -756,7 +776,7 @@ ) (get_local $0) ) - (func $std/typedarray/testInstantiate (; 9 ;) (type $iv) (param $0 i32) + (func $std/typedarray/testInstantiate (; 13 ;) (type $iv) (param $0 i32) (local $1 i32) (if (i32.load offset=4 @@ -1445,7 +1465,7 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#__set (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/typedarray/TypedArray#__set (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.ge_u @@ -1490,7 +1510,7 @@ (get_local $2) ) ) - (func $~lib/internal/typedarray/TypedArray#__get (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#__get (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.ge_u @@ -1534,7 +1554,7 @@ ) ) ) - (func $~lib/typedarray/Int32Array#subarray (; 12 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Int32Array#subarray (; 16 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $4 @@ -1621,7 +1641,7 @@ ) (i32.store (tee_local $3 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -1645,7 +1665,7 @@ ) (get_local $3) ) - (func $~lib/internal/typedarray/TypedArray#__set (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/typedarray/TypedArray#__set (; 17 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.ge_u @@ -1684,7 +1704,7 @@ (get_local $2) ) ) - (func $~lib/typedarray/Uint8ClampedArray#__set (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/typedarray/Uint8ClampedArray#__set (; 18 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (call $~lib/internal/typedarray/TypedArray#__set (get_local $0) @@ -1708,7 +1728,7 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#__get (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#__get (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.ge_u @@ -1746,16 +1766,10 @@ ) ) ) - (func $start (; 16 ;) (type $v) + (func $start (; 20 ;) (type $v) (local $0 i32) (set_global $~lib/allocator/arena/startOffset - (i32.and - (i32.add - (get_global $HEAP_BASE) - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 168) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index 3acf29fd..6bc2ad62 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -3,10 +3,22 @@ (type $iv (func (param i32))) (type $iii (func (param i32 i32) (result i32))) (type $ii (func (param i32) (result i32))) + (type $i (func (result i32))) (type $iiiv (func (param i32 i32 i32))) (type $iiii (func (param i32 i32 i32) (result i32))) (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) + (global $~lib/typedarray/Int8Array.BYTES_PER_ELEMENT i32 (i32.const 1)) + (global $~lib/typedarray/Uint8Array.BYTES_PER_ELEMENT i32 (i32.const 1)) + (global $~lib/typedarray/Uint8ClampedArray.BYTES_PER_ELEMENT i32 (i32.const 1)) + (global $~lib/typedarray/Int16Array.BYTES_PER_ELEMENT i32 (i32.const 2)) + (global $~lib/typedarray/Uint16Array.BYTES_PER_ELEMENT i32 (i32.const 2)) + (global $~lib/typedarray/Int32Array.BYTES_PER_ELEMENT i32 (i32.const 4)) + (global $~lib/typedarray/Uint32Array.BYTES_PER_ELEMENT i32 (i32.const 4)) + (global $~lib/typedarray/Int64Array.BYTES_PER_ELEMENT i32 (i32.const 8)) + (global $~lib/typedarray/Uint64Array.BYTES_PER_ELEMENT i32 (i32.const 8)) + (global $~lib/typedarray/Float32Array.BYTES_PER_ELEMENT i32 (i32.const 4)) + (global $~lib/typedarray/Float64Array.BYTES_PER_ELEMENT i32 (i32.const 8)) (global $~lib/internal/allocator/AL_BITS i32 (i32.const 3)) (global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8)) (global $~lib/internal/allocator/AL_MASK i32 (i32.const 7)) @@ -34,7 +46,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -42,7 +54,15 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.size (; 2 ;) (type $i) (result i32) + (current_memory) + ) + (func $~lib/memory/memory.grow (; 3 ;) (type $ii) (param $0 i32) (result i32) + (grow_memory + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -55,7 +75,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -69,16 +89,16 @@ (get_local $1) (get_local $0) ) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (set_local $3 - (current_memory) + (call $~lib/memory/memory.size) ) (if (i32.gt_u @@ -123,14 +143,14 @@ ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $5) ) (i32.const 0) ) (if (i32.lt_s - (grow_memory + (call $~lib/memory/memory.grow (get_local $4) ) (i32.const 0) @@ -150,13 +170,20 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/internal/arraybuffer/allocUnsafe (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.eqz (i32.le_u (get_local $0) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) ) (block @@ -170,7 +197,7 @@ ) ) (set_local $1 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -182,7 +209,7 @@ ) (get_local $1) ) - (func $~lib/memory/set_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memset (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -534,7 +561,14 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.fill (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (call $~lib/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $~lib/internal/typedarray/TypedArray#constructor (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -564,10 +598,10 @@ (get_local $2) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) @@ -580,7 +614,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -613,7 +647,7 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -643,10 +677,10 @@ (get_local $2) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) @@ -659,7 +693,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -692,7 +726,7 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -722,10 +756,10 @@ (get_local $2) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) @@ -738,7 +772,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -771,7 +805,7 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -801,10 +835,10 @@ (get_local $2) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) @@ -817,7 +851,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -850,7 +884,7 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -880,10 +914,10 @@ (get_local $2) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) @@ -896,7 +930,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -929,7 +963,7 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -959,10 +993,10 @@ (get_local $2) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) @@ -975,7 +1009,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -1008,7 +1042,7 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1038,10 +1072,10 @@ (get_local $2) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) @@ -1054,7 +1088,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -1087,7 +1121,7 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1117,10 +1151,10 @@ (get_local $2) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) @@ -1133,7 +1167,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -1166,7 +1200,7 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1196,10 +1230,10 @@ (get_local $2) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) @@ -1212,7 +1246,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -1245,7 +1279,7 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1275,10 +1309,10 @@ (get_local $2) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 0) (get_local $2) @@ -1291,7 +1325,7 @@ (tee_local $0 (block (result i32) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -1324,7 +1358,7 @@ ) (get_local $0) ) - (func $std/typedarray/testInstantiate (; 15 ;) (type $iv) (param $0 i32) + (func $std/typedarray/testInstantiate (; 19 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -1369,7 +1403,7 @@ ) (i32.mul (get_local $0) - (i32.const 1) + (get_global $~lib/typedarray/Int8Array.BYTES_PER_ELEMENT) ) ) ) @@ -1445,7 +1479,7 @@ ) (i32.mul (get_local $0) - (i32.const 1) + (get_global $~lib/typedarray/Uint8Array.BYTES_PER_ELEMENT) ) ) ) @@ -1521,7 +1555,7 @@ ) (i32.mul (get_local $0) - (i32.const 1) + (get_global $~lib/typedarray/Uint8Array.BYTES_PER_ELEMENT) ) ) ) @@ -1597,7 +1631,7 @@ ) (i32.mul (get_local $0) - (i32.const 2) + (get_global $~lib/typedarray/Int16Array.BYTES_PER_ELEMENT) ) ) ) @@ -1673,7 +1707,7 @@ ) (i32.mul (get_local $0) - (i32.const 2) + (get_global $~lib/typedarray/Uint16Array.BYTES_PER_ELEMENT) ) ) ) @@ -1749,7 +1783,7 @@ ) (i32.mul (get_local $0) - (i32.const 4) + (get_global $~lib/typedarray/Int32Array.BYTES_PER_ELEMENT) ) ) ) @@ -1825,7 +1859,7 @@ ) (i32.mul (get_local $0) - (i32.const 4) + (get_global $~lib/typedarray/Uint32Array.BYTES_PER_ELEMENT) ) ) ) @@ -1901,7 +1935,7 @@ ) (i32.mul (get_local $0) - (i32.const 8) + (get_global $~lib/typedarray/Int64Array.BYTES_PER_ELEMENT) ) ) ) @@ -1977,7 +2011,7 @@ ) (i32.mul (get_local $0) - (i32.const 8) + (get_global $~lib/typedarray/Uint64Array.BYTES_PER_ELEMENT) ) ) ) @@ -2053,7 +2087,7 @@ ) (i32.mul (get_local $0) - (i32.const 4) + (get_global $~lib/typedarray/Float32Array.BYTES_PER_ELEMENT) ) ) ) @@ -2129,7 +2163,7 @@ ) (i32.mul (get_local $0) - (i32.const 8) + (get_global $~lib/typedarray/Float64Array.BYTES_PER_ELEMENT) ) ) ) @@ -2173,7 +2207,7 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#__set (; 16 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/typedarray/TypedArray#__set (; 20 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2229,7 +2263,7 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#__get (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#__get (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2284,7 +2318,7 @@ ) ) ) - (func $~lib/typedarray/Int32Array#subarray (; 18 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Int32Array#subarray (; 22 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2390,7 +2424,7 @@ ) ) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -2417,7 +2451,7 @@ (get_local $4) ) ) - (func $~lib/internal/typedarray/TypedArray#__set (; 19 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/typedarray/TypedArray#__set (; 23 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2473,7 +2507,7 @@ ) ) ) - (func $~lib/typedarray/Uint8ClampedArray#__set (; 20 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/typedarray/Uint8ClampedArray#__set (; 24 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (call $~lib/internal/typedarray/TypedArray#__set @@ -2504,7 +2538,7 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#__get (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#__get (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2559,12 +2593,12 @@ ) ) ) - (func $start (; 22 ;) (type $v) + (func $start (; 26 ;) (type $v) (local $0 i32) (if (i32.eqz (i32.eq - (i32.const 1) + (get_global $~lib/typedarray/Int8Array.BYTES_PER_ELEMENT) (i32.const 1) ) ) @@ -2581,7 +2615,7 @@ (if (i32.eqz (i32.eq - (i32.const 1) + (get_global $~lib/typedarray/Uint8Array.BYTES_PER_ELEMENT) (i32.const 1) ) ) @@ -2598,7 +2632,7 @@ (if (i32.eqz (i32.eq - (i32.const 1) + (get_global $~lib/typedarray/Uint8ClampedArray.BYTES_PER_ELEMENT) (i32.const 1) ) ) @@ -2615,7 +2649,7 @@ (if (i32.eqz (i32.eq - (i32.const 2) + (get_global $~lib/typedarray/Int16Array.BYTES_PER_ELEMENT) (i32.const 2) ) ) @@ -2632,7 +2666,7 @@ (if (i32.eqz (i32.eq - (i32.const 2) + (get_global $~lib/typedarray/Uint16Array.BYTES_PER_ELEMENT) (i32.const 2) ) ) @@ -2649,7 +2683,7 @@ (if (i32.eqz (i32.eq - (i32.const 4) + (get_global $~lib/typedarray/Int32Array.BYTES_PER_ELEMENT) (i32.const 4) ) ) @@ -2666,7 +2700,7 @@ (if (i32.eqz (i32.eq - (i32.const 4) + (get_global $~lib/typedarray/Uint32Array.BYTES_PER_ELEMENT) (i32.const 4) ) ) @@ -2683,7 +2717,7 @@ (if (i32.eqz (i32.eq - (i32.const 8) + (get_global $~lib/typedarray/Int64Array.BYTES_PER_ELEMENT) (i32.const 8) ) ) @@ -2700,7 +2734,7 @@ (if (i32.eqz (i32.eq - (i32.const 8) + (get_global $~lib/typedarray/Uint64Array.BYTES_PER_ELEMENT) (i32.const 8) ) ) @@ -2717,7 +2751,7 @@ (if (i32.eqz (i32.eq - (i32.const 4) + (get_global $~lib/typedarray/Float32Array.BYTES_PER_ELEMENT) (i32.const 4) ) ) @@ -2734,7 +2768,7 @@ (if (i32.eqz (i32.eq - (i32.const 8) + (get_global $~lib/typedarray/Float64Array.BYTES_PER_ELEMENT) (i32.const 8) ) ) @@ -2752,10 +2786,10 @@ (i32.and (i32.add (get_global $HEAP_BASE) - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) @@ -3119,7 +3153,7 @@ (drop (call $~lib/internal/typedarray/TypedArray#constructor (i32.const 0) - (i32.const 134217727) + (get_global $std/typedarray/MAX_F64LENGTH) ) ) ) diff --git a/tests/compiler/typealias.optimized.wat b/tests/compiler/typealias.optimized.wat index f669b965..ea87f3f8 100644 --- a/tests/compiler/typealias.optimized.wat +++ b/tests/compiler/typealias.optimized.wat @@ -1,8 +1,8 @@ (module (type $ii (func (param i32) (result i32))) (memory $0 0) - (export "alias" (func $typealias/alias)) (export "memory" (memory $0)) + (export "alias" (func $typealias/alias)) (func $typealias/alias (; 0 ;) (type $ii) (param $0 i32) (result i32) (get_local $0) ) diff --git a/tests/compiler/typealias.untouched.wat b/tests/compiler/typealias.untouched.wat index 5a57a52d..b18bf6fb 100644 --- a/tests/compiler/typealias.untouched.wat +++ b/tests/compiler/typealias.untouched.wat @@ -3,8 +3,8 @@ (type $v (func)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) - (export "alias" (func $typealias/alias)) (export "memory" (memory $0)) + (export "alias" (func $typealias/alias)) (start $start) (func $typealias/alias (; 0 ;) (type $ii) (param $0 i32) (result i32) (get_local $0)