From 39b489bee24517d13757d2463fa362e61ecfe937 Mon Sep 17 00:00:00 2001 From: Daniel Wirtz Date: Fri, 20 Jul 2018 22:53:33 +0200 Subject: [PATCH] Rename memory instructions; Rework constant handling (#177) * Rename memory instructions as proposed by the bulk-memory-operations spec. * Rename memory manager functions to memory.* as well * Remove automatic inlining of constant globals (Binaryen does this now) * Improve 'const' enum compatibility * Improve module-level export generation * Enable the inline decorator for constant variables * Add ERROR, WARNING and INFO macros that emit a user-defined diagnostic * Reintroduce builtin decorator so these can appear anywhere in stdlib again * Inline isNaN and isFinite by default * Make an interface around gc.* similar to memory.* * Emit an error when trying to inline a mutable variable * Slim down CI stages * Add a more convenient tracing utility for debugging * Implement some prequesites for an eventual bundled GC --- .travis.yml | 48 +- cli/asc.js | 3 +- examples/game-of-life/build/optimized.wasm | Bin 933 -> 933 bytes examples/game-of-life/build/optimized.wat | 2 +- examples/game-of-life/build/untouched.wat | 2 +- examples/i64-polyfill/build/optimized.wat | 4 +- examples/i64-polyfill/build/untouched.wat | 4 +- examples/mandelbrot/build/optimized.wasm | Bin 561 -> 561 bytes examples/mandelbrot/build/optimized.wat | 2 +- examples/mandelbrot/build/untouched.wat | 18 +- examples/n-body/build/index.asm.js | 27 +- examples/n-body/build/optimized.wasm | Bin 2291 -> 2280 bytes examples/n-body/build/optimized.wat | 25 +- examples/n-body/build/untouched.wat | 488 +-- examples/pson/build/optimized.wat | 68 +- examples/pson/build/untouched.wat | 36 +- examples/ugc/assembly/ugc.ts | 4 +- lib/loader/tests/assembly/index.ts | 4 +- package-lock.json | 6 +- package.json | 16 +- snap/README.md | 2 +- src/ast.ts | 7 +- src/binary.ts | 4 +- src/builtins.ts | 201 +- src/common.ts | 16 +- src/compiler.ts | 614 +-- 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/parser.ts | 10 - src/program.ts | 202 +- std/assembly/allocator/arena.ts | 21 +- std/assembly/allocator/buddy.ts | 21 +- std/assembly/allocator/emscripten.ts | 13 +- std/assembly/allocator/system.ts | 13 +- std/assembly/allocator/tlsf.ts | 25 +- std/assembly/array.ts | 10 +- std/assembly/arraybuffer.ts | 4 +- std/assembly/builtins.ts | 268 +- std/assembly/collector/itcm.ts | 340 +- std/assembly/env.ts | 11 +- std/assembly/gc.ts | 28 + std/assembly/index.d.ts | 266 +- 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 | 78 +- 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 | 3067 +++++++++++++- tests/allocators/arena/untouched.wat | 3380 ++++++++++++++- tests/allocators/buddy/assembly/index.ts | 3 +- tests/allocators/buddy/optimized.wat | 3107 +++++++++++++- tests/allocators/buddy/untouched.wat | 3451 +++++++++++++++- tests/allocators/index.js | 12 +- tests/allocators/runner.js | 65 +- tests/allocators/tlsf/assembly/index.ts | 3 +- tests/allocators/tlsf/optimized.wat | 3144 +++++++++++++- tests/allocators/tlsf/untouched.wat | 3615 ++++++++++++++++- tests/binaryen/const-expr.js | 29 + tests/binaryen/const-expr.wat | 19 + tests/binaryen/const-global.js | 18 + tests/binaryen/const-global.wat | 8 + tests/binaryen/const-local.js | 18 + tests/compiler.js | 44 +- tests/compiler/abi.optimized.wat | 2 +- tests/compiler/abi.untouched.wat | 2 +- tests/compiler/asc-constants.untouched.wat | 8 + tests/compiler/binary.optimized.wat | 40 +- tests/compiler/binary.untouched.wat | 110 +- tests/compiler/builtins.optimized.wat | 361 +- tests/compiler/builtins.ts | 8 +- tests/compiler/builtins.untouched.wat | 504 ++- 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 | 146 +- tests/compiler/exports.ts | 4 +- tests/compiler/exports.untouched.wat | 255 +- 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 | 2 +- tests/compiler/main.untouched.wat | 2 +- tests/compiler/mandelbrot.optimized.wat | 6 +- tests/compiler/mandelbrot.untouched.wat | 13 +- 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 | 57 +- tests/compiler/object-literal.untouched.wat | 60 +- 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 | 113 +- tests/compiler/std/allocator_arena.ts | 26 +- .../std/allocator_arena.untouched.wat | 122 +- tests/compiler/std/array-access.optimized.wat | 35 +- tests/compiler/std/array-access.untouched.wat | 37 +- .../compiler/std/array-literal.optimized.wat | 39 +- .../compiler/std/array-literal.untouched.wat | 56 +- tests/compiler/std/array.optimized.wat | 383 +- tests/compiler/std/array.untouched.wat | 454 ++- tests/compiler/std/arraybuffer.optimized.wat | 58 +- tests/compiler/std/arraybuffer.untouched.wat | 75 +- tests/compiler/std/constructor.optimized.wat | 52 +- tests/compiler/std/constructor.ts | 4 +- tests/compiler/std/constructor.untouched.wat | 59 +- .../compiler/std/gc-integration.optimized.wat | 81 + tests/compiler/std/gc-integration.ts | 15 + .../compiler/std/gc-integration.untouched.wat | 96 + tests/compiler/std/gc.optimized.wat | 669 +++ tests/compiler/std/gc.ts | 37 + tests/compiler/std/gc.untouched.wat | 808 ++++ tests/compiler/std/hash.untouched.wat | 32 +- tests/compiler/std/libm.optimized.wat | 14 +- tests/compiler/std/libm.untouched.wat | 27 +- tests/compiler/std/map.optimized.wat | 171 +- tests/compiler/std/map.untouched.wat | 654 +-- tests/compiler/std/math.optimized.wat | 64 +- tests/compiler/std/math.untouched.wat | 2210 +++++----- tests/compiler/std/mod.optimized.wat | 56 +- tests/compiler/std/mod.untouched.wat | 128 +- tests/compiler/std/new.optimized.wat | 22 +- tests/compiler/std/new.untouched.wat | 25 +- .../std/operator-overloading.optimized.wat | 74 +- .../std/operator-overloading.untouched.wat | 88 +- tests/compiler/std/pointer.optimized.wat | 56 +- tests/compiler/std/pointer.untouched.wat | 56 +- tests/compiler/std/set.optimized.wat | 171 +- tests/compiler/std/set.untouched.wat | 654 +-- tests/compiler/std/static-array.optimized.wat | 84 +- tests/compiler/std/static-array.untouched.wat | 131 +- tests/compiler/std/string-utf8.optimized.wat | 31 +- tests/compiler/std/string-utf8.ts | 2 +- tests/compiler/std/string-utf8.untouched.wat | 35 +- tests/compiler/std/string.optimized.wat | 466 ++- tests/compiler/std/string.ts | 2 - tests/compiler/std/string.untouched.wat | 607 +-- tests/compiler/std/symbol.optimized.wat | 98 +- tests/compiler/std/symbol.untouched.wat | 191 +- tests/compiler/std/trace.optimized.wat | 104 + tests/compiler/std/trace.ts | 10 + tests/compiler/std/trace.untouched.wat | 105 + tests/compiler/std/typedarray.optimized.wat | 71 +- tests/compiler/std/typedarray.untouched.wat | 191 +- tests/compiler/typealias.optimized.wat | 2 +- tests/compiler/typealias.untouched.wat | 2 +- 196 files changed, 28714 insertions(+), 6674 deletions(-) create mode 100644 std/assembly/gc.ts create mode 100644 std/assembly/table.ts delete mode 100644 std/portable/memory.js create mode 100644 tests/binaryen/const-expr.js create mode 100644 tests/binaryen/const-expr.wat 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 create mode 100644 tests/compiler/std/trace.optimized.wat create mode 100644 tests/compiler/std/trace.ts create mode 100644 tests/compiler/std/trace.untouched.wat diff --git a/.travis.yml b/.travis.yml index bc8967f3..ee8e90bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,46 +1,24 @@ language: node_js notifications: email: false -before_install: npm i -g npm@latest --no-audit -install: npm config set progress=false && npm i --no-audit +before_install: npm config set progress=false && npm i -g npm@latest --no-audit +install: npm i --no-audit cache: directories: - node_modules -stages: -- name: check-pr - if: type = pull_request jobs: include: - - - stage: check-pr - node_js: lts/* - script: ./scripts/check-pr.sh - env: Checks contributing guidelines before testing pull requests - - - stage: lint - node_js: node - script: npm run lint - env: Checks the sources with TSLint - - - stage: test - node_js: lts/* - script: npm run clean && node bin/asc -v && npm test - env: Tests the sources on latest node.js LTS - - node_js: node - script: npm run clean && node bin/asc -v && npm test - env: Tests the sources on latest stable node.js - node_js: lts/* script: - - npm run clean - - cd $TRAVIS_BUILD_DIR/tests/allocators/arena && npm run build && cd .. && npm test arena - - cd $TRAVIS_BUILD_DIR/tests/allocators/buddy && npm run build && cd .. && npm test buddy - - cd $TRAVIS_BUILD_DIR/tests/allocators/tlsf && npm run build && cd .. && npm test tlsf - env: Tests the allocators on latest node.js LTS - - - stage: build - node_js: lts/* - script: npm run build && node bin/asc -v && npm test - env: Builds and tests the bundle on latest node.js LTS + - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then ./scripts/check-pr.sh; fi + - npm run all + - if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then + cd $TRAVIS_BUILD_DIR/tests/allocators/arena && npm run build && cd .. && npm test arena && + cd $TRAVIS_BUILD_DIR/tests/allocators/buddy && npm run build && cd .. && npm test buddy && + cd $TRAVIS_BUILD_DIR/tests/allocators/tlsf && npm run build && cd .. && npm test tlsf; + fi + env: Runs the tests on node.js LTS - node_js: node - script: npm run build && node bin/asc -v && npm test - env: Builds and tests the bundle on latest stable node.js + script: + - npm run all + env: Runs the tests on node.js stable diff --git a/cli/asc.js b/cli/asc.js index 818408f6..1a6b02e6 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -414,7 +414,8 @@ exports.main = function main(argv, options, callback) { // Initialize default aliases assemblyscript.setGlobalAlias(compilerOptions, "Math", "NativeMath"); assemblyscript.setGlobalAlias(compilerOptions, "Mathf", "NativeMathf"); - assemblyscript.setGlobalAlias(compilerOptions, "abort", "~lib/env/abort"); // to disable: --use abort= + assemblyscript.setGlobalAlias(compilerOptions, "abort", "~lib/env/abort"); + assemblyscript.setGlobalAlias(compilerOptions, "trace", "~lib/env/trace"); // Add or override aliases if specified if (args.use) { diff --git a/examples/game-of-life/build/optimized.wasm b/examples/game-of-life/build/optimized.wasm index e96a54fc04779553aaa63eadd433fdbc25b732ee..12f1a66645c7b5287460507c843e1b43d6495305 100644 GIT binary patch delta 41 xcmZ3=zLb5!BssR+)ZF}{N+t%D%)HDJ21b_RlGFkQCYH3!oE!$`jT^o)0RReX47&gT delta 41 xcmZ3=zLb5!BsrGMyvz~?Mwa4|)B*-3mbA>A90q2#+|=CsqDm%)jT^o)0RRD~47&gT diff --git a/examples/game-of-life/build/optimized.wat b/examples/game-of-life/build/optimized.wat index a195eef3..1e9714ea 100644 --- a/examples/game-of-life/build/optimized.wat +++ b/examples/game-of-life/build/optimized.wat @@ -11,10 +11,10 @@ (global $assembly/index/w (mut i32) (i32.const 0)) (global $assembly/index/h (mut i32) (i32.const 0)) (global $assembly/index/s (mut i32) (i32.const 0)) + (export "memory" (memory $0)) (export "init" (func $assembly/index/init)) (export "step" (func $assembly/index/step)) (export "fill" (func $assembly/index/fill)) - (export "memory" (memory $0)) (func $assembly/index/init (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) ;;@ assembly/index.ts:29:2 diff --git a/examples/game-of-life/build/untouched.wat b/examples/game-of-life/build/untouched.wat index 8ca9bf04..436ae074 100644 --- a/examples/game-of-life/build/untouched.wat +++ b/examples/game-of-life/build/untouched.wat @@ -12,10 +12,10 @@ (global $assembly/index/h (mut i32) (i32.const 0)) (global $assembly/index/s (mut i32) (i32.const 0)) (global $HEAP_BASE i32 (i32.const 8)) + (export "memory" (memory $0)) (export "init" (func $assembly/index/init)) (export "step" (func $assembly/index/step)) (export "fill" (func $assembly/index/fill)) - (export "memory" (memory $0)) (func $assembly/index/init (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) diff --git a/examples/i64-polyfill/build/optimized.wat b/examples/i64-polyfill/build/optimized.wat index 693481d9..f69f9ce1 100644 --- a/examples/i64-polyfill/build/optimized.wat +++ b/examples/i64-polyfill/build/optimized.wat @@ -4,7 +4,8 @@ (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 "memory" (memory $0)) (export "getLo" (func $assembly/i64/getLo)) (export "getHi" (func $assembly/i64/getHi)) (export "clz" (func $assembly/i64/clz)) @@ -36,7 +37,6 @@ (export "gt_u" (func $assembly/i64/gt_u)) (export "ge_s" (func $assembly/i64/ge_s)) (export "ge_u" (func $assembly/i64/ge_u)) - (export "memory" (memory $0)) (func $assembly/i64/getLo (; 0 ;) (type $i) (result i32) ;;@ assembly/i64.ts:4:9 (get_global $assembly/i64/lo) diff --git a/examples/i64-polyfill/build/untouched.wat b/examples/i64-polyfill/build/untouched.wat index ae701740..5e81d0df 100644 --- a/examples/i64-polyfill/build/untouched.wat +++ b/examples/i64-polyfill/build/untouched.wat @@ -7,7 +7,8 @@ (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 "memory" (memory $0)) (export "getLo" (func $assembly/i64/getLo)) (export "getHi" (func $assembly/i64/getHi)) (export "clz" (func $assembly/i64/clz)) @@ -39,7 +40,6 @@ (export "gt_u" (func $assembly/i64/gt_u)) (export "ge_s" (func $assembly/i64/ge_s)) (export "ge_u" (func $assembly/i64/ge_u)) - (export "memory" (memory $0)) (func $assembly/i64/getLo (; 0 ;) (type $i) (result i32) ;;@ assembly/i64.ts:4:9 (get_global $assembly/i64/lo) diff --git a/examples/mandelbrot/build/optimized.wasm b/examples/mandelbrot/build/optimized.wasm index d460e0da6056c61e88ea9dff43af2fb55ca12a36..85b29a7e94a5ba1f456d5e529aad5e763ac92756 100644 GIT binary patch delta 34 pcmdnUvXNy%gg9GnYHof}B@+X8a(-?>X-TS2W?m`-)5iQmi~z>N3xEIs delta 34 pcmdnUvXNy%ggAF{er`c&Nvcm~UMd3 (; 2 ;) (type $Fi) (param $0 f64) (result i32) - ;;@ ~lib/builtins.ts:22:26 + (export "computeLine" (func $assembly/index/computeLine)) + (func $~lib/builtins/isFinite (; 2 ;) (type $Fi) (param $0 f64) (result i32) + ;;@ ~lib/builtins.ts:16:70 (f64.eq - ;;@ ~lib/builtins.ts:22:9 + ;;@ ~lib/builtins.ts:16:53 (f64.sub (get_local $0) - ;;@ ~lib/builtins.ts:22:17 + ;;@ ~lib/builtins.ts:16:61 (get_local $0) ) - ;;@ ~lib/builtins.ts:22:26 + ;;@ ~lib/builtins.ts:16:70 (f64.const 0) ) ) @@ -375,7 +375,7 @@ (set_local $17 ;;@ assembly/index.ts:37:15 (if (result i32) - (call $isFinite + (call $~lib/builtins/isFinite ;;@ assembly/index.ts:37:24 (get_local $15) ) @@ -386,7 +386,7 @@ (f64.convert_s/i32 (i32.sub ;;@ assembly/index.ts:38:15 - (i32.const 2048) + (get_global $assembly/index/NUM_COLORS) ;;@ assembly/index.ts:38:28 (i32.const 1) ) @@ -421,7 +421,7 @@ ) ;;@ assembly/index.ts:39:8 (i32.sub - (i32.const 2048) + (get_global $assembly/index/NUM_COLORS) ;;@ assembly/index.ts:39:21 (i32.const 1) ) diff --git a/examples/n-body/build/index.asm.js b/examples/n-body/build/index.asm.js index 332b9c2b..3797ab4d 100644 --- a/examples/n-body/build/index.asm.js +++ b/examples/n-body/build/index.asm.js @@ -24,9 +24,8 @@ function asmFunc(global, env, buffer) { var $lib_allocator_arena_startOffset = 0; var $lib_allocator_arena_offset = 0; 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 +54,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 +80,7 @@ function asmFunc(global, env, buffer) { return $0 | 0; } - function $lib_memory_set_memory($0, $1, $2) { + function $lib_memory_memset($0, $1, $2) { $0 = $0 | 0; $1 = $1 | 0; $2 = $2 | 0; @@ -253,12 +252,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 +271,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_memset($3 + 8 | 0 | 0, 0 | 0, $2 | 0); return $0 | 0; } @@ -307,7 +306,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; @@ -492,7 +491,7 @@ function asmFunc(global, env, buffer) { } function start() { - $lib_allocator_arena_startOffset = (HEAP_BASE + 7 | 0) & 4294967288 | 0; + $lib_allocator_arena_startOffset = 40; $lib_allocator_arena_offset = $lib_allocator_arena_startOffset; } @@ -522,10 +521,6 @@ function asmFunc(global, env, buffer) { } return { - init: assembly_index_init, - getBody: assembly_index_getBody, - step: assembly_index_step, - bench: assembly_index_bench, memory: Object.create(Object.prototype, { grow: { value: __wasm_grow_memory @@ -536,6 +531,10 @@ function asmFunc(global, env, buffer) { } } - }) + }), + init: assembly_index_init, + getBody: assembly_index_getBody, + step: assembly_index_step, + bench: assembly_index_bench }; } diff --git a/examples/n-body/build/optimized.wasm b/examples/n-body/build/optimized.wasm index 380b00894cc77aba02f06f3710fea952490d3848..f71046780cb82a9925ef42ab9dbef571e33a7a3a 100644 GIT binary patch delta 58 zcmew?_(E_(hO7W{J)$ip>b<9a?07A^)yjmgJ3 FbO5794axuj delta 69 zcmaDM_*rm5hNLJ#constructor (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.fill (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/memory.ts:11:4 + (call $~lib/memory/memset + ;;@ ~lib/memory.ts:11:11 + (get_local $0) + ;;@ ~lib/memory.ts:11:17 + (get_local $1) + ;;@ ~lib/memory.ts:11:20 + (get_local $2) + ) + ) + (func $~lib/array/Array#constructor (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1041,7 +1065,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,13 +1091,13 @@ ;;@ ~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) ;;@ ~lib/array.ts:29:34 - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ;;@ ~lib/array.ts:30:6 (i32.const 0) @@ -1082,7 +1106,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 (; 14 ;) (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 +1134,14 @@ ) ) ) - (func $~lib/array/Array#get:length (; 13 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 15 ;) (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 (; 16 ;) (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 +1167,7 @@ ) ) ) - (func $~lib/array/Array#__get (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__get (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) ;;@ ~lib/array.ts:69:4 (set_local $2 @@ -1188,7 +1212,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 (; 18 ;) (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) @@ -1199,7 +1223,7 @@ (get_local $1) ) ;;@ assembly/index.ts:24:20 - (f64.const 39.47841760435743) + (get_global $assembly/index/SOLAR_MASS) ) ) ;;@ assembly/index.ts:25:4 @@ -1212,7 +1236,7 @@ (get_local $2) ) ;;@ assembly/index.ts:25:20 - (f64.const 39.47841760435743) + (get_global $assembly/index/SOLAR_MASS) ) ) ;;@ assembly/index.ts:26:4 @@ -1225,13 +1249,13 @@ (get_local $3) ) ;;@ assembly/index.ts:26:20 - (f64.const 39.47841760435743) + (get_global $assembly/index/SOLAR_MASS) ) ) ;;@ 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 (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 f64) (local $3 f64) (local $4 f64) @@ -1375,7 +1399,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 +1413,7 @@ ) ) ) - (func $assembly/index/init (; 18 ;) (type $v) + (func $assembly/index/init (; 20 ;) (type $v) (local $0 i32) ;;@ assembly/index.ts:191:2 (set_global $assembly/index/system @@ -1439,7 +1463,7 @@ ) ) ) - (func $assembly/index/getBody (; 19 ;) (type $ii) (param $0 i32) (result i32) + (func $assembly/index/getBody (; 21 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) ;;@ assembly/index.ts:201:2 (set_local $1 @@ -1469,7 +1493,7 @@ (i32.const 0) ) ) - (func $assembly/index/NBodySystem#advance (; 20 ;) (type $iFv) (param $0 i32) (param $1 f64) + (func $assembly/index/NBodySystem#advance (; 22 ;) (type $iFv) (param $0 i32) (param $1 f64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1890,7 +1914,7 @@ ) ) ) - (func $assembly/index/NBodySystem#energy (; 21 ;) (type $iF) (param $0 i32) (result f64) + (func $assembly/index/NBodySystem#energy (; 23 ;) (type $iF) (param $0 i32) (result f64) (local $1 f64) (local $2 i32) (local $3 i32) @@ -2191,7 +2215,7 @@ ;;@ assembly/index.ts:184:11 (get_local $1) ) - (func $assembly/index/step (; 22 ;) (type $F) (result f64) + (func $assembly/index/step (; 24 ;) (type $F) (result f64) ;;@ assembly/index.ts:206:9 (call $assembly/index/NBodySystem#advance ;;@ assembly/index.ts:206:2 @@ -2205,7 +2229,7 @@ (get_global $assembly/index/system) ) ) - (func $assembly/index/bench (; 23 ;) (type $iv) (param $0 i32) + (func $assembly/index/bench (; 25 ;) (type $iv) (param $0 i32) (local $1 i32) ;;@ assembly/index.ts:211:2 (block $break|0 @@ -2243,7 +2267,7 @@ ) ) ) - (func $start (; 24 ;) (type $v) + (func $start (; 26 ;) (type $v) (set_global $~lib/allocator/arena/startOffset ;;@ ~lib/allocator/arena.ts:12:25 (i32.and @@ -2251,12 +2275,12 @@ ;;@ ~lib/allocator/arena.ts:12:26 (get_global $HEAP_BASE) ;;@ ~lib/allocator/arena.ts:12:38 - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) ;;@ ~lib/allocator/arena.ts:12:49 (i32.xor ;;@ ~lib/allocator/arena.ts:12:50 - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) diff --git a/examples/pson/build/optimized.wat b/examples/pson/build/optimized.wat index eb045a4a..7f3aa416 100644 --- a/examples/pson/build/optimized.wat +++ b/examples/pson/build/optimized.wat @@ -22,6 +22,7 @@ (import "pson" "onBinary" (func $assembly/pson/onBinary (param i32 i32))) (global $assembly/pson/offset (mut i32) (i32.const 0)) (memory $0 0) + (export "memory" (memory $0)) (export "onNull" (func $assembly/pson/onNull)) (export "onTrue" (func $assembly/pson/onTrue)) (export "onFalse" (func $assembly/pson/onFalse)) @@ -37,7 +38,6 @@ (export "onString" (func $assembly/pson/onString)) (export "onBinary" (func $assembly/pson/onBinary)) (export "decode" (func $assembly/pson/decode)) - (export "memory" (memory $0)) (func $assembly/pson/readVarint32 (; 14 ;) (type $i) (result i32) (local $0 i32) (local $1 i32) @@ -190,54 +190,59 @@ (block $case3|0 (block $case2|0 (block $case1|0 - (block $case0|0 - (block $tablify|0 + (if + ;;@ assembly/pson.ts:46:28 + (block (result i32) (set_global $assembly/pson/offset (i32.add (tee_local $1 - ;;@ assembly/pson.ts:46:28 (get_global $assembly/pson/offset) ) (i32.const 1) ) ) - (br_table $case0|0 $case1|0 $case2|0 $case3|0 $case4|0 $case5|0 $case6|0 $case7|0 $case8|0 $case9|0 $case10|0 $case11|0 $case12|0 $tablify|0 - (i32.sub - (tee_local $1 - ;;@ assembly/pson.ts:46:2 - (tee_local $0 - ;;@ assembly/pson.ts:46:19 - (i32.load8_u - (get_local $1) - ) + (i32.ne + (tee_local $1 + ;;@ assembly/pson.ts:46:2 + (tee_local $0 + ;;@ assembly/pson.ts:46:19 + (i32.load8_u + (get_local $1) ) ) - (i32.const 240) ) + (i32.const 240) ) ) - (br_if $case14|0 - (i32.or + (block + (block $tablify|0 + (br_table $case1|0 $case2|0 $case3|0 $case4|0 $case5|0 $case6|0 $case7|0 $case8|0 $case9|0 $case10|0 $case11|0 $case12|0 $tablify|0 + (i32.sub + (get_local $1) + (i32.const 241) + ) + ) + ) + (br_if $case14|0 + (i32.or + (i32.eq + (get_local $1) + (i32.const 253) + ) + (i32.eq + (get_local $1) + (i32.const 254) + ) + ) + ) + (br_if $case15|0 (i32.eq (get_local $1) - ;;@ assembly/pson.ts:112:9 - (i32.const 253) - ) - (i32.eq - (get_local $1) - ;;@ assembly/pson.ts:113:9 - (i32.const 254) + (i32.const 255) ) ) + (br $case16|0) ) - (br_if $case15|0 - (i32.eq - (get_local $1) - ;;@ assembly/pson.ts:118:9 - (i32.const 255) - ) - ) - (br $case16|0) ) ;;@ assembly/pson.ts:51:6 (call $assembly/pson/onNull) @@ -500,7 +505,6 @@ ;;@ assembly/pson.ts:125:10 (i32.gt_u (get_local $0) - ;;@ assembly/pson.ts:125:18 (i32.const 239) ) ;;@ assembly/pson.ts:125:34 diff --git a/examples/pson/build/untouched.wat b/examples/pson/build/untouched.wat index 2d357852..4cbfd94c 100644 --- a/examples/pson/build/untouched.wat +++ b/examples/pson/build/untouched.wat @@ -41,6 +41,7 @@ (global $assembly/pson/Token.BINARY i32 (i32.const 255)) (global $HEAP_BASE i32 (i32.const 8)) (memory $0 0) + (export "memory" (memory $0)) (export "onNull" (func $assembly/pson/onNull)) (export "onTrue" (func $assembly/pson/onTrue)) (export "onFalse" (func $assembly/pson/onFalse)) @@ -56,7 +57,6 @@ (export "onString" (func $assembly/pson/onString)) (export "onBinary" (func $assembly/pson/onBinary)) (export "decode" (func $assembly/pson/decode)) - (export "memory" (memory $0)) (func $assembly/pson/readVarint32 (; 14 ;) (type $i) (result i32) (local $0 i32) (local $1 i32) @@ -283,112 +283,112 @@ (i32.eq (get_local $0) ;;@ assembly/pson.ts:50:9 - (i32.const 240) + (get_global $assembly/pson/Token.NULL) ) ) (br_if $case1|0 (i32.eq (get_local $0) ;;@ assembly/pson.ts:54:9 - (i32.const 241) + (get_global $assembly/pson/Token.TRUE) ) ) (br_if $case2|0 (i32.eq (get_local $0) ;;@ assembly/pson.ts:58:9 - (i32.const 242) + (get_global $assembly/pson/Token.FALSE) ) ) (br_if $case3|0 (i32.eq (get_local $0) ;;@ assembly/pson.ts:62:9 - (i32.const 243) + (get_global $assembly/pson/Token.EOBJECT) ) ) (br_if $case4|0 (i32.eq (get_local $0) ;;@ assembly/pson.ts:66:9 - (i32.const 244) + (get_global $assembly/pson/Token.EARRAY) ) ) (br_if $case5|0 (i32.eq (get_local $0) ;;@ assembly/pson.ts:70:9 - (i32.const 245) + (get_global $assembly/pson/Token.ESTRING) ) ) (br_if $case6|0 (i32.eq (get_local $0) ;;@ assembly/pson.ts:74:9 - (i32.const 246) + (get_global $assembly/pson/Token.OBJECT) ) ) (br_if $case7|0 (i32.eq (get_local $0) ;;@ assembly/pson.ts:82:9 - (i32.const 247) + (get_global $assembly/pson/Token.ARRAY) ) ) (br_if $case8|0 (i32.eq (get_local $0) ;;@ assembly/pson.ts:87:9 - (i32.const 248) + (get_global $assembly/pson/Token.INTEGER) ) ) (br_if $case9|0 (i32.eq (get_local $0) ;;@ assembly/pson.ts:91:9 - (i32.const 249) + (get_global $assembly/pson/Token.LONG) ) ) (br_if $case10|0 (i32.eq (get_local $0) ;;@ assembly/pson.ts:96:9 - (i32.const 250) + (get_global $assembly/pson/Token.FLOAT) ) ) (br_if $case11|0 (i32.eq (get_local $0) ;;@ assembly/pson.ts:101:9 - (i32.const 251) + (get_global $assembly/pson/Token.DOUBLE) ) ) (br_if $case12|0 (i32.eq (get_local $0) ;;@ assembly/pson.ts:106:9 - (i32.const 252) + (get_global $assembly/pson/Token.STRING) ) ) (br_if $case13|0 (i32.eq (get_local $0) ;;@ assembly/pson.ts:112:9 - (i32.const 253) + (get_global $assembly/pson/Token.STRING_ADD) ) ) (br_if $case14|0 (i32.eq (get_local $0) ;;@ assembly/pson.ts:113:9 - (i32.const 254) + (get_global $assembly/pson/Token.STRING_GET) ) ) (br_if $case15|0 (i32.eq (get_local $0) ;;@ assembly/pson.ts:118:9 - (i32.const 255) + (get_global $assembly/pson/Token.BINARY) ) ) (br $case16|0) @@ -716,7 +716,7 @@ (i32.gt_u (get_local $1) ;;@ assembly/pson.ts:125:18 - (i32.const 239) + (get_global $assembly/pson/Token.MAX) ) ;;@ assembly/pson.ts:125:34 (unreachable) 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..b8e03dc6 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": { @@ -41,15 +41,15 @@ "scripts": { "build": "webpack --mode production --display-modules", "clean": "node scripts/clean", - "lint": "npm run lint:compiler && npm run lint:library", - "lint:compiler": "tslint -c tslint.json --project src --formatters-dir lib/lint/formatters --format as", - "lint:library": "tslint -c tslint.json --project std/assembly --formatters-dir lib/lint/formatters --format as", - "test:config": "tsc --noEmit -p src --diagnostics --listFiles", + "check": "npm run check:config && npm run check:compiler && npm run check:library", + "check:config": "tsc --noEmit -p src --diagnostics --listFiles", + "check:compiler": "tslint -c tslint.json --project src --formatters-dir lib/lint/formatters --format as", + "check:library": "tslint -c tslint.json --project std/assembly --formatters-dir lib/lint/formatters --format as", + "test": "npm run test:parser && npm run test:compiler", "test:parser": "node tests/parser", "test:compiler": "node tests/compiler", - "test": "npm run test:config --scripts-prepend-node-path && npm run test:parser --scripts-prepend-node-path && npm run test:compiler --scripts-prepend-node-path", - "test:pr": "npm run clean && npm test && npm run build && npm test && npm run clean", - "all": "npm run lint && npm run clean && npm test && npm run build && npm test", + "make": "npm run clean && npm test && npm run build && npm test", + "all": "npm run check && npm run make", "docs": "typedoc --tsconfig tsconfig-docs.json --mode modules --name \"AssemblyScript Compiler API\" --out ./docs/api --ignoreCompilerErrors --excludeNotExported --excludePrivate --excludeExternals --exclude **/std/** --includeDeclarations --readme src/README.md" }, "files": [ 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/ast.ts b/src/ast.ts index 53bc8f85..ed3d07cf 100644 --- a/src/ast.ts +++ b/src/ast.ts @@ -1122,7 +1122,8 @@ export enum DecoratorKind { UNMANAGED, SEALED, INLINE, - EXTERNAL + EXTERNAL, + BUILTIN } /** Returns the kind of the specified decorator. Defaults to {@link DecoratorKind.CUSTOM}. */ @@ -1132,6 +1133,10 @@ export function decoratorNameToKind(name: Expression): DecoratorKind { let nameStr = (name).text; assert(nameStr.length); switch (nameStr.charCodeAt(0)) { + case CharCode.b: { + if (nameStr == "builtin") return DecoratorKind.BUILTIN; + break; + } case CharCode.e: { if (nameStr == "external") return DecoratorKind.EXTERNAL; break; 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..2c246026 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,45 @@ export function compileCall( WrapMode.NONE ); } + + // gc + + case "iterateRoots": { + 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(); + } + compiler.currentType = Type.void; + // just emit a call even if the function doesn't yet exist + compiler.needsIterateRoots = true; + return module.createCall("~iterateRoots", [ expr ], NativeType.None); + } } var expr = deferASMCall(compiler, prototype, operands, contextualType, reportNode); if (expr) { @@ -2816,8 +2871,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 +2881,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 +2902,6 @@ export function compileAllocate( ); } -const abortInternalName = "abort"; - /** Compiles an abort wired to the conditionally imported 'abort' function. */ export function compileAbort( compiler: Compiler, @@ -2874,13 +2911,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 @@ -2903,3 +2937,54 @@ export function compileAbort( module.createUnreachable() ]); } + +/** Compiles the iterateRoots function if requires. */ +export function compileIterateRoots(compiler: Compiler): void { + var module = compiler.module; + var 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( + module.createGetLocal(0, NativeType.I32), + [ + compiler.options.isWasm64 + ? module.createI64(i64_low(value), i64_high(value)) + : module.createI32(i64_low(value)) + ], + "iv" + ) + ); + } else { + exprs.push( + module.createCallIndirect( + module.createGetLocal(0, NativeType.I32), + [ + module.createGetGlobal( + global.internalName, + compiler.options.nativeSizeType + ) + ], + "iv" + ) + ); + } + } + } + var typeRef = compiler.ensureFunctionType([ Type.i32 ], Type.void); + module.addFunction("~iterateRoots", typeRef, [], + exprs.length + ? module.createBlock(null, exprs) + : module.createNop() + ); +} diff --git a/src/common.ts b/src/common.ts index 783cdbb8..638e3cba 100644 --- a/src/common.ts +++ b/src/common.ts @@ -58,24 +58,22 @@ export enum CommonFlags { // Compilation states - /** Is a builtin. */ - BUILTIN = 1 << 21, /** Is compiled. */ - COMPILED = 1 << 22, + COMPILED = 1 << 21, /** Has a constant value and is therefore inlined. */ - INLINED = 1 << 23, + INLINED = 1 << 22, /** Is scoped. */ - SCOPED = 1 << 24, + SCOPED = 1 << 23, /** Is a trampoline. */ - TRAMPOLINE = 1 << 25, + TRAMPOLINE = 1 << 24, /** Is a virtual method. */ - VIRTUAL = 1 << 26, + VIRTUAL = 1 << 25, /** Is the main function. */ - MAIN = 1 << 27, + MAIN = 1 << 26, // Other - QUOTED = 1 << 28 + QUOTED = 1 << 27 } /** Path delimiter inserted between file system levels. */ diff --git a/src/compiler.ts b/src/compiler.ts index f38cc229..1156a734 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -5,8 +5,9 @@ import { compileCall as compileBuiltinCall, - compileAllocate as compileBuiltinAllocate, - compileAbort as compileBuiltinAbort + compileAllocate, + compileAbort, + compileIterateRoots } from "./builtins"; import { @@ -32,7 +33,6 @@ import { getConstValueI64High, getConstValueF32, getConstValueF64, - getFunctionBody, getGetLocalIndex, getBlockChildCount, getBlockChild, @@ -287,6 +287,8 @@ export class Compiler extends DiagnosticEmitter { argcVar: GlobalRef = 0; /** Argument count helper setter. */ argcSet: FunctionRef = 0; + /** Indicates whether the iterateRoots function must be generated. */ + needsIterateRoots: bool = false; /** Compiles a {@link Program} to a {@link Module} using the specified options. */ static compile(program: Program, options: Options | null = null): Module { @@ -404,9 +406,175 @@ 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); + } + + // set up gc + if (this.needsIterateRoots) compileIterateRoots(this); + 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. */ @@ -565,16 +733,16 @@ export class Compiler extends DiagnosticEmitter { } // ambient builtins like 'HEAP_BASE' need to be resolved but are added explicitly - if (global.is(CommonFlags.AMBIENT | CommonFlags.BUILTIN)) return true; + if (global.is(CommonFlags.AMBIENT) && global.hasDecorator(DecoratorFlags.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 +769,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 +848,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 +870,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 +879,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; @@ -850,7 +980,7 @@ export class Compiler extends DiagnosticEmitter { } /** Either reuses or creates the function type matching the specified signature. */ - private ensureFunctionType( + ensureFunctionType( parameterTypes: Type[] | null, returnType: Type, thisType: Type | null = null @@ -883,7 +1013,7 @@ export class Compiler extends DiagnosticEmitter { /** Compiles a readily resolved function instance. */ compileFunction(instance: Function): bool { if (instance.is(CommonFlags.COMPILED)) return true; - assert(!instance.is(CommonFlags.AMBIENT | CommonFlags.BUILTIN)); + assert(!(instance.is(CommonFlags.AMBIENT) && instance.hasDecorator(DecoratorFlags.BUILTIN))); instance.set(CommonFlags.COMPILED); // check that modifiers are matching @@ -1015,16 +1145,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; } @@ -1115,6 +1235,7 @@ export class Compiler extends DiagnosticEmitter { noTreeShaking || (element).is(CommonFlags.EXPORT) ) && !(element).is(CommonFlags.GENERIC) ) { + if (element.hasDecorator(DecoratorFlags.BUILTIN)) break; this.compileFunctionUsingTypeArguments( element, [], @@ -1140,18 +1261,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 +1286,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 +1409,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 +1734,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 +1824,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 @@ -1970,7 +2028,7 @@ export class Compiler extends DiagnosticEmitter { flow.set(FlowFlags.RETURNS); // TODO: requires exception-handling spec. - return compileBuiltinAbort(this, null, statement); + return compileAbort(this, null, statement); } compileTryStatement(statement: TryStatement): ExpressionRef { @@ -2057,7 +2115,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 +2220,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 @@ -2291,7 +2349,8 @@ export class Compiler extends DiagnosticEmitter { : this.module.createI64(0); } case TypeKind.F64: { - if (!(element.is(CommonFlags.BUILTIN) && contextualType == Type.f32)) { + // monkey-patch for converting built-in floats to f32 implicitly + if (!(element.hasDecorator(DecoratorFlags.BUILTIN) && contextualType == Type.f32)) { return this.module.createF64((element).constantFloatValue); } // otherwise fall-through: basically precomputes f32.demote/f64 of NaN / Infinity @@ -2432,22 +2491,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, @@ -4927,7 +4975,7 @@ export class Compiler extends DiagnosticEmitter { let typeArguments = expression.typeArguments; // builtins handle present respectively omitted type arguments on their own - if (prototype.is(CommonFlags.AMBIENT | CommonFlags.BUILTIN)) { + if (prototype.hasDecorator(DecoratorFlags.BUILTIN)) { return this.compileCallExpressionBuiltin(prototype, expression, contextualType); } @@ -5497,8 +5545,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 +5994,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 +6301,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) { @@ -6481,7 +6530,7 @@ export class Compiler extends DiagnosticEmitter { // allocate a new instance first and assign 'this' to the temp. local exprs[0] = module.createSetLocal( tempLocal.index, - compileBuiltinAllocate(this, classReference, expression) + compileAllocate(this, classReference, expression) ); // once all field values have been set, return 'this' @@ -6534,12 +6583,13 @@ export class Compiler extends DiagnosticEmitter { var expr: ExpressionRef; - // traverse to the first matching constructor + // traverse to the top-most visible constructor var currentClassInstance: Class | null = classInstance; - var constructorInstance = classInstance.constructorInstance; - while (!constructorInstance && (currentClassInstance = classInstance.base)) { + var constructorInstance: Function | null = null; + do { constructorInstance = currentClassInstance.constructorInstance; - } + if (constructorInstance) break; // TODO: check visibility + } while (currentClassInstance = currentClassInstance.base); // if a constructor is present, call it with a zero `this` if (constructorInstance) { @@ -6601,6 +6651,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 +6739,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 @@ -7452,7 +7503,7 @@ export class Compiler extends DiagnosticEmitter { var initializers = new Array(); initializers.push( module.createSetLocal(tempLocal.index, - compileBuiltinAllocate(this, classInstance, reportNode) + compileAllocate(this, classInstance, reportNode) ) ); @@ -7536,47 +7587,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/parser.ts b/src/parser.ts index 2da1bf21..45ef2215 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -86,8 +86,6 @@ import { nodeIsGenericCallable } from "./ast"; -const builtinsFile = LIBRARY_PREFIX + "builtins.ts"; - /** Parser interface. */ export class Parser extends DiagnosticEmitter { @@ -135,11 +133,6 @@ export class Parser extends DiagnosticEmitter { var program = this.program; program.sources.push(source); - // mark the special builtins library file - if (source.normalizedPath == builtinsFile) { - source.set(CommonFlags.BUILTIN); - } - // tokenize and parse var tn = new Tokenizer(source, program.diagnostics); tn.onComment = this.onComment; @@ -176,9 +169,6 @@ export class Parser extends DiagnosticEmitter { decorators.push(decorator); } - // mark builtins - flags |= (tn.source.flags & CommonFlags.BUILTIN); - // check modifiers var exportStart: i32 = 0; var exportEnd: i32 = 0; diff --git a/src/program.ts b/src/program.ts index b967b77b..4b53dacd 100644 --- a/src/program.ts +++ b/src/program.ts @@ -66,7 +66,8 @@ import { VariableLikeDeclarationStatement, VariableStatement, - decoratorNameToKind + decoratorNameToKind, + findDecorator } from "./ast"; import { @@ -132,6 +133,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 +326,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 +336,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 +580,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"); + let element = (this.moduleLevelExports.get("main")).element; if ( element.kind == ElementKind.FUNCTION_PROTOTYPE && !(element).isAny(CommonFlags.GENERIC | CommonFlags.AMBIENT) @@ -623,6 +636,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. */ @@ -674,7 +709,16 @@ export class Program extends DiagnosticEmitter { let kind = decoratorNameToKind(decorator.name); let flag = decoratorKindToFlag(kind); if (flag) { - if (!(acceptedFlags & flag)) { + if (flag == DecoratorFlags.BUILTIN) { + if (decorator.range.source.isLibrary) { + presentFlags |= flag; + } else { + this.error( + DiagnosticCode.Decorator_0_is_not_valid_here, + decorator.range, decorator.name.range.toString() + ); + } + } else if (!(acceptedFlags & flag)) { this.error( DiagnosticCode.Decorator_0_is_not_valid_here, decorator.range, decorator.name.range.toString() @@ -698,13 +742,9 @@ export class Program extends DiagnosticEmitter { declaration: DeclarationStatement ): void { var parentNode = declaration.parent; - // alias the element globally if it is ... + // alias globally if explicitly annotated @global or exported from a top-level library file if ( - // explicitly annotated with @global - or - (element.hasDecorator(DecoratorFlags.GLOBAL)) || - // part of the special builtins library file - or - - (declaration.range.source.is(CommonFlags.BUILTIN)) || - // exported from a top-level library file ( declaration.range.source.isLibrary && element.is(CommonFlags.EXPORT) && @@ -724,10 +764,12 @@ export class Program extends DiagnosticEmitter { ); } else { this.elementsLookup.set(globalName, element); - // builtins can use the global name directly instead of being just an alias - if (element.is(CommonFlags.BUILTIN)) element.internalName = globalName; } } + // builtins use the global name directly + if (element.hasDecorator(DecoratorFlags.BUILTIN)) { + element.internalName = declaration.programLevelInternalName; + } } /** Initializes a class declaration. */ @@ -824,14 +866,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 + }); } } @@ -903,7 +949,7 @@ export class Program extends DiagnosticEmitter { Type.void, // resolved later on declaration, decorators - ? this.checkDecorators(decorators, DecoratorFlags.NONE) + ? this.checkDecorators(decorators, DecoratorFlags.INLINE) : DecoratorFlags.NONE ); staticField.parent = classPrototype; @@ -913,6 +959,13 @@ export class Program extends DiagnosticEmitter { staticField.set(CommonFlags.MODULE_EXPORT); } + if (staticField.hasDecorator(DecoratorFlags.INLINE) && !staticField.is(CommonFlags.READONLY)) { + this.error( + DiagnosticCode.Decorator_0_is_not_valid_here, + assert(findDecorator(DecoratorKind.INLINE, decorators)).range, "inline" + ); + } + // instance fields are remembered until resolved } else { if (isInterface) { @@ -1269,14 +1322,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 +1389,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 +1447,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 +1591,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 +1756,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 +1845,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 +1946,7 @@ export class Program extends DiagnosticEmitter { decorators ? this.checkDecorators(decorators, DecoratorFlags.GLOBAL | + DecoratorFlags.INLINE | DecoratorFlags.EXTERNAL ) : DecoratorFlags.NONE @@ -1876,6 +1954,13 @@ export class Program extends DiagnosticEmitter { global.parent = namespace; this.elementsLookup.set(internalName, global); + if (global.hasDecorator(DecoratorFlags.INLINE) && !global.is(CommonFlags.CONST)) { + this.error( + DiagnosticCode.Decorator_0_is_not_valid_here, + assert(findDecorator(DecoratorKind.INLINE, decorators)).range, "inline" + ); + } + if (namespace) { if (namespace.members) { if (namespace.members.has(simpleName)) { @@ -1904,14 +1989,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); @@ -1973,7 +2062,9 @@ export enum DecoratorFlags { /** Is always inlined. */ INLINE = 1 << 6, /** Is using a different external name. */ - EXTERNAL = 1 << 7 + EXTERNAL = 1 << 7, + /** Is a builtin. */ + BUILTIN = 1 << 8 } export function decoratorKindToFlag(kind: DecoratorKind): DecoratorFlags { @@ -1987,6 +2078,7 @@ export function decoratorKindToFlag(kind: DecoratorKind): DecoratorFlags { case DecoratorKind.SEALED: return DecoratorFlags.SEALED; case DecoratorKind.INLINE: return DecoratorFlags.INLINE; case DecoratorKind.EXTERNAL: return DecoratorFlags.EXTERNAL; + case DecoratorKind.BUILTIN: return DecoratorFlags.BUILTIN; default: return DecoratorFlags.NONE; } } @@ -2308,7 +2400,7 @@ export class Function extends Element { this.flags = prototype.flags; this.decoratorFlags = prototype.decoratorFlags; this.contextualTypeArguments = contextualTypeArguments; - if (!(prototype.is(CommonFlags.AMBIENT | CommonFlags.BUILTIN) || prototype.is(CommonFlags.DECLARE))) { + if (!(prototype.is(CommonFlags.AMBIENT))) { let localIndex = 0; if (parent && parent.kind == ElementKind.CLASS) { assert(this.is(CommonFlags.INSTANCE)); diff --git a/std/assembly/allocator/arena.ts b/std/assembly/allocator/arena.ts index 3c31800d..087cd217 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 @@ -12,18 +12,19 @@ import { AL_MASK, MAX_SIZE_32 } from "../internal/allocator"; var startOffset: usize = (HEAP_BASE + AL_MASK) & ~AL_MASK; var offset: usize = startOffset; -@global -export function allocate_memory(size: usize): usize { +// Memory allocator interface + +@global 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 } } @@ -34,12 +35,8 @@ export function allocate_memory(size: usize): usize { return 0; } -@global -export function free_memory(ptr: usize): void { - // nop -} +@global export function __memory_free(ptr: usize): void { /* nop */ } -@global -export function reset_memory(): void { +@global export function __memory_reset(): void { offset = startOffset; } diff --git a/std/assembly/allocator/buddy.ts b/std/assembly/allocator/buddy.ts index 481bab08..2aea2240 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; @@ -338,8 +338,9 @@ function lower_bucket_limit(bucket: usize): u32 { return 1; } -@global -export function allocate_memory(request: usize): usize { +// Memory allocator interface + +@global export function __memory_allocate(request: usize): usize { var original_bucket: usize, bucket: usize; /* @@ -357,7 +358,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; @@ -473,8 +474,7 @@ export function allocate_memory(request: usize): usize { return 0; } -@global -export function free_memory(ptr: usize): void { +@global export function __memory_free(ptr: usize): void { var bucket: usize, i: usize; /* @@ -538,8 +538,3 @@ export function free_memory(ptr: usize): void { */ list_push(buckets$get(bucket), changetype(ptr_for_node(i, bucket))); } - -@global -export function reset_memory(): void { - unreachable(); -} diff --git a/std/assembly/allocator/emscripten.ts b/std/assembly/allocator/emscripten.ts index c44e7765..92956b76 100644 --- a/std/assembly/allocator/emscripten.ts +++ b/std/assembly/allocator/emscripten.ts @@ -11,17 +11,12 @@ declare function _malloc(size: usize): usize; declare function _free(ptr: usize): void; -@global -export function allocate_memory(size: usize): usize { +// Memory allocator interface + +@global export function __memory_allocate(size: usize): usize { return _malloc(size); } -@global -export function free_memory(ptr: usize): void { +@global export function __memory_free(ptr: usize): void { _free(ptr); } - -@global -export function reset_memory(): void { - unreachable(); -} diff --git a/std/assembly/allocator/system.ts b/std/assembly/allocator/system.ts index 4f52ff63..76b3293b 100644 --- a/std/assembly/allocator/system.ts +++ b/std/assembly/allocator/system.ts @@ -10,17 +10,12 @@ declare function malloc(size: usize): usize; declare function free(ptr: usize): void; -@global -export function allocate_memory(size: usize): usize { +// Memory allocator interface + +@global export function __memory_allocate(size: usize): usize { return malloc(size); } -@global -export function free_memory(ptr: usize): void { +@global export function __memory_free(ptr: usize): void { free(ptr); } - -@global -export function reset_memory(): void { - unreachable(); -} diff --git a/std/assembly/allocator/tlsf.ts b/std/assembly/allocator/tlsf.ts index 93e82035..fda68cfa 100644 --- a/std/assembly/allocator/tlsf.ts +++ b/std/assembly/allocator/tlsf.ts @@ -433,19 +433,18 @@ function fls(word: T): T { /** Reference to the initialized {@link Root} structure, once initialized. */ var ROOT: Root = changetype(0); -// External interface +// Memory allocator interface /** Allocates a chunk of memory. */ -@global -export function allocate_memory(size: usize): usize { +@global 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 +454,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 +468,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 } @@ -490,8 +489,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 { +@global export function __memory_free(data: usize): void { if (data) { let root = ROOT; if (root) { @@ -504,7 +502,6 @@ export function free_memory(data: usize): void { } } -@global -export function reset_memory(): void { +@global 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..a8fbe294 100644 --- a/std/assembly/builtins.ts +++ b/std/assembly/builtins.ts @@ -1,147 +1,103 @@ -export declare function isInteger(value?: T): bool; +/* tslint:disable */ -export declare function isFloat(value?: T): bool; +@builtin @inline export const NaN: f64 = 0 / 0; +@builtin @inline export const Infinity: f64 = 1 / 0; +@builtin export declare const HEAP_BASE: usize; -export declare function isSigned(value?: T): bool; +@builtin export declare function isInteger(value?: T): bool; +@builtin export declare function isFloat(value?: T): bool; +@builtin export declare function isSigned(value?: T): bool; +@builtin export declare function isReference(value?: T): bool; +@builtin export declare function isString(value?: T): bool; +@builtin export declare function isArray(value?: T): bool; +@builtin export declare function isDefined(expression: void): bool; +@builtin export declare function isConstant(expression: void): bool; +@inline export function isNaN(value: T): bool { return value != value; } +@inline export function isFinite(value: T): bool { return value - value == 0; } -export declare function isReference(value?: T): bool; +@builtin export declare function clz(value: T): T; +@builtin export declare function ctz(value: T): T; +@builtin export declare function popcnt(value: T): T; +@builtin export declare function rotl(value: T, shift: T): T; +@builtin export declare function rotr(value: T, shift: T): T; +@builtin export declare function abs(value: T): T; +@builtin export declare function max(left: T, right: T): T; +@builtin export declare function min(left: T, right: T): T; +@builtin export declare function ceil(value: T): T; +@builtin export declare function floor(value: T): T; +@builtin export declare function copysign(left: T, right: T): T; +@builtin export declare function nearest(value: T): T; +@builtin export declare function reinterpret(value: void): T; +@builtin export declare function sqrt(value: T): T; +@builtin export declare function trunc(value: T): T; +@builtin export declare function load(offset: usize, constantOffset?: usize): T; +@builtin export declare function store(offset: usize, value: void, constantOffset?: usize): void; +@builtin export declare function sizeof(): usize; // | u32 / u64 +@builtin export declare function alignof(): usize; // | u32 / u64 +@builtin export declare function offsetof(fieldName?: string): usize; // | u32 / u64 +@builtin export declare function select(ifTrue: T, ifFalse: T, condition: bool): T; +@builtin export declare function unreachable(): void; +@builtin export declare function changetype(value: void): T; +@builtin export declare function assert(isTrueish: T, message?: string): T; +@builtin export declare function unchecked(expr: T): T; +@builtin export declare function call_indirect(target: void, ...args: void[]): T; -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 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; +@builtin export declare function i8(value: void): i8; export namespace i8 { export const MIN_VALUE: i8 = -128; export const MAX_VALUE: i8 = 127; } -export declare function i16(value: void): i16; +@builtin export declare function i16(value: void): i16; export namespace i16 { export const MIN_VALUE: i16 = -32768; export const MAX_VALUE: i16 = 32767; } -export declare function i32(value: void): i32; +@builtin export declare function i32(value: void): i32; export namespace i32 { export const MIN_VALUE: i32 = -2147483648; export const MAX_VALUE: i32 = 2147483647; - export declare function clz(value: i32): i32; - export declare function ctz(value: i32): i32; - export declare function popcnt(value: i32): i32; - export declare function rotl(value: i32, shift: i32): i32; - export declare function rotr(value: i32, shift: i32): i32; - export declare function reinterpret_f32(value: f32): i32; - export declare function load8_s(offset: usize, constantOffset?: usize): i32; - export declare function load8_u(offset: usize, constantOffset?: usize): i32; - export declare function load16_s(offset: usize, constantOffset?: usize): i32; - export declare function load16_u(offset: usize, constantOffset?: usize): i32; - export declare function load(offset: usize, constantOffset?: usize): i32; - export declare function store8(offset: usize, value: i32, constantOffset?: usize): void; - export declare function store16(offset: usize, value: i32, constantOffset?: usize): void; - export declare function store(offset: usize, value: i32, constantOffset?: usize): void; + @builtin export declare function clz(value: i32): i32; + @builtin export declare function ctz(value: i32): i32; + @builtin export declare function popcnt(value: i32): i32; + @builtin export declare function rotl(value: i32, shift: i32): i32; + @builtin export declare function rotr(value: i32, shift: i32): i32; + @builtin export declare function reinterpret_f32(value: f32): i32; + @builtin export declare function load8_s(offset: usize, constantOffset?: usize): i32; + @builtin export declare function load8_u(offset: usize, constantOffset?: usize): i32; + @builtin export declare function load16_s(offset: usize, constantOffset?: usize): i32; + @builtin export declare function load16_u(offset: usize, constantOffset?: usize): i32; + @builtin export declare function load(offset: usize, constantOffset?: usize): i32; + @builtin export declare function store8(offset: usize, value: i32, constantOffset?: usize): void; + @builtin export declare function store16(offset: usize, value: i32, constantOffset?: usize): void; + @builtin export declare function store(offset: usize, value: i32, constantOffset?: usize): void; } -export declare function i64(value: void): i64; +@builtin export declare function i64(value: void): i64; export namespace i64 { export const MIN_VALUE: i64 = -9223372036854775808; export const MAX_VALUE: i64 = 9223372036854775807; - export declare function clz(value: i64): i64; - export declare function ctz(value: i64): i64; - export declare function load8_s(offset: usize, constantOffset?: usize): i64; - export declare function load8_u(offset: usize, constantOffset?: usize): u64; - export declare function load16_s(offset: usize, constantOffset?: usize): i64; - export declare function load16_u(offset: usize, constantOffset?: usize): u64; - export declare function load32_s(offset: usize, constantOffset?: usize): i64; - export declare function load32_u(offset: usize, constantOffset?: usize): u64; - export declare function load(offset: usize, constantOffset?: usize): i64; - export declare function popcnt(value: i64): i64; - export declare function rotl(value: i64, shift: i64): i64; - export declare function rotr(value: i64, shift: i64): i64; - export declare function reinterpret_f64(value: f64): i64; - export declare function store8(offset: usize, value: i64, constantOffset?: usize): void; - export declare function store16(offset: usize, value: i64, constantOffset?: usize): void; - export declare function store32(offset: usize, value: i64, constantOffset?: usize): void; - export declare function store(offset: usize, value: i64, constantOffset?: usize): void; + @builtin export declare function clz(value: i64): i64; + @builtin export declare function ctz(value: i64): i64; + @builtin export declare function load8_s(offset: usize, constantOffset?: usize): i64; + @builtin export declare function load8_u(offset: usize, constantOffset?: usize): u64; + @builtin export declare function load16_s(offset: usize, constantOffset?: usize): i64; + @builtin export declare function load16_u(offset: usize, constantOffset?: usize): u64; + @builtin export declare function load32_s(offset: usize, constantOffset?: usize): i64; + @builtin export declare function load32_u(offset: usize, constantOffset?: usize): u64; + @builtin export declare function load(offset: usize, constantOffset?: usize): i64; + @builtin export declare function popcnt(value: i64): i64; + @builtin export declare function rotl(value: i64, shift: i64): i64; + @builtin export declare function rotr(value: i64, shift: i64): i64; + @builtin export declare function reinterpret_f64(value: f64): i64; + @builtin export declare function store8(offset: usize, value: i64, constantOffset?: usize): void; + @builtin export declare function store16(offset: usize, value: i64, constantOffset?: usize): void; + @builtin export declare function store32(offset: usize, value: i64, constantOffset?: usize): void; + @builtin export declare function store(offset: usize, value: i64, constantOffset?: usize): void; } -export declare function isize(value: void): isize; +@builtin export declare function isize(value: void): isize; export namespace isize { export const MIN_VALUE: isize = sizeof() == sizeof() ? -2147483648 @@ -151,31 +107,31 @@ export namespace isize { : 9223372036854775807; } -export declare function u8(value: void): u8; +@builtin export declare function u8(value: void): u8; export namespace u8 { export const MIN_VALUE: u8 = 0; export const MAX_VALUE: u8 = 255; } -export declare function u16(value: void): u16; +@builtin export declare function u16(value: void): u16; export namespace u16 { export const MIN_VALUE: u16 = 0; export const MAX_VALUE: u16 = 65535; } -export declare function u32(value: void): u32; +@builtin export declare function u32(value: void): u32; export namespace u32 { export const MIN_VALUE: u32 = 0; export const MAX_VALUE: u32 = 4294967295; } -export declare function u64(value: void): u64; +@builtin export declare function u64(value: void): u64; export namespace u64 { export const MIN_VALUE: u64 = 0; export const MAX_VALUE: u64 = 18446744073709551615; } -export declare function usize(value: void): usize; +@builtin export declare function usize(value: void): usize; export namespace usize { export const MIN_VALUE: usize = 0; export const MAX_VALUE: usize = sizeof() == sizeof() @@ -183,13 +139,13 @@ export namespace usize { : 18446744073709551615; } -export declare function bool(value: void): bool; +@builtin export declare function bool(value: void): bool; export namespace bool { export const MIN_VALUE: bool = false; export const MAX_VALUE: bool = true; } -export declare function f32(value: void): f32; +@builtin export declare function f32(value: void): f32; export namespace f32 { export const MIN_VALUE = reinterpret(0xFF7FFFFF); // -0x1.fffffep+127f export const MAX_VALUE = reinterpret(0x7F7FFFFF); // 0x1.fffffep+127f @@ -197,21 +153,21 @@ export namespace f32 { export const MIN_SAFE_INTEGER: f32 = -16777215; export const MAX_SAFE_INTEGER: f32 = 16777215; export const EPSILON = reinterpret(0x34000000); // 0x1p-23f - export declare function abs(value: f32): f32; - export declare function ceil(value: f32): f32; - export declare function copysign(x: f32, y: f32): f32; - export declare function floor(value: f32): f32; - export declare function load(offset: usize, constantOffset?: usize): f32; - export declare function max(left: f32, right: f32): f32; - export declare function min(left: f32, right: f32): f32; - export declare function nearest(value: f32): f32; - export declare function reinterpret_i32(value: i32): f32; - export declare function sqrt(value: f32): f32; - export declare function store(offset: usize, value: f32, constantOffset?: usize): void; - export declare function trunc(value: f32): f32; + @builtin export declare function abs(value: f32): f32; + @builtin export declare function ceil(value: f32): f32; + @builtin export declare function copysign(x: f32, y: f32): f32; + @builtin export declare function floor(value: f32): f32; + @builtin export declare function load(offset: usize, constantOffset?: usize): f32; + @builtin export declare function max(left: f32, right: f32): f32; + @builtin export declare function min(left: f32, right: f32): f32; + @builtin export declare function nearest(value: f32): f32; + @builtin export declare function reinterpret_i32(value: i32): f32; + @builtin export declare function sqrt(value: f32): f32; + @builtin export declare function store(offset: usize, value: f32, constantOffset?: usize): void; + @builtin export declare function trunc(value: f32): f32; } -export declare function f64(value: void): f64; +@builtin export declare function f64(value: void): f64; export namespace f64 { export const MIN_VALUE = reinterpret(0xFFEFFFFFFFFFFFFF); // -0x1.fffffffffffffp+1023 export const MAX_VALUE = reinterpret(0x7FEFFFFFFFFFFFFF); // 0x1.fffffffffffffp+1023 @@ -219,20 +175,24 @@ export namespace f64 { export const MIN_SAFE_INTEGER: f64 = -9007199254740991; export const MAX_SAFE_INTEGER: f64 = 9007199254740991; export const EPSILON = reinterpret(0x3CB0000000000000); // 0x1p-52 - export declare function abs(value: f64): f64; - export declare function ceil(value: f64): f64; - export declare function copysign(x: f64, y: f64): f64; - export declare function floor(value: f64): f64; - export declare function load(offset: usize, constantOffset?: usize): f64; - export declare function max(left: f64, right: f64): f64; - export declare function min(left: f64, right: f64): f64; - export declare function nearest(value: f64): f64; - export declare function reinterpret_i64(value: i64): f64; - export declare function sqrt(value: f64): f64; - export declare function store(offset: usize, value: f64, constantOffset?: usize): void; - export declare function trunc(value: f64): f64; + @builtin export declare function abs(value: f64): f64; + @builtin export declare function ceil(value: f64): f64; + @builtin export declare function copysign(x: f64, y: f64): f64; + @builtin export declare function floor(value: f64): f64; + @builtin export declare function load(offset: usize, constantOffset?: usize): f64; + @builtin export declare function max(left: f64, right: f64): f64; + @builtin export declare function min(left: f64, right: f64): f64; + @builtin export declare function nearest(value: f64): f64; + @builtin export declare function reinterpret_i64(value: i64): f64; + @builtin export declare function sqrt(value: f64): f64; + @builtin export declare function store(offset: usize, value: f64, constantOffset?: usize): void; + @builtin export declare function trunc(value: f64): f64; } -export declare const HEAP_BASE: usize; +@builtin export declare function start(): void; -export declare function start(): void; +@builtin export declare function ERROR(message?: void): void; +@builtin export declare function WARNING(message?: void): void; +@builtin export declare function INFO(message?: void): void; + +@builtin 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..6c12ef48 100644 --- a/std/assembly/collector/itcm.ts +++ b/std/assembly/collector/itcm.ts @@ -4,116 +4,18 @@ * @module std/assembly/collector/itcm *//***/ -// Based on the concepts of Bach Le's μgc, see: https://github.com/bullno1/ugc +// Largely based on the Bach Le's μgc, see: https://github.com/bullno1/ugc + +const TRACE = false; import { AL_MASK, MAX_SIZE_32 } from "../internal/allocator"; -// ╒═══════════════ 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 -// ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┼─┴─┴─┤ ┐ -// │ next │ F │ ◄─┐ = nextWithFlags -// ├─────────────────────────────────────────────────────────┴─────┤ │ usize -// │ prev │ ◄─┘ -// ╞═══════════════════════════════════════════════════════════════╡ SIZE ┘ -// │ ... data ... │ -// └───────────────────────────────────────────────────────────────┘ -// F: flags - -/** Managed object flags. */ -namespace Flags { - /** Object is unreachable (so far). */ - export var WHITE = 0; - /** Object is reachable. */ - export var BLACK = 1; - /** Object is reachable but its children have not yet been scanned. */ - export const GRAY = 2; - /** Mask to obtain just the flag bits. */ - export const MASK = AL_MASK; -} - -/** Represents a managed object in memory, consisting of a header followed by the object's data. */ -@unmanaged -class ManagedObject { - - /** Pointer to the next object with additional flags stored in the alignment bits. */ - nextWithFlags: usize; - - /** Pointer to the previous object. */ - prev: ManagedObject; - - /** Visitor function called with the data pointer (excl. header). */ - visitFn: (obj: usize) => void; - - /** Size of a managed object after alignment. */ - static readonly SIZE: usize = (offsetof() + AL_MASK) & ~AL_MASK; - - /** Gets the pointer to the next object in the list. */ - get next(): ManagedObject { - return changetype(this.nextWithFlags & ~Flags.MASK); - } - - /** Sets the pointer to the next object in the list. */ - set next(obj: ManagedObject) { - this.nextWithFlags = changetype(obj) | (this.nextWithFlags & Flags.MASK); - } - - /** Inserts an object to this list. */ - insert(obj: ManagedObject): void { - var prev = this.prev; - obj.next = this; - obj.prev = prev; - prev.next = obj; - this.prev = obj; - } - - /** Removes this object from its list. */ - remove(): void { - var next = this.next; - var prev = this.prev; - next.prev = prev; - prev.next = next; - } - - /** Tests if this object is white, that is unreachable (so far). */ - get isWhite(): bool { - return (this.nextWithFlags & Flags.MASK) == Flags.WHITE; - } - - /** Marks this object as white, that is unreachable (so far). */ - makeWhite(): void { - this.nextWithFlags = (this.nextWithFlags & ~Flags.MASK) | Flags.WHITE; - } - - /** Tests if this object is black, that is reachable. Root objects are always reachable. */ - get isBlack(): bool { - return (this.nextWithFlags & Flags.MASK) == Flags.BLACK; - } - - /** Marks this object as black, that is reachable. */ - makeBlack(): void { - this.nextWithFlags = (this.nextWithFlags & ~Flags.MASK) | Flags.BLACK; - } - - /** Tests if this object is gray, that is reachable with unscanned children. */ - get isGray(): bool { - return (this.nextWithFlags & Flags.MASK) == Flags.GRAY; - } - - /** Marks this object as gray, that is reachable with unscanned children. */ - makeGray(): void { - if (this != iter) { - this.remove(); - to.insert(this); - } else { - iter = iter.prev; - } - this.nextWithFlags = (this.nextWithFlags & ~Flags.MASK) | Flags.GRAY; - } -} +import { + iterateRoots +} from "../gc"; /** Collector states. */ const enum State { @@ -129,125 +31,213 @@ const enum State { /** Current collector state. */ var state = State.INIT; +/** Current white color value. */ +var white = 0; // From and to spaces -var from: ManagedObject; -var to: ManagedObject; +var from: ManagedObjectSet; +var to: ManagedObjectSet; var iter: ManagedObject; +// ╒═══════════════ 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 +// ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┼─┴─┴─┤ ┐ +// │ next │ F │ ◄─┐ = nextWithFlags +// ├─────────────────────────────────────────────────────────┴─────┤ │ usize +// │ prev │ ◄─┘ +// ╞═══════════════════════════════════════════════════════════════╡ SIZE ┘ +// │ ... data ... │ +// └───────────────────────────────────────────────────────────────┘ +// F: flags + +/** Represents a managed object in memory, consisting of a header followed by the object's data. */ +@unmanaged +class ManagedObject { + + /** Pointer to the next object with color flags stored in the alignment bits. */ + nextWithColor: usize; + + /** Pointer to the previous object. */ + prev: ManagedObject; + + /** Visitor function called with the payload reference. */ + visitFn: (ref: usize) => void; + + /** Size of a managed object after alignment. */ + static readonly SIZE: usize = (offsetof() + AL_MASK) & ~AL_MASK; + + /** Gets the pointer to the next object in the list. */ + get next(): ManagedObject { + return changetype(this.nextWithColor & ~3); + } + + /** Sets the pointer to the next object in the list. */ + set next(obj: ManagedObject) { + this.nextWithColor = changetype(obj) | (this.nextWithColor & 3); + } + + /** Gets this object's color. */ + get color(): i32 { + return this.nextWithColor & 3; + } + + /** Sets this object's color. */ + set color(color: i32) { + this.nextWithColor = (this.nextWithColor & ~3) | color; + } + + /** Unlinks this object from its list. */ + unlink(): void { + var next = this.next; + var prev = this.prev; + if (TRACE) trace(" unlink", 3, objToRef(prev), objToRef(this), objToRef(next)); + next.prev = prev; + prev.next = next; + } + + /** Marks this object as gray, that is reachable with unscanned children. */ + makeGray(): void { + if (TRACE) trace(" makeGray", 1, objToRef(this)); + const gray = 2; + if (this == iter) iter = this.prev; + this.unlink(); + to.push(this); + this.nextWithColor = (this.nextWithColor & ~3) | gray; + } +} + +/** A set of managed objects. Used for the from and to spaces. */ +@unmanaged +class ManagedObjectSet extends ManagedObject { + + /** Inserts an object. */ + push(obj: ManagedObject): void { + var prev = this.prev; + if (TRACE) trace(" push", 3, objToRef(prev), objToRef(obj), objToRef(this)); + obj.next = this; + obj.prev = prev; + prev.next = obj; + this.prev = obj; + } + + /** Clears this list. */ + clear(): void { + if (TRACE) trace(" clear", 1, objToRef(this)); + this.nextWithColor = changetype(this); + this.prev = this; + } +} + /** Performs a single step according to the current state. */ -function gc_step(): void { +function 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; + if (TRACE) trace("gc~step/INIT"); + from = changetype(memory.allocate(ManagedObject.SIZE)); + from.visitFn = changetype<(ref: usize) => void>(-1); // would error + from.clear(); + to = changetype(memory.allocate(ManagedObject.SIZE)); + to.visitFn = changetype<(ref: usize) => void>(-1); // would error + to.clear(); iter = to; + state = State.IDLE; + if (TRACE) trace("gc~state = IDLE"); // fall-through } case State.IDLE: { + if (TRACE) trace("gc~step/IDLE"); + iterateRoots(__gc_mark); state = State.MARK; + if (TRACE) trace("gc~state = MARK"); break; } case State.MARK: { obj = iter.next; - if (obj != to) { + if (obj !== to) { + if (TRACE) trace("gc~step/MARK iterate", 1, objToRef(obj)); iter = obj; - obj.makeBlack(); - obj.visitFn(changetype(obj) + ManagedObject.SIZE); + obj.color = !white; + obj.visitFn(objToRef(obj)); } else { + if (TRACE) trace("gc~step/MARK finish"); + iterateRoots(__gc_mark); obj = iter.next; - if (obj == to) { - let temp = from; + if (obj === to) { + let prevFrom = from; from = to; - to = temp; - Flags.WHITE ^= 1; - Flags.BLACK ^= 1; - iter = from.next; + to = prevFrom; + white = !white; + iter = prevFrom.next; state = State.SWEEP; + if (TRACE) trace("gc~state = SWEEP"); } } break; } case State.SWEEP: { obj = iter; - if (obj != to) { + if (obj !== to) { + if (TRACE) trace("gc~step/SWEEP free", 1, objToRef(obj)); iter = obj.next; - free_memory(changetype(obj)); + memory.free(changetype(obj)); } else { - to.nextWithFlags = changetype(to); - to.prev = to; + if (TRACE) trace("gc~step/SWEEP finish"); + to.clear(); state = State.IDLE; + if (TRACE) trace("gc~state = IDLE"); } break; } } } -/** Allocates a managed object. */ -@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); +@inline function refToObj(ref: usize): ManagedObject { + return changetype(ref - ManagedObject.SIZE); +} + +@inline function objToRef(obj: ManagedObject): usize { return changetype(obj) + ManagedObject.SIZE; } -/** 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(); +// Garbage collector interface + +@global export function __gc_allocate( + size: usize, + visitFn: (ref: usize) => void +): usize { + if (TRACE) trace("gc.allocate", 1, size); + if (size > MAX_SIZE_32 - ManagedObject.SIZE) unreachable(); + step(); // also makes sure it's initialized + var obj = changetype(memory.allocate(ManagedObject.SIZE + size)); + obj.visitFn = visitFn; + obj.color = white; + from.push(obj); + return objToRef(obj); } -/** 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(); +@global export function __gc_link(parentRef: usize, childRef: usize): void { + if (TRACE) trace("gc.link", 2, parentRef, childRef); + var parent = refToObj(parentRef); + if (parent.color == !white && refToObj(childRef).color == white) parent.makeGray(); } -/** Iterates the root set. Provided by the compiler according to the program. */ -@global -export declare function gc_roots(): void; +@global export function __gc_mark(ref: usize): void { + if (TRACE) trace("gc.mark", 1, ref); + if (ref) { + let obj = refToObj(ref); + if (obj.color == white) obj.makeGray(); + } +} -/** Performs a full garbage collection cycle. */ -@global -export function gc_collect(): void { +@global export function __gc_collect(): void { + if (TRACE) trace("gc.collect"); // begin collecting if not yet collecting switch (state) { case State.INIT: - case State.IDLE: gc_step(); + case State.IDLE: step(); } // finish the cycle - while (state != State.IDLE) gc_step(); + while (state != State.IDLE) 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/env.ts b/std/assembly/env.ts index f6da30e5..381e482c 100644 --- a/std/assembly/env.ts +++ b/std/assembly/env.ts @@ -1,7 +1,16 @@ -/** Environment abort function called where assertions evaluate to false / on throw. */ declare function abort( message?: string | null, fileName?: string | null, lineNumber?: u32, columnNumber?: u32 ): void; + +declare function trace( + message: string, + n?: i32, + a0?: f64, + a1?: f64, + a2?: f64, + a3?: f64, + a4?: f64 +): void; diff --git a/std/assembly/gc.ts b/std/assembly/gc.ts new file mode 100644 index 00000000..fa1f827b --- /dev/null +++ b/std/assembly/gc.ts @@ -0,0 +1,28 @@ +@builtin export declare function iterateRoots(fn: (ref: usize) => void): void; // tslint:disable-line + +export namespace gc { + + export function allocate(size: usize, visitFn: (ref: usize) => void): usize { + if (isDefined(__gc_allocate)) return __gc_allocate(size, visitFn); // tslint:disable-line + WARNING("Calling 'gc.allocate' requires a garbage collector to be present."); + return unreachable(); + } + + export function collect(): void { + if (isDefined(__gc_collect)) { __gc_collect(); return; } // tslint:disable-line + WARNING("Calling 'gc.collect' requires a garbage collector to be present."); + unreachable(); + } + + export function link(parentRef: usize, childRef: usize): void { + if (isDefined(__gc_link)) { __gc_link(parentRef, childRef); return; } // tslint:disable-line + WARNING("Calling 'gc.link' requires a garbage collector to be present."); + unreachable(); + } + + export function mark(ref: usize): void { + if (isDefined(__gc_mark)) { __gc_mark(ref); return; } // tslint:disable-line + WARNING("Calling 'gc.mark' requires a garbage collector to be present."); + unreachable(); + } +} diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 36c7f6e9..cbed794a 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,70 @@ 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; +} + +/** Garbage collector operations. */ +declare namespace gc { + /** Allocates a managed object identified by its visitor function. */ + export function allocate(size: usize, visitFn: (ref: usize) => void): usize; + /** Performs a full garbage collection cycle. */ + export function collect(): void; + /** Must be called when a managed object becomes a child of another one. */ + export function link(parentRef: usize, childRef: usize): void; + /** Must be called when a managed object is found reachable. */ + export function mark(ref: usize): 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 +652,10 @@ declare const Math: IMath; /** Alias of {@link NativeMathf} or {@link JSMath} respectively. Defaults to `NativeMathf`. */ declare const Mathf: IMath; -// Internal decorators +/** Environmental tracing function for debugging purposes. */ +declare function trace(msg: string, n?: i32, a0?: f64, a1?: f64, a2?: f64, a3?: f64, a4?: f64): void; + +// 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..51d82695 100644 --- a/std/assembly/memory.ts +++ b/std/assembly/memory.ts @@ -1,7 +1,56 @@ -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 { + @builtin export declare function size(): i32; // tslint:disable-line + + @builtin export declare function grow(pages: i32): i32; // 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 +193,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 +235,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 +296,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..5230aa59 100644 --- a/tests/allocators/arena/optimized.wat +++ b/tests/allocators/arena/optimized.wat @@ -1,17 +1,3042 @@ (module + (type $iiiv (func (param i32 i32 i32))) + (type $iiii (func (param i32 i32 i32) (result i32))) (type $ii (func (param 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" (memory $0)) + (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)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memset (; 0 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i64) + (local $4 i32) + ;;@ ~lib/memory.ts:244:2 + (if + ;;@ ~lib/memory.ts:244:6 + (i32.eqz + ;;@ ~lib/memory.ts:244:7 + (get_local $2) + ) + ;;@ ~lib/memory.ts:244:10 + (return) + ) + ;;@ ~lib/memory.ts:245:2 + (i32.store8 + ;;@ ~lib/memory.ts:245:12 + (get_local $0) + ;;@ ~lib/memory.ts:245:18 + (get_local $1) + ) + ;;@ ~lib/memory.ts:246:2 + (i32.store8 + ;;@ ~lib/memory.ts:246:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:246:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:246:23 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:246:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:247:2 + (if + ;;@ ~lib/memory.ts:247:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:247:11 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:247:14 + (return) + ) + ;;@ ~lib/memory.ts:249:2 + (i32.store8 + ;;@ ~lib/memory.ts:249:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:249:19 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:249:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:250:2 + (i32.store8 + ;;@ ~lib/memory.ts:250:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:250:19 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:250:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:251:2 + (i32.store8 + ;;@ ~lib/memory.ts:251:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:251:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:251:23 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:251:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:252:2 + (i32.store8 + ;;@ ~lib/memory.ts:252:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:252:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:252:23 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:252:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:253:2 + (if + ;;@ ~lib/memory.ts:253:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:253:11 + (i32.const 6) + ) + ;;@ ~lib/memory.ts:253:14 + (return) + ) + ;;@ ~lib/memory.ts:254:2 + (i32.store8 + ;;@ ~lib/memory.ts:254:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:254:19 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:254:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:255:2 + (i32.store8 + ;;@ ~lib/memory.ts:255:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:255:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:255:23 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:255:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:256:2 + (if + ;;@ ~lib/memory.ts:256:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:256:11 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:256:14 + (return) + ) + ;;@ ~lib/memory.ts:267:2 + (i32.store + ;;@ ~lib/memory.ts:260:2 + (tee_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:259:2 + (tee_local $4 + ;;@ ~lib/memory.ts:259:17 + (i32.and + (i32.sub + (i32.const 0) + ;;@ ~lib/memory.ts:259:18 + (get_local $0) + ) + ;;@ ~lib/memory.ts:259:25 + (i32.const 3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:264:2 + (tee_local $1 + ;;@ ~lib/memory.ts:264:17 + (i32.mul + (i32.and + ;;@ ~lib/memory.ts:264:33 + (get_local $1) + (i32.const 255) + ) + (i32.const 16843009) + ) + ) + ) + ;;@ ~lib/memory.ts:268:2 + (i32.store + ;;@ ~lib/memory.ts:268:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:262:2 + (tee_local $2 + (i32.and + (i32.sub + ;;@ ~lib/memory.ts:261:2 + (get_local $2) + ;;@ ~lib/memory.ts:261:7 + (get_local $4) + ) + ;;@ ~lib/memory.ts:262:7 + (i32.const -4) + ) + ) + ) + ;;@ ~lib/memory.ts:268:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:268:27 + (get_local $1) + ) + ;;@ ~lib/memory.ts:269:2 + (if + ;;@ ~lib/memory.ts:269:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:269:11 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:269:14 + (return) + ) + ;;@ ~lib/memory.ts:270:2 + (i32.store + ;;@ ~lib/memory.ts:270:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:270:20 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:270:23 + (get_local $1) + ) + ;;@ ~lib/memory.ts:271:2 + (i32.store + ;;@ ~lib/memory.ts:271:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:271:20 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:271:23 + (get_local $1) + ) + ;;@ ~lib/memory.ts:272:2 + (i32.store + ;;@ ~lib/memory.ts:272:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:272:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:272:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:272:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:273:2 + (i32.store + ;;@ ~lib/memory.ts:273:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:273:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:273:24 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:273:27 + (get_local $1) + ) + ;;@ ~lib/memory.ts:274:2 + (if + ;;@ ~lib/memory.ts:274:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:274:11 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:274:15 + (return) + ) + ;;@ ~lib/memory.ts:275:2 + (i32.store + ;;@ ~lib/memory.ts:275:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:275:20 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:275:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:276:2 + (i32.store + ;;@ ~lib/memory.ts:276:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:276:20 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:276:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:277:2 + (i32.store + ;;@ ~lib/memory.ts:277:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:277:20 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:277:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:278:2 + (i32.store + ;;@ ~lib/memory.ts:278:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:278:20 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:278:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:279:2 + (i32.store + ;;@ ~lib/memory.ts:279:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:279:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:279:24 + (i32.const 28) + ) + ;;@ ~lib/memory.ts:279:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:280:2 + (i32.store + ;;@ ~lib/memory.ts:280:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:280:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:280:24 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:280:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:281:2 + (i32.store + ;;@ ~lib/memory.ts:281:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:281:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:281:24 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:281:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:282:2 + (i32.store + ;;@ ~lib/memory.ts:282:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:282:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:282:24 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:282:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:286:2 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:285:2 + (tee_local $4 + ;;@ ~lib/memory.ts:285:6 + (i32.add + ;;@ ~lib/memory.ts:285:11 + (i32.and + ;;@ ~lib/memory.ts:285:12 + (get_local $0) + ;;@ ~lib/memory.ts:285:19 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:285:6 + (i32.const 24) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:287:2 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:287:7 + (get_local $4) + ) + ) + ;;@ ~lib/memory.ts:290:2 + (set_local $3 + ;;@ ~lib/memory.ts:290:17 + (i64.or + (i64.extend_u/i32 + (get_local $1) + ) + ;;@ ~lib/memory.ts:290:28 + (i64.shl + ;;@ ~lib/memory.ts:290:29 + (i64.extend_u/i32 + (get_local $1) + ) + ;;@ ~lib/memory.ts:290:41 + (i64.const 32) + ) + ) + ) + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:291:9 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:291:14 + (i32.const 32) + ) + (block + ;;@ ~lib/memory.ts:292:4 + (i64.store + ;;@ ~lib/memory.ts:292:15 + (get_local $0) + ;;@ ~lib/memory.ts:292:21 + (get_local $3) + ) + ;;@ ~lib/memory.ts:293:4 + (i64.store + ;;@ ~lib/memory.ts:293:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:293:22 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:293:25 + (get_local $3) + ) + ;;@ ~lib/memory.ts:294:4 + (i64.store + ;;@ ~lib/memory.ts:294:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:294:22 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:294:26 + (get_local $3) + ) + ;;@ ~lib/memory.ts:295:4 + (i64.store + ;;@ ~lib/memory.ts:295:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:295:22 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:295:26 + (get_local $3) + ) + ;;@ ~lib/memory.ts:296:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:296:9 + (i32.const 32) + ) + ) + ;;@ ~lib/memory.ts:297:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:297:12 + (i32.const 32) + ) + ) + (br $continue|0) + ) + ) + ) + ) + (func $~lib/memory/memory.fill (; 1 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/memory.ts:11:4 + (call $~lib/memory/memset + ;;@ ~lib/memory.ts:11:11 + (get_local $0) + ;;@ ~lib/memory.ts:11:17 + (get_local $1) + ;;@ ~lib/memory.ts:11:20 + (get_local $2) + ) + ) + (func $~lib/memory/memcpy (; 2 ;) (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:59:14 + (i32.and + ;;@ ~lib/memory.ts:59:15 + (get_local $1) + ;;@ ~lib/memory.ts:59:21 + (i32.const 3) + ) + (get_local $2) + ;;@ ~lib/memory.ts:59:9 + (get_local $2) + ) + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:60:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:60:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:60:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:60:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:61:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ;;@ ~lib/memory.ts:65:2 + (if + (i32.eqz + ;;@ ~lib/memory.ts:65:6 + (i32.and + ;;@ ~lib/memory.ts:65:7 + (get_local $0) + ;;@ ~lib/memory.ts:65:14 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:65:23 + (block + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:66:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:66:16 + (i32.const 16) + ) + (block + ;;@ ~lib/memory.ts:67:6 + (i32.store + ;;@ ~lib/memory.ts:67:17 + (get_local $0) + ;;@ ~lib/memory.ts:67:28 + (i32.load + ;;@ ~lib/memory.ts:67:38 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:68:6 + (i32.store + ;;@ ~lib/memory.ts:68:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:68:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:68:28 + (i32.load + ;;@ ~lib/memory.ts:68:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:68:45 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:69:6 + (i32.store + ;;@ ~lib/memory.ts:69:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:69:25 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:69:28 + (i32.load + ;;@ ~lib/memory.ts:69:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:69:45 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:70:6 + (i32.store + ;;@ ~lib/memory.ts:70:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:70:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:70:28 + (i32.load + ;;@ ~lib/memory.ts:70:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:70:44 + (i32.const 12) + ) + ) + ) + ;;@ ~lib/memory.ts:71:6 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:71:13 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:71:17 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:71:25 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:71:29 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:71:34 + (i32.const 16) + ) + ) + (br $continue|1) + ) + ) + ) + ;;@ ~lib/memory.ts:73:4 + (if + ;;@ ~lib/memory.ts:73:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:73:12 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:73:15 + (block + ;;@ ~lib/memory.ts:74:6 + (i32.store + ;;@ ~lib/memory.ts:74:17 + (get_local $0) + ;;@ ~lib/memory.ts:74:27 + (i32.load + ;;@ ~lib/memory.ts:74:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:75:6 + (i32.store + ;;@ ~lib/memory.ts:75:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:75:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:75:27 + (i32.load + ;;@ ~lib/memory.ts:75:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:75:43 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:76:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:76:14 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:76:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:76:24 + (i32.const 8) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:78:4 + (if + ;;@ ~lib/memory.ts:78:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:78:12 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:78:15 + (block + ;;@ ~lib/memory.ts:79:6 + (i32.store + ;;@ ~lib/memory.ts:79:17 + (get_local $0) + ;;@ ~lib/memory.ts:79:23 + (i32.load + ;;@ ~lib/memory.ts:79:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:80:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:80:14 + (i32.const 4) + ) + ) + ;;@ ~lib/memory.ts:80:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:80:24 + (i32.const 4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:82:4 + (if + ;;@ ~lib/memory.ts:82:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:82:12 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:82:15 + (block + ;;@ ~lib/memory.ts:83:6 + (i32.store16 + ;;@ ~lib/memory.ts:83:17 + (get_local $0) + ;;@ ~lib/memory.ts:83:23 + (i32.load16_u + ;;@ ~lib/memory.ts:83:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:84:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:84:14 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:84:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:84:24 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:86:4 + (if + ;;@ ~lib/memory.ts:86:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:86:12 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:87:16 + (block + (set_local $3 + (get_local $0) + ) + ;;@ ~lib/memory.ts:86:15 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:87:33 + (block (result i32) + (set_local $3 + (get_local $1) + ) + ;;@ ~lib/memory.ts:87:24 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:89:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:94:2 + (if + ;;@ ~lib/memory.ts:94:6 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:94:11 + (i32.const 32) + ) + ;;@ ~lib/memory.ts:94: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:95:12 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:95:19 + (i32.const 3) + ) + (i32.const 1) + ) + ) + ) + (br $break|2) + ) + ;;@ ~lib/memory.ts:98:8 + (set_local $4 + ;;@ ~lib/memory.ts:98:12 + (i32.load + ;;@ ~lib/memory.ts:98:22 + (get_local $1) + ) + ) + (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) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:100:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:100:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:100:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:100:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:101:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:101:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:101:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:101:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:102:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:102:13 + (i32.const 3) + ) + ) + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:103:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:103:20 + (i32.const 17) + ) + (block + ;;@ ~lib/memory.ts:105:10 + (i32.store + ;;@ ~lib/memory.ts:105:21 + (get_local $0) + ;;@ ~lib/memory.ts:105:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:105:32 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:105:37 + (i32.shl + ;;@ ~lib/memory.ts:104:10 + (tee_local $3 + ;;@ ~lib/memory.ts:104:14 + (i32.load + ;;@ ~lib/memory.ts:104:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:104:30 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:105:42 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:107:10 + (i32.store + ;;@ ~lib/memory.ts:107:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:107:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:107:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:107:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:107:41 + (i32.shl + ;;@ ~lib/memory.ts:106:10 + (tee_local $4 + ;;@ ~lib/memory.ts:106:14 + (i32.load + ;;@ ~lib/memory.ts:106:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:106:30 + (i32.const 5) + ) + ) + ) + ;;@ ~lib/memory.ts:107:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:109:10 + (i32.store + ;;@ ~lib/memory.ts:109:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:109:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:109:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:109:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:109:41 + (i32.shl + ;;@ ~lib/memory.ts:108:10 + (tee_local $3 + ;;@ ~lib/memory.ts:108:14 + (i32.load + ;;@ ~lib/memory.ts:108:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:108:30 + (i32.const 9) + ) + ) + ) + ;;@ ~lib/memory.ts:109:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:111:10 + (i32.store + ;;@ ~lib/memory.ts:111:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:111:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:111:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:111:37 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:111:42 + (i32.shl + ;;@ ~lib/memory.ts:110:10 + (tee_local $4 + ;;@ ~lib/memory.ts:110:14 + (i32.load + ;;@ ~lib/memory.ts:110:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:110:30 + (i32.const 13) + ) + ) + ) + ;;@ ~lib/memory.ts:111:47 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:112:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:112:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:112:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:112:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:112:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:112:38 + (i32.const 16) + ) + ) + (br $continue|3) + ) + ) + ) + ;;@ ~lib/memory.ts:114:8 + (br $break|2) + ) + ;;@ ~lib/memory.ts:117:8 + (set_local $4 + ;;@ ~lib/memory.ts:117:12 + (i32.load + ;;@ ~lib/memory.ts:117:22 + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:118:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:118:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:118:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:118:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:119:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:119:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:119:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:119:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:120:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:120:13 + (i32.const 2) + ) + ) + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:121:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:121:20 + (i32.const 18) + ) + (block + ;;@ ~lib/memory.ts:123:10 + (i32.store + ;;@ ~lib/memory.ts:123:21 + (get_local $0) + ;;@ ~lib/memory.ts:123:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:123:32 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:123:37 + (i32.shl + ;;@ ~lib/memory.ts:122:10 + (tee_local $3 + ;;@ ~lib/memory.ts:122:14 + (i32.load + ;;@ ~lib/memory.ts:122:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:122:30 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/memory.ts:123:42 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:125:10 + (i32.store + ;;@ ~lib/memory.ts:125:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:125:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:125:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:125:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:125:41 + (i32.shl + ;;@ ~lib/memory.ts:124:10 + (tee_local $4 + ;;@ ~lib/memory.ts:124:14 + (i32.load + ;;@ ~lib/memory.ts:124:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:124:30 + (i32.const 6) + ) + ) + ) + ;;@ ~lib/memory.ts:125:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:127:10 + (i32.store + ;;@ ~lib/memory.ts:127:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:127:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:127:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:127:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:127:41 + (i32.shl + ;;@ ~lib/memory.ts:126:10 + (tee_local $3 + ;;@ ~lib/memory.ts:126:14 + (i32.load + ;;@ ~lib/memory.ts:126:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:126:30 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/memory.ts:127:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:129:10 + (i32.store + ;;@ ~lib/memory.ts:129:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:129:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:129:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:129:37 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:129:42 + (i32.shl + ;;@ ~lib/memory.ts:128:10 + (tee_local $4 + ;;@ ~lib/memory.ts:128:14 + (i32.load + ;;@ ~lib/memory.ts:128:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:128:30 + (i32.const 14) + ) + ) + ) + ;;@ ~lib/memory.ts:129:47 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:130:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:130:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:130:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:130:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:130:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:130:38 + (i32.const 16) + ) + ) + (br $continue|4) + ) + ) + ) + ;;@ ~lib/memory.ts:132:8 + (br $break|2) + ) + ;;@ ~lib/memory.ts:135:8 + (set_local $4 + ;;@ ~lib/memory.ts:135:12 + (i32.load + ;;@ ~lib/memory.ts:135:22 + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:136:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:136:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:136:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:136:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:137:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:137:13 + (i32.const 1) + ) + ) + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:138:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:138:20 + (i32.const 19) + ) + (block + ;;@ ~lib/memory.ts:140:10 + (i32.store + ;;@ ~lib/memory.ts:140:21 + (get_local $0) + ;;@ ~lib/memory.ts:140:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:140:32 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:140:36 + (i32.shl + ;;@ ~lib/memory.ts:139:10 + (tee_local $3 + ;;@ ~lib/memory.ts:139:14 + (i32.load + ;;@ ~lib/memory.ts:139:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:139:30 + (i32.const 3) + ) + ) + ) + ;;@ ~lib/memory.ts:140:41 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:142:10 + (i32.store + ;;@ ~lib/memory.ts:142:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:142:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:142:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:142:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:142:40 + (i32.shl + ;;@ ~lib/memory.ts:141:10 + (tee_local $4 + ;;@ ~lib/memory.ts:141:14 + (i32.load + ;;@ ~lib/memory.ts:141:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:141:30 + (i32.const 7) + ) + ) + ) + ;;@ ~lib/memory.ts:142:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:144:10 + (i32.store + ;;@ ~lib/memory.ts:144:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:144:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:144:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:144:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:144:40 + (i32.shl + ;;@ ~lib/memory.ts:143:10 + (tee_local $3 + ;;@ ~lib/memory.ts:143:14 + (i32.load + ;;@ ~lib/memory.ts:143:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:143:30 + (i32.const 11) + ) + ) + ) + ;;@ ~lib/memory.ts:144:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:146:10 + (i32.store + ;;@ ~lib/memory.ts:146:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:146:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:146:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:146:37 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:146:41 + (i32.shl + ;;@ ~lib/memory.ts:145:10 + (tee_local $4 + ;;@ ~lib/memory.ts:145:14 + (i32.load + ;;@ ~lib/memory.ts:145:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:145:30 + (i32.const 15) + ) + ) + ) + ;;@ ~lib/memory.ts:146:46 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:147:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:147:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:147:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:147:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:147:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:147:38 + (i32.const 16) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:155:2 + (if + ;;@ ~lib/memory.ts:155:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:155:10 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:155:14 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:156:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:156:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:156:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:156:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:157:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:157:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:157:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:157:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:158:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:158:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:158:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:158:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:159:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:159:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:159:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:159:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:160:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:160:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:160:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:160:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:161:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:161:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:161:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:161:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:162:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:162:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:162:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:162:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:163:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:163:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:163:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:163:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:164:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:164:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:164:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:164:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (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) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:166:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:166:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:166:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:166:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:167:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:167:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:167:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:167:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:168:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:168:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:168:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:168:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:169:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:169:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:169:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:169:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:170:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:170:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:170:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:170:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:171:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:171:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:171:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:171:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:173:2 + (if + ;;@ ~lib/memory.ts:173:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:173:10 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:173:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:174:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:174:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:174:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:174:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:175:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:175:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:175:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:175:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:176:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:176:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:176:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:176:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:177:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:177:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:177:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:177:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:178:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:178:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:178:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:178:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:179:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:179:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:179:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:179:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:180:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:180:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:180:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:180:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:181:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:181:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:181:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:181:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:183:2 + (if + ;;@ ~lib/memory.ts:183:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:183:10 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:183:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:184:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:184:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:184:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:184:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:185:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:185:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:185:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:185:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:186:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:186:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:186:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:186:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:187:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:187:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:187:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:187:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:189:2 + (if + ;;@ ~lib/memory.ts:189:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:189:10 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:189:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:190:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:190:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:190:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:190:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:191:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:191:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:191:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:191:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:193:2 + (if + ;;@ ~lib/memory.ts:193:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:193:10 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:194:14 + (block + (set_local $3 + (get_local $0) + ) + ;;@ ~lib/memory.ts:193:13 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:194:31 + (block (result i32) + (set_local $3 + (get_local $1) + ) + ;;@ ~lib/memory.ts:194:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memmove (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + ;;@ ~lib/memory.ts:200:2 + (if + ;;@ ~lib/memory.ts:200:6 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:200:14 + (get_local $1) + ) + ;;@ ~lib/memory.ts:200:19 + (return) + ) + ;;@ ~lib/memory.ts:201:2 + (if + ;;@ ~lib/memory.ts:201:6 + (if (result i32) + (tee_local $3 + (i32.le_u + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:201:12 + (get_local $2) + ) + ;;@ ~lib/memory.ts:201:17 + (get_local $0) + ) + ) + (get_local $3) + ;;@ ~lib/memory.ts:201:25 + (i32.le_u + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:201:32 + (get_local $2) + ) + ;;@ ~lib/memory.ts:201:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:201:42 + (block + ;;@ ~lib/memory.ts:202:4 + (call $~lib/memory/memcpy + ;;@ ~lib/memory.ts:202:11 + (get_local $0) + ;;@ ~lib/memory.ts:202:17 + (get_local $1) + ;;@ ~lib/memory.ts:202:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:203:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:205:2 + (if + ;;@ ~lib/memory.ts:205:6 + (i32.lt_u + (get_local $0) + ;;@ ~lib/memory.ts:205:13 + (get_local $1) + ) + ;;@ ~lib/memory.ts:205:18 + (block + ;;@ ~lib/memory.ts:206:4 + (if + ;;@ ~lib/memory.ts:206:8 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:206:9 + (get_local $1) + ;;@ ~lib/memory.ts:206:15 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:206:21 + (i32.and + ;;@ ~lib/memory.ts:206:22 + (get_local $0) + ;;@ ~lib/memory.ts:206:29 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:206:33 + (block + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:207:13 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:207:20 + (i32.const 7) + ) + (block + ;;@ ~lib/memory.ts:208:8 + (if + ;;@ ~lib/memory.ts:208:12 + (i32.eqz + ;;@ ~lib/memory.ts:208:13 + (get_local $2) + ) + ;;@ ~lib/memory.ts:208:16 + (return) + ) + ;;@ ~lib/memory.ts:209:8 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:209:10 + (get_local $2) + (i32.const 1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:210:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:210:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:210:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:210:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (br $continue|0) + ) + ) + ) + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:212:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:212:18 + (i32.const 8) + ) + (block + ;;@ ~lib/memory.ts:213:8 + (i64.store + ;;@ ~lib/memory.ts:213:19 + (get_local $0) + ;;@ ~lib/memory.ts:213:25 + (i64.load + ;;@ ~lib/memory.ts:213:35 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:214:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:214:16 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:215:8 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:215:16 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:216:8 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:216:16 + (i32.const 8) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ) + (loop $continue|2 + (if + ;;@ ~lib/memory.ts:219:11 + (get_local $2) + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:220:16 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:220:6 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:220:33 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:220:24 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:221:6 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:221:8 + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:223:9 + (block + ;;@ ~lib/memory.ts:224:4 + (if + ;;@ ~lib/memory.ts:224:8 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:224:9 + (get_local $1) + ;;@ ~lib/memory.ts:224:15 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:224:21 + (i32.and + ;;@ ~lib/memory.ts:224:22 + (get_local $0) + ;;@ ~lib/memory.ts:224:29 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:224:33 + (block + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:225:13 + (i32.and + (i32.add + ;;@ ~lib/memory.ts:225:14 + (get_local $0) + ;;@ ~lib/memory.ts:225:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:225:26 + (i32.const 7) + ) + (block + ;;@ ~lib/memory.ts:226:8 + (if + ;;@ ~lib/memory.ts:226:12 + (i32.eqz + ;;@ ~lib/memory.ts:226:13 + (get_local $2) + ) + ;;@ ~lib/memory.ts:226:16 + (return) + ) + ;;@ ~lib/memory.ts:227:8 + (i32.store8 + ;;@ ~lib/memory.ts:227:18 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:227:25 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:227:27 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:227:30 + (i32.load8_u + ;;@ ~lib/memory.ts:227:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:227:45 + (get_local $2) + ) + ) + ) + (br $continue|3) + ) + ) + ) + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:229:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:229:18 + (i32.const 8) + ) + (block + ;;@ ~lib/memory.ts:231:8 + (i64.store + ;;@ ~lib/memory.ts:231:19 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:230:8 + (tee_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:230:13 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:231:29 + (i64.load + ;;@ ~lib/memory.ts:231:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:231:45 + (get_local $2) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ) + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:234:11 + (get_local $2) + (block + ;;@ ~lib/memory.ts:234:14 + (i32.store8 + ;;@ ~lib/memory.ts:235:16 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:235:23 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:235:25 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:235:28 + (i32.load8_u + ;;@ ~lib/memory.ts:235:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:235:43 + (get_local $2) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.copy (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/memory.ts:16:4 + (call $~lib/memory/memmove + ;;@ ~lib/memory.ts:16:12 + (get_local $0) + ;;@ ~lib/memory.ts:16:18 + (get_local $1) + ;;@ ~lib/memory.ts:16:23 + (get_local $2) + ) + ) + (func $~lib/memory/memcmp (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + ;;@ ~lib/memory.ts:302:2 + (if + ;;@ ~lib/memory.ts:302:6 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:302:12 + (get_local $1) + ) + ;;@ ~lib/memory.ts:302:23 + (return + (i32.const 0) + ) + ) + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:303:9 + (if (result i32) + (tee_local $3 + (i32.ne + (get_local $2) + ;;@ ~lib/memory.ts:303:14 + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:303:19 + (i32.eq + (i32.load8_u + ;;@ ~lib/memory.ts:303:28 + (get_local $0) + ) + ;;@ ~lib/memory.ts:303:35 + (i32.load8_u + ;;@ ~lib/memory.ts:303:44 + (get_local $1) + ) + ) + (get_local $3) + ) + (block + ;;@ ~lib/memory.ts:304:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:304:9 + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:304:15 + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ;;@ ~lib/memory.ts:306:53 + (if (result i32) + ;;@ ~lib/memory.ts:306:9 + (get_local $2) + ;;@ ~lib/memory.ts:306:13 + (i32.sub + (i32.load8_u + ;;@ ~lib/memory.ts:306:27 + (get_local $0) + ) + ;;@ ~lib/memory.ts:306:33 + (i32.load8_u + ;;@ ~lib/memory.ts:306:47 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:306:53 + (i32.const 0) + ) + ) + (func $~lib/memory/memory.compare (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + ;;@ ~lib/memory.ts:21:27 + (call $~lib/memory/memcmp + ;;@ ~lib/memory.ts:21:18 + (get_local $0) + ;;@ ~lib/memory.ts:21:22 + (get_local $1) + ;;@ ~lib/memory.ts:21:26 + (get_local $2) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 7 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -27,7 +3052,6 @@ ;;@ ~lib/allocator/arena.ts:18:8 (i32.gt_u (get_local $0) - ;;@ ~lib/allocator/arena.ts:18:15 (i32.const 1073741824) ) ;;@ ~lib/allocator/arena.ts:18:28 @@ -52,7 +3076,6 @@ ;;@ ~lib/allocator/arena.ts:20:24 (get_local $0) ) - ;;@ ~lib/allocator/arena.ts:20:31 (i32.const 7) ) (i32.const -8) @@ -62,7 +3085,7 @@ (i32.shl ;;@ ~lib/allocator/arena.ts:21:4 (tee_local $2 - ;;@ ~lib/allocator/arena.ts:21:22 + ;;@ ~lib/allocator/arena.ts:21:29 (current_memory) ) ;;@ ~lib/allocator/arena.ts:22:39 @@ -73,6 +3096,7 @@ (if ;;@ ~lib/allocator/arena.ts:25:10 (i32.lt_s + ;;@ ~lib/allocator/arena.ts:25:17 (grow_memory ;;@ ~lib/allocator/arena.ts:24:24 (select @@ -115,6 +3139,7 @@ (if ;;@ ~lib/allocator/arena.ts:26:12 (i32.lt_s + ;;@ ~lib/allocator/arena.ts:26:19 (grow_memory ;;@ ~lib/allocator/arena.ts:26:24 (get_local $3) @@ -141,28 +3166,24 @@ ;;@ ~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 (; 8 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:37:45 + (call $~lib/allocator/arena/__memory_allocate + ;;@ ~lib/memory.ts:37:63 + (get_local $0) + ) + ) + (func $~lib/memory/memory.free (; 9 ;) (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 (; 10 ;) (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 (; 11 ;) (type $v) (set_global $~lib/allocator/arena/startOffset - ;;@ ~lib/allocator/arena.ts:12:25 - (i32.and - (i32.add - ;;@ ~lib/allocator/arena.ts:12:26 - (get_global $HEAP_BASE) - ;;@ ~lib/allocator/arena.ts:12:38 - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 8) ) (set_global $~lib/allocator/arena/offset ;;@ ~lib/allocator/arena.ts:13:20 diff --git a/tests/allocators/arena/untouched.wat b/tests/allocators/arena/untouched.wat index 069c399f..7f58e174 100644 --- a/tests/allocators/arena/untouched.wat +++ b/tests/allocators/arena/untouched.wat @@ -1,4 +1,6 @@ (module + (type $iiiv (func (param i32 i32 i32))) + (type $iiii (func (param i32 i32 i32) (result i32))) (type $ii (func (param i32) (result i32))) (type $iv (func (param i32))) (type $v (func)) @@ -10,12 +12,3337 @@ (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" (memory $0)) + (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)) (start $start) - (func $~lib/allocator/arena/allocate_memory (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memset (; 0 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i64) + ;;@ ~lib/memory.ts:244:2 + (if + ;;@ ~lib/memory.ts:244:6 + (i32.eqz + ;;@ ~lib/memory.ts:244:7 + (get_local $2) + ) + ;;@ ~lib/memory.ts:244:10 + (return) + ) + ;;@ ~lib/memory.ts:245:2 + (i32.store8 + ;;@ ~lib/memory.ts:245:12 + (get_local $0) + ;;@ ~lib/memory.ts:245:18 + (get_local $1) + ) + ;;@ ~lib/memory.ts:246:2 + (i32.store8 + ;;@ ~lib/memory.ts:246:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:246:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:246:23 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:246:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:247:2 + (if + ;;@ ~lib/memory.ts:247:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:247:11 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:247:14 + (return) + ) + ;;@ ~lib/memory.ts:249:2 + (i32.store8 + ;;@ ~lib/memory.ts:249:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:249:19 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:249:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:250:2 + (i32.store8 + ;;@ ~lib/memory.ts:250:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:250:19 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:250:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:251:2 + (i32.store8 + ;;@ ~lib/memory.ts:251:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:251:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:251:23 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:251:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:252:2 + (i32.store8 + ;;@ ~lib/memory.ts:252:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:252:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:252:23 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:252:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:253:2 + (if + ;;@ ~lib/memory.ts:253:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:253:11 + (i32.const 6) + ) + ;;@ ~lib/memory.ts:253:14 + (return) + ) + ;;@ ~lib/memory.ts:254:2 + (i32.store8 + ;;@ ~lib/memory.ts:254:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:254:19 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:254:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:255:2 + (i32.store8 + ;;@ ~lib/memory.ts:255:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:255:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:255:23 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:255:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:256:2 + (if + ;;@ ~lib/memory.ts:256:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:256:11 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:256:14 + (return) + ) + ;;@ ~lib/memory.ts:259:2 + (set_local $3 + ;;@ ~lib/memory.ts:259:17 + (i32.and + (i32.sub + (i32.const 0) + ;;@ ~lib/memory.ts:259:18 + (get_local $0) + ) + ;;@ ~lib/memory.ts:259:25 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:260:2 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:260:10 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:261:2 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:261:7 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:262:2 + (set_local $2 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:262:7 + (i32.const -4) + ) + ) + ;;@ ~lib/memory.ts:264:2 + (set_local $4 + ;;@ ~lib/memory.ts:264:17 + (i32.mul + (i32.div_u + (i32.const -1) + ;;@ ~lib/memory.ts:264:27 + (i32.const 255) + ) + (i32.and + ;;@ ~lib/memory.ts:264:33 + (get_local $1) + (i32.const 255) + ) + ) + ) + ;;@ ~lib/memory.ts:267:2 + (i32.store + ;;@ ~lib/memory.ts:267:13 + (get_local $0) + ;;@ ~lib/memory.ts:267:19 + (get_local $4) + ) + ;;@ ~lib/memory.ts:268:2 + (i32.store + ;;@ ~lib/memory.ts:268:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:268:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:268:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:268:27 + (get_local $4) + ) + ;;@ ~lib/memory.ts:269:2 + (if + ;;@ ~lib/memory.ts:269:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:269:11 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:269:14 + (return) + ) + ;;@ ~lib/memory.ts:270:2 + (i32.store + ;;@ ~lib/memory.ts:270:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:270:20 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:270:23 + (get_local $4) + ) + ;;@ ~lib/memory.ts:271:2 + (i32.store + ;;@ ~lib/memory.ts:271:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:271:20 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:271:23 + (get_local $4) + ) + ;;@ ~lib/memory.ts:272:2 + (i32.store + ;;@ ~lib/memory.ts:272:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:272:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:272:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:272:28 + (get_local $4) + ) + ;;@ ~lib/memory.ts:273:2 + (i32.store + ;;@ ~lib/memory.ts:273:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:273:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:273:24 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:273:27 + (get_local $4) + ) + ;;@ ~lib/memory.ts:274:2 + (if + ;;@ ~lib/memory.ts:274:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:274:11 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:274:15 + (return) + ) + ;;@ ~lib/memory.ts:275:2 + (i32.store + ;;@ ~lib/memory.ts:275:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:275:20 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:275:24 + (get_local $4) + ) + ;;@ ~lib/memory.ts:276:2 + (i32.store + ;;@ ~lib/memory.ts:276:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:276:20 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:276:24 + (get_local $4) + ) + ;;@ ~lib/memory.ts:277:2 + (i32.store + ;;@ ~lib/memory.ts:277:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:277:20 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:277:24 + (get_local $4) + ) + ;;@ ~lib/memory.ts:278:2 + (i32.store + ;;@ ~lib/memory.ts:278:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:278:20 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:278:24 + (get_local $4) + ) + ;;@ ~lib/memory.ts:279:2 + (i32.store + ;;@ ~lib/memory.ts:279:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:279:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:279:24 + (i32.const 28) + ) + ;;@ ~lib/memory.ts:279:28 + (get_local $4) + ) + ;;@ ~lib/memory.ts:280:2 + (i32.store + ;;@ ~lib/memory.ts:280:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:280:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:280:24 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:280:28 + (get_local $4) + ) + ;;@ ~lib/memory.ts:281:2 + (i32.store + ;;@ ~lib/memory.ts:281:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:281:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:281:24 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:281:28 + (get_local $4) + ) + ;;@ ~lib/memory.ts:282:2 + (i32.store + ;;@ ~lib/memory.ts:282:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:282:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:282:24 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:282:28 + (get_local $4) + ) + ;;@ ~lib/memory.ts:285:2 + (set_local $3 + ;;@ ~lib/memory.ts:285:6 + (i32.add + (i32.const 24) + ;;@ ~lib/memory.ts:285:11 + (i32.and + ;;@ ~lib/memory.ts:285:12 + (get_local $0) + ;;@ ~lib/memory.ts:285:19 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:286:2 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:286:10 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:287:2 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:287:7 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:290:2 + (set_local $5 + ;;@ ~lib/memory.ts:290:17 + (i64.or + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/memory.ts:290:28 + (i64.shl + ;;@ ~lib/memory.ts:290:29 + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/memory.ts:290:41 + (i64.const 32) + ) + ) + ) + ;;@ ~lib/memory.ts:291:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:291:9 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:291:14 + (i32.const 32) + ) + (block + (block + ;;@ ~lib/memory.ts:292:4 + (i64.store + ;;@ ~lib/memory.ts:292:15 + (get_local $0) + ;;@ ~lib/memory.ts:292:21 + (get_local $5) + ) + ;;@ ~lib/memory.ts:293:4 + (i64.store + ;;@ ~lib/memory.ts:293:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:293:22 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:293:25 + (get_local $5) + ) + ;;@ ~lib/memory.ts:294:4 + (i64.store + ;;@ ~lib/memory.ts:294:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:294:22 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:294:26 + (get_local $5) + ) + ;;@ ~lib/memory.ts:295:4 + (i64.store + ;;@ ~lib/memory.ts:295:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:295:22 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:295:26 + (get_local $5) + ) + ;;@ ~lib/memory.ts:296:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:296:9 + (i32.const 32) + ) + ) + ;;@ ~lib/memory.ts:297:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:297:12 + (i32.const 32) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.fill (; 1 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/memory.ts:11:4 + (call $~lib/memory/memset + ;;@ ~lib/memory.ts:11:11 + (get_local $0) + ;;@ ~lib/memory.ts:11:17 + (get_local $1) + ;;@ ~lib/memory.ts:11:20 + (get_local $2) + ) + ) + (func $~lib/memory/memcpy (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + ;;@ ~lib/memory.ts:59:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:59:9 + (if (result i32) + (get_local $2) + ;;@ ~lib/memory.ts:59:14 + (i32.and + ;;@ ~lib/memory.ts:59:15 + (get_local $1) + ;;@ ~lib/memory.ts:59:21 + (i32.const 3) + ) + (get_local $2) + ) + (block + (block + ;;@ ~lib/memory.ts:60:4 + (i32.store8 + ;;@ ~lib/memory.ts:60: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:60:22 + (i32.load8_u + ;;@ ~lib/memory.ts:60: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:61:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:65:2 + (if + ;;@ ~lib/memory.ts:65:6 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:65:7 + (get_local $0) + ;;@ ~lib/memory.ts:65:14 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:65:20 + (i32.const 0) + ) + ;;@ ~lib/memory.ts:65:23 + (block + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:66:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:66:16 + (i32.const 16) + ) + (block + (block + ;;@ ~lib/memory.ts:67:6 + (i32.store + ;;@ ~lib/memory.ts:67:17 + (get_local $0) + ;;@ ~lib/memory.ts:67:28 + (i32.load + ;;@ ~lib/memory.ts:67:38 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:68:6 + (i32.store + ;;@ ~lib/memory.ts:68:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:68:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:68:28 + (i32.load + ;;@ ~lib/memory.ts:68:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:68:45 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:69:6 + (i32.store + ;;@ ~lib/memory.ts:69:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:69:25 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:69:28 + (i32.load + ;;@ ~lib/memory.ts:69:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:69:45 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:70:6 + (i32.store + ;;@ ~lib/memory.ts:70:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:70:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:70:28 + (i32.load + ;;@ ~lib/memory.ts:70:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:70:44 + (i32.const 12) + ) + ) + ) + ;;@ ~lib/memory.ts:71:6 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:71:13 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:71:17 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:71:25 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:71:29 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:71:34 + (i32.const 16) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:73:4 + (if + ;;@ ~lib/memory.ts:73:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:73:12 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:73:15 + (block + ;;@ ~lib/memory.ts:74:6 + (i32.store + ;;@ ~lib/memory.ts:74:17 + (get_local $0) + ;;@ ~lib/memory.ts:74:27 + (i32.load + ;;@ ~lib/memory.ts:74:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:75:6 + (i32.store + ;;@ ~lib/memory.ts:75:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:75:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:75:27 + (i32.load + ;;@ ~lib/memory.ts:75:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:75:43 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:76:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:76:14 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:76:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:76:24 + (i32.const 8) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:78:4 + (if + ;;@ ~lib/memory.ts:78:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:78:12 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:78:15 + (block + ;;@ ~lib/memory.ts:79:6 + (i32.store + ;;@ ~lib/memory.ts:79:17 + (get_local $0) + ;;@ ~lib/memory.ts:79:23 + (i32.load + ;;@ ~lib/memory.ts:79:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:80:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:80:14 + (i32.const 4) + ) + ) + ;;@ ~lib/memory.ts:80:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:80:24 + (i32.const 4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:82:4 + (if + ;;@ ~lib/memory.ts:82:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:82:12 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:82:15 + (block + ;;@ ~lib/memory.ts:83:6 + (i32.store16 + ;;@ ~lib/memory.ts:83:17 + (get_local $0) + ;;@ ~lib/memory.ts:83:23 + (i32.load16_u + ;;@ ~lib/memory.ts:83:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:84:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:84:14 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:84:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:84:24 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:86:4 + (if + ;;@ ~lib/memory.ts:86:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:86:12 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:86:15 + (i32.store8 + ;;@ ~lib/memory.ts:87: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:87:24 + (i32.load8_u + ;;@ ~lib/memory.ts:87: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:89:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:94:2 + (if + ;;@ ~lib/memory.ts:94:6 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:94:11 + (i32.const 32) + ) + ;;@ ~lib/memory.ts:94:15 + (block $break|2 + (block $case2|2 + (block $case1|2 + (block $case0|2 + (set_local $5 + ;;@ ~lib/memory.ts:95:12 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:95:19 + (i32.const 3) + ) + ) + (br_if $case0|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:97:11 + (i32.const 1) + ) + ) + (br_if $case1|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:116:11 + (i32.const 2) + ) + ) + (br_if $case2|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:134:11 + (i32.const 3) + ) + ) + (br $break|2) + ) + ;;@ ~lib/memory.ts:97:14 + (block + ;;@ ~lib/memory.ts:98:8 + (set_local $3 + ;;@ ~lib/memory.ts:98:12 + (i32.load + ;;@ ~lib/memory.ts:98:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:99:8 + (i32.store8 + ;;@ ~lib/memory.ts:99: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:99:26 + (i32.load8_u + ;;@ ~lib/memory.ts:99: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:100:8 + (i32.store8 + ;;@ ~lib/memory.ts:100: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:100:26 + (i32.load8_u + ;;@ ~lib/memory.ts:100: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:101:8 + (i32.store8 + ;;@ ~lib/memory.ts:101: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:101:26 + (i32.load8_u + ;;@ ~lib/memory.ts:101: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:102:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:102:13 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:103:8 + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:103:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:103:20 + (i32.const 17) + ) + (block + (block + ;;@ ~lib/memory.ts:104:10 + (set_local $4 + ;;@ ~lib/memory.ts:104:14 + (i32.load + ;;@ ~lib/memory.ts:104:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:104:30 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:105:10 + (i32.store + ;;@ ~lib/memory.ts:105:21 + (get_local $0) + ;;@ ~lib/memory.ts:105:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:105:32 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:105:37 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:105:42 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:106:10 + (set_local $3 + ;;@ ~lib/memory.ts:106:14 + (i32.load + ;;@ ~lib/memory.ts:106:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:106:30 + (i32.const 5) + ) + ) + ) + ;;@ ~lib/memory.ts:107:10 + (i32.store + ;;@ ~lib/memory.ts:107:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:107:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:107:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:107:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:107:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:107:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:108:10 + (set_local $4 + ;;@ ~lib/memory.ts:108:14 + (i32.load + ;;@ ~lib/memory.ts:108:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:108:30 + (i32.const 9) + ) + ) + ) + ;;@ ~lib/memory.ts:109:10 + (i32.store + ;;@ ~lib/memory.ts:109:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:109:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:109:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:109:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:109:41 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:109:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:110:10 + (set_local $3 + ;;@ ~lib/memory.ts:110:14 + (i32.load + ;;@ ~lib/memory.ts:110:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:110:30 + (i32.const 13) + ) + ) + ) + ;;@ ~lib/memory.ts:111:10 + (i32.store + ;;@ ~lib/memory.ts:111:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:111:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:111:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:111:37 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:111:42 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:111:47 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:112:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:112:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:112:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:112:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:112:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:112:38 + (i32.const 16) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:114:8 + (br $break|2) + ) + ) + ;;@ ~lib/memory.ts:116:14 + (block + ;;@ ~lib/memory.ts:117:8 + (set_local $3 + ;;@ ~lib/memory.ts:117:12 + (i32.load + ;;@ ~lib/memory.ts:117:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:118:8 + (i32.store8 + ;;@ ~lib/memory.ts:118: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:118:26 + (i32.load8_u + ;;@ ~lib/memory.ts:118: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:119:8 + (i32.store8 + ;;@ ~lib/memory.ts:119: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:119:26 + (i32.load8_u + ;;@ ~lib/memory.ts:119: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:120:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:120:13 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:121:8 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:121:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:121:20 + (i32.const 18) + ) + (block + (block + ;;@ ~lib/memory.ts:122:10 + (set_local $4 + ;;@ ~lib/memory.ts:122:14 + (i32.load + ;;@ ~lib/memory.ts:122:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:122:30 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/memory.ts:123:10 + (i32.store + ;;@ ~lib/memory.ts:123:21 + (get_local $0) + ;;@ ~lib/memory.ts:123:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:123:32 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:123:37 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:123:42 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:124:10 + (set_local $3 + ;;@ ~lib/memory.ts:124:14 + (i32.load + ;;@ ~lib/memory.ts:124:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:124:30 + (i32.const 6) + ) + ) + ) + ;;@ ~lib/memory.ts:125:10 + (i32.store + ;;@ ~lib/memory.ts:125:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:125:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:125:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:125:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:125:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:125:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:126:10 + (set_local $4 + ;;@ ~lib/memory.ts:126:14 + (i32.load + ;;@ ~lib/memory.ts:126:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:126:30 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/memory.ts:127:10 + (i32.store + ;;@ ~lib/memory.ts:127:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:127:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:127:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:127:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:127:41 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:127:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:128:10 + (set_local $3 + ;;@ ~lib/memory.ts:128:14 + (i32.load + ;;@ ~lib/memory.ts:128:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:128:30 + (i32.const 14) + ) + ) + ) + ;;@ ~lib/memory.ts:129:10 + (i32.store + ;;@ ~lib/memory.ts:129:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:129:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:129:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:129:37 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:129:42 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:129:47 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:130:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:130:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:130:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:130:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:130:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:130:38 + (i32.const 16) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:132:8 + (br $break|2) + ) + ) + ;;@ ~lib/memory.ts:134:14 + (block + ;;@ ~lib/memory.ts:135:8 + (set_local $3 + ;;@ ~lib/memory.ts:135:12 + (i32.load + ;;@ ~lib/memory.ts:135:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:136:8 + (i32.store8 + ;;@ ~lib/memory.ts:136: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:136:26 + (i32.load8_u + ;;@ ~lib/memory.ts:136: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:137:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:137:13 + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:138:8 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:138:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:138:20 + (i32.const 19) + ) + (block + (block + ;;@ ~lib/memory.ts:139:10 + (set_local $4 + ;;@ ~lib/memory.ts:139:14 + (i32.load + ;;@ ~lib/memory.ts:139:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:139:30 + (i32.const 3) + ) + ) + ) + ;;@ ~lib/memory.ts:140:10 + (i32.store + ;;@ ~lib/memory.ts:140:21 + (get_local $0) + ;;@ ~lib/memory.ts:140:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:140:32 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:140:36 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:140:41 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:141:10 + (set_local $3 + ;;@ ~lib/memory.ts:141:14 + (i32.load + ;;@ ~lib/memory.ts:141:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:141:30 + (i32.const 7) + ) + ) + ) + ;;@ ~lib/memory.ts:142:10 + (i32.store + ;;@ ~lib/memory.ts:142:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:142:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:142:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:142:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:142:40 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:142:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:143:10 + (set_local $4 + ;;@ ~lib/memory.ts:143:14 + (i32.load + ;;@ ~lib/memory.ts:143:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:143:30 + (i32.const 11) + ) + ) + ) + ;;@ ~lib/memory.ts:144:10 + (i32.store + ;;@ ~lib/memory.ts:144:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:144:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:144:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:144:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:144:40 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:144:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:145:10 + (set_local $3 + ;;@ ~lib/memory.ts:145:14 + (i32.load + ;;@ ~lib/memory.ts:145:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:145:30 + (i32.const 15) + ) + ) + ) + ;;@ ~lib/memory.ts:146:10 + (i32.store + ;;@ ~lib/memory.ts:146:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:146:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:146:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:146:37 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:146:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:146:46 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:147:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:147:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:147:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:147:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:147:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:147:38 + (i32.const 16) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:149:8 + (br $break|2) + ) + ) + ) + ;;@ ~lib/memory.ts:155:2 + (if + ;;@ ~lib/memory.ts:155:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:155:10 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:155:14 + (block + ;;@ ~lib/memory.ts:156:4 + (i32.store8 + ;;@ ~lib/memory.ts:156: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:156:22 + (i32.load8_u + ;;@ ~lib/memory.ts:156: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:157:4 + (i32.store8 + ;;@ ~lib/memory.ts:157: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:157:22 + (i32.load8_u + ;;@ ~lib/memory.ts:157: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:158:4 + (i32.store8 + ;;@ ~lib/memory.ts:158: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:158:22 + (i32.load8_u + ;;@ ~lib/memory.ts:158: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:159:4 + (i32.store8 + ;;@ ~lib/memory.ts:159: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:159:22 + (i32.load8_u + ;;@ ~lib/memory.ts:159: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:160:4 + (i32.store8 + ;;@ ~lib/memory.ts:160: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:160:22 + (i32.load8_u + ;;@ ~lib/memory.ts:160: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:161:4 + (i32.store8 + ;;@ ~lib/memory.ts:161: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:161:22 + (i32.load8_u + ;;@ ~lib/memory.ts:161: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:162:4 + (i32.store8 + ;;@ ~lib/memory.ts:162: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:162:22 + (i32.load8_u + ;;@ ~lib/memory.ts:162: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:163:4 + (i32.store8 + ;;@ ~lib/memory.ts:163: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:163:22 + (i32.load8_u + ;;@ ~lib/memory.ts:163: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:164:4 + (i32.store8 + ;;@ ~lib/memory.ts:164: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:164:22 + (i32.load8_u + ;;@ ~lib/memory.ts:164: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: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 + (i32.store8 + ;;@ ~lib/memory.ts:166: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:166:22 + (i32.load8_u + ;;@ ~lib/memory.ts:166: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:167:4 + (i32.store8 + ;;@ ~lib/memory.ts:167: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:167:22 + (i32.load8_u + ;;@ ~lib/memory.ts:167: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:168:4 + (i32.store8 + ;;@ ~lib/memory.ts:168: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:168:22 + (i32.load8_u + ;;@ ~lib/memory.ts:168: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:169:4 + (i32.store8 + ;;@ ~lib/memory.ts:169: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:169:22 + (i32.load8_u + ;;@ ~lib/memory.ts:169: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:170:4 + (i32.store8 + ;;@ ~lib/memory.ts:170: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:170:22 + (i32.load8_u + ;;@ ~lib/memory.ts:170: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:171:4 + (i32.store8 + ;;@ ~lib/memory.ts:171: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:171:22 + (i32.load8_u + ;;@ ~lib/memory.ts:171: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:173:2 + (if + ;;@ ~lib/memory.ts:173:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:173:10 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:173:13 + (block + ;;@ ~lib/memory.ts:174:4 + (i32.store8 + ;;@ ~lib/memory.ts:174: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:174:22 + (i32.load8_u + ;;@ ~lib/memory.ts:174: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:175:4 + (i32.store8 + ;;@ ~lib/memory.ts:175: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:175:22 + (i32.load8_u + ;;@ ~lib/memory.ts:175: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:176:4 + (i32.store8 + ;;@ ~lib/memory.ts:176: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:176:22 + (i32.load8_u + ;;@ ~lib/memory.ts:176: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:177:4 + (i32.store8 + ;;@ ~lib/memory.ts:177: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:177:22 + (i32.load8_u + ;;@ ~lib/memory.ts:177: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:178:4 + (i32.store8 + ;;@ ~lib/memory.ts:178: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:178:22 + (i32.load8_u + ;;@ ~lib/memory.ts:178: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:179:4 + (i32.store8 + ;;@ ~lib/memory.ts:179: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:179:22 + (i32.load8_u + ;;@ ~lib/memory.ts:179: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:180:4 + (i32.store8 + ;;@ ~lib/memory.ts:180: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:180:22 + (i32.load8_u + ;;@ ~lib/memory.ts:180: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:181:4 + (i32.store8 + ;;@ ~lib/memory.ts:181: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:181:22 + (i32.load8_u + ;;@ ~lib/memory.ts:181: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:183:2 + (if + ;;@ ~lib/memory.ts:183:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:183:10 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:183:13 + (block + ;;@ ~lib/memory.ts:184:4 + (i32.store8 + ;;@ ~lib/memory.ts:184: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:184:22 + (i32.load8_u + ;;@ ~lib/memory.ts:184: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:185:4 + (i32.store8 + ;;@ ~lib/memory.ts:185: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:185:22 + (i32.load8_u + ;;@ ~lib/memory.ts:185: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:186:4 + (i32.store8 + ;;@ ~lib/memory.ts:186: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:186:22 + (i32.load8_u + ;;@ ~lib/memory.ts:186: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:187:4 + (i32.store8 + ;;@ ~lib/memory.ts:187: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:187:22 + (i32.load8_u + ;;@ ~lib/memory.ts:187: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:189:2 + (if + ;;@ ~lib/memory.ts:189:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:189:10 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:189:13 + (block + ;;@ ~lib/memory.ts:190:4 + (i32.store8 + ;;@ ~lib/memory.ts:190: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:190:22 + (i32.load8_u + ;;@ ~lib/memory.ts:190: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:191:4 + (i32.store8 + ;;@ ~lib/memory.ts:191: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:191:22 + (i32.load8_u + ;;@ ~lib/memory.ts:191: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:193:2 + (if + ;;@ ~lib/memory.ts:193:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:193:10 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:193:13 + (i32.store8 + ;;@ ~lib/memory.ts:194: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:194:22 + (i32.load8_u + ;;@ ~lib/memory.ts:194: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/memmove (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + ;;@ ~lib/memory.ts:200:2 + (if + ;;@ ~lib/memory.ts:200:6 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:200:14 + (get_local $1) + ) + ;;@ ~lib/memory.ts:200:19 + (return) + ) + ;;@ ~lib/memory.ts:201:2 + (if + ;;@ ~lib/memory.ts:201:6 + (if (result i32) + (tee_local $3 + (i32.le_u + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:201:12 + (get_local $2) + ) + ;;@ ~lib/memory.ts:201:17 + (get_local $0) + ) + ) + (get_local $3) + ;;@ ~lib/memory.ts:201:25 + (i32.le_u + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:201:32 + (get_local $2) + ) + ;;@ ~lib/memory.ts:201:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:201:42 + (block + ;;@ ~lib/memory.ts:202:4 + (call $~lib/memory/memcpy + ;;@ ~lib/memory.ts:202:11 + (get_local $0) + ;;@ ~lib/memory.ts:202:17 + (get_local $1) + ;;@ ~lib/memory.ts:202:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:203:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:205:2 + (if + ;;@ ~lib/memory.ts:205:6 + (i32.lt_u + (get_local $0) + ;;@ ~lib/memory.ts:205:13 + (get_local $1) + ) + ;;@ ~lib/memory.ts:205:18 + (block + ;;@ ~lib/memory.ts:206:4 + (if + ;;@ ~lib/memory.ts:206:8 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:206:9 + (get_local $1) + ;;@ ~lib/memory.ts:206:15 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:206:21 + (i32.and + ;;@ ~lib/memory.ts:206:22 + (get_local $0) + ;;@ ~lib/memory.ts:206:29 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:206:33 + (block + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:207:13 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:207:20 + (i32.const 7) + ) + (block + (block + ;;@ ~lib/memory.ts:208:8 + (if + ;;@ ~lib/memory.ts:208:12 + (i32.eqz + ;;@ ~lib/memory.ts:208:13 + (get_local $2) + ) + ;;@ ~lib/memory.ts:208:16 + (return) + ) + ;;@ ~lib/memory.ts:209:8 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:209:10 + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:210:8 + (i32.store8 + ;;@ ~lib/memory.ts:210: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:210:26 + (i32.load8_u + ;;@ ~lib/memory.ts:210:35 + (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:212:6 + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:212:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:212:18 + (i32.const 8) + ) + (block + (block + ;;@ ~lib/memory.ts:213:8 + (i64.store + ;;@ ~lib/memory.ts:213:19 + (get_local $0) + ;;@ ~lib/memory.ts:213:25 + (i64.load + ;;@ ~lib/memory.ts:213:35 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:214:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:214:16 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:215:8 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:215:16 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:216:8 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:216:16 + (i32.const 8) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:219:4 + (block $break|2 + (loop $continue|2 + (if + ;;@ ~lib/memory.ts:219:11 + (get_local $2) + (block + (block + ;;@ ~lib/memory.ts:220:6 + (i32.store8 + ;;@ ~lib/memory.ts:220:16 + (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:220:24 + (i32.load8_u + ;;@ ~lib/memory.ts:220:33 + (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:221:6 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:221:8 + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|2) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:223:9 + (block + ;;@ ~lib/memory.ts:224:4 + (if + ;;@ ~lib/memory.ts:224:8 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:224:9 + (get_local $1) + ;;@ ~lib/memory.ts:224:15 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:224:21 + (i32.and + ;;@ ~lib/memory.ts:224:22 + (get_local $0) + ;;@ ~lib/memory.ts:224:29 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:224:33 + (block + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:225:13 + (i32.and + (i32.add + ;;@ ~lib/memory.ts:225:14 + (get_local $0) + ;;@ ~lib/memory.ts:225:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:225:26 + (i32.const 7) + ) + (block + (block + ;;@ ~lib/memory.ts:226:8 + (if + ;;@ ~lib/memory.ts:226:12 + (i32.eqz + ;;@ ~lib/memory.ts:226:13 + (get_local $2) + ) + ;;@ ~lib/memory.ts:226:16 + (return) + ) + ;;@ ~lib/memory.ts:227:8 + (i32.store8 + ;;@ ~lib/memory.ts:227:18 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:227:25 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:227:27 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:227:30 + (i32.load8_u + ;;@ ~lib/memory.ts:227:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:227:45 + (get_local $2) + ) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:229:6 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:229:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:229:18 + (i32.const 8) + ) + (block + (block + ;;@ ~lib/memory.ts:230:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:230:13 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:231:8 + (i64.store + ;;@ ~lib/memory.ts:231:19 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:231:26 + (get_local $2) + ) + ;;@ ~lib/memory.ts:231:29 + (i64.load + ;;@ ~lib/memory.ts:231:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:231:45 + (get_local $2) + ) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:234:4 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:234:11 + (get_local $2) + (block + ;;@ ~lib/memory.ts:234:14 + (i32.store8 + ;;@ ~lib/memory.ts:235:16 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:235:23 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:235:25 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:235:28 + (i32.load8_u + ;;@ ~lib/memory.ts:235:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:235:43 + (get_local $2) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.copy (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/memory.ts:16:4 + (call $~lib/memory/memmove + ;;@ ~lib/memory.ts:16:12 + (get_local $0) + ;;@ ~lib/memory.ts:16:18 + (get_local $1) + ;;@ ~lib/memory.ts:16:23 + (get_local $2) + ) + ) + (func $~lib/memory/memcmp (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + ;;@ ~lib/memory.ts:302:2 + (if + ;;@ ~lib/memory.ts:302:6 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:302:12 + (get_local $1) + ) + ;;@ ~lib/memory.ts:302:23 + (return + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:303:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:303:9 + (if (result i32) + (tee_local $3 + (i32.ne + (get_local $2) + ;;@ ~lib/memory.ts:303:14 + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:303:19 + (i32.eq + (i32.load8_u + ;;@ ~lib/memory.ts:303:28 + (get_local $0) + ) + ;;@ ~lib/memory.ts:303:35 + (i32.load8_u + ;;@ ~lib/memory.ts:303:44 + (get_local $1) + ) + ) + (get_local $3) + ) + (block + (block + ;;@ ~lib/memory.ts:304:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:304:9 + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:304:15 + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:306:53 + (if (result i32) + ;;@ ~lib/memory.ts:306:9 + (get_local $2) + ;;@ ~lib/memory.ts:306:13 + (i32.sub + (i32.load8_u + ;;@ ~lib/memory.ts:306:27 + (get_local $0) + ) + ;;@ ~lib/memory.ts:306:33 + (i32.load8_u + ;;@ ~lib/memory.ts:306:47 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:306:53 + (i32.const 0) + ) + ) + (func $~lib/memory/memory.compare (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + ;;@ ~lib/memory.ts:21:27 + (call $~lib/memory/memcmp + ;;@ ~lib/memory.ts:21:18 + (get_local $0) + ;;@ ~lib/memory.ts:21:22 + (get_local $1) + ;;@ ~lib/memory.ts:21:26 + (get_local $2) + ) + ) + (func $~lib/allocator/arena/__memory_allocate (; 7 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -34,7 +3361,7 @@ (i32.gt_u (get_local $0) ;;@ ~lib/allocator/arena.ts:18:15 - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) ;;@ ~lib/allocator/arena.ts:18:28 (unreachable) @@ -56,19 +3383,19 @@ (get_local $0) ) ;;@ ~lib/allocator/arena.ts:20:31 - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) ;;@ ~lib/allocator/arena.ts:20:42 (i32.xor ;;@ ~lib/allocator/arena.ts:20:43 - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) ;;@ ~lib/allocator/arena.ts:21:4 (set_local $3 - ;;@ ~lib/allocator/arena.ts:21:22 + ;;@ ~lib/allocator/arena.ts:21:29 (current_memory) ) ;;@ ~lib/allocator/arena.ts:22:4 @@ -134,6 +3461,7 @@ (if ;;@ ~lib/allocator/arena.ts:25:10 (i32.lt_s + ;;@ ~lib/allocator/arena.ts:25:17 (grow_memory ;;@ ~lib/allocator/arena.ts:25:22 (get_local $5) @@ -145,6 +3473,7 @@ (if ;;@ ~lib/allocator/arena.ts:26:12 (i32.lt_s + ;;@ ~lib/allocator/arena.ts:26:19 (grow_memory ;;@ ~lib/allocator/arena.ts:26:24 (get_local $4) @@ -172,17 +3501,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 (; 8 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:37:4 + (return + ;;@ ~lib/memory.ts:37:45 + (call $~lib/allocator/arena/__memory_allocate + ;;@ ~lib/memory.ts:37:63 + (get_local $0) + ) + ) + ) + (func $~lib/allocator/arena/__memory_free (; 9 ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/allocator/arena/reset_memory (; 2 ;) (type $v) + (func $~lib/memory/memory.free (; 10 ;) (type $iv) (param $0 i32) + ;;@ ~lib/memory.ts:43:36 + (call $~lib/allocator/arena/__memory_free + ;;@ ~lib/memory.ts:43:50 + (get_local $0) + ) + ;;@ ~lib/memory.ts:43:56 + (return) + ) + (func $~lib/allocator/arena/__memory_reset (; 11 ;) (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 (; 12 ;) (type $v) + ;;@ ~lib/memory.ts:49:37 + (call $~lib/allocator/arena/__memory_reset) + ;;@ ~lib/memory.ts:49:55 + (return) + ) + (func $start (; 13 ;) (type $v) (set_global $~lib/allocator/arena/startOffset ;;@ ~lib/allocator/arena.ts:12:25 (i32.and @@ -190,12 +3544,12 @@ ;;@ ~lib/allocator/arena.ts:12:26 (get_global $HEAP_BASE) ;;@ ~lib/allocator/arena.ts:12:38 - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) ;;@ ~lib/allocator/arena.ts:12:49 (i32.xor ;;@ ~lib/allocator/arena.ts:12:50 - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) 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..1256781b 100644 --- a/tests/allocators/buddy/optimized.wat +++ b/tests/allocators/buddy/optimized.wat @@ -1,4 +1,6 @@ (module + (type $iiiv (func (param i32 i32 i32))) + (type $iiii (func (param i32 i32 i32) (result i32))) (type $ii (func (param i32) (result i32))) (type $iv (func (param i32))) (type $iiv (func (param i32 i32))) @@ -11,13 +13,3037 @@ (global $~lib/allocator/buddy/NODE_IS_SPLIT_END (mut i32) (i32.const 0)) (global $~lib/allocator/buddy/base_ptr (mut i32) (i32.const 0)) (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" (memory $0)) + (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)) (start $start) - (func $~lib/allocator/buddy/update_max_ptr (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memset (; 0 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i64) + (local $4 i32) + ;;@ ~lib/memory.ts:244:2 + (if + ;;@ ~lib/memory.ts:244:6 + (i32.eqz + ;;@ ~lib/memory.ts:244:7 + (get_local $2) + ) + ;;@ ~lib/memory.ts:244:10 + (return) + ) + ;;@ ~lib/memory.ts:245:2 + (i32.store8 + ;;@ ~lib/memory.ts:245:12 + (get_local $0) + ;;@ ~lib/memory.ts:245:18 + (get_local $1) + ) + ;;@ ~lib/memory.ts:246:2 + (i32.store8 + ;;@ ~lib/memory.ts:246:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:246:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:246:23 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:246:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:247:2 + (if + ;;@ ~lib/memory.ts:247:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:247:11 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:247:14 + (return) + ) + ;;@ ~lib/memory.ts:249:2 + (i32.store8 + ;;@ ~lib/memory.ts:249:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:249:19 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:249:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:250:2 + (i32.store8 + ;;@ ~lib/memory.ts:250:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:250:19 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:250:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:251:2 + (i32.store8 + ;;@ ~lib/memory.ts:251:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:251:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:251:23 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:251:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:252:2 + (i32.store8 + ;;@ ~lib/memory.ts:252:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:252:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:252:23 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:252:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:253:2 + (if + ;;@ ~lib/memory.ts:253:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:253:11 + (i32.const 6) + ) + ;;@ ~lib/memory.ts:253:14 + (return) + ) + ;;@ ~lib/memory.ts:254:2 + (i32.store8 + ;;@ ~lib/memory.ts:254:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:254:19 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:254:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:255:2 + (i32.store8 + ;;@ ~lib/memory.ts:255:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:255:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:255:23 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:255:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:256:2 + (if + ;;@ ~lib/memory.ts:256:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:256:11 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:256:14 + (return) + ) + ;;@ ~lib/memory.ts:267:2 + (i32.store + ;;@ ~lib/memory.ts:260:2 + (tee_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:259:2 + (tee_local $4 + ;;@ ~lib/memory.ts:259:17 + (i32.and + (i32.sub + (i32.const 0) + ;;@ ~lib/memory.ts:259:18 + (get_local $0) + ) + ;;@ ~lib/memory.ts:259:25 + (i32.const 3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:264:2 + (tee_local $1 + ;;@ ~lib/memory.ts:264:17 + (i32.mul + (i32.and + ;;@ ~lib/memory.ts:264:33 + (get_local $1) + (i32.const 255) + ) + (i32.const 16843009) + ) + ) + ) + ;;@ ~lib/memory.ts:268:2 + (i32.store + ;;@ ~lib/memory.ts:268:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:262:2 + (tee_local $2 + (i32.and + (i32.sub + ;;@ ~lib/memory.ts:261:2 + (get_local $2) + ;;@ ~lib/memory.ts:261:7 + (get_local $4) + ) + ;;@ ~lib/memory.ts:262:7 + (i32.const -4) + ) + ) + ) + ;;@ ~lib/memory.ts:268:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:268:27 + (get_local $1) + ) + ;;@ ~lib/memory.ts:269:2 + (if + ;;@ ~lib/memory.ts:269:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:269:11 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:269:14 + (return) + ) + ;;@ ~lib/memory.ts:270:2 + (i32.store + ;;@ ~lib/memory.ts:270:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:270:20 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:270:23 + (get_local $1) + ) + ;;@ ~lib/memory.ts:271:2 + (i32.store + ;;@ ~lib/memory.ts:271:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:271:20 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:271:23 + (get_local $1) + ) + ;;@ ~lib/memory.ts:272:2 + (i32.store + ;;@ ~lib/memory.ts:272:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:272:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:272:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:272:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:273:2 + (i32.store + ;;@ ~lib/memory.ts:273:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:273:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:273:24 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:273:27 + (get_local $1) + ) + ;;@ ~lib/memory.ts:274:2 + (if + ;;@ ~lib/memory.ts:274:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:274:11 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:274:15 + (return) + ) + ;;@ ~lib/memory.ts:275:2 + (i32.store + ;;@ ~lib/memory.ts:275:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:275:20 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:275:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:276:2 + (i32.store + ;;@ ~lib/memory.ts:276:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:276:20 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:276:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:277:2 + (i32.store + ;;@ ~lib/memory.ts:277:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:277:20 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:277:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:278:2 + (i32.store + ;;@ ~lib/memory.ts:278:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:278:20 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:278:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:279:2 + (i32.store + ;;@ ~lib/memory.ts:279:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:279:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:279:24 + (i32.const 28) + ) + ;;@ ~lib/memory.ts:279:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:280:2 + (i32.store + ;;@ ~lib/memory.ts:280:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:280:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:280:24 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:280:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:281:2 + (i32.store + ;;@ ~lib/memory.ts:281:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:281:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:281:24 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:281:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:282:2 + (i32.store + ;;@ ~lib/memory.ts:282:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:282:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:282:24 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:282:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:286:2 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:285:2 + (tee_local $4 + ;;@ ~lib/memory.ts:285:6 + (i32.add + ;;@ ~lib/memory.ts:285:11 + (i32.and + ;;@ ~lib/memory.ts:285:12 + (get_local $0) + ;;@ ~lib/memory.ts:285:19 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:285:6 + (i32.const 24) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:287:2 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:287:7 + (get_local $4) + ) + ) + ;;@ ~lib/memory.ts:290:2 + (set_local $3 + ;;@ ~lib/memory.ts:290:17 + (i64.or + (i64.extend_u/i32 + (get_local $1) + ) + ;;@ ~lib/memory.ts:290:28 + (i64.shl + ;;@ ~lib/memory.ts:290:29 + (i64.extend_u/i32 + (get_local $1) + ) + ;;@ ~lib/memory.ts:290:41 + (i64.const 32) + ) + ) + ) + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:291:9 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:291:14 + (i32.const 32) + ) + (block + ;;@ ~lib/memory.ts:292:4 + (i64.store + ;;@ ~lib/memory.ts:292:15 + (get_local $0) + ;;@ ~lib/memory.ts:292:21 + (get_local $3) + ) + ;;@ ~lib/memory.ts:293:4 + (i64.store + ;;@ ~lib/memory.ts:293:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:293:22 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:293:25 + (get_local $3) + ) + ;;@ ~lib/memory.ts:294:4 + (i64.store + ;;@ ~lib/memory.ts:294:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:294:22 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:294:26 + (get_local $3) + ) + ;;@ ~lib/memory.ts:295:4 + (i64.store + ;;@ ~lib/memory.ts:295:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:295:22 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:295:26 + (get_local $3) + ) + ;;@ ~lib/memory.ts:296:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:296:9 + (i32.const 32) + ) + ) + ;;@ ~lib/memory.ts:297:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:297:12 + (i32.const 32) + ) + ) + (br $continue|0) + ) + ) + ) + ) + (func $~lib/memory/memory.fill (; 1 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/memory.ts:11:4 + (call $~lib/memory/memset + ;;@ ~lib/memory.ts:11:11 + (get_local $0) + ;;@ ~lib/memory.ts:11:17 + (get_local $1) + ;;@ ~lib/memory.ts:11:20 + (get_local $2) + ) + ) + (func $~lib/memory/memcpy (; 2 ;) (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:59:14 + (i32.and + ;;@ ~lib/memory.ts:59:15 + (get_local $1) + ;;@ ~lib/memory.ts:59:21 + (i32.const 3) + ) + (get_local $2) + ;;@ ~lib/memory.ts:59:9 + (get_local $2) + ) + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:60:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:60:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:60:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:60:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:61:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ;;@ ~lib/memory.ts:65:2 + (if + (i32.eqz + ;;@ ~lib/memory.ts:65:6 + (i32.and + ;;@ ~lib/memory.ts:65:7 + (get_local $0) + ;;@ ~lib/memory.ts:65:14 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:65:23 + (block + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:66:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:66:16 + (i32.const 16) + ) + (block + ;;@ ~lib/memory.ts:67:6 + (i32.store + ;;@ ~lib/memory.ts:67:17 + (get_local $0) + ;;@ ~lib/memory.ts:67:28 + (i32.load + ;;@ ~lib/memory.ts:67:38 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:68:6 + (i32.store + ;;@ ~lib/memory.ts:68:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:68:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:68:28 + (i32.load + ;;@ ~lib/memory.ts:68:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:68:45 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:69:6 + (i32.store + ;;@ ~lib/memory.ts:69:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:69:25 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:69:28 + (i32.load + ;;@ ~lib/memory.ts:69:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:69:45 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:70:6 + (i32.store + ;;@ ~lib/memory.ts:70:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:70:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:70:28 + (i32.load + ;;@ ~lib/memory.ts:70:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:70:44 + (i32.const 12) + ) + ) + ) + ;;@ ~lib/memory.ts:71:6 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:71:13 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:71:17 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:71:25 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:71:29 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:71:34 + (i32.const 16) + ) + ) + (br $continue|1) + ) + ) + ) + ;;@ ~lib/memory.ts:73:4 + (if + ;;@ ~lib/memory.ts:73:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:73:12 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:73:15 + (block + ;;@ ~lib/memory.ts:74:6 + (i32.store + ;;@ ~lib/memory.ts:74:17 + (get_local $0) + ;;@ ~lib/memory.ts:74:27 + (i32.load + ;;@ ~lib/memory.ts:74:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:75:6 + (i32.store + ;;@ ~lib/memory.ts:75:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:75:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:75:27 + (i32.load + ;;@ ~lib/memory.ts:75:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:75:43 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:76:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:76:14 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:76:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:76:24 + (i32.const 8) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:78:4 + (if + ;;@ ~lib/memory.ts:78:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:78:12 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:78:15 + (block + ;;@ ~lib/memory.ts:79:6 + (i32.store + ;;@ ~lib/memory.ts:79:17 + (get_local $0) + ;;@ ~lib/memory.ts:79:23 + (i32.load + ;;@ ~lib/memory.ts:79:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:80:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:80:14 + (i32.const 4) + ) + ) + ;;@ ~lib/memory.ts:80:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:80:24 + (i32.const 4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:82:4 + (if + ;;@ ~lib/memory.ts:82:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:82:12 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:82:15 + (block + ;;@ ~lib/memory.ts:83:6 + (i32.store16 + ;;@ ~lib/memory.ts:83:17 + (get_local $0) + ;;@ ~lib/memory.ts:83:23 + (i32.load16_u + ;;@ ~lib/memory.ts:83:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:84:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:84:14 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:84:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:84:24 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:86:4 + (if + ;;@ ~lib/memory.ts:86:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:86:12 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:87:16 + (block + (set_local $3 + (get_local $0) + ) + ;;@ ~lib/memory.ts:86:15 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:87:33 + (block (result i32) + (set_local $3 + (get_local $1) + ) + ;;@ ~lib/memory.ts:87:24 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:89:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:94:2 + (if + ;;@ ~lib/memory.ts:94:6 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:94:11 + (i32.const 32) + ) + ;;@ ~lib/memory.ts:94: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:95:12 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:95:19 + (i32.const 3) + ) + (i32.const 1) + ) + ) + ) + (br $break|2) + ) + ;;@ ~lib/memory.ts:98:8 + (set_local $4 + ;;@ ~lib/memory.ts:98:12 + (i32.load + ;;@ ~lib/memory.ts:98:22 + (get_local $1) + ) + ) + (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) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:100:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:100:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:100:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:100:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:101:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:101:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:101:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:101:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:102:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:102:13 + (i32.const 3) + ) + ) + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:103:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:103:20 + (i32.const 17) + ) + (block + ;;@ ~lib/memory.ts:105:10 + (i32.store + ;;@ ~lib/memory.ts:105:21 + (get_local $0) + ;;@ ~lib/memory.ts:105:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:105:32 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:105:37 + (i32.shl + ;;@ ~lib/memory.ts:104:10 + (tee_local $3 + ;;@ ~lib/memory.ts:104:14 + (i32.load + ;;@ ~lib/memory.ts:104:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:104:30 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:105:42 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:107:10 + (i32.store + ;;@ ~lib/memory.ts:107:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:107:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:107:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:107:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:107:41 + (i32.shl + ;;@ ~lib/memory.ts:106:10 + (tee_local $4 + ;;@ ~lib/memory.ts:106:14 + (i32.load + ;;@ ~lib/memory.ts:106:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:106:30 + (i32.const 5) + ) + ) + ) + ;;@ ~lib/memory.ts:107:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:109:10 + (i32.store + ;;@ ~lib/memory.ts:109:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:109:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:109:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:109:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:109:41 + (i32.shl + ;;@ ~lib/memory.ts:108:10 + (tee_local $3 + ;;@ ~lib/memory.ts:108:14 + (i32.load + ;;@ ~lib/memory.ts:108:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:108:30 + (i32.const 9) + ) + ) + ) + ;;@ ~lib/memory.ts:109:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:111:10 + (i32.store + ;;@ ~lib/memory.ts:111:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:111:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:111:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:111:37 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:111:42 + (i32.shl + ;;@ ~lib/memory.ts:110:10 + (tee_local $4 + ;;@ ~lib/memory.ts:110:14 + (i32.load + ;;@ ~lib/memory.ts:110:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:110:30 + (i32.const 13) + ) + ) + ) + ;;@ ~lib/memory.ts:111:47 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:112:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:112:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:112:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:112:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:112:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:112:38 + (i32.const 16) + ) + ) + (br $continue|3) + ) + ) + ) + ;;@ ~lib/memory.ts:114:8 + (br $break|2) + ) + ;;@ ~lib/memory.ts:117:8 + (set_local $4 + ;;@ ~lib/memory.ts:117:12 + (i32.load + ;;@ ~lib/memory.ts:117:22 + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:118:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:118:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:118:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:118:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:119:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:119:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:119:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:119:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:120:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:120:13 + (i32.const 2) + ) + ) + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:121:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:121:20 + (i32.const 18) + ) + (block + ;;@ ~lib/memory.ts:123:10 + (i32.store + ;;@ ~lib/memory.ts:123:21 + (get_local $0) + ;;@ ~lib/memory.ts:123:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:123:32 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:123:37 + (i32.shl + ;;@ ~lib/memory.ts:122:10 + (tee_local $3 + ;;@ ~lib/memory.ts:122:14 + (i32.load + ;;@ ~lib/memory.ts:122:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:122:30 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/memory.ts:123:42 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:125:10 + (i32.store + ;;@ ~lib/memory.ts:125:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:125:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:125:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:125:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:125:41 + (i32.shl + ;;@ ~lib/memory.ts:124:10 + (tee_local $4 + ;;@ ~lib/memory.ts:124:14 + (i32.load + ;;@ ~lib/memory.ts:124:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:124:30 + (i32.const 6) + ) + ) + ) + ;;@ ~lib/memory.ts:125:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:127:10 + (i32.store + ;;@ ~lib/memory.ts:127:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:127:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:127:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:127:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:127:41 + (i32.shl + ;;@ ~lib/memory.ts:126:10 + (tee_local $3 + ;;@ ~lib/memory.ts:126:14 + (i32.load + ;;@ ~lib/memory.ts:126:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:126:30 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/memory.ts:127:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:129:10 + (i32.store + ;;@ ~lib/memory.ts:129:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:129:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:129:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:129:37 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:129:42 + (i32.shl + ;;@ ~lib/memory.ts:128:10 + (tee_local $4 + ;;@ ~lib/memory.ts:128:14 + (i32.load + ;;@ ~lib/memory.ts:128:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:128:30 + (i32.const 14) + ) + ) + ) + ;;@ ~lib/memory.ts:129:47 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:130:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:130:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:130:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:130:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:130:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:130:38 + (i32.const 16) + ) + ) + (br $continue|4) + ) + ) + ) + ;;@ ~lib/memory.ts:132:8 + (br $break|2) + ) + ;;@ ~lib/memory.ts:135:8 + (set_local $4 + ;;@ ~lib/memory.ts:135:12 + (i32.load + ;;@ ~lib/memory.ts:135:22 + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:136:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:136:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:136:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:136:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:137:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:137:13 + (i32.const 1) + ) + ) + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:138:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:138:20 + (i32.const 19) + ) + (block + ;;@ ~lib/memory.ts:140:10 + (i32.store + ;;@ ~lib/memory.ts:140:21 + (get_local $0) + ;;@ ~lib/memory.ts:140:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:140:32 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:140:36 + (i32.shl + ;;@ ~lib/memory.ts:139:10 + (tee_local $3 + ;;@ ~lib/memory.ts:139:14 + (i32.load + ;;@ ~lib/memory.ts:139:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:139:30 + (i32.const 3) + ) + ) + ) + ;;@ ~lib/memory.ts:140:41 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:142:10 + (i32.store + ;;@ ~lib/memory.ts:142:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:142:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:142:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:142:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:142:40 + (i32.shl + ;;@ ~lib/memory.ts:141:10 + (tee_local $4 + ;;@ ~lib/memory.ts:141:14 + (i32.load + ;;@ ~lib/memory.ts:141:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:141:30 + (i32.const 7) + ) + ) + ) + ;;@ ~lib/memory.ts:142:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:144:10 + (i32.store + ;;@ ~lib/memory.ts:144:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:144:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:144:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:144:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:144:40 + (i32.shl + ;;@ ~lib/memory.ts:143:10 + (tee_local $3 + ;;@ ~lib/memory.ts:143:14 + (i32.load + ;;@ ~lib/memory.ts:143:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:143:30 + (i32.const 11) + ) + ) + ) + ;;@ ~lib/memory.ts:144:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:146:10 + (i32.store + ;;@ ~lib/memory.ts:146:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:146:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:146:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:146:37 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:146:41 + (i32.shl + ;;@ ~lib/memory.ts:145:10 + (tee_local $4 + ;;@ ~lib/memory.ts:145:14 + (i32.load + ;;@ ~lib/memory.ts:145:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:145:30 + (i32.const 15) + ) + ) + ) + ;;@ ~lib/memory.ts:146:46 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:147:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:147:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:147:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:147:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:147:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:147:38 + (i32.const 16) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:155:2 + (if + ;;@ ~lib/memory.ts:155:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:155:10 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:155:14 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:156:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:156:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:156:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:156:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:157:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:157:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:157:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:157:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:158:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:158:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:158:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:158:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:159:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:159:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:159:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:159:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:160:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:160:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:160:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:160:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:161:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:161:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:161:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:161:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:162:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:162:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:162:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:162:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:163:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:163:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:163:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:163:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:164:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:164:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:164:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:164:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (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) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:166:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:166:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:166:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:166:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:167:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:167:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:167:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:167:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:168:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:168:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:168:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:168:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:169:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:169:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:169:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:169:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:170:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:170:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:170:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:170:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:171:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:171:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:171:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:171:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:173:2 + (if + ;;@ ~lib/memory.ts:173:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:173:10 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:173:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:174:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:174:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:174:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:174:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:175:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:175:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:175:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:175:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:176:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:176:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:176:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:176:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:177:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:177:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:177:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:177:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:178:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:178:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:178:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:178:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:179:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:179:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:179:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:179:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:180:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:180:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:180:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:180:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:181:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:181:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:181:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:181:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:183:2 + (if + ;;@ ~lib/memory.ts:183:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:183:10 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:183:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:184:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:184:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:184:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:184:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:185:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:185:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:185:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:185:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:186:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:186:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:186:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:186:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:187:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:187:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:187:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:187:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:189:2 + (if + ;;@ ~lib/memory.ts:189:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:189:10 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:189:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:190:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:190:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:190:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:190:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:191:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:191:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:191:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:191:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:193:2 + (if + ;;@ ~lib/memory.ts:193:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:193:10 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:194:14 + (block + (set_local $3 + (get_local $0) + ) + ;;@ ~lib/memory.ts:193:13 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:194:31 + (block (result i32) + (set_local $3 + (get_local $1) + ) + ;;@ ~lib/memory.ts:194:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memmove (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + ;;@ ~lib/memory.ts:200:2 + (if + ;;@ ~lib/memory.ts:200:6 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:200:14 + (get_local $1) + ) + ;;@ ~lib/memory.ts:200:19 + (return) + ) + ;;@ ~lib/memory.ts:201:2 + (if + ;;@ ~lib/memory.ts:201:6 + (if (result i32) + (tee_local $3 + (i32.le_u + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:201:12 + (get_local $2) + ) + ;;@ ~lib/memory.ts:201:17 + (get_local $0) + ) + ) + (get_local $3) + ;;@ ~lib/memory.ts:201:25 + (i32.le_u + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:201:32 + (get_local $2) + ) + ;;@ ~lib/memory.ts:201:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:201:42 + (block + ;;@ ~lib/memory.ts:202:4 + (call $~lib/memory/memcpy + ;;@ ~lib/memory.ts:202:11 + (get_local $0) + ;;@ ~lib/memory.ts:202:17 + (get_local $1) + ;;@ ~lib/memory.ts:202:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:203:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:205:2 + (if + ;;@ ~lib/memory.ts:205:6 + (i32.lt_u + (get_local $0) + ;;@ ~lib/memory.ts:205:13 + (get_local $1) + ) + ;;@ ~lib/memory.ts:205:18 + (block + ;;@ ~lib/memory.ts:206:4 + (if + ;;@ ~lib/memory.ts:206:8 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:206:9 + (get_local $1) + ;;@ ~lib/memory.ts:206:15 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:206:21 + (i32.and + ;;@ ~lib/memory.ts:206:22 + (get_local $0) + ;;@ ~lib/memory.ts:206:29 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:206:33 + (block + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:207:13 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:207:20 + (i32.const 7) + ) + (block + ;;@ ~lib/memory.ts:208:8 + (if + ;;@ ~lib/memory.ts:208:12 + (i32.eqz + ;;@ ~lib/memory.ts:208:13 + (get_local $2) + ) + ;;@ ~lib/memory.ts:208:16 + (return) + ) + ;;@ ~lib/memory.ts:209:8 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:209:10 + (get_local $2) + (i32.const 1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:210:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:210:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:210:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:210:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (br $continue|0) + ) + ) + ) + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:212:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:212:18 + (i32.const 8) + ) + (block + ;;@ ~lib/memory.ts:213:8 + (i64.store + ;;@ ~lib/memory.ts:213:19 + (get_local $0) + ;;@ ~lib/memory.ts:213:25 + (i64.load + ;;@ ~lib/memory.ts:213:35 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:214:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:214:16 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:215:8 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:215:16 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:216:8 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:216:16 + (i32.const 8) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ) + (loop $continue|2 + (if + ;;@ ~lib/memory.ts:219:11 + (get_local $2) + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:220:16 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:220:6 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:220:33 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:220:24 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:221:6 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:221:8 + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:223:9 + (block + ;;@ ~lib/memory.ts:224:4 + (if + ;;@ ~lib/memory.ts:224:8 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:224:9 + (get_local $1) + ;;@ ~lib/memory.ts:224:15 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:224:21 + (i32.and + ;;@ ~lib/memory.ts:224:22 + (get_local $0) + ;;@ ~lib/memory.ts:224:29 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:224:33 + (block + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:225:13 + (i32.and + (i32.add + ;;@ ~lib/memory.ts:225:14 + (get_local $0) + ;;@ ~lib/memory.ts:225:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:225:26 + (i32.const 7) + ) + (block + ;;@ ~lib/memory.ts:226:8 + (if + ;;@ ~lib/memory.ts:226:12 + (i32.eqz + ;;@ ~lib/memory.ts:226:13 + (get_local $2) + ) + ;;@ ~lib/memory.ts:226:16 + (return) + ) + ;;@ ~lib/memory.ts:227:8 + (i32.store8 + ;;@ ~lib/memory.ts:227:18 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:227:25 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:227:27 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:227:30 + (i32.load8_u + ;;@ ~lib/memory.ts:227:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:227:45 + (get_local $2) + ) + ) + ) + (br $continue|3) + ) + ) + ) + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:229:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:229:18 + (i32.const 8) + ) + (block + ;;@ ~lib/memory.ts:231:8 + (i64.store + ;;@ ~lib/memory.ts:231:19 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:230:8 + (tee_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:230:13 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:231:29 + (i64.load + ;;@ ~lib/memory.ts:231:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:231:45 + (get_local $2) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ) + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:234:11 + (get_local $2) + (block + ;;@ ~lib/memory.ts:234:14 + (i32.store8 + ;;@ ~lib/memory.ts:235:16 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:235:23 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:235:25 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:235:28 + (i32.load8_u + ;;@ ~lib/memory.ts:235:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:235:43 + (get_local $2) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.copy (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/memory.ts:16:4 + (call $~lib/memory/memmove + ;;@ ~lib/memory.ts:16:12 + (get_local $0) + ;;@ ~lib/memory.ts:16:18 + (get_local $1) + ;;@ ~lib/memory.ts:16:23 + (get_local $2) + ) + ) + (func $~lib/memory/memcmp (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + ;;@ ~lib/memory.ts:302:2 + (if + ;;@ ~lib/memory.ts:302:6 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:302:12 + (get_local $1) + ) + ;;@ ~lib/memory.ts:302:23 + (return + (i32.const 0) + ) + ) + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:303:9 + (if (result i32) + (tee_local $3 + (i32.ne + (get_local $2) + ;;@ ~lib/memory.ts:303:14 + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:303:19 + (i32.eq + (i32.load8_u + ;;@ ~lib/memory.ts:303:28 + (get_local $0) + ) + ;;@ ~lib/memory.ts:303:35 + (i32.load8_u + ;;@ ~lib/memory.ts:303:44 + (get_local $1) + ) + ) + (get_local $3) + ) + (block + ;;@ ~lib/memory.ts:304:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:304:9 + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:304:15 + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ;;@ ~lib/memory.ts:306:53 + (if (result i32) + ;;@ ~lib/memory.ts:306:9 + (get_local $2) + ;;@ ~lib/memory.ts:306:13 + (i32.sub + (i32.load8_u + ;;@ ~lib/memory.ts:306:27 + (get_local $0) + ) + ;;@ ~lib/memory.ts:306:33 + (i32.load8_u + ;;@ ~lib/memory.ts:306:47 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:306:53 + (i32.const 0) + ) + ) + (func $~lib/memory/memory.compare (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + ;;@ ~lib/memory.ts:21:27 + (call $~lib/memory/memcmp + ;;@ ~lib/memory.ts:21:18 + (get_local $0) + ;;@ ~lib/memory.ts:21:22 + (get_local $1) + ;;@ ~lib/memory.ts:21:26 + (get_local $2) + ) + ) + (func $~lib/allocator/buddy/update_max_ptr (; 7 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) ;;@ ~lib/allocator/buddy.ts:175:2 (if @@ -33,6 +3059,7 @@ (if ;;@ ~lib/allocator/buddy.ts:182:8 (i32.lt_s + ;;@ ~lib/allocator/buddy.ts:182:15 (grow_memory ;;@ ~lib/allocator/buddy.ts:182:20 (i32.sub @@ -51,7 +3078,7 @@ ) (i32.const -65536) ) - ;;@ ~lib/allocator/buddy.ts:180:61 + ;;@ ~lib/allocator/buddy.ts:180:62 (i32.const 16) ) ) @@ -82,7 +3109,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 (; 8 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:102:59 (i32.add ;;@ ~lib/allocator/buddy.ts:102:26 @@ -90,12 +3117,11 @@ ;;@ ~lib/allocator/buddy.ts:102:42 (i32.shl (get_local $0) - ;;@ ~lib/allocator/buddy.ts:102:50 (i32.const 3) ) ) ) - (func $~lib/allocator/buddy/list_init (; 2 ;) (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) @@ -109,7 +3135,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 (; 10 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:207:2 (i32.store @@ -141,17 +3167,15 @@ (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 (; 11 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:279:2 (set_local $1 - ;;@ ~lib/allocator/buddy.ts:279:15 (i32.const 26) ) ;;@ ~lib/allocator/buddy.ts:280:2 (set_local $2 - ;;@ ~lib/allocator/buddy.ts:280:13 (i32.const 16) ) (loop $continue|0 @@ -185,7 +3209,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 (; 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 @@ -200,7 +3224,6 @@ ) ;;@ ~lib/allocator/buddy.ts:252:30 (i32.sub - ;;@ ~lib/allocator/buddy.ts:252:31 (i32.const 30) ;;@ ~lib/allocator/buddy.ts:252:48 (get_local $1) @@ -218,7 +3241,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 (; 13 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:148:45 (i32.load8_u ;;@ ~lib/allocator/buddy.ts:148:18 @@ -229,7 +3252,7 @@ ) ) ) - (func $~lib/allocator/buddy/parent_is_split (; 7 ;) (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:260:70 (i32.eq ;;@ ~lib/allocator/buddy.ts:260:9 @@ -273,7 +3296,7 @@ (i32.const 1) ) ) - (func $~lib/allocator/buddy/list_remove (; 8 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/buddy/list_remove (; 15 ;) (type $iv) (param $0 i32) (local $1 i32) ;;@ ~lib/allocator/buddy.ts:222:2 (i32.store offset=4 @@ -299,7 +3322,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 (; 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 @@ -324,7 +3347,6 @@ ) ;;@ ~lib/allocator/buddy.ts:243:52 (i32.sub - ;;@ ~lib/allocator/buddy.ts:243:53 (i32.const 30) ;;@ ~lib/allocator/buddy.ts:243:70 (get_local $1) @@ -332,7 +3354,7 @@ ) ) ) - (func $~lib/allocator/buddy/flip_parent_is_split (; 10 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/buddy/flip_parent_is_split (; 17 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) (set_local $2 @@ -388,7 +3410,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 (; 18 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (loop $continue|0 @@ -478,7 +3500,6 @@ (get_global $~lib/allocator/buddy/bucket_limit) ) ) - ;;@ ~lib/allocator/buddy.ts:322:38 (i32.const 8) ) ) @@ -545,7 +3566,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 (; 19 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) ;;@ ~lib/allocator/buddy.ts:231:2 (if @@ -574,7 +3595,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 (; 20 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -584,7 +3605,6 @@ ;;@ ~lib/allocator/buddy.ts:350:6 (i32.gt_u (get_local $0) - ;;@ ~lib/allocator/buddy.ts:350:16 (i32.const 1073741816) ) ;;@ ~lib/allocator/buddy.ts:350:41 @@ -616,13 +3636,12 @@ ;;@ ~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) ) ) ;;@ ~lib/allocator/buddy.ts:361:4 (set_global $~lib/allocator/buddy/bucket_limit - ;;@ ~lib/allocator/buddy.ts:361:19 (i32.const 26) ) ;;@ ~lib/allocator/buddy.ts:362:4 @@ -634,7 +3653,6 @@ ;;@ ~lib/allocator/buddy.ts:362:24 (i32.add (get_global $~lib/allocator/buddy/base_ptr) - ;;@ ~lib/allocator/buddy.ts:362:35 (i32.const 8) ) ) @@ -649,7 +3667,6 @@ (call $~lib/allocator/buddy/list_init ;;@ ~lib/allocator/buddy.ts:365:14 (call $~lib/allocator/buddy/buckets$get - ;;@ ~lib/allocator/buddy.ts:365:26 (i32.const 26) ) ) @@ -657,7 +3674,6 @@ (call $~lib/allocator/buddy/list_push ;;@ ~lib/allocator/buddy.ts:366:14 (call $~lib/allocator/buddy/buckets$get - ;;@ ~lib/allocator/buddy.ts:366:26 (i32.const 26) ) ;;@ ~lib/allocator/buddy.ts:366:45 @@ -674,7 +3690,6 @@ ;;@ ~lib/allocator/buddy.ts:373:30 (i32.add (get_local $0) - ;;@ ~lib/allocator/buddy.ts:373:40 (i32.const 8) ) ) @@ -794,7 +3809,6 @@ (i32.const 1) ;;@ ~lib/allocator/buddy.ts:425:16 (i32.sub - ;;@ ~lib/allocator/buddy.ts:425:17 (i32.const 30) ;;@ ~lib/allocator/buddy.ts:425:34 (get_local $1) @@ -824,7 +3838,6 @@ ;;@ ~lib/allocator/buddy.ts:426:53 (i32.const 2) ) - ;;@ ~lib/allocator/buddy.ts:426:57 (i32.const 8) ) ;;@ ~lib/allocator/buddy.ts:426:69 @@ -934,7 +3947,6 @@ ;;@ ~lib/allocator/buddy.ts:470:11 (i32.add (get_local $2) - ;;@ ~lib/allocator/buddy.ts:470:17 (i32.const 8) ) ) @@ -944,7 +3956,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 (; 21 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:37:45 + (call $~lib/allocator/buddy/__memory_allocate + ;;@ ~lib/memory.ts:37:63 + (get_local $0) + ) + ) + (func $~lib/allocator/buddy/__memory_free (; 22 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:483:2 @@ -969,12 +3988,10 @@ ;;@ ~lib/allocator/buddy.ts:492:8 (i32.sub (get_local $0) - ;;@ ~lib/allocator/buddy.ts:492:14 (i32.const 8) ) ) ) - ;;@ ~lib/allocator/buddy.ts:493:49 (i32.const 8) ) ) @@ -1086,10 +4103,19 @@ ) ) ) - (func $start (; 15 ;) (type $v) + (func $~lib/memory/memory.free (; 23 ;) (type $iv) (param $0 i32) + ;;@ ~lib/memory.ts:43:36 + (call $~lib/allocator/buddy/__memory_free + ;;@ ~lib/memory.ts:43:50 + (get_local $0) + ) + ) + (func $~lib/memory/memory.reset (; 24 ;) (type $v) + (unreachable) + ) + (func $start (; 25 ;) (type $v) (set_global $~lib/allocator/buddy/BUCKETS_START - ;;@ ~lib/allocator/buddy.ts:97:27 - (get_global $HEAP_BASE) + (i32.const 8) ) (set_global $~lib/allocator/buddy/BUCKETS_END ;;@ ~lib/allocator/buddy.ts:98:25 @@ -1106,7 +4132,6 @@ ;;@ ~lib/allocator/buddy.ts:144:31 (i32.add (get_global $~lib/allocator/buddy/NODE_IS_SPLIT_START) - ;;@ ~lib/allocator/buddy.ts:144:53 (i32.const 8388608) ) ) diff --git a/tests/allocators/buddy/untouched.wat b/tests/allocators/buddy/untouched.wat index b1352d06..3518776b 100644 --- a/tests/allocators/buddy/untouched.wat +++ b/tests/allocators/buddy/untouched.wat @@ -1,4 +1,6 @@ (module + (type $iiiv (func (param i32 i32 i32))) + (type $iiii (func (param i32 i32 i32) (result i32))) (type $ii (func (param i32) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $iv (func (param i32))) @@ -13,6 +15,7 @@ (global $~lib/allocator/buddy/MAX_ALLOC i32 (i32.const 1073741824)) (global $~lib/allocator/buddy/BUCKET_COUNT i32 (i32.const 27)) (global $~lib/allocator/buddy/BUCKETS_START (mut i32) (i32.const 0)) + (global $~lib/allocator/buddy/List.SIZE i32 (i32.const 8)) (global $~lib/allocator/buddy/BUCKETS_END (mut i32) (i32.const 0)) (global $~lib/allocator/buddy/bucket_limit (mut i32) (i32.const 0)) (global $~lib/allocator/buddy/SPLIT_COUNT i32 (i32.const 8388608)) @@ -23,11 +26,3337 @@ (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" (memory $0)) + (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)) (start $start) - (func $~lib/allocator/buddy/update_max_ptr (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memset (; 1 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i64) + ;;@ ~lib/memory.ts:244:2 + (if + ;;@ ~lib/memory.ts:244:6 + (i32.eqz + ;;@ ~lib/memory.ts:244:7 + (get_local $2) + ) + ;;@ ~lib/memory.ts:244:10 + (return) + ) + ;;@ ~lib/memory.ts:245:2 + (i32.store8 + ;;@ ~lib/memory.ts:245:12 + (get_local $0) + ;;@ ~lib/memory.ts:245:18 + (get_local $1) + ) + ;;@ ~lib/memory.ts:246:2 + (i32.store8 + ;;@ ~lib/memory.ts:246:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:246:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:246:23 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:246:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:247:2 + (if + ;;@ ~lib/memory.ts:247:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:247:11 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:247:14 + (return) + ) + ;;@ ~lib/memory.ts:249:2 + (i32.store8 + ;;@ ~lib/memory.ts:249:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:249:19 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:249:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:250:2 + (i32.store8 + ;;@ ~lib/memory.ts:250:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:250:19 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:250:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:251:2 + (i32.store8 + ;;@ ~lib/memory.ts:251:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:251:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:251:23 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:251:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:252:2 + (i32.store8 + ;;@ ~lib/memory.ts:252:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:252:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:252:23 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:252:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:253:2 + (if + ;;@ ~lib/memory.ts:253:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:253:11 + (i32.const 6) + ) + ;;@ ~lib/memory.ts:253:14 + (return) + ) + ;;@ ~lib/memory.ts:254:2 + (i32.store8 + ;;@ ~lib/memory.ts:254:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:254:19 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:254:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:255:2 + (i32.store8 + ;;@ ~lib/memory.ts:255:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:255:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:255:23 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:255:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:256:2 + (if + ;;@ ~lib/memory.ts:256:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:256:11 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:256:14 + (return) + ) + ;;@ ~lib/memory.ts:259:2 + (set_local $3 + ;;@ ~lib/memory.ts:259:17 + (i32.and + (i32.sub + (i32.const 0) + ;;@ ~lib/memory.ts:259:18 + (get_local $0) + ) + ;;@ ~lib/memory.ts:259:25 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:260:2 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:260:10 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:261:2 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:261:7 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:262:2 + (set_local $2 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:262:7 + (i32.const -4) + ) + ) + ;;@ ~lib/memory.ts:264:2 + (set_local $4 + ;;@ ~lib/memory.ts:264:17 + (i32.mul + (i32.div_u + (i32.const -1) + ;;@ ~lib/memory.ts:264:27 + (i32.const 255) + ) + (i32.and + ;;@ ~lib/memory.ts:264:33 + (get_local $1) + (i32.const 255) + ) + ) + ) + ;;@ ~lib/memory.ts:267:2 + (i32.store + ;;@ ~lib/memory.ts:267:13 + (get_local $0) + ;;@ ~lib/memory.ts:267:19 + (get_local $4) + ) + ;;@ ~lib/memory.ts:268:2 + (i32.store + ;;@ ~lib/memory.ts:268:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:268:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:268:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:268:27 + (get_local $4) + ) + ;;@ ~lib/memory.ts:269:2 + (if + ;;@ ~lib/memory.ts:269:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:269:11 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:269:14 + (return) + ) + ;;@ ~lib/memory.ts:270:2 + (i32.store + ;;@ ~lib/memory.ts:270:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:270:20 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:270:23 + (get_local $4) + ) + ;;@ ~lib/memory.ts:271:2 + (i32.store + ;;@ ~lib/memory.ts:271:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:271:20 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:271:23 + (get_local $4) + ) + ;;@ ~lib/memory.ts:272:2 + (i32.store + ;;@ ~lib/memory.ts:272:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:272:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:272:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:272:28 + (get_local $4) + ) + ;;@ ~lib/memory.ts:273:2 + (i32.store + ;;@ ~lib/memory.ts:273:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:273:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:273:24 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:273:27 + (get_local $4) + ) + ;;@ ~lib/memory.ts:274:2 + (if + ;;@ ~lib/memory.ts:274:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:274:11 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:274:15 + (return) + ) + ;;@ ~lib/memory.ts:275:2 + (i32.store + ;;@ ~lib/memory.ts:275:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:275:20 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:275:24 + (get_local $4) + ) + ;;@ ~lib/memory.ts:276:2 + (i32.store + ;;@ ~lib/memory.ts:276:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:276:20 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:276:24 + (get_local $4) + ) + ;;@ ~lib/memory.ts:277:2 + (i32.store + ;;@ ~lib/memory.ts:277:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:277:20 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:277:24 + (get_local $4) + ) + ;;@ ~lib/memory.ts:278:2 + (i32.store + ;;@ ~lib/memory.ts:278:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:278:20 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:278:24 + (get_local $4) + ) + ;;@ ~lib/memory.ts:279:2 + (i32.store + ;;@ ~lib/memory.ts:279:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:279:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:279:24 + (i32.const 28) + ) + ;;@ ~lib/memory.ts:279:28 + (get_local $4) + ) + ;;@ ~lib/memory.ts:280:2 + (i32.store + ;;@ ~lib/memory.ts:280:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:280:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:280:24 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:280:28 + (get_local $4) + ) + ;;@ ~lib/memory.ts:281:2 + (i32.store + ;;@ ~lib/memory.ts:281:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:281:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:281:24 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:281:28 + (get_local $4) + ) + ;;@ ~lib/memory.ts:282:2 + (i32.store + ;;@ ~lib/memory.ts:282:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:282:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:282:24 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:282:28 + (get_local $4) + ) + ;;@ ~lib/memory.ts:285:2 + (set_local $3 + ;;@ ~lib/memory.ts:285:6 + (i32.add + (i32.const 24) + ;;@ ~lib/memory.ts:285:11 + (i32.and + ;;@ ~lib/memory.ts:285:12 + (get_local $0) + ;;@ ~lib/memory.ts:285:19 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:286:2 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:286:10 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:287:2 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:287:7 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:290:2 + (set_local $5 + ;;@ ~lib/memory.ts:290:17 + (i64.or + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/memory.ts:290:28 + (i64.shl + ;;@ ~lib/memory.ts:290:29 + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/memory.ts:290:41 + (i64.const 32) + ) + ) + ) + ;;@ ~lib/memory.ts:291:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:291:9 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:291:14 + (i32.const 32) + ) + (block + (block + ;;@ ~lib/memory.ts:292:4 + (i64.store + ;;@ ~lib/memory.ts:292:15 + (get_local $0) + ;;@ ~lib/memory.ts:292:21 + (get_local $5) + ) + ;;@ ~lib/memory.ts:293:4 + (i64.store + ;;@ ~lib/memory.ts:293:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:293:22 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:293:25 + (get_local $5) + ) + ;;@ ~lib/memory.ts:294:4 + (i64.store + ;;@ ~lib/memory.ts:294:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:294:22 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:294:26 + (get_local $5) + ) + ;;@ ~lib/memory.ts:295:4 + (i64.store + ;;@ ~lib/memory.ts:295:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:295:22 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:295:26 + (get_local $5) + ) + ;;@ ~lib/memory.ts:296:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:296:9 + (i32.const 32) + ) + ) + ;;@ ~lib/memory.ts:297:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:297:12 + (i32.const 32) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.fill (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/memory.ts:11:4 + (call $~lib/memory/memset + ;;@ ~lib/memory.ts:11:11 + (get_local $0) + ;;@ ~lib/memory.ts:11:17 + (get_local $1) + ;;@ ~lib/memory.ts:11:20 + (get_local $2) + ) + ) + (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:59:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:59:9 + (if (result i32) + (get_local $2) + ;;@ ~lib/memory.ts:59:14 + (i32.and + ;;@ ~lib/memory.ts:59:15 + (get_local $1) + ;;@ ~lib/memory.ts:59:21 + (i32.const 3) + ) + (get_local $2) + ) + (block + (block + ;;@ ~lib/memory.ts:60:4 + (i32.store8 + ;;@ ~lib/memory.ts:60: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:60:22 + (i32.load8_u + ;;@ ~lib/memory.ts:60: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:61:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:65:2 + (if + ;;@ ~lib/memory.ts:65:6 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:65:7 + (get_local $0) + ;;@ ~lib/memory.ts:65:14 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:65:20 + (i32.const 0) + ) + ;;@ ~lib/memory.ts:65:23 + (block + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:66:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:66:16 + (i32.const 16) + ) + (block + (block + ;;@ ~lib/memory.ts:67:6 + (i32.store + ;;@ ~lib/memory.ts:67:17 + (get_local $0) + ;;@ ~lib/memory.ts:67:28 + (i32.load + ;;@ ~lib/memory.ts:67:38 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:68:6 + (i32.store + ;;@ ~lib/memory.ts:68:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:68:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:68:28 + (i32.load + ;;@ ~lib/memory.ts:68:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:68:45 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:69:6 + (i32.store + ;;@ ~lib/memory.ts:69:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:69:25 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:69:28 + (i32.load + ;;@ ~lib/memory.ts:69:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:69:45 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:70:6 + (i32.store + ;;@ ~lib/memory.ts:70:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:70:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:70:28 + (i32.load + ;;@ ~lib/memory.ts:70:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:70:44 + (i32.const 12) + ) + ) + ) + ;;@ ~lib/memory.ts:71:6 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:71:13 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:71:17 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:71:25 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:71:29 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:71:34 + (i32.const 16) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:73:4 + (if + ;;@ ~lib/memory.ts:73:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:73:12 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:73:15 + (block + ;;@ ~lib/memory.ts:74:6 + (i32.store + ;;@ ~lib/memory.ts:74:17 + (get_local $0) + ;;@ ~lib/memory.ts:74:27 + (i32.load + ;;@ ~lib/memory.ts:74:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:75:6 + (i32.store + ;;@ ~lib/memory.ts:75:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:75:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:75:27 + (i32.load + ;;@ ~lib/memory.ts:75:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:75:43 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:76:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:76:14 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:76:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:76:24 + (i32.const 8) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:78:4 + (if + ;;@ ~lib/memory.ts:78:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:78:12 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:78:15 + (block + ;;@ ~lib/memory.ts:79:6 + (i32.store + ;;@ ~lib/memory.ts:79:17 + (get_local $0) + ;;@ ~lib/memory.ts:79:23 + (i32.load + ;;@ ~lib/memory.ts:79:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:80:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:80:14 + (i32.const 4) + ) + ) + ;;@ ~lib/memory.ts:80:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:80:24 + (i32.const 4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:82:4 + (if + ;;@ ~lib/memory.ts:82:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:82:12 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:82:15 + (block + ;;@ ~lib/memory.ts:83:6 + (i32.store16 + ;;@ ~lib/memory.ts:83:17 + (get_local $0) + ;;@ ~lib/memory.ts:83:23 + (i32.load16_u + ;;@ ~lib/memory.ts:83:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:84:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:84:14 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:84:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:84:24 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:86:4 + (if + ;;@ ~lib/memory.ts:86:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:86:12 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:86:15 + (i32.store8 + ;;@ ~lib/memory.ts:87: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:87:24 + (i32.load8_u + ;;@ ~lib/memory.ts:87: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:89:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:94:2 + (if + ;;@ ~lib/memory.ts:94:6 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:94:11 + (i32.const 32) + ) + ;;@ ~lib/memory.ts:94:15 + (block $break|2 + (block $case2|2 + (block $case1|2 + (block $case0|2 + (set_local $5 + ;;@ ~lib/memory.ts:95:12 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:95:19 + (i32.const 3) + ) + ) + (br_if $case0|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:97:11 + (i32.const 1) + ) + ) + (br_if $case1|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:116:11 + (i32.const 2) + ) + ) + (br_if $case2|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:134:11 + (i32.const 3) + ) + ) + (br $break|2) + ) + ;;@ ~lib/memory.ts:97:14 + (block + ;;@ ~lib/memory.ts:98:8 + (set_local $3 + ;;@ ~lib/memory.ts:98:12 + (i32.load + ;;@ ~lib/memory.ts:98:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:99:8 + (i32.store8 + ;;@ ~lib/memory.ts:99: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:99:26 + (i32.load8_u + ;;@ ~lib/memory.ts:99: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:100:8 + (i32.store8 + ;;@ ~lib/memory.ts:100: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:100:26 + (i32.load8_u + ;;@ ~lib/memory.ts:100: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:101:8 + (i32.store8 + ;;@ ~lib/memory.ts:101: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:101:26 + (i32.load8_u + ;;@ ~lib/memory.ts:101: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:102:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:102:13 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:103:8 + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:103:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:103:20 + (i32.const 17) + ) + (block + (block + ;;@ ~lib/memory.ts:104:10 + (set_local $4 + ;;@ ~lib/memory.ts:104:14 + (i32.load + ;;@ ~lib/memory.ts:104:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:104:30 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:105:10 + (i32.store + ;;@ ~lib/memory.ts:105:21 + (get_local $0) + ;;@ ~lib/memory.ts:105:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:105:32 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:105:37 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:105:42 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:106:10 + (set_local $3 + ;;@ ~lib/memory.ts:106:14 + (i32.load + ;;@ ~lib/memory.ts:106:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:106:30 + (i32.const 5) + ) + ) + ) + ;;@ ~lib/memory.ts:107:10 + (i32.store + ;;@ ~lib/memory.ts:107:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:107:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:107:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:107:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:107:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:107:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:108:10 + (set_local $4 + ;;@ ~lib/memory.ts:108:14 + (i32.load + ;;@ ~lib/memory.ts:108:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:108:30 + (i32.const 9) + ) + ) + ) + ;;@ ~lib/memory.ts:109:10 + (i32.store + ;;@ ~lib/memory.ts:109:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:109:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:109:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:109:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:109:41 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:109:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:110:10 + (set_local $3 + ;;@ ~lib/memory.ts:110:14 + (i32.load + ;;@ ~lib/memory.ts:110:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:110:30 + (i32.const 13) + ) + ) + ) + ;;@ ~lib/memory.ts:111:10 + (i32.store + ;;@ ~lib/memory.ts:111:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:111:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:111:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:111:37 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:111:42 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:111:47 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:112:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:112:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:112:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:112:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:112:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:112:38 + (i32.const 16) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:114:8 + (br $break|2) + ) + ) + ;;@ ~lib/memory.ts:116:14 + (block + ;;@ ~lib/memory.ts:117:8 + (set_local $3 + ;;@ ~lib/memory.ts:117:12 + (i32.load + ;;@ ~lib/memory.ts:117:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:118:8 + (i32.store8 + ;;@ ~lib/memory.ts:118: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:118:26 + (i32.load8_u + ;;@ ~lib/memory.ts:118: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:119:8 + (i32.store8 + ;;@ ~lib/memory.ts:119: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:119:26 + (i32.load8_u + ;;@ ~lib/memory.ts:119: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:120:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:120:13 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:121:8 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:121:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:121:20 + (i32.const 18) + ) + (block + (block + ;;@ ~lib/memory.ts:122:10 + (set_local $4 + ;;@ ~lib/memory.ts:122:14 + (i32.load + ;;@ ~lib/memory.ts:122:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:122:30 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/memory.ts:123:10 + (i32.store + ;;@ ~lib/memory.ts:123:21 + (get_local $0) + ;;@ ~lib/memory.ts:123:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:123:32 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:123:37 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:123:42 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:124:10 + (set_local $3 + ;;@ ~lib/memory.ts:124:14 + (i32.load + ;;@ ~lib/memory.ts:124:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:124:30 + (i32.const 6) + ) + ) + ) + ;;@ ~lib/memory.ts:125:10 + (i32.store + ;;@ ~lib/memory.ts:125:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:125:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:125:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:125:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:125:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:125:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:126:10 + (set_local $4 + ;;@ ~lib/memory.ts:126:14 + (i32.load + ;;@ ~lib/memory.ts:126:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:126:30 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/memory.ts:127:10 + (i32.store + ;;@ ~lib/memory.ts:127:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:127:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:127:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:127:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:127:41 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:127:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:128:10 + (set_local $3 + ;;@ ~lib/memory.ts:128:14 + (i32.load + ;;@ ~lib/memory.ts:128:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:128:30 + (i32.const 14) + ) + ) + ) + ;;@ ~lib/memory.ts:129:10 + (i32.store + ;;@ ~lib/memory.ts:129:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:129:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:129:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:129:37 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:129:42 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:129:47 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:130:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:130:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:130:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:130:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:130:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:130:38 + (i32.const 16) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:132:8 + (br $break|2) + ) + ) + ;;@ ~lib/memory.ts:134:14 + (block + ;;@ ~lib/memory.ts:135:8 + (set_local $3 + ;;@ ~lib/memory.ts:135:12 + (i32.load + ;;@ ~lib/memory.ts:135:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:136:8 + (i32.store8 + ;;@ ~lib/memory.ts:136: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:136:26 + (i32.load8_u + ;;@ ~lib/memory.ts:136: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:137:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:137:13 + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:138:8 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:138:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:138:20 + (i32.const 19) + ) + (block + (block + ;;@ ~lib/memory.ts:139:10 + (set_local $4 + ;;@ ~lib/memory.ts:139:14 + (i32.load + ;;@ ~lib/memory.ts:139:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:139:30 + (i32.const 3) + ) + ) + ) + ;;@ ~lib/memory.ts:140:10 + (i32.store + ;;@ ~lib/memory.ts:140:21 + (get_local $0) + ;;@ ~lib/memory.ts:140:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:140:32 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:140:36 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:140:41 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:141:10 + (set_local $3 + ;;@ ~lib/memory.ts:141:14 + (i32.load + ;;@ ~lib/memory.ts:141:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:141:30 + (i32.const 7) + ) + ) + ) + ;;@ ~lib/memory.ts:142:10 + (i32.store + ;;@ ~lib/memory.ts:142:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:142:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:142:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:142:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:142:40 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:142:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:143:10 + (set_local $4 + ;;@ ~lib/memory.ts:143:14 + (i32.load + ;;@ ~lib/memory.ts:143:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:143:30 + (i32.const 11) + ) + ) + ) + ;;@ ~lib/memory.ts:144:10 + (i32.store + ;;@ ~lib/memory.ts:144:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:144:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:144:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:144:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:144:40 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:144:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:145:10 + (set_local $3 + ;;@ ~lib/memory.ts:145:14 + (i32.load + ;;@ ~lib/memory.ts:145:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:145:30 + (i32.const 15) + ) + ) + ) + ;;@ ~lib/memory.ts:146:10 + (i32.store + ;;@ ~lib/memory.ts:146:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:146:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:146:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:146:37 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:146:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:146:46 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:147:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:147:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:147:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:147:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:147:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:147:38 + (i32.const 16) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:149:8 + (br $break|2) + ) + ) + ) + ;;@ ~lib/memory.ts:155:2 + (if + ;;@ ~lib/memory.ts:155:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:155:10 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:155:14 + (block + ;;@ ~lib/memory.ts:156:4 + (i32.store8 + ;;@ ~lib/memory.ts:156: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:156:22 + (i32.load8_u + ;;@ ~lib/memory.ts:156: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:157:4 + (i32.store8 + ;;@ ~lib/memory.ts:157: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:157:22 + (i32.load8_u + ;;@ ~lib/memory.ts:157: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:158:4 + (i32.store8 + ;;@ ~lib/memory.ts:158: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:158:22 + (i32.load8_u + ;;@ ~lib/memory.ts:158: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:159:4 + (i32.store8 + ;;@ ~lib/memory.ts:159: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:159:22 + (i32.load8_u + ;;@ ~lib/memory.ts:159: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:160:4 + (i32.store8 + ;;@ ~lib/memory.ts:160: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:160:22 + (i32.load8_u + ;;@ ~lib/memory.ts:160: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:161:4 + (i32.store8 + ;;@ ~lib/memory.ts:161: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:161:22 + (i32.load8_u + ;;@ ~lib/memory.ts:161: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:162:4 + (i32.store8 + ;;@ ~lib/memory.ts:162: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:162:22 + (i32.load8_u + ;;@ ~lib/memory.ts:162: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:163:4 + (i32.store8 + ;;@ ~lib/memory.ts:163: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:163:22 + (i32.load8_u + ;;@ ~lib/memory.ts:163: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:164:4 + (i32.store8 + ;;@ ~lib/memory.ts:164: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:164:22 + (i32.load8_u + ;;@ ~lib/memory.ts:164: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: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 + (i32.store8 + ;;@ ~lib/memory.ts:166: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:166:22 + (i32.load8_u + ;;@ ~lib/memory.ts:166: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:167:4 + (i32.store8 + ;;@ ~lib/memory.ts:167: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:167:22 + (i32.load8_u + ;;@ ~lib/memory.ts:167: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:168:4 + (i32.store8 + ;;@ ~lib/memory.ts:168: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:168:22 + (i32.load8_u + ;;@ ~lib/memory.ts:168: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:169:4 + (i32.store8 + ;;@ ~lib/memory.ts:169: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:169:22 + (i32.load8_u + ;;@ ~lib/memory.ts:169: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:170:4 + (i32.store8 + ;;@ ~lib/memory.ts:170: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:170:22 + (i32.load8_u + ;;@ ~lib/memory.ts:170: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:171:4 + (i32.store8 + ;;@ ~lib/memory.ts:171: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:171:22 + (i32.load8_u + ;;@ ~lib/memory.ts:171: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:173:2 + (if + ;;@ ~lib/memory.ts:173:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:173:10 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:173:13 + (block + ;;@ ~lib/memory.ts:174:4 + (i32.store8 + ;;@ ~lib/memory.ts:174: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:174:22 + (i32.load8_u + ;;@ ~lib/memory.ts:174: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:175:4 + (i32.store8 + ;;@ ~lib/memory.ts:175: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:175:22 + (i32.load8_u + ;;@ ~lib/memory.ts:175: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:176:4 + (i32.store8 + ;;@ ~lib/memory.ts:176: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:176:22 + (i32.load8_u + ;;@ ~lib/memory.ts:176: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:177:4 + (i32.store8 + ;;@ ~lib/memory.ts:177: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:177:22 + (i32.load8_u + ;;@ ~lib/memory.ts:177: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:178:4 + (i32.store8 + ;;@ ~lib/memory.ts:178: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:178:22 + (i32.load8_u + ;;@ ~lib/memory.ts:178: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:179:4 + (i32.store8 + ;;@ ~lib/memory.ts:179: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:179:22 + (i32.load8_u + ;;@ ~lib/memory.ts:179: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:180:4 + (i32.store8 + ;;@ ~lib/memory.ts:180: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:180:22 + (i32.load8_u + ;;@ ~lib/memory.ts:180: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:181:4 + (i32.store8 + ;;@ ~lib/memory.ts:181: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:181:22 + (i32.load8_u + ;;@ ~lib/memory.ts:181: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:183:2 + (if + ;;@ ~lib/memory.ts:183:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:183:10 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:183:13 + (block + ;;@ ~lib/memory.ts:184:4 + (i32.store8 + ;;@ ~lib/memory.ts:184: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:184:22 + (i32.load8_u + ;;@ ~lib/memory.ts:184: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:185:4 + (i32.store8 + ;;@ ~lib/memory.ts:185: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:185:22 + (i32.load8_u + ;;@ ~lib/memory.ts:185: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:186:4 + (i32.store8 + ;;@ ~lib/memory.ts:186: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:186:22 + (i32.load8_u + ;;@ ~lib/memory.ts:186: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:187:4 + (i32.store8 + ;;@ ~lib/memory.ts:187: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:187:22 + (i32.load8_u + ;;@ ~lib/memory.ts:187: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:189:2 + (if + ;;@ ~lib/memory.ts:189:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:189:10 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:189:13 + (block + ;;@ ~lib/memory.ts:190:4 + (i32.store8 + ;;@ ~lib/memory.ts:190: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:190:22 + (i32.load8_u + ;;@ ~lib/memory.ts:190: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:191:4 + (i32.store8 + ;;@ ~lib/memory.ts:191: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:191:22 + (i32.load8_u + ;;@ ~lib/memory.ts:191: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:193:2 + (if + ;;@ ~lib/memory.ts:193:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:193:10 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:193:13 + (i32.store8 + ;;@ ~lib/memory.ts:194: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:194:22 + (i32.load8_u + ;;@ ~lib/memory.ts:194: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/memmove (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + ;;@ ~lib/memory.ts:200:2 + (if + ;;@ ~lib/memory.ts:200:6 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:200:14 + (get_local $1) + ) + ;;@ ~lib/memory.ts:200:19 + (return) + ) + ;;@ ~lib/memory.ts:201:2 + (if + ;;@ ~lib/memory.ts:201:6 + (if (result i32) + (tee_local $3 + (i32.le_u + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:201:12 + (get_local $2) + ) + ;;@ ~lib/memory.ts:201:17 + (get_local $0) + ) + ) + (get_local $3) + ;;@ ~lib/memory.ts:201:25 + (i32.le_u + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:201:32 + (get_local $2) + ) + ;;@ ~lib/memory.ts:201:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:201:42 + (block + ;;@ ~lib/memory.ts:202:4 + (call $~lib/memory/memcpy + ;;@ ~lib/memory.ts:202:11 + (get_local $0) + ;;@ ~lib/memory.ts:202:17 + (get_local $1) + ;;@ ~lib/memory.ts:202:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:203:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:205:2 + (if + ;;@ ~lib/memory.ts:205:6 + (i32.lt_u + (get_local $0) + ;;@ ~lib/memory.ts:205:13 + (get_local $1) + ) + ;;@ ~lib/memory.ts:205:18 + (block + ;;@ ~lib/memory.ts:206:4 + (if + ;;@ ~lib/memory.ts:206:8 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:206:9 + (get_local $1) + ;;@ ~lib/memory.ts:206:15 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:206:21 + (i32.and + ;;@ ~lib/memory.ts:206:22 + (get_local $0) + ;;@ ~lib/memory.ts:206:29 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:206:33 + (block + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:207:13 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:207:20 + (i32.const 7) + ) + (block + (block + ;;@ ~lib/memory.ts:208:8 + (if + ;;@ ~lib/memory.ts:208:12 + (i32.eqz + ;;@ ~lib/memory.ts:208:13 + (get_local $2) + ) + ;;@ ~lib/memory.ts:208:16 + (return) + ) + ;;@ ~lib/memory.ts:209:8 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:209:10 + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:210:8 + (i32.store8 + ;;@ ~lib/memory.ts:210: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:210:26 + (i32.load8_u + ;;@ ~lib/memory.ts:210:35 + (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:212:6 + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:212:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:212:18 + (i32.const 8) + ) + (block + (block + ;;@ ~lib/memory.ts:213:8 + (i64.store + ;;@ ~lib/memory.ts:213:19 + (get_local $0) + ;;@ ~lib/memory.ts:213:25 + (i64.load + ;;@ ~lib/memory.ts:213:35 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:214:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:214:16 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:215:8 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:215:16 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:216:8 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:216:16 + (i32.const 8) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:219:4 + (block $break|2 + (loop $continue|2 + (if + ;;@ ~lib/memory.ts:219:11 + (get_local $2) + (block + (block + ;;@ ~lib/memory.ts:220:6 + (i32.store8 + ;;@ ~lib/memory.ts:220:16 + (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:220:24 + (i32.load8_u + ;;@ ~lib/memory.ts:220:33 + (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:221:6 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:221:8 + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|2) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:223:9 + (block + ;;@ ~lib/memory.ts:224:4 + (if + ;;@ ~lib/memory.ts:224:8 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:224:9 + (get_local $1) + ;;@ ~lib/memory.ts:224:15 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:224:21 + (i32.and + ;;@ ~lib/memory.ts:224:22 + (get_local $0) + ;;@ ~lib/memory.ts:224:29 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:224:33 + (block + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:225:13 + (i32.and + (i32.add + ;;@ ~lib/memory.ts:225:14 + (get_local $0) + ;;@ ~lib/memory.ts:225:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:225:26 + (i32.const 7) + ) + (block + (block + ;;@ ~lib/memory.ts:226:8 + (if + ;;@ ~lib/memory.ts:226:12 + (i32.eqz + ;;@ ~lib/memory.ts:226:13 + (get_local $2) + ) + ;;@ ~lib/memory.ts:226:16 + (return) + ) + ;;@ ~lib/memory.ts:227:8 + (i32.store8 + ;;@ ~lib/memory.ts:227:18 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:227:25 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:227:27 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:227:30 + (i32.load8_u + ;;@ ~lib/memory.ts:227:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:227:45 + (get_local $2) + ) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:229:6 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:229:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:229:18 + (i32.const 8) + ) + (block + (block + ;;@ ~lib/memory.ts:230:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:230:13 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:231:8 + (i64.store + ;;@ ~lib/memory.ts:231:19 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:231:26 + (get_local $2) + ) + ;;@ ~lib/memory.ts:231:29 + (i64.load + ;;@ ~lib/memory.ts:231:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:231:45 + (get_local $2) + ) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:234:4 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:234:11 + (get_local $2) + (block + ;;@ ~lib/memory.ts:234:14 + (i32.store8 + ;;@ ~lib/memory.ts:235:16 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:235:23 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:235:25 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:235:28 + (i32.load8_u + ;;@ ~lib/memory.ts:235:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:235:43 + (get_local $2) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.copy (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/memory.ts:16:4 + (call $~lib/memory/memmove + ;;@ ~lib/memory.ts:16:12 + (get_local $0) + ;;@ ~lib/memory.ts:16:18 + (get_local $1) + ;;@ ~lib/memory.ts:16:23 + (get_local $2) + ) + ) + (func $~lib/memory/memcmp (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + ;;@ ~lib/memory.ts:302:2 + (if + ;;@ ~lib/memory.ts:302:6 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:302:12 + (get_local $1) + ) + ;;@ ~lib/memory.ts:302:23 + (return + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:303:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:303:9 + (if (result i32) + (tee_local $3 + (i32.ne + (get_local $2) + ;;@ ~lib/memory.ts:303:14 + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:303:19 + (i32.eq + (i32.load8_u + ;;@ ~lib/memory.ts:303:28 + (get_local $0) + ) + ;;@ ~lib/memory.ts:303:35 + (i32.load8_u + ;;@ ~lib/memory.ts:303:44 + (get_local $1) + ) + ) + (get_local $3) + ) + (block + (block + ;;@ ~lib/memory.ts:304:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:304:9 + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:304:15 + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:306:53 + (if (result i32) + ;;@ ~lib/memory.ts:306:9 + (get_local $2) + ;;@ ~lib/memory.ts:306:13 + (i32.sub + (i32.load8_u + ;;@ ~lib/memory.ts:306:27 + (get_local $0) + ) + ;;@ ~lib/memory.ts:306:33 + (i32.load8_u + ;;@ ~lib/memory.ts:306:47 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:306:53 + (i32.const 0) + ) + ) + (func $~lib/memory/memory.compare (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + ;;@ ~lib/memory.ts:21:27 + (call $~lib/memory/memcmp + ;;@ ~lib/memory.ts:21:18 + (get_local $0) + ;;@ ~lib/memory.ts:21:22 + (get_local $1) + ;;@ ~lib/memory.ts:21:26 + (get_local $2) + ) + ) + (func $~lib/allocator/buddy/update_max_ptr (; 8 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:175:2 @@ -65,7 +3394,7 @@ (i32.const -1) ) ) - ;;@ ~lib/allocator/buddy.ts:180:61 + ;;@ ~lib/allocator/buddy.ts:180:62 (i32.const 16) ) ) @@ -73,7 +3402,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,6 +3422,7 @@ (if ;;@ ~lib/allocator/buddy.ts:182:8 (i32.lt_s + ;;@ ~lib/allocator/buddy.ts:182:15 (grow_memory ;;@ ~lib/allocator/buddy.ts:182:20 (i32.sub @@ -124,7 +3454,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 (; 9 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:101:2 (if (i32.eqz @@ -132,7 +3462,7 @@ (i32.lt_u (get_local $0) ;;@ ~lib/allocator/buddy.ts:101:17 - (i32.const 27) + (get_global $~lib/allocator/buddy/BUCKET_COUNT) ) ) (block @@ -153,11 +3483,11 @@ (i32.mul (get_local $0) ;;@ ~lib/allocator/buddy.ts:102:50 - (i32.const 8) + (get_global $~lib/allocator/buddy/List.SIZE) ) ) ) - (func $~lib/allocator/buddy/list_init (; 3 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/buddy/list_init (; 10 ;) (type $iv) (param $0 i32) ;;@ ~lib/allocator/buddy.ts:197:2 (i32.store (get_local $0) @@ -171,7 +3501,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 (; 11 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:206:2 (set_local $2 @@ -205,14 +3535,14 @@ (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 (; 12 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:279:2 (set_local $1 ;;@ ~lib/allocator/buddy.ts:279:15 (i32.sub - (i32.const 27) + (get_global $~lib/allocator/buddy/BUCKET_COUNT) ;;@ ~lib/allocator/buddy.ts:279:30 (i32.const 1) ) @@ -220,7 +3550,7 @@ ;;@ ~lib/allocator/buddy.ts:280:2 (set_local $2 ;;@ ~lib/allocator/buddy.ts:280:13 - (i32.const 16) + (get_global $~lib/allocator/buddy/MIN_ALLOC) ) ;;@ ~lib/allocator/buddy.ts:282:2 (block $break|0 @@ -258,7 +3588,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 (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:252:75 (i32.sub ;;@ ~lib/allocator/buddy.ts:252:9 @@ -274,7 +3604,7 @@ ;;@ ~lib/allocator/buddy.ts:252:30 (i32.sub ;;@ ~lib/allocator/buddy.ts:252:31 - (i32.const 30) + (get_global $~lib/allocator/buddy/MAX_ALLOC_LOG2) ;;@ ~lib/allocator/buddy.ts:252:48 (get_local $1) ) @@ -291,7 +3621,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 (; 14 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:147:2 (if (i32.eqz @@ -299,7 +3629,7 @@ (i32.lt_u (get_local $0) ;;@ ~lib/allocator/buddy.ts:147:17 - (i32.const 8388608) + (get_global $~lib/allocator/buddy/SPLIT_COUNT) ) ) (block @@ -322,7 +3652,7 @@ ) ) ) - (func $~lib/allocator/buddy/parent_is_split (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/parent_is_split (; 15 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:259:2 (set_local $0 ;;@ ~lib/allocator/buddy.ts:259:10 @@ -367,7 +3697,7 @@ (i32.const 1) ) ) - (func $~lib/allocator/buddy/list_remove (; 9 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/buddy/list_remove (; 16 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:220:2 @@ -397,7 +3727,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 (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) ;;@ ~lib/allocator/buddy.ts:243:77 (i32.add ;;@ ~lib/allocator/buddy.ts:243:9 @@ -423,14 +3753,14 @@ ;;@ ~lib/allocator/buddy.ts:243:52 (i32.sub ;;@ ~lib/allocator/buddy.ts:243:53 - (i32.const 30) + (get_global $~lib/allocator/buddy/MAX_ALLOC_LOG2) ;;@ ~lib/allocator/buddy.ts:243:70 (get_local $1) ) ) ) ) - (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 (; 18 ;) (type $iiv) (param $0 i32) (param $1 i32) ;;@ ~lib/allocator/buddy.ts:152:2 (if (i32.eqz @@ -438,7 +3768,7 @@ (i32.lt_u (get_local $0) ;;@ ~lib/allocator/buddy.ts:152:17 - (i32.const 8388608) + (get_global $~lib/allocator/buddy/SPLIT_COUNT) ) ) (block @@ -463,7 +3793,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 (; 19 ;) (type $iv) (param $0 i32) (local $1 i32) ;;@ ~lib/allocator/buddy.ts:267:2 (set_local $0 @@ -513,7 +3843,7 @@ ) ) ) - (func $~lib/allocator/buddy/lower_bucket_limit (; 13 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/buddy/lower_bucket_limit (; 20 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) ;;@ ~lib/allocator/buddy.ts:296:2 @@ -610,7 +3940,7 @@ (i32.add (get_local $2) ;;@ ~lib/allocator/buddy.ts:322:38 - (i32.const 8) + (get_global $~lib/allocator/buddy/List.SIZE) ) ) ) @@ -684,7 +4014,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 (; 21 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) ;;@ ~lib/allocator/buddy.ts:230:2 (set_local $1 @@ -714,7 +4044,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 (; 22 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -729,9 +4059,9 @@ (get_local $0) ;;@ ~lib/allocator/buddy.ts:350:16 (i32.sub - (i32.const 1073741824) + (get_global $~lib/allocator/buddy/MAX_ALLOC) ;;@ ~lib/allocator/buddy.ts:350:28 - (i32.const 8) + (get_global $~lib/allocator/buddy/HEADER_SIZE) ) ) ;;@ ~lib/allocator/buddy.ts:350:41 @@ -770,7 +4100,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) ) ) @@ -778,7 +4108,7 @@ (set_global $~lib/allocator/buddy/bucket_limit ;;@ ~lib/allocator/buddy.ts:361:19 (i32.sub - (i32.const 27) + (get_global $~lib/allocator/buddy/BUCKET_COUNT) ;;@ ~lib/allocator/buddy.ts:361:34 (i32.const 1) ) @@ -793,7 +4123,7 @@ (i32.add (get_global $~lib/allocator/buddy/base_ptr) ;;@ ~lib/allocator/buddy.ts:362:35 - (i32.const 8) + (get_global $~lib/allocator/buddy/List.SIZE) ) ) ) @@ -809,7 +4139,7 @@ (call $~lib/allocator/buddy/buckets$get ;;@ ~lib/allocator/buddy.ts:365:26 (i32.sub - (i32.const 27) + (get_global $~lib/allocator/buddy/BUCKET_COUNT) ;;@ ~lib/allocator/buddy.ts:365:41 (i32.const 1) ) @@ -821,7 +4151,7 @@ (call $~lib/allocator/buddy/buckets$get ;;@ ~lib/allocator/buddy.ts:366:26 (i32.sub - (i32.const 27) + (get_global $~lib/allocator/buddy/BUCKET_COUNT) ;;@ ~lib/allocator/buddy.ts:366:41 (i32.const 1) ) @@ -839,7 +4169,7 @@ (i32.add (get_local $0) ;;@ ~lib/allocator/buddy.ts:373:40 - (i32.const 8) + (get_global $~lib/allocator/buddy/HEADER_SIZE) ) ) ) @@ -973,7 +4303,7 @@ ;;@ ~lib/allocator/buddy.ts:425:16 (i32.sub ;;@ ~lib/allocator/buddy.ts:425:17 - (i32.const 30) + (get_global $~lib/allocator/buddy/MAX_ALLOC_LOG2) ;;@ ~lib/allocator/buddy.ts:425:34 (get_local $2) ) @@ -996,7 +4326,7 @@ (i32.const 2) ) ;;@ ~lib/allocator/buddy.ts:426:57 - (i32.const 8) + (get_global $~lib/allocator/buddy/List.SIZE) ) ;;@ ~lib/allocator/buddy.ts:426:69 (get_local $3) @@ -1133,7 +4463,7 @@ (i32.add (get_local $6) ;;@ ~lib/allocator/buddy.ts:470:17 - (i32.const 8) + (get_global $~lib/allocator/buddy/HEADER_SIZE) ) ) ) @@ -1143,7 +4473,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 (; 23 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:37:4 + (return + ;;@ ~lib/memory.ts:37:45 + (call $~lib/allocator/buddy/__memory_allocate + ;;@ ~lib/memory.ts:37:63 + (get_local $0) + ) + ) + ) + (func $~lib/allocator/buddy/__memory_free (; 24 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -1163,7 +4503,7 @@ (i32.sub (get_local $0) ;;@ ~lib/allocator/buddy.ts:492:14 - (i32.const 8) + (get_global $~lib/allocator/buddy/HEADER_SIZE) ) ) ;;@ ~lib/allocator/buddy.ts:493:2 @@ -1177,7 +4517,7 @@ (get_local $0) ) ;;@ ~lib/allocator/buddy.ts:493:49 - (i32.const 8) + (get_global $~lib/allocator/buddy/HEADER_SIZE) ) ) ) @@ -1296,7 +4636,26 @@ ) ) ) - (func $start (; 17 ;) (type $v) + (func $~lib/memory/memory.free (; 25 ;) (type $iv) (param $0 i32) + ;;@ ~lib/memory.ts:43:36 + (call $~lib/allocator/buddy/__memory_free + ;;@ ~lib/memory.ts:43:50 + (get_local $0) + ) + ;;@ ~lib/memory.ts:43:56 + (return) + ) + (func $~lib/allocator/buddy/__memory_reset (; 26 ;) (type $v) + ;;@ ~lib/allocator/buddy.ts:544:2 + (unreachable) + ) + (func $~lib/memory/memory.reset (; 27 ;) (type $v) + ;;@ ~lib/memory.ts:49:37 + (call $~lib/allocator/buddy/__memory_reset) + ;;@ ~lib/memory.ts:49:55 + (return) + ) + (func $start (; 28 ;) (type $v) (set_global $~lib/allocator/buddy/BUCKETS_START ;;@ ~lib/allocator/buddy.ts:97:27 (get_global $HEAP_BASE) @@ -1307,9 +4666,9 @@ (get_global $~lib/allocator/buddy/BUCKETS_START) ;;@ ~lib/allocator/buddy.ts:98:41 (i32.mul - (i32.const 27) + (get_global $~lib/allocator/buddy/BUCKET_COUNT) ;;@ ~lib/allocator/buddy.ts:98:56 - (i32.const 8) + (get_global $~lib/allocator/buddy/List.SIZE) ) ) ) @@ -1323,7 +4682,7 @@ (get_global $~lib/allocator/buddy/NODE_IS_SPLIT_START) ;;@ ~lib/allocator/buddy.ts:144:53 (i32.mul - (i32.const 8388608) + (get_global $~lib/allocator/buddy/SPLIT_COUNT) ;;@ ~lib/allocator/buddy.ts:144:67 (i32.const 1) ) 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..33eb34d5 100644 --- a/tests/allocators/tlsf/optimized.wat +++ b/tests/allocators/tlsf/optimized.wat @@ -1,18 +1,3043 @@ (module + (type $iiiv (func (param i32 i32 i32))) + (type $iiii (func (param i32 i32 i32) (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 $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" (memory $0)) - (func $~lib/allocator/tlsf/Root#set:tailRef (; 0 ;) (type $iiv) (param $0 i32) (param $1 i32) + (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)) + (func $~lib/memory/memset (; 0 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i64) + (local $4 i32) + ;;@ ~lib/memory.ts:244:2 + (if + ;;@ ~lib/memory.ts:244:6 + (i32.eqz + ;;@ ~lib/memory.ts:244:7 + (get_local $2) + ) + ;;@ ~lib/memory.ts:244:10 + (return) + ) + ;;@ ~lib/memory.ts:245:2 + (i32.store8 + ;;@ ~lib/memory.ts:245:12 + (get_local $0) + ;;@ ~lib/memory.ts:245:18 + (get_local $1) + ) + ;;@ ~lib/memory.ts:246:2 + (i32.store8 + ;;@ ~lib/memory.ts:246:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:246:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:246:23 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:246:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:247:2 + (if + ;;@ ~lib/memory.ts:247:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:247:11 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:247:14 + (return) + ) + ;;@ ~lib/memory.ts:249:2 + (i32.store8 + ;;@ ~lib/memory.ts:249:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:249:19 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:249:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:250:2 + (i32.store8 + ;;@ ~lib/memory.ts:250:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:250:19 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:250:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:251:2 + (i32.store8 + ;;@ ~lib/memory.ts:251:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:251:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:251:23 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:251:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:252:2 + (i32.store8 + ;;@ ~lib/memory.ts:252:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:252:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:252:23 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:252:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:253:2 + (if + ;;@ ~lib/memory.ts:253:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:253:11 + (i32.const 6) + ) + ;;@ ~lib/memory.ts:253:14 + (return) + ) + ;;@ ~lib/memory.ts:254:2 + (i32.store8 + ;;@ ~lib/memory.ts:254:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:254:19 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:254:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:255:2 + (i32.store8 + ;;@ ~lib/memory.ts:255:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:255:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:255:23 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:255:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:256:2 + (if + ;;@ ~lib/memory.ts:256:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:256:11 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:256:14 + (return) + ) + ;;@ ~lib/memory.ts:267:2 + (i32.store + ;;@ ~lib/memory.ts:260:2 + (tee_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:259:2 + (tee_local $4 + ;;@ ~lib/memory.ts:259:17 + (i32.and + (i32.sub + (i32.const 0) + ;;@ ~lib/memory.ts:259:18 + (get_local $0) + ) + ;;@ ~lib/memory.ts:259:25 + (i32.const 3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:264:2 + (tee_local $1 + ;;@ ~lib/memory.ts:264:17 + (i32.mul + (i32.and + ;;@ ~lib/memory.ts:264:33 + (get_local $1) + (i32.const 255) + ) + (i32.const 16843009) + ) + ) + ) + ;;@ ~lib/memory.ts:268:2 + (i32.store + ;;@ ~lib/memory.ts:268:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:262:2 + (tee_local $2 + (i32.and + (i32.sub + ;;@ ~lib/memory.ts:261:2 + (get_local $2) + ;;@ ~lib/memory.ts:261:7 + (get_local $4) + ) + ;;@ ~lib/memory.ts:262:7 + (i32.const -4) + ) + ) + ) + ;;@ ~lib/memory.ts:268:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:268:27 + (get_local $1) + ) + ;;@ ~lib/memory.ts:269:2 + (if + ;;@ ~lib/memory.ts:269:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:269:11 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:269:14 + (return) + ) + ;;@ ~lib/memory.ts:270:2 + (i32.store + ;;@ ~lib/memory.ts:270:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:270:20 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:270:23 + (get_local $1) + ) + ;;@ ~lib/memory.ts:271:2 + (i32.store + ;;@ ~lib/memory.ts:271:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:271:20 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:271:23 + (get_local $1) + ) + ;;@ ~lib/memory.ts:272:2 + (i32.store + ;;@ ~lib/memory.ts:272:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:272:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:272:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:272:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:273:2 + (i32.store + ;;@ ~lib/memory.ts:273:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:273:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:273:24 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:273:27 + (get_local $1) + ) + ;;@ ~lib/memory.ts:274:2 + (if + ;;@ ~lib/memory.ts:274:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:274:11 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:274:15 + (return) + ) + ;;@ ~lib/memory.ts:275:2 + (i32.store + ;;@ ~lib/memory.ts:275:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:275:20 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:275:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:276:2 + (i32.store + ;;@ ~lib/memory.ts:276:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:276:20 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:276:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:277:2 + (i32.store + ;;@ ~lib/memory.ts:277:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:277:20 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:277:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:278:2 + (i32.store + ;;@ ~lib/memory.ts:278:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:278:20 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:278:24 + (get_local $1) + ) + ;;@ ~lib/memory.ts:279:2 + (i32.store + ;;@ ~lib/memory.ts:279:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:279:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:279:24 + (i32.const 28) + ) + ;;@ ~lib/memory.ts:279:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:280:2 + (i32.store + ;;@ ~lib/memory.ts:280:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:280:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:280:24 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:280:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:281:2 + (i32.store + ;;@ ~lib/memory.ts:281:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:281:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:281:24 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:281:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:282:2 + (i32.store + ;;@ ~lib/memory.ts:282:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:282:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:282:24 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:282:28 + (get_local $1) + ) + ;;@ ~lib/memory.ts:286:2 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:285:2 + (tee_local $4 + ;;@ ~lib/memory.ts:285:6 + (i32.add + ;;@ ~lib/memory.ts:285:11 + (i32.and + ;;@ ~lib/memory.ts:285:12 + (get_local $0) + ;;@ ~lib/memory.ts:285:19 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:285:6 + (i32.const 24) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:287:2 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:287:7 + (get_local $4) + ) + ) + ;;@ ~lib/memory.ts:290:2 + (set_local $3 + ;;@ ~lib/memory.ts:290:17 + (i64.or + (i64.extend_u/i32 + (get_local $1) + ) + ;;@ ~lib/memory.ts:290:28 + (i64.shl + ;;@ ~lib/memory.ts:290:29 + (i64.extend_u/i32 + (get_local $1) + ) + ;;@ ~lib/memory.ts:290:41 + (i64.const 32) + ) + ) + ) + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:291:9 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:291:14 + (i32.const 32) + ) + (block + ;;@ ~lib/memory.ts:292:4 + (i64.store + ;;@ ~lib/memory.ts:292:15 + (get_local $0) + ;;@ ~lib/memory.ts:292:21 + (get_local $3) + ) + ;;@ ~lib/memory.ts:293:4 + (i64.store + ;;@ ~lib/memory.ts:293:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:293:22 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:293:25 + (get_local $3) + ) + ;;@ ~lib/memory.ts:294:4 + (i64.store + ;;@ ~lib/memory.ts:294:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:294:22 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:294:26 + (get_local $3) + ) + ;;@ ~lib/memory.ts:295:4 + (i64.store + ;;@ ~lib/memory.ts:295:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:295:22 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:295:26 + (get_local $3) + ) + ;;@ ~lib/memory.ts:296:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:296:9 + (i32.const 32) + ) + ) + ;;@ ~lib/memory.ts:297:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:297:12 + (i32.const 32) + ) + ) + (br $continue|0) + ) + ) + ) + ) + (func $~lib/memory/memory.fill (; 1 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/memory.ts:11:4 + (call $~lib/memory/memset + ;;@ ~lib/memory.ts:11:11 + (get_local $0) + ;;@ ~lib/memory.ts:11:17 + (get_local $1) + ;;@ ~lib/memory.ts:11:20 + (get_local $2) + ) + ) + (func $~lib/memory/memcpy (; 2 ;) (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:59:14 + (i32.and + ;;@ ~lib/memory.ts:59:15 + (get_local $1) + ;;@ ~lib/memory.ts:59:21 + (i32.const 3) + ) + (get_local $2) + ;;@ ~lib/memory.ts:59:9 + (get_local $2) + ) + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:60:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:60:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:60:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:60:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:61:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ;;@ ~lib/memory.ts:65:2 + (if + (i32.eqz + ;;@ ~lib/memory.ts:65:6 + (i32.and + ;;@ ~lib/memory.ts:65:7 + (get_local $0) + ;;@ ~lib/memory.ts:65:14 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:65:23 + (block + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:66:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:66:16 + (i32.const 16) + ) + (block + ;;@ ~lib/memory.ts:67:6 + (i32.store + ;;@ ~lib/memory.ts:67:17 + (get_local $0) + ;;@ ~lib/memory.ts:67:28 + (i32.load + ;;@ ~lib/memory.ts:67:38 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:68:6 + (i32.store + ;;@ ~lib/memory.ts:68:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:68:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:68:28 + (i32.load + ;;@ ~lib/memory.ts:68:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:68:45 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:69:6 + (i32.store + ;;@ ~lib/memory.ts:69:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:69:25 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:69:28 + (i32.load + ;;@ ~lib/memory.ts:69:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:69:45 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:70:6 + (i32.store + ;;@ ~lib/memory.ts:70:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:70:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:70:28 + (i32.load + ;;@ ~lib/memory.ts:70:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:70:44 + (i32.const 12) + ) + ) + ) + ;;@ ~lib/memory.ts:71:6 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:71:13 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:71:17 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:71:25 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:71:29 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:71:34 + (i32.const 16) + ) + ) + (br $continue|1) + ) + ) + ) + ;;@ ~lib/memory.ts:73:4 + (if + ;;@ ~lib/memory.ts:73:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:73:12 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:73:15 + (block + ;;@ ~lib/memory.ts:74:6 + (i32.store + ;;@ ~lib/memory.ts:74:17 + (get_local $0) + ;;@ ~lib/memory.ts:74:27 + (i32.load + ;;@ ~lib/memory.ts:74:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:75:6 + (i32.store + ;;@ ~lib/memory.ts:75:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:75:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:75:27 + (i32.load + ;;@ ~lib/memory.ts:75:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:75:43 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:76:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:76:14 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:76:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:76:24 + (i32.const 8) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:78:4 + (if + ;;@ ~lib/memory.ts:78:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:78:12 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:78:15 + (block + ;;@ ~lib/memory.ts:79:6 + (i32.store + ;;@ ~lib/memory.ts:79:17 + (get_local $0) + ;;@ ~lib/memory.ts:79:23 + (i32.load + ;;@ ~lib/memory.ts:79:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:80:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:80:14 + (i32.const 4) + ) + ) + ;;@ ~lib/memory.ts:80:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:80:24 + (i32.const 4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:82:4 + (if + ;;@ ~lib/memory.ts:82:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:82:12 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:82:15 + (block + ;;@ ~lib/memory.ts:83:6 + (i32.store16 + ;;@ ~lib/memory.ts:83:17 + (get_local $0) + ;;@ ~lib/memory.ts:83:23 + (i32.load16_u + ;;@ ~lib/memory.ts:83:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:84:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:84:14 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:84:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:84:24 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:86:4 + (if + ;;@ ~lib/memory.ts:86:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:86:12 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:87:16 + (block + (set_local $3 + (get_local $0) + ) + ;;@ ~lib/memory.ts:86:15 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:87:33 + (block (result i32) + (set_local $3 + (get_local $1) + ) + ;;@ ~lib/memory.ts:87:24 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:89:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:94:2 + (if + ;;@ ~lib/memory.ts:94:6 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:94:11 + (i32.const 32) + ) + ;;@ ~lib/memory.ts:94: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:95:12 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:95:19 + (i32.const 3) + ) + (i32.const 1) + ) + ) + ) + (br $break|2) + ) + ;;@ ~lib/memory.ts:98:8 + (set_local $4 + ;;@ ~lib/memory.ts:98:12 + (i32.load + ;;@ ~lib/memory.ts:98:22 + (get_local $1) + ) + ) + (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) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:100:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:100:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:100:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:100:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:101:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:101:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:101:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:101:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:102:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:102:13 + (i32.const 3) + ) + ) + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:103:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:103:20 + (i32.const 17) + ) + (block + ;;@ ~lib/memory.ts:105:10 + (i32.store + ;;@ ~lib/memory.ts:105:21 + (get_local $0) + ;;@ ~lib/memory.ts:105:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:105:32 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:105:37 + (i32.shl + ;;@ ~lib/memory.ts:104:10 + (tee_local $3 + ;;@ ~lib/memory.ts:104:14 + (i32.load + ;;@ ~lib/memory.ts:104:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:104:30 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:105:42 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:107:10 + (i32.store + ;;@ ~lib/memory.ts:107:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:107:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:107:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:107:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:107:41 + (i32.shl + ;;@ ~lib/memory.ts:106:10 + (tee_local $4 + ;;@ ~lib/memory.ts:106:14 + (i32.load + ;;@ ~lib/memory.ts:106:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:106:30 + (i32.const 5) + ) + ) + ) + ;;@ ~lib/memory.ts:107:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:109:10 + (i32.store + ;;@ ~lib/memory.ts:109:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:109:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:109:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:109:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:109:41 + (i32.shl + ;;@ ~lib/memory.ts:108:10 + (tee_local $3 + ;;@ ~lib/memory.ts:108:14 + (i32.load + ;;@ ~lib/memory.ts:108:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:108:30 + (i32.const 9) + ) + ) + ) + ;;@ ~lib/memory.ts:109:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:111:10 + (i32.store + ;;@ ~lib/memory.ts:111:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:111:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:111:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:111:37 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:111:42 + (i32.shl + ;;@ ~lib/memory.ts:110:10 + (tee_local $4 + ;;@ ~lib/memory.ts:110:14 + (i32.load + ;;@ ~lib/memory.ts:110:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:110:30 + (i32.const 13) + ) + ) + ) + ;;@ ~lib/memory.ts:111:47 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:112:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:112:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:112:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:112:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:112:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:112:38 + (i32.const 16) + ) + ) + (br $continue|3) + ) + ) + ) + ;;@ ~lib/memory.ts:114:8 + (br $break|2) + ) + ;;@ ~lib/memory.ts:117:8 + (set_local $4 + ;;@ ~lib/memory.ts:117:12 + (i32.load + ;;@ ~lib/memory.ts:117:22 + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:118:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:118:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:118:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:118:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:119:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:119:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:119:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:119:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:120:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:120:13 + (i32.const 2) + ) + ) + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:121:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:121:20 + (i32.const 18) + ) + (block + ;;@ ~lib/memory.ts:123:10 + (i32.store + ;;@ ~lib/memory.ts:123:21 + (get_local $0) + ;;@ ~lib/memory.ts:123:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:123:32 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:123:37 + (i32.shl + ;;@ ~lib/memory.ts:122:10 + (tee_local $3 + ;;@ ~lib/memory.ts:122:14 + (i32.load + ;;@ ~lib/memory.ts:122:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:122:30 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/memory.ts:123:42 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:125:10 + (i32.store + ;;@ ~lib/memory.ts:125:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:125:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:125:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:125:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:125:41 + (i32.shl + ;;@ ~lib/memory.ts:124:10 + (tee_local $4 + ;;@ ~lib/memory.ts:124:14 + (i32.load + ;;@ ~lib/memory.ts:124:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:124:30 + (i32.const 6) + ) + ) + ) + ;;@ ~lib/memory.ts:125:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:127:10 + (i32.store + ;;@ ~lib/memory.ts:127:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:127:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:127:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:127:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:127:41 + (i32.shl + ;;@ ~lib/memory.ts:126:10 + (tee_local $3 + ;;@ ~lib/memory.ts:126:14 + (i32.load + ;;@ ~lib/memory.ts:126:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:126:30 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/memory.ts:127:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:129:10 + (i32.store + ;;@ ~lib/memory.ts:129:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:129:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:129:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:129:37 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:129:42 + (i32.shl + ;;@ ~lib/memory.ts:128:10 + (tee_local $4 + ;;@ ~lib/memory.ts:128:14 + (i32.load + ;;@ ~lib/memory.ts:128:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:128:30 + (i32.const 14) + ) + ) + ) + ;;@ ~lib/memory.ts:129:47 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:130:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:130:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:130:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:130:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:130:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:130:38 + (i32.const 16) + ) + ) + (br $continue|4) + ) + ) + ) + ;;@ ~lib/memory.ts:132:8 + (br $break|2) + ) + ;;@ ~lib/memory.ts:135:8 + (set_local $4 + ;;@ ~lib/memory.ts:135:12 + (i32.load + ;;@ ~lib/memory.ts:135:22 + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:136:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:136:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:136:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:136:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:137:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:137:13 + (i32.const 1) + ) + ) + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:138:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:138:20 + (i32.const 19) + ) + (block + ;;@ ~lib/memory.ts:140:10 + (i32.store + ;;@ ~lib/memory.ts:140:21 + (get_local $0) + ;;@ ~lib/memory.ts:140:27 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:140:32 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:140:36 + (i32.shl + ;;@ ~lib/memory.ts:139:10 + (tee_local $3 + ;;@ ~lib/memory.ts:139:14 + (i32.load + ;;@ ~lib/memory.ts:139:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:139:30 + (i32.const 3) + ) + ) + ) + ;;@ ~lib/memory.ts:140:41 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:142:10 + (i32.store + ;;@ ~lib/memory.ts:142:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:142:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:142:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:142:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:142:40 + (i32.shl + ;;@ ~lib/memory.ts:141:10 + (tee_local $4 + ;;@ ~lib/memory.ts:141:14 + (i32.load + ;;@ ~lib/memory.ts:141:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:141:30 + (i32.const 7) + ) + ) + ) + ;;@ ~lib/memory.ts:142:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:144:10 + (i32.store + ;;@ ~lib/memory.ts:144:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:144:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:144:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:144:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:144:40 + (i32.shl + ;;@ ~lib/memory.ts:143:10 + (tee_local $3 + ;;@ ~lib/memory.ts:143:14 + (i32.load + ;;@ ~lib/memory.ts:143:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:143:30 + (i32.const 11) + ) + ) + ) + ;;@ ~lib/memory.ts:144:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:146:10 + (i32.store + ;;@ ~lib/memory.ts:146:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:146:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:146:32 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:146:37 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:146:41 + (i32.shl + ;;@ ~lib/memory.ts:145:10 + (tee_local $4 + ;;@ ~lib/memory.ts:145:14 + (i32.load + ;;@ ~lib/memory.ts:145:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:145:30 + (i32.const 15) + ) + ) + ) + ;;@ ~lib/memory.ts:146:46 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:147:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:147:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:147:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:147:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:147:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:147:38 + (i32.const 16) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:155:2 + (if + ;;@ ~lib/memory.ts:155:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:155:10 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:155:14 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:156:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:156:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:156:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:156:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:157:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:157:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:157:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:157:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:158:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:158:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:158:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:158:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:159:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:159:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:159:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:159:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:160:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:160:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:160:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:160:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:161:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:161:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:161:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:161:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:162:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:162:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:162:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:162:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:163:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:163:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:163:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:163:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:164:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:164:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:164:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:164:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (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) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:166:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:166:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:166:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:166:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:167:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:167:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:167:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:167:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:168:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:168:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:168:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:168:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:169:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:169:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:169:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:169:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:170:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:170:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:170:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:170:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:171:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:171:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:171:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:171:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:173:2 + (if + ;;@ ~lib/memory.ts:173:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:173:10 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:173:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:174:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:174:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:174:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:174:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:175:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:175:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:175:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:175:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:176:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:176:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:176:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:176:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:177:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:177:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:177:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:177:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:178:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:178:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:178:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:178:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:179:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:179:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:179:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:179:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:180:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:180:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:180:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:180:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:181:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:181:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:181:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:181:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:183:2 + (if + ;;@ ~lib/memory.ts:183:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:183:10 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:183:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:184:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:184:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:184:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:184:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:185:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:185:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:185:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:185:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:186:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:186:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:186:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:186:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:187:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:187:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:187:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:187:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:189:2 + (if + ;;@ ~lib/memory.ts:189:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:189:10 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:189:13 + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:190:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:190:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:190:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:190:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:191:14 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:191:4 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:191:31 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:191:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:193:2 + (if + ;;@ ~lib/memory.ts:193:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:193:10 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:194:14 + (block + (set_local $3 + (get_local $0) + ) + ;;@ ~lib/memory.ts:193:13 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:194:31 + (block (result i32) + (set_local $3 + (get_local $1) + ) + ;;@ ~lib/memory.ts:194:22 + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memmove (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + ;;@ ~lib/memory.ts:200:2 + (if + ;;@ ~lib/memory.ts:200:6 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:200:14 + (get_local $1) + ) + ;;@ ~lib/memory.ts:200:19 + (return) + ) + ;;@ ~lib/memory.ts:201:2 + (if + ;;@ ~lib/memory.ts:201:6 + (if (result i32) + (tee_local $3 + (i32.le_u + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:201:12 + (get_local $2) + ) + ;;@ ~lib/memory.ts:201:17 + (get_local $0) + ) + ) + (get_local $3) + ;;@ ~lib/memory.ts:201:25 + (i32.le_u + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:201:32 + (get_local $2) + ) + ;;@ ~lib/memory.ts:201:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:201:42 + (block + ;;@ ~lib/memory.ts:202:4 + (call $~lib/memory/memcpy + ;;@ ~lib/memory.ts:202:11 + (get_local $0) + ;;@ ~lib/memory.ts:202:17 + (get_local $1) + ;;@ ~lib/memory.ts:202:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:203:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:205:2 + (if + ;;@ ~lib/memory.ts:205:6 + (i32.lt_u + (get_local $0) + ;;@ ~lib/memory.ts:205:13 + (get_local $1) + ) + ;;@ ~lib/memory.ts:205:18 + (block + ;;@ ~lib/memory.ts:206:4 + (if + ;;@ ~lib/memory.ts:206:8 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:206:9 + (get_local $1) + ;;@ ~lib/memory.ts:206:15 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:206:21 + (i32.and + ;;@ ~lib/memory.ts:206:22 + (get_local $0) + ;;@ ~lib/memory.ts:206:29 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:206:33 + (block + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:207:13 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:207:20 + (i32.const 7) + ) + (block + ;;@ ~lib/memory.ts:208:8 + (if + ;;@ ~lib/memory.ts:208:12 + (i32.eqz + ;;@ ~lib/memory.ts:208:13 + (get_local $2) + ) + ;;@ ~lib/memory.ts:208:16 + (return) + ) + ;;@ ~lib/memory.ts:209:8 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:209:10 + (get_local $2) + (i32.const 1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:210:18 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:210:8 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:210:35 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:210:26 + (i32.load8_u + (get_local $3) + ) + ) + ) + (br $continue|0) + ) + ) + ) + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:212:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:212:18 + (i32.const 8) + ) + (block + ;;@ ~lib/memory.ts:213:8 + (i64.store + ;;@ ~lib/memory.ts:213:19 + (get_local $0) + ;;@ ~lib/memory.ts:213:25 + (i64.load + ;;@ ~lib/memory.ts:213:35 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:214:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:214:16 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:215:8 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:215:16 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:216:8 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:216:16 + (i32.const 8) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ) + (loop $continue|2 + (if + ;;@ ~lib/memory.ts:219:11 + (get_local $2) + (block + (set_local $0 + (i32.add + (tee_local $3 + ;;@ ~lib/memory.ts:220:16 + (get_local $0) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:220:6 + (i32.store8 + (get_local $3) + ;;@ ~lib/memory.ts:220:33 + (block (result i32) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:220:24 + (i32.load8_u + (get_local $3) + ) + ) + ) + ;;@ ~lib/memory.ts:221:6 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:221:8 + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:223:9 + (block + ;;@ ~lib/memory.ts:224:4 + (if + ;;@ ~lib/memory.ts:224:8 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:224:9 + (get_local $1) + ;;@ ~lib/memory.ts:224:15 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:224:21 + (i32.and + ;;@ ~lib/memory.ts:224:22 + (get_local $0) + ;;@ ~lib/memory.ts:224:29 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:224:33 + (block + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:225:13 + (i32.and + (i32.add + ;;@ ~lib/memory.ts:225:14 + (get_local $0) + ;;@ ~lib/memory.ts:225:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:225:26 + (i32.const 7) + ) + (block + ;;@ ~lib/memory.ts:226:8 + (if + ;;@ ~lib/memory.ts:226:12 + (i32.eqz + ;;@ ~lib/memory.ts:226:13 + (get_local $2) + ) + ;;@ ~lib/memory.ts:226:16 + (return) + ) + ;;@ ~lib/memory.ts:227:8 + (i32.store8 + ;;@ ~lib/memory.ts:227:18 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:227:25 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:227:27 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:227:30 + (i32.load8_u + ;;@ ~lib/memory.ts:227:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:227:45 + (get_local $2) + ) + ) + ) + (br $continue|3) + ) + ) + ) + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:229:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:229:18 + (i32.const 8) + ) + (block + ;;@ ~lib/memory.ts:231:8 + (i64.store + ;;@ ~lib/memory.ts:231:19 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:230:8 + (tee_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:230:13 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:231:29 + (i64.load + ;;@ ~lib/memory.ts:231:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:231:45 + (get_local $2) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ) + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:234:11 + (get_local $2) + (block + ;;@ ~lib/memory.ts:234:14 + (i32.store8 + ;;@ ~lib/memory.ts:235:16 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:235:23 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:235:25 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:235:28 + (i32.load8_u + ;;@ ~lib/memory.ts:235:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:235:43 + (get_local $2) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.copy (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/memory.ts:16:4 + (call $~lib/memory/memmove + ;;@ ~lib/memory.ts:16:12 + (get_local $0) + ;;@ ~lib/memory.ts:16:18 + (get_local $1) + ;;@ ~lib/memory.ts:16:23 + (get_local $2) + ) + ) + (func $~lib/memory/memcmp (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + ;;@ ~lib/memory.ts:302:2 + (if + ;;@ ~lib/memory.ts:302:6 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:302:12 + (get_local $1) + ) + ;;@ ~lib/memory.ts:302:23 + (return + (i32.const 0) + ) + ) + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:303:9 + (if (result i32) + (tee_local $3 + (i32.ne + (get_local $2) + ;;@ ~lib/memory.ts:303:14 + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:303:19 + (i32.eq + (i32.load8_u + ;;@ ~lib/memory.ts:303:28 + (get_local $0) + ) + ;;@ ~lib/memory.ts:303:35 + (i32.load8_u + ;;@ ~lib/memory.ts:303:44 + (get_local $1) + ) + ) + (get_local $3) + ) + (block + ;;@ ~lib/memory.ts:304:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:304:9 + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:304:15 + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + ;;@ ~lib/memory.ts:306:53 + (if (result i32) + ;;@ ~lib/memory.ts:306:9 + (get_local $2) + ;;@ ~lib/memory.ts:306:13 + (i32.sub + (i32.load8_u + ;;@ ~lib/memory.ts:306:27 + (get_local $0) + ) + ;;@ ~lib/memory.ts:306:33 + (i32.load8_u + ;;@ ~lib/memory.ts:306:47 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:306:53 + (i32.const 0) + ) + ) + (func $~lib/memory/memory.compare (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + ;;@ ~lib/memory.ts:21:27 + (call $~lib/memory/memcmp + ;;@ ~lib/memory.ts:21:18 + (get_local $0) + ;;@ ~lib/memory.ts:21:22 + (get_local $1) + ;;@ ~lib/memory.ts:21:26 + (get_local $2) + ) + ) + (func $~lib/allocator/tlsf/Root#set:tailRef (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32) ;;@ ~lib/allocator/tlsf.ts:181:30 (i32.store ;;@ ~lib/allocator/tlsf.ts:181:43 @@ -21,7 +3046,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 (; 8 ;) (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 +3063,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 (; 9 ;) (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 @@ -50,7 +3075,6 @@ ;;@ ~lib/allocator/tlsf.ts:170:33 (i32.shl (get_local $1) - ;;@ ~lib/allocator/tlsf.ts:170:38 (i32.const 5) ) ;;@ ~lib/allocator/tlsf.ts:170:48 @@ -64,13 +3088,12 @@ (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 (; 10 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:94:4 (i32.add ;;@ ~lib/allocator/tlsf.ts:92:8 (i32.add (get_local $0) - ;;@ ~lib/allocator/tlsf.ts:92:34 (i32.const 8) ) ;;@ ~lib/allocator/tlsf.ts:92:47 @@ -83,7 +3106,7 @@ ) ) ) - (func $~lib/allocator/tlsf/fls (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/fls (; 11 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:430:26 (i32.sub ;;@ ~lib/allocator/tlsf.ts:430:9 @@ -95,7 +3118,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 (; 12 ;) (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 @@ -107,7 +3130,6 @@ ;;@ ~lib/allocator/tlsf.ts:161:33 (i32.shl (get_local $1) - ;;@ ~lib/allocator/tlsf.ts:161:38 (i32.const 5) ) ;;@ ~lib/allocator/tlsf.ts:161:48 @@ -119,7 +3141,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Root#getSLMap (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/allocator/tlsf/Root#getSLMap (; 13 ;) (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 +3156,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Root#remove (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/allocator/tlsf/Root#remove (; 14 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -155,7 +3177,6 @@ (i32.const -4) ) ) - ;;@ ~lib/allocator/tlsf.ts:264:15 (i32.const 256) ) ;;@ ~lib/allocator/tlsf.ts:264:24 @@ -166,7 +3187,6 @@ (i32.div_u ;;@ ~lib/allocator/tlsf.ts:266:17 (get_local $2) - ;;@ ~lib/allocator/tlsf.ts:266:24 (i32.const 8) ) ) @@ -193,7 +3213,6 @@ (get_local $2) ) ) - ;;@ ~lib/allocator/tlsf.ts:269:32 (i32.const 5) ) ) @@ -203,7 +3222,6 @@ (i32.sub ;;@ ~lib/allocator/tlsf.ts:270:6 (get_local $3) - ;;@ ~lib/allocator/tlsf.ts:270:12 (i32.const 7) ) ) @@ -343,7 +3361,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Root#insert (; 8 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/allocator/tlsf/Root#insert (; 15 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -373,7 +3391,6 @@ ) ) ) - ;;@ ~lib/allocator/tlsf.ts:201:20 (i32.const 1) ) ;;@ ~lib/allocator/tlsf.ts:201:26 @@ -401,7 +3418,6 @@ (get_local $5) (i32.const -4) ) - ;;@ ~lib/allocator/tlsf.ts:203:33 (i32.const 8) ) ) @@ -427,7 +3443,6 @@ ;;@ ~lib/allocator/tlsf.ts:210:8 (i32.and (get_local $2) - ;;@ ~lib/allocator/tlsf.ts:210:20 (i32.const 2) ) ;;@ ~lib/allocator/tlsf.ts:210:31 @@ -471,7 +3486,6 @@ (get_local $2) (i32.const -4) ) - ;;@ ~lib/allocator/tlsf.ts:215:31 (i32.const 8) ) ) @@ -490,7 +3504,6 @@ ;;@ ~lib/allocator/tlsf.ts:221:17 (i32.or (get_local $5) - ;;@ ~lib/allocator/tlsf.ts:221:29 (i32.const 2) ) ) @@ -522,7 +3535,6 @@ (i32.const -4) ) ) - ;;@ ~lib/allocator/tlsf.ts:230:15 (i32.const 256) ) ;;@ ~lib/allocator/tlsf.ts:230:24 @@ -533,7 +3545,6 @@ (i32.div_u ;;@ ~lib/allocator/tlsf.ts:232:17 (get_local $3) - ;;@ ~lib/allocator/tlsf.ts:232:24 (i32.const 8) ) ) @@ -560,7 +3571,6 @@ (get_local $3) ) ) - ;;@ ~lib/allocator/tlsf.ts:235:32 (i32.const 5) ) ) @@ -570,7 +3580,6 @@ (i32.sub ;;@ ~lib/allocator/tlsf.ts:236:6 (get_local $2) - ;;@ ~lib/allocator/tlsf.ts:236:12 (i32.const 7) ) ) @@ -655,7 +3664,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 (; 16 ;) (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 @@ -672,7 +3681,6 @@ (i32.eq (i32.sub (get_local $1) - ;;@ ~lib/allocator/tlsf.ts:387:18 (i32.const 8) ) ;;@ ~lib/allocator/tlsf.ts:387:32 @@ -684,7 +3692,6 @@ (set_local $1 (i32.sub (get_local $1) - ;;@ ~lib/allocator/tlsf.ts:388:17 (i32.const 8) ) ) @@ -711,7 +3718,6 @@ (get_local $1) ) ) - ;;@ ~lib/allocator/tlsf.ts:398:45 (i32.const 32) ) ;;@ ~lib/allocator/tlsf.ts:398:57 @@ -732,14 +3738,12 @@ (get_local $2) (i32.const 16) ) - ;;@ ~lib/allocator/tlsf.ts:405:27 (i32.const 1) ) ;;@ ~lib/allocator/tlsf.ts:405:34 (i32.and ;;@ ~lib/allocator/tlsf.ts:405:35 (get_local $4) - ;;@ ~lib/allocator/tlsf.ts:405:46 (i32.const 2) ) ) @@ -768,7 +3772,6 @@ ;;@ ~lib/allocator/tlsf.ts:410:41 (get_local $2) ) - ;;@ ~lib/allocator/tlsf.ts:410:48 (i32.const 8) ) ) @@ -790,7 +3793,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 (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $1 ;;@ ~lib/allocator/tlsf.ts:300:4 @@ -798,14 +3801,12 @@ ;;@ ~lib/allocator/tlsf.ts:300:8 (i32.lt_u (get_local $1) - ;;@ ~lib/allocator/tlsf.ts:300:15 (i32.const 256) ) ;;@ ~lib/allocator/tlsf.ts:302:11 (i32.div_u ;;@ ~lib/allocator/tlsf.ts:302:17 (get_local $1) - ;;@ ~lib/allocator/tlsf.ts:302:24 (i32.const 8) ) ;;@ ~lib/allocator/tlsf.ts:303:11 @@ -828,7 +3829,6 @@ (get_local $1) ) ) - ;;@ ~lib/allocator/tlsf.ts:306:32 (i32.const 5) ) ) @@ -839,7 +3839,6 @@ (set_local $2 (i32.sub (get_local $2) - ;;@ ~lib/allocator/tlsf.ts:307:12 (i32.const 7) ) ) @@ -848,7 +3847,6 @@ ;;@ ~lib/allocator/tlsf.ts:309:10 (i32.lt_u (get_local $1) - ;;@ ~lib/allocator/tlsf.ts:309:15 (i32.const 31) ) (i32.add @@ -960,7 +3958,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 (; 18 ;) (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 @@ -994,7 +3992,6 @@ (get_local $2) ) ) - ;;@ ~lib/allocator/tlsf.ts:356:34 (i32.const 24) ) ;;@ ~lib/allocator/tlsf.ts:356:50 @@ -1009,7 +4006,6 @@ (i32.and ;;@ ~lib/allocator/tlsf.ts:357:27 (get_local $3) - ;;@ ~lib/allocator/tlsf.ts:357:39 (i32.const 2) ) ) @@ -1023,7 +4019,6 @@ ;;@ ~lib/allocator/tlsf.ts:360:8 (i32.add (get_local $1) - ;;@ ~lib/allocator/tlsf.ts:360:35 (i32.const 8) ) ;;@ ~lib/allocator/tlsf.ts:360:48 @@ -1035,10 +4030,8 @@ (i32.sub ;;@ ~lib/allocator/tlsf.ts:362:20 (get_local $4) - ;;@ ~lib/allocator/tlsf.ts:362:32 (i32.const 8) ) - ;;@ ~lib/allocator/tlsf.ts:362:46 (i32.const 1) ) ) @@ -1085,11 +4078,10 @@ (i32.add ;;@ ~lib/allocator/tlsf.ts:372:11 (get_local $1) - ;;@ ~lib/allocator/tlsf.ts:372:38 (i32.const 8) ) ) - (func $~lib/allocator/tlsf/allocate_memory (; 12 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/__memory_allocate (; 19 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -1122,16 +4114,7 @@ (i32.add ;;@ ~lib/allocator/tlsf.ts:445:4 (tee_local $4 - ;;@ ~lib/allocator/tlsf.ts:445:21 - (i32.and - (i32.add - ;;@ ~lib/allocator/tlsf.ts:445:22 - (get_global $HEAP_BASE) - ;;@ ~lib/allocator/tlsf.ts:445:34 - (i32.const 7) - ) - (i32.const -8) - ) + (i32.const 8) ) (i32.const 68451) ) @@ -1143,13 +4126,14 @@ ) ;;@ ~lib/allocator/tlsf.ts:446:4 (tee_local $5 - ;;@ ~lib/allocator/tlsf.ts:446:22 + ;;@ ~lib/allocator/tlsf.ts:446:29 (current_memory) ) ) ) ;;@ ~lib/allocator/tlsf.ts:448:37 (i32.lt_s + ;;@ ~lib/allocator/tlsf.ts:448:44 (grow_memory ;;@ ~lib/allocator/tlsf.ts:448:49 (i32.sub @@ -1198,7 +4182,6 @@ ;;@ ~lib/allocator/tlsf.ts:452:28 (i32.ge_u (get_local $3) - ;;@ ~lib/allocator/tlsf.ts:452:33 (i32.const 22) ) ) @@ -1223,7 +4206,6 @@ ;;@ ~lib/allocator/tlsf.ts:454:28 (i32.ge_u (get_local $1) - ;;@ ~lib/allocator/tlsf.ts:454:33 (i32.const 32) ) ) @@ -1276,8 +4258,9 @@ ) ;;@ ~lib/allocator/tlsf.ts:458:66 (i32.shl + ;;@ ~lib/allocator/tlsf.ts:458:73 (current_memory) - ;;@ ~lib/allocator/tlsf.ts:458:86 + ;;@ ~lib/allocator/tlsf.ts:458:83 (i32.const 16) ) ) @@ -1300,7 +4283,6 @@ ;;@ ~lib/allocator/tlsf.ts:464:8 (i32.gt_u (get_local $0) - ;;@ ~lib/allocator/tlsf.ts:464:15 (i32.const 1073741824) ) ;;@ ~lib/allocator/tlsf.ts:464:31 @@ -1326,14 +4308,12 @@ (i32.add ;;@ ~lib/allocator/tlsf.ts:466:23 (get_local $0) - ;;@ ~lib/allocator/tlsf.ts:466:30 (i32.const 7) ) (i32.const -8) ) ) (tee_local $5 - ;;@ ~lib/allocator/tlsf.ts:466:51 (i32.const 16) ) (i32.gt_u @@ -1351,13 +4331,14 @@ (if ;;@ ~lib/allocator/tlsf.ts:475:10 (i32.lt_s + ;;@ ~lib/allocator/tlsf.ts:475:17 (grow_memory ;;@ ~lib/allocator/tlsf.ts:474:24 (select (tee_local $3 ;;@ ~lib/allocator/tlsf.ts:472:6 (tee_local $5 - ;;@ ~lib/allocator/tlsf.ts:472:24 + ;;@ ~lib/allocator/tlsf.ts:472:31 (current_memory) ) ) @@ -1395,6 +4376,7 @@ (if ;;@ ~lib/allocator/tlsf.ts:476:12 (i32.lt_s + ;;@ ~lib/allocator/tlsf.ts:476:19 (grow_memory ;;@ ~lib/allocator/tlsf.ts:476:24 (get_local $4) @@ -1419,7 +4401,7 @@ ) ;;@ ~lib/allocator/tlsf.ts:481:47 (i32.shl - ;;@ ~lib/allocator/tlsf.ts:480:23 + ;;@ ~lib/allocator/tlsf.ts:480:30 (current_memory) ;;@ ~lib/allocator/tlsf.ts:481:68 (i32.const 16) @@ -1455,7 +4437,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 (; 20 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:37:45 + (call $~lib/allocator/tlsf/__memory_allocate + ;;@ ~lib/memory.ts:37:63 + (get_local $0) + ) + ) + (func $~lib/allocator/tlsf/__memory_free (; 21 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) ;;@ ~lib/allocator/tlsf.ts:495:2 @@ -1479,7 +4468,6 @@ (i32.sub ;;@ ~lib/allocator/tlsf.ts:498:36 (get_local $0) - ;;@ ~lib/allocator/tlsf.ts:498:43 (i32.const 8) ) ) @@ -1489,7 +4477,6 @@ (i32.load (get_local $2) ) - ;;@ ~lib/allocator/tlsf.ts:501:31 (i32.const 1) ) ) @@ -1501,7 +4488,6 @@ (i32.sub ;;@ ~lib/allocator/tlsf.ts:502:36 (get_local $0) - ;;@ ~lib/allocator/tlsf.ts:502:43 (i32.const 8) ) ) @@ -1509,4 +4495,14 @@ ) ) ) + (func $~lib/memory/memory.free (; 22 ;) (type $iv) (param $0 i32) + ;;@ ~lib/memory.ts:43:36 + (call $~lib/allocator/tlsf/__memory_free + ;;@ ~lib/memory.ts:43:50 + (get_local $0) + ) + ) + (func $~lib/memory/memory.reset (; 23 ;) (type $v) + (unreachable) + ) ) diff --git a/tests/allocators/tlsf/untouched.wat b/tests/allocators/tlsf/untouched.wat index a096f818..26986726 100644 --- a/tests/allocators/tlsf/untouched.wat +++ b/tests/allocators/tlsf/untouched.wat @@ -1,9 +1,9 @@ (module (type $iiiiv (func (param i32 i32 i32 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 $ii (func (param 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)) @@ -21,14 +21,3348 @@ (global $~lib/allocator/tlsf/LEFT_FREE i32 (i32.const 2)) (global $~lib/allocator/tlsf/TAGS i32 (i32.const 3)) (global $~lib/allocator/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/allocator/tlsf/Root.SL_START i32 (i32.const 4)) + (global $~lib/allocator/tlsf/Root.SL_END i32 (i32.const 92)) + (global $~lib/allocator/tlsf/Root.HL_START i32 (i32.const 96)) + (global $~lib/allocator/tlsf/Root.HL_END i32 (i32.const 2912)) + (global $~lib/allocator/tlsf/Root.SIZE i32 (i32.const 2916)) + (global $~lib/allocator/tlsf/Block.INFO i32 (i32.const 8)) + (global $~lib/allocator/tlsf/Block.MIN_SIZE i32 (i32.const 16)) + (global $~lib/allocator/tlsf/Block.MAX_SIZE i32 (i32.const 1073741824)) (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" (memory $0)) + (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)) (start $start) - (func $~lib/allocator/tlsf/Root#set:tailRef (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/memory/memset (; 1 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i64) + ;;@ ~lib/memory.ts:244:2 + (if + ;;@ ~lib/memory.ts:244:6 + (i32.eqz + ;;@ ~lib/memory.ts:244:7 + (get_local $2) + ) + ;;@ ~lib/memory.ts:244:10 + (return) + ) + ;;@ ~lib/memory.ts:245:2 + (i32.store8 + ;;@ ~lib/memory.ts:245:12 + (get_local $0) + ;;@ ~lib/memory.ts:245:18 + (get_local $1) + ) + ;;@ ~lib/memory.ts:246:2 + (i32.store8 + ;;@ ~lib/memory.ts:246:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:246:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:246:23 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:246:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:247:2 + (if + ;;@ ~lib/memory.ts:247:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:247:11 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:247:14 + (return) + ) + ;;@ ~lib/memory.ts:249:2 + (i32.store8 + ;;@ ~lib/memory.ts:249:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:249:19 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:249:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:250:2 + (i32.store8 + ;;@ ~lib/memory.ts:250:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:250:19 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:250:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:251:2 + (i32.store8 + ;;@ ~lib/memory.ts:251:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:251:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:251:23 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:251:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:252:2 + (i32.store8 + ;;@ ~lib/memory.ts:252:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:252:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:252:23 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:252:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:253:2 + (if + ;;@ ~lib/memory.ts:253:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:253:11 + (i32.const 6) + ) + ;;@ ~lib/memory.ts:253:14 + (return) + ) + ;;@ ~lib/memory.ts:254:2 + (i32.store8 + ;;@ ~lib/memory.ts:254:12 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:254:19 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:254:22 + (get_local $1) + ) + ;;@ ~lib/memory.ts:255:2 + (i32.store8 + ;;@ ~lib/memory.ts:255:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:255:19 + (get_local $2) + ) + ;;@ ~lib/memory.ts:255:23 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:255:26 + (get_local $1) + ) + ;;@ ~lib/memory.ts:256:2 + (if + ;;@ ~lib/memory.ts:256:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:256:11 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:256:14 + (return) + ) + ;;@ ~lib/memory.ts:259:2 + (set_local $3 + ;;@ ~lib/memory.ts:259:17 + (i32.and + (i32.sub + (i32.const 0) + ;;@ ~lib/memory.ts:259:18 + (get_local $0) + ) + ;;@ ~lib/memory.ts:259:25 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:260:2 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:260:10 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:261:2 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:261:7 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:262:2 + (set_local $2 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:262:7 + (i32.const -4) + ) + ) + ;;@ ~lib/memory.ts:264:2 + (set_local $4 + ;;@ ~lib/memory.ts:264:17 + (i32.mul + (i32.div_u + (i32.const -1) + ;;@ ~lib/memory.ts:264:27 + (i32.const 255) + ) + (i32.and + ;;@ ~lib/memory.ts:264:33 + (get_local $1) + (i32.const 255) + ) + ) + ) + ;;@ ~lib/memory.ts:267:2 + (i32.store + ;;@ ~lib/memory.ts:267:13 + (get_local $0) + ;;@ ~lib/memory.ts:267:19 + (get_local $4) + ) + ;;@ ~lib/memory.ts:268:2 + (i32.store + ;;@ ~lib/memory.ts:268:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:268:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:268:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:268:27 + (get_local $4) + ) + ;;@ ~lib/memory.ts:269:2 + (if + ;;@ ~lib/memory.ts:269:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:269:11 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:269:14 + (return) + ) + ;;@ ~lib/memory.ts:270:2 + (i32.store + ;;@ ~lib/memory.ts:270:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:270:20 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:270:23 + (get_local $4) + ) + ;;@ ~lib/memory.ts:271:2 + (i32.store + ;;@ ~lib/memory.ts:271:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:271:20 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:271:23 + (get_local $4) + ) + ;;@ ~lib/memory.ts:272:2 + (i32.store + ;;@ ~lib/memory.ts:272:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:272:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:272:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:272:28 + (get_local $4) + ) + ;;@ ~lib/memory.ts:273:2 + (i32.store + ;;@ ~lib/memory.ts:273:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:273:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:273:24 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:273:27 + (get_local $4) + ) + ;;@ ~lib/memory.ts:274:2 + (if + ;;@ ~lib/memory.ts:274:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/memory.ts:274:11 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:274:15 + (return) + ) + ;;@ ~lib/memory.ts:275:2 + (i32.store + ;;@ ~lib/memory.ts:275:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:275:20 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:275:24 + (get_local $4) + ) + ;;@ ~lib/memory.ts:276:2 + (i32.store + ;;@ ~lib/memory.ts:276:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:276:20 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:276:24 + (get_local $4) + ) + ;;@ ~lib/memory.ts:277:2 + (i32.store + ;;@ ~lib/memory.ts:277:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:277:20 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:277:24 + (get_local $4) + ) + ;;@ ~lib/memory.ts:278:2 + (i32.store + ;;@ ~lib/memory.ts:278:13 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:278:20 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:278:24 + (get_local $4) + ) + ;;@ ~lib/memory.ts:279:2 + (i32.store + ;;@ ~lib/memory.ts:279:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:279:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:279:24 + (i32.const 28) + ) + ;;@ ~lib/memory.ts:279:28 + (get_local $4) + ) + ;;@ ~lib/memory.ts:280:2 + (i32.store + ;;@ ~lib/memory.ts:280:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:280:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:280:24 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:280:28 + (get_local $4) + ) + ;;@ ~lib/memory.ts:281:2 + (i32.store + ;;@ ~lib/memory.ts:281:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:281:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:281:24 + (i32.const 20) + ) + ;;@ ~lib/memory.ts:281:28 + (get_local $4) + ) + ;;@ ~lib/memory.ts:282:2 + (i32.store + ;;@ ~lib/memory.ts:282:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:282:20 + (get_local $2) + ) + ;;@ ~lib/memory.ts:282:24 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:282:28 + (get_local $4) + ) + ;;@ ~lib/memory.ts:285:2 + (set_local $3 + ;;@ ~lib/memory.ts:285:6 + (i32.add + (i32.const 24) + ;;@ ~lib/memory.ts:285:11 + (i32.and + ;;@ ~lib/memory.ts:285:12 + (get_local $0) + ;;@ ~lib/memory.ts:285:19 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:286:2 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:286:10 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:287:2 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:287:7 + (get_local $3) + ) + ) + ;;@ ~lib/memory.ts:290:2 + (set_local $5 + ;;@ ~lib/memory.ts:290:17 + (i64.or + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/memory.ts:290:28 + (i64.shl + ;;@ ~lib/memory.ts:290:29 + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/memory.ts:290:41 + (i64.const 32) + ) + ) + ) + ;;@ ~lib/memory.ts:291:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:291:9 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:291:14 + (i32.const 32) + ) + (block + (block + ;;@ ~lib/memory.ts:292:4 + (i64.store + ;;@ ~lib/memory.ts:292:15 + (get_local $0) + ;;@ ~lib/memory.ts:292:21 + (get_local $5) + ) + ;;@ ~lib/memory.ts:293:4 + (i64.store + ;;@ ~lib/memory.ts:293:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:293:22 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:293:25 + (get_local $5) + ) + ;;@ ~lib/memory.ts:294:4 + (i64.store + ;;@ ~lib/memory.ts:294:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:294:22 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:294:26 + (get_local $5) + ) + ;;@ ~lib/memory.ts:295:4 + (i64.store + ;;@ ~lib/memory.ts:295:15 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:295:22 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:295:26 + (get_local $5) + ) + ;;@ ~lib/memory.ts:296:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:296:9 + (i32.const 32) + ) + ) + ;;@ ~lib/memory.ts:297:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:297:12 + (i32.const 32) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.fill (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/memory.ts:11:4 + (call $~lib/memory/memset + ;;@ ~lib/memory.ts:11:11 + (get_local $0) + ;;@ ~lib/memory.ts:11:17 + (get_local $1) + ;;@ ~lib/memory.ts:11:20 + (get_local $2) + ) + ) + (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:59:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:59:9 + (if (result i32) + (get_local $2) + ;;@ ~lib/memory.ts:59:14 + (i32.and + ;;@ ~lib/memory.ts:59:15 + (get_local $1) + ;;@ ~lib/memory.ts:59:21 + (i32.const 3) + ) + (get_local $2) + ) + (block + (block + ;;@ ~lib/memory.ts:60:4 + (i32.store8 + ;;@ ~lib/memory.ts:60: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:60:22 + (i32.load8_u + ;;@ ~lib/memory.ts:60: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:61:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:65:2 + (if + ;;@ ~lib/memory.ts:65:6 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:65:7 + (get_local $0) + ;;@ ~lib/memory.ts:65:14 + (i32.const 3) + ) + ;;@ ~lib/memory.ts:65:20 + (i32.const 0) + ) + ;;@ ~lib/memory.ts:65:23 + (block + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:66:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:66:16 + (i32.const 16) + ) + (block + (block + ;;@ ~lib/memory.ts:67:6 + (i32.store + ;;@ ~lib/memory.ts:67:17 + (get_local $0) + ;;@ ~lib/memory.ts:67:28 + (i32.load + ;;@ ~lib/memory.ts:67:38 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:68:6 + (i32.store + ;;@ ~lib/memory.ts:68:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:68:25 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:68:28 + (i32.load + ;;@ ~lib/memory.ts:68:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:68:45 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:69:6 + (i32.store + ;;@ ~lib/memory.ts:69:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:69:25 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:69:28 + (i32.load + ;;@ ~lib/memory.ts:69:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:69:45 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:70:6 + (i32.store + ;;@ ~lib/memory.ts:70:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:70:24 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:70:28 + (i32.load + ;;@ ~lib/memory.ts:70:38 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:70:44 + (i32.const 12) + ) + ) + ) + ;;@ ~lib/memory.ts:71:6 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:71:13 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:71:17 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:71:25 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:71:29 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:71:34 + (i32.const 16) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:73:4 + (if + ;;@ ~lib/memory.ts:73:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:73:12 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:73:15 + (block + ;;@ ~lib/memory.ts:74:6 + (i32.store + ;;@ ~lib/memory.ts:74:17 + (get_local $0) + ;;@ ~lib/memory.ts:74:27 + (i32.load + ;;@ ~lib/memory.ts:74:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:75:6 + (i32.store + ;;@ ~lib/memory.ts:75:17 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:75:24 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:75:27 + (i32.load + ;;@ ~lib/memory.ts:75:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:75:43 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/memory.ts:76:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:76:14 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:76:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:76:24 + (i32.const 8) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:78:4 + (if + ;;@ ~lib/memory.ts:78:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:78:12 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:78:15 + (block + ;;@ ~lib/memory.ts:79:6 + (i32.store + ;;@ ~lib/memory.ts:79:17 + (get_local $0) + ;;@ ~lib/memory.ts:79:23 + (i32.load + ;;@ ~lib/memory.ts:79:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:80:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:80:14 + (i32.const 4) + ) + ) + ;;@ ~lib/memory.ts:80:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:80:24 + (i32.const 4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:82:4 + (if + ;;@ ~lib/memory.ts:82:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:82:12 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:82:15 + (block + ;;@ ~lib/memory.ts:83:6 + (i32.store16 + ;;@ ~lib/memory.ts:83:17 + (get_local $0) + ;;@ ~lib/memory.ts:83:23 + (i32.load16_u + ;;@ ~lib/memory.ts:83:33 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:84:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:84:14 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:84:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:84:24 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:86:4 + (if + ;;@ ~lib/memory.ts:86:8 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:86:12 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:86:15 + (i32.store8 + ;;@ ~lib/memory.ts:87: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:87:24 + (i32.load8_u + ;;@ ~lib/memory.ts:87: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:89:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:94:2 + (if + ;;@ ~lib/memory.ts:94:6 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:94:11 + (i32.const 32) + ) + ;;@ ~lib/memory.ts:94:15 + (block $break|2 + (block $case2|2 + (block $case1|2 + (block $case0|2 + (set_local $5 + ;;@ ~lib/memory.ts:95:12 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:95:19 + (i32.const 3) + ) + ) + (br_if $case0|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:97:11 + (i32.const 1) + ) + ) + (br_if $case1|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:116:11 + (i32.const 2) + ) + ) + (br_if $case2|2 + (i32.eq + (get_local $5) + ;;@ ~lib/memory.ts:134:11 + (i32.const 3) + ) + ) + (br $break|2) + ) + ;;@ ~lib/memory.ts:97:14 + (block + ;;@ ~lib/memory.ts:98:8 + (set_local $3 + ;;@ ~lib/memory.ts:98:12 + (i32.load + ;;@ ~lib/memory.ts:98:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:99:8 + (i32.store8 + ;;@ ~lib/memory.ts:99: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:99:26 + (i32.load8_u + ;;@ ~lib/memory.ts:99: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:100:8 + (i32.store8 + ;;@ ~lib/memory.ts:100: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:100:26 + (i32.load8_u + ;;@ ~lib/memory.ts:100: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:101:8 + (i32.store8 + ;;@ ~lib/memory.ts:101: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:101:26 + (i32.load8_u + ;;@ ~lib/memory.ts:101: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:102:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:102:13 + (i32.const 3) + ) + ) + ;;@ ~lib/memory.ts:103:8 + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:103:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:103:20 + (i32.const 17) + ) + (block + (block + ;;@ ~lib/memory.ts:104:10 + (set_local $4 + ;;@ ~lib/memory.ts:104:14 + (i32.load + ;;@ ~lib/memory.ts:104:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:104:30 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:105:10 + (i32.store + ;;@ ~lib/memory.ts:105:21 + (get_local $0) + ;;@ ~lib/memory.ts:105:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:105:32 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:105:37 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:105:42 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:106:10 + (set_local $3 + ;;@ ~lib/memory.ts:106:14 + (i32.load + ;;@ ~lib/memory.ts:106:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:106:30 + (i32.const 5) + ) + ) + ) + ;;@ ~lib/memory.ts:107:10 + (i32.store + ;;@ ~lib/memory.ts:107:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:107:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:107:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:107:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:107:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:107:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:108:10 + (set_local $4 + ;;@ ~lib/memory.ts:108:14 + (i32.load + ;;@ ~lib/memory.ts:108:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:108:30 + (i32.const 9) + ) + ) + ) + ;;@ ~lib/memory.ts:109:10 + (i32.store + ;;@ ~lib/memory.ts:109:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:109:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:109:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:109:36 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:109:41 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:109:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:110:10 + (set_local $3 + ;;@ ~lib/memory.ts:110:14 + (i32.load + ;;@ ~lib/memory.ts:110:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:110:30 + (i32.const 13) + ) + ) + ) + ;;@ ~lib/memory.ts:111:10 + (i32.store + ;;@ ~lib/memory.ts:111:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:111:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:111:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:111:37 + (i32.const 24) + ) + ;;@ ~lib/memory.ts:111:42 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:111:47 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/memory.ts:112:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:112:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:112:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:112:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:112:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:112:38 + (i32.const 16) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:114:8 + (br $break|2) + ) + ) + ;;@ ~lib/memory.ts:116:14 + (block + ;;@ ~lib/memory.ts:117:8 + (set_local $3 + ;;@ ~lib/memory.ts:117:12 + (i32.load + ;;@ ~lib/memory.ts:117:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:118:8 + (i32.store8 + ;;@ ~lib/memory.ts:118: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:118:26 + (i32.load8_u + ;;@ ~lib/memory.ts:118: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:119:8 + (i32.store8 + ;;@ ~lib/memory.ts:119: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:119:26 + (i32.load8_u + ;;@ ~lib/memory.ts:119: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:120:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:120:13 + (i32.const 2) + ) + ) + ;;@ ~lib/memory.ts:121:8 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:121:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:121:20 + (i32.const 18) + ) + (block + (block + ;;@ ~lib/memory.ts:122:10 + (set_local $4 + ;;@ ~lib/memory.ts:122:14 + (i32.load + ;;@ ~lib/memory.ts:122:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:122:30 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/memory.ts:123:10 + (i32.store + ;;@ ~lib/memory.ts:123:21 + (get_local $0) + ;;@ ~lib/memory.ts:123:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:123:32 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:123:37 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:123:42 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:124:10 + (set_local $3 + ;;@ ~lib/memory.ts:124:14 + (i32.load + ;;@ ~lib/memory.ts:124:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:124:30 + (i32.const 6) + ) + ) + ) + ;;@ ~lib/memory.ts:125:10 + (i32.store + ;;@ ~lib/memory.ts:125:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:125:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:125:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:125:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:125:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:125:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:126:10 + (set_local $4 + ;;@ ~lib/memory.ts:126:14 + (i32.load + ;;@ ~lib/memory.ts:126:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:126:30 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/memory.ts:127:10 + (i32.store + ;;@ ~lib/memory.ts:127:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:127:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:127:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:127:36 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:127:41 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:127:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:128:10 + (set_local $3 + ;;@ ~lib/memory.ts:128:14 + (i32.load + ;;@ ~lib/memory.ts:128:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:128:30 + (i32.const 14) + ) + ) + ) + ;;@ ~lib/memory.ts:129:10 + (i32.store + ;;@ ~lib/memory.ts:129:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:129:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:129:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:129:37 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:129:42 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:129:47 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/memory.ts:130:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:130:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:130:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:130:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:130:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:130:38 + (i32.const 16) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:132:8 + (br $break|2) + ) + ) + ;;@ ~lib/memory.ts:134:14 + (block + ;;@ ~lib/memory.ts:135:8 + (set_local $3 + ;;@ ~lib/memory.ts:135:12 + (i32.load + ;;@ ~lib/memory.ts:135:22 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:136:8 + (i32.store8 + ;;@ ~lib/memory.ts:136: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:136:26 + (i32.load8_u + ;;@ ~lib/memory.ts:136: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:137:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:137:13 + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:138:8 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:138:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:138:20 + (i32.const 19) + ) + (block + (block + ;;@ ~lib/memory.ts:139:10 + (set_local $4 + ;;@ ~lib/memory.ts:139:14 + (i32.load + ;;@ ~lib/memory.ts:139:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:139:30 + (i32.const 3) + ) + ) + ) + ;;@ ~lib/memory.ts:140:10 + (i32.store + ;;@ ~lib/memory.ts:140:21 + (get_local $0) + ;;@ ~lib/memory.ts:140:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:140:32 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:140:36 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:140:41 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:141:10 + (set_local $3 + ;;@ ~lib/memory.ts:141:14 + (i32.load + ;;@ ~lib/memory.ts:141:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:141:30 + (i32.const 7) + ) + ) + ) + ;;@ ~lib/memory.ts:142:10 + (i32.store + ;;@ ~lib/memory.ts:142:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:142:28 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:142:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:142:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:142:40 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:142:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:143:10 + (set_local $4 + ;;@ ~lib/memory.ts:143:14 + (i32.load + ;;@ ~lib/memory.ts:143:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:143:30 + (i32.const 11) + ) + ) + ) + ;;@ ~lib/memory.ts:144:10 + (i32.store + ;;@ ~lib/memory.ts:144:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:144:28 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:144:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/memory.ts:144:36 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:144:40 + (i32.shl + (get_local $4) + ;;@ ~lib/memory.ts:144:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:145:10 + (set_local $3 + ;;@ ~lib/memory.ts:145:14 + (i32.load + ;;@ ~lib/memory.ts:145:24 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:145:30 + (i32.const 15) + ) + ) + ) + ;;@ ~lib/memory.ts:146:10 + (i32.store + ;;@ ~lib/memory.ts:146:21 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:146:28 + (i32.const 12) + ) + ;;@ ~lib/memory.ts:146:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/memory.ts:146:37 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:146:41 + (i32.shl + (get_local $3) + ;;@ ~lib/memory.ts:146:46 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/memory.ts:147:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:147:17 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:147:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:147:29 + (i32.const 16) + ) + ) + ;;@ ~lib/memory.ts:147:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:147:38 + (i32.const 16) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:149:8 + (br $break|2) + ) + ) + ) + ;;@ ~lib/memory.ts:155:2 + (if + ;;@ ~lib/memory.ts:155:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:155:10 + (i32.const 16) + ) + ;;@ ~lib/memory.ts:155:14 + (block + ;;@ ~lib/memory.ts:156:4 + (i32.store8 + ;;@ ~lib/memory.ts:156: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:156:22 + (i32.load8_u + ;;@ ~lib/memory.ts:156: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:157:4 + (i32.store8 + ;;@ ~lib/memory.ts:157: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:157:22 + (i32.load8_u + ;;@ ~lib/memory.ts:157: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:158:4 + (i32.store8 + ;;@ ~lib/memory.ts:158: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:158:22 + (i32.load8_u + ;;@ ~lib/memory.ts:158: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:159:4 + (i32.store8 + ;;@ ~lib/memory.ts:159: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:159:22 + (i32.load8_u + ;;@ ~lib/memory.ts:159: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:160:4 + (i32.store8 + ;;@ ~lib/memory.ts:160: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:160:22 + (i32.load8_u + ;;@ ~lib/memory.ts:160: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:161:4 + (i32.store8 + ;;@ ~lib/memory.ts:161: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:161:22 + (i32.load8_u + ;;@ ~lib/memory.ts:161: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:162:4 + (i32.store8 + ;;@ ~lib/memory.ts:162: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:162:22 + (i32.load8_u + ;;@ ~lib/memory.ts:162: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:163:4 + (i32.store8 + ;;@ ~lib/memory.ts:163: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:163:22 + (i32.load8_u + ;;@ ~lib/memory.ts:163: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:164:4 + (i32.store8 + ;;@ ~lib/memory.ts:164: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:164:22 + (i32.load8_u + ;;@ ~lib/memory.ts:164: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: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 + (i32.store8 + ;;@ ~lib/memory.ts:166: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:166:22 + (i32.load8_u + ;;@ ~lib/memory.ts:166: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:167:4 + (i32.store8 + ;;@ ~lib/memory.ts:167: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:167:22 + (i32.load8_u + ;;@ ~lib/memory.ts:167: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:168:4 + (i32.store8 + ;;@ ~lib/memory.ts:168: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:168:22 + (i32.load8_u + ;;@ ~lib/memory.ts:168: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:169:4 + (i32.store8 + ;;@ ~lib/memory.ts:169: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:169:22 + (i32.load8_u + ;;@ ~lib/memory.ts:169: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:170:4 + (i32.store8 + ;;@ ~lib/memory.ts:170: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:170:22 + (i32.load8_u + ;;@ ~lib/memory.ts:170: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:171:4 + (i32.store8 + ;;@ ~lib/memory.ts:171: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:171:22 + (i32.load8_u + ;;@ ~lib/memory.ts:171: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:173:2 + (if + ;;@ ~lib/memory.ts:173:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:173:10 + (i32.const 8) + ) + ;;@ ~lib/memory.ts:173:13 + (block + ;;@ ~lib/memory.ts:174:4 + (i32.store8 + ;;@ ~lib/memory.ts:174: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:174:22 + (i32.load8_u + ;;@ ~lib/memory.ts:174: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:175:4 + (i32.store8 + ;;@ ~lib/memory.ts:175: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:175:22 + (i32.load8_u + ;;@ ~lib/memory.ts:175: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:176:4 + (i32.store8 + ;;@ ~lib/memory.ts:176: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:176:22 + (i32.load8_u + ;;@ ~lib/memory.ts:176: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:177:4 + (i32.store8 + ;;@ ~lib/memory.ts:177: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:177:22 + (i32.load8_u + ;;@ ~lib/memory.ts:177: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:178:4 + (i32.store8 + ;;@ ~lib/memory.ts:178: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:178:22 + (i32.load8_u + ;;@ ~lib/memory.ts:178: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:179:4 + (i32.store8 + ;;@ ~lib/memory.ts:179: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:179:22 + (i32.load8_u + ;;@ ~lib/memory.ts:179: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:180:4 + (i32.store8 + ;;@ ~lib/memory.ts:180: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:180:22 + (i32.load8_u + ;;@ ~lib/memory.ts:180: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:181:4 + (i32.store8 + ;;@ ~lib/memory.ts:181: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:181:22 + (i32.load8_u + ;;@ ~lib/memory.ts:181: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:183:2 + (if + ;;@ ~lib/memory.ts:183:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:183:10 + (i32.const 4) + ) + ;;@ ~lib/memory.ts:183:13 + (block + ;;@ ~lib/memory.ts:184:4 + (i32.store8 + ;;@ ~lib/memory.ts:184: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:184:22 + (i32.load8_u + ;;@ ~lib/memory.ts:184: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:185:4 + (i32.store8 + ;;@ ~lib/memory.ts:185: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:185:22 + (i32.load8_u + ;;@ ~lib/memory.ts:185: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:186:4 + (i32.store8 + ;;@ ~lib/memory.ts:186: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:186:22 + (i32.load8_u + ;;@ ~lib/memory.ts:186: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:187:4 + (i32.store8 + ;;@ ~lib/memory.ts:187: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:187:22 + (i32.load8_u + ;;@ ~lib/memory.ts:187: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:189:2 + (if + ;;@ ~lib/memory.ts:189:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:189:10 + (i32.const 2) + ) + ;;@ ~lib/memory.ts:189:13 + (block + ;;@ ~lib/memory.ts:190:4 + (i32.store8 + ;;@ ~lib/memory.ts:190: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:190:22 + (i32.load8_u + ;;@ ~lib/memory.ts:190: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:191:4 + (i32.store8 + ;;@ ~lib/memory.ts:191: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:191:22 + (i32.load8_u + ;;@ ~lib/memory.ts:191: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:193:2 + (if + ;;@ ~lib/memory.ts:193:6 + (i32.and + (get_local $2) + ;;@ ~lib/memory.ts:193:10 + (i32.const 1) + ) + ;;@ ~lib/memory.ts:193:13 + (i32.store8 + ;;@ ~lib/memory.ts:194: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:194:22 + (i32.load8_u + ;;@ ~lib/memory.ts:194: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/memmove (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + ;;@ ~lib/memory.ts:200:2 + (if + ;;@ ~lib/memory.ts:200:6 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:200:14 + (get_local $1) + ) + ;;@ ~lib/memory.ts:200:19 + (return) + ) + ;;@ ~lib/memory.ts:201:2 + (if + ;;@ ~lib/memory.ts:201:6 + (if (result i32) + (tee_local $3 + (i32.le_u + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:201:12 + (get_local $2) + ) + ;;@ ~lib/memory.ts:201:17 + (get_local $0) + ) + ) + (get_local $3) + ;;@ ~lib/memory.ts:201:25 + (i32.le_u + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:201:32 + (get_local $2) + ) + ;;@ ~lib/memory.ts:201:37 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:201:42 + (block + ;;@ ~lib/memory.ts:202:4 + (call $~lib/memory/memcpy + ;;@ ~lib/memory.ts:202:11 + (get_local $0) + ;;@ ~lib/memory.ts:202:17 + (get_local $1) + ;;@ ~lib/memory.ts:202:22 + (get_local $2) + ) + ;;@ ~lib/memory.ts:203:4 + (return) + ) + ) + ;;@ ~lib/memory.ts:205:2 + (if + ;;@ ~lib/memory.ts:205:6 + (i32.lt_u + (get_local $0) + ;;@ ~lib/memory.ts:205:13 + (get_local $1) + ) + ;;@ ~lib/memory.ts:205:18 + (block + ;;@ ~lib/memory.ts:206:4 + (if + ;;@ ~lib/memory.ts:206:8 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:206:9 + (get_local $1) + ;;@ ~lib/memory.ts:206:15 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:206:21 + (i32.and + ;;@ ~lib/memory.ts:206:22 + (get_local $0) + ;;@ ~lib/memory.ts:206:29 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:206:33 + (block + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:207:13 + (i32.and + (get_local $0) + ;;@ ~lib/memory.ts:207:20 + (i32.const 7) + ) + (block + (block + ;;@ ~lib/memory.ts:208:8 + (if + ;;@ ~lib/memory.ts:208:12 + (i32.eqz + ;;@ ~lib/memory.ts:208:13 + (get_local $2) + ) + ;;@ ~lib/memory.ts:208:16 + (return) + ) + ;;@ ~lib/memory.ts:209:8 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:209:10 + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:210:8 + (i32.store8 + ;;@ ~lib/memory.ts:210: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:210:26 + (i32.load8_u + ;;@ ~lib/memory.ts:210:35 + (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:212:6 + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/memory.ts:212:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:212:18 + (i32.const 8) + ) + (block + (block + ;;@ ~lib/memory.ts:213:8 + (i64.store + ;;@ ~lib/memory.ts:213:19 + (get_local $0) + ;;@ ~lib/memory.ts:213:25 + (i64.load + ;;@ ~lib/memory.ts:213:35 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:214:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:214:16 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:215:8 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:215:16 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:216:8 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:216:16 + (i32.const 8) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:219:4 + (block $break|2 + (loop $continue|2 + (if + ;;@ ~lib/memory.ts:219:11 + (get_local $2) + (block + (block + ;;@ ~lib/memory.ts:220:6 + (i32.store8 + ;;@ ~lib/memory.ts:220:16 + (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:220:24 + (i32.load8_u + ;;@ ~lib/memory.ts:220:33 + (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:221:6 + (set_local $2 + (i32.sub + ;;@ ~lib/memory.ts:221:8 + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|2) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:223:9 + (block + ;;@ ~lib/memory.ts:224:4 + (if + ;;@ ~lib/memory.ts:224:8 + (i32.eq + (i32.and + ;;@ ~lib/memory.ts:224:9 + (get_local $1) + ;;@ ~lib/memory.ts:224:15 + (i32.const 7) + ) + ;;@ ~lib/memory.ts:224:21 + (i32.and + ;;@ ~lib/memory.ts:224:22 + (get_local $0) + ;;@ ~lib/memory.ts:224:29 + (i32.const 7) + ) + ) + ;;@ ~lib/memory.ts:224:33 + (block + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/memory.ts:225:13 + (i32.and + (i32.add + ;;@ ~lib/memory.ts:225:14 + (get_local $0) + ;;@ ~lib/memory.ts:225:21 + (get_local $2) + ) + ;;@ ~lib/memory.ts:225:26 + (i32.const 7) + ) + (block + (block + ;;@ ~lib/memory.ts:226:8 + (if + ;;@ ~lib/memory.ts:226:12 + (i32.eqz + ;;@ ~lib/memory.ts:226:13 + (get_local $2) + ) + ;;@ ~lib/memory.ts:226:16 + (return) + ) + ;;@ ~lib/memory.ts:227:8 + (i32.store8 + ;;@ ~lib/memory.ts:227:18 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:227:25 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:227:27 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:227:30 + (i32.load8_u + ;;@ ~lib/memory.ts:227:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:227:45 + (get_local $2) + ) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:229:6 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/memory.ts:229:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/memory.ts:229:18 + (i32.const 8) + ) + (block + (block + ;;@ ~lib/memory.ts:230:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/memory.ts:230:13 + (i32.const 8) + ) + ) + ;;@ ~lib/memory.ts:231:8 + (i64.store + ;;@ ~lib/memory.ts:231:19 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:231:26 + (get_local $2) + ) + ;;@ ~lib/memory.ts:231:29 + (i64.load + ;;@ ~lib/memory.ts:231:39 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:231:45 + (get_local $2) + ) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:234:4 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/memory.ts:234:11 + (get_local $2) + (block + ;;@ ~lib/memory.ts:234:14 + (i32.store8 + ;;@ ~lib/memory.ts:235:16 + (i32.add + (get_local $0) + ;;@ ~lib/memory.ts:235:23 + (tee_local $2 + (i32.sub + ;;@ ~lib/memory.ts:235:25 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:235:28 + (i32.load8_u + ;;@ ~lib/memory.ts:235:37 + (i32.add + (get_local $1) + ;;@ ~lib/memory.ts:235:43 + (get_local $2) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.copy (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/memory.ts:16:4 + (call $~lib/memory/memmove + ;;@ ~lib/memory.ts:16:12 + (get_local $0) + ;;@ ~lib/memory.ts:16:18 + (get_local $1) + ;;@ ~lib/memory.ts:16:23 + (get_local $2) + ) + ) + (func $~lib/memory/memcmp (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + ;;@ ~lib/memory.ts:302:2 + (if + ;;@ ~lib/memory.ts:302:6 + (i32.eq + (get_local $0) + ;;@ ~lib/memory.ts:302:12 + (get_local $1) + ) + ;;@ ~lib/memory.ts:302:23 + (return + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:303:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/memory.ts:303:9 + (if (result i32) + (tee_local $3 + (i32.ne + (get_local $2) + ;;@ ~lib/memory.ts:303:14 + (i32.const 0) + ) + ) + ;;@ ~lib/memory.ts:303:19 + (i32.eq + (i32.load8_u + ;;@ ~lib/memory.ts:303:28 + (get_local $0) + ) + ;;@ ~lib/memory.ts:303:35 + (i32.load8_u + ;;@ ~lib/memory.ts:303:44 + (get_local $1) + ) + ) + (get_local $3) + ) + (block + (block + ;;@ ~lib/memory.ts:304:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:304:9 + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:304:15 + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/memory.ts:306:53 + (if (result i32) + ;;@ ~lib/memory.ts:306:9 + (get_local $2) + ;;@ ~lib/memory.ts:306:13 + (i32.sub + (i32.load8_u + ;;@ ~lib/memory.ts:306:27 + (get_local $0) + ) + ;;@ ~lib/memory.ts:306:33 + (i32.load8_u + ;;@ ~lib/memory.ts:306:47 + (get_local $1) + ) + ) + ;;@ ~lib/memory.ts:306:53 + (i32.const 0) + ) + ) + (func $~lib/memory/memory.compare (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + ;;@ ~lib/memory.ts:21:27 + (call $~lib/memory/memcmp + ;;@ ~lib/memory.ts:21:18 + (get_local $0) + ;;@ ~lib/memory.ts:21:22 + (get_local $1) + ;;@ ~lib/memory.ts:21:26 + (get_local $2) + ) + ) + (func $~lib/allocator/tlsf/Root#set:tailRef (; 8 ;) (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 +3371,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 (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) ;;@ ~lib/allocator/tlsf.ts:144:4 (if (i32.eqz @@ -45,7 +3379,7 @@ (i32.lt_u (get_local $1) ;;@ ~lib/allocator/tlsf.ts:144:16 - (i32.const 22) + (get_global $~lib/allocator/tlsf/FL_BITS) ) ) (block @@ -74,7 +3408,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 (; 10 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) ;;@ ~lib/allocator/tlsf.ts:167:4 (if (i32.eqz @@ -82,7 +3416,7 @@ (i32.lt_u (get_local $1) ;;@ ~lib/allocator/tlsf.ts:167:16 - (i32.const 22) + (get_global $~lib/allocator/tlsf/FL_BITS) ) ) (block @@ -102,7 +3436,7 @@ (i32.lt_u (get_local $2) ;;@ ~lib/allocator/tlsf.ts:168:16 - (i32.const 32) + (get_global $~lib/allocator/tlsf/SL_SIZE) ) ) (block @@ -127,7 +3461,7 @@ (i32.mul (get_local $1) ;;@ ~lib/allocator/tlsf.ts:170:38 - (i32.const 32) + (get_global $~lib/allocator/tlsf/SL_SIZE) ) ;;@ ~lib/allocator/tlsf.ts:170:48 (get_local $2) @@ -140,14 +3474,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 (; 11 ;) (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 (; 12 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) ;;@ ~lib/allocator/tlsf.ts:89:4 (if @@ -160,7 +3494,7 @@ ;;@ ~lib/allocator/tlsf.ts:89:23 (i32.xor ;;@ ~lib/allocator/tlsf.ts:89:24 - (i32.const 3) + (get_global $~lib/allocator/tlsf/TAGS) (i32.const -1) ) ) @@ -185,7 +3519,7 @@ (i32.add (get_local $0) ;;@ ~lib/allocator/tlsf.ts:92:34 - (i32.const 8) + (get_global $~lib/allocator/tlsf/Block.INFO) ) ;;@ ~lib/allocator/tlsf.ts:92:47 (i32.and @@ -196,7 +3530,7 @@ ;;@ ~lib/allocator/tlsf.ts:92:60 (i32.xor ;;@ ~lib/allocator/tlsf.ts:92:61 - (i32.const 3) + (get_global $~lib/allocator/tlsf/TAGS) (i32.const -1) ) ) @@ -215,7 +3549,7 @@ (get_local $1) ) ) - (func $~lib/allocator/tlsf/fls (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/fls (; 13 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:428:2 (if (i32.eqz @@ -247,7 +3581,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 (; 14 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:158:4 (if (i32.eqz @@ -255,7 +3589,7 @@ (i32.lt_u (get_local $1) ;;@ ~lib/allocator/tlsf.ts:158:16 - (i32.const 22) + (get_global $~lib/allocator/tlsf/FL_BITS) ) ) (block @@ -275,7 +3609,7 @@ (i32.lt_u (get_local $2) ;;@ ~lib/allocator/tlsf.ts:159:16 - (i32.const 32) + (get_global $~lib/allocator/tlsf/SL_SIZE) ) ) (block @@ -300,7 +3634,7 @@ (i32.mul (get_local $1) ;;@ ~lib/allocator/tlsf.ts:161:38 - (i32.const 32) + (get_global $~lib/allocator/tlsf/SL_SIZE) ) ;;@ ~lib/allocator/tlsf.ts:161:48 (get_local $2) @@ -311,7 +3645,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Root#getSLMap (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/allocator/tlsf/Root#getSLMap (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:138:4 (if (i32.eqz @@ -319,7 +3653,7 @@ (i32.lt_u (get_local $1) ;;@ ~lib/allocator/tlsf.ts:138:16 - (i32.const 22) + (get_global $~lib/allocator/tlsf/FL_BITS) ) ) (block @@ -346,7 +3680,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Root#remove (; 9 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/allocator/tlsf/Root#remove (; 16 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -368,7 +3702,7 @@ (i32.and (get_local $2) ;;@ ~lib/allocator/tlsf.ts:258:23 - (i32.const 1) + (get_global $~lib/allocator/tlsf/FREE) ) ) (block @@ -389,7 +3723,7 @@ ;;@ ~lib/allocator/tlsf.ts:259:27 (i32.xor ;;@ ~lib/allocator/tlsf.ts:259:28 - (i32.const 3) + (get_global $~lib/allocator/tlsf/TAGS) (i32.const -1) ) ) @@ -403,14 +3737,14 @@ (i32.ge_u (get_local $3) ;;@ ~lib/allocator/tlsf.ts:260:19 - (i32.const 16) + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) ) ) ;;@ ~lib/allocator/tlsf.ts:260:37 (i32.lt_u (get_local $3) ;;@ ~lib/allocator/tlsf.ts:260:44 - (i32.const 1073741824) + (get_global $~lib/allocator/tlsf/Block.MAX_SIZE) ) (get_local $4) ) @@ -431,7 +3765,7 @@ (i32.lt_u (get_local $3) ;;@ ~lib/allocator/tlsf.ts:264:15 - (i32.const 256) + (get_global $~lib/allocator/tlsf/SB_SIZE) ) ;;@ ~lib/allocator/tlsf.ts:264:24 (block @@ -447,7 +3781,7 @@ ;;@ ~lib/allocator/tlsf.ts:266:17 (get_local $3) ;;@ ~lib/allocator/tlsf.ts:266:24 - (i32.const 8) + (get_global $~lib/internal/allocator/AL_SIZE) ) ) ) @@ -474,7 +3808,7 @@ ;;@ ~lib/allocator/tlsf.ts:269:27 (get_local $5) ;;@ ~lib/allocator/tlsf.ts:269:32 - (i32.const 5) + (get_global $~lib/allocator/tlsf/SL_BITS) ) ) ;;@ ~lib/allocator/tlsf.ts:269:44 @@ -482,7 +3816,7 @@ ;;@ ~lib/allocator/tlsf.ts:269:45 (i32.const 1) ;;@ ~lib/allocator/tlsf.ts:269:50 - (i32.const 5) + (get_global $~lib/allocator/tlsf/SL_BITS) ) ) ) @@ -492,7 +3826,7 @@ (get_local $5) ;;@ ~lib/allocator/tlsf.ts:270:12 (i32.sub - (i32.const 8) + (get_global $~lib/allocator/tlsf/SB_BITS) ;;@ ~lib/allocator/tlsf.ts:270:22 (i32.const 1) ) @@ -640,7 +3974,7 @@ ) ) ) - (func $~lib/allocator/tlsf/Block#get:left (; 10 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/Block#get:left (; 17 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) ;;@ ~lib/allocator/tlsf.ts:81:4 (if @@ -651,7 +3985,7 @@ (get_local $0) ) ;;@ ~lib/allocator/tlsf.ts:81:23 - (i32.const 2) + (get_global $~lib/allocator/tlsf/LEFT_FREE) ) ) (block @@ -691,7 +4025,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 (; 18 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) ;;@ ~lib/allocator/tlsf.ts:334:4 (if (i32.eqz @@ -701,7 +4035,7 @@ (get_local $1) ) ;;@ ~lib/allocator/tlsf.ts:334:23 - (i32.const 1) + (get_global $~lib/allocator/tlsf/FREE) ) ) (block @@ -745,7 +4079,7 @@ (get_local $2) ) ;;@ ~lib/allocator/tlsf.ts:336:24 - (i32.const 2) + (get_global $~lib/allocator/tlsf/LEFT_FREE) ) ) (block @@ -770,7 +4104,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 (; 19 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -810,7 +4144,7 @@ (i32.and (get_local $2) ;;@ ~lib/allocator/tlsf.ts:191:23 - (i32.const 1) + (get_global $~lib/allocator/tlsf/FREE) ) ) (block @@ -839,20 +4173,20 @@ ;;@ ~lib/allocator/tlsf.ts:194:27 (i32.xor ;;@ ~lib/allocator/tlsf.ts:194:28 - (i32.const 3) + (get_global $~lib/allocator/tlsf/TAGS) (i32.const -1) ) ) ) ;;@ ~lib/allocator/tlsf.ts:194:37 - (i32.const 16) + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) ) ) ;;@ ~lib/allocator/tlsf.ts:194:55 (i32.lt_u (get_local $3) ;;@ ~lib/allocator/tlsf.ts:194:62 - (i32.const 1073741824) + (get_global $~lib/allocator/tlsf/Block.MAX_SIZE) ) (get_local $4) ) @@ -904,7 +4238,7 @@ (i32.and (get_local $6) ;;@ ~lib/allocator/tlsf.ts:201:20 - (i32.const 1) + (get_global $~lib/allocator/tlsf/FREE) ) ;;@ ~lib/allocator/tlsf.ts:201:26 (block @@ -925,7 +4259,7 @@ (get_local $2) ;;@ ~lib/allocator/tlsf.ts:203:33 (i32.add - (i32.const 8) + (get_global $~lib/allocator/tlsf/Block.INFO) ;;@ ~lib/allocator/tlsf.ts:203:46 (i32.and ;;@ ~lib/allocator/tlsf.ts:203:47 @@ -933,7 +4267,7 @@ ;;@ ~lib/allocator/tlsf.ts:203:59 (i32.xor ;;@ ~lib/allocator/tlsf.ts:203:60 - (i32.const 3) + (get_global $~lib/allocator/tlsf/TAGS) (i32.const -1) ) ) @@ -963,7 +4297,7 @@ (i32.and (get_local $2) ;;@ ~lib/allocator/tlsf.ts:210:20 - (i32.const 2) + (get_global $~lib/allocator/tlsf/LEFT_FREE) ) ;;@ ~lib/allocator/tlsf.ts:210:31 (block @@ -1005,7 +4339,7 @@ (i32.and (get_local $7) ;;@ ~lib/allocator/tlsf.ts:213:24 - (i32.const 1) + (get_global $~lib/allocator/tlsf/FREE) ) ) (block @@ -1035,7 +4369,7 @@ (get_local $7) ;;@ ~lib/allocator/tlsf.ts:215:31 (i32.add - (i32.const 8) + (get_global $~lib/allocator/tlsf/Block.INFO) ;;@ ~lib/allocator/tlsf.ts:215:44 (i32.and ;;@ ~lib/allocator/tlsf.ts:215:45 @@ -1043,7 +4377,7 @@ ;;@ ~lib/allocator/tlsf.ts:215:57 (i32.xor ;;@ ~lib/allocator/tlsf.ts:215:58 - (i32.const 3) + (get_global $~lib/allocator/tlsf/TAGS) (i32.const -1) ) ) @@ -1070,7 +4404,7 @@ (i32.or (get_local $6) ;;@ ~lib/allocator/tlsf.ts:221:29 - (i32.const 2) + (get_global $~lib/allocator/tlsf/LEFT_FREE) ) ) ;;@ ~lib/allocator/tlsf.ts:222:9 @@ -1090,7 +4424,7 @@ ;;@ ~lib/allocator/tlsf.ts:225:23 (i32.xor ;;@ ~lib/allocator/tlsf.ts:225:24 - (i32.const 3) + (get_global $~lib/allocator/tlsf/TAGS) (i32.const -1) ) ) @@ -1104,14 +4438,14 @@ (i32.ge_u (get_local $3) ;;@ ~lib/allocator/tlsf.ts:226:19 - (i32.const 16) + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) ) ) ;;@ ~lib/allocator/tlsf.ts:226:37 (i32.lt_u (get_local $3) ;;@ ~lib/allocator/tlsf.ts:226:44 - (i32.const 1073741824) + (get_global $~lib/allocator/tlsf/Block.MAX_SIZE) ) (get_local $7) ) @@ -1132,7 +4466,7 @@ (i32.lt_u (get_local $3) ;;@ ~lib/allocator/tlsf.ts:230:15 - (i32.const 256) + (get_global $~lib/allocator/tlsf/SB_SIZE) ) ;;@ ~lib/allocator/tlsf.ts:230:24 (block @@ -1148,7 +4482,7 @@ ;;@ ~lib/allocator/tlsf.ts:232:17 (get_local $3) ;;@ ~lib/allocator/tlsf.ts:232:24 - (i32.const 8) + (get_global $~lib/internal/allocator/AL_SIZE) ) ) ) @@ -1175,7 +4509,7 @@ ;;@ ~lib/allocator/tlsf.ts:235:27 (get_local $8) ;;@ ~lib/allocator/tlsf.ts:235:32 - (i32.const 5) + (get_global $~lib/allocator/tlsf/SL_BITS) ) ) ;;@ ~lib/allocator/tlsf.ts:235:44 @@ -1183,7 +4517,7 @@ ;;@ ~lib/allocator/tlsf.ts:235:45 (i32.const 1) ;;@ ~lib/allocator/tlsf.ts:235:50 - (i32.const 5) + (get_global $~lib/allocator/tlsf/SL_BITS) ) ) ) @@ -1193,7 +4527,7 @@ (get_local $8) ;;@ ~lib/allocator/tlsf.ts:236:12 (i32.sub - (i32.const 8) + (get_global $~lib/allocator/tlsf/SB_BITS) ;;@ ~lib/allocator/tlsf.ts:236:22 (i32.const 1) ) @@ -1288,7 +4622,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 (; 20 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1325,7 +4659,7 @@ ;;@ ~lib/allocator/tlsf.ts:378:13 (get_local $1) ;;@ ~lib/allocator/tlsf.ts:378:21 - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) ) ) @@ -1349,7 +4683,7 @@ ;;@ ~lib/allocator/tlsf.ts:379:13 (get_local $2) ;;@ ~lib/allocator/tlsf.ts:379:19 - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) ) ) @@ -1412,7 +4746,7 @@ (i32.sub (get_local $1) ;;@ ~lib/allocator/tlsf.ts:387:18 - (i32.const 8) + (get_global $~lib/allocator/tlsf/Block.INFO) ) ;;@ ~lib/allocator/tlsf.ts:387:32 (get_local $3) @@ -1424,7 +4758,7 @@ (i32.sub (get_local $1) ;;@ ~lib/allocator/tlsf.ts:388:17 - (i32.const 8) + (get_global $~lib/allocator/tlsf/Block.INFO) ) ) ;;@ ~lib/allocator/tlsf.ts:389:8 @@ -1447,7 +4781,7 @@ (i32.add (get_local $0) ;;@ ~lib/allocator/tlsf.ts:393:48 - (i32.const 2916) + (get_global $~lib/allocator/tlsf/Root.SIZE) ) ) ) @@ -1479,12 +4813,12 @@ ;;@ ~lib/allocator/tlsf.ts:398:15 (i32.add (i32.add - (i32.const 8) + (get_global $~lib/allocator/tlsf/Block.INFO) ;;@ ~lib/allocator/tlsf.ts:398:28 - (i32.const 16) + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) ) ;;@ ~lib/allocator/tlsf.ts:398:45 - (i32.const 8) + (get_global $~lib/allocator/tlsf/Block.INFO) ) ) ;;@ ~lib/allocator/tlsf.ts:398:57 @@ -1502,7 +4836,7 @@ (i32.mul (i32.const 2) ;;@ ~lib/allocator/tlsf.ts:403:30 - (i32.const 8) + (get_global $~lib/allocator/tlsf/Block.INFO) ) ) ) @@ -1519,14 +4853,14 @@ (i32.or (get_local $6) ;;@ ~lib/allocator/tlsf.ts:405:27 - (i32.const 1) + (get_global $~lib/allocator/tlsf/FREE) ) ;;@ ~lib/allocator/tlsf.ts:405:34 (i32.and ;;@ ~lib/allocator/tlsf.ts:405:35 (get_local $4) ;;@ ~lib/allocator/tlsf.ts:405:46 - (i32.const 2) + (get_global $~lib/allocator/tlsf/LEFT_FREE) ) ) ) @@ -1553,7 +4887,7 @@ (get_local $5) ) ;;@ ~lib/allocator/tlsf.ts:410:48 - (i32.const 8) + (get_global $~lib/allocator/tlsf/Block.INFO) ) ) ;;@ ~lib/allocator/tlsf.ts:411:4 @@ -1563,7 +4897,7 @@ (i32.or (i32.const 0) ;;@ ~lib/allocator/tlsf.ts:411:20 - (i32.const 2) + (get_global $~lib/allocator/tlsf/LEFT_FREE) ) ) ;;@ ~lib/allocator/tlsf.ts:412:4 @@ -1582,7 +4916,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 (; 21 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:422:2 (if (i32.eqz @@ -1609,7 +4943,7 @@ (get_local $0) ) ) - (func $~lib/allocator/tlsf/ffs (; 15 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/ffs (; 22 ;) (type $ii) (param $0 i32) (result i32) ;;@ ~lib/allocator/tlsf.ts:422:2 (if (i32.eqz @@ -1636,7 +4970,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 (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1652,14 +4986,14 @@ (i32.ge_u (get_local $1) ;;@ ~lib/allocator/tlsf.ts:296:19 - (i32.const 16) + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) ) ) ;;@ ~lib/allocator/tlsf.ts:296:37 (i32.lt_u (get_local $1) ;;@ ~lib/allocator/tlsf.ts:296:44 - (i32.const 1073741824) + (get_global $~lib/allocator/tlsf/Block.MAX_SIZE) ) (get_local $2) ) @@ -1680,7 +5014,7 @@ (i32.lt_u (get_local $1) ;;@ ~lib/allocator/tlsf.ts:300:15 - (i32.const 256) + (get_global $~lib/allocator/tlsf/SB_SIZE) ) ;;@ ~lib/allocator/tlsf.ts:300:24 (block @@ -1696,7 +5030,7 @@ ;;@ ~lib/allocator/tlsf.ts:302:17 (get_local $1) ;;@ ~lib/allocator/tlsf.ts:302:24 - (i32.const 8) + (get_global $~lib/internal/allocator/AL_SIZE) ) ) ) @@ -1723,7 +5057,7 @@ ;;@ ~lib/allocator/tlsf.ts:306:27 (get_local $3) ;;@ ~lib/allocator/tlsf.ts:306:32 - (i32.const 5) + (get_global $~lib/allocator/tlsf/SL_BITS) ) ) ;;@ ~lib/allocator/tlsf.ts:306:44 @@ -1731,7 +5065,7 @@ ;;@ ~lib/allocator/tlsf.ts:306:45 (i32.const 1) ;;@ ~lib/allocator/tlsf.ts:306:50 - (i32.const 5) + (get_global $~lib/allocator/tlsf/SL_BITS) ) ) ) @@ -1741,7 +5075,7 @@ (get_local $3) ;;@ ~lib/allocator/tlsf.ts:307:12 (i32.sub - (i32.const 8) + (get_global $~lib/allocator/tlsf/SB_BITS) ;;@ ~lib/allocator/tlsf.ts:307:22 (i32.const 1) ) @@ -1754,7 +5088,7 @@ (get_local $4) ;;@ ~lib/allocator/tlsf.ts:309:15 (i32.sub - (i32.const 32) + (get_global $~lib/allocator/tlsf/SL_SIZE) ;;@ ~lib/allocator/tlsf.ts:309:25 (i32.const 1) ) @@ -1927,7 +5261,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 (; 24 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1945,7 +5279,7 @@ (i32.and (get_local $3) ;;@ ~lib/allocator/tlsf.ts:348:23 - (i32.const 1) + (get_global $~lib/allocator/tlsf/FREE) ) ) (block @@ -1967,14 +5301,14 @@ (i32.ge_u (get_local $2) ;;@ ~lib/allocator/tlsf.ts:349:19 - (i32.const 16) + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) ) ) ;;@ ~lib/allocator/tlsf.ts:349:37 (i32.lt_u (get_local $2) ;;@ ~lib/allocator/tlsf.ts:349:44 - (i32.const 1073741824) + (get_global $~lib/allocator/tlsf/Block.MAX_SIZE) ) (get_local $4) ) @@ -1999,7 +5333,7 @@ ;;@ ~lib/allocator/tlsf.ts:350:13 (get_local $2) ;;@ ~lib/allocator/tlsf.ts:350:20 - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) ) ) @@ -2030,7 +5364,7 @@ ;;@ ~lib/allocator/tlsf.ts:355:33 (i32.xor ;;@ ~lib/allocator/tlsf.ts:355:34 - (i32.const 3) + (get_global $~lib/allocator/tlsf/TAGS) (i32.const -1) ) ) @@ -2045,9 +5379,9 @@ (get_local $5) ;;@ ~lib/allocator/tlsf.ts:356:21 (i32.add - (i32.const 8) + (get_global $~lib/allocator/tlsf/Block.INFO) ;;@ ~lib/allocator/tlsf.ts:356:34 - (i32.const 16) + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) ) ) ;;@ ~lib/allocator/tlsf.ts:356:50 @@ -2063,7 +5397,7 @@ ;;@ ~lib/allocator/tlsf.ts:357:27 (get_local $3) ;;@ ~lib/allocator/tlsf.ts:357:39 - (i32.const 2) + (get_global $~lib/allocator/tlsf/LEFT_FREE) ) ) ) @@ -2075,7 +5409,7 @@ (i32.add (get_local $1) ;;@ ~lib/allocator/tlsf.ts:360:35 - (i32.const 8) + (get_global $~lib/allocator/tlsf/Block.INFO) ) ;;@ ~lib/allocator/tlsf.ts:360:48 (get_local $2) @@ -2090,10 +5424,10 @@ ;;@ ~lib/allocator/tlsf.ts:362:20 (get_local $5) ;;@ ~lib/allocator/tlsf.ts:362:32 - (i32.const 8) + (get_global $~lib/allocator/tlsf/Block.INFO) ) ;;@ ~lib/allocator/tlsf.ts:362:46 - (i32.const 1) + (get_global $~lib/allocator/tlsf/FREE) ) ) ;;@ ~lib/allocator/tlsf.ts:363:11 @@ -2115,7 +5449,7 @@ ;;@ ~lib/allocator/tlsf.ts:367:31 (i32.xor ;;@ ~lib/allocator/tlsf.ts:367:32 - (i32.const 1) + (get_global $~lib/allocator/tlsf/FREE) (i32.const -1) ) ) @@ -2154,7 +5488,7 @@ ;;@ ~lib/allocator/tlsf.ts:369:20 (i32.xor ;;@ ~lib/allocator/tlsf.ts:369:21 - (i32.const 2) + (get_global $~lib/allocator/tlsf/LEFT_FREE) (i32.const -1) ) ) @@ -2166,10 +5500,10 @@ ;;@ ~lib/allocator/tlsf.ts:372:11 (get_local $1) ;;@ ~lib/allocator/tlsf.ts:372:38 - (i32.const 8) + (get_global $~lib/allocator/tlsf/Block.INFO) ) ) - (func $~lib/allocator/tlsf/allocate_memory (; 18 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/tlsf/__memory_allocate (; 25 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -2200,19 +5534,19 @@ ;;@ ~lib/allocator/tlsf.ts:445:22 (get_global $HEAP_BASE) ;;@ ~lib/allocator/tlsf.ts:445:34 - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) ;;@ ~lib/allocator/tlsf.ts:445:45 (i32.xor ;;@ ~lib/allocator/tlsf.ts:445:46 - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) ;;@ ~lib/allocator/tlsf.ts:446:4 (set_local $3 - ;;@ ~lib/allocator/tlsf.ts:446:22 + ;;@ ~lib/allocator/tlsf.ts:446:29 (current_memory) ) ;;@ ~lib/allocator/tlsf.ts:447:4 @@ -2228,7 +5562,7 @@ ;;@ ~lib/allocator/tlsf.ts:447:31 (get_local $2) ;;@ ~lib/allocator/tlsf.ts:447:44 - (i32.const 2916) + (get_global $~lib/allocator/tlsf/Root.SIZE) ) ;;@ ~lib/allocator/tlsf.ts:447:57 (i32.const 65535) @@ -2257,6 +5591,7 @@ ) ;;@ ~lib/allocator/tlsf.ts:448:37 (i32.lt_s + ;;@ ~lib/allocator/tlsf.ts:448:44 (grow_memory ;;@ ~lib/allocator/tlsf.ts:448:49 (i32.sub @@ -2307,7 +5642,7 @@ (i32.lt_u (get_local $5) ;;@ ~lib/allocator/tlsf.ts:452:33 - (i32.const 22) + (get_global $~lib/allocator/tlsf/FL_BITS) ) ) ) @@ -2336,7 +5671,7 @@ (i32.lt_u (get_local $6) ;;@ ~lib/allocator/tlsf.ts:454:33 - (i32.const 32) + (get_global $~lib/allocator/tlsf/SL_SIZE) ) ) ) @@ -2386,22 +5721,23 @@ (i32.add (get_local $2) ;;@ ~lib/allocator/tlsf.ts:458:33 - (i32.const 2916) + (get_global $~lib/allocator/tlsf/Root.SIZE) ) ;;@ ~lib/allocator/tlsf.ts:458:45 - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) ;;@ ~lib/allocator/tlsf.ts:458:56 (i32.xor ;;@ ~lib/allocator/tlsf.ts:458:57 - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ;;@ ~lib/allocator/tlsf.ts:458:66 (i32.shl + ;;@ ~lib/allocator/tlsf.ts:458:73 (current_memory) - ;;@ ~lib/allocator/tlsf.ts:458:86 + ;;@ ~lib/allocator/tlsf.ts:458:83 (i32.const 16) ) ) @@ -2425,7 +5761,7 @@ (i32.gt_u (get_local $0) ;;@ ~lib/allocator/tlsf.ts:464:15 - (i32.const 1073741824) + (get_global $~lib/allocator/tlsf/Block.MAX_SIZE) ) ;;@ ~lib/allocator/tlsf.ts:464:31 (unreachable) @@ -2441,19 +5777,19 @@ ;;@ ~lib/allocator/tlsf.ts:466:23 (get_local $0) ;;@ ~lib/allocator/tlsf.ts:466:30 - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) ) ;;@ ~lib/allocator/tlsf.ts:466:41 (i32.xor ;;@ ~lib/allocator/tlsf.ts:466:42 - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) ) (tee_local $3 ;;@ ~lib/allocator/tlsf.ts:466:51 - (i32.const 16) + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) ) (i32.gt_u (get_local $4) @@ -2482,7 +5818,7 @@ (block ;;@ ~lib/allocator/tlsf.ts:472:6 (set_local $3 - ;;@ ~lib/allocator/tlsf.ts:472:24 + ;;@ ~lib/allocator/tlsf.ts:472:31 (current_memory) ) ;;@ ~lib/allocator/tlsf.ts:473:6 @@ -2531,6 +5867,7 @@ (if ;;@ ~lib/allocator/tlsf.ts:475:10 (i32.lt_s + ;;@ ~lib/allocator/tlsf.ts:475:17 (grow_memory ;;@ ~lib/allocator/tlsf.ts:475:22 (get_local $5) @@ -2542,6 +5879,7 @@ (if ;;@ ~lib/allocator/tlsf.ts:476:12 (i32.lt_s + ;;@ ~lib/allocator/tlsf.ts:476:19 (grow_memory ;;@ ~lib/allocator/tlsf.ts:476:24 (get_local $2) @@ -2555,7 +5893,7 @@ ) ;;@ ~lib/allocator/tlsf.ts:480:6 (set_local $6 - ;;@ ~lib/allocator/tlsf.ts:480:23 + ;;@ ~lib/allocator/tlsf.ts:480:30 (current_memory) ) ;;@ ~lib/allocator/tlsf.ts:481:11 @@ -2619,7 +5957,7 @@ ;;@ ~lib/allocator/tlsf.ts:485:25 (i32.xor ;;@ ~lib/allocator/tlsf.ts:485:26 - (i32.const 3) + (get_global $~lib/allocator/tlsf/TAGS) (i32.const -1) ) ) @@ -2654,7 +5992,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 (; 26 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:37:4 + (return + ;;@ ~lib/memory.ts:37:45 + (call $~lib/allocator/tlsf/__memory_allocate + ;;@ ~lib/memory.ts:37:63 + (get_local $0) + ) + ) + ) + (func $~lib/allocator/tlsf/__memory_free (; 27 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -2682,7 +6030,7 @@ ;;@ ~lib/allocator/tlsf.ts:498:36 (get_local $0) ;;@ ~lib/allocator/tlsf.ts:498:43 - (i32.const 8) + (get_global $~lib/allocator/tlsf/Block.INFO) ) ) ;;@ ~lib/allocator/tlsf.ts:499:6 @@ -2702,7 +6050,7 @@ ;;@ ~lib/allocator/tlsf.ts:500:15 (get_local $3) ;;@ ~lib/allocator/tlsf.ts:500:27 - (i32.const 1) + (get_global $~lib/allocator/tlsf/FREE) ) ) ) @@ -2723,7 +6071,7 @@ (i32.or (get_local $3) ;;@ ~lib/allocator/tlsf.ts:501:31 - (i32.const 1) + (get_global $~lib/allocator/tlsf/FREE) ) ) ;;@ ~lib/allocator/tlsf.ts:502:11 @@ -2735,7 +6083,7 @@ ;;@ ~lib/allocator/tlsf.ts:502:36 (get_local $0) ;;@ ~lib/allocator/tlsf.ts:502:43 - (i32.const 8) + (get_global $~lib/allocator/tlsf/Block.INFO) ) ) ) @@ -2743,7 +6091,26 @@ ) ) ) - (func $start (; 20 ;) (type $v) + (func $~lib/memory/memory.free (; 28 ;) (type $iv) (param $0 i32) + ;;@ ~lib/memory.ts:43:36 + (call $~lib/allocator/tlsf/__memory_free + ;;@ ~lib/memory.ts:43:50 + (get_local $0) + ) + ;;@ ~lib/memory.ts:43:56 + (return) + ) + (func $~lib/allocator/tlsf/__memory_reset (; 29 ;) (type $v) + ;;@ ~lib/allocator/tlsf.ts:509:2 + (unreachable) + ) + (func $~lib/memory/memory.reset (; 30 ;) (type $v) + ;;@ ~lib/memory.ts:49:37 + (call $~lib/allocator/tlsf/__memory_reset) + ;;@ ~lib/memory.ts:49:55 + (return) + ) + (func $start (; 31 ;) (type $v) ;;@ ~lib/allocator/tlsf.ts:122:0 (if (i32.eqz @@ -2753,7 +6120,7 @@ ;;@ ~lib/allocator/tlsf.ts:122:8 (i32.const 1) ;;@ ~lib/allocator/tlsf.ts:122:13 - (i32.const 5) + (get_global $~lib/allocator/tlsf/SL_BITS) ) ;;@ ~lib/allocator/tlsf.ts:122:25 (i32.const 32) diff --git a/tests/binaryen/const-expr.js b/tests/binaryen/const-expr.js new file mode 100644 index 00000000..61b3ddca --- /dev/null +++ b/tests/binaryen/const-expr.js @@ -0,0 +1,29 @@ +var binaryen = require("binaryen"); + +var mod = new binaryen.Module(); + +var addType = mod.addFunctionType("iii", binaryen.i32, [ binaryen.i32, binaryen.i32 ]); +mod.addFunction("add", addType, [], + mod.i32.add( + mod.get_local(0, binaryen.i32), + mod.get_local(1, binaryen.i32) + ) +); +mod.addFunctionExport("add", "add"); + +var testType = mod.addFunctionType("i", binaryen.i32, []); +mod.addFunction("test", testType, [], + mod.call("add", [ + mod.i32.const(1), + mod.i32.const(2) + ], binaryen.i32) +); +mod.addFunctionExport("test", "test"); + +binaryen.setOptimizeLevel(4); +binaryen.setShrinkLevel(0); +binaryen.setDebugInfo(false); +mod.runPasses(["precompute"]); +if (!mod.validate()) + console.log("-> does not validate"); +console.log(mod.emitText()); diff --git a/tests/binaryen/const-expr.wat b/tests/binaryen/const-expr.wat new file mode 100644 index 00000000..936b198e --- /dev/null +++ b/tests/binaryen/const-expr.wat @@ -0,0 +1,19 @@ +(module + (type $iii (func (param i32 i32) (result i32))) + (type $i (func (result i32))) + (export "add" (func $add)) + (export "test" (func $test)) + (func $add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (func $test (; 1 ;) (type $i) (result i32) + (call $add + (i32.const 1) + (i32.const 2) + ) + ) +) + 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.js b/tests/compiler.js index 96da3280..d77ad7ff 100644 --- a/tests/compiler.js +++ b/tests/compiler.js @@ -153,16 +153,40 @@ tests.forEach(filename => { // Instantiate try { + let memory = new WebAssembly.Memory({ initial: 10 }); + let exports = {}; + + function getString(ptr) { + if (!ptr) return "null"; + var U32 = new Uint32Array(exports.memory ? exports.memory.buffer : memory.buffer); + var U16 = new Uint16Array(exports.memory ? exports.memory.buffer : memory.buffer); + var dataLength = U32[ptr >>> 2]; + var dataOffset = (ptr + 4) >>> 1; + var dataRemain = dataLength; + var parts = []; + const chunkSize = 1024; + while (dataRemain > chunkSize) { + let last = U16[dataOffset + chunkSize - 1]; + let size = last >= 0xD800 && last < 0xDC00 ? chunkSize - 1 : chunkSize; + let part = U16.subarray(dataOffset, dataOffset += size); + parts.push(String.fromCharCode.apply(String, part)); + dataRemain -= size; + } + return parts.join("") + String.fromCharCode.apply(String, U16.subarray(dataOffset, dataOffset + dataRemain)); + } + let runTime = asc.measure(() => { - let exports = new WebAssembly.Instance(new WebAssembly.Module(stdout.toBuffer()), { + exports = new WebAssembly.Instance(new WebAssembly.Module(stdout.toBuffer()), { env: { + memory, abort: function(msg, file, line, column) { - console.log("abort called at " + line + ":" + column); + console.log(colorsUtil.red(" abort: " + getString(msg) + " at " + getString(file) + ":" + line + ":" + column)); + }, + trace: function(msg, n) { + console.log(" " + getString(msg) + (n ? " " : "") + Array.prototype.slice.call(arguments, 2, 2 + n).join(", ")); }, externalFunction: function() { }, - externalConstant: 1, - logi: function(i) { console.log("logi: " + i); }, - logf: function(f) { console.log("logf: " + f); } + externalConstant: 1 }, JSOp: { mod: function(a, b) { return a % b; } @@ -188,10 +212,16 @@ tests.forEach(filename => { bar: function() {}, baz: function() {}, "var": 3 - }, - }); + } + }).exports; + if (exports.main) { + console.log(colorsUtil.white(" [main]")); + var code = exports.main(); + console.log(colorsUtil.white(" [exit " + code + "]\n")); + } }); console.log("- " + colorsUtil.green("instantiate OK") + " (" + asc.formatTime(runTime) + ")"); + console.log("\n " + Object.keys(exports).map(key => "[" + (typeof exports[key]).substring(0, 3) + "] " + key).join("\n ")); } catch (e) { console.log("- " + colorsUtil.red("instantiate ERROR: ") + e.stack); failed = true; 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/binary.optimized.wat b/tests/compiler/binary.optimized.wat index 45343ae9..0645ef48 100644 --- a/tests/compiler/binary.optimized.wat +++ b/tests/compiler/binary.optimized.wat @@ -2,9 +2,7 @@ (type $FFF (func (param f64 f64) (result f64))) (type $FiF (func (param f64 i32) (result f64))) (type $fff (func (param f32 f32) (result f32))) - (type $fi (func (param f32) (result i32))) (type $fif (func (param f32 i32) (result f32))) - (type $Fi (func (param f64) (result i32))) (type $v (func)) (global $binary/b (mut i32) (i32.const 0)) (global $binary/i (mut i32) (i32.const 0)) @@ -1555,13 +1553,7 @@ (f64.const 1.e+300) ) ) - (func $isNaN (; 2 ;) (type $fi) (param $0 f32) (result i32) - (f32.ne - (get_local $0) - (get_local $0) - ) - ) - (func $~lib/math/NativeMathf.mod (; 3 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.mod (; 2 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1613,14 +1605,18 @@ ) ) (set_local $3 - (call $isNaN + (f32.ne + (get_local $1) (get_local $1) ) ) ) (if (i32.eqz - (get_local $3) + (i32.and + (get_local $3) + (i32.const 1) + ) ) (set_local $3 (i32.eq @@ -1630,7 +1626,10 @@ ) ) (if - (get_local $3) + (i32.and + (get_local $3) + (i32.const 1) + ) (return (f32.div (tee_local $0 @@ -1902,7 +1901,7 @@ (get_local $0) ) ) - (func $~lib/math/NativeMathf.scalbn (; 4 ;) (type $fif) (param $0 f32) (param $1 i32) (result f32) + (func $~lib/math/NativeMathf.scalbn (; 3 ;) (type $fif) (param $0 f32) (param $1 i32) (result f32) (local $2 f32) (set_local $2 (get_local $0) @@ -2014,7 +2013,7 @@ ) ) ) - (func $~lib/math/NativeMathf.pow (; 5 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.pow (; 4 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 f32) (local $3 f32) (local $4 i32) @@ -3201,13 +3200,7 @@ (f32.const 1.0000000031710769e-30) ) ) - (func $isNaN (; 6 ;) (type $Fi) (param $0 f64) (result i32) - (f64.ne - (get_local $0) - (get_local $0) - ) - ) - (func $~lib/math/NativeMath.mod (; 7 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.mod (; 5 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i32) (local $4 i64) @@ -3267,7 +3260,8 @@ ) ) (set_local $7 - (call $isNaN + (f64.ne + (get_local $1) (get_local $1) ) ) @@ -3581,7 +3575,7 @@ (get_local $0) ) ) - (func $start (; 8 ;) (type $v) + (func $start (; 6 ;) (type $v) (drop (i32.rem_s (get_global $binary/i) diff --git a/tests/compiler/binary.untouched.wat b/tests/compiler/binary.untouched.wat index 6ae5ff78..9ebe4a44 100644 --- a/tests/compiler/binary.untouched.wat +++ b/tests/compiler/binary.untouched.wat @@ -2,9 +2,7 @@ (type $FFF (func (param f64 f64) (result f64))) (type $FiF (func (param f64 i32) (result f64))) (type $fff (func (param f32 f32) (result f32))) - (type $fi (func (param f32) (result i32))) (type $fif (func (param f32 i32) (result f32))) - (type $Fi (func (param f64) (result i32))) (type $v (func)) (global $binary/b (mut i32) (i32.const 0)) (global $binary/i (mut i32) (i32.const 0)) @@ -1692,13 +1690,7 @@ (get_local $13) ) ) - (func $isNaN (; 2 ;) (type $fi) (param $0 f32) (result i32) - (f32.ne - (get_local $0) - (get_local $0) - ) - ) - (func $~lib/math/NativeMathf.mod (; 3 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.mod (; 2 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1741,29 +1733,38 @@ ) ) (if - (if (result i32) - (tee_local $7 - (if (result i32) + (i32.and + (if (result i32) + (i32.and (tee_local $7 - (i32.eq - (i32.shl - (get_local $3) - (i32.const 1) + (if (result i32) + (tee_local $7 + (i32.eq + (i32.shl + (get_local $3) + (i32.const 1) + ) + (i32.const 0) + ) + ) + (get_local $7) + (block $~lib/builtins/isNaN|inlined.1 (result i32) + (f32.ne + (get_local $1) + (get_local $1) + ) ) - (i32.const 0) ) ) - (get_local $7) - (call $isNaN - (get_local $1) - ) + (i32.const 1) + ) + (get_local $7) + (i32.eq + (get_local $4) + (i32.const 255) ) ) - (get_local $7) - (i32.eq - (get_local $4) - (i32.const 255) - ) + (i32.const 1) ) (return (f32.div @@ -2119,7 +2120,7 @@ (get_local $2) ) ) - (func $~lib/math/NativeMathf.scalbn (; 4 ;) (type $fif) (param $0 f32) (param $1 i32) (result f32) + (func $~lib/math/NativeMathf.scalbn (; 3 ;) (type $fif) (param $0 f32) (param $1 i32) (result f32) (local $2 f32) (set_local $2 (get_local $0) @@ -2235,7 +2236,7 @@ ) ) ) - (func $~lib/math/NativeMathf.pow (; 5 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.pow (; 4 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3550,13 +3551,7 @@ (get_local $11) ) ) - (func $isNaN (; 6 ;) (type $Fi) (param $0 f64) (result i32) - (f64.ne - (get_local $0) - (get_local $0) - ) - ) - (func $~lib/math/NativeMath.mod (; 7 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.mod (; 5 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i64) (local $4 i32) @@ -3605,29 +3600,38 @@ ) ) (if - (if (result i32) - (tee_local $7 - (if (result i32) + (i32.and + (if (result i32) + (i32.and (tee_local $7 - (i64.eq - (i64.shl - (get_local $3) - (i64.const 1) + (if (result i32) + (tee_local $7 + (i64.eq + (i64.shl + (get_local $3) + (i64.const 1) + ) + (i64.const 0) + ) + ) + (get_local $7) + (block $~lib/builtins/isNaN|inlined.1 (result i32) + (f64.ne + (get_local $1) + (get_local $1) + ) ) - (i64.const 0) ) ) - (get_local $7) - (call $isNaN - (get_local $1) - ) + (i32.const 1) + ) + (get_local $7) + (i32.eq + (get_local $4) + (i32.const 2047) ) ) - (get_local $7) - (i32.eq - (get_local $4) - (i32.const 2047) - ) + (i32.const 1) ) (return (f64.div @@ -3996,7 +4000,7 @@ (get_local $2) ) ) - (func $start (; 8 ;) (type $v) + (func $start (; 6 ;) (type $v) (drop (i32.lt_s (get_global $binary/i) diff --git a/tests/compiler/builtins.optimized.wat b/tests/compiler/builtins.optimized.wat index d3cc2769..2a588b92 100644 --- a/tests/compiler/builtins.optimized.wat +++ b/tests/compiler/builtins.optimized.wat @@ -1,7 +1,5 @@ (module (type $iiiiv (func (param i32 i32 i32 i32))) - (type $fi (func (param f32) (result i32))) - (type $Fi (func (param f64) (result i32))) (type $iiv (func (param i32 i32))) (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) @@ -19,47 +17,17 @@ (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 - (get_local $0) - (get_local $0) - ) - ) - (func $isFinite (; 2 ;) (type $fi) (param $0 f32) (result i32) - (f32.eq - (f32.sub - (get_local $0) - (get_local $0) - ) - (f32.const 0) - ) - ) - (func $isNaN (; 3 ;) (type $Fi) (param $0 f64) (result i32) - (f64.ne - (get_local $0) - (get_local $0) - ) - ) - (func $isFinite (; 4 ;) (type $Fi) (param $0 f64) (result i32) - (f64.eq - (f64.sub - (get_local $0) - (get_local $0) - ) - (f64.const 0) - ) - ) - (func $start~anonymous|0 (; 5 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $start~anonymous|0 (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32) (nop) ) - (func $builtins/test (; 6 ;) (type $v) + (func $builtins/test (; 2 ;) (type $v) (nop) ) - (func $start (; 7 ;) (type $v) + (func $start (; 3 ;) (type $v) (set_global $builtins/i (i32.const 31) ) @@ -198,96 +166,6 @@ (unreachable) ) ) - (if - (call $isNaN - (f32.const 1.25) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 87) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (i32.ne - (call $isNaN - (f32.const nan:0x400000) - ) - (i32.const 1) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 88) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (i32.ne - (call $isFinite - (f32.const 1.25) - ) - (i32.const 1) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 89) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (call $isFinite - (f32.const inf) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 90) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (call $isFinite - (f32.const -inf) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 91) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (call $isFinite - (f32.const nan:0x400000) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 92) - (i32.const 0) - ) - (unreachable) - ) - ) (set_global $builtins/f (f32.const nan:0x400000) ) @@ -322,104 +200,10 @@ (f32.const 1) ) (set_global $builtins/b - (call $isNaN - (f32.const 1.25) - ) + (i32.const 0) ) (set_global $builtins/b - (call $isFinite - (f32.const 1.25) - ) - ) - (if - (call $isNaN - (f64.const 1.25) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 123) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (i32.ne - (call $isNaN - (f64.const nan:0x8000000000000) - ) - (i32.const 1) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 124) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (i32.ne - (call $isFinite - (f64.const 1.25) - ) - (i32.const 1) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 125) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (call $isFinite - (f64.const inf) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 126) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (call $isFinite - (f64.const -inf) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 127) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (call $isFinite - (f64.const nan:0x8000000000000) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 128) - (i32.const 0) - ) - (unreachable) - ) + (i32.const 1) ) (set_global $builtins/F (f64.const nan:0x8000000000000) @@ -455,14 +239,10 @@ (f64.const 1) ) (set_global $builtins/b - (call $isNaN - (f64.const 1.25) - ) + (i32.const 0) ) (set_global $builtins/b - (call $isFinite - (f64.const 1.25) - ) + (i32.const 1) ) (set_global $builtins/i (i32.load @@ -767,126 +547,6 @@ (i32.const 2) (get_global $builtins/fn) ) - (if - (i32.eqz - (call $isNaN - (f32.const nan:0x400000) - ) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 271) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (i32.eqz - (call $isNaN - (f64.const nan:0x8000000000000) - ) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 272) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (call $isFinite - (f32.const nan:0x400000) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 273) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (call $isFinite - (f32.const inf) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 274) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (call $isFinite - (f64.const nan:0x8000000000000) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 275) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (call $isFinite - (f64.const inf) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 276) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (i32.eqz - (call $isFinite - (f32.const 0) - ) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 277) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (i32.eqz - (call $isFinite - (f64.const 0) - ) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 8) - (i32.const 278) - (i32.const 0) - ) - (unreachable) - ) - ) (drop (i32.load8_s (i32.const 8) @@ -993,10 +653,5 @@ (i32.const 8) (f64.const 1) ) - (drop - (call $isNaN - (f64.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..4af9e20c 100644 --- a/tests/compiler/builtins.untouched.wat +++ b/tests/compiler/builtins.untouched.wat @@ -1,7 +1,5 @@ (module (type $iiiiv (func (param i32 i32 i32 i32))) - (type $fi (func (param f32) (result i32))) - (type $Fi (func (param f64) (result i32))) (type $iiv (func (param i32 i32))) (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) @@ -17,57 +15,57 @@ (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 $~lib/builtins/i8.MIN_VALUE i32 (i32.const -128)) + (global $~lib/builtins/i8.MAX_VALUE i32 (i32.const 127)) + (global $~lib/builtins/i16.MIN_VALUE i32 (i32.const -32768)) + (global $~lib/builtins/i16.MAX_VALUE i32 (i32.const 32767)) + (global $~lib/builtins/i32.MIN_VALUE i32 (i32.const -2147483648)) + (global $~lib/builtins/i32.MAX_VALUE i32 (i32.const 2147483647)) + (global $~lib/builtins/i64.MIN_VALUE i64 (i64.const -9223372036854775808)) + (global $~lib/builtins/i64.MAX_VALUE i64 (i64.const 9223372036854775807)) + (global $~lib/builtins/u8.MIN_VALUE i32 (i32.const 0)) + (global $~lib/builtins/u8.MAX_VALUE i32 (i32.const 255)) + (global $~lib/builtins/u16.MIN_VALUE i32 (i32.const 0)) + (global $~lib/builtins/u16.MAX_VALUE i32 (i32.const 65535)) + (global $~lib/builtins/u32.MIN_VALUE i32 (i32.const 0)) + (global $~lib/builtins/u32.MAX_VALUE i32 (i32.const -1)) + (global $~lib/builtins/u64.MIN_VALUE i64 (i64.const 0)) + (global $~lib/builtins/u64.MAX_VALUE i64 (i64.const -1)) + (global $~lib/builtins/bool.MIN_VALUE i32 (i32.const 0)) + (global $~lib/builtins/bool.MAX_VALUE i32 (i32.const 1)) + (global $~lib/builtins/f32.MIN_VALUE f32 (f32.const -3402823466385288598117041e14)) + (global $~lib/builtins/f32.MAX_VALUE f32 (f32.const 3402823466385288598117041e14)) + (global $~lib/builtins/f32.MIN_SAFE_INTEGER f32 (f32.const -16777215)) + (global $~lib/builtins/f32.MAX_SAFE_INTEGER f32 (f32.const 16777215)) + (global $~lib/builtins/f32.EPSILON f32 (f32.const 1.1920928955078125e-07)) + (global $~lib/builtins/f64.MIN_VALUE f64 (f64.const -1797693134862315708145274e284)) + (global $~lib/builtins/f64.MAX_VALUE f64 (f64.const 1797693134862315708145274e284)) + (global $~lib/builtins/f64.MIN_SAFE_INTEGER f64 (f64.const -9007199254740991)) + (global $~lib/builtins/f64.MAX_SAFE_INTEGER f64 (f64.const 9007199254740991)) + (global $~lib/builtins/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 - (get_local $0) - (get_local $0) - ) - ) - (func $isFinite (; 2 ;) (type $fi) (param $0 f32) (result i32) - (f32.eq - (f32.sub - (get_local $0) - (get_local $0) - ) - (f32.const 0) - ) - ) - (func $isNaN (; 3 ;) (type $Fi) (param $0 f64) (result i32) - (f64.ne - (get_local $0) - (get_local $0) - ) - ) - (func $isFinite (; 4 ;) (type $Fi) (param $0 f64) (result i32) - (f64.eq - (f64.sub - (get_local $0) - (get_local $0) - ) - (f64.const 0) - ) - ) - (func $start~anonymous|0 (; 5 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $start~anonymous|0 (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32) (nop) ) - (func $builtins/test (; 6 ;) (type $v) + (func $builtins/test (; 2 ;) (type $v) (nop) ) - (func $start (; 7 ;) (type $v) + (func $start (; 3 ;) (type $v) (local $0 i32) (local $1 i32) (local $2 i64) (local $3 i64) + (local $4 f32) + (local $5 f64) (if (i32.eqz (i32.const 1) @@ -809,8 +807,17 @@ (if (i32.eqz (i32.eq - (call $isNaN - (f32.const 1.25) + (i32.and + (block $~lib/builtins/isNaN|inlined.0 (result i32) + (set_local $4 + (f32.const 1.25) + ) + (f32.ne + (get_local $4) + (get_local $4) + ) + ) + (i32.const 1) ) (i32.const 0) ) @@ -828,8 +835,17 @@ (if (i32.eqz (i32.eq - (call $isNaN - (f32.const nan:0x400000) + (i32.and + (block $~lib/builtins/isNaN|inlined.1 (result i32) + (set_local $4 + (f32.const nan:0x400000) + ) + (f32.ne + (get_local $4) + (get_local $4) + ) + ) + (i32.const 1) ) (i32.const 1) ) @@ -847,8 +863,20 @@ (if (i32.eqz (i32.eq - (call $isFinite - (f32.const 1.25) + (i32.and + (block $~lib/builtins/isFinite|inlined.0 (result i32) + (set_local $4 + (f32.const 1.25) + ) + (f32.eq + (f32.sub + (get_local $4) + (get_local $4) + ) + (f32.const 0) + ) + ) + (i32.const 1) ) (i32.const 1) ) @@ -866,8 +894,20 @@ (if (i32.eqz (i32.eq - (call $isFinite - (f32.const inf) + (i32.and + (block $~lib/builtins/isFinite|inlined.1 (result i32) + (set_local $4 + (f32.const inf) + ) + (f32.eq + (f32.sub + (get_local $4) + (get_local $4) + ) + (f32.const 0) + ) + ) + (i32.const 1) ) (i32.const 0) ) @@ -885,10 +925,22 @@ (if (i32.eqz (i32.eq - (call $isFinite - (f32.neg - (f32.const inf) + (i32.and + (block $~lib/builtins/isFinite|inlined.2 (result i32) + (set_local $4 + (f32.neg + (f32.const inf) + ) + ) + (f32.eq + (f32.sub + (get_local $4) + (get_local $4) + ) + (f32.const 0) + ) ) + (i32.const 1) ) (i32.const 0) ) @@ -906,8 +958,20 @@ (if (i32.eqz (i32.eq - (call $isFinite - (f32.const nan:0x400000) + (i32.and + (block $~lib/builtins/isFinite|inlined.3 (result i32) + (set_local $4 + (f32.const nan:0x400000) + ) + (f32.eq + (f32.sub + (get_local $4) + (get_local $4) + ) + (f32.const 0) + ) + ) + (i32.const 1) ) (i32.const 0) ) @@ -977,13 +1041,34 @@ ) ) (set_global $builtins/b - (call $isNaN - (f32.const 1.25) + (i32.and + (block $~lib/builtins/isNaN|inlined.2 (result i32) + (set_local $4 + (f32.const 1.25) + ) + (f32.ne + (get_local $4) + (get_local $4) + ) + ) + (i32.const 1) ) ) (set_global $builtins/b - (call $isFinite - (f32.const 1.25) + (i32.and + (block $~lib/builtins/isFinite|inlined.4 (result i32) + (set_local $4 + (f32.const 1.25) + ) + (f32.eq + (f32.sub + (get_local $4) + (get_local $4) + ) + (f32.const 0) + ) + ) + (i32.const 1) ) ) (drop @@ -1049,8 +1134,17 @@ (if (i32.eqz (i32.eq - (call $isNaN - (f64.const 1.25) + (i32.and + (block $~lib/builtins/isNaN|inlined.0 (result i32) + (set_local $5 + (f64.const 1.25) + ) + (f64.ne + (get_local $5) + (get_local $5) + ) + ) + (i32.const 1) ) (i32.const 0) ) @@ -1068,8 +1162,17 @@ (if (i32.eqz (i32.eq - (call $isNaN - (f64.const nan:0x8000000000000) + (i32.and + (block $~lib/builtins/isNaN|inlined.1 (result i32) + (set_local $5 + (f64.const nan:0x8000000000000) + ) + (f64.ne + (get_local $5) + (get_local $5) + ) + ) + (i32.const 1) ) (i32.const 1) ) @@ -1087,8 +1190,20 @@ (if (i32.eqz (i32.eq - (call $isFinite - (f64.const 1.25) + (i32.and + (block $~lib/builtins/isFinite|inlined.0 (result i32) + (set_local $5 + (f64.const 1.25) + ) + (f64.eq + (f64.sub + (get_local $5) + (get_local $5) + ) + (f64.const 0) + ) + ) + (i32.const 1) ) (i32.const 1) ) @@ -1106,8 +1221,20 @@ (if (i32.eqz (i32.eq - (call $isFinite - (f64.const inf) + (i32.and + (block $~lib/builtins/isFinite|inlined.1 (result i32) + (set_local $5 + (f64.const inf) + ) + (f64.eq + (f64.sub + (get_local $5) + (get_local $5) + ) + (f64.const 0) + ) + ) + (i32.const 1) ) (i32.const 0) ) @@ -1125,10 +1252,22 @@ (if (i32.eqz (i32.eq - (call $isFinite - (f64.neg - (f64.const inf) + (i32.and + (block $~lib/builtins/isFinite|inlined.2 (result i32) + (set_local $5 + (f64.neg + (f64.const inf) + ) + ) + (f64.eq + (f64.sub + (get_local $5) + (get_local $5) + ) + (f64.const 0) + ) ) + (i32.const 1) ) (i32.const 0) ) @@ -1146,8 +1285,20 @@ (if (i32.eqz (i32.eq - (call $isFinite - (f64.const nan:0x8000000000000) + (i32.and + (block $~lib/builtins/isFinite|inlined.3 (result i32) + (set_local $5 + (f64.const nan:0x8000000000000) + ) + (f64.eq + (f64.sub + (get_local $5) + (get_local $5) + ) + (f64.const 0) + ) + ) + (i32.const 1) ) (i32.const 0) ) @@ -1217,13 +1368,34 @@ ) ) (set_global $builtins/b - (call $isNaN - (f64.const 1.25) + (i32.and + (block $~lib/builtins/isNaN|inlined.2 (result i32) + (set_local $5 + (f64.const 1.25) + ) + (f64.ne + (get_local $5) + (get_local $5) + ) + ) + (i32.const 1) ) ) (set_global $builtins/b - (call $isFinite - (f64.const 1.25) + (i32.and + (block $~lib/builtins/isFinite|inlined.4 (result i32) + (set_local $5 + (f64.const 1.25) + ) + (f64.eq + (f64.sub + (get_local $5) + (get_local $5) + ) + (f64.const 0) + ) + ) + (i32.const 1) ) ) (set_global $builtins/i @@ -1917,8 +2089,17 @@ ) (if (i32.eqz - (call $isNaN - (f32.const nan:0x400000) + (i32.and + (block $~lib/builtins/isNaN|inlined.3 (result i32) + (set_local $4 + (f32.const nan:0x400000) + ) + (f32.ne + (get_local $4) + (get_local $4) + ) + ) + (i32.const 1) ) ) (block @@ -1933,8 +2114,17 @@ ) (if (i32.eqz - (call $isNaN - (f64.const nan:0x8000000000000) + (i32.and + (block $~lib/builtins/isNaN|inlined.3 (result i32) + (set_local $5 + (f64.const nan:0x8000000000000) + ) + (f64.ne + (get_local $5) + (get_local $5) + ) + ) + (i32.const 1) ) ) (block @@ -1950,8 +2140,20 @@ (if (i32.eqz (i32.eqz - (call $isFinite - (f32.const nan:0x400000) + (i32.and + (block $~lib/builtins/isFinite|inlined.5 (result i32) + (set_local $4 + (f32.const nan:0x400000) + ) + (f32.eq + (f32.sub + (get_local $4) + (get_local $4) + ) + (f32.const 0) + ) + ) + (i32.const 1) ) ) ) @@ -1968,8 +2170,20 @@ (if (i32.eqz (i32.eqz - (call $isFinite - (f32.const inf) + (i32.and + (block $~lib/builtins/isFinite|inlined.6 (result i32) + (set_local $4 + (f32.const inf) + ) + (f32.eq + (f32.sub + (get_local $4) + (get_local $4) + ) + (f32.const 0) + ) + ) + (i32.const 1) ) ) ) @@ -1986,8 +2200,20 @@ (if (i32.eqz (i32.eqz - (call $isFinite - (f64.const nan:0x8000000000000) + (i32.and + (block $~lib/builtins/isFinite|inlined.5 (result i32) + (set_local $5 + (f64.const nan:0x8000000000000) + ) + (f64.eq + (f64.sub + (get_local $5) + (get_local $5) + ) + (f64.const 0) + ) + ) + (i32.const 1) ) ) ) @@ -2004,8 +2230,20 @@ (if (i32.eqz (i32.eqz - (call $isFinite - (f64.const inf) + (i32.and + (block $~lib/builtins/isFinite|inlined.6 (result i32) + (set_local $5 + (f64.const inf) + ) + (f64.eq + (f64.sub + (get_local $5) + (get_local $5) + ) + (f64.const 0) + ) + ) + (i32.const 1) ) ) ) @@ -2021,8 +2259,20 @@ ) (if (i32.eqz - (call $isFinite - (f32.const 0) + (i32.and + (block $~lib/builtins/isFinite|inlined.7 (result i32) + (set_local $4 + (f32.const 0) + ) + (f32.eq + (f32.sub + (get_local $4) + (get_local $4) + ) + (f32.const 0) + ) + ) + (i32.const 1) ) ) (block @@ -2037,8 +2287,20 @@ ) (if (i32.eqz - (call $isFinite - (f64.const 0) + (i32.and + (block $~lib/builtins/isFinite|inlined.7 (result i32) + (set_local $5 + (f64.const 0) + ) + (f64.eq + (f64.sub + (get_local $5) + (get_local $5) + ) + (f64.const 0) + ) + ) + (i32.const 1) ) ) (block @@ -2054,7 +2316,7 @@ (if (i32.eqz (i32.eq - (i32.const -128) + (get_global $~lib/builtins/i8.MIN_VALUE) (i32.shr_s (i32.shl (i32.const 128) @@ -2077,7 +2339,7 @@ (if (i32.eqz (i32.eq - (i32.const 127) + (get_global $~lib/builtins/i8.MAX_VALUE) (i32.const 127) ) ) @@ -2094,7 +2356,7 @@ (if (i32.eqz (i32.eq - (i32.const -32768) + (get_global $~lib/builtins/i16.MIN_VALUE) (i32.shr_s (i32.shl (i32.const 32768) @@ -2117,7 +2379,7 @@ (if (i32.eqz (i32.eq - (i32.const 32767) + (get_global $~lib/builtins/i16.MAX_VALUE) (i32.const 32767) ) ) @@ -2134,7 +2396,7 @@ (if (i32.eqz (i32.eq - (i32.const -2147483648) + (get_global $~lib/builtins/i32.MIN_VALUE) (i32.const -2147483648) ) ) @@ -2151,7 +2413,7 @@ (if (i32.eqz (i32.eq - (i32.const 2147483647) + (get_global $~lib/builtins/i32.MAX_VALUE) (i32.const 2147483647) ) ) @@ -2168,7 +2430,7 @@ (if (i32.eqz (i64.eq - (i64.const -9223372036854775808) + (get_global $~lib/builtins/i64.MIN_VALUE) (i64.const -9223372036854775808) ) ) @@ -2185,7 +2447,7 @@ (if (i32.eqz (i64.eq - (i64.const 9223372036854775807) + (get_global $~lib/builtins/i64.MAX_VALUE) (i64.const 9223372036854775807) ) ) @@ -2202,7 +2464,7 @@ (if (i32.eqz (i32.eq - (i32.const 0) + (get_global $~lib/builtins/u8.MIN_VALUE) (i32.const 0) ) ) @@ -2219,7 +2481,7 @@ (if (i32.eqz (i32.eq - (i32.const 255) + (get_global $~lib/builtins/u8.MAX_VALUE) (i32.const 255) ) ) @@ -2236,7 +2498,7 @@ (if (i32.eqz (i32.eq - (i32.const 0) + (get_global $~lib/builtins/u16.MIN_VALUE) (i32.const 0) ) ) @@ -2253,7 +2515,7 @@ (if (i32.eqz (i32.eq - (i32.const 65535) + (get_global $~lib/builtins/u16.MAX_VALUE) (i32.const 65535) ) ) @@ -2270,7 +2532,7 @@ (if (i32.eqz (i32.eq - (i32.const 0) + (get_global $~lib/builtins/u32.MIN_VALUE) (i32.const 0) ) ) @@ -2287,7 +2549,7 @@ (if (i32.eqz (i32.eq - (i32.const -1) + (get_global $~lib/builtins/u32.MAX_VALUE) (i32.const -1) ) ) @@ -2304,7 +2566,7 @@ (if (i32.eqz (i64.eq - (i64.const 0) + (get_global $~lib/builtins/u64.MIN_VALUE) (i64.const 0) ) ) @@ -2321,7 +2583,7 @@ (if (i32.eqz (i64.eq - (i64.const -1) + (get_global $~lib/builtins/u64.MAX_VALUE) (i64.const -1) ) ) @@ -2338,7 +2600,7 @@ (if (i32.eqz (i32.eq - (i32.const 0) + (get_global $~lib/builtins/bool.MIN_VALUE) (i32.const 0) ) ) @@ -2355,7 +2617,7 @@ (if (i32.eqz (i32.eq - (i32.const 0) + (get_global $~lib/builtins/bool.MIN_VALUE) (i32.const 0) ) ) @@ -2372,7 +2634,7 @@ (if (i32.eqz (i32.eq - (i32.const 1) + (get_global $~lib/builtins/bool.MAX_VALUE) (i32.const 1) ) ) @@ -2389,7 +2651,7 @@ (if (i32.eqz (i32.eq - (i32.const 1) + (get_global $~lib/builtins/bool.MAX_VALUE) (i32.const 1) ) ) @@ -2406,7 +2668,7 @@ (if (i32.eqz (f32.eq - (f32.const -3402823466385288598117041e14) + (get_global $~lib/builtins/f32.MIN_VALUE) (f32.const -3402823466385288598117041e14) ) ) @@ -2423,7 +2685,7 @@ (if (i32.eqz (f32.eq - (f32.const 3402823466385288598117041e14) + (get_global $~lib/builtins/f32.MAX_VALUE) (f32.const 3402823466385288598117041e14) ) ) @@ -2440,7 +2702,7 @@ (if (i32.eqz (f32.eq - (f32.const -16777215) + (get_global $~lib/builtins/f32.MIN_SAFE_INTEGER) (f32.const -16777215) ) ) @@ -2457,7 +2719,7 @@ (if (i32.eqz (f32.eq - (f32.const 16777215) + (get_global $~lib/builtins/f32.MAX_SAFE_INTEGER) (f32.const 16777215) ) ) @@ -2474,7 +2736,7 @@ (if (i32.eqz (f32.eq - (f32.const 1.1920928955078125e-07) + (get_global $~lib/builtins/f32.EPSILON) (f32.const 1.1920928955078125e-07) ) ) @@ -2491,7 +2753,7 @@ (if (i32.eqz (f64.eq - (f64.const -1797693134862315708145274e284) + (get_global $~lib/builtins/f64.MIN_VALUE) (f64.const -1797693134862315708145274e284) ) ) @@ -2508,7 +2770,7 @@ (if (i32.eqz (f64.eq - (f64.const 1797693134862315708145274e284) + (get_global $~lib/builtins/f64.MAX_VALUE) (f64.const 1797693134862315708145274e284) ) ) @@ -2525,7 +2787,7 @@ (if (i32.eqz (f64.eq - (f64.const -9007199254740991) + (get_global $~lib/builtins/f64.MIN_SAFE_INTEGER) (f64.const -9007199254740991) ) ) @@ -2542,7 +2804,7 @@ (if (i32.eqz (f64.eq - (f64.const 9007199254740991) + (get_global $~lib/builtins/f64.MAX_SAFE_INTEGER) (f64.const 9007199254740991) ) ) @@ -2559,7 +2821,7 @@ (if (i32.eqz (f64.eq - (f64.const 2.220446049250313e-16) + (get_global $~lib/builtins/f64.EPSILON) (f64.const 2.220446049250313e-16) ) ) @@ -2850,8 +3112,14 @@ ) ) (drop - (call $isNaN - (f64.const 1) + (block $~lib/builtins/isNaN|inlined.4 (result i32) + (set_local $5 + (f64.const 1) + ) + (f64.ne + (get_local $5) + (get_local $5) + ) ) ) ) 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..a0b9e587 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,10 @@ (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/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -172,14 +144,19 @@ ) (i32.const 0) ) - (func $exports/Car#constructor (; 6 ;) (type $iii) (param $0 i32) (param $1 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 $exports/Car#constructor (; 5 ;) (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 +169,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 (; 6 ;) (type $ii) (param $0 i32) (result i32) + (i32.load + (get_local $0) + ) + ) + (func $exports/Car#set:numDoors (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store + (get_local $0) + (get_local $1) + ) + ) + (func $exports/Car#openDoors (; 8 ;) (type $iv) (param $0 i32) + (nop) + ) + (func $start (; 9 ;) (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 (; 10 ;) (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 (; 11 ;) (type $iv) (param $0 i32) + (set_global $~argc + (get_local $0) + ) + ) + (func $exports/Car#constructor|trampoline (; 12 ;) (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 +237,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..c4ad7060 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,16 @@ (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/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -109,7 +82,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -123,10 +96,10 @@ (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) ) ) @@ -204,7 +177,14 @@ ) (i32.const 0) ) - (func $exports/Car#constructor (; 7 ;) (type $iii) (param $0 i32) (param $1 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 $exports/Car#constructor (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (i32.store (tee_local $0 @@ -214,7 +194,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 +211,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 (; 7 ;) (type $ii) (param $0 i32) (result i32) + (i32.load + (get_local $0) + ) + ) + (func $exports/Car#set:numDoors (; 8 ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store + (get_local $0) + (get_local $1) + ) + ) + (func $exports/Car#openDoors (; 9 ;) (type $iv) (param $0 i32) + (nop) + ) + (func $exports/vehicles.Car.getNumTires (; 10 ;) (type $i) (result i32) + (get_global $exports/vehicles.Car.TIRES) + ) + (func $exports/vehicles.Car#constructor (; 11 ;) (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 (; 12 ;) (type $ii) (param $0 i32) (result i32) + (i32.load + (get_local $0) + ) + ) + (func $exports/vehicles.Car#set:numDoors (; 13 ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store + (get_local $0) + (get_local $1) + ) + ) + (func $exports/vehicles.Car#openDoors (; 14 ;) (type $iv) (param $0 i32) + (nop) + ) + (func $start (; 15 ;) (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 (; 16 ;) (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 (; 17 ;) (type $iv) (param $0 i32) + (set_global $~argc + (get_local $0) + ) + ) + (func $exports/Car#constructor|trampoline (; 18 ;) (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 +332,22 @@ (get_local $1) ) ) - (func $Car#get:doors (; 9 ;) (type $ii) (param $0 i32) (result i32) + (func $Car#get:doors (; 19 ;) (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 (; 20 ;) (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 (; 21 ;) (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 +362,15 @@ (get_local $1) ) ) - (func $vehicles.Car#get:doors (; 17 ;) (type $ii) (param $0 i32) (result i32) + (func $vehicles.Car#get:doors (; 22 ;) (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 (; 23 ;) (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..0b04ce4d 100644 --- a/tests/compiler/limits.untouched.wat +++ b/tests/compiler/limits.untouched.wat @@ -1,87 +1,113 @@ (module (type $v (func)) + (global $~lib/builtins/i8.MIN_VALUE i32 (i32.const -128)) + (global $~lib/builtins/i8.MAX_VALUE i32 (i32.const 127)) + (global $~lib/builtins/i16.MIN_VALUE i32 (i32.const -32768)) + (global $~lib/builtins/i16.MAX_VALUE i32 (i32.const 32767)) + (global $~lib/builtins/i32.MIN_VALUE i32 (i32.const -2147483648)) + (global $~lib/builtins/i32.MAX_VALUE i32 (i32.const 2147483647)) + (global $~lib/builtins/i64.MIN_VALUE i64 (i64.const -9223372036854775808)) + (global $~lib/builtins/i64.MAX_VALUE i64 (i64.const 9223372036854775807)) + (global $~lib/builtins/isize.MIN_VALUE i32 (i32.const -2147483648)) + (global $~lib/builtins/isize.MAX_VALUE i32 (i32.const 2147483647)) + (global $~lib/builtins/u8.MIN_VALUE i32 (i32.const 0)) + (global $~lib/builtins/u8.MAX_VALUE i32 (i32.const 255)) + (global $~lib/builtins/u16.MIN_VALUE i32 (i32.const 0)) + (global $~lib/builtins/u16.MAX_VALUE i32 (i32.const 65535)) + (global $~lib/builtins/u32.MIN_VALUE i32 (i32.const 0)) + (global $~lib/builtins/u32.MAX_VALUE i32 (i32.const -1)) + (global $~lib/builtins/u64.MIN_VALUE i64 (i64.const 0)) + (global $~lib/builtins/u64.MAX_VALUE i64 (i64.const -1)) + (global $~lib/builtins/usize.MIN_VALUE i32 (i32.const 0)) + (global $~lib/builtins/usize.MAX_VALUE i32 (i32.const -1)) + (global $~lib/builtins/bool.MIN_VALUE i32 (i32.const 0)) + (global $~lib/builtins/bool.MAX_VALUE i32 (i32.const 1)) + (global $~lib/builtins/f32.MIN_SAFE_INTEGER f32 (f32.const -16777215)) + (global $~lib/builtins/f32.MAX_SAFE_INTEGER f32 (f32.const 16777215)) + (global $~lib/builtins/f64.MIN_SAFE_INTEGER f64 (f64.const -9007199254740991)) + (global $~lib/builtins/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 $~lib/builtins/i8.MIN_VALUE) ) (drop - (i32.const 127) + (get_global $~lib/builtins/i8.MAX_VALUE) ) (drop - (i32.const -32768) + (get_global $~lib/builtins/i16.MIN_VALUE) ) (drop - (i32.const 32767) + (get_global $~lib/builtins/i16.MAX_VALUE) ) (drop - (i32.const -2147483648) + (get_global $~lib/builtins/i32.MIN_VALUE) ) (drop - (i32.const 2147483647) + (get_global $~lib/builtins/i32.MAX_VALUE) ) (drop - (i64.const -9223372036854775808) + (get_global $~lib/builtins/i64.MIN_VALUE) ) (drop - (i64.const 9223372036854775807) + (get_global $~lib/builtins/i64.MAX_VALUE) ) (drop - (i32.const -2147483648) + (get_global $~lib/builtins/isize.MIN_VALUE) ) (drop - (i32.const 2147483647) + (get_global $~lib/builtins/isize.MAX_VALUE) ) (drop - (i32.const 0) + (get_global $~lib/builtins/u8.MIN_VALUE) ) (drop - (i32.const 255) + (get_global $~lib/builtins/u8.MAX_VALUE) ) (drop - (i32.const 0) + (get_global $~lib/builtins/u16.MIN_VALUE) ) (drop - (i32.const 65535) + (get_global $~lib/builtins/u16.MAX_VALUE) ) (drop - (i32.const 0) + (get_global $~lib/builtins/u32.MIN_VALUE) ) (drop - (i32.const -1) + (get_global $~lib/builtins/u32.MAX_VALUE) ) (drop - (i64.const 0) + (get_global $~lib/builtins/u64.MIN_VALUE) ) (drop - (i64.const -1) + (get_global $~lib/builtins/u64.MAX_VALUE) ) (drop - (i32.const 0) + (get_global $~lib/builtins/usize.MIN_VALUE) ) (drop - (i32.const -1) + (get_global $~lib/builtins/usize.MAX_VALUE) ) (drop - (i32.const 0) + (get_global $~lib/builtins/bool.MIN_VALUE) ) (drop - (i32.const 1) + (get_global $~lib/builtins/bool.MAX_VALUE) ) (drop - (f32.const -16777215) + (get_global $~lib/builtins/f32.MIN_SAFE_INTEGER) ) (drop - (f32.const 16777215) + (get_global $~lib/builtins/f32.MAX_SAFE_INTEGER) ) (drop - (f64.const -9007199254740991) + (get_global $~lib/builtins/f64.MIN_SAFE_INTEGER) ) (drop - (f64.const 9007199254740991) + (get_global $~lib/builtins/f64.MAX_SAFE_INTEGER) ) ) ) diff --git a/tests/compiler/main.optimized.wat b/tests/compiler/main.optimized.wat index f4422d67..7a3b5019 100644 --- a/tests/compiler/main.optimized.wat +++ b/tests/compiler/main.optimized.wat @@ -4,8 +4,8 @@ (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)) (func $main/main (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz diff --git a/tests/compiler/main.untouched.wat b/tests/compiler/main.untouched.wat index 3826d542..76d161e5 100644 --- a/tests/compiler/main.untouched.wat +++ b/tests/compiler/main.untouched.wat @@ -5,8 +5,8 @@ (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)) (func $main/main (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz diff --git a/tests/compiler/mandelbrot.optimized.wat b/tests/compiler/mandelbrot.optimized.wat index 517a32a7..93a7f1bc 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) @@ -268,7 +268,7 @@ ) ) ) - (func $isFinite (; 1 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isFinite (; 1 ;) (type $Fi) (param $0 f64) (result i32) (f64.eq (f64.sub (get_local $0) @@ -499,7 +499,7 @@ ) (tee_local $2 (if (result i32) - (call $isFinite + (call $~lib/builtins/isFinite (tee_local $6 (f64.div (call $~lib/math/NativeMath.log diff --git a/tests/compiler/mandelbrot.untouched.wat b/tests/compiler/mandelbrot.untouched.wat index ef264043..2aa859fe 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) @@ -309,7 +310,7 @@ ) ) ) - (func $isFinite (; 1 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isFinite (; 1 ;) (type $Fi) (param $0 f64) (result i32) (f64.eq (f64.sub (get_local $0) @@ -571,19 +572,19 @@ ) ) ) - (f64.const 0.6931471805599453) + (get_global $~lib/math/NativeMath.LN2) ) ) (set_local $17 (if (result i32) - (call $isFinite + (call $~lib/builtins/isFinite (get_local $15) ) (i32.trunc_u/f64 (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..065b7136 100644 --- a/tests/compiler/object-literal.optimized.wat +++ b/tests/compiler/object-literal.optimized.wat @@ -8,13 +8,12 @@ (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/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -100,7 +99,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 (; 2 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/memory/memcmp (; 3 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -112,8 +117,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 +132,10 @@ (get_local $1) ) ) - (get_local $2) ) + ) + (if + (get_local $3) (block (set_local $2 (i32.sub @@ -162,7 +174,14 @@ ) ) ) - (func $~lib/string/String.__eq (; 3 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.compare (; 4 ;) (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 (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eq @@ -209,7 +228,7 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -225,7 +244,7 @@ ) ) ) - (func $object-literal/bar (; 4 ;) (type $iv) (param $0 i32) + (func $object-literal/bar (; 6 ;) (type $iv) (param $0 i32) (if (i32.ne (i32.load @@ -263,7 +282,7 @@ ) ) ) - (func $object-literal/bar2 (; 5 ;) (type $iv) (param $0 i32) + (func $object-literal/bar2 (; 7 ;) (type $iv) (param $0 i32) (if (i32.ne (i32.load @@ -282,7 +301,7 @@ ) ) ) - (func $object-literal/Foo2#test (; 6 ;) (type $iv) (param $0 i32) + (func $object-literal/Foo2#test (; 8 ;) (type $iv) (param $0 i32) (if (i32.ne (i32.load @@ -301,23 +320,17 @@ ) ) ) - (func $start (; 7 ;) (type $v) + (func $start (; 9 ;) (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 +345,7 @@ ) (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 4) ) ) @@ -343,7 +356,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..63c0d36e 100644 --- a/tests/compiler/object-literal.untouched.wat +++ b/tests/compiler/object-literal.untouched.wat @@ -19,7 +19,7 @@ (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/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -32,7 +32,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -46,10 +46,10 @@ (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) ) ) @@ -127,7 +127,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 (; 2 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/memory/memcmp (; 3 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -141,7 +149,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 +163,7 @@ (get_local $1) ) ) - (get_local $2) + (get_local $3) ) (block (block @@ -191,7 +204,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 (; 4 ;) (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 (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -238,14 +258,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 +274,7 @@ ) ) ) - (func $object-literal/bar (; 4 ;) (type $iv) (param $0 i32) + (func $object-literal/bar (; 6 ;) (type $iv) (param $0 i32) (if (i32.eqz (i32.eq @@ -294,7 +314,7 @@ ) ) ) - (func $object-literal/bar2 (; 5 ;) (type $iv) (param $0 i32) + (func $object-literal/bar2 (; 7 ;) (type $iv) (param $0 i32) (if (i32.eqz (i32.eq @@ -315,7 +335,7 @@ ) ) ) - (func $object-literal/Foo2#test (; 6 ;) (type $iv) (param $0 i32) + (func $object-literal/Foo2#test (; 8 ;) (type $iv) (param $0 i32) (if (i32.eqz (i32.eq @@ -336,7 +356,7 @@ ) ) ) - (func $start (; 7 ;) (type $v) + (func $start (; 9 ;) (type $v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -344,10 +364,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 +378,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 +396,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 +410,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..fd09652f 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 $~lib/builtins/i8.MAX_VALUE i32 (i32.const 127)) + (global $~lib/builtins/i8.MIN_VALUE i32 (i32.const -128)) + (global $~lib/builtins/u8.MAX_VALUE i32 (i32.const 255)) + (global $~lib/builtins/i16.MIN_VALUE i32 (i32.const -32768)) + (global $~lib/builtins/i16.MAX_VALUE i32 (i32.const 32767)) + (global $~lib/builtins/u16.MAX_VALUE i32 (i32.const 65535)) + (global $~lib/builtins/i32.MAX_VALUE i32 (i32.const 2147483647)) + (global $~lib/builtins/i32.MIN_VALUE i32 (i32.const -2147483648)) + (global $~lib/builtins/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 $~lib/builtins/i8.MAX_VALUE) ) (call $retain-i32/test - (i32.const 127) + (get_global $~lib/builtins/i8.MAX_VALUE) (i32.const 0) ) (call $retain-i32/test (i32.const 1) - (i32.const 127) + (get_global $~lib/builtins/i8.MAX_VALUE) ) (call $retain-i32/test - (i32.const 127) + (get_global $~lib/builtins/i8.MAX_VALUE) (i32.const 1) ) (call $retain-i32/test (i32.const -1) - (i32.const 127) + (get_global $~lib/builtins/i8.MAX_VALUE) ) (call $retain-i32/test - (i32.const 127) + (get_global $~lib/builtins/i8.MAX_VALUE) (i32.const -1) ) (call $retain-i32/test (i32.const 0) - (i32.const -128) + (get_global $~lib/builtins/i8.MIN_VALUE) ) (call $retain-i32/test - (i32.const -128) + (get_global $~lib/builtins/i8.MIN_VALUE) (i32.const 0) ) (call $retain-i32/test (i32.const 1) - (i32.const -128) + (get_global $~lib/builtins/i8.MIN_VALUE) ) (call $retain-i32/test - (i32.const -128) + (get_global $~lib/builtins/i8.MIN_VALUE) (i32.const 1) ) (call $retain-i32/test (i32.const -1) - (i32.const -128) + (get_global $~lib/builtins/i8.MIN_VALUE) ) (call $retain-i32/test - (i32.const -128) + (get_global $~lib/builtins/i8.MIN_VALUE) (i32.const -1) ) (call $retain-i32/test - (i32.const 127) - (i32.const 127) + (get_global $~lib/builtins/i8.MAX_VALUE) + (get_global $~lib/builtins/i8.MAX_VALUE) ) (call $retain-i32/test - (i32.const -128) - (i32.const -128) + (get_global $~lib/builtins/i8.MIN_VALUE) + (get_global $~lib/builtins/i8.MIN_VALUE) ) (call $retain-i32/test - (i32.const 127) - (i32.const -128) + (get_global $~lib/builtins/i8.MAX_VALUE) + (get_global $~lib/builtins/i8.MIN_VALUE) ) (call $retain-i32/test - (i32.const -128) - (i32.const 127) + (get_global $~lib/builtins/i8.MIN_VALUE) + (get_global $~lib/builtins/i8.MAX_VALUE) ) (call $retain-i32/test (i32.const 0) - (i32.const 255) + (get_global $~lib/builtins/u8.MAX_VALUE) ) (call $retain-i32/test - (i32.const 255) + (get_global $~lib/builtins/u8.MAX_VALUE) (i32.const 0) ) (call $retain-i32/test (i32.const 1) - (i32.const 255) + (get_global $~lib/builtins/u8.MAX_VALUE) ) (call $retain-i32/test - (i32.const 255) + (get_global $~lib/builtins/u8.MAX_VALUE) (i32.const 1) ) (call $retain-i32/test (i32.const -1) - (i32.const 255) + (get_global $~lib/builtins/u8.MAX_VALUE) ) (call $retain-i32/test - (i32.const 255) + (get_global $~lib/builtins/u8.MAX_VALUE) (i32.const -1) ) (call $retain-i32/test - (i32.const 255) - (i32.const 255) + (get_global $~lib/builtins/u8.MAX_VALUE) + (get_global $~lib/builtins/u8.MAX_VALUE) ) (block $break|0 (set_local $0 - (i32.const -128) + (get_global $~lib/builtins/i8.MIN_VALUE) ) (loop $repeat|0 (br_if $break|0 (i32.eqz (i32.le_s (get_local $0) - (i32.const 255) + (get_global $~lib/builtins/u8.MAX_VALUE) ) ) ) @@ -581,39 +590,39 @@ (get_local $0) ) (call $retain-i32/test - (i32.const -128) + (get_global $~lib/builtins/i8.MIN_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const 127) + (get_global $~lib/builtins/i8.MAX_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const 255) + (get_global $~lib/builtins/u8.MAX_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const -32768) + (get_global $~lib/builtins/i16.MIN_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const 32767) + (get_global $~lib/builtins/i16.MAX_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const 65535) + (get_global $~lib/builtins/u16.MAX_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const 2147483647) + (get_global $~lib/builtins/i32.MAX_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const -2147483648) + (get_global $~lib/builtins/i32.MIN_VALUE) (get_local $0) ) (call $retain-i32/test - (i32.const -1) + (get_global $~lib/builtins/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..a238fd5d 100644 --- a/tests/compiler/std/allocator_arena.optimized.wat +++ b/tests/compiler/std/allocator_arena.optimized.wat @@ -11,12 +11,11 @@ (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/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -102,7 +101,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 (; 2 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/memory/memset (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -432,7 +436,14 @@ ) ) ) - (func $~lib/memory/copy_memory (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memory.fill (; 4 ;) (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 (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1818,7 +1829,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -1853,7 +1864,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 +2121,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 (; 7 ;) (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 (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -2122,8 +2141,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 +2156,10 @@ (get_local $1) ) ) - (get_local $2) ) + ) + (if + (get_local $3) (block (set_local $2 (i32.sub @@ -2172,34 +2198,43 @@ ) ) ) - (func $~lib/allocator/arena/free_memory (; 6 ;) (type $iv) (param $0 i32) + (func $~lib/memory/memory.compare (; 9 ;) (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 (; 10 ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/allocator/arena/reset_memory (; 7 ;) (type $v) + (func $~lib/memory/memory.free (; 11 ;) (type $iv) (param $0 i32) + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + ) + (func $~lib/allocator/arena/__memory_reset (; 12 ;) (type $v) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) ) ) - (func $start (; 8 ;) (type $v) + (func $~lib/memory/memory.reset (; 13 ;) (type $v) + (call $~lib/allocator/arena/__memory_reset) + ) + (func $start (; 14 ;) (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 +2253,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 +2283,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 +2300,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 +2330,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 +2348,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 +2357,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..afba45d2 100644 --- a/tests/compiler/std/allocator_arena.untouched.wat +++ b/tests/compiler/std/allocator_arena.untouched.wat @@ -21,7 +21,7 @@ (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/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -34,7 +34,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -48,10 +48,10 @@ (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) ) ) @@ -129,7 +129,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 (; 2 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/memory/memset (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -481,7 +488,14 @@ ) ) ) - (func $~lib/memory/copy_memory (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memory.fill (; 4 ;) (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 (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2283,7 +2297,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.eq @@ -2313,7 +2327,7 @@ ) ) (block - (call $~lib/memory/copy_memory + (call $~lib/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2601,7 +2615,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 (; 7 ;) (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 (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -2615,7 +2637,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 +2651,7 @@ (get_local $1) ) ) - (get_local $2) + (get_local $3) ) (block (block @@ -2665,23 +2692,40 @@ (i32.const 0) ) ) - (func $~lib/allocator/arena/free_memory (; 6 ;) (type $iv) (param $0 i32) + (func $~lib/memory/memory.compare (; 9 ;) (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 (; 10 ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/allocator/arena/reset_memory (; 7 ;) (type $v) + (func $~lib/memory/memory.free (; 11 ;) (type $iv) (param $0 i32) + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + (return) + ) + (func $~lib/allocator/arena/__memory_reset (; 12 ;) (type $v) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) ) ) - (func $start (; 8 ;) (type $v) + (func $~lib/memory/memory.reset (; 13 ;) (type $v) + (call $~lib/allocator/arena/__memory_reset) + (return) + ) + (func $start (; 14 ;) (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 +2734,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 +2760,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 +2774,7 @@ (i32.eqz (i32.lt_u (get_global $std/allocator_arena/i) - (i32.const 42) + (get_global $std/allocator_arena/size) ) ) ) @@ -2750,8 +2794,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 +2809,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 +2823,7 @@ (i32.eqz (i32.lt_u (get_global $std/allocator_arena/i) - (i32.const 42) + (get_global $std/allocator_arena/size) ) ) ) @@ -2799,8 +2843,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 +2861,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 +2873,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 +2911,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..825155c5 100644 --- a/tests/compiler/std/array-literal.optimized.wat +++ b/tests/compiler/std/array-literal.optimized.wat @@ -10,7 +10,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 +66,7 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -153,7 +152,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 5 ;) (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 @@ -172,7 +176,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 +186,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 (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -512,7 +516,14 @@ ) ) ) - (func $~lib/array/Array#constructor (; 7 ;) (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/array/Array#constructor (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -547,7 +558,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -567,7 +578,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 +588,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 (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (i32.store offset=8 (i32.add (i32.load @@ -591,16 +602,10 @@ (get_local $2) ) ) - (func $start (; 9 ;) (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 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..70c26658 100644 --- a/tests/compiler/std/array-literal.untouched.wat +++ b/tests/compiler/std/array-literal.untouched.wat @@ -70,7 +70,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -78,7 +78,7 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -91,7 +91,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -105,10 +105,10 @@ (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) ) ) @@ -186,13 +186,20 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 5 ;) (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 @@ -206,7 +213,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 +225,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 (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -570,7 +577,14 @@ ) ) ) - (func $~lib/array/Array#constructor (; 7 ;) (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/array/Array#constructor (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -608,7 +622,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 +645,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 (; 10 ;) (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 +675,16 @@ ) ) ) - (func $start (; 9 ;) (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) ) ) @@ -682,7 +696,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 +715,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 +735,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 +755,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..dc002a14 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -46,7 +46,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 +88,7 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -175,7 +174,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (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/allocUnsafe (; 5 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -194,7 +198,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 +208,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 (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -534,7 +538,14 @@ ) ) ) - (func $~lib/array/Array#constructor (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.fill (; 7 ;) (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 (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -569,7 +580,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -589,7 +600,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 +610,12 @@ ) (get_local $0) ) - (func $~lib/array/Array#get:length (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 9 ;) (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 (; 10 ;) (type $ii) (param $0 i32) (result i32) (i32.shr_s (i32.load (i32.load @@ -614,7 +625,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 (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2000,7 +2011,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 10 ;) (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 @@ -2035,7 +2046,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 +2303,16 @@ ) ) ) - (func $~lib/internal/arraybuffer/reallocUnsafe (; 11 ;) (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) @@ -2336,7 +2353,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 +2369,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 +2384,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 +2434,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 (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2490,7 +2508,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 (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (i32.lt_u @@ -2519,7 +2537,7 @@ ) ) ) - (func $~lib/array/Array#pop (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#pop (; 17 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -2565,14 +2583,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 (; 18 ;) (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 +2600,7 @@ ) (if (i32.ge_u - (get_local $3) + (get_local $4) (tee_local $5 (i32.shr_u (i32.load @@ -2599,7 +2617,7 @@ (block (if (i32.ge_u - (get_local $3) + (get_local $4) (i32.const 268435454) ) (block @@ -2619,7 +2637,7 @@ (call $~lib/internal/arraybuffer/reallocUnsafe (get_local $2) (i32.shl - (get_local $4) + (get_local $3) (i32.const 2) ) ) @@ -2634,17 +2652,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 +2675,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 (; 19 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -2687,27 +2703,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 +2735,8 @@ ) (i32.store offset=8 (i32.add - (get_local $3) (get_local $2) + (get_local $4) ) (i32.const 0) ) @@ -2730,9 +2744,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 (; 20 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -2814,7 +2828,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 (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (if @@ -2904,7 +2918,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 (; 22 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (if @@ -2994,7 +3008,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 (; 23 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -3040,15 +3054,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 +3070,10 @@ ) ) (i32.add - (get_local $2) + (i32.add + (get_local $2) + (i32.const 8) + ) (i32.shl (i32.add (get_local $1) @@ -3092,7 +3109,7 @@ ) ) ) - (func $~lib/array/Array#__set (; 21 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__set (; 24 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -3159,12 +3176,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 (; 25 ;) (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 (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3240,19 +3257,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 (; 27 ;) (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 (; 28 ;) (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 (; 29 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3264,7 +3281,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 (; 30 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3275,13 +3292,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 (; 31 ;) (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 (; 32 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3357,13 +3374,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 (; 33 ;) (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 (; 34 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3375,13 +3392,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 (; 35 ;) (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 (; 36 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3392,13 +3409,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 (; 37 ;) (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 (; 38 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3474,13 +3491,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 (; 39 ;) (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 (; 40 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3492,13 +3509,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 (; 41 ;) (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 (; 42 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3509,7 +3526,7 @@ (i32.const 3) ) ) - (func $start~anonymous|16 (; 40 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|16 (; 43 ;) (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 +3534,7 @@ ) ) ) - (func $~lib/array/Array#forEach (; 41 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/array/Array#forEach (; 44 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3582,7 +3599,7 @@ ) ) ) - (func $start~anonymous|17 (; 42 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|17 (; 45 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3596,7 +3613,7 @@ ) ) ) - (func $start~anonymous|19 (; 43 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|19 (; 46 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3609,12 +3626,12 @@ ) ) ) - (func $start~anonymous|20 (; 44 ;) (type $iiif) (param $0 i32) (param $1 i32) (param $2 i32) (result f32) + (func $start~anonymous|20 (; 47 ;) (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 (; 48 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3700,7 +3717,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 (; 49 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) (if (result f32) (i32.lt_u (get_local $1) @@ -3727,7 +3744,7 @@ (unreachable) ) ) - (func $start~anonymous|21 (; 47 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|21 (; 50 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3742,7 +3759,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 (; 51 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3828,7 +3845,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 (; 52 ;) (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 +3854,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 (; 53 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3851,13 +3868,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 (; 54 ;) (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 (; 55 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3944,7 +3961,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 (; 56 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3962,7 +3979,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 (; 57 ;) (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 +3991,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 (; 58 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3991,13 +4008,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 (; 59 ;) (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 (; 60 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4066,7 +4083,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 (; 61 ;) (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 +4096,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 (; 62 ;) (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 +4109,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 (; 63 ;) (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 +4121,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 (; 64 ;) (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 +4132,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 (; 65 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $4 @@ -4170,7 +4187,7 @@ ) (get_local $2) ) - (func $~lib/math/murmurHash3 (; 63 ;) (type $II) (param $0 i64) (result i64) + (func $~lib/math/murmurHash3 (; 66 ;) (type $II) (param $0 i64) (result i64) (i64.xor (tee_local $0 (i64.mul @@ -4201,7 +4218,7 @@ ) ) ) - (func $~lib/math/NativeMath.seedRandom (; 64 ;) (type $Iv) (param $0 i64) + (func $~lib/math/NativeMath.seedRandom (; 67 ;) (type $Iv) (param $0 i64) (if (i64.eqz (get_local $0) @@ -4230,7 +4247,7 @@ ) ) ) - (func $std/array/createReverseOrderedArray (; 65 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedArray (; 68 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (call $~lib/array/Array#constructor @@ -4275,7 +4292,7 @@ ) (get_local $1) ) - (func $~lib/math/NativeMath.random (; 66 ;) (type $F) (result f64) + (func $~lib/math/NativeMath.random (; 69 ;) (type $F) (result f64) (local $0 i64) (local $1 i64) (if @@ -4344,7 +4361,7 @@ (f64.const 1) ) ) - (func $std/array/createRandomOrderedArray (; 67 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomOrderedArray (; 70 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $0 (call $~lib/array/Array#constructor @@ -4387,7 +4404,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 (; 71 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.gt_s (get_local $0) @@ -4399,7 +4416,7 @@ ) ) ) - (func $~lib/internal/array/insertionSort (; 69 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/insertionSort (; 72 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4526,10 +4543,15 @@ ) (get_local $0) ) - (func $~lib/allocator/arena/free_memory (; 70 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 73 ;) (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 (; 74 ;) (type $iv) (param $0 i32) + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + ) + (func $~lib/internal/array/weakHeapSort (; 75 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4538,9 +4560,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 +4929,7 @@ (br $repeat|2) ) ) - (call $~lib/allocator/arena/free_memory + (call $~lib/memory/memory.free (get_local $7) ) (set_local $1 @@ -4933,7 +4955,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 (; 76 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5036,7 +5058,7 @@ ) ) ) - (func $std/array/isSorted (; 73 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted (; 77 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -5093,7 +5115,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted (; 74 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted (; 78 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -5115,13 +5137,13 @@ ) ) ) - (func $std/array/assertSortedDefault (; 75 ;) (type $iv) (param $0 i32) + (func $std/array/assertSortedDefault (; 79 ;) (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 (; 80 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -5184,19 +5206,19 @@ ) (i32.const 1) ) - (func $start~anonymous|43 (; 77 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|43 (; 81 ;) (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 (; 82 ;) (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 (; 83 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (call $~lib/array/Array#constructor @@ -5252,7 +5274,7 @@ ) (get_local $1) ) - (func $start~anonymous|47 (; 80 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|47 (; 84 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/array/Array#__get (get_local $0) @@ -5264,7 +5286,7 @@ ) ) ) - (func $~lib/array/Array>#sort (; 81 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#sort (; 85 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5355,7 +5377,7 @@ (get_local $1) ) ) - (func $std/array/assertSorted> (; 82 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted> (; 86 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -5377,14 +5399,14 @@ ) ) ) - (func $std/array/Proxy#constructor (; 83 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/Proxy#constructor (; 87 ;) (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 +5415,7 @@ ) (get_local $0) ) - (func $std/array/createReverseOrderedElementsArray (; 84 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedElementsArray (; 88 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (call $~lib/array/Array#constructor @@ -5441,7 +5463,7 @@ ) (get_local $1) ) - (func $start~anonymous|48 (; 85 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|48 (; 89 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.load (get_local $0) @@ -5451,7 +5473,8 @@ ) ) ) - (func $~lib/memory/compare_memory (; 86 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memcmp (; 90 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -5463,8 +5486,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 +5501,10 @@ (get_local $1) ) ) - (get_local $2) ) + ) + (if + (get_local $3) (block (set_local $2 (i32.sub @@ -5513,7 +5543,14 @@ ) ) ) - (func $~lib/string/String.__gt (; 87 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.compare (; 91 ;) (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 (; 92 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -5573,7 +5610,7 @@ ) ) (i32.gt_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -5597,7 +5634,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 (; 93 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -5657,7 +5694,7 @@ ) ) (i32.lt_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -5681,7 +5718,7 @@ (i32.const 0) ) ) - (func $start~anonymous|49 (; 89 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|49 (; 94 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/string/String.__gt (get_local $0) @@ -5693,7 +5730,7 @@ ) ) ) - (func $~lib/string/String.__eq (; 90 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 95 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eq @@ -5740,7 +5777,7 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -5756,7 +5793,7 @@ ) ) ) - (func $~lib/string/String.__ne (; 91 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__ne (; 96 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.eqz (call $~lib/string/String.__eq (get_local $0) @@ -5764,7 +5801,7 @@ ) ) ) - (func $std/array/isArraysEqual (; 92 ;) (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 @@ -5827,7 +5864,7 @@ ) (i32.const 1) ) - (func $~lib/internal/string/allocate (; 93 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/string/allocate (; 98 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (tee_local $1 @@ -5859,7 +5896,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 +5910,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 (; 99 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -5918,11 +5955,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 (; 100 ;) (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 +6002,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 +6022,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 +6041,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 (; 101 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) @@ -6018,7 +6055,7 @@ (get_local $1) ) ) - (func $std/array/createRandomString (; 97 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomString (; 102 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -6063,7 +6100,7 @@ ) (get_local $1) ) - (func $std/array/createRandomStringArray (; 98 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomStringArray (; 103 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (call $~lib/array/Array#constructor @@ -6107,15 +6144,9 @@ ) (get_local $1) ) - (func $start (; 99 ;) (type $v) + (func $start (; 104 ;) (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..d23b28d9 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -93,7 +93,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -101,7 +101,7 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -114,7 +114,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -128,10 +128,10 @@ (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) ) ) @@ -209,13 +209,20 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (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/allocUnsafe (; 5 ;) (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 +236,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 +248,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 (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -593,7 +600,14 @@ ) ) ) - (func $~lib/array/Array#constructor (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.fill (; 7 ;) (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 (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -631,7 +645,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 +668,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 (; 9 ;) (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 (; 10 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (i32.load @@ -683,7 +697,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 (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2485,7 +2499,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 10 ;) (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 @@ -2515,7 +2529,7 @@ ) ) (block - (call $~lib/memory/copy_memory + (call $~lib/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2803,7 +2817,14 @@ ) ) ) - (func $~lib/internal/arraybuffer/reallocUnsafe (; 11 ;) (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 @@ -2821,7 +2842,7 @@ (i32.eqz (i32.le_s (get_local $1) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) ) (block @@ -2841,7 +2862,7 @@ (call $~lib/internal/arraybuffer/computeSize (get_local $2) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block @@ -2849,11 +2870,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 +2891,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 +2954,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 (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3016,7 +3037,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 (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -3047,7 +3068,7 @@ (unreachable) ) ) - (func $~lib/array/Array#pop (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#pop (; 17 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -3104,7 +3125,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 (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3178,17 +3199,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 +3240,7 @@ ) (get_local $5) ) - (func $~lib/array/Array#shift (; 16 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#shift (; 19 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -3272,15 +3293,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 +3331,7 @@ ) (get_local $4) ) - (func $~lib/array/Array#reverse (; 17 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#reverse (; 20 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -3415,7 +3436,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 (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3513,7 +3534,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 (; 22 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3611,7 +3632,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 (; 23 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3680,11 +3701,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 +3715,7 @@ (i32.add (i32.add (get_local $6) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.shl (i32.add @@ -3717,7 +3738,7 @@ ) ) ) - (func $~lib/array/Array#__set (; 21 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__set (; 24 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -3792,13 +3813,13 @@ ) ) ) - (func $start~anonymous|0 (; 22 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|0 (; 25 ;) (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 (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3879,19 +3900,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 (; 27 ;) (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 (; 28 ;) (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 (; 29 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3903,13 +3924,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 (; 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|5 (; 28 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|5 (; 31 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3920,13 +3941,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 (; 32 ;) (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 (; 33 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4009,13 +4030,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 (; 34 ;) (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 (; 35 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -4027,13 +4048,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 (; 36 ;) (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 (; 37 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -4044,13 +4065,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 (; 38 ;) (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 (; 39 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4131,13 +4152,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 (; 40 ;) (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 (; 41 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -4149,13 +4170,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 (; 42 ;) (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 (; 43 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -4166,7 +4187,7 @@ (i32.const 3) ) ) - (func $start~anonymous|16 (; 41 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|16 (; 44 ;) (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 +4195,7 @@ ) ) ) - (func $~lib/array/Array#forEach (; 42 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/array/Array#forEach (; 45 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4246,7 +4267,7 @@ ) ) ) - (func $start~anonymous|17 (; 43 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|17 (; 46 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -4260,7 +4281,7 @@ ) ) ) - (func $start~anonymous|18 (; 44 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|18 (; 47 ;) (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 +4289,7 @@ ) ) ) - (func $start~anonymous|19 (; 45 ;) (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) @@ -4281,12 +4302,12 @@ ) ) ) - (func $start~anonymous|20 (; 46 ;) (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#constructor (; 47 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#constructor (; 50 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4324,7 +4345,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 +4368,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 (; 51 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4456,12 +4477,12 @@ ) (get_local $4) ) - (func $~lib/array/Array#get:length (; 49 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 52 ;) (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 (; 53 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) (set_local $2 (i32.load @@ -4492,7 +4513,7 @@ (unreachable) ) ) - (func $start~anonymous|21 (; 51 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|21 (; 54 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -4507,7 +4528,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 (; 55 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4605,7 +4626,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 (; 56 ;) (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 +4635,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 (; 57 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -4628,13 +4649,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 (; 58 ;) (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 (; 59 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4728,7 +4749,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 (; 60 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -4746,7 +4767,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 (; 61 ;) (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 +4779,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 (; 62 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -4775,13 +4796,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 (; 63 ;) (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 (; 64 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4861,13 +4882,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 (; 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 $start~anonymous|30 (; 63 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|30 (; 66 ;) (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 +4901,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 (; 67 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4960,7 +4981,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 (; 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) @@ -4973,7 +4994,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 (; 69 ;) (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 +5006,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 (; 70 ;) (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 (; 71 ;) (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 +5023,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 (; 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 $~lib/array/Array#reduceRight (; 70 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#reduceRight (; 73 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -5073,13 +5094,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 (; 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 $start~anonymous|37 (; 72 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|37 (; 75 ;) (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 +5113,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 (; 76 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -5157,7 +5178,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 (; 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) @@ -5170,7 +5191,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 (; 78 ;) (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 +5203,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 (; 79 ;) (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 (; 80 ;) (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 +5220,7 @@ (get_local $1) ) ) - (func $~lib/math/murmurHash3 (; 78 ;) (type $II) (param $0 i64) (result i64) + (func $~lib/math/murmurHash3 (; 81 ;) (type $II) (param $0 i64) (result i64) (set_local $0 (i64.xor (get_local $0) @@ -5241,7 +5262,7 @@ ) (get_local $0) ) - (func $~lib/math/NativeMath.seedRandom (; 79 ;) (type $Iv) (param $0 i64) + (func $~lib/math/NativeMath.seedRandom (; 82 ;) (type $Iv) (param $0 i64) (if (i64.eqz (get_local $0) @@ -5270,7 +5291,7 @@ ) ) ) - (func $std/array/createReverseOrderedArray (; 80 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedArray (; 83 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -5318,7 +5339,7 @@ ) (get_local $1) ) - (func $~lib/math/NativeMath.random (; 81 ;) (type $F) (result f64) + (func $~lib/math/NativeMath.random (; 84 ;) (type $F) (result f64) (local $0 i64) (local $1 i64) (local $2 i64) @@ -5400,7 +5421,7 @@ (f64.const 1) ) ) - (func $std/array/createRandomOrderedArray (; 82 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomOrderedArray (; 85 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -5449,7 +5470,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 (; 86 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.gt_s (get_local $0) @@ -5461,7 +5482,7 @@ ) ) ) - (func $~lib/internal/array/insertionSort (; 84 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/insertionSort (; 87 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5617,10 +5638,16 @@ ) (get_local $0) ) - (func $~lib/allocator/arena/free_memory (; 85 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 88 ;) (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 (; 89 ;) (type $iv) (param $0 i32) + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + (return) + ) + (func $~lib/internal/array/weakHeapSort (; 90 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5650,11 +5677,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 +6129,7 @@ (br $repeat|2) ) ) - (call $~lib/allocator/arena/free_memory + (call $~lib/memory/memory.free (get_local $4) ) (set_local $12 @@ -6169,7 +6196,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 (; 91 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6315,7 +6342,7 @@ ) ) ) - (func $std/array/isSorted (; 88 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted (; 92 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -6376,7 +6403,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted (; 89 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted (; 93 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -6398,7 +6425,7 @@ ) ) ) - (func $std/array/assertSortedDefault (; 90 ;) (type $iv) (param $0 i32) + (func $std/array/assertSortedDefault (; 94 ;) (type $iv) (param $0 i32) (call $std/array/assertSorted (get_local $0) (block $~lib/internal/array/defaultComparator|inlined.0 (result i32) @@ -6406,7 +6433,7 @@ ) ) ) - (func $std/array/isArraysEqual (; 91 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/array/isArraysEqual (; 95 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -6472,31 +6499,31 @@ ) (i32.const 1) ) - (func $start~anonymous|43 (; 92 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|43 (; 96 ;) (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 (; 97 ;) (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 (; 98 ;) (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 (; 99 ;) (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 (; 100 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6534,7 +6561,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 +6584,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 (; 101 ;) (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 (; 102 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -6647,7 +6674,7 @@ ) ) ) - (func $~lib/array/Array>#__get (; 99 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#__get (; 103 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -6678,7 +6705,7 @@ (unreachable) ) ) - (func $std/array/createReverseOrderedNestedArray (; 100 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedNestedArray (; 104 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -6739,7 +6766,7 @@ ) (get_local $1) ) - (func $start~anonymous|47 (; 101 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|47 (; 105 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/array/Array#__get (get_local $0) @@ -6751,7 +6778,7 @@ ) ) ) - (func $~lib/internal/array/insertionSort> (; 102 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/insertionSort> (; 106 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6907,7 +6934,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 (; 107 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7043,7 +7070,7 @@ ) ) ) - (func $std/array/isSorted> (; 104 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted> (; 108 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -7104,7 +7131,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted> (; 105 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted> (; 109 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted> @@ -7126,7 +7153,7 @@ ) ) ) - (func $~lib/array/Array>#constructor (; 106 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#constructor (; 110 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7164,7 +7191,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 +7214,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 (; 111 ;) (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 (; 112 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (tee_local $0 (if (result i32) @@ -7211,7 +7238,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 +7252,7 @@ ) ) ) - (func $~lib/array/Array>#__set (; 109 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array>#__set (; 113 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -7300,7 +7327,7 @@ ) ) ) - (func $std/array/createReverseOrderedElementsArray (; 110 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedElementsArray (; 114 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -7351,7 +7378,7 @@ ) (get_local $1) ) - (func $start~anonymous|48 (; 111 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|48 (; 115 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.load (get_local $0) @@ -7361,7 +7388,7 @@ ) ) ) - (func $~lib/internal/array/insertionSort> (; 112 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/insertionSort> (; 116 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7517,7 +7544,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 (; 117 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7653,7 +7680,7 @@ ) ) ) - (func $~lib/array/Array>#__get (; 114 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#__get (; 118 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -7684,7 +7711,7 @@ (unreachable) ) ) - (func $std/array/isSorted> (; 115 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted> (; 119 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -7745,7 +7772,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted> (; 116 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted> (; 120 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted> @@ -7767,7 +7794,8 @@ ) ) ) - (func $~lib/memory/compare_memory (; 117 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/memory/memcmp (; 121 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -7781,7 +7809,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 +7823,7 @@ (get_local $1) ) ) - (get_local $2) + (get_local $3) ) (block (block @@ -7831,7 +7864,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 (; 122 ;) (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 (; 123 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7905,14 +7945,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 +7962,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 (; 124 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7996,14 +8036,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 +8053,7 @@ (i32.const 0) ) ) - (func $start~anonymous|49 (; 120 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|49 (; 125 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/string/String.__gt (get_local $0) @@ -8025,12 +8065,12 @@ ) ) ) - (func $~lib/array/Array#get:length (; 121 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 126 ;) (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 (; 127 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8186,7 +8226,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 (; 128 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8322,7 +8362,7 @@ ) ) ) - (func $~lib/array/Array#__get (; 124 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__get (; 129 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -8353,7 +8393,7 @@ (unreachable) ) ) - (func $std/array/isSorted (; 125 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted (; 130 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -8414,7 +8454,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted (; 126 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted (; 131 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -8436,7 +8476,7 @@ ) ) ) - (func $~lib/string/String.__eq (; 127 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 132 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -8483,14 +8523,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 +8539,7 @@ ) ) ) - (func $~lib/string/String.__ne (; 128 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__ne (; 133 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.eqz (call $~lib/string/String.__eq (get_local $0) @@ -8507,7 +8547,7 @@ ) ) ) - (func $std/array/isArraysEqual (; 129 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/array/isArraysEqual (; 134 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -8573,7 +8613,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 (; 135 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8611,7 +8651,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 +8674,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 (; 136 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -8658,7 +8698,7 @@ ) (i32.le_s (get_local $0) - (i32.const 536870910) + (get_global $~lib/internal/string/MAX_LENGTH) ) (get_local $1) ) @@ -8674,9 +8714,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 +8730,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 (; 137 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -8717,7 +8757,7 @@ ) ) (return - (i32.const 544) + (get_global $~lib/internal/string/EMPTY) ) ) (set_local $2 @@ -8739,7 +8779,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 (; 138 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8792,7 +8832,7 @@ (i32.const 0) ) (return - (i32.const 544) + (get_global $~lib/internal/string/EMPTY) ) ) (set_local $5 @@ -8800,25 +8840,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 +8867,7 @@ ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $3) @@ -8836,7 +8876,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 (; 139 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) @@ -8850,7 +8890,7 @@ (get_local $1) ) ) - (func $std/array/createRandomString (; 135 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomString (; 140 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 f64) @@ -8874,7 +8914,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 +8922,7 @@ (call $~lib/math/NativeMath.random) (f64.convert_s/i32 (i32.load - (i32.const 156) + (get_global $std/array/charset) ) ) ) @@ -8906,7 +8946,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 (; 141 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -8981,7 +9021,7 @@ ) ) ) - (func $std/array/createRandomStringArray (; 137 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomStringArray (; 142 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -9028,7 +9068,7 @@ ) (get_local $1) ) - (func $start~anonymous|50 (; 138 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|50 (; 143 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/string/String.__gt (get_local $0) @@ -9040,15 +9080,15 @@ ) ) ) - (func $start (; 139 ;) (type $v) + (func $start (; 144 ;) (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..5d4e4ce8 100644 --- a/tests/compiler/std/arraybuffer.optimized.wat +++ b/tests/compiler/std/arraybuffer.optimized.wat @@ -10,7 +10,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 +30,7 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -117,7 +116,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (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 $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -136,7 +140,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 +150,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 (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -476,7 +480,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 (; 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/arraybuffer/ArrayBuffer#constructor (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u @@ -505,7 +516,7 @@ (i32.const 1) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) (i32.const 8) @@ -516,7 +527,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 (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1902,7 +1913,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -1937,7 +1948,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 +2205,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 (; 10 ;) (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 (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $4 @@ -2233,7 +2251,7 @@ ) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add (tee_local $2 (call $~lib/internal/arraybuffer/allocUnsafe @@ -2297,12 +2315,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 (; 12 ;) (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 +2340,9 @@ (get_local $2) ) ) - (func $start (; 10 ;) (type $v) + (func $start (; 13 ;) (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..dfff6835 100644 --- a/tests/compiler/std/arraybuffer.untouched.wat +++ b/tests/compiler/std/arraybuffer.untouched.wat @@ -32,7 +32,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -40,7 +40,7 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -53,7 +53,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -67,10 +67,10 @@ (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) ) ) @@ -148,13 +148,20 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (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 $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (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 +175,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 +187,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 (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -532,12 +539,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 (; 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/arraybuffer/ArrayBuffer#constructor (; 7 ;) (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 +575,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 +586,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 (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2374,7 +2388,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.eq @@ -2404,7 +2418,7 @@ ) ) (block - (call $~lib/memory/copy_memory + (call $~lib/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2692,7 +2706,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 (; 10 ;) (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 (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2799,15 +2820,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 +2836,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 (; 12 ;) (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 +2852,7 @@ ) ) (set_local $2 - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) ) (call $~lib/arraybuffer/ArrayBuffer#slice @@ -2840,15 +2861,15 @@ (get_local $2) ) ) - (func $start (; 10 ;) (type $v) + (func $start (; 13 ;) (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..fa51bb3a 100644 --- a/tests/compiler/std/constructor.optimized.wat +++ b/tests/compiler/std/constructor.optimized.wat @@ -14,11 +14,10 @@ (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/allocator/arena/__memory_allocate (; 0 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -104,23 +103,28 @@ ) (i32.const 0) ) - (func $std/constructor/EmptyCtor#constructor (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $std/constructor/EmptyCtor#constructor (; 2 ;) (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 (; 3 ;) (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 +133,14 @@ ) (get_local $0) ) - (func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 4 ;) (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 +149,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 (; 5 ;) (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 (; 6 ;) (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 +166,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 (; 7 ;) (type $ii) (param $0 i32) (result i32) (if (get_global $std/constructor/b) (if @@ -175,7 +179,7 @@ (get_local $0) ) (set_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 0) ) ) @@ -186,23 +190,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 (; 8 ;) (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 +221,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 +238,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..d2ded3be 100644 --- a/tests/compiler/std/constructor.untouched.wat +++ b/tests/compiler/std/constructor.untouched.wat @@ -22,7 +22,7 @@ (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/allocator/arena/__memory_allocate (; 0 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -35,7 +35,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -49,10 +49,10 @@ (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) ) ) @@ -130,7 +130,14 @@ ) (i32.const 0) ) - (func $std/constructor/EmptyCtor#constructor (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $std/constructor/EmptyCtor#constructor (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (tee_local $0 (if (result i32) @@ -139,7 +146,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 +156,7 @@ ) ) ) - (func $std/constructor/EmptyCtorWithFieldInit#constructor (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/EmptyCtorWithFieldInit#constructor (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (tee_local $0 (if (result i32) @@ -158,7 +165,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 +179,7 @@ ) ) ) - (func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (tee_local $0 (if (result i32) @@ -181,7 +188,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 +202,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 (; 5 ;) (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 (; 6 ;) (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 +224,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 +234,7 @@ ) ) ) - (func $std/constructor/CtorAllocates#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/CtorAllocates#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (drop (tee_local $0 @@ -237,7 +244,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 +256,7 @@ ) (get_local $0) ) - (func $std/constructor/CtorConditionallyAllocates#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/CtorConditionallyAllocates#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (get_global $std/constructor/b) @@ -261,7 +268,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 +286,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 +296,16 @@ ) ) ) - (func $start (; 8 ;) (type $v) + (func $start (; 9 ;) (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 +331,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 +341,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 +355,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..8c31124f --- /dev/null +++ b/tests/compiler/std/gc-integration.optimized.wat @@ -0,0 +1,81 @@ +(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 37) + ) + (unreachable) + ) + ) + ) + (func $start (; 2 ;) (type $v) + (call $~iterateRoots + (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) + ) + ) + ) + (func $~iterateRoots (; 3 ;) (type $iv) (param $0 i32) + (call_indirect (type $iv) + (i32.const 8) + (get_local $0) + ) + (call_indirect (type $iv) + (get_global $std/gc-integration/B.d) + (get_local $0) + ) + (call_indirect (type $iv) + (get_global $std/gc-integration/a_ref) + (get_local $0) + ) + (call_indirect (type $iv) + (get_global $std/gc-integration/b_ref) + (get_local $0) + ) + ) +) diff --git a/tests/compiler/std/gc-integration.ts b/tests/compiler/std/gc-integration.ts new file mode 100644 index 00000000..5650381f --- /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; +iterateRoots((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..58fd3644 --- /dev/null +++ b/tests/compiler/std/gc-integration.untouched.wat @@ -0,0 +1,96 @@ +(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 37) + ) + (unreachable) + ) + ) + ) + (func $start (; 2 ;) (type $v) + (drop + (get_global $std/gc-integration/B.c) + ) + (drop + (get_global $std/gc-integration/B.d) + ) + (call $~iterateRoots + (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) + ) + ) + ) + (func $~iterateRoots (; 3 ;) (type $iv) (param $0 i32) + (call_indirect (type $iv) + (get_global $std/gc-integration/B.c) + (get_local $0) + ) + (call_indirect (type $iv) + (get_global $std/gc-integration/B.d) + (get_local $0) + ) + (call_indirect (type $iv) + (get_global $std/gc-integration/a_ref) + (get_local $0) + ) + (call_indirect (type $iv) + (get_global $std/gc-integration/b_ref) + (get_local $0) + ) + ) +) diff --git a/tests/compiler/std/gc.optimized.wat b/tests/compiler/std/gc.optimized.wat new file mode 100644 index 00000000..3443e5fc --- /dev/null +++ b/tests/compiler/std/gc.optimized.wat @@ -0,0 +1,669 @@ +(module + (type $iv (func (param i32))) + (type $iii (func (param i32 i32) (result i32))) + (type $v (func)) + (type $ii (func (param i32) (result i32))) + (type $iiv (func (param i32 i32))) + (type $iiiiv (func (param i32 i32 i32 i32))) + (type $i (func (result i32))) + (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/white (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/from (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/to (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/iter (mut i32) (i32.const 0)) + (global $~argc (mut i32) (i32.const 0)) + (global $std/gc/obj (mut i32) (i32.const 0)) + (global $std/gc/obj2 (mut i32) (i32.const 0)) + (global $~started (mut i32) (i32.const 0)) + (table 2 2 anyfunc) + (elem (i32.const 0) $std/gc/MyObject_visit $~lib/collector/itcm/__gc_mark) + (memory $0 1) + (data (i32.const 8) "\t\00\00\00s\00t\00d\00/\00g\00c\00.\00t\00s") + (export "memory" (memory $0)) + (export "table" (table $0)) + (export "main" (func $std/gc/main)) + (func $std/gc/MyObject_visit (; 1 ;) (type $iv) (param $0 i32) + (nop) + ) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (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 + (current_memory) + ) + (i32.const 16) + ) + ) + (if + (i32.lt_s + (grow_memory + (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 + (grow_memory + (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 (; 3 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/collector/itcm/ManagedObjectSet#clear (; 4 ;) (type $iv) (param $0 i32) + (i32.store + (get_local $0) + (get_local $0) + ) + (i32.store offset=4 + (get_local $0) + (get_local $0) + ) + ) + (func $~lib/collector/itcm/ManagedObject#get:color (; 5 ;) (type $ii) (param $0 i32) (result i32) + (i32.and + (i32.load + (get_local $0) + ) + (i32.const 3) + ) + ) + (func $~lib/collector/itcm/ManagedObject#get:next (; 6 ;) (type $ii) (param $0 i32) (result i32) + (i32.and + (i32.load + (get_local $0) + ) + (i32.const -4) + ) + ) + (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 3) + ) + ) + ) + ) + (func $~lib/collector/itcm/ManagedObject#unlink (; 8 ;) (type $iv) (param $0 i32) + (local $1 i32) + (i32.store offset=4 + (tee_local $1 + (call $~lib/collector/itcm/ManagedObject#get:next + (get_local $0) + ) + ) + (tee_local $0 + (i32.load offset=4 + (get_local $0) + ) + ) + ) + (call $~lib/collector/itcm/ManagedObject#set:next + (get_local $0) + (get_local $1) + ) + ) + (func $~lib/collector/itcm/ManagedObjectSet#push (; 9 ;) (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/ManagedObject#makeGray (; 10 ;) (type $iv) (param $0 i32) + (if + (i32.eq + (get_local $0) + (get_global $~lib/collector/itcm/iter) + ) + (set_global $~lib/collector/itcm/iter + (i32.load offset=4 + (get_local $0) + ) + ) + ) + (call $~lib/collector/itcm/ManagedObject#unlink + (get_local $0) + ) + (call $~lib/collector/itcm/ManagedObjectSet#push + (get_global $~lib/collector/itcm/to) + (get_local $0) + ) + (i32.store + (get_local $0) + (i32.or + (i32.and + (i32.load + (get_local $0) + ) + (i32.const -4) + ) + (i32.const 2) + ) + ) + ) + (func $~lib/collector/itcm/__gc_mark (; 11 ;) (type $iv) (param $0 i32) + (local $1 i32) + (if + (get_local $0) + (if + (i32.eq + (call $~lib/collector/itcm/ManagedObject#get:color + (tee_local $1 + (i32.sub + (get_local $0) + (i32.const 16) + ) + ) + ) + (get_global $~lib/collector/itcm/white) + ) + (call $~lib/collector/itcm/ManagedObject#makeGray + (get_local $1) + ) + ) + ) + ) + (func $~lib/collector/itcm/ManagedObject#set:color (; 12 ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store + (get_local $0) + (i32.or + (i32.and + (i32.load + (get_local $0) + ) + (i32.const -4) + ) + (get_local $1) + ) + ) + ) + (func $~lib/memory/memory.free (; 13 ;) (type $iv) (param $0 i32) + (call $std/gc/MyObject_visit + (get_local $0) + ) + ) + (func $~lib/collector/itcm/step (; 14 ;) (type $v) + (local $0 i32) + (block $break|0 + (block $case3|0 + (block $case2|0 + (block $case1|0 + (if + (tee_local $0 + (get_global $~lib/collector/itcm/state) + ) + (block + (block $tablify|0 + (br_table $case1|0 $case2|0 $case3|0 $tablify|0 + (i32.sub + (get_local $0) + (i32.const 1) + ) + ) + ) + (br $break|0) + ) + ) + (set_global $~lib/collector/itcm/from + (call $~lib/memory/memory.allocate + (i32.const 16) + ) + ) + (i32.store offset=8 + (get_global $~lib/collector/itcm/from) + (i32.const -1) + ) + (call $~lib/collector/itcm/ManagedObjectSet#clear + (get_global $~lib/collector/itcm/from) + ) + (set_global $~lib/collector/itcm/to + (call $~lib/memory/memory.allocate + (i32.const 16) + ) + ) + (i32.store offset=8 + (get_global $~lib/collector/itcm/to) + (i32.const -1) + ) + (call $~lib/collector/itcm/ManagedObjectSet#clear + (get_global $~lib/collector/itcm/to) + ) + (set_global $~lib/collector/itcm/iter + (get_global $~lib/collector/itcm/to) + ) + (set_global $~lib/collector/itcm/state + (i32.const 1) + ) + ) + (call $~iterateRoots + (i32.const 1) + ) + (set_global $~lib/collector/itcm/state + (i32.const 2) + ) + (br $break|0) + ) + (if + (i32.ne + (tee_local $0 + (call $~lib/collector/itcm/ManagedObject#get:next + (get_global $~lib/collector/itcm/iter) + ) + ) + (get_global $~lib/collector/itcm/to) + ) + (block + (set_global $~lib/collector/itcm/iter + (get_local $0) + ) + (call $~lib/collector/itcm/ManagedObject#set:color + (get_local $0) + (i32.eqz + (get_global $~lib/collector/itcm/white) + ) + ) + (set_global $~argc + (i32.const 1) + ) + (call_indirect (type $iv) + (i32.add + (get_local $0) + (i32.const 16) + ) + (i32.load offset=8 + (get_local $0) + ) + ) + ) + (block + (call $~iterateRoots + (i32.const 1) + ) + (if + (i32.eq + (call $~lib/collector/itcm/ManagedObject#get:next + (get_global $~lib/collector/itcm/iter) + ) + (get_global $~lib/collector/itcm/to) + ) + (block + (set_local $0 + (get_global $~lib/collector/itcm/from) + ) + (set_global $~lib/collector/itcm/from + (get_global $~lib/collector/itcm/to) + ) + (set_global $~lib/collector/itcm/to + (get_local $0) + ) + (set_global $~lib/collector/itcm/white + (i32.eqz + (get_global $~lib/collector/itcm/white) + ) + ) + (set_global $~lib/collector/itcm/iter + (call $~lib/collector/itcm/ManagedObject#get:next + (get_local $0) + ) + ) + (set_global $~lib/collector/itcm/state + (i32.const 3) + ) + ) + ) + ) + ) + (br $break|0) + ) + (if + (i32.ne + (tee_local $0 + (get_global $~lib/collector/itcm/iter) + ) + (get_global $~lib/collector/itcm/to) + ) + (block + (set_global $~lib/collector/itcm/iter + (call $~lib/collector/itcm/ManagedObject#get:next + (get_local $0) + ) + ) + (call $~lib/memory/memory.free + (get_local $0) + ) + ) + (block + (call $~lib/collector/itcm/ManagedObjectSet#clear + (get_global $~lib/collector/itcm/to) + ) + (set_global $~lib/collector/itcm/state + (i32.const 1) + ) + ) + ) + ) + ) + (func $~lib/collector/itcm/__gc_allocate (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (if + (i32.gt_u + (get_local $0) + (i32.const 1073741808) + ) + (unreachable) + ) + (call $~lib/collector/itcm/step) + (i32.store offset=8 + (tee_local $2 + (call $~lib/memory/memory.allocate + (i32.add + (get_local $0) + (i32.const 16) + ) + ) + ) + (get_local $1) + ) + (call $~lib/collector/itcm/ManagedObject#set:color + (get_local $2) + (get_global $~lib/collector/itcm/white) + ) + (call $~lib/collector/itcm/ManagedObjectSet#push + (get_global $~lib/collector/itcm/from) + (get_local $2) + ) + (i32.add + (get_local $2) + (i32.const 16) + ) + ) + (func $~lib/gc/gc.allocate (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (call $~lib/collector/itcm/__gc_allocate + (get_local $0) + (get_local $1) + ) + ) + (func $~lib/collector/itcm/__gc_collect (; 17 ;) (type $v) + (local $0 i32) + (block $break|0 + (block $case1|0 + (br_if $case1|0 + (i32.eqz + (tee_local $0 + (get_global $~lib/collector/itcm/state) + ) + ) + ) + (br_if $case1|0 + (i32.eq + (get_local $0) + (i32.const 1) + ) + ) + (br $break|0) + ) + (call $~lib/collector/itcm/step) + ) + (loop $continue|1 + (if + (i32.ne + (get_global $~lib/collector/itcm/state) + (i32.const 1) + ) + (block + (call $~lib/collector/itcm/step) + (br $continue|1) + ) + ) + ) + ) + (func $~lib/gc/gc.collect (; 18 ;) (type $v) + (call $~lib/collector/itcm/__gc_collect) + ) + (func $std/gc/main (; 19 ;) (type $i) (result i32) + (if + (i32.eqz + (get_global $~started) + ) + (block + (call $start) + (set_global $~started + (i32.const 1) + ) + ) + ) + (i32.const 0) + ) + (func $start (; 20 ;) (type $v) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (set_global $~lib/allocator/arena/startOffset + (i32.const 32) + ) + (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/gc/gc.allocate + (i32.const 4) + (i32.const 0) + ) + ) + (i32.store + (get_global $std/gc/obj) + (i32.const 123) + ) + (set_local $2 + (i32.load offset=4 + (tee_local $0 + (i32.sub + (get_global $std/gc/obj) + (i32.const 16) + ) + ) + ) + ) + (if + (tee_local $1 + (i32.ne + (tee_local $3 + (i32.and + (i32.load + (get_local $0) + ) + (i32.const -4) + ) + ) + (i32.const 0) + ) + ) + (set_local $1 + (i32.ne + (get_local $2) + (i32.const 0) + ) + ) + ) + (if + (get_local $1) + (set_local $1 + (i32.eq + (get_local $3) + (get_local $2) + ) + ) + ) + (if + (i32.eqz + (get_local $1) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 19) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.load offset=8 + (get_local $0) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 21) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.load offset=12 + (get_local $0) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 23) + (i32.const 2) + ) + (unreachable) + ) + ) + (if + (i32.ne + (i32.load offset=16 + (get_local $0) + ) + (i32.const 123) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 25) + (i32.const 2) + ) + (unreachable) + ) + ) + (call $~lib/gc/gc.collect) + (set_global $std/gc/obj + (i32.const 0) + ) + (call $~lib/gc/gc.collect) + ) + (func $~iterateRoots (; 21 ;) (type $iv) (param $0 i32) + (call_indirect (type $iv) + (get_global $std/gc/obj) + (get_local $0) + ) + (call_indirect (type $iv) + (get_global $std/gc/obj2) + (get_local $0) + ) + ) +) diff --git a/tests/compiler/std/gc.ts b/tests/compiler/std/gc.ts new file mode 100644 index 00000000..dfaadbf4 --- /dev/null +++ b/tests/compiler/std/gc.ts @@ -0,0 +1,37 @@ +import "allocator/arena"; +import "collector/itcm"; + +// a class to test with +class MyObject { + a: u32; +} +function MyObject_visit(ref: usize): void {} // function table index == classId ? + +// allocate a managed instance +var obj: MyObject | null = changetype(gc.allocate(offsetof(), MyObject_visit)); +obj.a = 123; + +// check header +{ + let head = changetype(obj) - 16; + let next = load(head, 0) & ~3; + let prev = load(head, 4); + assert(next != 0 && prev != 0 && next == prev); + let visitFn = load(head, 8); + assert(visitFn == changetype(MyObject_visit)); + let unused = load(head, 12); + assert(unused == 0); + let a = load(head, 16); + assert(a == 123); +} + +gc.collect(); // should keep 'obj' because it's a referenced root (see trace output) +obj = null; +gc.collect(); // should free 'obj' because it isn't referenced anymore (see trace output) + +var obj2: MyObject; // should also iterate globals defined late + +export function main(): i32 { return 0; } + +// BEWARE: The compiler does not emit any integrations except gc.iterateRoots yet, hence trying to +// use the GC with a 'normally' allocated object will break it, as it has no managed header! diff --git a/tests/compiler/std/gc.untouched.wat b/tests/compiler/std/gc.untouched.wat new file mode 100644 index 00000000..5b930839 --- /dev/null +++ b/tests/compiler/std/gc.untouched.wat @@ -0,0 +1,808 @@ +(module + (type $iv (func (param i32))) + (type $iii (func (param i32 i32) (result i32))) + (type $v (func)) + (type $ii (func (param i32) (result i32))) + (type $iiv (func (param i32 i32))) + (type $iiiiv (func (param i32 i32 i32 i32))) + (type $i (func (result i32))) + (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 $~lib/collector/itcm/TRACE i32 (i32.const 0)) + (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/white (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/from (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/to (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 $~argc (mut i32) (i32.const 0)) + (global $std/gc/obj (mut i32) (i32.const 0)) + (global $std/gc/obj2 (mut i32) (i32.const 0)) + (global $~started (mut i32) (i32.const 0)) + (global $HEAP_BASE i32 (i32.const 32)) + (table 2 2 anyfunc) + (elem (i32.const 0) $std/gc/MyObject_visit $~lib/collector/itcm/__gc_mark) + (memory $0 1) + (data (i32.const 8) "\t\00\00\00s\00t\00d\00/\00g\00c\00.\00t\00s\00") + (export "memory" (memory $0)) + (export "table" (table $0)) + (export "main" (func $std/gc/main)) + (func $std/gc/MyObject_visit (; 1 ;) (type $iv) (param $0 i32) + (nop) + ) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (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 + (current_memory) + ) + (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 + (grow_memory + (get_local $5) + ) + (i32.const 0) + ) + (if + (i32.lt_s + (grow_memory + (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 (; 3 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/collector/itcm/ManagedObjectSet#clear (; 4 ;) (type $iv) (param $0 i32) + (i32.store + (get_local $0) + (get_local $0) + ) + (i32.store offset=4 + (get_local $0) + (get_local $0) + ) + ) + (func $~lib/collector/itcm/ManagedObject#get:color (; 5 ;) (type $ii) (param $0 i32) (result i32) + (i32.and + (i32.load + (get_local $0) + ) + (i32.const 3) + ) + ) + (func $~lib/collector/itcm/ManagedObject#get:next (; 6 ;) (type $ii) (param $0 i32) (result i32) + (i32.and + (i32.load + (get_local $0) + ) + (i32.xor + (i32.const 3) + (i32.const -1) + ) + ) + ) + (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 3) + ) + ) + ) + ) + (func $~lib/collector/itcm/ManagedObject#unlink (; 8 ;) (type $iv) (param $0 i32) + (local $1 i32) + (local $2 i32) + (set_local $1 + (call $~lib/collector/itcm/ManagedObject#get:next + (get_local $0) + ) + ) + (set_local $2 + (i32.load offset=4 + (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) + ) + ) + (func $~lib/collector/itcm/ManagedObjectSet#push (; 9 ;) (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/ManagedObject#makeGray (; 10 ;) (type $iv) (param $0 i32) + (if + (i32.eq + (get_local $0) + (get_global $~lib/collector/itcm/iter) + ) + (set_global $~lib/collector/itcm/iter + (i32.load offset=4 + (get_local $0) + ) + ) + ) + (call $~lib/collector/itcm/ManagedObject#unlink + (get_local $0) + ) + (call $~lib/collector/itcm/ManagedObjectSet#push + (get_global $~lib/collector/itcm/to) + (get_local $0) + ) + (i32.store + (get_local $0) + (i32.or + (i32.and + (i32.load + (get_local $0) + ) + (i32.xor + (i32.const 3) + (i32.const -1) + ) + ) + (i32.const 2) + ) + ) + ) + (func $~lib/collector/itcm/__gc_mark (; 11 ;) (type $iv) (param $0 i32) + (local $1 i32) + (if + (get_local $0) + (block + (set_local $1 + (block $~lib/collector/itcm/refToObj|inlined.0 (result i32) + (i32.sub + (get_local $0) + (get_global $~lib/collector/itcm/ManagedObject.SIZE) + ) + ) + ) + (if + (i32.eq + (call $~lib/collector/itcm/ManagedObject#get:color + (get_local $1) + ) + (get_global $~lib/collector/itcm/white) + ) + (call $~lib/collector/itcm/ManagedObject#makeGray + (get_local $1) + ) + ) + ) + ) + ) + (func $~lib/collector/itcm/ManagedObject#set:color (; 12 ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store + (get_local $0) + (i32.or + (i32.and + (i32.load + (get_local $0) + ) + (i32.xor + (i32.const 3) + (i32.const -1) + ) + ) + (get_local $1) + ) + ) + ) + (func $~lib/allocator/arena/__memory_free (; 13 ;) (type $iv) (param $0 i32) + (nop) + ) + (func $~lib/memory/memory.free (; 14 ;) (type $iv) (param $0 i32) + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + (return) + ) + (func $~lib/collector/itcm/step (; 15 ;) (type $v) + (local $0 i32) + (local $1 i32) + (block $break|0 + (block $case3|0 + (block $case2|0 + (block $case1|0 + (block $case0|0 + (set_local $1 + (get_global $~lib/collector/itcm/state) + ) + (br_if $case0|0 + (i32.eq + (get_local $1) + (get_global $~lib/collector/itcm/State.INIT) + ) + ) + (br_if $case1|0 + (i32.eq + (get_local $1) + (get_global $~lib/collector/itcm/State.IDLE) + ) + ) + (br_if $case2|0 + (i32.eq + (get_local $1) + (get_global $~lib/collector/itcm/State.MARK) + ) + ) + (br_if $case3|0 + (i32.eq + (get_local $1) + (get_global $~lib/collector/itcm/State.SWEEP) + ) + ) + (br $break|0) + ) + (block + (set_global $~lib/collector/itcm/from + (call $~lib/memory/memory.allocate + (get_global $~lib/collector/itcm/ManagedObject.SIZE) + ) + ) + (i32.store offset=8 + (get_global $~lib/collector/itcm/from) + (i32.const -1) + ) + (call $~lib/collector/itcm/ManagedObjectSet#clear + (get_global $~lib/collector/itcm/from) + ) + (set_global $~lib/collector/itcm/to + (call $~lib/memory/memory.allocate + (get_global $~lib/collector/itcm/ManagedObject.SIZE) + ) + ) + (i32.store offset=8 + (get_global $~lib/collector/itcm/to) + (i32.const -1) + ) + (call $~lib/collector/itcm/ManagedObjectSet#clear + (get_global $~lib/collector/itcm/to) + ) + (set_global $~lib/collector/itcm/iter + (get_global $~lib/collector/itcm/to) + ) + (set_global $~lib/collector/itcm/state + (get_global $~lib/collector/itcm/State.IDLE) + ) + ) + ) + (block + (call $~iterateRoots + (i32.const 1) + ) + (set_global $~lib/collector/itcm/state + (get_global $~lib/collector/itcm/State.MARK) + ) + (br $break|0) + ) + ) + (block + (set_local $0 + (call $~lib/collector/itcm/ManagedObject#get:next + (get_global $~lib/collector/itcm/iter) + ) + ) + (if + (i32.ne + (get_local $0) + (get_global $~lib/collector/itcm/to) + ) + (block + (set_global $~lib/collector/itcm/iter + (get_local $0) + ) + (call $~lib/collector/itcm/ManagedObject#set:color + (get_local $0) + (i32.eqz + (get_global $~lib/collector/itcm/white) + ) + ) + (set_global $~argc + (i32.const 1) + ) + (call_indirect (type $iv) + (block $~lib/collector/itcm/objToRef|inlined.0 (result i32) + (i32.add + (get_local $0) + (get_global $~lib/collector/itcm/ManagedObject.SIZE) + ) + ) + (i32.load offset=8 + (get_local $0) + ) + ) + ) + (block + (call $~iterateRoots + (i32.const 1) + ) + (set_local $0 + (call $~lib/collector/itcm/ManagedObject#get:next + (get_global $~lib/collector/itcm/iter) + ) + ) + (if + (i32.eq + (get_local $0) + (get_global $~lib/collector/itcm/to) + ) + (block + (set_local $1 + (get_global $~lib/collector/itcm/from) + ) + (set_global $~lib/collector/itcm/from + (get_global $~lib/collector/itcm/to) + ) + (set_global $~lib/collector/itcm/to + (get_local $1) + ) + (set_global $~lib/collector/itcm/white + (i32.eqz + (get_global $~lib/collector/itcm/white) + ) + ) + (set_global $~lib/collector/itcm/iter + (call $~lib/collector/itcm/ManagedObject#get:next + (get_local $1) + ) + ) + (set_global $~lib/collector/itcm/state + (get_global $~lib/collector/itcm/State.SWEEP) + ) + ) + ) + ) + ) + (br $break|0) + ) + ) + (block + (set_local $0 + (get_global $~lib/collector/itcm/iter) + ) + (if + (i32.ne + (get_local $0) + (get_global $~lib/collector/itcm/to) + ) + (block + (set_global $~lib/collector/itcm/iter + (call $~lib/collector/itcm/ManagedObject#get:next + (get_local $0) + ) + ) + (call $~lib/memory/memory.free + (get_local $0) + ) + ) + (block + (call $~lib/collector/itcm/ManagedObjectSet#clear + (get_global $~lib/collector/itcm/to) + ) + (set_global $~lib/collector/itcm/state + (get_global $~lib/collector/itcm/State.IDLE) + ) + ) + ) + (br $break|0) + ) + ) + ) + (func $~lib/collector/itcm/__gc_allocate (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (if + (i32.gt_u + (get_local $0) + (i32.sub + (get_global $~lib/internal/allocator/MAX_SIZE_32) + (get_global $~lib/collector/itcm/ManagedObject.SIZE) + ) + ) + (unreachable) + ) + (call $~lib/collector/itcm/step) + (set_local $2 + (call $~lib/memory/memory.allocate + (i32.add + (get_global $~lib/collector/itcm/ManagedObject.SIZE) + (get_local $0) + ) + ) + ) + (i32.store offset=8 + (get_local $2) + (get_local $1) + ) + (call $~lib/collector/itcm/ManagedObject#set:color + (get_local $2) + (get_global $~lib/collector/itcm/white) + ) + (call $~lib/collector/itcm/ManagedObjectSet#push + (get_global $~lib/collector/itcm/from) + (get_local $2) + ) + (block $~lib/collector/itcm/objToRef|inlined.1 (result i32) + (i32.add + (get_local $2) + (get_global $~lib/collector/itcm/ManagedObject.SIZE) + ) + ) + ) + (func $~lib/gc/gc.allocate (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (return + (call $~lib/collector/itcm/__gc_allocate + (get_local $0) + (get_local $1) + ) + ) + ) + (func $~lib/collector/itcm/__gc_collect (; 18 ;) (type $v) + (local $0 i32) + (block $break|0 + (block $case1|0 + (block $case0|0 + (set_local $0 + (get_global $~lib/collector/itcm/state) + ) + (br_if $case0|0 + (i32.eq + (get_local $0) + (get_global $~lib/collector/itcm/State.INIT) + ) + ) + (br_if $case1|0 + (i32.eq + (get_local $0) + (get_global $~lib/collector/itcm/State.IDLE) + ) + ) + (br $break|0) + ) + ) + (call $~lib/collector/itcm/step) + ) + (block $break|1 + (loop $continue|1 + (if + (i32.ne + (get_global $~lib/collector/itcm/state) + (get_global $~lib/collector/itcm/State.IDLE) + ) + (block + (call $~lib/collector/itcm/step) + (br $continue|1) + ) + ) + ) + ) + ) + (func $~lib/gc/gc.collect (; 19 ;) (type $v) + (call $~lib/collector/itcm/__gc_collect) + (return) + ) + (func $std/gc/main (; 20 ;) (type $i) (result i32) + (if + (i32.eqz + (get_global $~started) + ) + (block + (call $start) + (set_global $~started + (i32.const 1) + ) + ) + ) + (i32.const 0) + ) + (func $start (; 21 ;) (type $v) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (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/gc/gc.allocate + (i32.const 4) + (i32.const 0) + ) + ) + (i32.store + (get_global $std/gc/obj) + (i32.const 123) + ) + (block + (set_local $0 + (i32.sub + (get_global $std/gc/obj) + (i32.const 16) + ) + ) + (set_local $1 + (i32.and + (i32.load + (get_local $0) + ) + (i32.xor + (i32.const 3) + (i32.const -1) + ) + ) + ) + (set_local $2 + (i32.load offset=4 + (get_local $0) + ) + ) + (if + (i32.eqz + (if (result i32) + (tee_local $3 + (if (result i32) + (tee_local $3 + (i32.ne + (get_local $1) + (i32.const 0) + ) + ) + (i32.ne + (get_local $2) + (i32.const 0) + ) + (get_local $3) + ) + ) + (i32.eq + (get_local $1) + (get_local $2) + ) + (get_local $3) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 19) + (i32.const 2) + ) + (unreachable) + ) + ) + (set_local $3 + (i32.load offset=8 + (get_local $0) + ) + ) + (if + (i32.eqz + (i32.eq + (get_local $3) + (i32.const 0) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 21) + (i32.const 2) + ) + (unreachable) + ) + ) + (set_local $4 + (i32.load offset=12 + (get_local $0) + ) + ) + (if + (i32.eqz + (i32.eq + (get_local $4) + (i32.const 0) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 23) + (i32.const 2) + ) + (unreachable) + ) + ) + (set_local $5 + (i32.load offset=16 + (get_local $0) + ) + ) + (if + (i32.eqz + (i32.eq + (get_local $5) + (i32.const 123) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 25) + (i32.const 2) + ) + (unreachable) + ) + ) + ) + (call $~lib/gc/gc.collect) + (set_global $std/gc/obj + (i32.const 0) + ) + (call $~lib/gc/gc.collect) + ) + (func $~iterateRoots (; 22 ;) (type $iv) (param $0 i32) + (call_indirect (type $iv) + (get_global $std/gc/obj) + (get_local $0) + ) + (call_indirect (type $iv) + (get_global $std/gc/obj2) + (get_local $0) + ) + ) +) 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..834fea7b 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) @@ -1308,7 +1308,7 @@ (get_local $0) ) ) - (func $isNaN (; 12 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isNaN (; 12 ;) (type $Fi) (param $0 f64) (result i32) (f64.ne (get_local $0) (get_local $0) @@ -1346,7 +1346,7 @@ ) (block (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) (return @@ -1797,13 +1797,13 @@ (if (i32.eqz (tee_local $2 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) ) ) (set_local $2 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) @@ -2390,7 +2390,7 @@ ) (block (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) (return @@ -2943,7 +2943,7 @@ ) (block (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) (return diff --git a/tests/compiler/std/libm.untouched.wat b/tests/compiler/std/libm.untouched.wat index 229b833b..a601a0a4 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 $~lib/builtins/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 @@ -1494,7 +1503,7 @@ (get_local $0) ) ) - (func $isNaN (; 12 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isNaN (; 12 ;) (type $Fi) (param $0 f64) (result i32) (f64.ne (get_local $0) (get_local $0) @@ -1538,7 +1547,7 @@ ) (block (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) (return @@ -2036,12 +2045,12 @@ (if (if (result i32) (tee_local $2 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) ) (get_local $2) - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) @@ -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) ) ) ) @@ -2798,7 +2807,7 @@ ) (block (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) (return @@ -3385,7 +3394,7 @@ ) (block (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) (return diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index dc882472..1e0dde64 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -20,14 +20,13 @@ (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/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -113,7 +112,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/computeSize (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -127,7 +131,7 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -146,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) ) @@ -156,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 (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -486,7 +490,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 (; 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/arraybuffer/ArrayBuffer#constructor (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u @@ -515,7 +526,7 @@ (i32.const 1) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) (i32.const 8) @@ -526,7 +537,7 @@ ) (get_local $3) ) - (func $~lib/map/Map#clear (; 6 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 8 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -560,7 +571,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -568,7 +579,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -601,7 +612,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash8 (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash8 (; 10 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (get_local $0) @@ -610,7 +621,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 (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -676,7 +687,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 (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -694,7 +705,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 11 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 13 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -857,7 +868,7 @@ ) ) ) - (func $~lib/map/Map#set (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1000,7 +1011,7 @@ ) ) ) - (func $~lib/map/Map#get (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -1025,12 +1036,12 @@ ) ) ) - (func $~lib/map/Map#get:size (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 16 ;) (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 (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -1131,7 +1142,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 16 ;) (type $v) + (func $std/map/test (; 18 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -1617,7 +1628,7 @@ ) ) ) - (func $~lib/map/Map#has (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -1632,7 +1643,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 18 ;) (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) @@ -1795,7 +1806,7 @@ ) ) ) - (func $~lib/map/Map#set (; 19 ;) (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) @@ -1935,7 +1946,7 @@ ) ) ) - (func $~lib/map/Map#get (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -1957,7 +1968,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -2055,7 +2066,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 22 ;) (type $v) + (func $std/map/test (; 24 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -2520,7 +2531,7 @@ ) ) ) - (func $~lib/internal/hash/hash16 (; 23 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash16 (; 25 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -2541,7 +2552,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 (; 26 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -2607,7 +2618,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 (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -2625,7 +2636,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 26 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 28 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2788,7 +2799,7 @@ ) ) ) - (func $~lib/map/Map#set (; 27 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 29 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2931,7 +2942,7 @@ ) ) ) - (func $~lib/map/Map#get (; 28 ;) (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) (tee_local $0 (if (result i32) (tee_local $0 @@ -2956,7 +2967,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 31 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -3057,7 +3068,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 30 ;) (type $v) + (func $std/map/test (; 32 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -3543,7 +3554,7 @@ ) ) ) - (func $~lib/map/Map#has (; 31 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 33 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -3558,7 +3569,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 32 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 34 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3721,7 +3732,7 @@ ) ) ) - (func $~lib/map/Map#set (; 33 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 35 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3861,7 +3872,7 @@ ) ) ) - (func $~lib/map/Map#get (; 34 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 36 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -3883,7 +3894,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 35 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 37 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -3981,7 +3992,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 36 ;) (type $v) + (func $std/map/test (; 38 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -4446,7 +4457,7 @@ ) ) ) - (func $~lib/internal/hash/hash32 (; 37 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 39 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -4491,7 +4502,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 (; 40 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -4554,7 +4565,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 (; 41 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -4566,7 +4577,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 40 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 42 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4729,7 +4740,7 @@ ) ) ) - (func $~lib/map/Map#set (; 41 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 43 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4866,7 +4877,7 @@ ) ) ) - (func $~lib/map/Map#get (; 42 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 44 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -4885,7 +4896,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 43 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 45 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -4980,7 +4991,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 44 ;) (type $v) + (func $std/map/test (; 46 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -5424,7 +5435,7 @@ ) ) ) - (func $std/map/test (; 45 ;) (type $v) + (func $std/map/test (; 47 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -5868,7 +5879,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 46 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 48 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -5902,7 +5913,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 47 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 49 ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -5910,7 +5921,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -5943,7 +5954,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash64 (; 48 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash64 (; 50 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (i32.mul (i32.xor @@ -6042,7 +6053,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 (; 51 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -6105,7 +6116,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 (; 52 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -6117,7 +6128,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 51 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 53 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6280,7 +6291,7 @@ ) ) ) - (func $~lib/map/Map#set (; 52 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/map/Map#set (; 54 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6417,7 +6428,7 @@ ) ) ) - (func $~lib/map/Map#get (; 53 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#get (; 55 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -6436,7 +6447,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 54 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#delete (; 56 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (if @@ -6532,7 +6543,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 55 ;) (type $v) + (func $std/map/test (; 57 ;) (type $v) (local $0 i64) (local $1 i32) (set_local $1 @@ -6990,7 +7001,7 @@ ) ) ) - (func $std/map/test (; 56 ;) (type $v) + (func $std/map/test (; 58 ;) (type $v) (local $0 i64) (local $1 i32) (set_local $1 @@ -7448,7 +7459,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 (; 59 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -7511,7 +7522,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 (; 60 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -7525,7 +7536,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 59 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 61 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7690,7 +7701,7 @@ ) ) ) - (func $~lib/map/Map#set (; 60 ;) (type $ifiv) (param $0 i32) (param $1 f32) (param $2 i32) + (func $~lib/map/Map#set (; 62 ;) (type $ifiv) (param $0 i32) (param $1 f32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -7829,7 +7840,7 @@ ) ) ) - (func $~lib/map/Map#get (; 61 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/map/Map#get (; 63 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -7850,7 +7861,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 62 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/map/Map#delete (; 64 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (local $3 i32) (if @@ -7948,7 +7959,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 63 ;) (type $v) + (func $std/map/test (; 65 ;) (type $v) (local $0 f32) (local $1 i32) (set_local $1 @@ -8414,7 +8425,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 (; 66 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -8477,7 +8488,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 (; 67 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -8491,7 +8502,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 66 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 68 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8656,7 +8667,7 @@ ) ) ) - (func $~lib/map/Map#set (; 67 ;) (type $iFiv) (param $0 i32) (param $1 f64) (param $2 i32) + (func $~lib/map/Map#set (; 69 ;) (type $iFiv) (param $0 i32) (param $1 f64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -8795,7 +8806,7 @@ ) ) ) - (func $~lib/map/Map#get (; 68 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/map/Map#get (; 70 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -8816,7 +8827,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 69 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/map/Map#delete (; 71 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 i32) (if @@ -8914,7 +8925,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 70 ;) (type $v) + (func $std/map/test (; 72 ;) (type $v) (local $0 f64) (local $1 i32) (set_local $1 @@ -9380,15 +9391,9 @@ ) ) ) - (func $start (; 71 ;) (type $v) + (func $start (; 73 ;) (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..ed6f6fab 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -40,7 +40,7 @@ (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/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -53,7 +53,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -67,10 +67,10 @@ (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) ) ) @@ -148,7 +148,14 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/computeSize (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -157,7 +164,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -165,13 +172,13 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (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 +192,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 +204,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 (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -549,12 +556,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 (; 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/arraybuffer/ArrayBuffer#constructor (; 7 ;) (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 +592,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 +603,7 @@ ) (get_local $3) ) - (func $~lib/map/Map#clear (; 6 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 8 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -601,7 +615,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -615,7 +629,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 +640,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -636,7 +650,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 +686,16 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash8 (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash8 (; 10 ;) (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 (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -697,7 +711,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -716,7 +730,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -744,7 +758,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -757,7 +771,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 (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -779,7 +793,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 11 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 13 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -802,7 +816,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -813,7 +827,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -834,7 +848,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -853,7 +867,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -874,7 +888,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -915,7 +929,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -976,7 +990,7 @@ ) ) ) - (func $~lib/map/Map#set (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1033,7 +1047,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -1061,7 +1075,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 +1128,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1131,7 +1145,7 @@ ) ) ) - (func $~lib/map/Map#get (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -1160,12 +1174,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 16 ;) (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 (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1203,7 +1217,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -1233,7 +1247,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -1258,7 +1272,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -1271,7 +1285,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 16 ;) (type $v) + (func $std/map/test (; 18 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -1805,7 +1819,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 17 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 19 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -1817,7 +1831,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -1831,7 +1845,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 +1856,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 18 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 20 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -1852,7 +1866,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 +1902,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 (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -1904,7 +1918,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1923,7 +1937,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -1948,7 +1962,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -1961,7 +1975,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 (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -1980,7 +1994,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 21 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 23 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2003,7 +2017,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -2014,7 +2028,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -2035,7 +2049,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -2054,7 +2068,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -2075,7 +2089,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -2116,7 +2130,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -2177,7 +2191,7 @@ ) ) ) - (func $~lib/map/Map#set (; 22 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 24 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2231,7 +2245,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -2259,7 +2273,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 +2326,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -2329,7 +2343,7 @@ ) ) ) - (func $~lib/map/Map#get (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -2355,12 +2369,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 24 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 26 ;) (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 (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2395,7 +2409,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -2425,7 +2439,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -2450,7 +2464,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -2463,7 +2477,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 26 ;) (type $v) + (func $std/map/test (; 28 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -2976,7 +2990,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 27 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 29 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -2988,7 +3002,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -3002,7 +3016,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 +3027,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 28 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 30 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -3023,7 +3037,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 +3073,10 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash16 (; 29 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash16 (; 31 ;) (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 +3087,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -3085,12 +3099,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 (; 32 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -3106,7 +3120,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -3125,7 +3139,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -3153,7 +3167,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -3166,7 +3180,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 (; 33 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -3188,7 +3202,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 32 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 34 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3211,7 +3225,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -3222,7 +3236,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -3243,7 +3257,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -3262,7 +3276,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -3283,7 +3297,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -3324,7 +3338,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -3385,7 +3399,7 @@ ) ) ) - (func $~lib/map/Map#set (; 33 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 35 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3442,7 +3456,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -3470,7 +3484,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 +3537,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -3540,7 +3554,7 @@ ) ) ) - (func $~lib/map/Map#get (; 34 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 36 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -3569,12 +3583,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 35 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 37 ;) (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 (; 38 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3612,7 +3626,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -3642,7 +3656,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -3667,7 +3681,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -3680,7 +3694,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 37 ;) (type $v) + (func $std/map/test (; 39 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -4214,7 +4228,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 38 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 40 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -4226,7 +4240,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -4240,7 +4254,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 +4265,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 39 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 41 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -4261,7 +4275,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 +4311,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 (; 42 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -4313,7 +4327,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -4332,7 +4346,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -4357,7 +4371,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -4370,7 +4384,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 (; 43 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -4389,7 +4403,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 42 ;) (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) @@ -4412,7 +4426,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -4423,7 +4437,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -4444,7 +4458,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -4463,7 +4477,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -4484,7 +4498,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -4525,7 +4539,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -4586,7 +4600,7 @@ ) ) ) - (func $~lib/map/Map#set (; 43 ;) (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) @@ -4640,7 +4654,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -4668,7 +4682,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 +4735,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -4738,7 +4752,7 @@ ) ) ) - (func $~lib/map/Map#get (; 44 ;) (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) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -4764,12 +4778,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 45 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 47 ;) (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 (; 48 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4804,7 +4818,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -4834,7 +4848,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -4859,7 +4873,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -4872,7 +4886,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 47 ;) (type $v) + (func $std/map/test (; 49 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -5385,7 +5399,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 48 ;) (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 @@ -5397,7 +5411,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -5411,7 +5425,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 +5436,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 49 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 51 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -5432,7 +5446,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 +5482,10 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash32 (; 50 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 52 ;) (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 +5496,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -5497,7 +5511,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -5512,7 +5526,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -5524,12 +5538,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 (; 53 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -5545,7 +5559,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -5564,7 +5578,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -5586,7 +5600,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -5599,7 +5613,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 (; 54 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -5615,7 +5629,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 53 ;) (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) @@ -5638,7 +5652,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -5649,7 +5663,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -5670,7 +5684,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -5689,7 +5703,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -5710,7 +5724,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -5751,7 +5765,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -5812,7 +5826,7 @@ ) ) ) - (func $~lib/map/Map#set (; 54 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 56 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -5863,7 +5877,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -5891,7 +5905,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 +5958,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -5961,7 +5975,7 @@ ) ) ) - (func $~lib/map/Map#get (; 55 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 57 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -5984,12 +5998,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 56 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 58 ;) (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 (; 59 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6021,7 +6035,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -6051,7 +6065,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -6076,7 +6090,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -6089,7 +6103,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 58 ;) (type $v) + (func $std/map/test (; 60 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -6581,7 +6595,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 59 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 61 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -6593,7 +6607,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -6607,7 +6621,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 +6632,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 60 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 62 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -6628,7 +6642,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 +6678,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 (; 63 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -6680,7 +6694,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -6699,7 +6713,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -6721,7 +6735,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -6734,7 +6748,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 (; 64 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -6750,7 +6764,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 63 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 65 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6773,7 +6787,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -6784,7 +6798,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -6805,7 +6819,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -6824,7 +6838,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -6845,7 +6859,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -6886,7 +6900,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -6947,7 +6961,7 @@ ) ) ) - (func $~lib/map/Map#set (; 64 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 66 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6998,7 +7012,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -7026,7 +7040,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 +7093,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -7096,7 +7110,7 @@ ) ) ) - (func $~lib/map/Map#get (; 65 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 67 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -7119,12 +7133,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 66 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 68 ;) (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 (; 69 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7156,7 +7170,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -7186,7 +7200,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -7211,7 +7225,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -7224,7 +7238,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 68 ;) (type $v) + (func $std/map/test (; 70 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -7716,7 +7730,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 69 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 71 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -7728,7 +7742,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -7742,7 +7756,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 +7767,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 70 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 72 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -7763,7 +7777,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 +7813,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash64 (; 71 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash64 (; 73 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -7817,7 +7831,7 @@ ) ) (set_local $3 - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) ) (set_local $3 (i32.mul @@ -7828,7 +7842,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -7843,7 +7857,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -7858,7 +7872,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -7870,7 +7884,7 @@ (i32.const 24) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -7882,7 +7896,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -7897,7 +7911,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -7912,7 +7926,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -7924,12 +7938,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 (; 74 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -7945,7 +7959,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -7964,7 +7978,7 @@ (i32.load offset=12 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -7986,7 +8000,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -7999,7 +8013,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 (; 75 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -8015,7 +8029,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 74 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 76 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8039,7 +8053,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -8050,7 +8064,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -8071,7 +8085,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -8090,7 +8104,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -8111,7 +8125,7 @@ (i32.load offset=12 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -8152,7 +8166,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -8213,7 +8227,7 @@ ) ) ) - (func $~lib/map/Map#set (; 75 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/map/Map#set (; 77 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -8264,7 +8278,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -8292,7 +8306,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 +8359,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -8362,7 +8376,7 @@ ) ) ) - (func $~lib/map/Map#get (; 76 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#get (; 78 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -8385,12 +8399,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 77 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 79 ;) (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 (; 80 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8422,7 +8436,7 @@ (i32.load offset=12 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -8452,7 +8466,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -8477,7 +8491,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -8490,7 +8504,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 79 ;) (type $v) + (func $std/map/test (; 81 ;) (type $v) (local $0 i32) (local $1 i64) (set_local $0 @@ -8996,7 +9010,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 80 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 82 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -9008,7 +9022,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -9022,7 +9036,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 +9047,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 81 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 83 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -9043,7 +9057,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 +9093,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 (; 84 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -9095,7 +9109,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -9114,7 +9128,7 @@ (i32.load offset=12 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -9136,7 +9150,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -9149,7 +9163,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 (; 85 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -9165,7 +9179,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 84 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 86 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9189,7 +9203,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -9200,7 +9214,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -9221,7 +9235,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -9240,7 +9254,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -9261,7 +9275,7 @@ (i32.load offset=12 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -9302,7 +9316,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -9363,7 +9377,7 @@ ) ) ) - (func $~lib/map/Map#set (; 85 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/map/Map#set (; 87 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -9414,7 +9428,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -9442,7 +9456,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 +9509,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -9512,7 +9526,7 @@ ) ) ) - (func $~lib/map/Map#get (; 86 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#get (; 88 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -9535,12 +9549,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 87 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 89 ;) (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 (; 90 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9572,7 +9586,7 @@ (i32.load offset=12 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -9602,7 +9616,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -9627,7 +9641,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -9640,7 +9654,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 89 ;) (type $v) + (func $std/map/test (; 91 ;) (type $v) (local $0 i32) (local $1 i64) (set_local $0 @@ -10146,7 +10160,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 90 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 92 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -10158,7 +10172,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -10172,7 +10186,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 +10197,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 91 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 93 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -10193,7 +10207,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 +10243,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 (; 94 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -10245,7 +10259,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -10264,7 +10278,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -10286,7 +10300,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -10299,7 +10313,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 (; 95 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -10317,7 +10331,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 94 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 96 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10341,7 +10355,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -10352,7 +10366,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -10373,7 +10387,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -10392,7 +10406,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -10413,7 +10427,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -10456,7 +10470,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -10517,7 +10531,7 @@ ) ) ) - (func $~lib/map/Map#set (; 95 ;) (type $ifiv) (param $0 i32) (param $1 f32) (param $2 i32) + (func $~lib/map/Map#set (; 97 ;) (type $ifiv) (param $0 i32) (param $1 f32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -10570,7 +10584,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -10598,7 +10612,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 +10665,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -10668,7 +10682,7 @@ ) ) ) - (func $~lib/map/Map#get (; 96 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/map/Map#get (; 98 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -10693,12 +10707,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 97 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 99 ;) (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 (; 100 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10732,7 +10746,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -10762,7 +10776,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -10787,7 +10801,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -10800,7 +10814,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 99 ;) (type $v) + (func $std/map/test (; 101 ;) (type $v) (local $0 i32) (local $1 f32) (set_local $0 @@ -11306,7 +11320,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 100 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 102 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -11318,7 +11332,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -11332,7 +11346,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 +11357,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 101 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 103 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -11353,7 +11367,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 +11403,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 (; 104 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -11405,7 +11419,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -11424,7 +11438,7 @@ (i32.load offset=12 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -11446,7 +11460,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -11459,7 +11473,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 (; 105 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -11477,7 +11491,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 104 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 106 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -11501,7 +11515,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -11512,7 +11526,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -11533,7 +11547,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -11552,7 +11566,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -11573,7 +11587,7 @@ (i32.load offset=12 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -11616,7 +11630,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -11677,7 +11691,7 @@ ) ) ) - (func $~lib/map/Map#set (; 105 ;) (type $iFiv) (param $0 i32) (param $1 f64) (param $2 i32) + (func $~lib/map/Map#set (; 107 ;) (type $iFiv) (param $0 i32) (param $1 f64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -11730,7 +11744,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -11758,7 +11772,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 +11825,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -11828,7 +11842,7 @@ ) ) ) - (func $~lib/map/Map#get (; 106 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/map/Map#get (; 108 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -11853,12 +11867,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 107 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 109 ;) (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 (; 110 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -11892,7 +11906,7 @@ (i32.load offset=12 (get_local $2) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (i32.store offset=20 @@ -11922,7 +11936,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -11947,7 +11961,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -11960,7 +11974,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 109 ;) (type $v) + (func $std/map/test (; 111 ;) (type $v) (local $0 i32) (local $1 f64) (set_local $0 @@ -12466,15 +12480,15 @@ ) ) ) - (func $start (; 110 ;) (type $v) + (func $start (; 112 ;) (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.optimized.wat b/tests/compiler/std/math.optimized.wat index 871b0d1e..18bc66ba 100644 --- a/tests/compiler/std/math.optimized.wat +++ b/tests/compiler/std/math.optimized.wat @@ -66,7 +66,7 @@ (data (i32.const 36) "\0c\00\00\00~\00l\00i\00b\00/\00m\00a\00t\00h\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $isNaN (; 30 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isNaN (; 30 ;) (type $Fi) (param $0 f64) (result i32) (f64.ne (get_local $0) (get_local $0) @@ -82,7 +82,7 @@ ) ) ) - (func $isFinite (; 32 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isFinite (; 32 ;) (type $Fi) (param $0 f64) (result i32) (f64.eq (f64.sub (get_local $0) @@ -239,12 +239,12 @@ (local $3 i32) (if (tee_local $3 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) (set_local $3 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) ) @@ -281,7 +281,7 @@ ) (if (i32.eqz - (call $isFinite + (call $~lib/builtins/isFinite (get_local $0) ) ) @@ -327,11 +327,11 @@ ) ) (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) (return - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) @@ -353,7 +353,7 @@ ) (i32.const 1) ) - (func $isNaN (; 37 ;) (type $fi) (param $0 f32) (result i32) + (func $~lib/builtins/isNaN (; 37 ;) (type $fi) (param $0 f32) (result i32) (f32.ne (get_local $0) (get_local $0) @@ -367,7 +367,7 @@ (i32.const 31) ) ) - (func $isFinite (; 39 ;) (type $fi) (param $0 f32) (result i32) + (func $~lib/builtins/isFinite (; 39 ;) (type $fi) (param $0 f32) (result i32) (f32.eq (f32.sub (get_local $0) @@ -520,12 +520,12 @@ (local $3 i32) (if (tee_local $3 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) (set_local $3 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) ) @@ -562,7 +562,7 @@ ) (if (i32.eqz - (call $isFinite + (call $~lib/builtins/isFinite (get_local $0) ) ) @@ -608,11 +608,11 @@ ) ) (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) (return - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) @@ -3094,7 +3094,7 @@ ) (block (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) (return @@ -3480,7 +3480,7 @@ ) (block (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) (return @@ -4021,13 +4021,13 @@ (if (i32.eqz (tee_local $2 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) ) ) (set_local $2 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) @@ -4399,13 +4399,13 @@ (if (i32.eqz (tee_local $2 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) ) ) (set_local $2 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) @@ -5154,7 +5154,7 @@ ) (block (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) (return @@ -5593,7 +5593,7 @@ ) (block (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) (return @@ -8598,7 +8598,8 @@ ) ) (set_local $7 - (call $isNaN + (f64.ne + (get_local $1) (get_local $1) ) ) @@ -8994,14 +8995,18 @@ ) ) (set_local $3 - (call $isNaN + (f32.ne + (get_local $1) (get_local $1) ) ) ) (if (i32.eqz - (get_local $3) + (i32.and + (get_local $3) + (i32.const 1) + ) ) (set_local $3 (i32.eq @@ -9011,7 +9016,10 @@ ) ) (if - (get_local $3) + (i32.and + (get_local $3) + (i32.const 1) + ) (return (f32.div (tee_local $0 @@ -12502,7 +12510,7 @@ ) ) (set_local $5 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) ) @@ -12971,7 +12979,7 @@ ) ) (set_local $2 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) ) diff --git a/tests/compiler/std/math.untouched.wat b/tests/compiler/std/math.untouched.wat index 3d2ce643..f2d3b8af 100644 --- a/tests/compiler/std/math.untouched.wat +++ b/tests/compiler/std/math.untouched.wat @@ -64,18 +64,34 @@ (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 $~lib/builtins/f64.EPSILON f64 (f64.const 2.220446049250313e-16)) + (global $~lib/builtins/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") (data (i32.const 36) "\0c\00\00\00~\00l\00i\00b\00/\00m\00a\00t\00h\00.\00t\00s\00") (export "memory" (memory $0)) (start $start) - (func $isNaN (; 30 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isNaN (; 30 ;) (type $Fi) (param $0 f64) (result i32) (f64.ne (get_local $0) (get_local $0) @@ -91,7 +107,7 @@ ) ) ) - (func $isFinite (; 32 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isFinite (; 32 ;) (type $Fi) (param $0 f64) (result i32) (f64.eq (f64.sub (get_local $0) @@ -261,11 +277,11 @@ (if (if (result i32) (tee_local $3 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) (get_local $3) @@ -300,7 +316,7 @@ ) (if (i32.eqz - (call $isFinite + (call $~lib/builtins/isFinite (get_local $0) ) ) @@ -347,11 +363,11 @@ ) ) (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) (return - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) @@ -376,7 +392,7 @@ ) (i32.const 1) ) - (func $isNaN (; 37 ;) (type $fi) (param $0 f32) (result i32) + (func $~lib/builtins/isNaN (; 37 ;) (type $fi) (param $0 f32) (result i32) (f32.ne (get_local $0) (get_local $0) @@ -390,7 +406,7 @@ (i32.const 31) ) ) - (func $isFinite (; 39 ;) (type $fi) (param $0 f32) (result i32) + (func $~lib/builtins/isFinite (; 39 ;) (type $fi) (param $0 f32) (result i32) (f32.eq (f32.sub (get_local $0) @@ -556,11 +572,11 @@ (if (if (result i32) (tee_local $3 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) (get_local $3) @@ -595,7 +611,7 @@ ) (if (i32.eqz - (call $isFinite + (call $~lib/builtins/isFinite (get_local $0) ) ) @@ -642,11 +658,11 @@ ) ) (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) (return - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) @@ -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) @@ -3512,7 +3528,7 @@ ) (block (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) (return @@ -3896,7 +3912,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -3945,7 +3961,7 @@ ) (block (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) (return @@ -4409,7 +4425,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -4548,12 +4564,12 @@ (if (if (result i32) (tee_local $2 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) ) (get_local $2) - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) @@ -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) @@ -5049,12 +5065,12 @@ (if (if (result i32) (tee_local $2 - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) ) (get_local $2) - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) @@ -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) @@ -6006,7 +6022,7 @@ ) (block (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) (return @@ -6475,7 +6491,7 @@ ) (block (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) (return @@ -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) @@ -9921,29 +9937,38 @@ ) ) (if - (if (result i32) - (tee_local $7 - (if (result i32) + (i32.and + (if (result i32) + (i32.and (tee_local $7 - (i64.eq - (i64.shl - (get_local $3) - (i64.const 1) + (if (result i32) + (tee_local $7 + (i64.eq + (i64.shl + (get_local $3) + (i64.const 1) + ) + (i64.const 0) + ) + ) + (get_local $7) + (block $~lib/builtins/isNaN|inlined.1 (result i32) + (f64.ne + (get_local $1) + (get_local $1) + ) ) - (i64.const 0) ) ) - (get_local $7) - (call $isNaN - (get_local $1) - ) + (i32.const 1) + ) + (get_local $7) + (i32.eq + (get_local $4) + (i32.const 2047) ) ) - (get_local $7) - (i32.eq - (get_local $4) - (i32.const 2047) - ) + (i32.const 1) ) (return (f64.div @@ -10329,7 +10354,7 @@ (if (result i32) (tee_local $5 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $5) @@ -10389,29 +10414,38 @@ ) ) (if - (if (result i32) - (tee_local $7 - (if (result i32) + (i32.and + (if (result i32) + (i32.and (tee_local $7 - (i32.eq - (i32.shl - (get_local $3) - (i32.const 1) + (if (result i32) + (tee_local $7 + (i32.eq + (i32.shl + (get_local $3) + (i32.const 1) + ) + (i32.const 0) + ) + ) + (get_local $7) + (block $~lib/builtins/isNaN|inlined.1 (result i32) + (f32.ne + (get_local $1) + (get_local $1) + ) ) - (i32.const 0) ) ) - (get_local $7) - (call $isNaN - (get_local $1) - ) + (i32.const 1) + ) + (get_local $7) + (i32.eq + (get_local $4) + (i32.const 255) ) ) - (get_local $7) - (i32.eq - (get_local $4) - (i32.const 255) - ) + (i32.const 1) ) (return (f32.div @@ -12353,7 +12387,7 @@ (if (result i32) (tee_local $5 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $5) @@ -14227,7 +14261,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -14338,7 +14372,7 @@ ) ) (get_local $8) - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) ) @@ -14894,7 +14928,7 @@ ) ) (get_local $10) - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) ) @@ -15519,7 +15553,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -15683,7 +15717,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -15870,7 +15904,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -16046,7 +16080,7 @@ (if (result i32) (tee_local $4 (i32.eqz - (i32.const 1) + (get_global $std/math/js) ) ) (get_local $4) @@ -16083,8 +16117,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 +16134,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 +16151,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 +16170,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 +16189,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 +16208,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 +16227,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 +16246,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 +16265,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 +16284,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 +16305,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 +16326,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 +16347,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 +16368,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 +16389,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 +16410,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 +16820,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 +16967,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 +16990,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 +17013,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 +17420,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 +17567,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 +17590,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 +17613,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 +18284,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18269,7 +18303,7 @@ (f64.const 4.345239849338305) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18288,7 +18322,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18307,7 +18341,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18326,7 +18360,7 @@ (f64.const 9.267056966972586) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18345,7 +18379,7 @@ (f64.const 0.6619858980995045) (f64.const 0.8473310828433507) (f64.const -0.41553276777267456) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18364,7 +18398,7 @@ (f64.const -0.4066039223853553) (f64.const 1.989530071088669) (f64.const 0.4973946213722229) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18383,7 +18417,7 @@ (f64.const 0.5617597462207241) (f64.const 0.9742849645674904) (f64.const -0.4428897500038147) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18402,7 +18436,7 @@ (f64.const 0.7741522965913037) (f64.const 0.6854215158636222) (f64.const -0.12589527666568756) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18421,7 +18455,7 @@ (f64.const -0.6787637026394024) (f64.const 2.316874138205964) (f64.const -0.17284949123859406) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18440,7 +18474,7 @@ (f64.const 0) (f64.const 1.5707963267948966) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18459,7 +18493,7 @@ (f64.const -1) (f64.const 3.141592653589793) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18497,7 +18531,7 @@ (f64.const 1.0000000000000002) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18516,7 +18550,7 @@ (f64.const -1.0000000000000002) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18535,7 +18569,7 @@ (f64.const inf) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18556,7 +18590,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18594,7 +18628,7 @@ (f64.const -0.5309227209592985) (f64.const 2.1304853799705463) (f64.const 0.1391008496284485) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18613,7 +18647,7 @@ (f64.const 0.4939556746399746) (f64.const 1.0541629875851946) (f64.const 0.22054767608642578) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18632,7 +18666,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18651,7 +18685,7 @@ (f32.const 4.345239639282227) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18670,7 +18704,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18689,7 +18723,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18708,7 +18742,7 @@ (f32.const 9.267057418823242) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18727,7 +18761,7 @@ (f32.const 0.6619858741760254) (f32.const 0.8473311066627502) (f32.const -0.13588131964206696) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18746,7 +18780,7 @@ (f32.const -0.40660393238067627) (f32.const 1.989530086517334) (f32.const 0.03764917701482773) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18765,7 +18799,7 @@ (f32.const 0.5617597699165344) (f32.const 0.9742849469184875) (f32.const 0.18443739414215088) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18784,7 +18818,7 @@ (f32.const 0.7741522789001465) (f32.const 0.6854215264320374) (f32.const -0.29158344864845276) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18803,7 +18837,7 @@ (f32.const -0.6787636876106262) (f32.const 2.3168740272521973) (f32.const -0.3795364499092102) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18822,7 +18856,7 @@ (f32.const 0) (f32.const 1.5707963705062866) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18841,7 +18875,7 @@ (f32.const -1) (f32.const 3.1415927410125732) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18879,7 +18913,7 @@ (f32.const 1.0000001192092896) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18898,7 +18932,7 @@ (f32.const -1.0000001192092896) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18917,7 +18951,7 @@ (f32.const inf) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18938,7 +18972,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -18976,7 +19010,7 @@ (f32.const 0.49965065717697144) (f32.const 1.0476008653640747) (f32.const -0.21161814033985138) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -18995,7 +19029,7 @@ (f32.const -0.5051405429840088) (f32.const 2.1003410816192627) (f32.const -0.20852705836296082) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19014,7 +19048,7 @@ (f32.const -0.5189794898033142) (f32.const 2.116452932357788) (f32.const -0.14600826799869537) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19033,7 +19067,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19052,7 +19086,7 @@ (f64.const 4.345239849338305) (f64.const 2.1487163980597503) (f64.const -0.291634738445282) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19071,7 +19105,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19090,7 +19124,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19109,7 +19143,7 @@ (f64.const 9.267056966972586) (f64.const 2.91668914109908) (f64.const -0.24191908538341522) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19128,7 +19162,7 @@ (f64.const 0.6619858980995045) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19147,7 +19181,7 @@ (f64.const -0.4066039223853553) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19166,7 +19200,7 @@ (f64.const 0.5617597462207241) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19185,7 +19219,7 @@ (f64.const 0.7741522965913037) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19204,7 +19238,7 @@ (f64.const -0.6787637026394024) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19280,7 +19314,7 @@ (f64.const 0.9999923706054688) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19299,7 +19333,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19318,7 +19352,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19339,7 +19373,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19358,7 +19392,7 @@ (f64.const 1.1060831199926429) (f64.const 0.4566373404384803) (f64.const -0.29381608963012695) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19377,7 +19411,7 @@ (f64.const 1.1089809557628658) (f64.const 0.4627246859959428) (f64.const -0.3990095555782318) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19396,7 +19430,7 @@ (f64.const 1.1169429159875521) (f64.const 0.47902433134075284) (f64.const -0.321674108505249) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19415,7 +19449,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19434,7 +19468,7 @@ (f32.const 4.345239639282227) (f32.const 2.148716449737549) (f32.const 0.4251045286655426) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19453,7 +19487,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19472,7 +19506,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19491,7 +19525,7 @@ (f32.const 9.267057418823242) (f32.const 2.916689157485962) (f32.const -0.1369788944721222) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19510,7 +19544,7 @@ (f32.const 0.6619858741760254) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19529,7 +19563,7 @@ (f32.const -0.40660393238067627) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19548,7 +19582,7 @@ (f32.const 0.5617597699165344) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19567,7 +19601,7 @@ (f32.const 0.7741522789001465) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19586,7 +19620,7 @@ (f32.const -0.6787636876106262) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19662,7 +19696,7 @@ (f32.const 0.9999923706054688) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19681,7 +19715,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19700,7 +19734,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19721,7 +19755,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19740,7 +19774,7 @@ (f32.const -1125899906842624) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19759,7 +19793,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19778,7 +19812,7 @@ (f64.const 4.345239849338305) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19797,7 +19831,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19816,7 +19850,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19835,7 +19869,7 @@ (f64.const 9.267056966972586) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -19854,7 +19888,7 @@ (f64.const 0.6619858980995045) (f64.const 0.7234652439515459) (f64.const -0.13599912822246552) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19873,7 +19907,7 @@ (f64.const -0.4066039223853553) (f64.const -0.41873374429377225) (f64.const -0.09264230728149414) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19892,7 +19926,7 @@ (f64.const 0.5617597462207241) (f64.const 0.5965113622274062) (f64.const -0.10864213854074478) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19911,7 +19945,7 @@ (f64.const 0.7741522965913037) (f64.const 0.8853748109312743) (f64.const -0.4256366193294525) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19930,7 +19964,7 @@ (f64.const -0.6787637026394024) (f64.const -0.7460778114110673) (f64.const 0.13986606895923615) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19949,7 +19983,7 @@ (f64.const 1) (f64.const 1.5707963267948966) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -19968,7 +20002,7 @@ (f64.const -1) (f64.const -1.5707963267948966) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20025,7 +20059,7 @@ (f64.const 1.0000000000000002) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20044,7 +20078,7 @@ (f64.const -1.0000000000000002) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20063,7 +20097,7 @@ (f64.const inf) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20084,7 +20118,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20122,7 +20156,7 @@ (f64.const 0.5073043929119148) (f64.const 0.5320538997772349) (f64.const -0.16157317161560059) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20141,7 +20175,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20160,7 +20194,7 @@ (f32.const 4.345239639282227) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20179,7 +20213,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20198,7 +20232,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20217,7 +20251,7 @@ (f32.const 9.267057418823242) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20236,7 +20270,7 @@ (f32.const 0.6619858741760254) (f32.const 0.7234652042388916) (f32.const -0.1307632476091385) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20255,7 +20289,7 @@ (f32.const -0.40660393238067627) (f32.const -0.41873374581336975) (f32.const 0.3161141574382782) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20274,7 +20308,7 @@ (f32.const 0.5617597699165344) (f32.const 0.5965113639831543) (f32.const -0.4510819613933563) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20293,7 +20327,7 @@ (f32.const 0.7741522789001465) (f32.const 0.8853747844696045) (f32.const 0.02493886835873127) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20312,7 +20346,7 @@ (f32.const -0.6787636876106262) (f32.const -0.7460777759552002) (f32.const 0.2515012323856354) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20331,7 +20365,7 @@ (f32.const 1) (f32.const 1.5707963705062866) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20350,7 +20384,7 @@ (f32.const -1) (f32.const -1.5707963705062866) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20407,7 +20441,7 @@ (f32.const 1.0000001192092896) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20426,7 +20460,7 @@ (f32.const -1.0000001192092896) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20445,7 +20479,7 @@ (f32.const inf) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20466,7 +20500,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -20504,7 +20538,7 @@ (f32.const 0.5004770159721375) (f32.const 0.5241496562957764) (f32.const -0.29427099227905273) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20523,7 +20557,7 @@ (f64.const -8.06684839057968) (f64.const -2.784729878387861) (f64.const -0.4762189984321594) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20542,7 +20576,7 @@ (f64.const 4.345239849338305) (f64.const 2.175213389013164) (f64.const -0.02728751301765442) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20561,7 +20595,7 @@ (f64.const -8.38143342755525) (f64.const -2.822706083697696) (f64.const 0.20985257625579834) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20580,7 +20614,7 @@ (f64.const -6.531673581913484) (f64.const -2.575619446591922) (f64.const 0.3113134205341339) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20599,7 +20633,7 @@ (f64.const 9.267056966972586) (f64.const 2.9225114951048674) (f64.const 0.4991756081581116) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20618,7 +20652,7 @@ (f64.const 0.6619858980995045) (f64.const 0.6212462762707166) (f64.const -0.4697347581386566) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20637,7 +20671,7 @@ (f64.const -0.4066039223853553) (f64.const -0.39615990393192035) (f64.const -0.40814438462257385) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20656,7 +20690,7 @@ (f64.const 0.5617597462207241) (f64.const 0.5357588870255474) (f64.const 0.3520713150501251) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20675,7 +20709,7 @@ (f64.const 0.7741522965913037) (f64.const 0.7123571263197349) (f64.const 0.13371451199054718) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20694,7 +20728,7 @@ (f64.const -0.6787637026394024) (f64.const -0.635182348903198) (f64.const 0.04749670997262001) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20812,7 +20846,7 @@ (f32.const -8.066848754882812) (f32.const -2.7847299575805664) (f32.const -0.14418013393878937) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20831,7 +20865,7 @@ (f32.const 4.345239639282227) (f32.const 2.17521333694458) (f32.const -0.020796965807676315) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20850,7 +20884,7 @@ (f32.const -8.381433486938477) (f32.const -2.8227059841156006) (f32.const 0.44718533754348755) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20869,7 +20903,7 @@ (f32.const -6.531673431396484) (f32.const -2.5756194591522217) (f32.const -0.14822272956371307) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20888,7 +20922,7 @@ (f32.const 9.267057418823242) (f32.const 2.922511577606201) (f32.const 0.14270681142807007) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20907,7 +20941,7 @@ (f32.const 0.6619858741760254) (f32.const 0.6212462782859802) (f32.const 0.3684912919998169) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20926,7 +20960,7 @@ (f32.const -0.40660393238067627) (f32.const -0.39615991711616516) (f32.const -0.13170306384563446) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20945,7 +20979,7 @@ (f32.const 0.5617597699165344) (f32.const 0.535758912563324) (f32.const 0.08184859901666641) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20964,7 +20998,7 @@ (f32.const 0.7741522789001465) (f32.const 0.7123571038246155) (f32.const -0.14270737767219543) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -20983,7 +21017,7 @@ (f32.const -0.6787636876106262) (f32.const -0.6351823210716248) (f32.const 0.2583143711090088) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21101,7 +21135,7 @@ (f64.const -8.06684839057968) (f64.const -1.4474613762633468) (f64.const 0.14857111871242523) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21120,7 +21154,7 @@ (f64.const 4.345239849338305) (f64.const 1.344597927114538) (f64.const -0.08170335739850998) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21139,7 +21173,7 @@ (f64.const -8.38143342755525) (f64.const -1.4520463463295539) (f64.const -0.07505480200052261) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21158,7 +21192,7 @@ (f64.const -6.531673581913484) (f64.const -1.4188758658752532) (f64.const -0.057633496820926666) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21177,7 +21211,7 @@ (f64.const 9.267056966972586) (f64.const 1.463303145448706) (f64.const 0.1606956422328949) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21196,7 +21230,7 @@ (f64.const 0.6619858980995045) (f64.const 0.5847550670238325) (f64.const 0.4582556486129761) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21215,7 +21249,7 @@ (f64.const -0.4066039223853553) (f64.const -0.3861864177552131) (f64.const -0.2574281692504883) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21234,7 +21268,7 @@ (f64.const 0.5617597462207241) (f64.const 0.5118269531628881) (f64.const -0.11444277316331863) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21253,7 +21287,7 @@ (f64.const 0.7741522965913037) (f64.const 0.6587802431653822) (f64.const -0.11286488175392151) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21272,7 +21306,7 @@ (f64.const -0.6787637026394024) (f64.const -0.5963307826973472) (f64.const -0.2182842344045639) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21329,7 +21363,7 @@ (f64.const 1) (f64.const 0.7853981633974483) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21348,7 +21382,7 @@ (f64.const -1) (f64.const -0.7853981633974483) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21367,7 +21401,7 @@ (f64.const inf) (f64.const 1.5707963267948966) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21388,7 +21422,7 @@ ) (f64.const -1.5707963267948966) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21426,7 +21460,7 @@ (f64.const 0.6929821535674624) (f64.const 0.6060004555152562) (f64.const -0.17075790464878082) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21445,7 +21479,7 @@ (f32.const -8.066848754882812) (f32.const -1.4474613666534424) (f32.const 0.12686480581760406) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21464,7 +21498,7 @@ (f32.const 4.345239639282227) (f32.const 1.3445979356765747) (f32.const 0.16045434772968292) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21483,7 +21517,7 @@ (f32.const -8.381433486938477) (f32.const -1.4520463943481445) (f32.const -0.39581751823425293) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21502,7 +21536,7 @@ (f32.const -6.531673431396484) (f32.const -1.418875813484192) (f32.const 0.410570353269577) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21521,7 +21555,7 @@ (f32.const 9.267057418823242) (f32.const 1.4633032083511353) (f32.const 0.48403501510620117) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21540,7 +21574,7 @@ (f32.const 0.6619858741760254) (f32.const 0.5847550630569458) (f32.const 0.2125193476676941) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21559,7 +21593,7 @@ (f32.const -0.40660393238067627) (f32.const -0.386186420917511) (f32.const 0.18169628083705902) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21578,7 +21612,7 @@ (f32.const 0.5617597699165344) (f32.const 0.5118269920349121) (f32.const 0.3499770760536194) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21597,7 +21631,7 @@ (f32.const 0.7741522789001465) (f32.const 0.6587802171707153) (f32.const -0.2505330741405487) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21616,7 +21650,7 @@ (f32.const -0.6787636876106262) (f32.const -0.5963307619094849) (f32.const 0.17614826560020447) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21673,7 +21707,7 @@ (f32.const 1) (f32.const 0.7853981852531433) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21692,7 +21726,7 @@ (f32.const -1) (f32.const -0.7853981852531433) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21711,7 +21745,7 @@ (f32.const inf) (f32.const 1.5707963705062866) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21732,7 +21766,7 @@ ) (f32.const -1.5707963705062866) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21770,7 +21804,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -21789,7 +21823,7 @@ (f64.const 4.345239849338305) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -21808,7 +21842,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -21827,7 +21861,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -21846,7 +21880,7 @@ (f64.const 9.267056966972586) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -21865,7 +21899,7 @@ (f64.const 0.6619858980995045) (f64.const 0.7963404371347943) (f64.const 0.21338365972042084) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21884,7 +21918,7 @@ (f64.const -0.4066039223853553) (f64.const -0.43153570730602897) (f64.const -0.4325666129589081) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21903,7 +21937,7 @@ (f64.const 0.5617597462207241) (f64.const 0.6354006111644578) (f64.const -0.06527865678071976) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21922,7 +21956,7 @@ (f64.const 0.7741522965913037) (f64.const 1.0306085575277995) (f64.const 0.14632052183151245) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21941,7 +21975,7 @@ (f64.const -0.6787637026394024) (f64.const -0.8268179645205255) (f64.const 0.1397128701210022) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -21979,7 +22013,7 @@ (f64.const inf) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22000,7 +22034,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22057,7 +22091,7 @@ (f64.const 1) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -22078,7 +22112,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -22097,7 +22131,7 @@ (f64.const 1.0000152587890625) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22116,7 +22150,7 @@ (f64.const -1.0000152587890625) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22135,7 +22169,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 +22188,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 +22208,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 +22230,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 +22251,7 @@ (f64.const 8988465674311579538646525e283) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22236,7 +22270,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22255,7 +22289,7 @@ (f32.const 4.345239639282227) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22274,7 +22308,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22293,7 +22327,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22312,7 +22346,7 @@ (f32.const 9.267057418823242) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22331,7 +22365,7 @@ (f32.const 0.6619858741760254) (f32.const 0.7963404059410095) (f32.const 0.19112196564674377) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22350,7 +22384,7 @@ (f32.const -0.40660393238067627) (f32.const -0.4315357208251953) (f32.const -0.05180925130844116) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22369,7 +22403,7 @@ (f32.const 0.5617597699165344) (f32.const 0.635400652885437) (f32.const 0.11911056190729141) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22388,7 +22422,7 @@ (f32.const 0.7741522789001465) (f32.const 1.0306085348129272) (f32.const 0.1798270344734192) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22407,7 +22441,7 @@ (f32.const -0.6787636876106262) (f32.const -0.8268179297447205) (f32.const 0.11588983237743378) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22445,7 +22479,7 @@ (f32.const inf) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22466,7 +22500,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22523,7 +22557,7 @@ (f32.const 1) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -22544,7 +22578,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -22563,7 +22597,7 @@ (f32.const 1.0000152587890625) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22582,7 +22616,7 @@ (f32.const -1.0000152587890625) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22601,7 +22635,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 +22654,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 +22674,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 +22696,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 +22717,7 @@ (f32.const 1701411834604692317316873e14) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -22703,7 +22737,7 @@ (f64.const 4.535662560676869) (f64.const -1.0585895402489023) (f64.const 0.09766263514757156) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22723,7 +22757,7 @@ (f64.const -8.88799136300345) (f64.const 2.6868734126013067) (f64.const 0.35833948850631714) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22743,7 +22777,7 @@ (f64.const -2.763607337379588) (f64.const -1.889300091849528) (f64.const -0.46235957741737366) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22763,7 +22797,7 @@ (f64.const 4.567535276842744) (f64.const -0.9605469021111489) (f64.const -0.21524477005004883) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22783,7 +22817,7 @@ (f64.const 4.811392084359796) (f64.const 1.0919123946142109) (f64.const 0.3894443213939667) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22803,7 +22837,7 @@ (f64.const 0.6620717923376739) (f64.const -1.468508500616424) (f64.const -0.448591411113739) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22823,7 +22857,7 @@ (f64.const 0.05215452675006225) (f64.const 1.5641600512601268) (f64.const 0.3784842789173126) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22843,7 +22877,7 @@ (f64.const 7.67640268511754) (f64.const -0.10281658910678508) (f64.const -0.13993260264396667) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22863,7 +22897,7 @@ (f64.const 2.0119025790324803) (f64.const 0.29697974004493516) (f64.const 0.44753071665763855) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22883,7 +22917,7 @@ (f64.const 0.03223983060263804) (f64.const -1.5131612053303916) (f64.const 0.39708876609802246) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22923,7 +22957,7 @@ (f64.const -0) (f64.const 3.141592653589793) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22943,7 +22977,7 @@ (f64.const -1) (f64.const 3.141592653589793) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -22965,7 +22999,7 @@ ) (f64.const 3.141592653589793) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23045,7 +23079,7 @@ (f64.const -0) (f64.const -3.141592653589793) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23065,7 +23099,7 @@ (f64.const -1) (f64.const -3.141592653589793) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23087,7 +23121,7 @@ ) (f64.const -3.141592653589793) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23147,7 +23181,7 @@ (f64.const 0) (f64.const -1.5707963267948966) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23167,7 +23201,7 @@ (f64.const -0) (f64.const -1.5707963267948966) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23187,7 +23221,7 @@ (f64.const 0) (f64.const 1.5707963267948966) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23207,7 +23241,7 @@ (f64.const -0) (f64.const 1.5707963267948966) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23269,7 +23303,7 @@ ) (f64.const -3.141592653589793) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23291,7 +23325,7 @@ ) (f64.const 3.141592653589793) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23311,7 +23345,7 @@ (f64.const 0) (f64.const 1.5707963267948966) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23333,7 +23367,7 @@ (f64.const 0) (f64.const -1.5707963267948966) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23353,7 +23387,7 @@ (f64.const inf) (f64.const 0.7853981633974483) (f64.const -0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23375,7 +23409,7 @@ ) (f64.const 2.356194490192345) (f64.const -0.20682445168495178) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23397,7 +23431,7 @@ (f64.const inf) (f64.const -0.7853981633974483) (f64.const 0.27576595544815063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23421,7 +23455,7 @@ ) (f64.const -2.356194490192345) (f64.const 0.20682445168495178) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23442,8 +23476,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 +23499,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 +23522,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 +23544,7 @@ (f64.const -8988465674311579538646525e283) (f64.const 3.141592653589793) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23530,7 +23564,7 @@ (f32.const 4.535662651062012) (f32.const -1.0585895776748657) (f32.const -0.22352588176727295) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23550,7 +23584,7 @@ (f32.const -8.887990951538086) (f32.const 2.686873435974121) (f32.const 0.09464472532272339) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23570,7 +23604,7 @@ (f32.const -2.7636072635650635) (f32.const -1.8893001079559326) (f32.const -0.21941901743412018) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23590,7 +23624,7 @@ (f32.const 4.567535400390625) (f32.const -0.9605468511581421) (f32.const 0.46015575528144836) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23610,7 +23644,7 @@ (f32.const 4.811392307281494) (f32.const 1.0919123888015747) (f32.const -0.05708503723144531) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23630,7 +23664,7 @@ (f32.const 0.6620717644691467) (f32.const -1.4685084819793701) (f32.const 0.19611206650733948) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23650,7 +23684,7 @@ (f32.const 0.052154526114463806) (f32.const 1.5641601085662842) (f32.const 0.48143187165260315) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23670,7 +23704,7 @@ (f32.const 7.676402568817139) (f32.const -0.10281659662723541) (f32.const -0.4216274917125702) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23690,7 +23724,7 @@ (f32.const 2.0119025707244873) (f32.const 0.29697975516319275) (f32.const 0.2322007566690445) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23710,7 +23744,7 @@ (f32.const 0.03223983198404312) (f32.const -1.5131611824035645) (f32.const 0.16620726883411407) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23750,7 +23784,7 @@ (f32.const -0) (f32.const 3.1415927410125732) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23770,7 +23804,7 @@ (f32.const -1) (f32.const 3.1415927410125732) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23792,7 +23826,7 @@ ) (f32.const 3.1415927410125732) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23872,7 +23906,7 @@ (f32.const -0) (f32.const -3.1415927410125732) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23892,7 +23926,7 @@ (f32.const -1) (f32.const -3.1415927410125732) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23914,7 +23948,7 @@ ) (f32.const -3.1415927410125732) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23974,7 +24008,7 @@ (f32.const 0) (f32.const -1.5707963705062866) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -23994,7 +24028,7 @@ (f32.const -0) (f32.const -1.5707963705062866) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24014,7 +24048,7 @@ (f32.const 0) (f32.const 1.5707963705062866) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24034,7 +24068,7 @@ (f32.const -0) (f32.const 1.5707963705062866) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24096,7 +24130,7 @@ ) (f32.const -3.1415927410125732) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24118,7 +24152,7 @@ ) (f32.const 3.1415927410125732) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24138,7 +24172,7 @@ (f32.const 0) (f32.const 1.5707963705062866) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24160,7 +24194,7 @@ (f32.const 0) (f32.const -1.5707963705062866) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24180,7 +24214,7 @@ (f32.const inf) (f32.const 0.7853981852531433) (f32.const 0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24202,7 +24236,7 @@ ) (f32.const 2.356194496154785) (f32.const 0.02500828728079796) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24224,7 +24258,7 @@ (f32.const inf) (f32.const -0.7853981852531433) (f32.const -0.3666777014732361) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24248,7 +24282,7 @@ ) (f32.const -2.356194496154785) (f32.const -0.02500828728079796) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24269,8 +24303,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 +24326,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 +24347,7 @@ (f64.const -8.06684839057968) (f64.const -2.0055552545020245) (f64.const 0.46667951345443726) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24332,7 +24366,7 @@ (f64.const 4.345239849338305) (f64.const 1.6318162410515635) (f64.const -0.08160271495580673) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24351,7 +24385,7 @@ (f64.const -8.38143342755525) (f64.const -2.031293910673361) (f64.const -0.048101816326379776) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24370,7 +24404,7 @@ (f64.const -6.531673581913484) (f64.const -1.8692820012204925) (f64.const 0.08624018728733063) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24389,7 +24423,7 @@ (f64.const 9.267056966972586) (f64.const 2.100457720859702) (f64.const -0.2722989022731781) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24408,7 +24442,7 @@ (f64.const 0.6619858980995045) (f64.const 0.8715311470455973) (f64.const 0.4414918124675751) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24427,7 +24461,7 @@ (f64.const -0.4066039223853553) (f64.const -0.740839030300223) (f64.const 0.016453813761472702) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24446,7 +24480,7 @@ (f64.const 0.5617597462207241) (f64.const 0.8251195400559286) (f64.const 0.30680638551712036) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24465,7 +24499,7 @@ (f64.const 0.7741522965913037) (f64.const 0.9182102478959914) (f64.const 0.06543998420238495) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24484,7 +24518,7 @@ (f64.const -0.6787637026394024) (f64.const -0.8788326906580094) (f64.const -0.2016713172197342) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24697,7 +24731,7 @@ (f32.const -8.066848754882812) (f32.const -2.0055553913116455) (f32.const -0.44719240069389343) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24716,7 +24750,7 @@ (f32.const 4.345239639282227) (f32.const 1.6318162679672241) (f32.const 0.44636252522468567) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24735,7 +24769,7 @@ (f32.const -8.381433486938477) (f32.const -2.0312938690185547) (f32.const 0.19483426213264465) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24754,7 +24788,7 @@ (f32.const -6.531673431396484) (f32.const -1.8692820072174072) (f32.const -0.17075514793395996) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24773,7 +24807,7 @@ (f32.const 9.267057418823242) (f32.const 2.1004576683044434) (f32.const -0.36362043023109436) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24792,7 +24826,7 @@ (f32.const 0.6619858741760254) (f32.const 0.8715311288833618) (f32.const -0.12857209146022797) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24811,7 +24845,7 @@ (f32.const -0.40660393238067627) (f32.const -0.7408390641212463) (f32.const -0.4655757546424866) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24830,7 +24864,7 @@ (f32.const 0.5617597699165344) (f32.const 0.8251195549964905) (f32.const 0.05601907894015312) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24849,7 +24883,7 @@ (f32.const 0.7741522789001465) (f32.const 0.9182102680206299) (f32.const 0.45498204231262207) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -24868,7 +24902,7 @@ (f32.const -0.6787636876106262) (f32.const -0.8788326978683472) (f32.const -0.22978967428207397) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25081,7 +25115,7 @@ (f64.const -8.06684839057968) (f64.const -8) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25100,7 +25134,7 @@ (f64.const 4.345239849338305) (f64.const 5) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25119,7 +25153,7 @@ (f64.const -8.38143342755525) (f64.const -8) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25138,7 +25172,7 @@ (f64.const -6.531673581913484) (f64.const -6) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25157,7 +25191,7 @@ (f64.const 9.267056966972586) (f64.const 10) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25176,7 +25210,7 @@ (f64.const 0.6619858980995045) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25195,7 +25229,7 @@ (f64.const -0.4066039223853553) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25214,7 +25248,7 @@ (f64.const 0.5617597462207241) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25233,7 +25267,7 @@ (f64.const 0.7741522965913037) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25252,7 +25286,7 @@ (f64.const -0.6787637026394024) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25408,7 +25442,7 @@ (f64.const 0.5) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25427,7 +25461,7 @@ (f64.const -0.5) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25446,7 +25480,7 @@ (f64.const 1.0000152587890625) (f64.const 2) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25465,7 +25499,7 @@ (f64.const -1.0000152587890625) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25484,7 +25518,7 @@ (f64.const 0.9999923706054688) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25503,7 +25537,7 @@ (f64.const -0.9999923706054688) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25522,7 +25556,7 @@ (f64.const 7.888609052210118e-31) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25541,7 +25575,7 @@ (f64.const -7.888609052210118e-31) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25697,7 +25731,7 @@ (f64.const 0.5) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25716,7 +25750,7 @@ (f64.const -0.5) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25735,7 +25769,7 @@ (f64.const 1.0000152587890625) (f64.const 2) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25754,7 +25788,7 @@ (f64.const -1.0000152587890625) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25773,7 +25807,7 @@ (f64.const 0.9999923706054688) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25792,7 +25826,7 @@ (f64.const -0.9999923706054688) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25811,7 +25845,7 @@ (f64.const 7.888609052210118e-31) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25830,7 +25864,7 @@ (f64.const -7.888609052210118e-31) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -25986,7 +26020,7 @@ (f64.const 0.5) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26005,7 +26039,7 @@ (f64.const -0.5) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26024,7 +26058,7 @@ (f64.const 1.0000152587890625) (f64.const 2) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26043,7 +26077,7 @@ (f64.const -1.0000152587890625) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26062,7 +26096,7 @@ (f64.const 0.9999923706054688) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26081,7 +26115,7 @@ (f64.const -0.9999923706054688) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26100,7 +26134,7 @@ (f64.const 7.888609052210118e-31) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26119,7 +26153,7 @@ (f64.const -7.888609052210118e-31) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26138,7 +26172,7 @@ (f32.const -8.066848754882812) (f32.const -8) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26157,7 +26191,7 @@ (f32.const 4.345239639282227) (f32.const 5) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26176,7 +26210,7 @@ (f32.const -8.381433486938477) (f32.const -8) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26195,7 +26229,7 @@ (f32.const -6.531673431396484) (f32.const -6) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26214,7 +26248,7 @@ (f32.const 9.267057418823242) (f32.const 10) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26233,7 +26267,7 @@ (f32.const 0.6619858741760254) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26252,7 +26286,7 @@ (f32.const -0.40660393238067627) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26271,7 +26305,7 @@ (f32.const 0.5617597699165344) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26290,7 +26324,7 @@ (f32.const 0.7741522789001465) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26309,7 +26343,7 @@ (f32.const -0.6787636876106262) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26465,7 +26499,7 @@ (f32.const 0.5) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26484,7 +26518,7 @@ (f32.const -0.5) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26503,7 +26537,7 @@ (f32.const 1.0000152587890625) (f32.const 2) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26522,7 +26556,7 @@ (f32.const -1.0000152587890625) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26541,7 +26575,7 @@ (f32.const 0.9999923706054688) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26560,7 +26594,7 @@ (f32.const -0.9999923706054688) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26579,7 +26613,7 @@ (f32.const 7.888609052210118e-31) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26598,7 +26632,7 @@ (f32.const -7.888609052210118e-31) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26754,7 +26788,7 @@ (f32.const 0.5) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26773,7 +26807,7 @@ (f32.const -0.5) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26792,7 +26826,7 @@ (f32.const 1.0000152587890625) (f32.const 2) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26811,7 +26845,7 @@ (f32.const -1.0000152587890625) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26830,7 +26864,7 @@ (f32.const 0.9999923706054688) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26849,7 +26883,7 @@ (f32.const -0.9999923706054688) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26868,7 +26902,7 @@ (f32.const 7.888609052210118e-31) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -26887,7 +26921,7 @@ (f32.const -7.888609052210118e-31) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27043,7 +27077,7 @@ (f32.const 0.5) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27062,7 +27096,7 @@ (f32.const -0.5) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27081,7 +27115,7 @@ (f32.const 1.0000152587890625) (f32.const 2) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27100,7 +27134,7 @@ (f32.const -1.0000152587890625) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27119,7 +27153,7 @@ (f32.const 0.9999923706054688) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27138,7 +27172,7 @@ (f32.const -0.9999923706054688) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27157,7 +27191,7 @@ (f32.const 7.888609052210118e-31) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27176,7 +27210,7 @@ (f32.const -7.888609052210118e-31) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27195,7 +27229,7 @@ (f64.const -8.06684839057968) (f64.const 1593.5209938862329) (f64.const -0.38098856806755066) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27214,7 +27248,7 @@ (f64.const 4.345239849338305) (f64.const 38.56174928426729) (f64.const -0.2712278366088867) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27233,7 +27267,7 @@ (f64.const -8.38143342755525) (f64.const 2182.630979595893) (f64.const 0.0817827582359314) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27252,7 +27286,7 @@ (f64.const -6.531673581913484) (f64.const 343.273849250879) (f64.const -0.429940402507782) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27271,7 +27305,7 @@ (f64.const 9.267056966972586) (f64.const 5291.779170005587) (f64.const -0.1592995822429657) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27290,7 +27324,7 @@ (f64.const 0.6619858980995045) (f64.const 1.2272321957342842) (f64.const 0.23280741274356842) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27309,7 +27343,7 @@ (f64.const -0.4066039223853553) (f64.const 1.083808541871197) (f64.const -0.3960916996002197) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27328,7 +27362,7 @@ (f64.const 0.5617597462207241) (f64.const 1.1619803583175077) (f64.const 0.37748390436172485) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27347,7 +27381,7 @@ (f64.const 0.7741522965913037) (f64.const 1.3149236876276706) (f64.const 0.43587008118629456) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27366,7 +27400,7 @@ (f64.const -0.6787637026394024) (f64.const 1.2393413245934533) (f64.const 0.10201606154441833) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27482,7 +27516,7 @@ (f32.const -8.066848754882812) (f32.const 1593.5216064453125) (f32.const 0.26242581009864807) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27501,7 +27535,7 @@ (f32.const 4.345239639282227) (f32.const 38.56174087524414) (f32.const -0.08168885856866837) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27520,7 +27554,7 @@ (f32.const -8.381433486938477) (f32.const 2182.631103515625) (f32.const -0.02331414446234703) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27539,7 +27573,7 @@ (f32.const -6.531673431396484) (f32.const 343.2738037109375) (f32.const 0.20081493258476257) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27558,7 +27592,7 @@ (f32.const 9.267057418823242) (f32.const 5291.78173828125) (f32.const 0.36286723613739014) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27577,7 +27611,7 @@ (f32.const 0.6619858741760254) (f32.const 1.2272322177886963) (f32.const 0.32777416706085205) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27596,7 +27630,7 @@ (f32.const -0.40660393238067627) (f32.const 1.0838085412979126) (f32.const -0.039848703891038895) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27615,7 +27649,7 @@ (f32.const 0.5617597699165344) (f32.const 1.161980390548706) (f32.const 0.15274477005004883) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27634,7 +27668,7 @@ (f32.const 0.7741522789001465) (f32.const 1.314923644065857) (f32.const -0.2387111485004425) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27653,7 +27687,7 @@ (f32.const -0.6787636876106262) (f32.const 1.2393412590026855) (f32.const -0.45791932940483093) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27769,7 +27803,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 +27822,7 @@ (f64.const 4.345239849338305) (f64.const 77.11053017112141) (f64.const -0.02792675793170929) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27807,7 +27841,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 +27860,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 +27879,7 @@ (f64.const 9.267056966972586) (f64.const 10583.558245524993) (f64.const 0.17696762084960938) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27864,7 +27898,7 @@ (f64.const 0.6619858980995045) (f64.const 1.9386384525571998) (f64.const -0.4964246451854706) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27883,7 +27917,7 @@ (f64.const -0.4066039223853553) (f64.const 0.6659078892838025) (f64.const -0.10608318448066711) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27902,7 +27936,7 @@ (f64.const 0.5617597462207241) (f64.const 1.7537559518626311) (f64.const -0.39162111282348633) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27921,7 +27955,7 @@ (f64.const 0.7741522965913037) (f64.const 2.1687528885129246) (f64.const -0.2996125817298889) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27940,7 +27974,7 @@ (f64.const -0.6787637026394024) (f64.const 0.5072437089402843) (f64.const 0.47261738777160645) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -27997,7 +28031,7 @@ (f64.const 1) (f64.const 2.718281828459045) (f64.const -0.3255307376384735) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28016,7 +28050,7 @@ (f64.const -1) (f64.const 0.36787944117144233) (f64.const 0.22389651834964752) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28094,7 +28128,7 @@ (f64.const 1.0397214889526365) (f64.const 2.828429155876411) (f64.const 0.18803080916404724) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28113,7 +28147,7 @@ (f64.const -1.0397214889526365) (f64.const 0.35355313670217847) (f64.const 0.2527272403240204) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28132,7 +28166,7 @@ (f64.const 1.0397210121154785) (f64.const 2.8284278071766122) (f64.const -0.4184139370918274) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28151,7 +28185,7 @@ (f64.const 1.0397214889526367) (f64.const 2.8284291558764116) (f64.const -0.22618377208709717) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28170,7 +28204,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 +28223,7 @@ (f32.const 4.345239639282227) (f32.const 77.11051177978516) (f32.const -0.2875460684299469) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28208,7 +28242,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 +28261,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 +28280,7 @@ (f32.const 9.267057418823242) (f32.const 10583.5634765625) (f32.const 0.45962104201316833) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28265,7 +28299,7 @@ (f32.const 0.6619858741760254) (f32.const 1.93863844871521) (f32.const 0.3568260967731476) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28284,7 +28318,7 @@ (f32.const -0.40660393238067627) (f32.const 0.6659078598022461) (f32.const -0.38294991850852966) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28303,7 +28337,7 @@ (f32.const 0.5617597699165344) (f32.const 1.753756046295166) (f32.const 0.44355490803718567) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28322,7 +28356,7 @@ (f32.const 0.7741522789001465) (f32.const 2.168752908706665) (f32.const 0.24562469124794006) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28341,7 +28375,7 @@ (f32.const -0.6787636876106262) (f32.const 0.5072436928749084) (f32.const -0.3974292278289795) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28398,7 +28432,7 @@ (f32.const 1) (f32.const 2.7182817459106445) (f32.const -0.3462330996990204) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28417,7 +28451,7 @@ (f32.const -1) (f32.const 0.3678794503211975) (f32.const 0.3070148527622223) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28495,7 +28529,7 @@ (f32.const 88.72283172607422) (f32.const 340279851902147610656242e15) (f32.const -0.09067153930664062) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28515,8 +28549,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 +28571,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 +28593,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 +28614,7 @@ (f32.const 0.3465735614299774) (f32.const 1.4142135381698608) (f32.const 0.13922421634197235) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28599,7 +28633,7 @@ (f32.const 0.3465735912322998) (f32.const 1.4142135381698608) (f32.const -0.21432916820049286) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28618,7 +28652,7 @@ (f32.const 0.3465736210346222) (f32.const 1.4142136573791504) (f32.const 0.43211743235588074) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28637,7 +28671,7 @@ (f64.const -8.06684839057968) (f64.const -0.9996862293931839) (f64.const -0.2760058343410492) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28656,7 +28690,7 @@ (f64.const 4.345239849338305) (f64.const 76.11053017112141) (f64.const -0.02792675793170929) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28675,7 +28709,7 @@ (f64.const -8.38143342755525) (f64.const -0.9997709186615084) (f64.const 0.10052496194839478) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28694,7 +28728,7 @@ (f64.const -6.531673581913484) (f64.const -0.9985434338739069) (f64.const -0.27437829971313477) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28713,7 +28747,7 @@ (f64.const 9.267056966972586) (f64.const 10582.558245524993) (f64.const 0.17696762084960938) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28732,7 +28766,7 @@ (f64.const 0.6619858980995045) (f64.const 0.9386384525571999) (f64.const 0.007150684483349323) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28751,7 +28785,7 @@ (f64.const -0.4066039223853553) (f64.const -0.3340921107161975) (f64.const -0.21216636896133423) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28770,7 +28804,7 @@ (f64.const 0.5617597462207241) (f64.const 0.7537559518626312) (f64.const 0.21675777435302734) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28789,7 +28823,7 @@ (f64.const 0.7741522965913037) (f64.const 1.1687528885129248) (f64.const 0.4007748067378998) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28808,7 +28842,7 @@ (f64.const -0.6787637026394024) (f64.const -0.4927562910597158) (f64.const -0.05476519837975502) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28865,7 +28899,7 @@ (f64.const 1) (f64.const 1.7182818284590453) (f64.const 0.348938524723053) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28884,7 +28918,7 @@ (f64.const -1) (f64.const -0.6321205588285577) (f64.const 0.11194825917482376) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -28963,8 +28997,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 +29019,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 +29040,7 @@ (f32.const -8.066848754882812) (f32.const -0.9996862411499023) (f32.const -0.19532723724842072) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29025,7 +29059,7 @@ (f32.const 4.345239639282227) (f32.const 76.11051177978516) (f32.const -0.2875460684299469) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29044,7 +29078,7 @@ (f32.const -8.381433486938477) (f32.const -0.9997709393501282) (f32.const -0.34686920046806335) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29063,7 +29097,7 @@ (f32.const -6.531673431396484) (f32.const -0.9985434412956238) (f32.const -0.1281939446926117) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29082,7 +29116,7 @@ (f32.const 9.267057418823242) (f32.const 10582.5634765625) (f32.const 0.45962104201316833) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29101,7 +29135,7 @@ (f32.const 0.6619858741760254) (f32.const 0.9386383891105652) (f32.const -0.28634780645370483) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29120,7 +29154,7 @@ (f32.const -0.40660393238067627) (f32.const -0.3340921103954315) (f32.const 0.23410017788410187) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29139,7 +29173,7 @@ (f32.const 0.5617597699165344) (f32.const 0.7537559866905212) (f32.const -0.11289017647504807) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29158,7 +29192,7 @@ (f32.const 0.7741522789001465) (f32.const 1.168752908706665) (f32.const 0.4912493824958801) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29177,7 +29211,7 @@ (f32.const -0.6787636876106262) (f32.const -0.49275627732276917) (f32.const 0.20514154434204102) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29234,7 +29268,7 @@ (f32.const 1) (f32.const 1.718281865119934) (f32.const 0.3075338304042816) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29253,7 +29287,7 @@ (f32.const -1) (f32.const -0.6321205496788025) (f32.const 0.15350742638111115) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29331,7 +29365,7 @@ (f64.const -8.06684839057968) (f64.const -9) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29350,7 +29384,7 @@ (f64.const 4.345239849338305) (f64.const 4) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29369,7 +29403,7 @@ (f64.const -8.38143342755525) (f64.const -9) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29388,7 +29422,7 @@ (f64.const -6.531673581913484) (f64.const -7) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29407,7 +29441,7 @@ (f64.const 9.267056966972586) (f64.const 9) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29426,7 +29460,7 @@ (f64.const 0.6619858980995045) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29445,7 +29479,7 @@ (f64.const -0.4066039223853553) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29464,7 +29498,7 @@ (f64.const 0.5617597462207241) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29483,7 +29517,7 @@ (f64.const 0.7741522965913037) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29502,7 +29536,7 @@ (f64.const -0.6787637026394024) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29658,7 +29692,7 @@ (f64.const 0.5) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29677,7 +29711,7 @@ (f64.const -0.5) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29696,7 +29730,7 @@ (f64.const 1.0000152587890625) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29715,7 +29749,7 @@ (f64.const -1.0000152587890625) (f64.const -2) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29734,7 +29768,7 @@ (f64.const 0.9999923706054688) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29753,7 +29787,7 @@ (f64.const -0.9999923706054688) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29772,7 +29806,7 @@ (f64.const 7.888609052210118e-31) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29791,7 +29825,7 @@ (f64.const -7.888609052210118e-31) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29810,7 +29844,7 @@ (f32.const -8.066848754882812) (f32.const -9) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29829,7 +29863,7 @@ (f32.const 4.345239639282227) (f32.const 4) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29848,7 +29882,7 @@ (f32.const -8.381433486938477) (f32.const -9) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29867,7 +29901,7 @@ (f32.const -6.531673431396484) (f32.const -7) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29886,7 +29920,7 @@ (f32.const 9.267057418823242) (f32.const 9) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29905,7 +29939,7 @@ (f32.const 0.6619858741760254) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29924,7 +29958,7 @@ (f32.const -0.40660393238067627) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29943,7 +29977,7 @@ (f32.const 0.5617597699165344) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29962,7 +29996,7 @@ (f32.const 0.7741522789001465) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -29981,7 +30015,7 @@ (f32.const -0.6787636876106262) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30137,7 +30171,7 @@ (f32.const 0.5) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30156,7 +30190,7 @@ (f32.const -0.5) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30175,7 +30209,7 @@ (f32.const 1.0000152587890625) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30194,7 +30228,7 @@ (f32.const -1.0000152587890625) (f32.const -2) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30213,7 +30247,7 @@ (f32.const 0.9999923706054688) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30232,7 +30266,7 @@ (f32.const -0.9999923706054688) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30251,7 +30285,7 @@ (f32.const 7.888609052210118e-31) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30270,7 +30304,7 @@ (f32.const -7.888609052210118e-31) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30290,7 +30324,7 @@ (f64.const 4.535662560676869) (f64.const 9.25452742288464) (f64.const -0.31188681721687317) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30310,7 +30344,7 @@ (f64.const -8.88799136300345) (f64.const 9.893305808328252) (f64.const 0.4593673348426819) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30330,7 +30364,7 @@ (f64.const -2.763607337379588) (f64.const 8.825301797432132) (f64.const -0.1701754331588745) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30350,7 +30384,7 @@ (f64.const 4.567535276842744) (f64.const 7.970265885519092) (f64.const -0.3176782727241516) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30370,7 +30404,7 @@ (f64.const 4.811392084359796) (f64.const 10.441639651824575) (f64.const -0.2693633437156677) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30390,7 +30424,7 @@ (f64.const 0.6620717923376739) (f64.const 6.483936052542593) (f64.const 0.35618898272514343) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30410,7 +30444,7 @@ (f64.const 0.05215452675006225) (f64.const 7.859063309581766) (f64.const 0.08044655621051788) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30430,7 +30464,7 @@ (f64.const 7.67640268511754) (f64.const 7.717156764899584) (f64.const 0.05178084969520569) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30450,7 +30484,7 @@ (f64.const 2.0119025790324803) (f64.const 2.104006123874314) (f64.const -0.0918039008975029) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30470,7 +30504,7 @@ (f64.const 0.03223983060263804) (f64.const 0.5596880129062913) (f64.const 0.1383407711982727) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30878,7 +30912,7 @@ (f32.const 4.535662651062012) (f32.const 9.254528045654297) (f32.const 0.2735958993434906) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30898,7 +30932,7 @@ (f32.const -8.887990951538086) (f32.const 9.893305778503418) (f32.const 0.4530770778656006) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30918,7 +30952,7 @@ (f32.const -2.7636072635650635) (f32.const 8.825302124023438) (f32.const 0.30755728483200073) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30938,7 +30972,7 @@ (f32.const 4.567535400390625) (f32.const 7.970265865325928) (f32.const 0.06785223633050919) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30958,7 +30992,7 @@ (f32.const 4.811392307281494) (f32.const 10.44163990020752) (f32.const -0.26776307821273804) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30978,7 +31012,7 @@ (f32.const 0.6620717644691467) (f32.const 6.483936309814453) (f32.const 0.48381292819976807) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -30998,7 +31032,7 @@ (f32.const 0.052154526114463806) (f32.const 7.859063148498535) (f32.const 0.07413065433502197) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31018,7 +31052,7 @@ (f32.const 7.676402568817139) (f32.const 7.717156887054443) (f32.const 0.4940592646598816) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31038,7 +31072,7 @@ (f32.const 2.0119025707244873) (f32.const 2.104006052017212) (f32.const -0.287089467048645) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31058,7 +31092,7 @@ (f32.const 0.03223983198404312) (f32.const 0.5596880316734314) (f32.const 0.4191940724849701) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31465,7 +31499,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31484,7 +31518,7 @@ (f64.const 4.345239849338305) (f64.const 1.4690809584224322) (f64.const -0.3412533402442932) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31503,7 +31537,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31522,7 +31556,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31541,7 +31575,7 @@ (f64.const 9.267056966972586) (f64.const 2.2264658498795615) (f64.const 0.3638114035129547) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31560,7 +31594,7 @@ (f64.const 0.6619858980995045) (f64.const -0.4125110252365137) (f64.const -0.29108747839927673) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31579,7 +31613,7 @@ (f64.const -0.4066039223853553) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31598,7 +31632,7 @@ (f64.const 0.5617597462207241) (f64.const -0.5766810183195862) (f64.const -0.10983199626207352) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31617,7 +31651,7 @@ (f64.const 0.7741522965913037) (f64.const -0.2559866591263865) (f64.const -0.057990044355392456) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -31636,7 +31670,7 @@ (f64.const -0.6787637026394024) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31657,7 +31691,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -31678,7 +31712,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -31697,7 +31731,7 @@ (f64.const -7.888609052210118e-31) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31735,7 +31769,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31775,7 +31809,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31815,7 +31849,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -31836,7 +31870,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -31855,7 +31889,7 @@ (f32.const -7.888609052210118e-31) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31893,7 +31927,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31933,7 +31967,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -31973,7 +32007,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -31994,7 +32028,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -32013,7 +32047,7 @@ (f32.const -7.888609052210118e-31) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32051,7 +32085,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32091,7 +32125,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32129,7 +32163,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32148,7 +32182,7 @@ (f64.const 4.345239849338305) (f64.const 0.6380137537120029) (f64.const -0.2088824063539505) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32167,7 +32201,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32186,7 +32220,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32205,7 +32239,7 @@ (f64.const 9.267056966972586) (f64.const 0.9669418327487274) (f64.const -0.06120431795716286) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32224,7 +32258,7 @@ (f64.const 0.6619858980995045) (f64.const -0.17915126198447093) (f64.const 0.39090874791145325) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32243,7 +32277,7 @@ (f64.const -0.4066039223853553) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32262,7 +32296,7 @@ (f64.const 0.5617597462207241) (f64.const -0.25044938407454437) (f64.const -0.3046841621398926) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32281,7 +32315,7 @@ (f64.const 0.7741522965913037) (f64.const -0.11117359349943837) (f64.const -0.31503361463546753) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32300,7 +32334,7 @@ (f64.const -0.6787637026394024) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32321,7 +32355,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -32342,7 +32376,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -32361,7 +32395,7 @@ (f64.const -7.888609052210118e-31) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32399,7 +32433,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32439,7 +32473,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32477,7 +32511,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32496,7 +32530,7 @@ (f32.const 4.345239639282227) (f32.const 0.6380137205123901) (f32.const -0.20476758480072021) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32515,7 +32549,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32534,7 +32568,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32553,7 +32587,7 @@ (f32.const 9.267057418823242) (f32.const 0.9669418334960938) (f32.const -0.34273025393486023) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32572,7 +32606,7 @@ (f32.const 0.6619858741760254) (f32.const -0.1791512817144394) (f32.const -0.27078554034233093) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32591,7 +32625,7 @@ (f32.const -0.40660393238067627) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32610,7 +32644,7 @@ (f32.const 0.5617597699165344) (f32.const -0.25044935941696167) (f32.const 0.2126826047897339) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32629,7 +32663,7 @@ (f32.const 0.7741522789001465) (f32.const -0.1111735999584198) (f32.const 0.46515095233917236) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32648,7 +32682,7 @@ (f32.const -0.6787636876106262) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32669,7 +32703,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -32690,7 +32724,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -32709,7 +32743,7 @@ (f32.const -7.888609052210118e-31) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32747,7 +32781,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32787,7 +32821,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32825,7 +32859,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32844,7 +32878,7 @@ (f64.const 4.345239849338305) (f64.const 1.6762064170601734) (f64.const 0.46188199520111084) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32863,7 +32897,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32882,7 +32916,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -32901,7 +32935,7 @@ (f64.const 9.267056966972586) (f64.const 2.3289404168523826) (f64.const -0.411114901304245) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32920,7 +32954,7 @@ (f64.const 0.6619858980995045) (f64.const 0.5080132114992477) (f64.const -0.29306045174598694) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32939,7 +32973,7 @@ (f64.const -0.4066039223853553) (f64.const -0.5218931811663979) (f64.const -0.25825726985931396) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32958,7 +32992,7 @@ (f64.const 0.5617597462207241) (f64.const 0.4458132279488102) (f64.const -0.13274887204170227) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32977,7 +33011,7 @@ (f64.const 0.7741522965913037) (f64.const 0.5733227294648414) (f64.const 0.02716583013534546) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -32996,7 +33030,7 @@ (f64.const -0.6787637026394024) (f64.const -1.1355782978128564) (f64.const 0.2713092863559723) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33053,7 +33087,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 +33106,7 @@ (f64.const 1) (f64.const 0.6931471805599453) (f64.const -0.2088811695575714) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33093,7 +33127,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -33133,7 +33167,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33171,7 +33205,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33190,7 +33224,7 @@ (f32.const 4.345239639282227) (f32.const 1.676206350326538) (f32.const -0.23014859855175018) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33209,7 +33243,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33228,7 +33262,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33247,7 +33281,7 @@ (f32.const 9.267057418823242) (f32.const 2.3289403915405273) (f32.const -0.29075589776039124) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33266,7 +33300,7 @@ (f32.const 0.6619858741760254) (f32.const 0.5080131888389587) (f32.const -0.1386766880750656) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33285,7 +33319,7 @@ (f32.const -0.40660393238067627) (f32.const -0.5218932032585144) (f32.const -0.08804433047771454) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33304,7 +33338,7 @@ (f32.const 0.5617597699165344) (f32.const 0.44581323862075806) (f32.const -0.15101368725299835) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33323,7 +33357,7 @@ (f32.const 0.7741522789001465) (f32.const 0.5733227133750916) (f32.const -0.10264533013105392) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33342,7 +33376,7 @@ (f32.const -0.6787636876106262) (f32.const -1.1355782747268677) (f32.const -0.19879481196403503) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33399,7 +33433,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 +33452,7 @@ (f32.const 1) (f32.const 0.6931471824645996) (f32.const 0.031954795122146606) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33439,7 +33473,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -33479,7 +33513,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33518,8 +33552,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 +33573,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33558,7 +33592,7 @@ (f64.const 4.345239849338305) (f64.const 2.1194358133804485) (f64.const -0.10164877772331238) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33577,7 +33611,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33596,7 +33630,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33615,7 +33649,7 @@ (f64.const 9.267056966972586) (f64.const 3.2121112403298744) (f64.const -0.15739446878433228) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33634,7 +33668,7 @@ (f64.const 0.6619858980995045) (f64.const -0.5951276104207402) (f64.const 0.3321485221385956) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33653,7 +33687,7 @@ (f64.const -0.4066039223853553) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33672,7 +33706,7 @@ (f64.const 0.5617597462207241) (f64.const -0.8319748453044644) (f64.const 0.057555437088012695) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33691,7 +33725,7 @@ (f64.const 0.7741522965913037) (f64.const -0.36931068365537134) (f64.const -0.19838279485702515) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33710,7 +33744,7 @@ (f64.const -0.6787637026394024) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33731,7 +33765,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -33752,7 +33786,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -33771,7 +33805,7 @@ (f64.const -7.888609052210118e-31) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33809,7 +33843,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33849,7 +33883,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33887,7 +33921,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33906,7 +33940,7 @@ (f32.const 4.345239639282227) (f32.const 2.1194357872009277) (f32.const 0.18271538615226746) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33925,7 +33959,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33944,7 +33978,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -33963,7 +33997,7 @@ (f32.const 9.267057418823242) (f32.const 3.212111234664917) (f32.const -0.3188050389289856) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -33982,7 +34016,7 @@ (f32.const 0.6619858741760254) (f32.const -0.5951276421546936) (f32.const 0.34231460094451904) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -34001,7 +34035,7 @@ (f32.const -0.40660393238067627) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -34020,7 +34054,7 @@ (f32.const 0.5617597699165344) (f32.const -0.8319748044013977) (f32.const -0.33473604917526245) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -34039,7 +34073,7 @@ (f32.const 0.7741522789001465) (f32.const -0.3693107068538666) (f32.const 0.3278401792049408) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -34058,7 +34092,7 @@ (f32.const -0.6787636876106262) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -34079,7 +34113,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -34100,7 +34134,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -34119,7 +34153,7 @@ (f32.const -7.888609052210118e-31) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -34157,7 +34191,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -34197,7 +34231,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40252,7 +40286,7 @@ (f64.const 1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40274,7 +40308,7 @@ (f64.const 1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40514,7 +40548,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40536,7 +40570,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40576,7 +40610,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40596,7 +40630,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40678,7 +40712,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40698,7 +40732,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40780,7 +40814,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40800,7 +40834,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40820,7 +40854,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40842,7 +40876,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40882,7 +40916,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40902,7 +40936,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40924,7 +40958,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40964,7 +40998,7 @@ (f64.const 2) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -40984,7 +41018,7 @@ (f64.const -0.5) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41026,7 +41060,7 @@ (f64.const 2) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41048,7 +41082,7 @@ (f64.const -0.5) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41190,7 +41224,7 @@ (f64.const inf) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41212,7 +41246,7 @@ (f64.const inf) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41278,7 +41312,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41302,7 +41336,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41802,7 +41836,7 @@ (f32.const 1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -41824,7 +41858,7 @@ (f32.const 1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42064,7 +42098,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42086,7 +42120,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42126,7 +42160,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42146,7 +42180,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42228,7 +42262,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42248,7 +42282,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42330,7 +42364,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42350,7 +42384,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42370,7 +42404,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42392,7 +42426,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42432,7 +42466,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42452,7 +42486,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42474,7 +42508,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42514,7 +42548,7 @@ (f32.const 2) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42534,7 +42568,7 @@ (f32.const -0.5) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42576,7 +42610,7 @@ (f32.const 2) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42598,7 +42632,7 @@ (f32.const -0.5) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42740,7 +42774,7 @@ (f32.const inf) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42762,7 +42796,7 @@ (f32.const inf) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42828,7 +42862,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42852,7 +42886,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42952,7 +42986,7 @@ (f64.const 4.535662560676869) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -42972,7 +43006,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 +43026,7 @@ (f64.const -2.763607337379588) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -43012,7 +43046,7 @@ (f64.const 4.567535276842744) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -43032,7 +43066,7 @@ (f64.const 4.811392084359796) (f64.const 44909.29941512966) (f64.const -0.26659080386161804) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -43052,7 +43086,7 @@ (f64.const 0.6620717923376739) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -43072,7 +43106,7 @@ (f64.const 0.05215452675006225) (f64.const 1.1135177413458652) (f64.const -0.37168607115745544) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -43092,7 +43126,7 @@ (f64.const 7.67640268511754) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -43112,7 +43146,7 @@ (f64.const 2.0119025790324803) (f64.const 0.37690773521380183) (f64.const 0.32473301887512207) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -43132,7 +43166,7 @@ (f64.const 0.03223983060263804) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -43312,7 +43346,7 @@ (f64.const -0.5) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43332,7 +43366,7 @@ (f64.const -1) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43352,7 +43386,7 @@ (f64.const -2) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43372,7 +43406,7 @@ (f64.const -3) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43392,7 +43426,7 @@ (f64.const -4) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43594,7 +43628,7 @@ (f64.const -0.5) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43616,7 +43650,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43636,7 +43670,7 @@ (f64.const -2) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43658,7 +43692,7 @@ (f64.const inf) ) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -43678,7 +43712,7 @@ (f64.const -4) (f64.const inf) (f64.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -44106,7 +44140,7 @@ (f64.const 0.5) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -44268,7 +44302,7 @@ (f64.const 0.5) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -44288,7 +44322,7 @@ (f64.const 1.5) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -45042,7 +45076,7 @@ (f32.const 4.535662651062012) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -45062,7 +45096,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 +45116,7 @@ (f32.const -2.7636072635650635) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -45102,7 +45136,7 @@ (f32.const 4.567535400390625) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -45122,7 +45156,7 @@ (f32.const 4.811392307281494) (f32.const 44909.33203125) (f32.const -0.05356409028172493) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -45142,7 +45176,7 @@ (f32.const 0.6620717644691467) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -45162,7 +45196,7 @@ (f32.const 0.052154526114463806) (f32.const 1.1135177612304688) (f32.const 0.19122089445590973) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -45182,7 +45216,7 @@ (f32.const 7.676402568817139) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -45202,7 +45236,7 @@ (f32.const 2.0119025707244873) (f32.const 0.3769077658653259) (f32.const 0.337149053812027) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -45222,7 +45256,7 @@ (f32.const 0.03223983198404312) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -45402,7 +45436,7 @@ (f32.const -0.5) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45422,7 +45456,7 @@ (f32.const -1) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45442,7 +45476,7 @@ (f32.const -2) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45462,7 +45496,7 @@ (f32.const -3) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45482,7 +45516,7 @@ (f32.const -4) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45684,7 +45718,7 @@ (f32.const -0.5) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45706,7 +45740,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45726,7 +45760,7 @@ (f32.const -2) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45748,7 +45782,7 @@ (f32.const inf) ) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -45768,7 +45802,7 @@ (f32.const -4) (f32.const inf) (f32.const 0) - (i32.const 4) + (get_global $std/math/DIVBYZERO) ) ) (block @@ -46196,7 +46230,7 @@ (f32.const 0.5) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -46358,7 +46392,7 @@ (f32.const 0.5) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -46378,7 +46412,7 @@ (f32.const 1.5) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -47256,7 +47290,7 @@ (f64.const -8.06684839057968) (f64.const -8) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47275,7 +47309,7 @@ (f64.const 4.345239849338305) (f64.const 4) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47294,7 +47328,7 @@ (f64.const -8.38143342755525) (f64.const -8) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47313,7 +47347,7 @@ (f64.const -6.531673581913484) (f64.const -7) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47332,7 +47366,7 @@ (f64.const 9.267056966972586) (f64.const 9) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47351,7 +47385,7 @@ (f64.const 0.6619858980995045) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47370,7 +47404,7 @@ (f64.const -0.4066039223853553) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47389,7 +47423,7 @@ (f64.const 0.5617597462207241) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47408,7 +47442,7 @@ (f64.const 0.7741522965913037) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47427,7 +47461,7 @@ (f64.const -0.6787637026394024) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47583,7 +47617,7 @@ (f64.const 0.5) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47602,7 +47636,7 @@ (f64.const -0.5) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47621,7 +47655,7 @@ (f64.const 1.5) (f64.const 2) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47640,7 +47674,7 @@ (f64.const -1.5) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47659,7 +47693,7 @@ (f64.const 1.0000152587890625) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47678,7 +47712,7 @@ (f64.const -1.0000152587890625) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47697,7 +47731,7 @@ (f64.const 0.9999923706054688) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47716,7 +47750,7 @@ (f64.const -0.9999923706054688) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47735,7 +47769,7 @@ (f64.const 7.888609052210118e-31) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47754,7 +47788,7 @@ (f64.const -7.888609052210118e-31) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47773,7 +47807,7 @@ (f32.const -8.066848754882812) (f32.const -8) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47792,7 +47826,7 @@ (f32.const 4.345239639282227) (f32.const 4) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47811,7 +47845,7 @@ (f32.const -8.381433486938477) (f32.const -8) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47830,7 +47864,7 @@ (f32.const -6.531673431396484) (f32.const -7) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47849,7 +47883,7 @@ (f32.const 9.267057418823242) (f32.const 9) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47868,7 +47902,7 @@ (f32.const 0.6619858741760254) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47887,7 +47921,7 @@ (f32.const -0.40660393238067627) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47906,7 +47940,7 @@ (f32.const 0.5617597699165344) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47925,7 +47959,7 @@ (f32.const 0.7741522789001465) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -47944,7 +47978,7 @@ (f32.const -0.6787636876106262) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48100,7 +48134,7 @@ (f32.const 0.5) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48119,7 +48153,7 @@ (f32.const -0.5) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48138,7 +48172,7 @@ (f64.const 1.5) (f64.const 2) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48157,7 +48191,7 @@ (f64.const -1.5) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48176,7 +48210,7 @@ (f32.const 1.0000152587890625) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48195,7 +48229,7 @@ (f32.const -1.0000152587890625) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48214,7 +48248,7 @@ (f32.const 0.9999923706054688) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48233,7 +48267,7 @@ (f32.const -0.9999923706054688) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48252,7 +48286,7 @@ (f32.const 7.888609052210118e-31) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -48271,7 +48305,7 @@ (f32.const -7.888609052210118e-31) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -49037,7 +49071,7 @@ (f64.const 1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49059,7 +49093,7 @@ (f64.const 1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49299,7 +49333,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49321,7 +49355,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49361,7 +49395,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49381,7 +49415,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49463,7 +49497,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49483,7 +49517,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49565,7 +49599,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49585,7 +49619,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49605,7 +49639,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49627,7 +49661,7 @@ (f64.const 0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49667,7 +49701,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49687,7 +49721,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49709,7 +49743,7 @@ (f64.const -0) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49749,7 +49783,7 @@ (f64.const 2) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49769,7 +49803,7 @@ (f64.const -0.5) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49811,7 +49845,7 @@ (f64.const 2) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49833,7 +49867,7 @@ (f64.const -0.5) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49975,7 +50009,7 @@ (f64.const inf) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -49997,7 +50031,7 @@ (f64.const inf) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50063,7 +50097,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50087,7 +50121,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50607,7 +50641,7 @@ (f32.const 1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50629,7 +50663,7 @@ (f32.const 1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50869,7 +50903,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50891,7 +50925,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50931,7 +50965,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -50951,7 +50985,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51033,7 +51067,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51053,7 +51087,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51135,7 +51169,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51155,7 +51189,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51175,7 +51209,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51197,7 +51231,7 @@ (f32.const 0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51237,7 +51271,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51257,7 +51291,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51279,7 +51313,7 @@ (f32.const -0) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51319,7 +51353,7 @@ (f32.const 2) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51339,7 +51373,7 @@ (f32.const -0.5) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51381,7 +51415,7 @@ (f32.const 2) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51403,7 +51437,7 @@ (f32.const -0.5) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51545,7 +51579,7 @@ (f32.const inf) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51567,7 +51601,7 @@ (f32.const inf) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51633,7 +51667,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51657,7 +51691,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -51776,7 +51810,7 @@ (f64.const -8.06684839057968) (f64.const -1593.5206801156262) (f64.const -0.2138727605342865) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51795,7 +51829,7 @@ (f64.const 4.345239849338305) (f64.const 38.54878088685412) (f64.const 0.21537430584430695) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51814,7 +51848,7 @@ (f64.const -8.38143342755525) (f64.const -2182.6307505145546) (f64.const 0.16213826835155487) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51833,7 +51867,7 @@ (f64.const -6.531673581913484) (f64.const -343.2723926847529) (f64.const 0.20479513704776764) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51852,7 +51886,7 @@ (f64.const 9.267056966972586) (f64.const 5291.7790755194055) (f64.const -0.48676517605781555) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51871,7 +51905,7 @@ (f64.const 0.6619858980995045) (f64.const 0.7114062568229157) (f64.const -0.4584641456604004) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51890,7 +51924,7 @@ (f64.const -0.4066039223853553) (f64.const -0.41790065258739445) (f64.const 0.37220045924186707) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51909,7 +51943,7 @@ (f64.const 0.5617597462207241) (f64.const 0.5917755935451237) (f64.const 0.46178996562957764) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51928,7 +51962,7 @@ (f64.const 0.7741522965913037) (f64.const 0.8538292008852542) (f64.const -0.07019051909446716) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -51947,7 +51981,7 @@ (f64.const -0.6787637026394024) (f64.const -0.732097615653169) (f64.const 0.26858529448509216) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52065,7 +52099,7 @@ (f32.const -8.066848754882812) (f32.const -1593.521240234375) (f32.const 0.1671663224697113) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52084,7 +52118,7 @@ (f32.const 4.345239639282227) (f32.const 38.548770904541016) (f32.const -0.49340328574180603) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52103,7 +52137,7 @@ (f32.const -8.381433486938477) (f32.const -2182.630859375) (f32.const 0.0849970355629921) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52122,7 +52156,7 @@ (f32.const -6.531673431396484) (f32.const -343.2723388671875) (f32.const 0.0704190656542778) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52141,7 +52175,7 @@ (f32.const 9.267057418823242) (f32.const 5291.78125) (f32.const -0.44362515211105347) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52160,7 +52194,7 @@ (f32.const 0.6619858741760254) (f32.const 0.7114062309265137) (f32.const 0.058103885501623154) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52179,7 +52213,7 @@ (f32.const -0.40660393238067627) (f32.const -0.4179006516933441) (f32.const 0.39349499344825745) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52198,7 +52232,7 @@ (f32.const 0.5617597699165344) (f32.const 0.5917755961418152) (f32.const -0.4183797240257263) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52217,7 +52251,7 @@ (f32.const 0.7741522789001465) (f32.const 0.8538292050361633) (f32.const 0.45992106199264526) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52236,7 +52270,7 @@ (f32.const -0.6787636876106262) (f32.const -0.7320976257324219) (f32.const -0.48159059882164) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52354,7 +52388,7 @@ (f64.const -8.06684839057968) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52373,7 +52407,7 @@ (f64.const 4.345239849338305) (f64.const 2.0845238903256313) (f64.const -0.07180261611938477) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52392,7 +52426,7 @@ (f64.const -8.38143342755525) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52411,7 +52445,7 @@ (f64.const -6.531673581913484) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52430,7 +52464,7 @@ (f64.const 9.267056966972586) (f64.const 3.0441841217266385) (f64.const -0.01546262577176094) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52449,7 +52483,7 @@ (f64.const 0.6619858980995045) (f64.const 0.8136251582267503) (f64.const -0.08618157356977463) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52468,7 +52502,7 @@ (f64.const -0.4066039223853553) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52487,7 +52521,7 @@ (f64.const 0.5617597462207241) (f64.const 0.7495063350104014) (f64.const -0.0981396734714508) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52506,7 +52540,7 @@ (f64.const 0.7741522965913037) (f64.const 0.879859248170583) (f64.const -0.37124353647232056) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52525,7 +52559,7 @@ (f64.const -0.6787637026394024) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52584,7 +52618,7 @@ ) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52660,7 +52694,7 @@ (f64.const -1) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52698,7 +52732,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 +52751,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 +52789,7 @@ (f64.const -5e-324) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52774,7 +52808,7 @@ (f64.const 0.9999999999999999) (f64.const 0.9999999999999999) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52793,7 +52827,7 @@ (f64.const 1.9999999999999998) (f64.const 1.414213562373095) (f64.const -0.21107041835784912) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52812,7 +52846,7 @@ (f64.const 1.0000000000000002) (f64.const 1) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52831,7 +52865,7 @@ (f64.const 2.0000000000000004) (f64.const 1.4142135623730951) (f64.const -0.27173060178756714) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52850,7 +52884,7 @@ (f64.const 1.0000000000000002) (f64.const 1) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52869,7 +52903,7 @@ (f64.const 0.9999999999999999) (f64.const 0.9999999999999999) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52888,7 +52922,7 @@ (f64.const -1797693134862315708145274e284) (f64.const nan:0x8000000000000) (f64.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -52907,7 +52941,7 @@ (f64.const 1797693134862315708145274e284) (f64.const 1340780792994259561100831e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52926,7 +52960,7 @@ (f64.const 179769313486231490980915e285) (f64.const 134078079299425926338769e131) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52945,7 +52979,7 @@ (f64.const 1797693134862314111473026e284) (f64.const 1340780792994258965674548e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52964,7 +52998,7 @@ (f64.const 1797693134862313313136902e284) (f64.const 1340780792994258667961407e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -52983,7 +53017,7 @@ (f64.const 1797693134862312514800778e284) (f64.const 1340780792994258370248265e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53002,7 +53036,7 @@ (f64.const 1797693134862311716464655e284) (f64.const 1340780792994258072535124e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53021,7 +53055,7 @@ (f64.const 1797693134862310918128531e284) (f64.const 1340780792994257774821982e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53040,7 +53074,7 @@ (f64.const 1797693134862310119792407e284) (f64.const 1340780792994257477108841e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53059,7 +53093,7 @@ (f64.const 1797693134862309321456283e284) (f64.const 1340780792994257179395699e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53078,7 +53112,7 @@ (f64.const 1797693134862308523120159e284) (f64.const 1340780792994256881682558e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53097,7 +53131,7 @@ (f64.const 1797693134862307724784036e284) (f64.const 1340780792994256583969417e130) (f64.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53116,7 +53150,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 +53169,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 +53188,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 +53207,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 +53226,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 +53245,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 +53264,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 +53283,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 +53302,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 +53321,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 +53340,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 +53359,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 +53378,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 +53397,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 +53416,7 @@ (f64.const 92.35130391890645) (f64.const 9.609958580499006) (f64.const 0.4998137056827545) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53401,7 +53435,7 @@ (f64.const 93.3599596388916) (f64.const 9.662295774757238) (f64.const -0.49979978799819946) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53420,7 +53454,7 @@ (f64.const 95.42049628886124) (f64.const 9.76834153215689) (f64.const -0.49997270107269287) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53439,7 +53473,7 @@ (f64.const 95.87916941885449) (f64.const 9.791790919890728) (f64.const 0.4998766779899597) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53458,7 +53492,7 @@ (f64.const 96.84804174884022) (f64.const 9.841140266698785) (f64.const 0.499801903963089) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53477,7 +53511,7 @@ (f64.const 97.43639050883155) (f64.const 9.87098731175517) (f64.const 0.4997696280479431) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53496,7 +53530,7 @@ (f64.const 97.50957979883047) (f64.const 9.874693909120955) (f64.const 0.49999818205833435) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53515,7 +53549,7 @@ (f64.const 97.80496893882612) (f64.const 9.88963947466368) (f64.const -0.4999580681324005) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53534,7 +53568,7 @@ (f64.const 98.2751822888192) (f64.const 9.913383997849534) (f64.const 0.49979931116104126) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53553,7 +53587,7 @@ (f64.const 99.47293564880155) (f64.const 9.973611966023219) (f64.const -0.4999540448188782) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53572,7 +53606,7 @@ (f64.const 100.57047130878539) (f64.const 10.028483001370914) (f64.const -0.49996453523635864) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53591,7 +53625,7 @@ (f64.const 100.60954608878481) (f64.const 10.030431002144665) (f64.const 0.49975672364234924) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53610,7 +53644,7 @@ (f64.const 100.67909109878379) (f64.const 10.033897104255344) (f64.const -0.4997771382331848) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53629,7 +53663,7 @@ (f64.const 101.12268095877725) (f64.const 10.055977374615422) (f64.const 0.49988678097724915) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53648,7 +53682,7 @@ (f64.const 101.3027691287746) (f64.const 10.064927676281366) (f64.const 0.4999105632305145) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53667,7 +53701,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 +53720,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 +53739,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 +53758,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 +53777,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 +53796,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 +53815,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 +53834,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 +53853,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 +53872,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 +53891,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 +53910,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 +53929,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 +53948,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 +53967,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 +53986,7 @@ (f32.const -8.066848754882812) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -53971,7 +54005,7 @@ (f32.const 4.345239639282227) (f32.const 2.084523916244507) (f32.const 0.3200402557849884) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -53990,7 +54024,7 @@ (f32.const -8.381433486938477) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54009,7 +54043,7 @@ (f32.const -6.531673431396484) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54028,7 +54062,7 @@ (f32.const 9.267057418823242) (f32.const 3.0441842079162598) (f32.const 0.05022354796528816) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54047,7 +54081,7 @@ (f32.const 0.6619858741760254) (f32.const 0.813625156879425) (f32.const 0.2240506112575531) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54066,7 +54100,7 @@ (f32.const -0.40660393238067627) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54085,7 +54119,7 @@ (f32.const 0.5617597699165344) (f32.const 0.7495063543319702) (f32.const 0.05895441770553589) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54104,7 +54138,7 @@ (f32.const 0.7741522789001465) (f32.const 0.879859209060669) (f32.const -0.4874873757362366) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54123,7 +54157,7 @@ (f32.const -0.6787636876106262) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54182,7 +54216,7 @@ ) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54258,7 +54292,7 @@ (f32.const -1) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54315,7 +54349,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 +54368,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 +54387,7 @@ (f32.const -1.401298464324817e-45) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54372,7 +54406,7 @@ (f32.const 3402823466385288598117041e14) (f32.const 18446742974197923840) (f32.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54391,7 +54425,7 @@ (f32.const -3402823466385288598117041e14) (f32.const nan:0x400000) (f32.const 0) - (i32.const 2) + (get_global $std/math/INVALID) ) ) (block @@ -54410,7 +54444,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 +54463,7 @@ (f32.const 0.9999999403953552) (f32.const 0.9999999403953552) (f32.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54448,7 +54482,7 @@ (f32.const 1.999999761581421) (f32.const 1.4142134189605713) (f32.const -0.4959246516227722) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54467,7 +54501,7 @@ (f32.const 1.9999998807907104) (f32.const 1.4142135381698608) (f32.const 0.15052194893360138) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54486,7 +54520,7 @@ (f32.const 1.0000001192092896) (f32.const 1) (f32.const -0.5) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54505,7 +54539,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 +54558,7 @@ (f32.const 2.000000238418579) (f32.const 1.4142136573791504) (f32.const 0.08986179530620575) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54543,7 +54577,7 @@ (f32.const 2.000000476837158) (f32.const 1.41421377658844) (f32.const 0.3827550709247589) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54562,7 +54596,7 @@ (f64.const -8.06684839057968) (f64.const -0.999999803096032) (f64.const 0.012793331407010555) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54581,7 +54615,7 @@ (f64.const 4.345239849338305) (f64.const 0.9996636978961307) (f64.const 0.1573508232831955) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54600,7 +54634,7 @@ (f64.const -8.38143342755525) (f64.const -0.9999998950434862) (f64.const 0.27985066175460815) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54619,7 +54653,7 @@ (f64.const -6.531673581913484) (f64.const -0.9999957568392429) (f64.const -0.44285574555397034) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54638,7 +54672,7 @@ (f64.const 9.267056966972586) (f64.const 0.9999999821447234) (f64.const 0.4462755024433136) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54657,7 +54691,7 @@ (f64.const 0.6619858980995045) (f64.const 0.5796835018635275) (f64.const 0.4892043173313141) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54676,7 +54710,7 @@ (f64.const -0.4066039223853553) (f64.const -0.3855853099901652) (f64.const 0.35993871092796326) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54695,7 +54729,7 @@ (f64.const 0.5617597462207241) (f64.const 0.5092819248700439) (f64.const -0.39436522126197815) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54714,7 +54748,7 @@ (f64.const 0.7741522965913037) (f64.const 0.6493374550318555) (f64.const -0.4899396002292633) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54733,7 +54767,7 @@ (f64.const -0.6787637026394024) (f64.const -0.590715084799841) (f64.const -0.0145387789234519) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54849,7 +54883,7 @@ (f32.const -8.066848754882812) (f32.const -0.9999998211860657) (f32.const -0.3034979999065399) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54868,7 +54902,7 @@ (f32.const 4.345239639282227) (f32.const 0.9996637105941772) (f32.const 0.2154078334569931) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54887,7 +54921,7 @@ (f32.const -8.381433486938477) (f32.const -0.9999998807907104) (f32.const 0.23912210762500763) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54906,7 +54940,7 @@ (f32.const -6.531673431396484) (f32.const -0.999995768070221) (f32.const -0.18844597041606903) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54925,7 +54959,7 @@ (f32.const 9.267057418823242) (f32.const 1) (f32.const 0.1497807800769806) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54944,7 +54978,7 @@ (f32.const 0.6619858741760254) (f32.const 0.5796834826469421) (f32.const -0.05590476095676422) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54963,7 +54997,7 @@ (f32.const -0.40660393238067627) (f32.const -0.38558530807495117) (f32.const 0.349787175655365) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -54982,7 +55016,7 @@ (f32.const 0.5617597699165344) (f32.const 0.5092819333076477) (f32.const -0.1528785079717636) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55001,7 +55035,7 @@ (f32.const 0.7741522789001465) (f32.const 0.6493374705314636) (f32.const 0.4317026138305664) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55020,7 +55054,7 @@ (f32.const -0.6787636876106262) (f32.const -0.5907150506973267) (f32.const 0.4079873859882355) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55136,7 +55170,7 @@ (f64.const -8.06684839057968) (f64.const -8) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55155,7 +55189,7 @@ (f64.const 4.345239849338305) (f64.const 4) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55174,7 +55208,7 @@ (f64.const -8.38143342755525) (f64.const -8) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55193,7 +55227,7 @@ (f64.const -6.531673581913484) (f64.const -6) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55212,7 +55246,7 @@ (f64.const 9.267056966972586) (f64.const 9) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55231,7 +55265,7 @@ (f64.const 0.6619858980995045) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55250,7 +55284,7 @@ (f64.const -0.4066039223853553) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55269,7 +55303,7 @@ (f64.const 0.5617597462207241) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55288,7 +55322,7 @@ (f64.const 0.7741522965913037) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55307,7 +55341,7 @@ (f64.const -0.6787637026394024) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55463,7 +55497,7 @@ (f64.const 0.5) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55482,7 +55516,7 @@ (f64.const -0.5) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55501,7 +55535,7 @@ (f64.const 1.0000152587890625) (f64.const 1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55520,7 +55554,7 @@ (f64.const -1.0000152587890625) (f64.const -1) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55539,7 +55573,7 @@ (f64.const 0.9999923706054688) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55558,7 +55592,7 @@ (f64.const -0.9999923706054688) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55577,7 +55611,7 @@ (f64.const 7.888609052210118e-31) (f64.const 0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55596,7 +55630,7 @@ (f64.const -7.888609052210118e-31) (f64.const -0) (f64.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55615,7 +55649,7 @@ (f32.const -8.066848754882812) (f32.const -8) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55634,7 +55668,7 @@ (f32.const 4.345239639282227) (f32.const 4) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55653,7 +55687,7 @@ (f32.const -8.381433486938477) (f32.const -8) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55672,7 +55706,7 @@ (f32.const -6.531673431396484) (f32.const -6) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55691,7 +55725,7 @@ (f32.const 9.267057418823242) (f32.const 9) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55710,7 +55744,7 @@ (f32.const 0.6619858741760254) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55729,7 +55763,7 @@ (f32.const -0.40660393238067627) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55748,7 +55782,7 @@ (f32.const 0.5617597699165344) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55767,7 +55801,7 @@ (f32.const 0.7741522789001465) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55786,7 +55820,7 @@ (f32.const -0.6787636876106262) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55942,7 +55976,7 @@ (f32.const 0.5) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55961,7 +55995,7 @@ (f32.const -0.5) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55980,7 +56014,7 @@ (f32.const 1.0000152587890625) (f32.const 1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -55999,7 +56033,7 @@ (f32.const -1.0000152587890625) (f32.const -1) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -56018,7 +56052,7 @@ (f32.const 0.9999923706054688) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -56037,7 +56071,7 @@ (f32.const -0.9999923706054688) (f32.const -0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -56056,7 +56090,7 @@ (f32.const 7.888609052210118e-31) (f32.const 0) (f32.const 0) - (i32.const 1) + (get_global $std/math/INEXACT) ) ) (block @@ -56075,7 +56109,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.optimized.wat b/tests/compiler/std/mod.optimized.wat index 77e4030a..142fa083 100644 --- a/tests/compiler/std/mod.optimized.wat +++ b/tests/compiler/std/mod.optimized.wat @@ -1,13 +1,13 @@ (module (type $FFFi (func (param f64 f64 f64) (result i32))) (type $FFF (func (param f64 f64) (result f64))) - (type $Fi (func (param f64) (result i32))) (type $FFi (func (param f64 f64) (result i32))) + (type $Fi (func (param f64) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $fffi (func (param f32 f32 f32) (result i32))) (type $fff (func (param f32 f32) (result f32))) - (type $fi (func (param f32) (result i32))) (type $ffi (func (param f32 f32) (result i32))) + (type $fi (func (param f32) (result i32))) (type $v (func)) (import "JSOp" "mod" (func $std/mod/JSOp.mod (param f64 f64) (result f64))) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) @@ -15,13 +15,7 @@ (data (i32.const 8) "\n\00\00\00s\00t\00d\00/\00m\00o\00d\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $isNaN (; 2 ;) (type $Fi) (param $0 f64) (result i32) - (f64.ne - (get_local $0) - (get_local $0) - ) - ) - (func $~lib/math/NativeMath.mod (; 3 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.mod (; 2 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i32) (local $4 i64) @@ -81,7 +75,8 @@ ) ) (set_local $7 - (call $isNaN + (f64.ne + (get_local $1) (get_local $1) ) ) @@ -395,13 +390,19 @@ (get_local $0) ) ) + (func $~lib/builtins/isNaN (; 3 ;) (type $Fi) (param $0 f64) (result i32) + (f64.ne + (get_local $0) + (get_local $0) + ) + ) (func $std/mod/check (; 4 ;) (type $FFi) (param $0 f64) (param $1 f64) (result i32) (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) (return - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) @@ -455,13 +456,7 @@ ) (get_local $3) ) - (func $isNaN (; 6 ;) (type $fi) (param $0 f32) (result i32) - (f32.ne - (get_local $0) - (get_local $0) - ) - ) - (func $~lib/math/NativeMathf.mod (; 7 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.mod (; 6 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -513,14 +508,18 @@ ) ) (set_local $3 - (call $isNaN + (f32.ne + (get_local $1) (get_local $1) ) ) ) (if (i32.eqz - (get_local $3) + (i32.and + (get_local $3) + (i32.const 1) + ) ) (set_local $3 (i32.eq @@ -530,7 +529,10 @@ ) ) (if - (get_local $3) + (i32.and + (get_local $3) + (i32.const 1) + ) (return (f32.div (tee_local $0 @@ -802,13 +804,19 @@ (get_local $0) ) ) + (func $~lib/builtins/isNaN (; 7 ;) (type $fi) (param $0 f32) (result i32) + (f32.ne + (get_local $0) + (get_local $0) + ) + ) (func $std/mod/check (; 8 ;) (type $ffi) (param $0 f32) (param $1 f32) (result i32) (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) (return - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) diff --git a/tests/compiler/std/mod.untouched.wat b/tests/compiler/std/mod.untouched.wat index 0c6e03c3..432214b0 100644 --- a/tests/compiler/std/mod.untouched.wat +++ b/tests/compiler/std/mod.untouched.wat @@ -1,13 +1,13 @@ (module (type $FFFi (func (param f64 f64 f64) (result i32))) (type $FFF (func (param f64 f64) (result f64))) - (type $Fi (func (param f64) (result i32))) (type $FFi (func (param f64 f64) (result i32))) + (type $Fi (func (param f64) (result i32))) (type $iiiiv (func (param i32 i32 i32 i32))) (type $fffi (func (param f32 f32 f32) (result i32))) (type $fff (func (param f32 f32) (result f32))) - (type $fi (func (param f32) (result i32))) (type $ffi (func (param f32 f32) (result i32))) + (type $fi (func (param f32) (result i32))) (type $v (func)) (import "JSOp" "mod" (func $std/mod/JSOp.mod (param f64 f64) (result f64))) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) @@ -19,13 +19,7 @@ (data (i32.const 8) "\n\00\00\00s\00t\00d\00/\00m\00o\00d\00.\00t\00s\00") (export "memory" (memory $0)) (start $start) - (func $isNaN (; 2 ;) (type $Fi) (param $0 f64) (result i32) - (f64.ne - (get_local $0) - (get_local $0) - ) - ) - (func $~lib/math/NativeMath.mod (; 3 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.mod (; 2 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i64) (local $4 i32) @@ -74,29 +68,38 @@ ) ) (if - (if (result i32) - (tee_local $7 - (if (result i32) + (i32.and + (if (result i32) + (i32.and (tee_local $7 - (i64.eq - (i64.shl - (get_local $3) - (i64.const 1) + (if (result i32) + (tee_local $7 + (i64.eq + (i64.shl + (get_local $3) + (i64.const 1) + ) + (i64.const 0) + ) + ) + (get_local $7) + (block $~lib/builtins/isNaN|inlined.1 (result i32) + (f64.ne + (get_local $1) + (get_local $1) + ) ) - (i64.const 0) ) ) - (get_local $7) - (call $isNaN - (get_local $1) - ) + (i32.const 1) + ) + (get_local $7) + (i32.eq + (get_local $4) + (i32.const 2047) ) ) - (get_local $7) - (i32.eq - (get_local $4) - (i32.const 2047) - ) + (i32.const 1) ) (return (f64.div @@ -465,13 +468,19 @@ (get_local $2) ) ) + (func $~lib/builtins/isNaN (; 3 ;) (type $Fi) (param $0 f64) (result i32) + (f64.ne + (get_local $0) + (get_local $0) + ) + ) (func $std/mod/check (; 4 ;) (type $FFi) (param $0 f64) (param $1 f64) (result i32) (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) (return - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) @@ -516,7 +525,7 @@ (if (result i32) (tee_local $3 (i32.eqz - (i32.const 1) + (get_global $std/mod/js) ) ) (get_local $3) @@ -531,13 +540,7 @@ (get_local $3) ) ) - (func $isNaN (; 6 ;) (type $fi) (param $0 f32) (result i32) - (f32.ne - (get_local $0) - (get_local $0) - ) - ) - (func $~lib/math/NativeMathf.mod (; 7 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.mod (; 6 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -580,29 +583,38 @@ ) ) (if - (if (result i32) - (tee_local $7 - (if (result i32) + (i32.and + (if (result i32) + (i32.and (tee_local $7 - (i32.eq - (i32.shl - (get_local $3) - (i32.const 1) + (if (result i32) + (tee_local $7 + (i32.eq + (i32.shl + (get_local $3) + (i32.const 1) + ) + (i32.const 0) + ) + ) + (get_local $7) + (block $~lib/builtins/isNaN|inlined.1 (result i32) + (f32.ne + (get_local $1) + (get_local $1) + ) ) - (i32.const 0) ) ) - (get_local $7) - (call $isNaN - (get_local $1) - ) + (i32.const 1) + ) + (get_local $7) + (i32.eq + (get_local $4) + (i32.const 255) ) ) - (get_local $7) - (i32.eq - (get_local $4) - (i32.const 255) - ) + (i32.const 1) ) (return (f32.div @@ -958,13 +970,19 @@ (get_local $2) ) ) + (func $~lib/builtins/isNaN (; 7 ;) (type $fi) (param $0 f32) (result i32) + (f32.ne + (get_local $0) + (get_local $0) + ) + ) (func $std/mod/check (; 8 ;) (type $ffi) (param $0 f32) (param $1 f32) (result i32) (if - (call $isNaN + (call $~lib/builtins/isNaN (get_local $1) ) (return - (call $isNaN + (call $~lib/builtins/isNaN (get_local $0) ) ) diff --git a/tests/compiler/std/new.optimized.wat b/tests/compiler/std/new.optimized.wat index 7e37c663..748c7cce 100644 --- a/tests/compiler/std/new.optimized.wat +++ b/tests/compiler/std/new.optimized.wat @@ -5,11 +5,10 @@ (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/allocator/arena/__memory_allocate (; 0 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -95,7 +94,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 (; 1 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $std/new/AClass#constructor (; 2 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (if (i32.eqz @@ -106,7 +110,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -133,15 +137,9 @@ ) (get_local $0) ) - (func $start (; 2 ;) (type $v) + (func $start (; 3 ;) (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..5ea02d13 100644 --- a/tests/compiler/std/new.untouched.wat +++ b/tests/compiler/std/new.untouched.wat @@ -13,7 +13,7 @@ (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/allocator/arena/__memory_allocate (; 0 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -26,7 +26,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -40,10 +40,10 @@ (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) ) ) @@ -121,7 +121,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 (; 1 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $std/new/AClass#constructor (; 2 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (i32.store (get_local $0) @@ -134,7 +141,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 +168,15 @@ ) (get_local $0) ) - (func $start (; 2 ;) (type $v) + (func $start (; 3 ;) (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..fef8a1bb 100644 --- a/tests/compiler/std/operator-overloading.optimized.wat +++ b/tests/compiler/std/operator-overloading.optimized.wat @@ -74,12 +74,11 @@ (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/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -165,7 +164,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 (; 2 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $std/operator-overloading/Tester#constructor (; 3 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (if (i32.eqz (get_local $0) @@ -173,7 +177,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 8) ) ) @@ -187,7 +191,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 (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.add @@ -208,7 +212,7 @@ ) ) ) - (func $std/operator-overloading/Tester.sub (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.sub (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.sub @@ -229,7 +233,7 @@ ) ) ) - (func $std/operator-overloading/Tester.mul (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.mul (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.mul @@ -250,7 +254,7 @@ ) ) ) - (func $std/operator-overloading/Tester.div (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.div (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.div_s @@ -271,7 +275,7 @@ ) ) ) - (func $std/operator-overloading/Tester.mod (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.mod (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.rem_s @@ -292,7 +296,7 @@ ) ) ) - (func $~lib/math/NativeMath.scalbn (; 8 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) + (func $~lib/math/NativeMath.scalbn (; 9 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) (local $2 f64) (set_local $2 (get_local $0) @@ -406,7 +410,7 @@ ) ) ) - (func $~lib/math/NativeMath.pow (; 9 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.pow (; 10 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 f64) (local $3 f64) (local $4 i32) @@ -1833,7 +1837,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 (; 11 ;) (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 +1870,7 @@ ) ) ) - (func $std/operator-overloading/Tester.and (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.and (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.and @@ -1887,7 +1891,7 @@ ) ) ) - (func $std/operator-overloading/Tester.or (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.or (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.or @@ -1908,7 +1912,7 @@ ) ) ) - (func $std/operator-overloading/Tester.xor (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.xor (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.xor @@ -1929,7 +1933,7 @@ ) ) ) - (func $std/operator-overloading/Tester.equals (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.equals (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -1955,7 +1959,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 (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -1981,7 +1985,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 (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -2007,7 +2011,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 (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -2033,7 +2037,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 (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -2059,7 +2063,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 (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -2085,7 +2089,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 (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.shr_s @@ -2102,7 +2106,7 @@ ) ) ) - (func $std/operator-overloading/Tester.shu (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.shu (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.shr_u @@ -2119,7 +2123,7 @@ ) ) ) - (func $std/operator-overloading/Tester.shl (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.shl (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.shl @@ -2136,7 +2140,7 @@ ) ) ) - (func $std/operator-overloading/Tester.pos (; 23 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.pos (; 24 ;) (type $ii) (param $0 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.load @@ -2147,7 +2151,7 @@ ) ) ) - (func $std/operator-overloading/Tester.neg (; 24 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.neg (; 25 ;) (type $ii) (param $0 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.sub @@ -2164,7 +2168,7 @@ ) ) ) - (func $std/operator-overloading/Tester.not (; 25 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.not (; 26 ;) (type $ii) (param $0 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.xor @@ -2181,7 +2185,7 @@ ) ) ) - (func $std/operator-overloading/Tester.excl (; 26 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.excl (; 27 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (tee_local $1 @@ -2201,7 +2205,7 @@ ) (get_local $1) ) - (func $std/operator-overloading/Tester#inc (; 27 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester#inc (; 28 ;) (type $ii) (param $0 i32) (result i32) (i32.store (get_local $0) (i32.add @@ -2222,7 +2226,7 @@ ) (get_local $0) ) - (func $std/operator-overloading/Tester#dec (; 28 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester#dec (; 29 ;) (type $ii) (param $0 i32) (result i32) (i32.store (get_local $0) (i32.sub @@ -2243,17 +2247,11 @@ ) (get_local $0) ) - (func $start (; 29 ;) (type $v) + (func $start (; 30 ;) (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..0a5e2551 100644 --- a/tests/compiler/std/operator-overloading.untouched.wat +++ b/tests/compiler/std/operator-overloading.untouched.wat @@ -47,6 +47,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 $~lib/builtins/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 +85,7 @@ (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/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -97,7 +98,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -111,10 +112,10 @@ (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) ) ) @@ -192,7 +193,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 (; 2 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $std/operator-overloading/Tester#constructor (; 3 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (tee_local $0 (if (result i32) @@ -201,7 +209,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 +227,7 @@ ) ) ) - (func $std/operator-overloading/Tester.add (; 3 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.add (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.add @@ -240,7 +248,7 @@ ) ) ) - (func $std/operator-overloading/Tester.sub (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.sub (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.sub @@ -261,7 +269,7 @@ ) ) ) - (func $std/operator-overloading/Tester.mul (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.mul (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.mul @@ -282,7 +290,7 @@ ) ) ) - (func $std/operator-overloading/Tester.div (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.div (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.div_s @@ -303,7 +311,7 @@ ) ) ) - (func $std/operator-overloading/Tester.mod (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.mod (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.rem_s @@ -324,7 +332,7 @@ ) ) ) - (func $~lib/math/NativeMath.scalbn (; 8 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) + (func $~lib/math/NativeMath.scalbn (; 9 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) (local $2 f64) (set_local $2 (get_local $0) @@ -442,7 +450,7 @@ ) ) ) - (func $~lib/math/NativeMath.pow (; 9 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.pow (; 10 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i32) (local $4 i32) @@ -2000,7 +2008,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 (; 11 ;) (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 +2041,7 @@ ) ) ) - (func $std/operator-overloading/Tester.and (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.and (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.and @@ -2054,7 +2062,7 @@ ) ) ) - (func $std/operator-overloading/Tester.or (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.or (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.or @@ -2075,7 +2083,7 @@ ) ) ) - (func $std/operator-overloading/Tester.xor (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.xor (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.xor @@ -2096,7 +2104,7 @@ ) ) ) - (func $std/operator-overloading/Tester.equals (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.equals (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (result i32) (tee_local $2 @@ -2120,7 +2128,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 (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (result i32) (tee_local $2 @@ -2144,7 +2152,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 (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (result i32) (tee_local $2 @@ -2168,7 +2176,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 (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (result i32) (tee_local $2 @@ -2192,7 +2200,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 (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (result i32) (tee_local $2 @@ -2216,7 +2224,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 (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (result i32) (tee_local $2 @@ -2240,7 +2248,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 (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.shr_s @@ -2257,7 +2265,7 @@ ) ) ) - (func $std/operator-overloading/Tester.shu (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.shu (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.shr_u @@ -2274,7 +2282,7 @@ ) ) ) - (func $std/operator-overloading/Tester.shl (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.shl (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.shl @@ -2291,7 +2299,7 @@ ) ) ) - (func $std/operator-overloading/Tester.pos (; 23 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.pos (; 24 ;) (type $ii) (param $0 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.load @@ -2302,7 +2310,7 @@ ) ) ) - (func $std/operator-overloading/Tester.neg (; 24 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.neg (; 25 ;) (type $ii) (param $0 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.sub @@ -2319,7 +2327,7 @@ ) ) ) - (func $std/operator-overloading/Tester.not (; 25 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.not (; 26 ;) (type $ii) (param $0 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.xor @@ -2336,7 +2344,7 @@ ) ) ) - (func $std/operator-overloading/Tester.excl (; 26 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.excl (; 27 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (result i32) (tee_local $1 @@ -2354,7 +2362,7 @@ (get_local $1) ) ) - (func $std/operator-overloading/Tester#inc (; 27 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester#inc (; 28 ;) (type $ii) (param $0 i32) (result i32) (i32.store (get_local $0) (i32.add @@ -2375,7 +2383,7 @@ ) (get_local $0) ) - (func $std/operator-overloading/Tester#dec (; 28 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester#dec (; 29 ;) (type $ii) (param $0 i32) (result i32) (i32.store (get_local $0) (i32.sub @@ -2396,7 +2404,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 (; 30 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (tee_local $0 (if (result i32) @@ -2405,7 +2413,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 +2431,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 (; 31 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (tee_local $0 (if (result i32) @@ -2432,7 +2440,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 +2458,17 @@ ) ) ) - (func $start (; 31 ;) (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) + (get_global $~lib/internal/allocator/AL_MASK) ) (i32.xor - (i32.const 7) + (get_global $~lib/internal/allocator/AL_MASK) (i32.const -1) ) ) @@ -3042,7 +3050,7 @@ (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.const 2) - (i32.const 2147483647) + (get_global $~lib/builtins/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..8516d51a 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -22,14 +22,13 @@ (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/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -115,7 +114,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/computeSize (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -129,7 +133,7 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -148,7 +152,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 +162,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 (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -488,7 +492,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 (; 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/arraybuffer/ArrayBuffer#constructor (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u @@ -517,7 +528,7 @@ (i32.const 1) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) (i32.const 8) @@ -528,7 +539,7 @@ ) (get_local $3) ) - (func $~lib/set/Set#clear (; 6 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 8 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -562,7 +573,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -570,7 +581,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -603,7 +614,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash8 (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash8 (; 10 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (get_local $0) @@ -612,7 +623,7 @@ (i32.const 16777619) ) ) - (func $~lib/internal/hash/hash (; 9 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 11 ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/hash/hash8 (i32.shr_s (i32.shl @@ -623,7 +634,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 (; 12 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -689,7 +700,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 (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -701,7 +712,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 12 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 14 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -858,7 +869,7 @@ ) ) ) - (func $~lib/set/Set#add (; 13 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 15 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -987,12 +998,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 16 ;) (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 (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -1093,7 +1104,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 16 ;) (type $v) + (func $std/set/test (; 18 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -1437,7 +1448,7 @@ ) ) ) - (func $~lib/internal/hash/hash (; 17 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 19 ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/hash/hash8 (i32.and (get_local $0) @@ -1445,7 +1456,7 @@ ) ) ) - (func $~lib/set/Set#has (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -1457,7 +1468,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 19 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 21 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1614,7 +1625,7 @@ ) ) ) - (func $~lib/set/Set#add (; 20 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 22 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1743,7 +1754,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -1841,7 +1852,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 22 ;) (type $v) + (func $std/set/test (; 24 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -2185,7 +2196,7 @@ ) ) ) - (func $~lib/internal/hash/hash16 (; 23 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash16 (; 25 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -2206,7 +2217,7 @@ (i32.const 16777619) ) ) - (func $~lib/internal/hash/hash (; 24 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 26 ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/hash/hash16 (i32.shr_s (i32.shl @@ -2217,7 +2228,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 (; 27 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -2283,7 +2294,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 (; 28 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -2295,7 +2306,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 27 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 29 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2452,7 +2463,7 @@ ) ) ) - (func $~lib/set/Set#add (; 28 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 30 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2581,7 +2592,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 31 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -2682,7 +2693,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 30 ;) (type $v) + (func $std/set/test (; 32 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -3026,7 +3037,7 @@ ) ) ) - (func $~lib/internal/hash/hash (; 31 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 33 ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/hash/hash16 (i32.and (get_local $0) @@ -3034,7 +3045,7 @@ ) ) ) - (func $~lib/set/Set#has (; 32 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 34 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -3046,7 +3057,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 33 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 35 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3203,7 +3214,7 @@ ) ) ) - (func $~lib/set/Set#add (; 34 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 36 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3332,7 +3343,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 35 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 37 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -3430,7 +3441,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 36 ;) (type $v) + (func $std/set/test (; 38 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -3774,7 +3785,7 @@ ) ) ) - (func $~lib/internal/hash/hash32 (; 37 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 39 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -3819,12 +3830,12 @@ (i32.const 16777619) ) ) - (func $~lib/internal/hash/hash (; 38 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 40 ;) (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 (; 41 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -3887,7 +3898,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 (; 42 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -3899,7 +3910,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 41 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 43 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4056,7 +4067,7 @@ ) ) ) - (func $~lib/set/Set#add (; 42 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 44 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4185,7 +4196,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 43 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 45 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -4280,7 +4291,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 44 ;) (type $v) + (func $std/set/test (; 46 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -4624,7 +4635,7 @@ ) ) ) - (func $std/set/test (; 45 ;) (type $v) + (func $std/set/test (; 47 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -4968,7 +4979,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 46 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 48 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -5002,7 +5013,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 47 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 49 ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -5010,7 +5021,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -5043,7 +5054,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash64 (; 48 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash64 (; 50 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (i32.mul (i32.xor @@ -5142,12 +5153,12 @@ (i32.const 16777619) ) ) - (func $~lib/internal/hash/hash (; 49 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash (; 51 ;) (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 (; 52 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -5210,7 +5221,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 (; 53 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -5222,7 +5233,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 52 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 54 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5379,7 +5390,7 @@ ) ) ) - (func $~lib/set/Set#add (; 53 ;) (type $iIv) (param $0 i32) (param $1 i64) + (func $~lib/set/Set#add (; 55 ;) (type $iIv) (param $0 i32) (param $1 i64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5508,7 +5519,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 54 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#delete (; 56 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (if @@ -5604,7 +5615,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 55 ;) (type $v) + (func $std/set/test (; 57 ;) (type $v) (local $0 i64) (local $1 i32) (set_local $1 @@ -5948,7 +5959,7 @@ ) ) ) - (func $std/set/test (; 56 ;) (type $v) + (func $std/set/test (; 58 ;) (type $v) (local $0 i64) (local $1 i32) (set_local $1 @@ -6292,14 +6303,14 @@ ) ) ) - (func $~lib/internal/hash/hash (; 57 ;) (type $fi) (param $0 f32) (result i32) + (func $~lib/internal/hash/hash (; 59 ;) (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 (; 60 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -6362,7 +6373,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 (; 61 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -6374,7 +6385,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 60 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 62 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6533,7 +6544,7 @@ ) ) ) - (func $~lib/set/Set#add (; 61 ;) (type $ifv) (param $0 i32) (param $1 f32) + (func $~lib/set/Set#add (; 63 ;) (type $ifv) (param $0 i32) (param $1 f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6662,7 +6673,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 62 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/set/Set#delete (; 64 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (local $3 i32) (if @@ -6760,7 +6771,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 63 ;) (type $v) + (func $std/set/test (; 65 ;) (type $v) (local $0 f32) (local $1 i32) (set_local $1 @@ -7112,14 +7123,14 @@ ) ) ) - (func $~lib/internal/hash/hash (; 64 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/internal/hash/hash (; 66 ;) (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 (; 67 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -7182,7 +7193,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 (; 68 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -7194,7 +7205,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 67 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 69 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7353,7 +7364,7 @@ ) ) ) - (func $~lib/set/Set#add (; 68 ;) (type $iFv) (param $0 i32) (param $1 f64) + (func $~lib/set/Set#add (; 70 ;) (type $iFv) (param $0 i32) (param $1 f64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7482,7 +7493,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 69 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/set/Set#delete (; 71 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 i32) (if @@ -7580,7 +7591,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 70 ;) (type $v) + (func $std/set/test (; 72 ;) (type $v) (local $0 f64) (local $1 i32) (set_local $1 @@ -7932,15 +7943,9 @@ ) ) ) - (func $start (; 71 ;) (type $v) + (func $start (; 73 ;) (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..c9fa1d85 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -42,7 +42,7 @@ (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/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -55,7 +55,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -69,10 +69,10 @@ (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) ) ) @@ -150,7 +150,14 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/computeSize (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -159,7 +166,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -167,13 +174,13 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (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 +194,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 +206,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 (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -551,12 +558,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 (; 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/arraybuffer/ArrayBuffer#constructor (; 7 ;) (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 +594,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 +605,7 @@ ) (get_local $3) ) - (func $~lib/set/Set#clear (; 6 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 8 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -603,7 +617,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -617,7 +631,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 +642,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -638,7 +652,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 +688,16 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash8 (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash8 (; 10 ;) (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 (; 11 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash8 (i32.shr_s @@ -696,7 +710,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 (; 12 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -712,7 +726,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -731,7 +745,7 @@ (i32.load offset=4 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -759,7 +773,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -772,7 +786,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 (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -784,7 +798,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 12 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 14 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -807,7 +821,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -818,7 +832,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -839,7 +853,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -858,7 +872,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -879,7 +893,7 @@ (i32.load offset=4 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -914,7 +928,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -975,7 +989,7 @@ ) ) ) - (func $~lib/set/Set#add (; 13 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 15 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1020,7 +1034,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -1048,7 +1062,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 +1111,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -1114,12 +1128,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 16 ;) (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 (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1157,7 +1171,7 @@ (i32.load offset=4 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -1187,7 +1201,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -1212,7 +1226,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -1225,7 +1239,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 16 ;) (type $v) + (func $std/set/test (; 18 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -1613,7 +1627,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 17 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 19 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -1625,7 +1639,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -1639,7 +1653,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 +1664,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 18 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 20 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -1660,7 +1674,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 +1710,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 19 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 21 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash8 (i32.and @@ -1706,7 +1720,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 (; 22 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -1722,7 +1736,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -1741,7 +1755,7 @@ (i32.load offset=4 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -1766,7 +1780,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -1779,7 +1793,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 (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -1791,7 +1805,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 22 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 24 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1814,7 +1828,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -1825,7 +1839,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -1846,7 +1860,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -1865,7 +1879,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -1886,7 +1900,7 @@ (i32.load offset=4 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -1921,7 +1935,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -1982,7 +1996,7 @@ ) ) ) - (func $~lib/set/Set#add (; 23 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 25 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2027,7 +2041,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -2055,7 +2069,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 +2118,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -2121,12 +2135,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 24 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 26 ;) (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 (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2161,7 +2175,7 @@ (i32.load offset=4 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -2191,7 +2205,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -2216,7 +2230,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -2229,7 +2243,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 26 ;) (type $v) + (func $std/set/test (; 28 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -2617,7 +2631,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 27 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 29 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -2629,7 +2643,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -2643,7 +2657,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 +2668,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 28 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 30 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -2664,7 +2678,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 +2714,10 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash16 (; 29 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash16 (; 31 ;) (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 +2728,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -2726,12 +2740,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 (; 32 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash16 (i32.shr_s @@ -2744,7 +2758,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 (; 33 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -2760,7 +2774,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -2779,7 +2793,7 @@ (i32.load offset=4 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -2807,7 +2821,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -2820,7 +2834,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 (; 34 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -2832,7 +2846,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 33 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 35 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2855,7 +2869,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -2866,7 +2880,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -2887,7 +2901,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -2906,7 +2920,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -2927,7 +2941,7 @@ (i32.load offset=4 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -2962,7 +2976,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -3023,7 +3037,7 @@ ) ) ) - (func $~lib/set/Set#add (; 34 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 36 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3068,7 +3082,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -3096,7 +3110,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 +3159,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -3162,12 +3176,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 35 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 37 ;) (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 (; 38 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3205,7 +3219,7 @@ (i32.load offset=4 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -3235,7 +3249,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -3260,7 +3274,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -3273,7 +3287,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 37 ;) (type $v) + (func $std/set/test (; 39 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -3661,7 +3675,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 38 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 40 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -3673,7 +3687,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -3687,7 +3701,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 +3712,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 39 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 41 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -3708,7 +3722,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 +3758,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 40 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 42 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash16 (i32.and @@ -3754,7 +3768,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 (; 43 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -3770,7 +3784,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -3789,7 +3803,7 @@ (i32.load offset=4 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -3814,7 +3828,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -3827,7 +3841,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 (; 44 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -3839,7 +3853,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 43 ;) (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) @@ -3862,7 +3876,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -3873,7 +3887,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -3894,7 +3908,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -3913,7 +3927,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -3934,7 +3948,7 @@ (i32.load offset=4 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -3969,7 +3983,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -4030,7 +4044,7 @@ ) ) ) - (func $~lib/set/Set#add (; 44 ;) (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) @@ -4075,7 +4089,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -4103,7 +4117,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 +4166,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -4169,12 +4183,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 45 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 47 ;) (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 (; 48 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4209,7 +4223,7 @@ (i32.load offset=4 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -4239,7 +4253,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -4264,7 +4278,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -4277,7 +4291,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 47 ;) (type $v) + (func $std/set/test (; 49 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -4665,7 +4679,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 48 ;) (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 @@ -4677,7 +4691,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -4691,7 +4705,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 +4716,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 49 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 51 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -4712,7 +4726,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 +4762,10 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash32 (; 50 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 52 ;) (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 +4776,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -4777,7 +4791,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -4792,7 +4806,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -4804,19 +4818,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 (; 53 ;) (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 (; 54 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -4832,7 +4846,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -4851,7 +4865,7 @@ (i32.load offset=4 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -4873,7 +4887,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -4886,7 +4900,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 (; 55 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -4898,7 +4912,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 54 ;) (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) @@ -4921,7 +4935,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -4932,7 +4946,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -4953,7 +4967,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -4972,7 +4986,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -4993,7 +5007,7 @@ (i32.load offset=4 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -5028,7 +5042,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -5089,7 +5103,7 @@ ) ) ) - (func $~lib/set/Set#add (; 55 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 57 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5134,7 +5148,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -5162,7 +5176,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 +5225,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -5228,12 +5242,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 56 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 58 ;) (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 (; 59 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5265,7 +5279,7 @@ (i32.load offset=4 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -5295,7 +5309,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -5320,7 +5334,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -5333,7 +5347,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 58 ;) (type $v) + (func $std/set/test (; 60 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -5721,7 +5735,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 59 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 61 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -5733,7 +5747,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -5747,7 +5761,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 +5772,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 60 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 62 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -5768,7 +5782,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 +5818,14 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 61 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 63 ;) (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 (; 64 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -5827,7 +5841,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -5846,7 +5860,7 @@ (i32.load offset=4 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -5868,7 +5882,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -5881,7 +5895,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 (; 65 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -5893,7 +5907,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 64 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 66 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5916,7 +5930,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -5927,7 +5941,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -5948,7 +5962,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -5967,7 +5981,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -5988,7 +6002,7 @@ (i32.load offset=4 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -6023,7 +6037,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -6084,7 +6098,7 @@ ) ) ) - (func $~lib/set/Set#add (; 65 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 67 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6129,7 +6143,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -6157,7 +6171,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 +6220,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -6223,12 +6237,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 66 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 68 ;) (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 (; 69 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6260,7 +6274,7 @@ (i32.load offset=4 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -6290,7 +6304,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -6315,7 +6329,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -6328,7 +6342,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 68 ;) (type $v) + (func $std/set/test (; 70 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -6716,7 +6730,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 69 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 71 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -6728,7 +6742,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -6742,7 +6756,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 +6767,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 70 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 72 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -6763,7 +6777,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 +6813,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash64 (; 71 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash64 (; 73 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -6817,7 +6831,7 @@ ) ) (set_local $3 - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) ) (set_local $3 (i32.mul @@ -6828,7 +6842,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -6843,7 +6857,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -6858,7 +6872,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -6870,7 +6884,7 @@ (i32.const 24) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -6882,7 +6896,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -6897,7 +6911,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -6912,7 +6926,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $3 @@ -6924,19 +6938,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 (; 74 ;) (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 (; 75 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -6952,7 +6966,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -6971,7 +6985,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -6993,7 +7007,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -7006,7 +7020,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 (; 76 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -7018,7 +7032,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 75 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 77 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7042,7 +7056,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -7053,7 +7067,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -7074,7 +7088,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -7093,7 +7107,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -7114,7 +7128,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -7149,7 +7163,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -7210,7 +7224,7 @@ ) ) ) - (func $~lib/set/Set#add (; 76 ;) (type $iIv) (param $0 i32) (param $1 i64) + (func $~lib/set/Set#add (; 78 ;) (type $iIv) (param $0 i32) (param $1 i64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7255,7 +7269,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -7283,7 +7297,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 +7346,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -7349,12 +7363,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 77 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 79 ;) (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 (; 80 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7386,7 +7400,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -7416,7 +7430,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -7441,7 +7455,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -7454,7 +7468,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 79 ;) (type $v) + (func $std/set/test (; 81 ;) (type $v) (local $0 i32) (local $1 i64) (set_local $0 @@ -7842,7 +7856,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 80 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 82 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -7854,7 +7868,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -7868,7 +7882,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 +7893,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 81 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 83 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -7889,7 +7903,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 +7939,14 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 82 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash (; 84 ;) (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 (; 85 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -7948,7 +7962,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -7967,7 +7981,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -7989,7 +8003,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -8002,7 +8016,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 (; 86 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -8014,7 +8028,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 85 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 87 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8038,7 +8052,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -8049,7 +8063,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -8070,7 +8084,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -8089,7 +8103,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -8110,7 +8124,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -8145,7 +8159,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -8206,7 +8220,7 @@ ) ) ) - (func $~lib/set/Set#add (; 86 ;) (type $iIv) (param $0 i32) (param $1 i64) + (func $~lib/set/Set#add (; 88 ;) (type $iIv) (param $0 i32) (param $1 i64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8251,7 +8265,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -8279,7 +8293,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 +8342,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -8345,12 +8359,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 87 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 89 ;) (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 (; 90 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8382,7 +8396,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -8412,7 +8426,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -8437,7 +8451,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -8450,7 +8464,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 89 ;) (type $v) + (func $std/set/test (; 91 ;) (type $v) (local $0 i32) (local $1 i64) (set_local $0 @@ -8838,7 +8852,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 90 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 92 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -8850,7 +8864,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -8864,7 +8878,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 +8889,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 91 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 93 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -8885,7 +8899,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 +8935,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 92 ;) (type $fi) (param $0 f32) (result i32) + (func $~lib/internal/hash/hash (; 94 ;) (type $fi) (param $0 f32) (result i32) (return (call $~lib/internal/hash/hash32 (i32.reinterpret/f32 @@ -8930,7 +8944,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 (; 95 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -8946,7 +8960,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -8965,7 +8979,7 @@ (i32.load offset=4 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -8987,7 +9001,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -9000,7 +9014,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 (; 96 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -9012,7 +9026,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 95 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 97 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9036,7 +9050,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -9047,7 +9061,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -9068,7 +9082,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -9087,7 +9101,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -9108,7 +9122,7 @@ (i32.load offset=4 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -9145,7 +9159,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -9206,7 +9220,7 @@ ) ) ) - (func $~lib/set/Set#add (; 96 ;) (type $ifv) (param $0 i32) (param $1 f32) + (func $~lib/set/Set#add (; 98 ;) (type $ifv) (param $0 i32) (param $1 f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9251,7 +9265,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -9279,7 +9293,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 +9342,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -9345,12 +9359,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 97 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 99 ;) (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 (; 100 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9384,7 +9398,7 @@ (i32.load offset=4 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -9414,7 +9428,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -9439,7 +9453,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -9452,7 +9466,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 99 ;) (type $v) + (func $std/set/test (; 101 ;) (type $v) (local $0 i32) (local $1 f32) (set_local $0 @@ -9840,7 +9854,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 100 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 102 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -9852,7 +9866,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -9866,7 +9880,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 +9891,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 101 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 103 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -9887,7 +9901,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 +9937,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 102 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/internal/hash/hash (; 104 ;) (type $Fi) (param $0 f64) (result i32) (return (call $~lib/internal/hash/hash64 (i64.reinterpret/f64 @@ -9932,7 +9946,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 (; 105 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -9948,7 +9962,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -9967,7 +9981,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) ) @@ -9989,7 +10003,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/set/EMPTY) (i32.const -1) ) ) @@ -10002,7 +10016,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 (; 106 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -10014,7 +10028,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 105 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 107 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10038,7 +10052,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) (i32.const 0) ) @@ -10049,7 +10063,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/set/FILL_FACTOR) ) ) ) @@ -10070,7 +10084,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -10089,7 +10103,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -10110,7 +10124,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (block @@ -10147,7 +10161,7 @@ (get_local $3) (i32.mul (get_local $12) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -10208,7 +10222,7 @@ ) ) ) - (func $~lib/set/Set#add (; 106 ;) (type $iFv) (param $0 i32) (param $1 f64) + (func $~lib/set/Set#add (; 108 ;) (type $iFv) (param $0 i32) (param $1 f64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10253,7 +10267,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -10281,7 +10295,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 +10344,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/set/BUCKET_SIZE) ) ) ) @@ -10347,12 +10361,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 107 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 109 ;) (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 (; 110 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10386,7 +10400,7 @@ (i32.load offset=8 (get_local $2) ) - (i32.const 1) + (get_global $~lib/set/EMPTY) ) ) (i32.store offset=20 @@ -10416,7 +10430,7 @@ ) (select (tee_local $4 - (i32.const 4) + (get_global $~lib/set/INITIAL_CAPACITY) ) (tee_local $5 (i32.load offset=20 @@ -10441,7 +10455,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/set/FREE_FACTOR) ) ) ) @@ -10454,7 +10468,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 109 ;) (type $v) + (func $std/set/test (; 111 ;) (type $v) (local $0 i32) (local $1 f64) (set_local $0 @@ -10842,15 +10856,15 @@ ) ) ) - (func $start (; 110 ;) (type $v) + (func $start (; 112 ;) (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..2ed2947e 100644 --- a/tests/compiler/std/static-array.optimized.wat +++ b/tests/compiler/std/static-array.optimized.wat @@ -13,7 +13,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 +73,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 +403,14 @@ ) ) ) - (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/allocator/arena/__memory_allocate (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -490,7 +496,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 6 ;) (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 @@ -509,7 +520,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 +530,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 (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1905,7 +1916,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -1940,7 +1951,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 +2208,16 @@ ) ) ) - (func $~lib/internal/arraybuffer/reallocUnsafe (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.copy (; 11 ;) (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 (; 12 ;) (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 +2258,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 +2274,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 +2289,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 +2339,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 (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -2388,7 +2406,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 (; 14 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64) (if (result i64) (i32.lt_u (get_local $1) @@ -2415,7 +2433,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 12 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64) + (func $~lib/array/Array#__set (; 15 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (local $4 i32) (if @@ -2482,7 +2500,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 (; 16 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) (if (result f32) (i32.lt_u (get_local $1) @@ -2509,7 +2527,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 14 ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32) + (func $~lib/array/Array#__set (; 17 ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32) (local $3 i32) (local $4 i32) (if @@ -2576,7 +2594,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 (; 18 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (if (result f64) (i32.lt_u (get_local $1) @@ -2603,7 +2621,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 16 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64) + (func $~lib/array/Array#__set (; 19 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (local $4 i32) (if @@ -2670,15 +2688,9 @@ (get_local $2) ) ) - (func $start (; 17 ;) (type $v) + (func $start (; 20 ;) (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..70dd5c69 100644 --- a/tests/compiler/std/static-array.untouched.wat +++ b/tests/compiler/std/static-array.untouched.wat @@ -79,7 +79,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -87,7 +87,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 +439,14 @@ ) ) ) - (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/allocator/arena/__memory_allocate (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -452,7 +459,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -466,10 +473,10 @@ (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) ) ) @@ -547,13 +554,20 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 6 ;) (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 @@ -567,7 +581,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 +593,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 (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2381,7 +2395,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.eq @@ -2411,7 +2425,7 @@ ) ) (block - (call $~lib/memory/copy_memory + (call $~lib/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2699,7 +2713,14 @@ ) ) ) - (func $~lib/internal/arraybuffer/reallocUnsafe (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.copy (; 11 ;) (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 (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (set_local $2 @@ -2717,7 +2738,7 @@ (i32.eqz (i32.le_s (get_local $1) - (i32.const 1073741816) + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) ) ) (block @@ -2737,7 +2758,7 @@ (call $~lib/internal/arraybuffer/computeSize (get_local $2) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block @@ -2745,11 +2766,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 +2787,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 +2850,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 (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -2904,12 +2925,12 @@ ) ) ) - (func $~lib/array/Array#get:length (; 11 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 14 ;) (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 (; 15 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64) (local $2 i32) (set_local $2 (i32.load @@ -2940,7 +2961,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 13 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64) + (func $~lib/array/Array#__set (; 16 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (local $4 i32) (set_local $3 @@ -3015,12 +3036,12 @@ ) ) ) - (func $~lib/array/Array#get:length (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 17 ;) (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 (; 18 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) (set_local $2 (i32.load @@ -3051,7 +3072,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 16 ;) (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) (set_local $3 @@ -3126,12 +3147,12 @@ ) ) ) - (func $~lib/array/Array#get:length (; 17 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 20 ;) (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 (; 21 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.load @@ -3162,7 +3183,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 19 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64) + (func $~lib/array/Array#__set (; 22 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (local $4 i32) (set_local $3 @@ -3237,15 +3258,15 @@ ) ) ) - (func $start (; 20 ;) (type $v) + (func $start (; 23 ;) (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 +3278,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 +3297,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 +3317,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 +3334,7 @@ ) ) (call $~lib/array/Array#__set - (i32.const 8) + (get_global $std/static-array/i) (i32.const 0) (i32.const 2) ) @@ -3321,7 +3342,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 +3362,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 +3381,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 +3401,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 +3418,7 @@ ) ) (call $~lib/array/Array#__set - (i32.const 32) + (get_global $std/static-array/I) (i32.const 0) (i64.const 4) ) @@ -3405,7 +3426,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 +3446,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 +3465,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 +3485,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 +3502,7 @@ ) ) (call $~lib/array/Array#__set - (i32.const 72) + (get_global $std/static-array/f) (i32.const 0) (f32.const 2.5) ) @@ -3489,7 +3510,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 +3530,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 +3549,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 +3569,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 +3586,7 @@ ) ) (call $~lib/array/Array#__set - (i32.const 96) + (get_global $std/static-array/F) (i32.const 0) (f64.const 2.25) ) @@ -3573,7 +3594,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..0e94dcfc 100644 --- a/tests/compiler/std/string-utf8.optimized.wat +++ b/tests/compiler/std/string-utf8.optimized.wat @@ -9,7 +9,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 +160,7 @@ ) (get_local $1) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -247,7 +246,12 @@ ) (i32.const 0) ) - (func $~lib/string/String#toUTF8 (; 3 ;) (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 $~lib/string/String#toUTF8 (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -256,7 +260,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 +537,17 @@ ) (get_local $5) ) - (func $~lib/allocator/arena/free_memory (; 4 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 5 ;) (type $iv) (param $0 i32) (nop) ) - (func $start (; 5 ;) (type $v) + (func $~lib/memory/memory.free (; 6 ;) (type $iv) (param $0 i32) + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + ) + (func $start (; 7 ;) (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 +761,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..aff3a817 100644 --- a/tests/compiler/std/string-utf8.untouched.wat +++ b/tests/compiler/std/string-utf8.untouched.wat @@ -177,7 +177,7 @@ ) (get_local $1) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -190,7 +190,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -204,10 +204,10 @@ (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) ) ) @@ -285,7 +285,14 @@ ) (i32.const 0) ) - (func $~lib/string/String#toUTF8 (; 3 ;) (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 $~lib/string/String#toUTF8 (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -294,7 +301,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 +604,24 @@ ) (get_local $1) ) - (func $~lib/allocator/arena/free_memory (; 4 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 5 ;) (type $iv) (param $0 i32) (nop) ) - (func $start (; 5 ;) (type $v) + (func $~lib/memory/memory.free (; 6 ;) (type $iv) (param $0 i32) + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + (return) + ) + (func $start (; 7 ;) (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 +865,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..28c47c49 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,7 @@ (get_local $4) ) ) - (func $~lib/allocator/arena/allocate_memory (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 15 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -1365,7 +1379,12 @@ ) (i32.const 0) ) - (func $~lib/internal/string/allocate (; 15 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 16 ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/internal/string/allocate (; 17 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (tee_local $1 @@ -1397,7 +1416,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 +1430,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 (; 18 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2797,7 +2816,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 17 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 19 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -2832,7 +2851,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 +3108,17 @@ ) ) ) - (func $~lib/string/String#concat (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.copy (; 20 ;) (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 (; 21 ;) (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 +3162,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 +3182,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 +3201,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 (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) @@ -3189,7 +3215,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 (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eq @@ -3236,7 +3262,7 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -3252,7 +3278,7 @@ ) ) ) - (func $~lib/string/String.__ne (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__ne (; 24 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.eqz (call $~lib/string/String.__eq (get_local $0) @@ -3260,7 +3286,7 @@ ) ) ) - (func $~lib/string/String.__gt (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__gt (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -3320,7 +3346,7 @@ ) ) (i32.gt_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -3344,7 +3370,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 (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -3404,7 +3430,7 @@ ) ) (i32.ge_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -3428,7 +3454,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 (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -3488,7 +3514,7 @@ ) ) (i32.lt_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -3512,7 +3538,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 (; 28 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -3572,7 +3598,7 @@ ) ) (i32.le_s - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -3596,7 +3622,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 (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3709,7 +3735,7 @@ (get_local $1) ) ) - (call $~lib/memory/move_memory + (call $~lib/memory/memory.copy (i32.add (i32.add (get_local $4) @@ -3734,7 +3760,7 @@ ) (get_local $4) ) - (func $~lib/internal/itoa/decimalCountU32 (; 27 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/decimalCountU32 (; 30 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $2 @@ -3774,7 +3800,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 (; 31 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -3935,7 +3961,7 @@ ) ) ) - (func $~lib/internal/itoa/itoa32 (; 29 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/itoa32 (; 32 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -3986,7 +4012,7 @@ ) (get_local $2) ) - (func $~lib/internal/itoa/utoa32 (; 30 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/utoa32 (; 33 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -4012,7 +4038,7 @@ ) (get_local $2) ) - (func $~lib/internal/itoa/decimalCountU64 (; 31 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/decimalCountU64 (; 34 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i64) (set_local $2 @@ -4060,7 +4086,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 (; 35 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4206,7 +4232,7 @@ (get_local $2) ) ) - (func $~lib/internal/itoa/utoa64 (; 33 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/utoa64 (; 36 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4256,7 +4282,7 @@ ) (get_local $2) ) - (func $~lib/internal/itoa/itoa64 (; 34 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/itoa64 (; 37 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4334,15 +4360,9 @@ ) (get_local $3) ) - (func $start (; 35 ;) (type $v) + (func $start (; 38 ;) (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) @@ -4356,7 +4376,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 13) + (i32.const 11) (i32.const 0) ) (unreachable) @@ -4373,7 +4393,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 15) + (i32.const 13) (i32.const 0) ) (unreachable) @@ -4391,7 +4411,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 16) + (i32.const 14) (i32.const 0) ) (unreachable) @@ -4409,7 +4429,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 17) + (i32.const 15) (i32.const 0) ) (unreachable) @@ -4430,7 +4450,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 18) + (i32.const 16) (i32.const 0) ) (unreachable) @@ -4448,7 +4468,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 19) + (i32.const 17) (i32.const 0) ) (unreachable) @@ -4464,7 +4484,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 21) + (i32.const 19) (i32.const 0) ) (unreachable) @@ -4483,7 +4503,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 22) + (i32.const 20) (i32.const 0) ) (unreachable) @@ -4499,7 +4519,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 23) + (i32.const 21) (i32.const 0) ) (unreachable) @@ -4518,7 +4538,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 24) + (i32.const 22) (i32.const 0) ) (unreachable) @@ -4537,7 +4557,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 25) + (i32.const 23) (i32.const 0) ) (unreachable) @@ -4556,7 +4576,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 26) + (i32.const 24) (i32.const 0) ) (unreachable) @@ -4575,7 +4595,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 27) + (i32.const 25) (i32.const 0) ) (unreachable) @@ -4594,7 +4614,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 28) + (i32.const 26) (i32.const 0) ) (unreachable) @@ -4613,7 +4633,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 30) + (i32.const 28) (i32.const 0) ) (unreachable) @@ -4635,7 +4655,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 31) + (i32.const 29) (i32.const 0) ) (unreachable) @@ -4659,7 +4679,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 32) + (i32.const 30) (i32.const 0) ) (unreachable) @@ -4681,7 +4701,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 33) + (i32.const 31) (i32.const 0) ) (unreachable) @@ -4703,7 +4723,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 34) + (i32.const 32) (i32.const 0) ) (unreachable) @@ -4725,7 +4745,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 35) + (i32.const 33) (i32.const 0) ) (unreachable) @@ -4744,7 +4764,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 36) + (i32.const 34) (i32.const 0) ) (unreachable) @@ -4763,7 +4783,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 37) + (i32.const 35) (i32.const 0) ) (unreachable) @@ -4782,7 +4802,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 38) + (i32.const 36) (i32.const 0) ) (unreachable) @@ -4801,7 +4821,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 39) + (i32.const 37) (i32.const 0) ) (unreachable) @@ -4817,7 +4837,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 40) + (i32.const 38) (i32.const 0) ) (unreachable) @@ -4835,7 +4855,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 46) + (i32.const 44) (i32.const 0) ) (unreachable) @@ -4853,7 +4873,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 47) + (i32.const 45) (i32.const 0) ) (unreachable) @@ -4871,7 +4891,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 48) + (i32.const 46) (i32.const 0) ) (unreachable) @@ -4889,7 +4909,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 49) + (i32.const 47) (i32.const 0) ) (unreachable) @@ -4907,7 +4927,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 50) + (i32.const 48) (i32.const 0) ) (unreachable) @@ -4925,7 +4945,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 51) + (i32.const 49) (i32.const 0) ) (unreachable) @@ -4943,7 +4963,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 52) + (i32.const 50) (i32.const 0) ) (unreachable) @@ -4961,7 +4981,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 53) + (i32.const 51) (i32.const 0) ) (unreachable) @@ -4978,7 +4998,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 55) + (i32.const 53) (i32.const 0) ) (unreachable) @@ -4995,7 +5015,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 56) + (i32.const 54) (i32.const 0) ) (unreachable) @@ -5012,7 +5032,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 57) + (i32.const 55) (i32.const 0) ) (unreachable) @@ -5029,7 +5049,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 58) + (i32.const 56) (i32.const 0) ) (unreachable) @@ -5046,7 +5066,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 59) + (i32.const 57) (i32.const 0) ) (unreachable) @@ -5069,7 +5089,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 62) + (i32.const 60) (i32.const 0) ) (unreachable) @@ -5086,7 +5106,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 63) + (i32.const 61) (i32.const 0) ) (unreachable) @@ -5103,7 +5123,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 64) + (i32.const 62) (i32.const 0) ) (unreachable) @@ -5120,7 +5140,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 65) + (i32.const 63) (i32.const 0) ) (unreachable) @@ -5137,7 +5157,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 67) + (i32.const 65) (i32.const 0) ) (unreachable) @@ -5154,7 +5174,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 68) + (i32.const 66) (i32.const 0) ) (unreachable) @@ -5171,7 +5191,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 69) + (i32.const 67) (i32.const 0) ) (unreachable) @@ -5188,7 +5208,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 70) + (i32.const 68) (i32.const 0) ) (unreachable) @@ -5199,6 +5219,21 @@ (i32.const 428) (i32.const 420) ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 48) + (i32.const 69) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (call $~lib/string/String.__lt + (i32.const 360) + (get_global $std/string/nullStr) + ) (block (call $~lib/env/abort (i32.const 0) @@ -5209,21 +5244,6 @@ (unreachable) ) ) - (if - (call $~lib/string/String.__lt - (i32.const 360) - (get_global $std/string/nullStr) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 48) - (i32.const 73) - (i32.const 0) - ) - (unreachable) - ) - ) (if (call $~lib/string/String.__lt (get_global $std/string/nullStr) @@ -5233,7 +5253,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 74) + (i32.const 72) (i32.const 0) ) (unreachable) @@ -5250,7 +5270,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 76) + (i32.const 74) (i32.const 0) ) (unreachable) @@ -5267,7 +5287,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 77) + (i32.const 75) (i32.const 0) ) (unreachable) @@ -5284,7 +5304,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 78) + (i32.const 76) (i32.const 0) ) (unreachable) @@ -5301,7 +5321,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 79) + (i32.const 77) (i32.const 0) ) (unreachable) @@ -5312,6 +5332,36 @@ (i32.const 444) (i32.const 8) ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 48) + (i32.const 78) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (call $~lib/string/String.__gt + (i32.const 8) + (i32.const 444) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 48) + (i32.const 79) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (call $~lib/string/String.__lt + (i32.const 8) + (i32.const 8) + ) (block (call $~lib/env/abort (i32.const 0) @@ -5325,7 +5375,7 @@ (if (call $~lib/string/String.__gt (i32.const 8) - (i32.const 444) + (i32.const 8) ) (block (call $~lib/env/abort @@ -5337,36 +5387,6 @@ (unreachable) ) ) - (if - (call $~lib/string/String.__lt - (i32.const 8) - (i32.const 8) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 48) - (i32.const 82) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (call $~lib/string/String.__gt - (i32.const 8) - (i32.const 8) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 48) - (i32.const 83) - (i32.const 0) - ) - (unreachable) - ) - ) (if (i32.eqz (call $~lib/string/String.__gte @@ -5378,7 +5398,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 84) + (i32.const 82) (i32.const 0) ) (unreachable) @@ -5395,7 +5415,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 85) + (i32.const 83) (i32.const 0) ) (unreachable) @@ -5412,7 +5432,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 87) + (i32.const 85) (i32.const 0) ) (unreachable) @@ -5432,7 +5452,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 89) + (i32.const 87) (i32.const 0) ) (unreachable) @@ -5452,7 +5472,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 90) + (i32.const 88) (i32.const 0) ) (unreachable) @@ -5472,7 +5492,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 91) + (i32.const 89) (i32.const 0) ) (unreachable) @@ -5492,7 +5512,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 92) + (i32.const 90) (i32.const 0) ) (unreachable) @@ -5512,7 +5532,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 93) + (i32.const 91) (i32.const 0) ) (unreachable) @@ -5532,7 +5552,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 94) + (i32.const 92) (i32.const 0) ) (unreachable) @@ -5552,7 +5572,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 95) + (i32.const 93) (i32.const 0) ) (unreachable) @@ -5572,7 +5592,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 96) + (i32.const 94) (i32.const 0) ) (unreachable) @@ -5592,7 +5612,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 97) + (i32.const 95) (i32.const 0) ) (unreachable) @@ -5611,7 +5631,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 99) + (i32.const 97) (i32.const 0) ) (unreachable) @@ -5630,7 +5650,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 100) + (i32.const 98) (i32.const 0) ) (unreachable) @@ -5649,7 +5669,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 101) + (i32.const 99) (i32.const 0) ) (unreachable) @@ -5668,7 +5688,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 102) + (i32.const 100) (i32.const 0) ) (unreachable) @@ -5687,7 +5707,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 103) + (i32.const 101) (i32.const 0) ) (unreachable) @@ -5706,7 +5726,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 104) + (i32.const 102) (i32.const 0) ) (unreachable) @@ -5725,7 +5745,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 105) + (i32.const 103) (i32.const 0) ) (unreachable) @@ -5744,7 +5764,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 106) + (i32.const 104) (i32.const 0) ) (unreachable) @@ -5763,7 +5783,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 107) + (i32.const 105) (i32.const 0) ) (unreachable) @@ -5782,7 +5802,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 108) + (i32.const 106) (i32.const 0) ) (unreachable) @@ -5801,7 +5821,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 109) + (i32.const 107) (i32.const 0) ) (unreachable) @@ -5820,7 +5840,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 110) + (i32.const 108) (i32.const 0) ) (unreachable) @@ -5839,7 +5859,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 111) + (i32.const 109) (i32.const 0) ) (unreachable) @@ -5858,7 +5878,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 112) + (i32.const 110) (i32.const 0) ) (unreachable) @@ -5877,7 +5897,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 114) + (i32.const 112) (i32.const 0) ) (unreachable) @@ -5896,7 +5916,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 115) + (i32.const 113) (i32.const 0) ) (unreachable) @@ -5915,7 +5935,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 116) + (i32.const 114) (i32.const 0) ) (unreachable) @@ -5934,7 +5954,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 117) + (i32.const 115) (i32.const 0) ) (unreachable) @@ -5953,7 +5973,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 118) + (i32.const 116) (i32.const 0) ) (unreachable) @@ -5972,7 +5992,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 120) + (i32.const 118) (i32.const 0) ) (unreachable) @@ -5991,7 +6011,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 121) + (i32.const 119) (i32.const 0) ) (unreachable) @@ -6010,7 +6030,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 122) + (i32.const 120) (i32.const 0) ) (unreachable) @@ -6029,7 +6049,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 123) + (i32.const 121) (i32.const 0) ) (unreachable) @@ -6048,7 +6068,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 124) + (i32.const 122) (i32.const 0) ) (unreachable) @@ -6067,7 +6087,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 125) + (i32.const 123) (i32.const 0) ) (unreachable) @@ -6086,7 +6106,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 126) + (i32.const 124) (i32.const 0) ) (unreachable) @@ -6105,7 +6125,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 127) + (i32.const 125) (i32.const 0) ) (unreachable) @@ -6124,7 +6144,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 128) + (i32.const 126) (i32.const 0) ) (unreachable) @@ -6143,7 +6163,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 129) + (i32.const 127) (i32.const 0) ) (unreachable) @@ -6162,7 +6182,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 130) + (i32.const 128) (i32.const 0) ) (unreachable) @@ -6181,7 +6201,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 132) + (i32.const 130) (i32.const 0) ) (unreachable) @@ -6200,7 +6220,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 133) + (i32.const 131) (i32.const 0) ) (unreachable) @@ -6219,7 +6239,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 134) + (i32.const 132) (i32.const 0) ) (unreachable) @@ -6238,7 +6258,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 135) + (i32.const 133) (i32.const 0) ) (unreachable) @@ -6257,7 +6277,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 136) + (i32.const 134) (i32.const 0) ) (unreachable) @@ -6276,7 +6296,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 137) + (i32.const 135) (i32.const 0) ) (unreachable) @@ -6295,7 +6315,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 138) + (i32.const 136) (i32.const 0) ) (unreachable) @@ -6314,7 +6334,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 139) + (i32.const 137) (i32.const 0) ) (unreachable) @@ -6333,7 +6353,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 140) + (i32.const 138) (i32.const 0) ) (unreachable) @@ -6352,7 +6372,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 141) + (i32.const 139) (i32.const 0) ) (unreachable) @@ -6371,7 +6391,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 142) + (i32.const 140) (i32.const 0) ) (unreachable) diff --git a/tests/compiler/std/string.ts b/tests/compiler/std/string.ts index 5215cdb4..2b3bba90 100644 --- a/tests/compiler/std/string.ts +++ b/tests/compiler/std/string.ts @@ -2,8 +2,6 @@ import "allocator/arena"; import { utoa32, itoa32, utoa64, itoa64 } from "internal/itoa"; -// declare function logi(i: i32): void; - // preliminary var str: string = "hi, I'm a string"; diff --git a/tests/compiler/std/string.untouched.wat b/tests/compiler/std/string.untouched.wat index b34550ed..fc31eac9 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 $~lib/builtins/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 $~lib/builtins/u32.MAX_VALUE i32 (i32.const -1)) + (global $~lib/builtins/u64.MAX_VALUE i64 (i64.const -1)) + (global $~lib/builtins/i64.MAX_VALUE i64 (i64.const 9223372036854775807)) + (global $~lib/builtins/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 $~lib/builtins/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,7 @@ (get_local $5) ) ) - (func $~lib/allocator/arena/allocate_memory (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 15 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -1493,7 +1512,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -1507,10 +1526,10 @@ (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) ) ) @@ -1588,7 +1607,14 @@ ) (i32.const 0) ) - (func $~lib/internal/string/allocate (; 15 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 16 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/internal/string/allocate (; 17 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -1602,7 +1628,7 @@ ) (i32.le_s (get_local $0) - (i32.const 536870910) + (get_global $~lib/internal/string/MAX_LENGTH) ) (get_local $1) ) @@ -1618,9 +1644,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 +1660,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 (; 18 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3436,7 +3462,7 @@ ) ) ) - (func $~lib/memory/move_memory (; 17 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memmove (; 19 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.eq @@ -3466,7 +3492,7 @@ ) ) (block - (call $~lib/memory/copy_memory + (call $~lib/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -3754,7 +3780,14 @@ ) ) ) - (func $~lib/string/String#concat (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.copy (; 20 ;) (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 (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3807,7 +3840,7 @@ (i32.const 0) ) (return - (i32.const 8) + (get_global $~lib/internal/string/EMPTY) ) ) (set_local $5 @@ -3815,25 +3848,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 +3875,7 @@ ) (i32.add (get_local $1) - (i32.const 4) + (get_global $~lib/internal/string/HEADER_SIZE) ) (i32.shl (get_local $3) @@ -3851,7 +3884,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 (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) @@ -3865,7 +3898,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 (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -3912,14 +3945,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 +3961,7 @@ ) ) ) - (func $~lib/string/String.__ne (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__ne (; 24 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.eqz (call $~lib/string/String.__eq (get_local $0) @@ -3936,7 +3969,7 @@ ) ) ) - (func $~lib/string/String.__gt (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__gt (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4010,14 +4043,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 +4060,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 (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4103,14 +4136,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 +4153,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 (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4194,14 +4227,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 +4244,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 (; 28 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4287,14 +4320,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 +4337,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 (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4376,7 +4409,7 @@ ) ) (return - (i32.const 8) + (get_global $~lib/internal/string/EMPTY) ) ) (if @@ -4423,17 +4456,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 +4481,7 @@ ) (get_local $4) ) - (func $~lib/internal/itoa/decimalCountU32 (; 27 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/decimalCountU32 (; 30 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4504,7 +4537,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 (; 31 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4706,7 +4739,7 @@ ) (set_local $5 (i32.add - (i32.const 48) + (get_global $~lib/internal/string/CharCode._0) (get_local $1) ) ) @@ -4723,7 +4756,7 @@ ) ) ) - (func $~lib/internal/itoa/itoa32 (; 29 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/itoa32 (; 32 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4774,12 +4807,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 (; 33 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -4809,7 +4842,7 @@ ) (get_local $2) ) - (func $~lib/internal/itoa/decimalCountU64 (; 31 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/decimalCountU64 (; 34 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4877,7 +4910,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 (; 35 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i64) (local $5 i32) @@ -5071,7 +5104,7 @@ (get_local $2) ) ) - (func $~lib/internal/itoa/utoa64 (; 33 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/utoa64 (; 36 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -5087,7 +5120,7 @@ (i64.le_u (get_local $0) (i64.extend_u/i32 - (i32.const -1) + (get_global $~lib/builtins/u32.MAX_VALUE) ) ) (block @@ -5136,7 +5169,7 @@ ) (get_local $1) ) - (func $~lib/internal/itoa/itoa64 (; 34 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/itoa64 (; 37 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -5167,7 +5200,9 @@ (if (i64.le_u (get_local $0) - (i64.const 4294967295) + (i64.extend_u/i32 + (get_global $~lib/builtins/u32.MAX_VALUE) + ) ) (block (set_local $3 @@ -5223,20 +5258,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 (; 38 ;) (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) ) ) @@ -5255,7 +5290,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 13) + (i32.const 11) (i32.const 0) ) (unreachable) @@ -5274,7 +5309,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 15) + (i32.const 13) (i32.const 0) ) (unreachable) @@ -5294,7 +5329,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 16) + (i32.const 14) (i32.const 0) ) (unreachable) @@ -5312,7 +5347,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 17) + (i32.const 15) (i32.const 0) ) (unreachable) @@ -5335,7 +5370,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 18) + (i32.const 16) (i32.const 0) ) (unreachable) @@ -5353,7 +5388,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 19) + (i32.const 17) (i32.const 0) ) (unreachable) @@ -5374,7 +5409,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 21) + (i32.const 19) (i32.const 0) ) (unreachable) @@ -5395,7 +5430,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 22) + (i32.const 20) (i32.const 0) ) (unreachable) @@ -5416,7 +5451,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 23) + (i32.const 21) (i32.const 0) ) (unreachable) @@ -5437,7 +5472,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 24) + (i32.const 22) (i32.const 0) ) (unreachable) @@ -5458,7 +5493,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 25) + (i32.const 23) (i32.const 0) ) (unreachable) @@ -5479,7 +5514,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 26) + (i32.const 24) (i32.const 0) ) (unreachable) @@ -5500,7 +5535,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 27) + (i32.const 25) (i32.const 0) ) (unreachable) @@ -5521,7 +5556,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 28) + (i32.const 26) (i32.const 0) ) (unreachable) @@ -5547,7 +5582,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 30) + (i32.const 28) (i32.const 0) ) (unreachable) @@ -5573,7 +5608,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 31) + (i32.const 29) (i32.const 0) ) (unreachable) @@ -5601,7 +5636,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 32) + (i32.const 30) (i32.const 0) ) (unreachable) @@ -5627,7 +5662,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 33) + (i32.const 31) (i32.const 0) ) (unreachable) @@ -5653,7 +5688,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 34) + (i32.const 32) (i32.const 0) ) (unreachable) @@ -5679,7 +5714,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 35) + (i32.const 33) (i32.const 0) ) (unreachable) @@ -5700,7 +5735,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 36) + (i32.const 34) (i32.const 0) ) (unreachable) @@ -5721,7 +5756,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 37) + (i32.const 35) (i32.const 0) ) (unreachable) @@ -5742,7 +5777,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 38) + (i32.const 36) (i32.const 0) ) (unreachable) @@ -5763,7 +5798,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 39) + (i32.const 37) (i32.const 0) ) (unreachable) @@ -5784,7 +5819,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 40) + (i32.const 38) (i32.const 0) ) (unreachable) @@ -5804,7 +5839,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 46) + (i32.const 44) (i32.const 0) ) (unreachable) @@ -5824,7 +5859,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 47) + (i32.const 45) (i32.const 0) ) (unreachable) @@ -5844,7 +5879,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 48) + (i32.const 46) (i32.const 0) ) (unreachable) @@ -5864,7 +5899,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 49) + (i32.const 47) (i32.const 0) ) (unreachable) @@ -5884,7 +5919,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 50) + (i32.const 48) (i32.const 0) ) (unreachable) @@ -5904,7 +5939,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 51) + (i32.const 49) (i32.const 0) ) (unreachable) @@ -5924,7 +5959,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 52) + (i32.const 50) (i32.const 0) ) (unreachable) @@ -5944,7 +5979,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 53) + (i32.const 51) (i32.const 0) ) (unreachable) @@ -5963,7 +5998,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 55) + (i32.const 53) (i32.const 0) ) (unreachable) @@ -5982,7 +6017,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 56) + (i32.const 54) (i32.const 0) ) (unreachable) @@ -6001,7 +6036,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 57) + (i32.const 55) (i32.const 0) ) (unreachable) @@ -6020,7 +6055,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 58) + (i32.const 56) (i32.const 0) ) (unreachable) @@ -6039,7 +6074,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 59) + (i32.const 57) (i32.const 0) ) (unreachable) @@ -6062,7 +6097,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 62) + (i32.const 60) (i32.const 0) ) (unreachable) @@ -6079,7 +6114,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 63) + (i32.const 61) (i32.const 0) ) (unreachable) @@ -6096,7 +6131,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 64) + (i32.const 62) (i32.const 0) ) (unreachable) @@ -6113,7 +6148,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 65) + (i32.const 63) (i32.const 0) ) (unreachable) @@ -6130,7 +6165,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 67) + (i32.const 65) (i32.const 0) ) (unreachable) @@ -6147,7 +6182,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 68) + (i32.const 66) (i32.const 0) ) (unreachable) @@ -6164,7 +6199,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 69) + (i32.const 67) (i32.const 0) ) (unreachable) @@ -6181,7 +6216,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 70) + (i32.const 68) (i32.const 0) ) (unreachable) @@ -6196,6 +6231,25 @@ ) ) ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 48) + (i32.const 69) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eqz + (call $~lib/string/String.__lt + (i32.const 360) + (get_global $std/string/nullStr) + ) + ) + ) (block (call $~lib/env/abort (i32.const 0) @@ -6206,25 +6260,6 @@ (unreachable) ) ) - (if - (i32.eqz - (i32.eqz - (call $~lib/string/String.__lt - (i32.const 360) - (get_global $std/string/nullStr) - ) - ) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 48) - (i32.const 73) - (i32.const 0) - ) - (unreachable) - ) - ) (if (i32.eqz (i32.eqz @@ -6238,7 +6273,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 74) + (i32.const 72) (i32.const 0) ) (unreachable) @@ -6255,7 +6290,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 76) + (i32.const 74) (i32.const 0) ) (unreachable) @@ -6272,7 +6307,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 77) + (i32.const 75) (i32.const 0) ) (unreachable) @@ -6289,7 +6324,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 78) + (i32.const 76) (i32.const 0) ) (unreachable) @@ -6306,7 +6341,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 79) + (i32.const 77) (i32.const 0) ) (unreachable) @@ -6321,6 +6356,44 @@ ) ) ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 48) + (i32.const 78) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eqz + (call $~lib/string/String.__gt + (i32.const 8) + (i32.const 444) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 48) + (i32.const 79) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eqz + (call $~lib/string/String.__lt + (i32.const 8) + (i32.const 8) + ) + ) + ) (block (call $~lib/env/abort (i32.const 0) @@ -6336,7 +6409,7 @@ (i32.eqz (call $~lib/string/String.__gt (i32.const 8) - (i32.const 444) + (i32.const 8) ) ) ) @@ -6350,44 +6423,6 @@ (unreachable) ) ) - (if - (i32.eqz - (i32.eqz - (call $~lib/string/String.__lt - (i32.const 8) - (i32.const 8) - ) - ) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 48) - (i32.const 82) - (i32.const 0) - ) - (unreachable) - ) - ) - (if - (i32.eqz - (i32.eqz - (call $~lib/string/String.__gt - (i32.const 8) - (i32.const 8) - ) - ) - ) - (block - (call $~lib/env/abort - (i32.const 0) - (i32.const 48) - (i32.const 83) - (i32.const 0) - ) - (unreachable) - ) - ) (if (i32.eqz (call $~lib/string/String.__gte @@ -6399,7 +6434,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 84) + (i32.const 82) (i32.const 0) ) (unreachable) @@ -6416,7 +6451,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 85) + (i32.const 83) (i32.const 0) ) (unreachable) @@ -6435,7 +6470,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 87) + (i32.const 85) (i32.const 0) ) (unreachable) @@ -6455,7 +6490,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 89) + (i32.const 87) (i32.const 0) ) (unreachable) @@ -6475,7 +6510,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 90) + (i32.const 88) (i32.const 0) ) (unreachable) @@ -6495,7 +6530,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 91) + (i32.const 89) (i32.const 0) ) (unreachable) @@ -6515,7 +6550,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 92) + (i32.const 90) (i32.const 0) ) (unreachable) @@ -6535,7 +6570,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 93) + (i32.const 91) (i32.const 0) ) (unreachable) @@ -6555,7 +6590,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 94) + (i32.const 92) (i32.const 0) ) (unreachable) @@ -6575,7 +6610,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 95) + (i32.const 93) (i32.const 0) ) (unreachable) @@ -6595,7 +6630,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 96) + (i32.const 94) (i32.const 0) ) (unreachable) @@ -6615,7 +6650,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 97) + (i32.const 95) (i32.const 0) ) (unreachable) @@ -6634,7 +6669,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 99) + (i32.const 97) (i32.const 0) ) (unreachable) @@ -6653,7 +6688,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 100) + (i32.const 98) (i32.const 0) ) (unreachable) @@ -6672,7 +6707,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 101) + (i32.const 99) (i32.const 0) ) (unreachable) @@ -6691,7 +6726,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 102) + (i32.const 100) (i32.const 0) ) (unreachable) @@ -6710,7 +6745,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 103) + (i32.const 101) (i32.const 0) ) (unreachable) @@ -6729,7 +6764,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 104) + (i32.const 102) (i32.const 0) ) (unreachable) @@ -6748,7 +6783,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 105) + (i32.const 103) (i32.const 0) ) (unreachable) @@ -6767,7 +6802,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 106) + (i32.const 104) (i32.const 0) ) (unreachable) @@ -6786,7 +6821,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 107) + (i32.const 105) (i32.const 0) ) (unreachable) @@ -6805,7 +6840,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 108) + (i32.const 106) (i32.const 0) ) (unreachable) @@ -6824,7 +6859,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 109) + (i32.const 107) (i32.const 0) ) (unreachable) @@ -6843,7 +6878,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 110) + (i32.const 108) (i32.const 0) ) (unreachable) @@ -6862,7 +6897,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 111) + (i32.const 109) (i32.const 0) ) (unreachable) @@ -6881,7 +6916,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 112) + (i32.const 110) (i32.const 0) ) (unreachable) @@ -6900,7 +6935,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 114) + (i32.const 112) (i32.const 0) ) (unreachable) @@ -6919,7 +6954,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 115) + (i32.const 113) (i32.const 0) ) (unreachable) @@ -6938,7 +6973,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 116) + (i32.const 114) (i32.const 0) ) (unreachable) @@ -6957,7 +6992,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 117) + (i32.const 115) (i32.const 0) ) (unreachable) @@ -6967,7 +7002,7 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/internal/itoa/utoa32 - (i32.const -1) + (get_global $~lib/builtins/u32.MAX_VALUE) ) (i32.const 1372) ) @@ -6976,7 +7011,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 118) + (i32.const 116) (i32.const 0) ) (unreachable) @@ -6995,7 +7030,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 120) + (i32.const 118) (i32.const 0) ) (unreachable) @@ -7014,7 +7049,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 121) + (i32.const 119) (i32.const 0) ) (unreachable) @@ -7033,7 +7068,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 122) + (i32.const 120) (i32.const 0) ) (unreachable) @@ -7052,7 +7087,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 123) + (i32.const 121) (i32.const 0) ) (unreachable) @@ -7071,7 +7106,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 124) + (i32.const 122) (i32.const 0) ) (unreachable) @@ -7090,7 +7125,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 125) + (i32.const 123) (i32.const 0) ) (unreachable) @@ -7109,7 +7144,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 126) + (i32.const 124) (i32.const 0) ) (unreachable) @@ -7128,7 +7163,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 127) + (i32.const 125) (i32.const 0) ) (unreachable) @@ -7147,7 +7182,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 128) + (i32.const 126) (i32.const 0) ) (unreachable) @@ -7166,7 +7201,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 129) + (i32.const 127) (i32.const 0) ) (unreachable) @@ -7176,7 +7211,7 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/internal/itoa/utoa64 - (i64.const -1) + (get_global $~lib/builtins/u64.MAX_VALUE) ) (i32.const 2204) ) @@ -7185,7 +7220,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 130) + (i32.const 128) (i32.const 0) ) (unreachable) @@ -7204,7 +7239,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 132) + (i32.const 130) (i32.const 0) ) (unreachable) @@ -7223,7 +7258,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 133) + (i32.const 131) (i32.const 0) ) (unreachable) @@ -7242,7 +7277,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 134) + (i32.const 132) (i32.const 0) ) (unreachable) @@ -7261,7 +7296,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 135) + (i32.const 133) (i32.const 0) ) (unreachable) @@ -7280,7 +7315,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 136) + (i32.const 134) (i32.const 0) ) (unreachable) @@ -7299,7 +7334,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 137) + (i32.const 135) (i32.const 0) ) (unreachable) @@ -7318,7 +7353,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 138) + (i32.const 136) (i32.const 0) ) (unreachable) @@ -7337,7 +7372,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 139) + (i32.const 137) (i32.const 0) ) (unreachable) @@ -7356,7 +7391,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 140) + (i32.const 138) (i32.const 0) ) (unreachable) @@ -7366,7 +7401,7 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/internal/itoa/itoa64 - (i64.const 9223372036854775807) + (get_global $~lib/builtins/i64.MAX_VALUE) ) (i32.const 2428) ) @@ -7375,7 +7410,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 141) + (i32.const 139) (i32.const 0) ) (unreachable) @@ -7385,7 +7420,7 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/internal/itoa/itoa64 - (i64.const -9223372036854775808) + (get_global $~lib/builtins/i64.MIN_VALUE) ) (i32.const 2472) ) @@ -7394,7 +7429,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 48) - (i32.const 142) + (i32.const 140) (i32.const 0) ) (unreachable) diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index 2b424471..13d23005 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -21,7 +21,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 +45,7 @@ ) (get_local $0) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -132,7 +131,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (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 $~lib/internal/arraybuffer/computeSize (; 4 ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -146,7 +150,7 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocUnsafe (; 5 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -165,7 +169,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 +179,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 (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -505,7 +509,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 (; 7 ;) (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 (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u @@ -534,7 +545,7 @@ (i32.const 1) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (get_local $3) (i32.const 8) @@ -545,7 +556,7 @@ ) (get_local $3) ) - (func $~lib/map/Map#clear (; 7 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 9 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -579,7 +590,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 10 ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -587,7 +598,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 24) ) ) @@ -620,7 +631,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hashStr (; 9 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hashStr (; 11 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -668,7 +679,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 (; 12 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -680,8 +692,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 +707,10 @@ (get_local $1) ) ) - (get_local $2) ) + ) + (if + (get_local $3) (block (set_local $2 (i32.sub @@ -730,7 +749,14 @@ ) ) ) - (func $~lib/string/String.__eq (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/memory/memory.compare (; 13 ;) (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 (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eq @@ -777,7 +803,7 @@ ) ) (i32.eqz - (call $~lib/memory/compare_memory + (call $~lib/memory/memory.compare (i32.add (get_local $0) (i32.const 4) @@ -793,7 +819,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 (; 15 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -856,7 +882,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 (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -868,7 +894,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 (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -887,7 +913,7 @@ ) ) ) - (func $~lib/map/Map#rehash (; 15 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 18 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1050,7 +1076,7 @@ ) ) ) - (func $~lib/map/Map#set (; 16 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 19 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1187,7 +1213,7 @@ ) ) ) - (func $~lib/internal/hash/hash32 (; 17 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 20 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -1232,7 +1258,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 (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -1295,7 +1321,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#rehash (; 19 ;) (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) @@ -1458,7 +1484,7 @@ ) ) ) - (func $~lib/map/Map#set (; 20 ;) (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) @@ -1595,7 +1621,7 @@ ) ) ) - (func $~lib/symbol/Symbol.for (; 21 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/symbol/Symbol.for (; 24 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (get_global $~lib/symbol/stringToId) @@ -1650,7 +1676,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 (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -1662,7 +1688,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 (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -1681,7 +1707,7 @@ ) ) ) - (func $~lib/symbol/Symbol.keyFor (; 24 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/symbol/Symbol.keyFor (; 27 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (tee_local $1 @@ -1708,15 +1734,9 @@ ) ) ) - (func $start (; 25 ;) (type $v) + (func $start (; 28 ;) (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..c380155a 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -35,6 +35,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 +70,7 @@ ) (get_local $2) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -81,7 +83,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -95,10 +97,10 @@ (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) ) ) @@ -176,7 +178,14 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (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 $~lib/internal/arraybuffer/computeSize (; 4 ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -185,7 +194,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -193,13 +202,13 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocUnsafe (; 5 ;) (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 +222,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 +234,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 (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -577,12 +586,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 (; 7 ;) (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 (; 8 ;) (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 +622,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 +633,7 @@ ) (get_local $3) ) - (func $~lib/map/Map#clear (; 7 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 9 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -629,7 +645,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -643,7 +659,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 +670,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 10 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -664,7 +680,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 +716,7 @@ ) (get_local $0) ) - (func $~lib/map/Map#clear (; 9 ;) (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 @@ -712,7 +728,7 @@ (i32.store offset=4 (get_local $0) (i32.sub - (i32.const 4) + (get_global $~lib/map/INITIAL_CAPACITY) (i32.const 1) ) ) @@ -726,7 +742,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 +753,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 10 ;) (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 @@ -747,7 +763,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 +799,12 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hashStr (; 11 ;) (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) (set_local $1 - (i32.const -2128831035) + (get_global $~lib/internal/hash/FNV_OFFSET) ) (block $break|0 (block @@ -824,7 +840,7 @@ ) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $2 @@ -838,7 +854,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 (; 14 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) (if (i32.eq (get_local $0) @@ -852,7 +869,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 +883,7 @@ (get_local $1) ) ) - (get_local $2) + (get_local $3) ) (block (block @@ -902,7 +924,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 (; 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) (local $3 i32) (if @@ -949,14 +978,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 +994,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 (; 17 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -981,7 +1010,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1000,7 +1029,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -1022,7 +1051,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -1035,7 +1064,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 (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -1051,7 +1080,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 (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -1074,7 +1103,7 @@ (unreachable) ) ) - (func $~lib/map/Map#rehash (; 17 ;) (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) @@ -1097,7 +1126,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -1108,7 +1137,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -1129,7 +1158,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -1148,7 +1177,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -1169,7 +1198,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -1210,7 +1239,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1271,7 +1300,7 @@ ) ) ) - (func $~lib/map/Map#set (; 18 ;) (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) @@ -1322,7 +1351,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -1350,7 +1379,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 +1432,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1420,10 +1449,10 @@ ) ) ) - (func $~lib/internal/hash/hash32 (; 19 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 22 ;) (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 +1463,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -1449,7 +1478,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -1464,7 +1493,7 @@ (i32.const 255) ) ) - (i32.const 16777619) + (get_global $~lib/internal/hash/FNV_PRIME) ) ) (set_local $1 @@ -1476,12 +1505,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 (; 23 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -1497,7 +1526,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1516,7 +1545,7 @@ (i32.load offset=8 (get_local $3) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) ) @@ -1538,7 +1567,7 @@ (get_local $3) ) (i32.xor - (i32.const 1) + (get_global $~lib/map/EMPTY) (i32.const -1) ) ) @@ -1551,7 +1580,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#rehash (; 21 ;) (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) @@ -1574,7 +1603,7 @@ (i32.const 0) (i32.mul (get_local $2) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) (i32.const 0) ) @@ -1585,7 +1614,7 @@ (f64.convert_s/i32 (get_local $2) ) - (f64.const 2.6666666666666665) + (get_global $~lib/map/FILL_FACTOR) ) ) ) @@ -1606,7 +1635,7 @@ (i32.load offset=8 (get_local $0) ) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (set_local $7 @@ -1625,7 +1654,7 @@ (set_local $8 (i32.add (get_local $5) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) ) (block $break|0 @@ -1646,7 +1675,7 @@ (i32.load offset=8 (get_local $9) ) - (i32.const 1) + (get_global $~lib/map/EMPTY) ) ) (block @@ -1687,7 +1716,7 @@ (get_local $3) (i32.mul (get_local $11) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1748,7 +1777,7 @@ ) ) ) - (func $~lib/map/Map#set (; 22 ;) (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) @@ -1799,7 +1828,7 @@ (get_local $0) ) ) - (f64.const 0.75) + (get_global $~lib/map/FREE_FACTOR) ) ) ) @@ -1827,7 +1856,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 +1909,7 @@ (get_local $0) ) ) - (i32.const 4) + (get_global $~lib/map/BUCKET_SIZE) ) ) ) @@ -1897,7 +1926,7 @@ ) ) ) - (func $~lib/symbol/Symbol.for (; 23 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/symbol/Symbol.for (; 26 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -1961,7 +1990,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 (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -1977,7 +2006,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 (; 28 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -2000,7 +2029,7 @@ (unreachable) ) ) - (func $~lib/symbol/Symbol.keyFor (; 26 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/symbol/Symbol.keyFor (; 29 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (result i32) (if (result i32) @@ -2023,15 +2052,15 @@ (i32.const 0) ) ) - (func $start (; 27 ;) (type $v) + (func $start (; 30 ;) (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 +2211,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/trace.optimized.wat b/tests/compiler/std/trace.optimized.wat new file mode 100644 index 00000000..3e56415a --- /dev/null +++ b/tests/compiler/std/trace.optimized.wat @@ -0,0 +1,104 @@ +(module + (type $iiFFFFFv (func (param i32 i32 f64 f64 f64 f64 f64))) + (type $v (func)) + (import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64))) + (global $~started (mut i32) (i32.const 0)) + (memory $0 1) + (data (i32.const 8) "\0d\00\00\00z\00e\00r\00o\00_\00i\00m\00p\00l\00i\00c\00i\00t") + (data (i32.const 40) "\0d\00\00\00z\00e\00r\00o\00_\00e\00x\00p\00l\00i\00c\00i\00t") + (data (i32.const 72) "\07\00\00\00o\00n\00e\00_\00i\00n\00t") + (data (i32.const 92) "\07\00\00\00t\00w\00o\00_\00i\00n\00t") + (data (i32.const 112) "\t\00\00\00t\00h\00r\00e\00e\00_\00i\00n\00t") + (data (i32.const 136) "\08\00\00\00f\00o\00u\00r\00_\00i\00n\00t") + (data (i32.const 156) "\08\00\00\00f\00i\00v\00e\00_\00i\00n\00t") + (data (i32.const 176) "\08\00\00\00f\00i\00v\00e\00_\00d\00b\00l") + (export "memory" (memory $0)) + (export "main" (func $std/trace/main)) + (func $std/trace/main (; 1 ;) (type $v) + (if + (i32.eqz + (get_global $~started) + ) + (block + (call $start) + (set_global $~started + (i32.const 1) + ) + ) + ) + ) + (func $start (; 2 ;) (type $v) + (call $~lib/env/trace + (i32.const 8) + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $~lib/env/trace + (i32.const 40) + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $~lib/env/trace + (i32.const 72) + (i32.const 1) + (f64.const 1) + (f64.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $~lib/env/trace + (i32.const 92) + (i32.const 2) + (f64.const 1) + (f64.const 2) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $~lib/env/trace + (i32.const 112) + (i32.const 3) + (f64.const 1) + (f64.const 2) + (f64.const 3) + (f64.const 0) + (f64.const 0) + ) + (call $~lib/env/trace + (i32.const 136) + (i32.const 4) + (f64.const 1) + (f64.const 2) + (f64.const 3) + (f64.const 4) + (f64.const 0) + ) + (call $~lib/env/trace + (i32.const 156) + (i32.const 5) + (f64.const 1) + (f64.const 2) + (f64.const 3) + (f64.const 4) + (f64.const 5) + ) + (call $~lib/env/trace + (i32.const 176) + (i32.const 5) + (f64.const 1.1) + (f64.const 2.2) + (f64.const 3.3) + (f64.const 4.4) + (f64.const 5.5) + ) + ) +) diff --git a/tests/compiler/std/trace.ts b/tests/compiler/std/trace.ts new file mode 100644 index 00000000..0bd24612 --- /dev/null +++ b/tests/compiler/std/trace.ts @@ -0,0 +1,10 @@ +trace("zero_implicit"); +trace("zero_explicit", 0); +trace("one_int", 1, 1); +trace("two_int", 2, 1, 2); +trace("three_int", 3, 1, 2, 3); +trace("four_int", 4, 1, 2, 3, 4); +trace("five_int", 5, 1, 2, 3, 4, 5); +trace("five_dbl", 5, 1.1, 2.2, 3.3, 4.4, 5.5); + +export function main(): void {} diff --git a/tests/compiler/std/trace.untouched.wat b/tests/compiler/std/trace.untouched.wat new file mode 100644 index 00000000..4a24977d --- /dev/null +++ b/tests/compiler/std/trace.untouched.wat @@ -0,0 +1,105 @@ +(module + (type $iiFFFFFv (func (param i32 i32 f64 f64 f64 f64 f64))) + (type $v (func)) + (import "env" "trace" (func $~lib/env/trace (param i32 i32 f64 f64 f64 f64 f64))) + (global $~started (mut i32) (i32.const 0)) + (global $HEAP_BASE i32 (i32.const 196)) + (memory $0 1) + (data (i32.const 8) "\0d\00\00\00z\00e\00r\00o\00_\00i\00m\00p\00l\00i\00c\00i\00t\00") + (data (i32.const 40) "\0d\00\00\00z\00e\00r\00o\00_\00e\00x\00p\00l\00i\00c\00i\00t\00") + (data (i32.const 72) "\07\00\00\00o\00n\00e\00_\00i\00n\00t\00") + (data (i32.const 92) "\07\00\00\00t\00w\00o\00_\00i\00n\00t\00") + (data (i32.const 112) "\t\00\00\00t\00h\00r\00e\00e\00_\00i\00n\00t\00") + (data (i32.const 136) "\08\00\00\00f\00o\00u\00r\00_\00i\00n\00t\00") + (data (i32.const 156) "\08\00\00\00f\00i\00v\00e\00_\00i\00n\00t\00") + (data (i32.const 176) "\08\00\00\00f\00i\00v\00e\00_\00d\00b\00l\00") + (export "memory" (memory $0)) + (export "main" (func $std/trace/main)) + (func $std/trace/main (; 1 ;) (type $v) + (if + (i32.eqz + (get_global $~started) + ) + (block + (call $start) + (set_global $~started + (i32.const 1) + ) + ) + ) + ) + (func $start (; 2 ;) (type $v) + (call $~lib/env/trace + (i32.const 8) + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $~lib/env/trace + (i32.const 40) + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $~lib/env/trace + (i32.const 72) + (i32.const 1) + (f64.const 1) + (f64.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $~lib/env/trace + (i32.const 92) + (i32.const 2) + (f64.const 1) + (f64.const 2) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $~lib/env/trace + (i32.const 112) + (i32.const 3) + (f64.const 1) + (f64.const 2) + (f64.const 3) + (f64.const 0) + (f64.const 0) + ) + (call $~lib/env/trace + (i32.const 136) + (i32.const 4) + (f64.const 1) + (f64.const 2) + (f64.const 3) + (f64.const 4) + (f64.const 0) + ) + (call $~lib/env/trace + (i32.const 156) + (i32.const 5) + (f64.const 1) + (f64.const 2) + (f64.const 3) + (f64.const 4) + (f64.const 5) + ) + (call $~lib/env/trace + (i32.const 176) + (i32.const 5) + (f64.const 1.1) + (f64.const 2.2) + (f64.const 3.3) + (f64.const 4.4) + (f64.const 5.5) + ) + ) +) diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 5663d10e..7934def5 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -11,7 +11,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 +31,7 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -118,7 +117,12 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (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 $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -137,7 +141,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 +151,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 (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -477,7 +481,14 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result 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/internal/typedarray/TypedArray#constructor (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.gt_u @@ -494,7 +505,7 @@ (unreachable) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (tee_local $2 (call $~lib/internal/arraybuffer/allocUnsafe @@ -513,7 +524,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -543,7 +554,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 (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.gt_u @@ -560,7 +571,7 @@ (unreachable) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (tee_local $2 (call $~lib/internal/arraybuffer/allocUnsafe @@ -584,7 +595,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -614,7 +625,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 (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.gt_u @@ -631,7 +642,7 @@ (unreachable) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (tee_local $2 (call $~lib/internal/arraybuffer/allocUnsafe @@ -655,7 +666,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -685,7 +696,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 (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.gt_u @@ -702,7 +713,7 @@ (unreachable) ) ) - (call $~lib/memory/set_memory + (call $~lib/memory/memory.fill (i32.add (tee_local $2 (call $~lib/internal/arraybuffer/allocUnsafe @@ -726,7 +737,7 @@ (block (i32.store (tee_local $0 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -756,7 +767,7 @@ ) (get_local $0) ) - (func $std/typedarray/testInstantiate (; 9 ;) (type $iv) (param $0 i32) + (func $std/typedarray/testInstantiate (; 11 ;) (type $iv) (param $0 i32) (local $1 i32) (if (i32.load offset=4 @@ -1445,7 +1456,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 (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.ge_u @@ -1490,7 +1501,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 (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.ge_u @@ -1534,7 +1545,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 (; 14 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $4 @@ -1621,7 +1632,7 @@ ) (i32.store (tee_local $3 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -1645,7 +1656,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 (; 15 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.ge_u @@ -1684,7 +1695,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 (; 16 ;) (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 +1719,7 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#__get (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#__get (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.ge_u @@ -1746,16 +1757,10 @@ ) ) ) - (func $start (; 16 ;) (type $v) + (func $start (; 18 ;) (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..34544f1c 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -7,6 +7,17 @@ (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 +45,7 @@ (i32.sub (i32.add (get_local $0) - (i32.const 8) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) (i32.const 1) ) @@ -42,7 +53,7 @@ ) ) ) - (func $~lib/allocator/arena/allocate_memory (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -55,7 +66,7 @@ (if (i32.gt_u (get_local $0) - (i32.const 1073741824) + (get_global $~lib/internal/allocator/MAX_SIZE_32) ) (unreachable) ) @@ -69,10 +80,10 @@ (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) ) ) @@ -150,13 +161,20 @@ ) (i32.const 0) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 3 ;) (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 $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (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 +188,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 +200,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 (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -534,7 +552,14 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result 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/internal/typedarray/TypedArray#constructor (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -564,10 +589,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 +605,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 +638,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 (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -643,10 +668,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 +684,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 +717,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 (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -722,10 +747,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 +763,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 +796,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 (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -801,10 +826,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 +842,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 +875,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 (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -880,10 +905,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 +921,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 +954,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 (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -959,10 +984,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 +1000,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 +1033,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 (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1038,10 +1063,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 +1079,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 +1112,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 (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1117,10 +1142,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 +1158,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 +1191,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 (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1196,10 +1221,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 +1237,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 +1270,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 (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1275,10 +1300,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 +1316,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 +1349,7 @@ ) (get_local $0) ) - (func $std/typedarray/testInstantiate (; 15 ;) (type $iv) (param $0 i32) + (func $std/typedarray/testInstantiate (; 17 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -1369,7 +1394,7 @@ ) (i32.mul (get_local $0) - (i32.const 1) + (get_global $~lib/typedarray/Int8Array.BYTES_PER_ELEMENT) ) ) ) @@ -1445,7 +1470,7 @@ ) (i32.mul (get_local $0) - (i32.const 1) + (get_global $~lib/typedarray/Uint8Array.BYTES_PER_ELEMENT) ) ) ) @@ -1521,7 +1546,7 @@ ) (i32.mul (get_local $0) - (i32.const 1) + (get_global $~lib/typedarray/Uint8Array.BYTES_PER_ELEMENT) ) ) ) @@ -1597,7 +1622,7 @@ ) (i32.mul (get_local $0) - (i32.const 2) + (get_global $~lib/typedarray/Int16Array.BYTES_PER_ELEMENT) ) ) ) @@ -1673,7 +1698,7 @@ ) (i32.mul (get_local $0) - (i32.const 2) + (get_global $~lib/typedarray/Uint16Array.BYTES_PER_ELEMENT) ) ) ) @@ -1749,7 +1774,7 @@ ) (i32.mul (get_local $0) - (i32.const 4) + (get_global $~lib/typedarray/Int32Array.BYTES_PER_ELEMENT) ) ) ) @@ -1825,7 +1850,7 @@ ) (i32.mul (get_local $0) - (i32.const 4) + (get_global $~lib/typedarray/Uint32Array.BYTES_PER_ELEMENT) ) ) ) @@ -1901,7 +1926,7 @@ ) (i32.mul (get_local $0) - (i32.const 8) + (get_global $~lib/typedarray/Int64Array.BYTES_PER_ELEMENT) ) ) ) @@ -1977,7 +2002,7 @@ ) (i32.mul (get_local $0) - (i32.const 8) + (get_global $~lib/typedarray/Uint64Array.BYTES_PER_ELEMENT) ) ) ) @@ -2053,7 +2078,7 @@ ) (i32.mul (get_local $0) - (i32.const 4) + (get_global $~lib/typedarray/Float32Array.BYTES_PER_ELEMENT) ) ) ) @@ -2129,7 +2154,7 @@ ) (i32.mul (get_local $0) - (i32.const 8) + (get_global $~lib/typedarray/Float64Array.BYTES_PER_ELEMENT) ) ) ) @@ -2173,7 +2198,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 (; 18 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2229,7 +2254,7 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#__get (; 17 ;) (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) (local $3 i32) (local $4 i32) @@ -2284,7 +2309,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 (; 20 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2390,7 +2415,7 @@ ) ) (set_local $4 - (call $~lib/allocator/arena/allocate_memory + (call $~lib/memory/memory.allocate (i32.const 12) ) ) @@ -2417,7 +2442,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 (; 21 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2473,7 +2498,7 @@ ) ) ) - (func $~lib/typedarray/Uint8ClampedArray#__set (; 20 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/typedarray/Uint8ClampedArray#__set (; 22 ;) (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 +2529,7 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#__get (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#__get (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2559,12 +2584,12 @@ ) ) ) - (func $start (; 22 ;) (type $v) + (func $start (; 24 ;) (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 +2606,7 @@ (if (i32.eqz (i32.eq - (i32.const 1) + (get_global $~lib/typedarray/Uint8Array.BYTES_PER_ELEMENT) (i32.const 1) ) ) @@ -2598,7 +2623,7 @@ (if (i32.eqz (i32.eq - (i32.const 1) + (get_global $~lib/typedarray/Uint8ClampedArray.BYTES_PER_ELEMENT) (i32.const 1) ) ) @@ -2615,7 +2640,7 @@ (if (i32.eqz (i32.eq - (i32.const 2) + (get_global $~lib/typedarray/Int16Array.BYTES_PER_ELEMENT) (i32.const 2) ) ) @@ -2632,7 +2657,7 @@ (if (i32.eqz (i32.eq - (i32.const 2) + (get_global $~lib/typedarray/Uint16Array.BYTES_PER_ELEMENT) (i32.const 2) ) ) @@ -2649,7 +2674,7 @@ (if (i32.eqz (i32.eq - (i32.const 4) + (get_global $~lib/typedarray/Int32Array.BYTES_PER_ELEMENT) (i32.const 4) ) ) @@ -2666,7 +2691,7 @@ (if (i32.eqz (i32.eq - (i32.const 4) + (get_global $~lib/typedarray/Uint32Array.BYTES_PER_ELEMENT) (i32.const 4) ) ) @@ -2683,7 +2708,7 @@ (if (i32.eqz (i32.eq - (i32.const 8) + (get_global $~lib/typedarray/Int64Array.BYTES_PER_ELEMENT) (i32.const 8) ) ) @@ -2700,7 +2725,7 @@ (if (i32.eqz (i32.eq - (i32.const 8) + (get_global $~lib/typedarray/Uint64Array.BYTES_PER_ELEMENT) (i32.const 8) ) ) @@ -2717,7 +2742,7 @@ (if (i32.eqz (i32.eq - (i32.const 4) + (get_global $~lib/typedarray/Float32Array.BYTES_PER_ELEMENT) (i32.const 4) ) ) @@ -2734,7 +2759,7 @@ (if (i32.eqz (i32.eq - (i32.const 8) + (get_global $~lib/typedarray/Float64Array.BYTES_PER_ELEMENT) (i32.const 8) ) ) @@ -2752,10 +2777,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 +3144,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)