From e65d875ebc7c13783b13a6e8859144073e7b3514 Mon Sep 17 00:00:00 2001 From: dcode Date: Sat, 1 Jun 2019 01:14:04 +0200 Subject: [PATCH] llvm-like naming of __heap_base, definition fixes, update examples --- examples/game-of-life/build/optimized.d.ts | 15 +- examples/game-of-life/build/untouched.wat | 694 ++--- examples/game-of-life/package.json | 4 +- examples/i64-polyfill/build/optimized.d.ts | 4 - examples/i64-polyfill/package.json | 4 +- examples/mandelbrot/build/optimized.d.ts | 5 - examples/mandelbrot/build/untouched.wat | 286 +- examples/mandelbrot/package.json | 4 +- examples/n-body/assembly/index.ts | 2 - examples/n-body/build/index.asm.js | 436 ++- examples/n-body/build/optimized.wasm | Bin 1691 -> 1644 bytes examples/n-body/build/optimized.wat | 142 +- examples/n-body/build/untouched.wat | 2596 ++++++++++++----- examples/n-body/package.json | 6 +- examples/n-body/scripts/postprocess-asmjs.js | 7 + lib/loader/index.js | 18 +- lib/loader/tests/build/untouched.wasm | Bin 9379 -> 9477 bytes lib/loader/tests/index.js | 1 + lib/parse/build/index.wat | 139 +- lib/parse/index.js | 2 +- lib/parse/index.js.map | 2 +- lib/parse/package.json | 2 +- src/builtins.ts | 8 +- src/compiler.ts | 26 +- src/definitions.ts | 213 +- std/assembly/heap.ts | 2 +- std/assembly/index.d.ts | 4 +- std/assembly/rt.ts | 6 +- std/assembly/rt/index-full.ts | 2 +- std/assembly/rt/index-stub.ts | 2 +- std/assembly/rt/pure.ts | 6 +- std/assembly/rt/stub.ts | 2 +- std/assembly/rt/tlsf.ts | 2 +- std/assembly/shared/typeinfo.ts | 2 +- tests/allocators/buddy/assembly/buddy.ts | 2 +- tests/allocators/buddy/untouched.wat | 4 +- tests/allocators/rt-full/optimized.wat | 4 +- tests/allocators/rt-full/untouched.wat | 150 +- tests/allocators/rt-stub/optimized.wat | 4 +- tests/allocators/rt-stub/untouched.wat | 8 +- tests/compiler/call-super.untouched.wat | 4 +- tests/compiler/constructor.untouched.wat | 4 +- tests/compiler/empty.json | 2 +- tests/compiler/exports.untouched.wat | 4 +- tests/compiler/getter-call.untouched.wat | 4 +- tests/compiler/inlining.untouched.wat | 4 +- tests/compiler/memset.ts | 2 +- tests/compiler/memset.untouched.wat | 4 +- tests/compiler/number.untouched.wat | 4 +- .../optional-typeparameters.untouched.wat | 4 +- tests/compiler/rc/global-init.untouched.wat | 14 +- tests/compiler/rc/local-init.untouched.wat | 14 +- .../rc/logical-and-mismatch.untouched.wat | 14 +- .../rc/logical-or-mismatch.untouched.wat | 14 +- tests/compiler/rc/rereturn.optimized.wat | 4 +- tests/compiler/rc/rereturn.untouched.wat | 16 +- .../rc/ternary-mismatch.untouched.wat | 14 +- .../retain-release-sanity.untouched.wat | 14 +- tests/compiler/retain-release.untouched.wat | 4 +- tests/compiler/rt/flags.untouched.wat | 4 +- tests/compiler/rt/instanceof.untouched.wat | 8 +- tests/compiler/runtime-full.optimized.wat | 4 +- tests/compiler/runtime-full.untouched.wat | 16 +- tests/compiler/runtime-stub.optimized.wat | 4 +- tests/compiler/runtime-stub.untouched.wat | 8 +- .../compiler/std/array-literal.untouched.wat | 14 +- tests/compiler/std/array.optimized.wat | 4 +- tests/compiler/std/array.untouched.wat | 16 +- tests/compiler/std/arraybuffer.untouched.wat | 4 +- tests/compiler/std/dataview.untouched.wat | 4 +- tests/compiler/std/date.untouched.wat | 4 +- tests/compiler/std/map.untouched.wat | 14 +- tests/compiler/std/new.untouched.wat | 4 +- .../compiler/std/object-literal.untouched.wat | 4 +- .../std/operator-overloading.untouched.wat | 4 +- tests/compiler/std/set.untouched.wat | 14 +- tests/compiler/std/static-array.untouched.wat | 4 +- tests/compiler/std/string-utf8.untouched.wat | 4 +- tests/compiler/std/string.untouched.wat | 14 +- tests/compiler/std/symbol.untouched.wat | 4 +- tests/compiler/std/typedarray.untouched.wat | 14 +- 81 files changed, 3135 insertions(+), 1995 deletions(-) create mode 100644 examples/n-body/scripts/postprocess-asmjs.js diff --git a/examples/game-of-life/build/optimized.d.ts b/examples/game-of-life/build/optimized.d.ts index 62152f45..08e7e10a 100644 --- a/examples/game-of-life/build/optimized.d.ts +++ b/examples/game-of-life/build/optimized.d.ts @@ -8,17 +8,8 @@ declare module ASModule { type f32 = number; type f64 = number; type bool = any; - namespace JSMath { - function random(): f64; - } - var w: i32; - var h: i32; - var s: i32; - function init(width: i32, height: i32): void; - function step(): void; - function fill(x: u32, y: u32, p: f64): void; - var BGR_ALIVE: u32; - var BGR_DEAD: u32; - var BIT_ROT: u32; + export function init(width: i32, height: i32): void; + export function step(): void; + export function fill(x: u32, y: u32, p: f64): void; } export default ASModule; diff --git a/examples/game-of-life/build/untouched.wat b/examples/game-of-life/build/untouched.wat index 64f056fc..86c8e310 100644 --- a/examples/game-of-life/build/untouched.wat +++ b/examples/game-of-life/build/untouched.wat @@ -133,360 +133,364 @@ i32.lt_s i32.eqz br_if $break|0 - block - local.get $2 - i32.const 0 - i32.eq - if (result i32) - local.get $0 - else - local.get $2 - i32.const 1 - i32.sub - end - local.set $3 - local.get $2 + local.get $2 + i32.const 0 + i32.eq + if (result i32) local.get $0 - i32.eq - if (result i32) + else + local.get $2 + i32.const 1 + i32.sub + end + local.set $3 + local.get $2 + local.get $0 + i32.eq + if (result i32) + i32.const 0 + else + local.get $2 + i32.const 1 + i32.add + end + local.set $4 + block $break|1 + i32.const 0 + local.set $5 + loop $repeat|1 + local.get $5 + global.get $assembly/index/w + i32.lt_s + i32.eqz + br_if $break|1 + local.get $5 i32.const 0 - else - local.get $2 - i32.const 1 - i32.add - end - local.set $4 - block $break|1 - i32.const 0 - local.set $5 - loop $repeat|1 + i32.eq + if (result i32) + local.get $1 + else local.get $5 - global.get $assembly/index/w - i32.lt_s - i32.eqz - br_if $break|1 - block - local.get $5 - i32.const 0 - i32.eq - if (result i32) - local.get $1 - else - local.get $5 - i32.const 1 - i32.sub - end - local.set $6 - local.get $5 - local.get $1 - i32.eq - if (result i32) - i32.const 0 - else - local.get $5 - i32.const 1 - i32.add - end - local.set $7 - block $assembly/index/get|inlined.0 (result i32) - local.get $6 - local.set $9 - local.get $3 - local.set $8 - local.get $8 - global.get $assembly/index/w - i32.mul - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.load - end - i32.const 1 - i32.and - block $assembly/index/get|inlined.1 (result i32) - local.get $5 - local.set $9 - local.get $3 - local.set $8 - local.get $8 - global.get $assembly/index/w - i32.mul - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.load - end - i32.const 1 - i32.and - i32.add - block $assembly/index/get|inlined.2 (result i32) - local.get $7 - local.set $9 - local.get $3 - local.set $8 - local.get $8 - global.get $assembly/index/w - i32.mul - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.load - end - i32.const 1 - i32.and - i32.add - block $assembly/index/get|inlined.3 (result i32) - local.get $6 - local.set $9 - local.get $2 - local.set $8 - local.get $8 - global.get $assembly/index/w - i32.mul - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.load - end - i32.const 1 - i32.and - i32.add - block $assembly/index/get|inlined.4 (result i32) - local.get $7 - local.set $9 - local.get $2 - local.set $8 - local.get $8 - global.get $assembly/index/w - i32.mul - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.load - end - i32.const 1 - i32.and - i32.add - block $assembly/index/get|inlined.5 (result i32) - local.get $6 - local.set $9 - local.get $4 - local.set $8 - local.get $8 - global.get $assembly/index/w - i32.mul - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.load - end - i32.const 1 - i32.and - i32.add - block $assembly/index/get|inlined.6 (result i32) - local.get $5 - local.set $9 - local.get $4 - local.set $8 - local.get $8 - global.get $assembly/index/w - i32.mul - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.load - end - i32.const 1 - i32.and - i32.add - block $assembly/index/get|inlined.7 (result i32) - local.get $7 - local.set $9 - local.get $4 - local.set $8 - local.get $8 - global.get $assembly/index/w - i32.mul - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.load - end - i32.const 1 - i32.and - i32.add - local.set $8 - block $assembly/index/get|inlined.8 (result i32) - local.get $5 - local.set $10 - local.get $2 - local.set $9 - local.get $9 - global.get $assembly/index/w - i32.mul - local.get $10 - i32.add - i32.const 2 - i32.shl - i32.load - end - local.set $9 - local.get $9 - i32.const 1 - i32.and - if - local.get $8 - i32.const 14 - i32.and - i32.const 2 - i32.eq - if - local.get $5 - local.set $12 - local.get $2 - local.set $11 - local.get $9 - local.set $10 - local.get $10 - i32.const 24 - i32.shr_u - global.get $assembly/config/BIT_ROT - i32.sub - local.tee $13 - i32.const 0 - local.tee $14 - local.get $13 - local.get $14 - i32.gt_s - select - local.set $13 - block $assembly/index/set|inlined.1 - local.get $13 - i32.const 24 - i32.shl - local.get $10 - i32.const 16777215 - i32.and - i32.or - local.set $16 - global.get $assembly/index/s - local.get $11 - global.get $assembly/index/w - i32.mul - i32.add - local.get $12 - i32.add - i32.const 2 - i32.shl - local.get $16 - i32.store - end - else - local.get $5 - local.set $11 - local.get $2 - local.set $10 - global.get $assembly/config/BGR_DEAD - i32.const -16777216 - i32.or - local.set $13 - global.get $assembly/index/s - local.get $10 - global.get $assembly/index/w - i32.mul - i32.add - local.get $11 - i32.add - i32.const 2 - i32.shl - local.get $13 - i32.store - end - else - local.get $8 - i32.const 3 - i32.eq - if - local.get $5 - local.set $11 - local.get $2 - local.set $10 - global.get $assembly/config/BGR_ALIVE - i32.const -16777216 - i32.or - local.set $13 - global.get $assembly/index/s - local.get $10 - global.get $assembly/index/w - i32.mul - i32.add - local.get $11 - i32.add - i32.const 2 - i32.shl - local.get $13 - i32.store - else - local.get $5 - local.set $11 - local.get $2 - local.set $10 - local.get $9 - local.set $13 - local.get $13 - i32.const 24 - i32.shr_u - global.get $assembly/config/BIT_ROT - i32.sub - local.tee $12 - i32.const 0 - local.tee $16 - local.get $12 - local.get $16 - i32.gt_s - select - local.set $12 - block $assembly/index/set|inlined.4 - local.get $12 - i32.const 24 - i32.shl - local.get $13 - i32.const 16777215 - i32.and - i32.or - local.set $14 - global.get $assembly/index/s - local.get $10 - global.get $assembly/index/w - i32.mul - i32.add - local.get $11 - i32.add - i32.const 2 - i32.shl - local.get $14 - i32.store - end - end - end - end + i32.const 1 + i32.sub + end + local.set $6 + local.get $5 + local.get $1 + i32.eq + if (result i32) + i32.const 0 + else local.get $5 i32.const 1 i32.add - local.set $5 - br $repeat|1 - unreachable end + local.set $7 + block $assembly/index/get|inlined.0 (result i32) + local.get $6 + local.set $9 + local.get $3 + local.set $8 + local.get $8 + global.get $assembly/index/w + i32.mul + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.load + end + i32.const 1 + i32.and + block $assembly/index/get|inlined.1 (result i32) + local.get $5 + local.set $9 + local.get $3 + local.set $8 + local.get $8 + global.get $assembly/index/w + i32.mul + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.load + end + i32.const 1 + i32.and + i32.add + block $assembly/index/get|inlined.2 (result i32) + local.get $7 + local.set $9 + local.get $3 + local.set $8 + local.get $8 + global.get $assembly/index/w + i32.mul + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.load + end + i32.const 1 + i32.and + i32.add + block $assembly/index/get|inlined.3 (result i32) + local.get $6 + local.set $9 + local.get $2 + local.set $8 + local.get $8 + global.get $assembly/index/w + i32.mul + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.load + end + i32.const 1 + i32.and + i32.add + block $assembly/index/get|inlined.4 (result i32) + local.get $7 + local.set $9 + local.get $2 + local.set $8 + local.get $8 + global.get $assembly/index/w + i32.mul + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.load + end + i32.const 1 + i32.and + i32.add + block $assembly/index/get|inlined.5 (result i32) + local.get $6 + local.set $9 + local.get $4 + local.set $8 + local.get $8 + global.get $assembly/index/w + i32.mul + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.load + end + i32.const 1 + i32.and + i32.add + block $assembly/index/get|inlined.6 (result i32) + local.get $5 + local.set $9 + local.get $4 + local.set $8 + local.get $8 + global.get $assembly/index/w + i32.mul + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.load + end + i32.const 1 + i32.and + i32.add + block $assembly/index/get|inlined.7 (result i32) + local.get $7 + local.set $9 + local.get $4 + local.set $8 + local.get $8 + global.get $assembly/index/w + i32.mul + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.load + end + i32.const 1 + i32.and + i32.add + local.set $9 + block $assembly/index/get|inlined.8 (result i32) + local.get $5 + local.set $10 + local.get $2 + local.set $8 + local.get $8 + global.get $assembly/index/w + i32.mul + local.get $10 + i32.add + i32.const 2 + i32.shl + i32.load + end + local.set $10 + local.get $10 + i32.const 1 + i32.and + if + local.get $9 + i32.const 14 + i32.and + i32.const 2 + i32.eq + if + local.get $5 + local.set $12 + local.get $2 + local.set $11 + local.get $10 + local.set $8 + local.get $8 + i32.const 24 + i32.shr_u + global.get $assembly/config/BIT_ROT + i32.sub + local.tee $13 + i32.const 0 + local.tee $14 + local.get $13 + local.get $14 + i32.gt_s + select + local.set $13 + block $assembly/index/set|inlined.1 + local.get $12 + local.set $16 + local.get $11 + local.set $15 + local.get $13 + i32.const 24 + i32.shl + local.get $8 + i32.const 16777215 + i32.and + i32.or + local.set $14 + global.get $assembly/index/s + local.get $15 + global.get $assembly/index/w + i32.mul + i32.add + local.get $16 + i32.add + i32.const 2 + i32.shl + local.get $14 + i32.store + end + else + local.get $5 + local.set $16 + local.get $2 + local.set $15 + global.get $assembly/config/BGR_DEAD + i32.const -16777216 + i32.or + local.set $14 + global.get $assembly/index/s + local.get $15 + global.get $assembly/index/w + i32.mul + i32.add + local.get $16 + i32.add + i32.const 2 + i32.shl + local.get $14 + i32.store + end + else + local.get $9 + i32.const 3 + i32.eq + if + local.get $5 + local.set $12 + local.get $2 + local.set $11 + global.get $assembly/config/BGR_ALIVE + i32.const -16777216 + i32.or + local.set $8 + global.get $assembly/index/s + local.get $11 + global.get $assembly/index/w + i32.mul + i32.add + local.get $12 + i32.add + i32.const 2 + i32.shl + local.get $8 + i32.store + else + local.get $5 + local.set $15 + local.get $2 + local.set $14 + local.get $10 + local.set $13 + local.get $13 + i32.const 24 + i32.shr_u + global.get $assembly/config/BIT_ROT + i32.sub + local.tee $12 + i32.const 0 + local.tee $11 + local.get $12 + local.get $11 + i32.gt_s + select + local.set $12 + block $assembly/index/set|inlined.4 + local.get $15 + local.set $11 + local.get $14 + local.set $8 + local.get $12 + i32.const 24 + i32.shl + local.get $13 + i32.const 16777215 + i32.and + i32.or + local.set $16 + global.get $assembly/index/s + local.get $8 + global.get $assembly/index/w + i32.mul + i32.add + local.get $11 + i32.add + i32.const 2 + i32.shl + local.get $16 + i32.store + end + end + end + local.get $5 + i32.const 1 + i32.add + local.set $5 + br $repeat|1 unreachable end + unreachable end local.get $2 i32.const 1 diff --git a/examples/game-of-life/package.json b/examples/game-of-life/package.json index 3089b6af..93ff48f7 100644 --- a/examples/game-of-life/package.json +++ b/examples/game-of-life/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "private": true, "scripts": { - "asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --use Math=JSMath --importMemory --sourceMap --debug --validate --measure", - "asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --use Math=JSMath -O3 --importMemory --sourceMap --validate --measure", + "asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --use Math=JSMath --runtime none --importMemory --sourceMap --debug --validate --measure", + "asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --use Math=JSMath -O3 --runtime none --importMemory --sourceMap --validate --measure", "asbuild": "npm run asbuild:untouched && npm run asbuild:optimized", "server": "http-server . -o -c-1" }, diff --git a/examples/i64-polyfill/build/optimized.d.ts b/examples/i64-polyfill/build/optimized.d.ts index cd5d4450..9a936f58 100644 --- a/examples/i64-polyfill/build/optimized.d.ts +++ b/examples/i64-polyfill/build/optimized.d.ts @@ -8,10 +8,6 @@ declare module ASModule { type f32 = number; type f64 = number; type bool = any; - const NaN: f64; - const Infinity: f64; - var lo: u32; - var hi: u32; function getLo(): u32; function getHi(): u32; function clz(loLeft: u32, hiLeft: u32): void; diff --git a/examples/i64-polyfill/package.json b/examples/i64-polyfill/package.json index af03821f..4f078111 100644 --- a/examples/i64-polyfill/package.json +++ b/examples/i64-polyfill/package.json @@ -17,8 +17,8 @@ }, "scripts": { "asbuild": "npm run asbuild:untouched && npm run asbuild:optimized", - "asbuild:untouched": "asc assembly/i64.ts -t build/untouched.wat -b build/untouched.wasm --validate --sourceMap --debug --measure", - "asbuild:optimized": "asc -O assembly/i64.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --validate --sourceMap --measure", + "asbuild:untouched": "asc assembly/i64.ts -t build/untouched.wat -b build/untouched.wasm --runtime none --validate --sourceMap --debug --measure", + "asbuild:optimized": "asc assembly/i64.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts -O3 --runtime none --validate --sourceMap --measure", "test": "node tests" }, "files": [ diff --git a/examples/mandelbrot/build/optimized.d.ts b/examples/mandelbrot/build/optimized.d.ts index 820085f6..6dffd812 100644 --- a/examples/mandelbrot/build/optimized.d.ts +++ b/examples/mandelbrot/build/optimized.d.ts @@ -8,11 +8,6 @@ declare module ASModule { type f32 = number; type f64 = number; type bool = any; - namespace JSMath { - function log(x: f64): f64; - function log2(x: f64): f64; - } - var NUM_COLORS: i32; function computeLine(y: u32, width: u32, height: u32, limit: u32): void; } export default ASModule; diff --git a/examples/mandelbrot/build/untouched.wat b/examples/mandelbrot/build/untouched.wat index 9b2e60e0..b5efd7d4 100644 --- a/examples/mandelbrot/build/untouched.wat +++ b/examples/mandelbrot/build/untouched.wat @@ -94,159 +94,153 @@ i32.lt_u i32.eqz br_if $break|0 - block - local.get $12 - f64.convert_i32_u - local.get $6 - f64.mul - local.get $8 - f64.sub - local.set $13 - f64.const 0 - local.set $14 - f64.const 0 - local.set $15 - i32.const 0 - local.set $18 - block $break|1 - loop $continue|1 - local.get $14 - local.get $14 - f64.mul - local.tee $16 - local.get $15 - local.get $15 - f64.mul - local.tee $17 - f64.add - f64.const 4 - f64.le - if - block - f64.const 2 - local.get $14 - f64.mul - local.get $15 - f64.mul - local.get $7 - f64.add - local.set $15 - local.get $16 - local.get $17 - f64.sub - local.get $13 - f64.add - local.set $14 - local.get $18 - local.get $3 - i32.ge_u - if - br $break|1 - end - local.get $18 - i32.const 1 - i32.add - local.set $18 - end - br $continue|1 - end - end - end - block $break|2 - loop $continue|2 - local.get $18 - f64.convert_i32_u - local.get $11 - f64.lt - if - block - local.get $14 - local.get $14 - f64.mul - local.get $15 - local.get $15 - f64.mul - f64.sub - local.get $13 - f64.add - local.set $19 - f64.const 2 - local.get $14 - f64.mul - local.get $15 - f64.mul - local.get $7 - f64.add - local.set $15 - local.get $19 - local.set $14 - local.get $18 - i32.const 1 - i32.add - local.set $18 - end - br $continue|2 - end - end - end - global.get $assembly/index/NUM_COLORS - i32.const 1 - i32.sub - local.set $20 - local.get $14 - local.get $14 - f64.mul - local.get $15 - local.get $15 - f64.mul - f64.add - local.set $19 - local.get $19 - f64.const 1 - f64.gt - if - f64.const 0.5 - local.get $19 - call $~lib/bindings/Math/log + local.get $12 + f64.convert_i32_u + local.get $6 + f64.mul + local.get $8 + f64.sub + local.set $13 + f64.const 0 + local.set $14 + f64.const 0 + local.set $15 + i32.const 0 + local.set $18 + block $break|1 + loop $continue|1 + local.get $14 + local.get $14 f64.mul - call $~lib/bindings/Math/log2 - local.set $21 - global.get $assembly/index/NUM_COLORS - i32.const 1 - i32.sub - f64.convert_i32_s - block $assembly/index/clamp|inlined.0 (result f64) + local.tee $16 + local.get $15 + local.get $15 + f64.mul + local.tee $17 + f64.add + f64.const 4 + f64.le + if + f64.const 2 + local.get $14 + f64.mul + local.get $15 + f64.mul + local.get $7 + f64.add + local.set $15 + local.get $16 + local.get $17 + f64.sub + local.get $13 + f64.add + local.set $14 + local.get $18 + local.get $3 + i32.ge_u + if + br $break|1 + end local.get $18 i32.const 1 i32.add - f64.convert_i32_u - local.get $21 - f64.sub - local.get $10 - f64.mul - local.set $24 - f64.const 0 - local.set $23 - f64.const 1 - local.set $22 - local.get $24 - local.get $23 - f64.max - local.get $22 - f64.min + local.set $18 + br $continue|1 end - f64.mul - i32.trunc_f64_u - local.set $20 end - local.get $9 - local.get $12 - i32.const 1 - i32.shl - i32.add - local.get $20 - i32.store16 end + block $break|2 + loop $continue|2 + local.get $18 + f64.convert_i32_u + local.get $11 + f64.lt + if + local.get $14 + local.get $14 + f64.mul + local.get $15 + local.get $15 + f64.mul + f64.sub + local.get $13 + f64.add + local.set $19 + f64.const 2 + local.get $14 + f64.mul + local.get $15 + f64.mul + local.get $7 + f64.add + local.set $15 + local.get $19 + local.set $14 + local.get $18 + i32.const 1 + i32.add + local.set $18 + br $continue|2 + end + end + end + global.get $assembly/index/NUM_COLORS + i32.const 1 + i32.sub + local.set $20 + local.get $14 + local.get $14 + f64.mul + local.get $15 + local.get $15 + f64.mul + f64.add + local.set $19 + local.get $19 + f64.const 1 + f64.gt + if + f64.const 0.5 + local.get $19 + call $~lib/bindings/Math/log + f64.mul + call $~lib/bindings/Math/log2 + local.set $21 + global.get $assembly/index/NUM_COLORS + i32.const 1 + i32.sub + f64.convert_i32_s + block $assembly/index/clamp|inlined.0 (result f64) + local.get $18 + i32.const 1 + i32.add + f64.convert_i32_u + local.get $21 + f64.sub + local.get $10 + f64.mul + local.set $24 + f64.const 0 + local.set $23 + f64.const 1 + local.set $22 + local.get $24 + local.get $23 + f64.max + local.get $22 + f64.min + end + f64.mul + i32.trunc_f64_u + local.set $20 + end + local.get $9 + local.get $12 + i32.const 1 + i32.shl + i32.add + local.get $20 + i32.store16 local.get $12 i32.const 1 i32.add diff --git a/examples/mandelbrot/package.json b/examples/mandelbrot/package.json index 8d583687..28f94c01 100644 --- a/examples/mandelbrot/package.json +++ b/examples/mandelbrot/package.json @@ -3,8 +3,8 @@ "version": "1.0.0", "private": true, "scripts": { - "asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --use Math=JSMath --importMemory --sourceMap --debug --validate --measure", - "asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --use Math=JSMath -O3 --importMemory --sourceMap --validate --measure", + "asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --use Math=JSMath --runtime none --importMemory --sourceMap --debug --validate --measure", + "asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -d build/optimized.d.ts --use Math=JSMath --runtime none -O3 --importMemory --sourceMap --validate --measure", "asbuild": "npm run asbuild:untouched && npm run asbuild:optimized", "server": "http-server . -o -c-1" }, diff --git a/examples/n-body/assembly/index.ts b/examples/n-body/assembly/index.ts index 9a37c2d6..4173cb11 100644 --- a/examples/n-body/assembly/index.ts +++ b/examples/n-body/assembly/index.ts @@ -1,5 +1,3 @@ -import "allocator/arena"; - // From The Computer Language Benchmarks Game // http://benchmarksgame.alioth.debian.org diff --git a/examples/n-body/build/index.asm.js b/examples/n-body/build/index.asm.js index 1c85f4be..1f65685e 100644 --- a/examples/n-body/build/index.asm.js +++ b/examples/n-body/build/index.asm.js @@ -1,3 +1,4 @@ + function asmFunc(global, env, buffer) { "almost asm"; var HEAP8 = new global.Int8Array(buffer); @@ -21,314 +22,230 @@ function asmFunc(global, env, buffer) { var nan = global.NaN; var infinity = global.Infinity; var assembly_index_system = 0; - var $lib_allocator_arena_startOffset = 0; - var $lib_allocator_arena_offset = 0; - var i64toi32_i32$HIGH_BITS = 0; - function $lib_allocator_arena___mem_allocate($0) { - $0 = $0 | 0; - var $1 = 0, $2 = 0, $3 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0, wasm2js_i32$2 = 0; - if ($0 >>> 0 > 1073741824 >>> 0) abort(); - $1 = $lib_allocator_arena_offset; - $0 = (($1 + (wasm2js_i32$0 = $0, wasm2js_i32$1 = 1, wasm2js_i32$2 = $0 >>> 0 > 1 >>> 0, wasm2js_i32$2 ? wasm2js_i32$0 : wasm2js_i32$1) | 0) + 7 | 0) & 4294967288 | 0; - $2 = __wasm_current_memory(); - if ($0 >>> 0 > ($2 << 16 | 0) >>> 0) { - $3 = ((($0 - $1 | 0) + 65535 | 0) & 4294901760 | 0) >>> 16 | 0; - if ((__wasm_grow_memory((wasm2js_i32$0 = $2, wasm2js_i32$1 = $3, wasm2js_i32$2 = ($2 | 0) > ($3 | 0), wasm2js_i32$2 ? wasm2js_i32$0 : wasm2js_i32$1) | 0) | 0) < (0 | 0)) if ((__wasm_grow_memory($3 | 0) | 0) < (0 | 0)) abort();; + var $lib_rt_stub_startOffset = 0; + var $lib_rt_stub_offset = 0; + function $lib_rt_stub___alloc($0, $1) { + var $2 = 0, $3 = 0, $4 = 0, $5 = 0; + if ($0 >>> 0 > 1073741808 >>> 0) { + abort() } - $lib_allocator_arena_offset = $0; - return $1 | 0; - } - - function $lib_util_runtime_allocate($0) { - $0 = $0 | 0; - var $1 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0; - $1 = $lib_allocator_arena___mem_allocate(1 << (32 - Math_clz32($0 + 15 | 0) | 0) | 0 | 0) | 0; - wasm2js_i32$0 = $1; - wasm2js_i32$1 = 2774420247; - HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1; - wasm2js_i32$0 = $1; - wasm2js_i32$1 = $0; - HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1; - return $1 + 16 | 0 | 0; + $3 = $lib_rt_stub_offset + 16 | 0; + $2 = (($3 + ($0 >>> 0 > 1 >>> 0 ? $0 : 1) | 0) + 15 | 0) & -16 | 0; + $4 = __wasm_memory_size(); + if ($2 >>> 0 > ($4 << 16 | 0) >>> 0) { + $5 = ((($2 - $3 | 0) + 65535 | 0) & -65536 | 0) >>> 16 | 0; + if ((__wasm_memory_grow((($4 | 0) > ($5 | 0) ? $4 : $5) | 0) | 0) < (0 | 0)) { + if ((__wasm_memory_grow($5 | 0) | 0) < (0 | 0)) { + abort() + } + } + } + $lib_rt_stub_offset = $2; + $2 = $3 - 16 | 0; + HEAP32[($2 + 8 | 0) >> 2] = $1; + HEAP32[($2 + 12 | 0) >> 2] = $0; + return $3; } function assembly_index_NBodySystem_constructor($0) { - $0 = $0 | 0; - var $1 = 0, $2 = 0, $3 = 0.0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0, wasm2js_i32$1 = 0; - $7 = HEAP32[($0 + 12 | 0) >> 2] | 0; - repeat_0 : do { + var $1 = 0, $2 = 0, $3 = 0.0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0; + $7 = HEAP32[($0 + 12 | 0) >> 2]; + repeat_0 : while (1) { if (($1 | 0) < ($7 | 0)) { - $2 = HEAPU32[((HEAPU32[($0 + 4 | 0) >> 2] | 0) + ($1 << 2 | 0) | 0) >> 2] | 0; - $3 = +HEAPF64[($2 + 48 | 0) >> 3]; - $4 = $4 + +HEAPF64[($2 + 24 | 0) >> 3] * $3; - $5 = $5 + +HEAPF64[($2 + 32 | 0) >> 3] * $3; - $6 = $6 + +HEAPF64[($2 + 40 | 0) >> 3] * $3; + $2 = HEAP32[(HEAP32[($0 + 4 | 0) >> 2] + ($1 << 2 | 0) | 0) >> 2]; + $3 = HEAPF64[($2 + 48 | 0) >> 3]; + $4 = $4 + HEAPF64[($2 + 24 | 0) >> 3] * $3; + $5 = $5 + HEAPF64[($2 + 32 | 0) >> 3] * $3; + $6 = $6 + HEAPF64[($2 + 40 | 0) >> 3] * $3; $1 = $1 + 1 | 0; continue repeat_0; } break repeat_0; - } while (1); - $1 = HEAPU32[(HEAPU32[($0 + 4 | 0) >> 2] | 0) >> 2] | 0; - wasm2js_i32$0 = $1; - wasm2js_f64$0 = -$4 / 39.47841760435743; - HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0; - wasm2js_i32$0 = $1; - wasm2js_f64$0 = -$5 / 39.47841760435743; - HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0; - wasm2js_i32$0 = $1; - wasm2js_f64$0 = -$6 / 39.47841760435743; - HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0; - $1 = $lib_util_runtime_allocate(4 | 0) | 0; - wasm2js_i32$0 = $1 - 16 | 0; - wasm2js_i32$1 = 17; - HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1; - wasm2js_i32$0 = $1; - wasm2js_i32$1 = $0; - HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1; - return $1 | 0; + }; + $1 = HEAP32[HEAP32[($0 + 4 | 0) >> 2] >> 2]; + HEAPF64[($1 + 24 | 0) >> 3] = -$4 / 39.47841760435743; + HEAPF64[($1 + 32 | 0) >> 3] = -$5 / 39.47841760435743; + HEAPF64[($1 + 40 | 0) >> 3] = -$6 / 39.47841760435743; + $1 = $lib_rt_stub___alloc(4, 3); + HEAP32[$1 >> 2] = $0; + return $1; } function assembly_index_Body_constructor($0, $1, $2, $3, $4, $5, $6) { - $0 = +$0; - $1 = +$1; - $2 = +$2; - $3 = +$3; - $4 = +$4; - $5 = +$5; - $6 = +$6; - var $7 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0, wasm2js_f64$0 = 0.0; - $7 = $lib_util_runtime_allocate(56 | 0) | 0; - wasm2js_i32$0 = $7 - 16 | 0; - wasm2js_i32$1 = 18; - HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1; - wasm2js_i32$0 = $7; - wasm2js_f64$0 = $0; - HEAPF64[wasm2js_i32$0 >> 3] = wasm2js_f64$0; - wasm2js_i32$0 = $7; - wasm2js_f64$0 = $1; - HEAPF64[(wasm2js_i32$0 + 8 | 0) >> 3] = wasm2js_f64$0; - wasm2js_i32$0 = $7; - wasm2js_f64$0 = $2; - HEAPF64[(wasm2js_i32$0 + 16 | 0) >> 3] = wasm2js_f64$0; - wasm2js_i32$0 = $7; - wasm2js_f64$0 = $3; - HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0; - wasm2js_i32$0 = $7; - wasm2js_f64$0 = $4; - HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0; - wasm2js_i32$0 = $7; - wasm2js_f64$0 = $5; - HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0; - wasm2js_i32$0 = $7; - wasm2js_f64$0 = $6; - HEAPF64[(wasm2js_i32$0 + 48 | 0) >> 3] = wasm2js_f64$0; - return $7 | 0; + var $7 = 0; + $7 = $lib_rt_stub___alloc(56, 4); + HEAPF64[$7 >> 3] = $0; + HEAPF64[($7 + 8 | 0) >> 3] = $1; + HEAPF64[($7 + 16 | 0) >> 3] = $2; + HEAPF64[($7 + 24 | 0) >> 3] = $3; + HEAPF64[($7 + 32 | 0) >> 3] = $4; + HEAPF64[($7 + 40 | 0) >> 3] = $5; + HEAPF64[($7 + 48 | 0) >> 3] = $6; + return $7; } - function $lib_util_runtime_makeArray() { - var $0 = 0, $1 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0; - $0 = $lib_util_runtime_allocate(16 | 0) | 0; - wasm2js_i32$0 = $0 - 16 | 0; - wasm2js_i32$1 = 19; - HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1; - $1 = $lib_util_runtime_allocate(20 | 0) | 0; - wasm2js_i32$0 = $1 - 16 | 0; - wasm2js_i32$1 = 15; - HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1; - wasm2js_i32$0 = $0; - wasm2js_i32$1 = $1; - HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1; - wasm2js_i32$0 = $0; - wasm2js_i32$1 = $1; - HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1; - wasm2js_i32$0 = $0; - wasm2js_i32$1 = 20; - HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1; - wasm2js_i32$0 = $0; - wasm2js_i32$1 = 5; - HEAP32[(wasm2js_i32$0 + 12 | 0) >> 2] = wasm2js_i32$1; - return $0 | 0; + function $lib_rt___allocArray() { + var $0 = 0, $1 = 0; + $0 = $lib_rt_stub___alloc(16, 5); + $1 = $lib_rt_stub___alloc(20, 0); + HEAP32[$0 >> 2] = $1; + HEAP32[($0 + 4 | 0) >> 2] = $1; + HEAP32[($0 + 8 | 0) >> 2] = 20; + HEAP32[($0 + 12 | 0) >> 2] = 5; + return $0; } function assembly_index_init() { var $0 = 0, $1 = 0, wasm2js_i32$0 = 0, wasm2js_i32$1 = 0; - $1 = $lib_util_runtime_makeArray() | 0; - $0 = HEAPU32[($1 + 4 | 0) >> 2] | 0; - wasm2js_i32$0 = $0; - wasm2js_i32$1 = assembly_index_Body_constructor(+(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(0.0), +(39.47841760435743)) | 0; - HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1; - wasm2js_i32$0 = $0; - wasm2js_i32$1 = assembly_index_Body_constructor(+(4.841431442464721), +(-1.1603200440274284), +(-.10362204447112311), +(.606326392995832), +(2.81198684491626), +(-.02521836165988763), +(.03769367487038949)) | 0; - HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1; - wasm2js_i32$0 = $0; - wasm2js_i32$1 = assembly_index_Body_constructor(+(8.34336671824458), +(4.124798564124305), +(-.4035234171143214), +(-1.0107743461787924), +(1.8256623712304119), +(.008415761376584154), +(.011286326131968767)) | 0; - HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1; - wasm2js_i32$0 = $0; - wasm2js_i32$1 = assembly_index_Body_constructor(+(12.894369562139131), +(-15.111151401698631), +(-.22330757889265573), +(1.0827910064415354), +(.8687130181696082), +(-.010832637401363636), +(1.7237240570597112e-03)) | 0; - HEAP32[(wasm2js_i32$0 + 12 | 0) >> 2] = wasm2js_i32$1; - wasm2js_i32$0 = $0; - wasm2js_i32$1 = assembly_index_Body_constructor(+(15.379697114850917), +(-25.919314609987964), +(.17925877295037118), +(.979090732243898), +(.5946989986476762), +(-.034755955504078104), +(2.0336868699246304e-03)) | 0; - HEAP32[(wasm2js_i32$0 + 16 | 0) >> 2] = wasm2js_i32$1; - assembly_index_system = assembly_index_NBodySystem_constructor($1 | 0) | 0; + $1 = $lib_rt___allocArray(); + $0 = HEAP32[($1 + 4 | 0) >> 2]; + (wasm2js_i32$0 = $0, wasm2js_i32$1 = assembly_index_Body_constructor(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 39.47841760435743)), HEAP32[wasm2js_i32$0 >> 2] = wasm2js_i32$1; + (wasm2js_i32$0 = $0, wasm2js_i32$1 = assembly_index_Body_constructor(4.841431442464721, -1.1603200440274284, -.10362204447112311, .606326392995832, 2.81198684491626, -.02521836165988763, .03769367487038949)), HEAP32[(wasm2js_i32$0 + 4 | 0) >> 2] = wasm2js_i32$1; + (wasm2js_i32$0 = $0, wasm2js_i32$1 = assembly_index_Body_constructor(8.34336671824458, 4.124798564124305, -.4035234171143214, -1.0107743461787924, 1.8256623712304119, .008415761376584154, .011286326131968767)), HEAP32[(wasm2js_i32$0 + 8 | 0) >> 2] = wasm2js_i32$1; + (wasm2js_i32$0 = $0, wasm2js_i32$1 = assembly_index_Body_constructor(12.894369562139131, -15.111151401698631, -.22330757889265573, 1.0827910064415354, .8687130181696082, -.010832637401363636, 1.7237240570597112e-03)), HEAP32[(wasm2js_i32$0 + 12 | 0) >> 2] = wasm2js_i32$1; + (wasm2js_i32$0 = $0, wasm2js_i32$1 = assembly_index_Body_constructor(15.379697114850917, -25.919314609987964, .17925877295037118, .979090732243898, .5946989986476762, -.034755955504078104, 2.0336868699246304e-03)), HEAP32[(wasm2js_i32$0 + 16 | 0) >> 2] = wasm2js_i32$1; + assembly_index_system = assembly_index_NBodySystem_constructor($1); } function assembly_index_NBodySystem_advance($0) { - $0 = $0 | 0; - var $1 = 0, $2 = 0.0, $8 = 0.0, $3 = 0, $4 = 0.0, $5 = 0.0, $6 = 0.0, $7 = 0, $9 = 0.0, $10 = 0.0, $11 = 0.0, $12 = 0, $13 = 0, $14 = 0.0, $15 = 0.0, $16 = 0.0, $17 = 0.0, $107 = 0.0, wasm2js_i32$0 = 0, wasm2js_f64$0 = 0.0; - $12 = HEAPU32[$0 >> 2] | 0; - $13 = HEAP32[($12 + 12 | 0) >> 2] | 0; - repeat_0 : do { - if ($3 >>> 0 < $13 >>> 0) { - $0 = HEAPU32[((HEAPU32[($12 + 4 | 0) >> 2] | 0) + ($3 << 2 | 0) | 0) >> 2] | 0; - $14 = +HEAPF64[$0 >> 3]; - $15 = +HEAPF64[($0 + 8 | 0) >> 3]; - $16 = +HEAPF64[($0 + 16 | 0) >> 3]; - $4 = +HEAPF64[($0 + 24 | 0) >> 3]; - $5 = +HEAPF64[($0 + 32 | 0) >> 3]; - $6 = +HEAPF64[($0 + 40 | 0) >> 3]; - $17 = +HEAPF64[($0 + 48 | 0) >> 3]; - $7 = $3 + 1 | 0; - repeat_1 : do { - if ($7 >>> 0 < $13 >>> 0) { - $1 = HEAPU32[((HEAPU32[($12 + 4 | 0) >> 2] | 0) + ($7 << 2 | 0) | 0) >> 2] | 0; - $2 = $14 - +HEAPF64[$1 >> 3]; - $9 = $15 - +HEAPF64[($1 + 8 | 0) >> 3]; - $10 = $16 - +HEAPF64[($1 + 16 | 0) >> 3]; - $8 = $2 * $2 + $9 * $9 + $10 * $10; - $11 = Math_sqrt($8); - $11 = .01 / ($8 * $11); - $8 = +HEAPF64[($1 + 48 | 0) >> 3] * $11; - $4 = $4 - $2 * $8; - $5 = $5 - $9 * $8; - $6 = $6 - $10 * $8; - $107 = $2; + var $1 = 0, $2 = 0.0, $3 = 0.0, $4 = 0, $5 = 0.0, $6 = 0.0, $7 = 0.0, $8 = 0, $9 = 0.0, $10 = 0.0, $11 = 0.0, $12 = 0, $13 = 0, $14 = 0.0, $15 = 0.0, $16 = 0.0, $17 = 0.0; + $12 = HEAP32[$0 >> 2]; + $13 = HEAP32[($12 + 12 | 0) >> 2]; + repeat_0 : while (1) { + if ($4 >>> 0 < $13 >>> 0) { + $0 = HEAP32[(HEAP32[($12 + 4 | 0) >> 2] + ($4 << 2 | 0) | 0) >> 2]; + $14 = HEAPF64[$0 >> 3]; + $15 = HEAPF64[($0 + 8 | 0) >> 3]; + $16 = HEAPF64[($0 + 16 | 0) >> 3]; + $5 = HEAPF64[($0 + 24 | 0) >> 3]; + $6 = HEAPF64[($0 + 32 | 0) >> 3]; + $7 = HEAPF64[($0 + 40 | 0) >> 3]; + $17 = HEAPF64[($0 + 48 | 0) >> 3]; + $8 = $4 + 1 | 0; + repeat_1 : while (1) { + if ($8 >>> 0 < $13 >>> 0) { + $1 = HEAP32[(HEAP32[($12 + 4 | 0) >> 2] + ($8 << 2 | 0) | 0) >> 2]; + $2 = $14 - HEAPF64[$1 >> 3]; + $9 = $15 - HEAPF64[($1 + 8 | 0) >> 3]; + $10 = $16 - HEAPF64[($1 + 16 | 0) >> 3]; + $3 = $2 * $2 + $9 * $9 + $10 * $10; + $11 = Math_sqrt($3); + $11 = .01 / ($3 * $11); + $3 = HEAPF64[($1 + 48 | 0) >> 3] * $11; + $5 = $5 - $2 * $3; + $6 = $6 - $9 * $3; + $7 = $7 - $10 * $3; + $3 = $2; $2 = $17 * $11; - wasm2js_i32$0 = $1; - wasm2js_f64$0 = +HEAPF64[($1 + 24 | 0) >> 3] + $107 * $2; - HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0; - wasm2js_i32$0 = $1; - wasm2js_f64$0 = +HEAPF64[($1 + 32 | 0) >> 3] + $9 * $2; - HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0; - wasm2js_i32$0 = $1; - wasm2js_f64$0 = +HEAPF64[($1 + 40 | 0) >> 3] + $10 * $2; - HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0; - $7 = $7 + 1 | 0; + HEAPF64[($1 + 24 | 0) >> 3] = HEAPF64[($1 + 24 | 0) >> 3] + $3 * $2; + HEAPF64[($1 + 32 | 0) >> 3] = HEAPF64[($1 + 32 | 0) >> 3] + $9 * $2; + HEAPF64[($1 + 40 | 0) >> 3] = HEAPF64[($1 + 40 | 0) >> 3] + $10 * $2; + $8 = $8 + 1 | 0; continue repeat_1; } break repeat_1; - } while (1); - wasm2js_i32$0 = $0; - wasm2js_f64$0 = $4; - HEAPF64[(wasm2js_i32$0 + 24 | 0) >> 3] = wasm2js_f64$0; - wasm2js_i32$0 = $0; - wasm2js_f64$0 = $5; - HEAPF64[(wasm2js_i32$0 + 32 | 0) >> 3] = wasm2js_f64$0; - wasm2js_i32$0 = $0; - wasm2js_f64$0 = $6; - HEAPF64[(wasm2js_i32$0 + 40 | 0) >> 3] = wasm2js_f64$0; - wasm2js_i32$0 = $0; - wasm2js_f64$0 = +HEAPF64[$0 >> 3] + .01 * $4; - HEAPF64[wasm2js_i32$0 >> 3] = wasm2js_f64$0; - wasm2js_i32$0 = $0; - wasm2js_f64$0 = +HEAPF64[($0 + 8 | 0) >> 3] + .01 * $5; - HEAPF64[(wasm2js_i32$0 + 8 | 0) >> 3] = wasm2js_f64$0; - wasm2js_i32$0 = $0; - wasm2js_f64$0 = +HEAPF64[($0 + 16 | 0) >> 3] + .01 * $6; - HEAPF64[(wasm2js_i32$0 + 16 | 0) >> 3] = wasm2js_f64$0; - $3 = $3 + 1 | 0; + }; + HEAPF64[($0 + 24 | 0) >> 3] = $5; + HEAPF64[($0 + 32 | 0) >> 3] = $6; + HEAPF64[($0 + 40 | 0) >> 3] = $7; + HEAPF64[$0 >> 3] = HEAPF64[$0 >> 3] + .01 * $5; + HEAPF64[($0 + 8 | 0) >> 3] = HEAPF64[($0 + 8 | 0) >> 3] + .01 * $6; + HEAPF64[($0 + 16 | 0) >> 3] = HEAPF64[($0 + 16 | 0) >> 3] + .01 * $7; + $4 = $4 + 1 | 0; continue repeat_0; } break repeat_0; - } while (1); + }; } function assembly_index_NBodySystem_energy($0) { - $0 = $0 | 0; - var $1 = 0.0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $10 = 0.0, $6 = 0.0, $7 = 0.0, $8 = 0.0, $9 = 0.0, $30 = 0.0, $39 = 0.0, $45 = 0.0, $69 = 0.0, $84 = 0.0; - $4 = HEAPU32[$0 >> 2] | 0; - $5 = HEAP32[($4 + 12 | 0) >> 2] | 0; - repeat_0 : do { - if ($2 >>> 0 < $5 >>> 0) { - $0 = HEAPU32[((HEAPU32[($4 + 4 | 0) >> 2] | 0) + ($2 << 2 | 0) | 0) >> 2] | 0; - $7 = +HEAPF64[$0 >> 3]; - $8 = +HEAPF64[($0 + 8 | 0) >> 3]; - $9 = +HEAPF64[($0 + 16 | 0) >> 3]; - $30 = $1; - $10 = +HEAPF64[($0 + 48 | 0) >> 3]; - $1 = +HEAPF64[($0 + 24 | 0) >> 3]; - $39 = $1 * $1; - $1 = +HEAPF64[($0 + 32 | 0) >> 3]; - $45 = $39 + $1 * $1; - $1 = +HEAPF64[($0 + 40 | 0) >> 3]; - $1 = $30 + .5 * $10 * ($45 + $1 * $1); - $0 = $2 + 1 | 0; - repeat_1 : do { - if ($0 >>> 0 < $5 >>> 0) { - $3 = HEAPU32[((HEAPU32[($4 + 4 | 0) >> 2] | 0) + ($0 << 2 | 0) | 0) >> 2] | 0; - $6 = $7 - +HEAPF64[$3 >> 3]; - $69 = $1; - $1 = $8 - +HEAPF64[($3 + 8 | 0) >> 3]; - $84 = $6 * $6 + $1 * $1; - $1 = $9 - +HEAPF64[($3 + 16 | 0) >> 3]; - $1 = $69 - $10 * +HEAPF64[($3 + 48 | 0) >> 3] / Math_sqrt($84 + $1 * $1); + var $1 = 0.0, $2 = 0.0, $3 = 0, $4 = 0, $5 = 0, $6 = 0.0, $7 = 0, $8 = 0.0, $9 = 0.0, $10 = 0.0, $11 = 0.0; + $5 = HEAP32[$0 >> 2]; + $7 = HEAP32[($5 + 12 | 0) >> 2]; + repeat_0 : while (1) { + if ($3 >>> 0 < $7 >>> 0) { + $0 = HEAP32[(HEAP32[($5 + 4 | 0) >> 2] + ($3 << 2 | 0) | 0) >> 2]; + $9 = HEAPF64[$0 >> 3]; + $10 = HEAPF64[($0 + 8 | 0) >> 3]; + $11 = HEAPF64[($0 + 16 | 0) >> 3]; + $6 = $1; + $8 = HEAPF64[($0 + 48 | 0) >> 3]; + $1 = HEAPF64[($0 + 24 | 0) >> 3]; + $2 = $1 * $1; + $1 = HEAPF64[($0 + 32 | 0) >> 3]; + $2 = $2 + $1 * $1; + $1 = HEAPF64[($0 + 40 | 0) >> 3]; + $1 = $6 + .5 * $8 * ($2 + $1 * $1); + $0 = $3 + 1 | 0; + repeat_1 : while (1) { + if ($0 >>> 0 < $7 >>> 0) { + $4 = HEAP32[(HEAP32[($5 + 4 | 0) >> 2] + ($0 << 2 | 0) | 0) >> 2]; + $6 = $1; + $1 = $9 - HEAPF64[$4 >> 3]; + $2 = $1 * $1; + $1 = $10 - HEAPF64[($4 + 8 | 0) >> 3]; + $2 = $2 + $1 * $1; + $1 = $11 - HEAPF64[($4 + 16 | 0) >> 3]; + $1 = $6 - $8 * HEAPF64[($4 + 48 | 0) >> 3] / Math_sqrt($2 + $1 * $1); $0 = $0 + 1 | 0; continue repeat_1; } break repeat_1; - } while (1); - $2 = $2 + 1 | 0; + }; + $3 = $3 + 1 | 0; continue repeat_0; } break repeat_0; - } while (1); - return +$1; + }; + return $1; } function assembly_index_step() { - assembly_index_NBodySystem_advance(assembly_index_system | 0); - return +(+assembly_index_NBodySystem_energy(assembly_index_system | 0)); + assembly_index_NBodySystem_advance(assembly_index_system); + return +assembly_index_NBodySystem_energy(assembly_index_system); } function assembly_index_bench($0) { $0 = $0 | 0; var $1 = 0; - break_0 : { - repeat_0 : do { - if ($1 >>> 0 >= $0 >>> 0) break break_0; - assembly_index_NBodySystem_advance(assembly_index_system | 0); + repeat_0 : while (1) { + if (!($1 >>> 0 >= $0 >>> 0)) { + assembly_index_NBodySystem_advance(assembly_index_system); $1 = $1 + 1 | 0; continue repeat_0; - break repeat_0; - } while (1); + } + break repeat_0; }; } function assembly_index_getBody($0) { $0 = $0 | 0; - var $1 = 0, $14 = 0; - $1 = HEAPU32[assembly_index_system >> 2] | 0; - if ($0 >>> 0 < (HEAP32[($1 + 12 | 0) >> 2] | 0) >>> 0) $14 = HEAPU32[((HEAPU32[($1 + 4 | 0) >> 2] | 0) + ($0 << 2 | 0) | 0) >> 2] | 0; else $14 = 0; - return $14 | 0; + var $1 = 0; + $1 = HEAP32[assembly_index_system >> 2]; + if ($0 >>> 0 < HEAP32[($1 + 12 | 0) >> 2] >>> 0) { + $0 = HEAP32[(HEAP32[($1 + 4 | 0) >> 2] + ($0 << 2 | 0) | 0) >> 2] + } else { + $0 = 0 + } + return $0 | 0; } function start() { - $lib_allocator_arena_startOffset = 8; - $lib_allocator_arena_offset = $lib_allocator_arena_startOffset; + $lib_rt_stub_startOffset = 16; + $lib_rt_stub_offset = $lib_rt_stub_startOffset; } - function null_() { - - } - - function __wasm_grow_memory(pagesToAdd) { + var FUNCTION_TABLE = []; + function __wasm_memory_grow(pagesToAdd) { pagesToAdd = pagesToAdd | 0; - var oldPages = __wasm_current_memory() | 0; + var oldPages = __wasm_memory_size() | 0; var newPages = oldPages + pagesToAdd | 0; if ((oldPages < newPages) && (newPages < 65536)) { var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536)); var newHEAP8 = new global.Int8Array(newBuffer); newHEAP8.set(HEAP8); HEAP8 = newHEAP8; + HEAP8 = new global.Int8Array(newBuffer); HEAP16 = new global.Int16Array(newBuffer); HEAP32 = new global.Int32Array(newBuffer); HEAPU8 = new global.Uint8Array(newBuffer); @@ -341,32 +258,33 @@ function asmFunc(global, env, buffer) { return oldPages; } - function __wasm_current_memory() { + function __wasm_memory_size() { return buffer.byteLength / 65536 | 0; } return { - memory: Object.create(Object.prototype, { - grow: { - value: __wasm_grow_memory + "memory": Object.create(Object.prototype, { + "grow": { + "value": __wasm_memory_grow }, - buffer: { - get: function () { + "buffer": { + "get": function () { return buffer; } } }), - init: assembly_index_init, - step: assembly_index_step, - bench: assembly_index_bench, - getBody: assembly_index_getBody + "init": assembly_index_init, + "step": assembly_index_step, + "bench": assembly_index_bench, + "getBody": assembly_index_getBody }; } -const memasmFunc = new ArrayBuffer(65536); -const retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); }},memasmFunc); -export const memory = retasmFunc.memory; -export const init = retasmFunc.init; -export const step = retasmFunc.step; -export const bench = retasmFunc.bench; +var memasmFunc = new ArrayBuffer(65536); +var retasmFunc = asmFunc({Math,Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,NaN,Infinity}, {abort:function() { throw new Error('abort'); }},memasmFunc); +exports.memory = retasmFunc.memory; +exports.init = retasmFunc.init; +exports.step = retasmFunc.step; +exports.bench = retasmFunc.bench; +exports.getBody = retasmFunc.getBody; diff --git a/examples/n-body/build/optimized.wasm b/examples/n-body/build/optimized.wasm index ea9364a216ef6c07353b6997c2e17d96d7d667b4..a4fa268fd8bd90fddd3463d3618950cb39bb5f30 100644 GIT binary patch delta 384 zcmXAiy-EW?6ov1-Gn3t9HaMtFNZ~jMK@n_(#X@nf5D)`e+r^)tZ15)}2tsg!ZxFVW zynvP9gIM?)f>yS1R*QQ$=i?sEbM-T7!RhcC0RT6`Ea;MHo-*YE+Go zN&yHZ1x=4ynUup(?+yZW*1I{sf-t!3jrMOZ9-tgzrShSpN0gZb{+`e0q9YT~4Puiz z;Taa!si(Y<^4-AE9yrNnWr&C;{{3%8awkuo-{dm@&B-Dt7fn}_Y#Ur!l@kb&iwIx9{)lp=KjI}Sgj=iDa-kLx zv~F1s(Y6Qa1zOn|sRqvBHuz*z#1TyzH1^G8B0|158W?ry3#MYPR0jjQ91*`F04b%03Tc!z#Mq$G zTwVyf{YZh2=JDbC^(G)L)DV!P(Wp?qB}@2RQ^>yRo7sPxQ?g-OHraEnSF~R8i5ulD zq}V9tVEG(#Gym66uqn2UJbYD9cksk=#*(_s4X5!s?c2WJEwpqoVg0 kF`&hC8I&uR`F*O3y8ZCJhs@H+dOFBwDp#get:length (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 i32.load offset=12 @@ -45,8 +43,12 @@ i32.shl i32.add i32.load + call $~lib/rt/stub/__retain ) - (func $assembly/index/Body#offsetMomentum (; 3 ;) (type $FUNCSIG$iiddd) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32) + (func $~lib/rt/stub/__release (; 3 ;) (type $FUNCSIG$vi) (param $0 i32) + nop + ) + (func $assembly/index/Body#offsetMomentum (; 4 ;) (type $FUNCSIG$iiddd) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32) local.get $0 local.get $1 f64.neg @@ -66,61 +68,53 @@ f64.div f64.store offset=40 local.get $0 + call $~lib/rt/stub/__retain ) - (func $~lib/util/runtime/adjust (; 4 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - i32.const 1 - i32.const 32 - local.get $0 - global.get $~lib/util/runtime/HEADER_SIZE - i32.add - i32.const 1 - i32.sub - i32.clz - i32.sub - i32.shl - ) - (func $~lib/allocator/arena/__mem_allocate (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) + (func $~lib/rt/stub/__alloc (; 5 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) + (local $7 i32) + (local $8 i32) local.get $0 - i32.const 1073741824 + i32.const 1073741808 i32.gt_u if unreachable end - global.get $~lib/allocator/arena/offset - local.set $1 - local.get $1 - local.get $0 - local.tee $2 - i32.const 1 - local.tee $3 + global.get $~lib/rt/stub/offset + i32.const 16 + i32.add + local.set $2 local.get $2 + local.get $0 + local.tee $3 + i32.const 1 + local.tee $4 local.get $3 + local.get $4 i32.gt_u select i32.add - i32.const 7 + i32.const 15 i32.add - i32.const 7 + i32.const 15 i32.const -1 i32.xor i32.and - local.set $4 - current_memory local.set $5 - local.get $4 + memory.size + local.set $6 local.get $5 + local.get $6 i32.const 16 i32.shl i32.gt_u if - local.get $4 - local.get $1 + local.get $5 + local.get $2 i32.sub i32.const 65535 i32.add @@ -130,23 +124,23 @@ i32.and i32.const 16 i32.shr_u - local.set $2 - local.get $5 - local.tee $3 - local.get $2 - local.tee $6 - local.get $3 + local.set $3 local.get $6 + local.tee $4 + local.get $3 + local.tee $7 + local.get $4 + local.get $7 i32.gt_s select - local.set $3 - local.get $3 - grow_memory + local.set $4 + local.get $4 + memory.grow i32.const 0 i32.lt_s if - local.get $2 - grow_memory + local.get $3 + memory.grow i32.const 0 i32.lt_s if @@ -154,75 +148,32 @@ end end end - local.get $4 - global.set $~lib/allocator/arena/offset - local.get $1 - ) - (func $~lib/memory/memory.allocate (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - local.get $0 - call $~lib/allocator/arena/__mem_allocate - return - ) - (func $~lib/util/runtime/allocate (; 7 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) - (local $1 i32) - local.get $0 - call $~lib/util/runtime/adjust - call $~lib/memory/memory.allocate - local.set $1 - local.get $1 - global.get $~lib/util/runtime/HEADER_MAGIC - i32.store - local.get $1 - local.get $0 - i32.store offset=4 - local.get $1 - global.get $~lib/util/runtime/HEADER_SIZE - i32.add - ) - (func $~lib/util/runtime/register (; 8 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - local.get $0 - global.get $~lib/memory/HEAP_BASE - i32.gt_u - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 129 - i32.const 4 - call $~lib/builtins/abort - unreachable - end - local.get $0 - global.get $~lib/util/runtime/HEADER_SIZE + local.get $5 + global.set $~lib/rt/stub/offset + local.get $2 + i32.const 16 i32.sub - local.set $2 - local.get $2 - i32.load - global.get $~lib/util/runtime/HEADER_MAGIC - i32.eq - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 131 - i32.const 4 - call $~lib/builtins/abort - unreachable - end - local.get $2 + local.set $8 + local.get $8 local.get $1 - i32.store + i32.store offset=8 + local.get $8 local.get $0 + i32.store offset=12 + local.get $2 ) - (func $assembly/index/NBodySystem#constructor (; 9 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (func $assembly/index/NBodySystem#constructor (; 6 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 f64) (local $3 f64) (local $4 f64) (local $5 i32) (local $6 i32) (local $7 i32) - (local $8 f64) + (local $8 i32) + (local $9 f64) + local.get $1 + call $~lib/rt/stub/__retain + drop f64.const 0 local.set $2 f64.const 0 @@ -241,36 +192,40 @@ i32.lt_s i32.eqz br_if $break|0 - block - local.get $1 - local.get $6 - call $~lib/array/Array#__unchecked_get - local.set $7 - local.get $7 - f64.load offset=48 - local.set $8 - local.get $2 - local.get $7 - f64.load offset=24 - local.get $8 - f64.mul - f64.add - local.set $2 - local.get $3 - local.get $7 - f64.load offset=32 - local.get $8 - f64.mul - f64.add - local.set $3 - local.get $4 - local.get $7 - f64.load offset=40 - local.get $8 - f64.mul - f64.add - local.set $4 - end + local.get $1 + local.get $6 + call $~lib/array/Array#__unchecked_get + local.tee $7 + call $~lib/rt/stub/__retain + local.set $8 + local.get $8 + f64.load offset=48 + local.set $9 + local.get $2 + local.get $8 + f64.load offset=24 + local.get $9 + f64.mul + f64.add + local.set $2 + local.get $3 + local.get $8 + f64.load offset=32 + local.get $9 + f64.mul + f64.add + local.set $3 + local.get $4 + local.get $8 + f64.load offset=40 + local.get $9 + f64.mul + f64.add + local.set $4 + local.get $7 + call $~lib/rt/stub/__release + local.get $8 + call $~lib/rt/stub/__release local.get $6 i32.const 1 i32.add @@ -283,18 +238,19 @@ local.get $1 i32.const 0 call $~lib/array/Array#__unchecked_get + local.tee $8 local.get $2 local.get $3 local.get $4 call $assembly/index/Body#offsetMomentum - drop + call $~lib/rt/stub/__release local.get $0 i32.eqz if i32.const 4 - call $~lib/util/runtime/allocate - i32.const 17 - call $~lib/util/runtime/register + i32.const 3 + call $~lib/rt/stub/__alloc + call $~lib/rt/stub/__retain local.set $0 end local.get $0 @@ -302,14 +258,14 @@ i32.store local.get $0 ) - (func $assembly/index/Body#constructor (; 10 ;) (type $FUNCSIG$iiddddddd) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (param $7 f64) (result i32) + (func $assembly/index/Body#constructor (; 7 ;) (type $FUNCSIG$iiddddddd) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 f64) (param $5 f64) (param $6 f64) (param $7 f64) (result i32) local.get $0 i32.eqz if i32.const 56 - call $~lib/util/runtime/allocate - i32.const 18 - call $~lib/util/runtime/register + i32.const 4 + call $~lib/rt/stub/__alloc + call $~lib/rt/stub/__retain local.set $0 end local.get $0 @@ -335,7 +291,7 @@ f64.store offset=48 local.get $0 ) - (func $assembly/index/Sun (; 11 ;) (type $FUNCSIG$i) (result i32) + (func $assembly/index/Sun (; 8 ;) (type $FUNCSIG$i) (result i32) i32.const 0 f64.const 0 f64.const 0 @@ -346,92 +302,1383 @@ global.get $assembly/index/SOLAR_MASS call $assembly/index/Body#constructor ) - (func $~lib/memory/memory.copy (; 12 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (func $assembly/index/Jupiter (; 9 ;) (type $FUNCSIG$i) (result i32) + i32.const 0 + f64.const 4.841431442464721 + f64.const -1.1603200440274284 + f64.const -0.10362204447112311 + f64.const 0.001660076642744037 + global.get $assembly/index/DAYS_PER_YEAR + f64.mul + f64.const 0.007699011184197404 + global.get $assembly/index/DAYS_PER_YEAR + f64.mul + f64.const -6.90460016972063e-05 + global.get $assembly/index/DAYS_PER_YEAR + f64.mul + f64.const 9.547919384243266e-04 + global.get $assembly/index/SOLAR_MASS + f64.mul + call $assembly/index/Body#constructor + ) + (func $assembly/index/Saturn (; 10 ;) (type $FUNCSIG$i) (result i32) + i32.const 0 + f64.const 8.34336671824458 + f64.const 4.124798564124305 + f64.const -0.4035234171143214 + f64.const -0.002767425107268624 + global.get $assembly/index/DAYS_PER_YEAR + f64.mul + f64.const 0.004998528012349172 + global.get $assembly/index/DAYS_PER_YEAR + f64.mul + f64.const 2.3041729757376393e-05 + global.get $assembly/index/DAYS_PER_YEAR + f64.mul + f64.const 2.858859806661308e-04 + global.get $assembly/index/SOLAR_MASS + f64.mul + call $assembly/index/Body#constructor + ) + (func $assembly/index/Uranus (; 11 ;) (type $FUNCSIG$i) (result i32) + i32.const 0 + f64.const 12.894369562139131 + f64.const -15.111151401698631 + f64.const -0.22330757889265573 + f64.const 0.002964601375647616 + global.get $assembly/index/DAYS_PER_YEAR + f64.mul + f64.const 2.3784717395948095e-03 + global.get $assembly/index/DAYS_PER_YEAR + f64.mul + f64.const -2.9658956854023756e-05 + global.get $assembly/index/DAYS_PER_YEAR + f64.mul + f64.const 4.366244043351563e-05 + global.get $assembly/index/SOLAR_MASS + f64.mul + call $assembly/index/Body#constructor + ) + (func $assembly/index/Neptune (; 12 ;) (type $FUNCSIG$i) (result i32) + i32.const 0 + f64.const 15.379697114850917 + f64.const -25.919314609987964 + f64.const 0.17925877295037118 + f64.const 2.6806777249038932e-03 + global.get $assembly/index/DAYS_PER_YEAR + f64.mul + f64.const 0.001628241700382423 + global.get $assembly/index/DAYS_PER_YEAR + f64.mul + f64.const -9.515922545197159e-05 + global.get $assembly/index/DAYS_PER_YEAR + f64.mul + f64.const 5.1513890204661145e-05 + global.get $assembly/index/SOLAR_MASS + f64.mul + call $assembly/index/Body#constructor + ) + (func $~lib/util/memory/memcpy (; 13 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) + block $break|0 + loop $continue|0 + local.get $2 + if (result i32) + local.get $1 + i32.const 3 + i32.and + else + i32.const 0 + end + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + local.get $2 + i32.const 1 + i32.sub + local.set $2 + br $continue|0 + end + end + end + local.get $0 + i32.const 3 + i32.and + i32.const 0 + i32.eq + if + block $break|1 + loop $continue|1 + local.get $2 + i32.const 16 + i32.ge_u + if + local.get $0 + local.get $1 + i32.load + i32.store + local.get $0 + i32.const 4 + i32.add + local.get $1 + i32.const 4 + i32.add + i32.load + i32.store + local.get $0 + i32.const 8 + i32.add + local.get $1 + i32.const 8 + i32.add + i32.load + i32.store + local.get $0 + i32.const 12 + i32.add + local.get $1 + i32.const 12 + i32.add + i32.load + i32.store + local.get $1 + i32.const 16 + i32.add + local.set $1 + local.get $0 + i32.const 16 + i32.add + local.set $0 + local.get $2 + i32.const 16 + i32.sub + local.set $2 + br $continue|1 + end + end + end + local.get $2 + i32.const 8 + i32.and + if + local.get $0 + local.get $1 + i32.load + i32.store + local.get $0 + i32.const 4 + i32.add + local.get $1 + i32.const 4 + i32.add + i32.load + i32.store + local.get $0 + i32.const 8 + i32.add + local.set $0 + local.get $1 + i32.const 8 + i32.add + local.set $1 + end + local.get $2 + i32.const 4 + i32.and + if + local.get $0 + local.get $1 + i32.load + i32.store + local.get $0 + i32.const 4 + i32.add + local.set $0 + local.get $1 + i32.const 4 + i32.add + local.set $1 + end + local.get $2 + i32.const 2 + i32.and + if + local.get $0 + local.get $1 + i32.load16_u + i32.store16 + local.get $0 + i32.const 2 + i32.add + local.set $0 + local.get $1 + i32.const 2 + i32.add + local.set $1 + end + local.get $2 + i32.const 1 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + return + end + local.get $2 + i32.const 32 + i32.ge_u + if + block $break|2 + block $case2|2 + block $case1|2 + block $case0|2 + local.get $0 + i32.const 3 + i32.and + local.set $5 + local.get $5 + i32.const 1 + i32.eq + br_if $case0|2 + local.get $5 + i32.const 2 + i32.eq + br_if $case1|2 + local.get $5 + i32.const 3 + i32.eq + br_if $case2|2 + br $break|2 + end + block + local.get $1 + i32.load + local.set $3 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + local.get $2 + i32.const 3 + i32.sub + local.set $2 + block $break|3 + loop $continue|3 + local.get $2 + i32.const 17 + i32.ge_u + if + local.get $1 + i32.const 1 + i32.add + i32.load + local.set $4 + local.get $0 + local.get $3 + i32.const 24 + i32.shr_u + local.get $4 + i32.const 8 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 5 + i32.add + i32.load + local.set $3 + local.get $0 + i32.const 4 + i32.add + local.get $4 + i32.const 24 + i32.shr_u + local.get $3 + i32.const 8 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 9 + i32.add + i32.load + local.set $4 + local.get $0 + i32.const 8 + i32.add + local.get $3 + i32.const 24 + i32.shr_u + local.get $4 + i32.const 8 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 13 + i32.add + i32.load + local.set $3 + local.get $0 + i32.const 12 + i32.add + local.get $4 + i32.const 24 + i32.shr_u + local.get $3 + i32.const 8 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.set $1 + local.get $0 + i32.const 16 + i32.add + local.set $0 + local.get $2 + i32.const 16 + i32.sub + local.set $2 + br $continue|3 + end + end + end + br $break|2 + unreachable + end + unreachable + end + block + local.get $1 + i32.load + local.set $3 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + local.get $2 + i32.const 2 + i32.sub + local.set $2 + block $break|4 + loop $continue|4 + local.get $2 + i32.const 18 + i32.ge_u + if + local.get $1 + i32.const 2 + i32.add + i32.load + local.set $4 + local.get $0 + local.get $3 + i32.const 16 + i32.shr_u + local.get $4 + i32.const 16 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 6 + i32.add + i32.load + local.set $3 + local.get $0 + i32.const 4 + i32.add + local.get $4 + i32.const 16 + i32.shr_u + local.get $3 + i32.const 16 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 10 + i32.add + i32.load + local.set $4 + local.get $0 + i32.const 8 + i32.add + local.get $3 + i32.const 16 + i32.shr_u + local.get $4 + i32.const 16 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 14 + i32.add + i32.load + local.set $3 + local.get $0 + i32.const 12 + i32.add + local.get $4 + i32.const 16 + i32.shr_u + local.get $3 + i32.const 16 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.set $1 + local.get $0 + i32.const 16 + i32.add + local.set $0 + local.get $2 + i32.const 16 + i32.sub + local.set $2 + br $continue|4 + end + end + end + br $break|2 + unreachable + end + unreachable + end + block + local.get $1 + i32.load + local.set $3 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + local.get $2 + i32.const 1 + i32.sub + local.set $2 + block $break|5 + loop $continue|5 + local.get $2 + i32.const 19 + i32.ge_u + if + local.get $1 + i32.const 3 + i32.add + i32.load + local.set $4 + local.get $0 + local.get $3 + i32.const 8 + i32.shr_u + local.get $4 + i32.const 24 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 7 + i32.add + i32.load + local.set $3 + local.get $0 + i32.const 4 + i32.add + local.get $4 + i32.const 8 + i32.shr_u + local.get $3 + i32.const 24 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 11 + i32.add + i32.load + local.set $4 + local.get $0 + i32.const 8 + i32.add + local.get $3 + i32.const 8 + i32.shr_u + local.get $4 + i32.const 24 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 15 + i32.add + i32.load + local.set $3 + local.get $0 + i32.const 12 + i32.add + local.get $4 + i32.const 8 + i32.shr_u + local.get $3 + i32.const 24 + i32.shl + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.set $1 + local.get $0 + i32.const 16 + i32.add + local.set $0 + local.get $2 + i32.const 16 + i32.sub + local.set $2 + br $continue|5 + end + end + end + br $break|2 + unreachable + end + unreachable + end + end + local.get $2 + i32.const 16 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 8 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 4 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 2 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + local.get $2 + i32.const 1 + i32.and + if + block (result i32) + local.get $0 + local.tee $5 + i32.const 1 + i32.add + local.set $0 + local.get $5 + end + block (result i32) + local.get $1 + local.tee $5 + i32.const 1 + i32.add + local.set $1 + local.get $5 + end + i32.load8_u + i32.store8 + end + ) + (func $~lib/memory/memory.copy (; 14 ;) (type $FUNCSIG$viii) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) block $~lib/util/memory/memmove|inlined.0 local.get $0 + local.set $5 local.get $1 + local.set $4 + local.get $2 + local.set $3 + local.get $5 + local.get $4 i32.eq if br $~lib/util/memory/memmove|inlined.0 end - local.get $0 - local.get $1 + local.get $4 + local.get $3 + i32.add + local.get $5 + i32.le_u + if (result i32) + i32.const 1 + else + local.get $5 + local.get $3 + i32.add + local.get $4 + i32.le_u + end + if + local.get $5 + local.get $4 + local.get $3 + call $~lib/util/memory/memcpy + br $~lib/util/memory/memmove|inlined.0 + end + local.get $5 + local.get $4 i32.lt_u if - local.get $1 + local.get $4 i32.const 7 i32.and - local.get $0 + local.get $5 i32.const 7 i32.and i32.eq if block $break|0 loop $continue|0 - local.get $0 + local.get $5 i32.const 7 i32.and if - block - local.get $2 - i32.eqz - if - br $~lib/util/memory/memmove|inlined.0 - end - local.get $2 - i32.const 1 - i32.sub - local.set $2 - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 + local.get $3 + i32.eqz + if + br $~lib/util/memory/memmove|inlined.0 end + local.get $3 + i32.const 1 + i32.sub + local.set $3 + block (result i32) + local.get $5 + local.tee $6 + i32.const 1 + i32.add + local.set $5 + local.get $6 + end + block (result i32) + local.get $4 + local.tee $6 + i32.const 1 + i32.add + local.set $4 + local.get $6 + end + i32.load8_u + i32.store8 br $continue|0 end end end block $break|1 loop $continue|1 - local.get $2 + local.get $3 i32.const 8 i32.ge_u if - block - local.get $0 - local.get $1 - i64.load - i64.store - local.get $2 - i32.const 8 - i32.sub - local.set $2 - local.get $0 - i32.const 8 - i32.add - local.set $0 - local.get $1 - i32.const 8 - i32.add - local.set $1 - end + local.get $5 + local.get $4 + i64.load + i64.store + local.get $3 + i32.const 8 + i32.sub + local.set $3 + local.get $5 + i32.const 8 + i32.add + local.set $5 + local.get $4 + i32.const 8 + i32.add + local.set $4 br $continue|1 end end @@ -439,95 +1686,89 @@ end block $break|2 loop $continue|2 - local.get $2 + local.get $3 if - block - block (result i32) - local.get $0 - local.tee $5 - i32.const 1 - i32.add - local.set $0 - local.get $5 - end - block (result i32) - local.get $1 - local.tee $5 - i32.const 1 - i32.add - local.set $1 - local.get $5 - end - i32.load8_u - i32.store8 - local.get $2 + block (result i32) + local.get $5 + local.tee $6 i32.const 1 - i32.sub - local.set $2 + i32.add + local.set $5 + local.get $6 end + block (result i32) + local.get $4 + local.tee $6 + i32.const 1 + i32.add + local.set $4 + local.get $6 + end + i32.load8_u + i32.store8 + local.get $3 + i32.const 1 + i32.sub + local.set $3 br $continue|2 end end end else - local.get $1 + local.get $4 i32.const 7 i32.and - local.get $0 + local.get $5 i32.const 7 i32.and i32.eq if block $break|3 loop $continue|3 - local.get $0 - local.get $2 + local.get $5 + local.get $3 i32.add i32.const 7 i32.and if - block - local.get $2 - i32.eqz - if - br $~lib/util/memory/memmove|inlined.0 - end - local.get $0 - local.get $2 - i32.const 1 - i32.sub - local.tee $2 - i32.add - local.get $1 - local.get $2 - i32.add - i32.load8_u - i32.store8 + local.get $3 + i32.eqz + if + br $~lib/util/memory/memmove|inlined.0 end + local.get $5 + local.get $3 + i32.const 1 + i32.sub + local.tee $3 + i32.add + local.get $4 + local.get $3 + i32.add + i32.load8_u + i32.store8 br $continue|3 end end end block $break|4 loop $continue|4 - local.get $2 + local.get $3 i32.const 8 i32.ge_u if - block - local.get $2 - i32.const 8 - i32.sub - local.set $2 - local.get $0 - local.get $2 - i32.add - local.get $1 - local.get $2 - i32.add - i64.load - i64.store - end + local.get $3 + i32.const 8 + i32.sub + local.set $3 + local.get $5 + local.get $3 + i32.add + local.get $4 + local.get $3 + i32.add + i64.load + i64.store br $continue|4 end end @@ -535,16 +1776,16 @@ end block $break|5 loop $continue|5 - local.get $2 + local.get $3 if - local.get $0 - local.get $2 + local.get $5 + local.get $3 i32.const 1 i32.sub - local.tee $2 + local.tee $3 i32.add - local.get $1 - local.get $2 + local.get $4 + local.get $3 i32.add i32.load8_u i32.store8 @@ -555,26 +1796,25 @@ end end ) - (func $~lib/util/runtime/makeArray (; 13 ;) (type $FUNCSIG$iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $~lib/rt/__allocArray (; 15 ;) (type $FUNCSIG$iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (local $4 i32) (local $5 i32) (local $6 i32) i32.const 16 - call $~lib/util/runtime/allocate local.get $2 - call $~lib/util/runtime/register + call $~lib/rt/stub/__alloc local.set $4 local.get $0 local.get $1 i32.shl local.set $5 local.get $5 - call $~lib/util/runtime/allocate - i32.const 15 - call $~lib/util/runtime/register + i32.const 0 + call $~lib/rt/stub/__alloc local.set $6 local.get $4 local.get $6 + call $~lib/rt/stub/__retain i32.store local.get $4 local.get $6 @@ -594,140 +1834,98 @@ end local.get $4 ) - (func $assembly/index/Jupiter (; 14 ;) (type $FUNCSIG$i) (result i32) - i32.const 0 - f64.const 4.841431442464721 - f64.const -1.1603200440274284 - f64.const -0.10362204447112311 - f64.const 0.001660076642744037 - global.get $assembly/index/DAYS_PER_YEAR - f64.mul - f64.const 0.007699011184197404 - global.get $assembly/index/DAYS_PER_YEAR - f64.mul - f64.const -6.90460016972063e-05 - global.get $assembly/index/DAYS_PER_YEAR - f64.mul - f64.const 9.547919384243266e-04 - global.get $assembly/index/SOLAR_MASS - f64.mul - call $assembly/index/Body#constructor - ) - (func $assembly/index/Saturn (; 15 ;) (type $FUNCSIG$i) (result i32) - i32.const 0 - f64.const 8.34336671824458 - f64.const 4.124798564124305 - f64.const -0.4035234171143214 - f64.const -0.002767425107268624 - global.get $assembly/index/DAYS_PER_YEAR - f64.mul - f64.const 0.004998528012349172 - global.get $assembly/index/DAYS_PER_YEAR - f64.mul - f64.const 2.3041729757376393e-05 - global.get $assembly/index/DAYS_PER_YEAR - f64.mul - f64.const 2.858859806661308e-04 - global.get $assembly/index/SOLAR_MASS - f64.mul - call $assembly/index/Body#constructor - ) - (func $assembly/index/Uranus (; 16 ;) (type $FUNCSIG$i) (result i32) - i32.const 0 - f64.const 12.894369562139131 - f64.const -15.111151401698631 - f64.const -0.22330757889265573 - f64.const 0.002964601375647616 - global.get $assembly/index/DAYS_PER_YEAR - f64.mul - f64.const 2.3784717395948095e-03 - global.get $assembly/index/DAYS_PER_YEAR - f64.mul - f64.const -2.9658956854023756e-05 - global.get $assembly/index/DAYS_PER_YEAR - f64.mul - f64.const 4.366244043351563e-05 - global.get $assembly/index/SOLAR_MASS - f64.mul - call $assembly/index/Body#constructor - ) - (func $assembly/index/Neptune (; 17 ;) (type $FUNCSIG$i) (result i32) - i32.const 0 - f64.const 15.379697114850917 - f64.const -25.919314609987964 - f64.const 0.17925877295037118 - f64.const 2.6806777249038932e-03 - global.get $assembly/index/DAYS_PER_YEAR - f64.mul - f64.const 0.001628241700382423 - global.get $assembly/index/DAYS_PER_YEAR - f64.mul - f64.const -9.515922545197159e-05 - global.get $assembly/index/DAYS_PER_YEAR - f64.mul - f64.const 5.1513890204661145e-05 - global.get $assembly/index/SOLAR_MASS - f64.mul - call $assembly/index/Body#constructor - ) - (func $assembly/index/init (; 18 ;) (type $FUNCSIG$v) + (func $assembly/index/init (; 16 ;) (type $FUNCSIG$v) (local $0 i32) (local $1 i32) - i32.const 0 - block (result i32) - i32.const 5 - i32.const 2 - i32.const 19 - i32.const 0 - call $~lib/util/runtime/makeArray - local.set $0 - local.get $0 - i32.load offset=4 - local.set $1 - local.get $1 - call $assembly/index/Sun - i32.store - local.get $1 - call $assembly/index/Jupiter - i32.store offset=4 - local.get $1 - call $assembly/index/Saturn - i32.store offset=8 - local.get $1 - call $assembly/index/Uranus - i32.store offset=12 - local.get $1 - call $assembly/index/Neptune - i32.store offset=16 - local.get $0 - end - call $assembly/index/NBodySystem#constructor - global.set $assembly/index/system - ) - (func $assembly/index/NBodySystem#advance (; 19 ;) (type $FUNCSIG$vid) (param $0 i32) (param $1 f64) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 f64) + (local $6 i32) + block (result i32) + i32.const 0 + block (result i32) + i32.const 5 + i32.const 2 + i32.const 5 + i32.const 0 + call $~lib/rt/__allocArray + local.set $0 + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + call $assembly/index/Sun + local.tee $2 + call $~lib/rt/stub/__retain + i32.store + local.get $1 + call $assembly/index/Jupiter + local.tee $3 + call $~lib/rt/stub/__retain + i32.store offset=4 + local.get $1 + call $assembly/index/Saturn + local.tee $4 + call $~lib/rt/stub/__retain + i32.store offset=8 + local.get $1 + call $assembly/index/Uranus + local.tee $5 + call $~lib/rt/stub/__retain + i32.store offset=12 + local.get $1 + call $assembly/index/Neptune + local.tee $6 + call $~lib/rt/stub/__retain + i32.store offset=16 + local.get $0 + end + call $assembly/index/NBodySystem#constructor + local.set $0 + global.get $assembly/index/system + call $~lib/rt/stub/__release + local.get $0 + end + global.set $assembly/index/system + local.get $2 + call $~lib/rt/stub/__release + local.get $3 + call $~lib/rt/stub/__release + local.get $4 + call $~lib/rt/stub/__release + local.get $5 + call $~lib/rt/stub/__release + local.get $6 + call $~lib/rt/stub/__release + ) + (func $assembly/index/NBodySystem#advance (; 17 ;) (type $FUNCSIG$vid) (param $0 i32) (param $1 f64) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) (local $7 f64) (local $8 f64) (local $9 f64) (local $10 f64) (local $11 f64) (local $12 f64) - (local $13 i32) + (local $13 f64) (local $14 i32) - (local $15 f64) - (local $16 f64) + (local $15 i32) + (local $16 i32) (local $17 f64) (local $18 f64) (local $19 f64) (local $20 f64) (local $21 f64) (local $22 f64) + (local $23 f64) + (local $24 f64) local.get $0 i32.load + call $~lib/rt/stub/__retain local.set $2 local.get $2 call $~lib/array/Array#get:length @@ -741,183 +1939,191 @@ i32.lt_u i32.eqz br_if $break|0 - block - local.get $2 + local.get $2 + local.get $4 + call $~lib/array/Array#__unchecked_get + local.tee $5 + call $~lib/rt/stub/__retain + local.set $6 + local.get $6 + f64.load + local.set $7 + local.get $6 + f64.load offset=8 + local.set $8 + local.get $6 + f64.load offset=16 + local.set $9 + local.get $6 + f64.load offset=24 + local.set $10 + local.get $6 + f64.load offset=32 + local.set $11 + local.get $6 + f64.load offset=40 + local.set $12 + local.get $6 + f64.load offset=48 + local.set $13 + block $break|1 local.get $4 - call $~lib/array/Array#__unchecked_get - local.set $5 - local.get $5 - f64.load - local.set $6 - local.get $5 - f64.load offset=8 - local.set $7 - local.get $5 - f64.load offset=16 - local.set $8 - local.get $5 - f64.load offset=24 - local.set $9 - local.get $5 - f64.load offset=32 - local.set $10 - local.get $5 - f64.load offset=40 - local.set $11 - local.get $5 - f64.load offset=48 - local.set $12 - block $break|1 - local.get $4 + i32.const 1 + i32.add + local.set $14 + loop $repeat|1 + local.get $14 + local.get $3 + i32.lt_u + i32.eqz + br_if $break|1 + local.get $2 + local.get $14 + call $~lib/array/Array#__unchecked_get + local.tee $15 + call $~lib/rt/stub/__retain + local.set $16 + local.get $7 + local.get $16 + f64.load + f64.sub + local.set $17 + local.get $8 + local.get $16 + f64.load offset=8 + f64.sub + local.set $18 + local.get $9 + local.get $16 + f64.load offset=16 + f64.sub + local.set $19 + local.get $17 + local.get $17 + f64.mul + local.get $18 + local.get $18 + f64.mul + f64.add + local.get $19 + local.get $19 + f64.mul + f64.add + local.set $20 + block $~lib/math/NativeMath.sqrt|inlined.0 (result f64) + local.get $20 + local.set $21 + local.get $21 + f64.sqrt + end + local.set $21 + local.get $1 + local.get $20 + local.get $21 + f64.mul + f64.div + local.set $22 + local.get $13 + local.get $22 + f64.mul + local.set $23 + local.get $16 + f64.load offset=48 + local.get $22 + f64.mul + local.set $24 + local.get $10 + local.get $17 + local.get $24 + f64.mul + f64.sub + local.set $10 + local.get $11 + local.get $18 + local.get $24 + f64.mul + f64.sub + local.set $11 + local.get $12 + local.get $19 + local.get $24 + f64.mul + f64.sub + local.set $12 + local.get $16 + local.get $16 + f64.load offset=24 + local.get $17 + local.get $23 + f64.mul + f64.add + f64.store offset=24 + local.get $16 + local.get $16 + f64.load offset=32 + local.get $18 + local.get $23 + f64.mul + f64.add + f64.store offset=32 + local.get $16 + local.get $16 + f64.load offset=40 + local.get $19 + local.get $23 + f64.mul + f64.add + f64.store offset=40 + local.get $15 + call $~lib/rt/stub/__release + local.get $16 + call $~lib/rt/stub/__release + local.get $14 i32.const 1 i32.add - local.set $13 - loop $repeat|1 - local.get $13 - local.get $3 - i32.lt_u - i32.eqz - br_if $break|1 - block - local.get $2 - local.get $13 - call $~lib/array/Array#__unchecked_get - local.set $14 - local.get $6 - local.get $14 - f64.load - f64.sub - local.set $15 - local.get $7 - local.get $14 - f64.load offset=8 - f64.sub - local.set $16 - local.get $8 - local.get $14 - f64.load offset=16 - f64.sub - local.set $17 - local.get $15 - local.get $15 - f64.mul - local.get $16 - local.get $16 - f64.mul - f64.add - local.get $17 - local.get $17 - f64.mul - f64.add - local.set $18 - block $~lib/math/NativeMath.sqrt|inlined.0 (result f64) - local.get $18 - local.set $19 - local.get $19 - f64.sqrt - end - local.set $19 - local.get $1 - local.get $18 - local.get $19 - f64.mul - f64.div - local.set $20 - local.get $12 - local.get $20 - f64.mul - local.set $21 - local.get $14 - f64.load offset=48 - local.get $20 - f64.mul - local.set $22 - local.get $9 - local.get $15 - local.get $22 - f64.mul - f64.sub - local.set $9 - local.get $10 - local.get $16 - local.get $22 - f64.mul - f64.sub - local.set $10 - local.get $11 - local.get $17 - local.get $22 - f64.mul - f64.sub - local.set $11 - local.get $14 - local.get $14 - f64.load offset=24 - local.get $15 - local.get $21 - f64.mul - f64.add - f64.store offset=24 - local.get $14 - local.get $14 - f64.load offset=32 - local.get $16 - local.get $21 - f64.mul - f64.add - f64.store offset=32 - local.get $14 - local.get $14 - f64.load offset=40 - local.get $17 - local.get $21 - f64.mul - f64.add - f64.store offset=40 - end - local.get $13 - i32.const 1 - i32.add - local.set $13 - br $repeat|1 - unreachable - end + local.set $14 + br $repeat|1 unreachable end - local.get $5 - local.get $9 - f64.store offset=24 - local.get $5 - local.get $10 - f64.store offset=32 - local.get $5 - local.get $11 - f64.store offset=40 - local.get $5 - local.get $5 - f64.load - local.get $1 - local.get $9 - f64.mul - f64.add - f64.store - local.get $5 - local.get $5 - f64.load offset=8 - local.get $1 - local.get $10 - f64.mul - f64.add - f64.store offset=8 - local.get $5 - local.get $5 - f64.load offset=16 - local.get $1 - local.get $11 - f64.mul - f64.add - f64.store offset=16 + unreachable end + local.get $6 + local.get $10 + f64.store offset=24 + local.get $6 + local.get $11 + f64.store offset=32 + local.get $6 + local.get $12 + f64.store offset=40 + local.get $6 + local.get $6 + f64.load + local.get $1 + local.get $10 + f64.mul + f64.add + f64.store + local.get $6 + local.get $6 + f64.load offset=8 + local.get $1 + local.get $11 + f64.mul + f64.add + f64.store offset=8 + local.get $6 + local.get $6 + f64.load offset=16 + local.get $1 + local.get $12 + f64.mul + f64.add + f64.store offset=16 + local.get $5 + call $~lib/rt/stub/__release + local.get $6 + call $~lib/rt/stub/__release local.get $4 i32.const 1 i32.add @@ -927,30 +2133,35 @@ end unreachable end + local.get $2 + call $~lib/rt/stub/__release ) - (func $assembly/index/NBodySystem#energy (; 20 ;) (type $FUNCSIG$di) (param $0 i32) (result f64) + (func $assembly/index/NBodySystem#energy (; 18 ;) (type $FUNCSIG$di) (param $0 i32) (result f64) (local $1 f64) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 f64) + (local $6 i32) (local $7 f64) (local $8 f64) (local $9 f64) (local $10 f64) (local $11 f64) (local $12 f64) - (local $13 i32) + (local $13 f64) (local $14 i32) - (local $15 f64) - (local $16 f64) + (local $15 i32) + (local $16 i32) (local $17 f64) (local $18 f64) + (local $19 f64) + (local $20 f64) f64.const 0 local.set $1 local.get $0 i32.load + call $~lib/rt/stub/__retain local.set $2 block $break|0 block @@ -966,118 +2177,126 @@ i32.lt_u i32.eqz br_if $break|0 - block - local.get $2 + local.get $2 + local.get $3 + call $~lib/array/Array#__unchecked_get + local.tee $5 + call $~lib/rt/stub/__retain + local.set $6 + local.get $6 + f64.load + local.set $7 + local.get $6 + f64.load offset=8 + local.set $8 + local.get $6 + f64.load offset=16 + local.set $9 + local.get $6 + f64.load offset=24 + local.set $10 + local.get $6 + f64.load offset=32 + local.set $11 + local.get $6 + f64.load offset=40 + local.set $12 + local.get $6 + f64.load offset=48 + local.set $13 + local.get $1 + f64.const 0.5 + local.get $13 + f64.mul + local.get $10 + local.get $10 + f64.mul + local.get $11 + local.get $11 + f64.mul + f64.add + local.get $12 + local.get $12 + f64.mul + f64.add + f64.mul + f64.add + local.set $1 + block $break|1 local.get $3 - call $~lib/array/Array#__unchecked_get - local.set $5 - local.get $5 - f64.load - local.set $6 - local.get $5 - f64.load offset=8 - local.set $7 - local.get $5 - f64.load offset=16 - local.set $8 - local.get $5 - f64.load offset=24 - local.set $9 - local.get $5 - f64.load offset=32 - local.set $10 - local.get $5 - f64.load offset=40 - local.set $11 - local.get $5 - f64.load offset=48 - local.set $12 - local.get $1 - f64.const 0.5 - local.get $12 - f64.mul - local.get $9 - local.get $9 - f64.mul - local.get $10 - local.get $10 - f64.mul - f64.add - local.get $11 - local.get $11 - f64.mul - f64.add - f64.mul - f64.add - local.set $1 - block $break|1 - local.get $3 + i32.const 1 + i32.add + local.set $14 + loop $repeat|1 + local.get $14 + local.get $4 + i32.lt_u + i32.eqz + br_if $break|1 + local.get $2 + local.get $14 + call $~lib/array/Array#__unchecked_get + local.tee $15 + call $~lib/rt/stub/__retain + local.set $16 + local.get $7 + local.get $16 + f64.load + f64.sub + local.set $17 + local.get $8 + local.get $16 + f64.load offset=8 + f64.sub + local.set $18 + local.get $9 + local.get $16 + f64.load offset=16 + f64.sub + local.set $19 + block $~lib/math/NativeMath.sqrt|inlined.1 (result f64) + local.get $17 + local.get $17 + f64.mul + local.get $18 + local.get $18 + f64.mul + f64.add + local.get $19 + local.get $19 + f64.mul + f64.add + local.set $20 + local.get $20 + f64.sqrt + end + local.set $20 + local.get $1 + local.get $13 + local.get $16 + f64.load offset=48 + f64.mul + local.get $20 + f64.div + f64.sub + local.set $1 + local.get $15 + call $~lib/rt/stub/__release + local.get $16 + call $~lib/rt/stub/__release + local.get $14 i32.const 1 i32.add - local.set $13 - loop $repeat|1 - local.get $13 - local.get $4 - i32.lt_u - i32.eqz - br_if $break|1 - block - local.get $2 - local.get $13 - call $~lib/array/Array#__unchecked_get - local.set $14 - local.get $6 - local.get $14 - f64.load - f64.sub - local.set $15 - local.get $7 - local.get $14 - f64.load offset=8 - f64.sub - local.set $16 - local.get $8 - local.get $14 - f64.load offset=16 - f64.sub - local.set $17 - block $~lib/math/NativeMath.sqrt|inlined.1 (result f64) - local.get $15 - local.get $15 - f64.mul - local.get $16 - local.get $16 - f64.mul - f64.add - local.get $17 - local.get $17 - f64.mul - f64.add - local.set $18 - local.get $18 - f64.sqrt - end - local.set $18 - local.get $1 - local.get $12 - local.get $14 - f64.load offset=48 - f64.mul - local.get $18 - f64.div - f64.sub - local.set $1 - end - local.get $13 - i32.const 1 - i32.add - local.set $13 - br $repeat|1 - unreachable - end + local.set $14 + br $repeat|1 unreachable end + unreachable end + local.get $5 + call $~lib/rt/stub/__release + local.get $6 + call $~lib/rt/stub/__release local.get $3 i32.const 1 i32.add @@ -1088,15 +2307,19 @@ unreachable end local.get $1 + local.set $13 + local.get $2 + call $~lib/rt/stub/__release + local.get $13 ) - (func $assembly/index/step (; 21 ;) (type $FUNCSIG$d) (result f64) + (func $assembly/index/step (; 19 ;) (type $FUNCSIG$d) (result f64) global.get $assembly/index/system f64.const 0.01 call $assembly/index/NBodySystem#advance global.get $assembly/index/system call $assembly/index/NBodySystem#energy ) - (func $assembly/index/bench (; 22 ;) (type $FUNCSIG$vi) (param $0 i32) + (func $assembly/index/bench (; 20 ;) (type $FUNCSIG$vi) (param $0 i32) (local $1 i32) block $break|0 i32.const 0 @@ -1120,10 +2343,14 @@ unreachable end ) - (func $assembly/index/getBody (; 23 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (func $assembly/index/getBody (; 21 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) global.get $assembly/index/system i32.load + call $~lib/rt/stub/__retain local.set $1 local.get $0 local.get $1 @@ -1133,22 +2360,31 @@ local.get $1 local.get $0 call $~lib/array/Array#__unchecked_get + local.tee $2 + local.tee $3 else i32.const 0 + call $~lib/rt/stub/__retain + local.tee $4 end + call $~lib/rt/stub/__retain + local.set $2 + local.get $1 + call $~lib/rt/stub/__release + local.get $2 ) - (func $start (; 24 ;) (type $FUNCSIG$v) - global.get $~lib/memory/HEAP_BASE - i32.const 7 + (func $start (; 22 ;) (type $FUNCSIG$v) + global.get $~lib/heap/__heap_base + i32.const 15 i32.add - i32.const 7 + i32.const 15 i32.const -1 i32.xor i32.and - global.set $~lib/allocator/arena/startOffset - global.get $~lib/allocator/arena/startOffset - global.set $~lib/allocator/arena/offset + global.set $~lib/rt/stub/startOffset + global.get $~lib/rt/stub/startOffset + global.set $~lib/rt/stub/offset ) - (func $null (; 25 ;) (type $FUNCSIG$v) + (func $null (; 23 ;) (type $FUNCSIG$v) ) ) diff --git a/examples/n-body/package.json b/examples/n-body/package.json index ce64e03a..0fd4b4db 100644 --- a/examples/n-body/package.json +++ b/examples/n-body/package.json @@ -3,9 +3,9 @@ "version": "1.0.0", "private": true, "scripts": { - "asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --sourceMap --debug --validate --importMemory", - "asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -O3 --validate --noAssert --importMemory", - "asbuild:asmjs": "asc assembly/index.ts -a build/index.asm.js -O3 --validate --noAssert", + "asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --sourceMap --debug --validate --runtime none --importMemory", + "asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -O3 --validate --runtime none --noAssert --importMemory", + "asbuild:asmjs": "asc assembly/index.ts -a build/index.asm.js -O3 --validate --runtime none --noAssert && node scripts/postprocess-asmjs", "asbuild": "npm run asbuild:untouched && npm run asbuild:optimized && npm run asbuild:asmjs", "tsbuild": "tsc -p assembly -t ES2017 -m commonjs --outDir build", "build": "npm run asbuild && npm run tsbuild", diff --git a/examples/n-body/scripts/postprocess-asmjs.js b/examples/n-body/scripts/postprocess-asmjs.js new file mode 100644 index 00000000..d331a75a --- /dev/null +++ b/examples/n-body/scripts/postprocess-asmjs.js @@ -0,0 +1,7 @@ +const fs = require("fs"); +const path = require("path"); + +const filename = path.join(__dirname, "..", "build" , "index.asm.js"); +var source = fs.readFileSync(filename, { encoding: "utf8" }); +source = source.replace(/^export var ([^ ]+) =/mg, ($0, $1) => "exports." + $1 + " = "); +fs.writeFileSync(filename, source); diff --git a/lib/loader/index.js b/lib/loader/index.js index 99005a0f..58648748 100644 --- a/lib/loader/index.js +++ b/lib/loader/index.js @@ -85,7 +85,7 @@ function postInstantiate(baseModule, instance) { const table = rawExports.table; const alloc = rawExports["__alloc"]; const retain = rawExports["__retain"]; - const rtti = rawExports["__rtti"] || ~0; // oob if not present + const rttiBase = rawExports["__rtti_base"] || ~0; // oob if not present // Provide views for all sorts of basic values var buffer, I8, U8, I16, U16, I32, U32, F32, F64, I64, U64; @@ -113,16 +113,16 @@ function postInstantiate(baseModule, instance) { /** Gets the runtime type info for the given id. */ function getInfo(id) { - const count = U32[rtti >>> 2]; + const count = U32[rttiBase >>> 2]; if ((id >>>= 0) >= count) throw Error("invalid id: " + id); - return U32[(rtti + 4 >>> 2) + id * 2]; + return U32[(rttiBase + 4 >>> 2) + id * 2]; } /** Gets the runtime base id for the given id. */ function getBase(id) { - const count = U32[rtti >>> 2]; + const count = U32[rttiBase >>> 2]; if ((id >>>= 0) >= count) throw Error("invalid id: " + id); - return U32[(rtti + 4 >>> 2) + id * 2 + 1]; + return U32[(rttiBase + 4 >>> 2) + id * 2 + 1]; } /** Gets the runtime alignment of a collection's values or keys. */ @@ -217,7 +217,7 @@ function postInstantiate(baseModule, instance) { /** Tests whether an object is an instance of the class represented by the specified base id. */ function __instanceof(ref, baseId) { var id = U32[(ref + ID_OFFSET) >>> 2]; - if (id <= U32[rtti >>> 2]) { + if (id <= U32[rttiBase >>> 2]) { do if (id == baseId) return true; while (id = getBase(id)); } @@ -308,7 +308,11 @@ function demangle(exports, baseModule) { let ctor = function(...args) { return ctor.wrap(ctor.prototype.constructor(0, ...args)); }; - ctor.prototype = {}; + ctor.prototype = { + valueOf: function valueOf() { + return this[THIS]; + } + }; ctor.wrap = function(thisValue) { return Object.create(ctor.prototype, { [THIS]: { value: thisValue, writable: false } }); }; diff --git a/lib/loader/tests/build/untouched.wasm b/lib/loader/tests/build/untouched.wasm index 32f23c62b7885f10f39a3b7eb99ce99a1dbbb4b7..fd6471c9dcec11253664018e36154597da8cc9ce 100644 GIT binary patch delta 1226 zcmYjP&u<%55Pm;**M4hf(=_qgX`A=rmIkLWg@WrgRq9m}AShr_4pc?pF3vWNV|$(T z7O5P_0dYf!>LGFAfS~FL4%BB39QgwfQpF7kPFy(kQi<7(6LESo-+VLk&CL6L^RqX; zyfbrcl`(=jVg^DcXWTH%2hjukuV#4p@?56XYKOgE(2mi(Xtkm^-fey8j{=(KH=0|` zo0J=)IO+uhv|#o9xKs7Fw~^F7b`P#PH~gqP3gWASd;Rq=j7Dg6CV_SU+8w1xa|oG> zDVh-fkCvwrZaW-6{d?^=jF8GDNC+v1)z0QqMlT!%hrqdnP<_+8)mm>h^;2AW^?AG9 z@drD>RxsF!JLm-%2m1KYP8(e_KJueP?dj~H(Tak*)H2(Cub03V&FwIb{C0p|)VIi6 zw=al(&<~^g)pj_%kEV~j-N9~*UOMu&qi~2W$MjjI6 z%IWMMYpajxC0xmnhD6GeObMCsu;j6KFxp?tsI0W4@JQU1*&1OG)bFz=6+;>x+gl{+j=M!ju`v%t8?p z!Yl^(u2C(T08xnnwxyZCw3|vW^p8gId=8RqasYZMSWp+lfWRe?2g7ALvpXMxsk&#B83oFhKCe`j%k`?$y@|-te)h)?Q*yUb>VxUQeMuKvJ1 z3xQAFGOdeuQsftR7Q6a)SMjPcT{s;?ApPBl$#F5JX;R(~h! nxq{7;bHZ;SPEr3Y-_5(irpHi8Z>bip=^xYzzC3=SekK0_P+pWc0IkxSVM2od)wdQ%j(gGFXxvNts0E3jd6@LN zXj{A+Cf4;ze!l4>(L2<2y5VqW;mgiJoF-v6LRZY&ux-ngh_;6$hjD4B+n%=|JY%gn806UG{U6N~+m|b%HzvTlgv=g~ms>*{(*qtbfJ&On{Ilh3WD7 zIT{d2fk2O>lhjF@AW6*^{D(yMT31m?mxLgO1xjEpvk}C(!gv`OPtn0Zwk=f%K4;1$yJ>+M$V5bF@NPq1Q zX1}=vHs6(Q;Z5^*X@bw1sJwyCnUnGjKz=GWVEw0j8JEmjMe$9~ z^RAoMDy^ap2AT((UIXSG6wPOqxA3z0w=%|M6IHiy#e7-a!8P+swdR~xpcE__Qu`RM znNMna%NG^(U~=&6cVNoah$O+&=8swlFU`ct6^x&mZJu8v3r+jyNIK9+a!DTq8)mfH ztUe2T+$O%aV8shnTLzb`#_apmdl=j^b*-@Mb30^sLlTtDo_eEL@_hOjs+ez82ft{F N^-H)td%6B2`41=L=c@n! diff --git a/lib/loader/tests/index.js b/lib/loader/tests/index.js index 3938e345..c45ab474 100644 --- a/lib/loader/tests/index.js +++ b/lib/loader/tests/index.js @@ -111,6 +111,7 @@ car.openDoors(); assert.strictEqual(car.isDoorsOpen, 1); car.closeDoors(); assert.strictEqual(car.isDoorsOpen, 0); +module.__release(car); // uses Car.prototype.valueOf to obtain `thisPtr` // should be able to use trace module.dotrace(42); diff --git a/lib/parse/build/index.wat b/lib/parse/build/index.wat index 84a5cab8..1d63582a 100644 --- a/lib/parse/build/index.wat +++ b/lib/parse/build/index.wat @@ -300,16 +300,16 @@ i32.lt_u if call $assembly/index/readVaruint - local.set $2 + local.set $4 call $assembly/index/readVaruint local.set $3 i32.const 0 - local.set $4 - i32.const 0 local.set $5 - local.get $2 + i32.const 0 + local.set $2 + local.get $4 if - local.get $2 + local.get $4 i32.const 11 i32.gt_u if @@ -319,10 +319,9 @@ global.get $assembly/index/off local.set $6 call $assembly/index/readVaruint - local.set $5 - local.get $5 + local.tee $2 global.get $assembly/index/off - local.tee $4 + local.tee $5 i32.add global.set $assembly/index/off local.get $3 @@ -332,12 +331,12 @@ i32.sub local.set $3 end - local.get $2 + local.get $4 global.get $assembly/index/off local.tee $6 local.get $3 - local.get $4 local.get $5 + local.get $2 call $assembly/options/onSection if block $break|1 @@ -351,16 +350,16 @@ block $case3|1 block $case2|1 block $case1|1 - local.get $2 + local.get $4 i32.const 1 i32.ne if - local.get $2 + local.get $4 i32.const 2 i32.eq br_if $case1|1 block $tablify|0 - local.get $2 + local.get $4 br_table $case8|1 $tablify|0 $tablify|0 $case2|1 $case3|1 $case4|1 $case5|1 $case6|1 $case7|1 $case11|1 $case11|1 $case11|1 $tablify|0 end br $case12|1 @@ -368,13 +367,13 @@ call $assembly/index/readVaruint local.set $4 i32.const 0 - local.set $3 + local.set $2 loop $repeat|2 - local.get $3 + local.get $2 local.get $4 i32.lt_u if - local.get $3 + local.get $2 i32.const 7 call $assembly/index/readVarint i32.const 127 @@ -383,53 +382,53 @@ call $assembly/index/readVaruint local.set $5 i32.const 0 - local.set $2 + local.set $3 loop $repeat|3 - local.get $2 + local.get $3 local.get $5 i32.lt_u if - local.get $3 local.get $2 + local.get $3 i32.const 7 call $assembly/index/readVarint i32.const 127 i32.and call $assembly/options/onTypeParam - local.get $2 + local.get $3 i32.const 1 i32.add - local.set $2 + local.set $3 br $repeat|3 end end call $assembly/index/readVaruint local.set $5 i32.const 0 - local.set $2 + local.set $3 loop $repeat|4 - local.get $2 + local.get $3 local.get $5 i32.lt_u if - local.get $3 local.get $2 + local.get $3 i32.const 7 call $assembly/index/readVarint i32.const 127 i32.and call $assembly/options/onTypeReturn - local.get $2 + local.get $3 i32.const 1 i32.add - local.set $2 + local.set $3 br $repeat|4 end end - local.get $3 + local.get $2 i32.const 1 i32.add - local.set $3 + local.set $2 br $repeat|2 end end @@ -438,14 +437,14 @@ call $assembly/index/readVaruint local.set $7 i32.const 0 - local.set $3 + local.set $4 loop $repeat|5 - local.get $3 + local.get $4 local.get $7 i32.lt_u if call $assembly/index/readVaruint - local.tee $4 + local.tee $3 global.get $assembly/index/off local.tee $5 i32.add @@ -464,10 +463,10 @@ i32.const 1 i32.add global.set $assembly/index/off - local.get $3 + local.get $4 local.get $2 local.get $5 - local.get $4 + local.get $3 local.get $8 local.get $6 call $assembly/options/onImport @@ -483,11 +482,11 @@ i32.sub br_table $case1|6 $case2|6 $case3|6 $case4|6 end - local.get $0 + local.get $10 local.tee $2 i32.const 1 i32.add - local.set $0 + local.set $10 local.get $2 call $assembly/index/readVaruint call $assembly/options/onFunctionImport @@ -497,16 +496,16 @@ call $assembly/index/readVarint i32.const 127 i32.and - local.set $4 + local.set $3 call $assembly/index/readVaruint local.set $5 - local.get $10 + local.get $0 local.tee $2 i32.const 1 i32.add - local.set $10 + local.set $0 local.get $2 - local.get $4 + local.get $3 call $assembly/index/readVaruint local.get $5 i32.const 1 @@ -521,7 +520,7 @@ br $break|6 end call $assembly/index/readVaruint - local.set $4 + local.set $3 local.get $11 local.tee $2 i32.const 1 @@ -529,7 +528,7 @@ local.set $11 local.get $2 call $assembly/index/readVaruint - local.get $4 + local.get $3 i32.const 1 i32.and if (result i32) @@ -537,7 +536,7 @@ else i32.const 65535 end - local.get $4 + local.get $3 call $assembly/options/onMemoryImport br $break|6 end @@ -557,10 +556,10 @@ end unreachable end - local.get $3 + local.get $4 i32.const 1 i32.add - local.set $3 + local.set $4 br $repeat|5 end end @@ -575,11 +574,11 @@ local.get $4 i32.lt_u if - local.get $0 + local.get $10 local.tee $2 i32.const 1 i32.add - local.set $0 + local.set $10 local.get $2 call $assembly/index/readVaruint call $assembly/options/onFunction @@ -595,25 +594,25 @@ call $assembly/index/readVaruint local.set $7 i32.const 0 - local.set $3 + local.set $4 loop $repeat|8 - local.get $3 + local.get $4 local.get $7 i32.lt_u if call $assembly/index/readVaruint i32.const 127 i32.and - local.set $4 + local.set $3 call $assembly/index/readVaruint local.set $5 - local.get $10 + local.get $0 local.tee $2 i32.const 1 i32.add - local.set $10 + local.set $0 local.get $2 - local.get $4 + local.get $3 call $assembly/index/readVaruint local.get $5 i32.const 1 @@ -625,10 +624,10 @@ end local.get $5 call $assembly/options/onTable - local.get $3 + local.get $4 i32.const 1 i32.add - local.set $3 + local.set $4 br $repeat|8 end end @@ -707,12 +706,12 @@ br $break|1 end call $assembly/index/readVaruint - local.set $2 - i32.const 0 local.set $3 + i32.const 0 + local.set $2 loop $repeat|11 - local.get $3 local.get $2 + local.get $3 i32.lt_u if call $assembly/index/readVaruint @@ -729,16 +728,16 @@ i32.const 1 i32.add global.set $assembly/index/off - local.get $3 + local.get $2 local.get $7 call $assembly/index/readVaruint local.get $5 local.get $4 call $assembly/options/onExport - local.get $3 + local.get $2 i32.const 1 i32.add - local.set $3 + local.set $2 br $repeat|11 end end @@ -748,11 +747,11 @@ call $assembly/options/onStart br $break|1 end - local.get $5 + local.get $2 i32.const 4 i32.eq if (result i32) - local.get $4 + local.get $5 i32.load i32.const 1701667182 i32.eq @@ -790,12 +789,12 @@ br $break|12 end call $assembly/index/readVaruint - local.set $3 - i32.const 0 local.set $2 + i32.const 0 + local.set $3 loop $repeat|13 - local.get $2 local.get $3 + local.get $2 i32.lt_u if call $assembly/index/readVaruint @@ -810,10 +809,10 @@ local.get $8 local.get $7 call $assembly/options/onFunctionName - local.get $2 + local.get $3 i32.const 1 i32.add - local.set $2 + local.set $3 br $repeat|13 end end @@ -876,11 +875,11 @@ global.set $assembly/index/off br $break|1 else - local.get $5 + local.get $2 i32.const 16 i32.eq if (result i32) - local.get $4 + local.get $5 i64.load i64.const 7011371672682196851 i64.eq @@ -888,7 +887,7 @@ i32.const 0 end if (result i32) - local.get $4 + local.get $5 i32.const 8 i32.add i64.load diff --git a/lib/parse/index.js b/lib/parse/index.js index 9c6ea076..79b2952d 100644 --- a/lib/parse/index.js +++ b/lib/parse/index.js @@ -1,2 +1,2 @@ -!function(A,B){"object"==typeof exports&&"object"==typeof module?module.exports=B():"function"==typeof define&&define.amd?define([],B):"object"==typeof exports?exports.asparse=B():A.asparse=B()}("undefined"!=typeof self?self:this,function(){return function(A){var B={};function n(e){if(B[e])return B[e].exports;var o=B[e]={i:e,l:!1,exports:{}};return A[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=A,n.c=B,n.d=function(A,B,e){n.o(A,B)||Object.defineProperty(A,B,{enumerable:!0,get:e})},n.r=function(A){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})},n.t=function(A,B){if(1&B&&(A=n(A)),8&B)return A;if(4&B&&"object"==typeof A&&A&&A.__esModule)return A;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:A}),2&B&&"string"!=typeof A)for(var o in A)n.d(e,o,function(B){return A[B]}.bind(null,o));return e},n.n=function(A){var B=A&&A.__esModule?function(){return A.default}:function(){return A};return n.d(B,"a",B),B},n.o=function(A,B){return Object.prototype.hasOwnProperty.call(A,B)},n.p="",n(n.s=0)}([function(A,B,n){A.exports=n(1)},function(A,B,n){"use strict";B.__esModule=!0;var e=n(2);B.Type=e.Type,B.SectionId=e.SectionId,B.ExternalKind=e.ExternalKind;var o=null;B.parse=function A(B,n){n||(n={}),o||(o=new WebAssembly.Module(function(A){var B=A.length;if(B){for(var n=0,e=B;--e%4>1&&61===A.charCodeAt(e);)++n;B=Math.ceil(3*B)/4-n}for(var o=new Uint8Array(B),E=0,t=0,C=0,I=0,r=A.length;I1)break;if(void 0===(i=Q[i]))throw Error();switch(E){case 0:C=i,E=1;break;case 1:o[t++]=C<<2|(48&i)>>4,C=i,E=2;break;case 2:o[t++]=(15&C)<<4|(60&i)>>2,C=i,E=3;break;case 3:o[t++]=(3&C)<<6|i,E=0}}if(1===E)throw Error();return o}("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")));var e=B.length,E=(e+65535&-65536)>>16,t=new WebAssembly.Memory({initial:E}),C=new Uint8Array(t.buffer);C.set(B),A.readString=function(A,B){return function(A,B,n){if(n-B<1)return"";for(var e=null,o=[],Q=0,E=0;B191&&E<224?o[Q++]=(31&E)<<6|63&A[B++]:E>239&&E<365?(E=((7&E)<<18|(63&A[B++])<<12|(63&A[B++])<<6|63&A[B++])-65536,o[Q++]=55296+(E>>10),o[Q++]=56320+(1023&E)):o[Q++]=(15&E)<<12|(63&A[B++])<<6|63&A[B++],Q>8191&&((e||(e=[])).push(String.fromCharCode.apply(String,o)),Q=0);return e?(Q&&e.push(String.fromCharCode.apply(String,o.slice(0,Q))),e.join("")):String.fromCharCode.apply(String,o.slice(0,Q))}(C,A,A+B)};var I={env:{memory:t},options:{}};["onSection","onType","onTypeParam","onTypeReturn","onImport","onFunctionImport","onTableImport","onMemoryImport","onGlobalImport","onMemory","onFunction","onTable","onGlobal","onExport","onStart","onSourceMappingURL","onModuleName","onFunctionName","onLocalName"].forEach(function(A){return I.options[A]=n[A]||function(){}}),new WebAssembly.Instance(o,I).exports.parse(0,e)};for(var Q=new Array(123),E=0;E<64;)Q[E<26?E+65:E<52?E+71:E<62?E-4:E-59|43]=E++},function(A,B,n){"use strict";B.__esModule=!0,function(A){A[A.i32=127]="i32",A[A.i64=126]="i64",A[A.f32=125]="f32",A[A.f64=124]="f64",A[A.anyfunc=112]="anyfunc",A[A.func=96]="func",A[A.none=64]="none"}(B.Type||(B.Type={})),function(A){A[A.Custom=0]="Custom",A[A.Type=1]="Type",A[A.Import=2]="Import",A[A.Function=3]="Function",A[A.Table=4]="Table",A[A.Memory=5]="Memory",A[A.Global=6]="Global",A[A.Export=7]="Export",A[A.Start=8]="Start",A[A.Element=9]="Element",A[A.Code=10]="Code",A[A.Data=11]="Data"}(B.SectionId||(B.SectionId={})),function(A){A[A.Function=0]="Function",A[A.Table=1]="Table",A[A.Memory=2]="Memory",A[A.Global=3]="Global"}(B.ExternalKind||(B.ExternalKind={})),function(A){A[A.Module=0]="Module",A[A.Function=1]="Function",A[A.Local=2]="Local"}(B.NameType||(B.NameType={})),B.MAX_PAGES=65535,B.MAX_ELEMS=4294967295,function(A){A[A.end=11]="end",A[A.get_global=35]="get_global",A[A.i32_const=65]="i32_const",A[A.i64_const=66]="i64_const",A[A.f32_const=67]="f32_const",A[A.f64_const=68]="f64_const"}(B.Opcode||(B.Opcode={}))}])}); +!function(A,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.asparse=e():A.asparse=e()}("undefined"!=typeof self?self:this,function(){return function(A){var e={};function n(o){if(e[o])return e[o].exports;var Q=e[o]={i:o,l:!1,exports:{}};return A[o].call(Q.exports,Q,Q.exports,n),Q.l=!0,Q.exports}return n.m=A,n.c=e,n.d=function(A,e,o){n.o(A,e)||Object.defineProperty(A,e,{enumerable:!0,get:o})},n.r=function(A){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})},n.t=function(A,e){if(1&e&&(A=n(A)),8&e)return A;if(4&e&&"object"==typeof A&&A&&A.__esModule)return A;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:A}),2&e&&"string"!=typeof A)for(var Q in A)n.d(o,Q,function(e){return A[e]}.bind(null,Q));return o},n.n=function(A){var e=A&&A.__esModule?function(){return A.default}:function(){return A};return n.d(e,"a",e),e},n.o=function(A,e){return Object.prototype.hasOwnProperty.call(A,e)},n.p="",n(n.s=0)}([function(A,e,n){A.exports=n(1)},function(A,e,n){"use strict";e.__esModule=!0;var o=n(2);e.Type=o.Type,e.SectionId=o.SectionId,e.ExternalKind=o.ExternalKind;var Q=null;e.parse=function A(e,n){n||(n={}),Q||(Q=new WebAssembly.Module(function(A){var e=A.length;if(e){for(var n=0,o=e;--o%4>1&&61===A.charCodeAt(o);)++n;e=Math.ceil(3*e)/4-n}for(var Q=new Uint8Array(e),B=0,I=0,E=0,r=0,i=A.length;r1)break;if(void 0===(C=t[C]))throw Error();switch(B){case 0:E=C,B=1;break;case 1:Q[I++]=E<<2|(48&C)>>4,E=C,B=2;break;case 2:Q[I++]=(15&E)<<4|(60&C)>>2,E=C,B=3;break;case 3:Q[I++]=(3&E)<<6|C,B=0}}if(1===B)throw Error();return Q}("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")));var o=e.length,B=(o+65535&-65536)>>16,I=new WebAssembly.Memory({initial:B}),E=new Uint8Array(I.buffer);E.set(e),A.readString=function(A,e){return function(A,e,n){if(n-e<1)return"";for(var o=null,Q=[],t=0,B=0;e191&&B<224?Q[t++]=(31&B)<<6|63&A[e++]:B>239&&B<365?(B=((7&B)<<18|(63&A[e++])<<12|(63&A[e++])<<6|63&A[e++])-65536,Q[t++]=55296+(B>>10),Q[t++]=56320+(1023&B)):Q[t++]=(15&B)<<12|(63&A[e++])<<6|63&A[e++],t>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,Q)),t=0);return o?(t&&o.push(String.fromCharCode.apply(String,Q.slice(0,t))),o.join("")):String.fromCharCode.apply(String,Q.slice(0,t))}(E,A,A+e)};var r={env:{memory:I},options:{}};["onSection","onType","onTypeParam","onTypeReturn","onImport","onFunctionImport","onTableImport","onMemoryImport","onGlobalImport","onMemory","onFunction","onTable","onGlobal","onExport","onStart","onSourceMappingURL","onModuleName","onFunctionName","onLocalName"].forEach(function(A){return r.options[A]=n[A]||function(){}}),new WebAssembly.Instance(Q,r).exports.parse(0,o)};for(var t=new Array(123),B=0;B<64;)t[B<26?B+65:B<52?B+71:B<62?B-4:B-59|43]=B++},function(A,e,n){"use strict";e.__esModule=!0,function(A){A[A.i32=127]="i32",A[A.i64=126]="i64",A[A.f32=125]="f32",A[A.f64=124]="f64",A[A.anyfunc=112]="anyfunc",A[A.func=96]="func",A[A.none=64]="none"}(e.Type||(e.Type={})),function(A){A[A.Custom=0]="Custom",A[A.Type=1]="Type",A[A.Import=2]="Import",A[A.Function=3]="Function",A[A.Table=4]="Table",A[A.Memory=5]="Memory",A[A.Global=6]="Global",A[A.Export=7]="Export",A[A.Start=8]="Start",A[A.Element=9]="Element",A[A.Code=10]="Code",A[A.Data=11]="Data"}(e.SectionId||(e.SectionId={})),function(A){A[A.Function=0]="Function",A[A.Table=1]="Table",A[A.Memory=2]="Memory",A[A.Global=3]="Global"}(e.ExternalKind||(e.ExternalKind={})),function(A){A[A.Module=0]="Module",A[A.Function=1]="Function",A[A.Local=2]="Local"}(e.NameType||(e.NameType={})),e.MAX_PAGES=65535,e.MAX_ELEMS=4294967295,function(A){A[A.end=11]="end",A[A.get_global=35]="get_global",A[A.i32_const=65]="i32_const",A[A.i64_const=66]="i64_const",A[A.f32_const=67]="f32_const",A[A.f64_const=68]="f64_const"}(e.Opcode||(e.Opcode={}))}])}); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/parse/index.js.map b/lib/parse/index.js.map index 174cbb98..0253c777 100644 --- a/lib/parse/index.js.map +++ b/lib/parse/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://asparse/webpack/universalModuleDefinition","webpack://asparse/webpack/bootstrap","webpack://asparse/./src/index.ts","webpack://asparse/./src/common.ts"],"names":["root","factory","exports","module","define","amd","self","this","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","common_1","Type","SectionId","ExternalKind","compiled","parse","binary","options","WebAssembly","Module","string","length","charCodeAt","Math","ceil","buffer","Uint8Array","j","k","undefined","s64","Error","base64_decode","nBytes","nPages","memory","Memory","initial","set","readString","offset","start","end","parts","chunk","push","String","fromCharCode","apply","slice","join","utf8_read","imports","env","forEach","Instance","Array","NameType","MAX_PAGES","MAX_ELEMS","Opcode"],"mappings":"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","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"asparse\"] = factory();\n\telse\n\t\troot[\"asparse\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","\"use strict\";\r\nexports.__esModule = true;\r\nvar common_1 = require(\"./common\");\r\nexports.Type = common_1.Type;\r\nexports.SectionId = common_1.SectionId;\r\nexports.ExternalKind = common_1.ExternalKind;\r\n/** Cached compiled parser. */\r\nvar compiled = null;\r\nif (typeof WASM_DATA !== \"string\")\r\n WASM_DATA = require(\"fs\").readFileSync(__dirname + \"/../build/index.wasm\", \"base64\");\r\n/** Parses the contents of a WebAssembly binary according to the specified options. */\r\nfunction parse(binary, options) {\r\n if (!options)\r\n options = {};\r\n // compile the parser if not yet compiled\r\n if (!compiled)\r\n compiled = new WebAssembly.Module(base64_decode(WASM_DATA));\r\n // use the binary as the parser's memory\r\n var nBytes = binary.length;\r\n var nPages = ((nBytes + 0xffff) & ~0xffff) >> 16;\r\n var memory = new WebAssembly.Memory({ initial: nPages });\r\n var buffer = new Uint8Array(memory.buffer);\r\n buffer.set(binary);\r\n // provide a way to read strings from memory\r\n parse.readString = function (offset, length) { return utf8_read(buffer, offset, offset + length); };\r\n // instantiate the parser and return its exports\r\n var imports = {\r\n env: {\r\n memory: memory\r\n },\r\n options: {}\r\n };\r\n [\"onSection\",\r\n \"onType\",\r\n \"onTypeParam\",\r\n \"onTypeReturn\",\r\n \"onImport\",\r\n \"onFunctionImport\",\r\n \"onTableImport\",\r\n \"onMemoryImport\",\r\n \"onGlobalImport\",\r\n \"onMemory\",\r\n \"onFunction\",\r\n \"onTable\",\r\n \"onGlobal\",\r\n \"onExport\",\r\n \"onStart\",\r\n \"onSourceMappingURL\",\r\n \"onModuleName\",\r\n \"onFunctionName\",\r\n \"onLocalName\"\r\n ].forEach(function (name) { return imports.options[name] = options[name] || function () { }; });\r\n var instance = new WebAssembly.Instance(compiled, imports);\r\n instance.exports.parse(0, nBytes);\r\n}\r\nexports.parse = parse;\r\n// see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/utf8\r\nfunction utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null, chunk = [], i = 0, // char offset\r\n t = 0; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128) {\r\n chunk[i++] = t;\r\n }\r\n else if (t > 191 && t < 224) {\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n }\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n }\r\n else {\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n}\r\n// see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/base64\r\nfunction base64_decode(string) {\r\n var length = string.length;\r\n if (length) {\r\n var n = 0, p = length;\r\n while (--p % 4 > 1 && string.charCodeAt(p) === 61)\r\n ++n;\r\n length = Math.ceil(length * 3) / 4 - n;\r\n }\r\n var buffer = new Uint8Array(length);\r\n var j = 0, o = 0, t = 0;\r\n for (var i = 0, k = string.length; i < k;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error();\r\n switch (j) {\r\n case 0: {\r\n t = c;\r\n j = 1;\r\n break;\r\n }\r\n case 1: {\r\n buffer[o++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n }\r\n case 2: {\r\n buffer[o++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n }\r\n case 3: {\r\n buffer[o++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n }\r\n if (j === 1)\r\n throw Error();\r\n return buffer;\r\n}\r\nvar s64 = new Array(123);\r\nfor (var i = 0; i < 64;)\r\n s64[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n","\"use strict\";\r\n/** Common constants shared between AssemblyScript and TypeScript. */\r\nexports.__esModule = true;\r\n/** WebAssembly types. */\r\nvar Type;\r\n(function (Type) {\r\n Type[Type[\"i32\"] = 127] = \"i32\";\r\n Type[Type[\"i64\"] = 126] = \"i64\";\r\n Type[Type[\"f32\"] = 125] = \"f32\";\r\n Type[Type[\"f64\"] = 124] = \"f64\";\r\n Type[Type[\"anyfunc\"] = 112] = \"anyfunc\";\r\n Type[Type[\"func\"] = 96] = \"func\";\r\n Type[Type[\"none\"] = 64] = \"none\";\r\n})(Type = exports.Type || (exports.Type = {}));\r\n/** WebAssembly section ids. */\r\nvar SectionId;\r\n(function (SectionId) {\r\n SectionId[SectionId[\"Custom\"] = 0] = \"Custom\";\r\n SectionId[SectionId[\"Type\"] = 1] = \"Type\";\r\n SectionId[SectionId[\"Import\"] = 2] = \"Import\";\r\n SectionId[SectionId[\"Function\"] = 3] = \"Function\";\r\n SectionId[SectionId[\"Table\"] = 4] = \"Table\";\r\n SectionId[SectionId[\"Memory\"] = 5] = \"Memory\";\r\n SectionId[SectionId[\"Global\"] = 6] = \"Global\";\r\n SectionId[SectionId[\"Export\"] = 7] = \"Export\";\r\n SectionId[SectionId[\"Start\"] = 8] = \"Start\";\r\n SectionId[SectionId[\"Element\"] = 9] = \"Element\";\r\n SectionId[SectionId[\"Code\"] = 10] = \"Code\";\r\n SectionId[SectionId[\"Data\"] = 11] = \"Data\";\r\n})(SectionId = exports.SectionId || (exports.SectionId = {}));\r\n/** WebAssembly external kinds. */\r\nvar ExternalKind;\r\n(function (ExternalKind) {\r\n ExternalKind[ExternalKind[\"Function\"] = 0] = \"Function\";\r\n ExternalKind[ExternalKind[\"Table\"] = 1] = \"Table\";\r\n ExternalKind[ExternalKind[\"Memory\"] = 2] = \"Memory\";\r\n ExternalKind[ExternalKind[\"Global\"] = 3] = \"Global\";\r\n})(ExternalKind = exports.ExternalKind || (exports.ExternalKind = {}));\r\n/** Name section types. */\r\nvar NameType;\r\n(function (NameType) {\r\n NameType[NameType[\"Module\"] = 0] = \"Module\";\r\n NameType[NameType[\"Function\"] = 1] = \"Function\";\r\n NameType[NameType[\"Local\"] = 2] = \"Local\";\r\n})(NameType = exports.NameType || (exports.NameType = {}));\r\n/** Maximum number of memory pages. */\r\nexports.MAX_PAGES = 0xffff;\r\n/** Maximum number of table elements. */\r\nexports.MAX_ELEMS = 0xffffffff;\r\n/** WebAssembly opcodes. */\r\nvar Opcode;\r\n(function (Opcode) {\r\n // unreachable = 0x00,\r\n // nop = 0x01,\r\n // block = 0x02,\r\n // loop = 0x03,\r\n // if_ = 0x04,\r\n // else_ = 0x05,\r\n Opcode[Opcode[\"end\"] = 11] = \"end\";\r\n // br = 0x0c,\r\n // br_if = 0x0d,\r\n // br_table = 0x0e,\r\n // return_ = 0x0f,\r\n // call = 0x10,\r\n // call_indirect = 0x11,\r\n // drop = 0x1a,\r\n // select = 0x1b,\r\n // get_local = 0x20,\r\n // set_local = 0x21,\r\n // tee_local = 0x22,\r\n Opcode[Opcode[\"get_global\"] = 35] = \"get_global\";\r\n // set_global = 0x24,\r\n // i32_load = 0x28,\r\n // i64_load = 0x29,\r\n // f32_load = 0x2a,\r\n // f64_load = 0x2b,\r\n // i32_load8_s = 0x2c,\r\n // i32_load8_u = 0x2d,\r\n // i32_load16_s = 0x2e,\r\n // i32_load16_u = 0x2f,\r\n // i64_load8_s = 0x30,\r\n // i64_load8_u = 0x31,\r\n // i64_load16_s = 0x32,\r\n // i64_load16_u = 0x33,\r\n // i64_load32_s = 0x34,\r\n // i64_load32_u = 0x35,\r\n // i32_store = 0x36,\r\n // i64_store = 0x37,\r\n // f32_store = 0x38,\r\n // f64_store = 0x39,\r\n // i32_store8 = 0x3a,\r\n // i32_store16 = 0x3b,\r\n // i64_store8 = 0x3c,\r\n // i64_store16 = 0x3d,\r\n // i64_store32 = 0x3e,\r\n // current_memory = 0x3f,\r\n // grow_memory = 0x40,\r\n Opcode[Opcode[\"i32_const\"] = 65] = \"i32_const\";\r\n Opcode[Opcode[\"i64_const\"] = 66] = \"i64_const\";\r\n Opcode[Opcode[\"f32_const\"] = 67] = \"f32_const\";\r\n Opcode[Opcode[\"f64_const\"] = 68] = \"f64_const\";\r\n // i32_eqz = 0x45,\r\n // i32_eq = 0x46,\r\n // i32_ne = 0x47,\r\n // i32_lt_s = 0x48,\r\n // i32_lt_u = 0x49,\r\n // i32_gt_s = 0x4a,\r\n // i32_gt_u = 0x4b,\r\n // i32_le_s = 0x4c,\r\n // i32_le_u = 0x4d,\r\n // i32_ge_s = 0x4e,\r\n // i32_ge_u = 0x4f,\r\n // i64_eqz = 0x50,\r\n // i64_eq = 0x51,\r\n // i64_ne = 0x52,\r\n // i64_lt_s = 0x53,\r\n // i64_lt_u = 0x54,\r\n // i64_gt_s = 0x55,\r\n // i64_gt_u = 0x56,\r\n // i64_le_s = 0x57,\r\n // i64_le_u = 0x58,\r\n // i64_ge_s = 0x59,\r\n // i64_ge_u = 0x5a,\r\n // f32_eq = 0x5b,\r\n // f32_ne = 0x5c,\r\n // f32_lt = 0x5d,\r\n // f32_gt = 0x5e,\r\n // f32_le = 0x5f,\r\n // f32_ge = 0x60,\r\n // f64_eq = 0x61,\r\n // f64_ne = 0x62,\r\n // f64_lt = 0x63,\r\n // f64_gt = 0x64,\r\n // f64_le = 0x65,\r\n // f64_ge = 0x66,\r\n // i32_clz = 0x67,\r\n // i32_ctz = 0x68,\r\n // i32_popcnt = 0x69,\r\n // i32_add = 0x6a,\r\n // i32_sub = 0x6b,\r\n // i32_mul = 0x6c,\r\n // i32_div_s = 0x6d,\r\n // i32_div_u = 0x6e,\r\n // i32_rem_s = 0x6f,\r\n // i32_rem_u = 0x70,\r\n // i32_and = 0x71,\r\n // i32_or = 0x72,\r\n // i32_xor = 0x73,\r\n // i32_shl = 0x74,\r\n // i32_shr_s = 0x75,\r\n // i32_shr_u = 0x76,\r\n // i32_rotl = 0x77,\r\n // i32_rotr = 0x78,\r\n // i64_clz = 0x79,\r\n // i64_ctz = 0x7a,\r\n // i64_popcnt = 0x7b,\r\n // i64_add = 0x7c,\r\n // i64_sub = 0x7d,\r\n // i64_mul = 0x7e,\r\n // i64_div_s = 0x7f,\r\n // i64_div_u = 0x80,\r\n // i64_rem_s = 0x81,\r\n // i64_rem_u = 0x82,\r\n // i64_and = 0x83,\r\n // i64_or = 0x84,\r\n // i64_xor = 0x85,\r\n // i64_shl = 0x86,\r\n // i64_shr_s = 0x87,\r\n // i64_shr_u = 0x88,\r\n // i64_rotl = 0x89,\r\n // i64_rotr = 0x8a,\r\n // f32_abs = 0x8b,\r\n // f32_neg = 0x8c,\r\n // f32_ceil = 0x8d,\r\n // f32_floor = 0x8e,\r\n // f32_trunc = 0x8f,\r\n // f32_nearest = 0x90,\r\n // f32_sqrt = 0x91,\r\n // f32_add = 0x92,\r\n // f32_sub = 0x93,\r\n // f32_mul = 0x94,\r\n // f32_div = 0x95,\r\n // f32_min = 0x96,\r\n // f32_max = 0x97,\r\n // f32_copysign = 0x98,\r\n // f64_abs = 0x99,\r\n // f64_neg = 0x9a,\r\n // f64_ceil = 0x9b,\r\n // f64_floor = 0x9c,\r\n // f64_trunc = 0x9d,\r\n // f64_nearest = 0x9e,\r\n // f64_sqrt = 0x9f,\r\n // f64_add = 0xa0,\r\n // f64_sub = 0xa1,\r\n // f64_mul = 0xa2,\r\n // f64_div = 0xa3,\r\n // f64_min = 0xa4,\r\n // f64_max = 0xa5,\r\n // f64_copysign = 0xa6,\r\n // i32_wrap_i64 = 0xa7,\r\n // i32_trunc_s_f32 = 0xa8,\r\n // i32_trunc_u_f32 = 0xa9,\r\n // i32_trunc_s_f64 = 0xaa,\r\n // i32_trunc_u_f64 = 0xab,\r\n // i64_extend_s_i32 = 0xac,\r\n // i64_extend_u_i32 = 0xad,\r\n // i64_trunc_s_f32 = 0xae,\r\n // i64_trunc_u_f32 = 0xaf,\r\n // i64_trunc_s_f64 = 0xb0,\r\n // i64_trunc_u_f64 = 0xb1,\r\n // f32_convert_s_i32 = 0xb2,\r\n // f32_convert_u_i32 = 0xb3,\r\n // f32_convert_s_i64 = 0xb4,\r\n // f32_convert_u_i64 = 0xb5,\r\n // f32_demote_f64 = 0xb6,\r\n // f64_convert_s_i32 = 0xb7,\r\n // f64_convert_u_i32 = 0xb8,\r\n // f64_convert_s_i64 = 0xb9,\r\n // f64_convert_u_i64 = 0xba,\r\n // f64_promote_f32 = 0xbb,\r\n // i32_reinterpret_f32 = 0xbc,\r\n // i64_reinterpret_f64 = 0xbd,\r\n // f32_reinterpret_i32 = 0xbe,\r\n // f64_reinterpret_i64 = 0xbf\r\n})(Opcode = exports.Opcode || (exports.Opcode = {}));\r\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://asparse/webpack/universalModuleDefinition","webpack://asparse/webpack/bootstrap","webpack://asparse/./src/index.ts","webpack://asparse/./src/common.ts"],"names":["root","factory","exports","module","define","amd","self","this","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","common_1","Type","SectionId","ExternalKind","compiled","parse","binary","options","WebAssembly","Module","string","length","charCodeAt","Math","ceil","buffer","Uint8Array","j","k","undefined","s64","Error","base64_decode","nBytes","nPages","memory","Memory","initial","set","readString","offset","start","end","parts","chunk","push","String","fromCharCode","apply","slice","join","utf8_read","imports","env","forEach","Instance","Array","NameType","MAX_PAGES","MAX_ELEMS","Opcode"],"mappings":"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","file":"index.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"asparse\"] = factory();\n\telse\n\t\troot[\"asparse\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","\"use strict\";\r\nexports.__esModule = true;\r\nvar common_1 = require(\"./common\");\r\nexports.Type = common_1.Type;\r\nexports.SectionId = common_1.SectionId;\r\nexports.ExternalKind = common_1.ExternalKind;\r\n/** Cached compiled parser. */\r\nvar compiled = null;\r\nif (typeof WASM_DATA !== \"string\")\r\n WASM_DATA = require(\"fs\").readFileSync(__dirname + \"/../build/index.wasm\", \"base64\");\r\n/** Parses the contents of a WebAssembly binary according to the specified options. */\r\nfunction parse(binary, options) {\r\n if (!options)\r\n options = {};\r\n // compile the parser if not yet compiled\r\n if (!compiled)\r\n compiled = new WebAssembly.Module(base64_decode(WASM_DATA));\r\n // use the binary as the parser's memory\r\n var nBytes = binary.length;\r\n var nPages = ((nBytes + 0xffff) & ~0xffff) >> 16;\r\n var memory = new WebAssembly.Memory({ initial: nPages });\r\n var buffer = new Uint8Array(memory.buffer);\r\n buffer.set(binary);\r\n // provide a way to read strings from memory\r\n parse.readString = function (offset, length) { return utf8_read(buffer, offset, offset + length); };\r\n // instantiate the parser and return its exports\r\n var imports = {\r\n env: {\r\n memory: memory\r\n },\r\n options: {}\r\n };\r\n [\"onSection\",\r\n \"onType\",\r\n \"onTypeParam\",\r\n \"onTypeReturn\",\r\n \"onImport\",\r\n \"onFunctionImport\",\r\n \"onTableImport\",\r\n \"onMemoryImport\",\r\n \"onGlobalImport\",\r\n \"onMemory\",\r\n \"onFunction\",\r\n \"onTable\",\r\n \"onGlobal\",\r\n \"onExport\",\r\n \"onStart\",\r\n \"onSourceMappingURL\",\r\n \"onModuleName\",\r\n \"onFunctionName\",\r\n \"onLocalName\"\r\n ].forEach(function (name) { return imports.options[name] = options[name] || function () { }; });\r\n var instance = new WebAssembly.Instance(compiled, imports);\r\n instance.exports.parse(0, nBytes);\r\n}\r\nexports.parse = parse;\r\n// see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/utf8\r\nfunction utf8_read(buffer, start, end) {\r\n var len = end - start;\r\n if (len < 1)\r\n return \"\";\r\n var parts = null, chunk = [], i = 0, // char offset\r\n t = 0; // temporary\r\n while (start < end) {\r\n t = buffer[start++];\r\n if (t < 128) {\r\n chunk[i++] = t;\r\n }\r\n else if (t > 191 && t < 224) {\r\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\r\n }\r\n else if (t > 239 && t < 365) {\r\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\r\n chunk[i++] = 0xD800 + (t >> 10);\r\n chunk[i++] = 0xDC00 + (t & 1023);\r\n }\r\n else {\r\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\r\n }\r\n if (i > 8191) {\r\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\r\n i = 0;\r\n }\r\n }\r\n if (parts) {\r\n if (i)\r\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\r\n return parts.join(\"\");\r\n }\r\n return String.fromCharCode.apply(String, chunk.slice(0, i));\r\n}\r\n// see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/base64\r\nfunction base64_decode(string) {\r\n var length = string.length;\r\n if (length) {\r\n var n = 0, p = length;\r\n while (--p % 4 > 1 && string.charCodeAt(p) === 61)\r\n ++n;\r\n length = Math.ceil(length * 3) / 4 - n;\r\n }\r\n var buffer = new Uint8Array(length);\r\n var j = 0, o = 0, t = 0;\r\n for (var i = 0, k = string.length; i < k;) {\r\n var c = string.charCodeAt(i++);\r\n if (c === 61 && j > 1)\r\n break;\r\n if ((c = s64[c]) === undefined)\r\n throw Error();\r\n switch (j) {\r\n case 0: {\r\n t = c;\r\n j = 1;\r\n break;\r\n }\r\n case 1: {\r\n buffer[o++] = t << 2 | (c & 48) >> 4;\r\n t = c;\r\n j = 2;\r\n break;\r\n }\r\n case 2: {\r\n buffer[o++] = (t & 15) << 4 | (c & 60) >> 2;\r\n t = c;\r\n j = 3;\r\n break;\r\n }\r\n case 3: {\r\n buffer[o++] = (t & 3) << 6 | c;\r\n j = 0;\r\n break;\r\n }\r\n }\r\n }\r\n if (j === 1)\r\n throw Error();\r\n return buffer;\r\n}\r\nvar s64 = new Array(123);\r\nfor (var i = 0; i < 64;)\r\n s64[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\r\n","\"use strict\";\r\n/** Common constants shared between AssemblyScript and TypeScript. */\r\nexports.__esModule = true;\r\n/** WebAssembly types. */\r\nvar Type;\r\n(function (Type) {\r\n Type[Type[\"i32\"] = 127] = \"i32\";\r\n Type[Type[\"i64\"] = 126] = \"i64\";\r\n Type[Type[\"f32\"] = 125] = \"f32\";\r\n Type[Type[\"f64\"] = 124] = \"f64\";\r\n Type[Type[\"anyfunc\"] = 112] = \"anyfunc\";\r\n Type[Type[\"func\"] = 96] = \"func\";\r\n Type[Type[\"none\"] = 64] = \"none\";\r\n})(Type = exports.Type || (exports.Type = {}));\r\n/** WebAssembly section ids. */\r\nvar SectionId;\r\n(function (SectionId) {\r\n SectionId[SectionId[\"Custom\"] = 0] = \"Custom\";\r\n SectionId[SectionId[\"Type\"] = 1] = \"Type\";\r\n SectionId[SectionId[\"Import\"] = 2] = \"Import\";\r\n SectionId[SectionId[\"Function\"] = 3] = \"Function\";\r\n SectionId[SectionId[\"Table\"] = 4] = \"Table\";\r\n SectionId[SectionId[\"Memory\"] = 5] = \"Memory\";\r\n SectionId[SectionId[\"Global\"] = 6] = \"Global\";\r\n SectionId[SectionId[\"Export\"] = 7] = \"Export\";\r\n SectionId[SectionId[\"Start\"] = 8] = \"Start\";\r\n SectionId[SectionId[\"Element\"] = 9] = \"Element\";\r\n SectionId[SectionId[\"Code\"] = 10] = \"Code\";\r\n SectionId[SectionId[\"Data\"] = 11] = \"Data\";\r\n})(SectionId = exports.SectionId || (exports.SectionId = {}));\r\n/** WebAssembly external kinds. */\r\nvar ExternalKind;\r\n(function (ExternalKind) {\r\n ExternalKind[ExternalKind[\"Function\"] = 0] = \"Function\";\r\n ExternalKind[ExternalKind[\"Table\"] = 1] = \"Table\";\r\n ExternalKind[ExternalKind[\"Memory\"] = 2] = \"Memory\";\r\n ExternalKind[ExternalKind[\"Global\"] = 3] = \"Global\";\r\n})(ExternalKind = exports.ExternalKind || (exports.ExternalKind = {}));\r\n/** Name section types. */\r\nvar NameType;\r\n(function (NameType) {\r\n NameType[NameType[\"Module\"] = 0] = \"Module\";\r\n NameType[NameType[\"Function\"] = 1] = \"Function\";\r\n NameType[NameType[\"Local\"] = 2] = \"Local\";\r\n})(NameType = exports.NameType || (exports.NameType = {}));\r\n/** Maximum number of memory pages. */\r\nexports.MAX_PAGES = 0xffff;\r\n/** Maximum number of table elements. */\r\nexports.MAX_ELEMS = 0xffffffff;\r\n/** WebAssembly opcodes. */\r\nvar Opcode;\r\n(function (Opcode) {\r\n // unreachable = 0x00,\r\n // nop = 0x01,\r\n // block = 0x02,\r\n // loop = 0x03,\r\n // if_ = 0x04,\r\n // else_ = 0x05,\r\n Opcode[Opcode[\"end\"] = 11] = \"end\";\r\n // br = 0x0c,\r\n // br_if = 0x0d,\r\n // br_table = 0x0e,\r\n // return_ = 0x0f,\r\n // call = 0x10,\r\n // call_indirect = 0x11,\r\n // drop = 0x1a,\r\n // select = 0x1b,\r\n // get_local = 0x20,\r\n // set_local = 0x21,\r\n // tee_local = 0x22,\r\n Opcode[Opcode[\"get_global\"] = 35] = \"get_global\";\r\n // set_global = 0x24,\r\n // i32_load = 0x28,\r\n // i64_load = 0x29,\r\n // f32_load = 0x2a,\r\n // f64_load = 0x2b,\r\n // i32_load8_s = 0x2c,\r\n // i32_load8_u = 0x2d,\r\n // i32_load16_s = 0x2e,\r\n // i32_load16_u = 0x2f,\r\n // i64_load8_s = 0x30,\r\n // i64_load8_u = 0x31,\r\n // i64_load16_s = 0x32,\r\n // i64_load16_u = 0x33,\r\n // i64_load32_s = 0x34,\r\n // i64_load32_u = 0x35,\r\n // i32_store = 0x36,\r\n // i64_store = 0x37,\r\n // f32_store = 0x38,\r\n // f64_store = 0x39,\r\n // i32_store8 = 0x3a,\r\n // i32_store16 = 0x3b,\r\n // i64_store8 = 0x3c,\r\n // i64_store16 = 0x3d,\r\n // i64_store32 = 0x3e,\r\n // current_memory = 0x3f,\r\n // grow_memory = 0x40,\r\n Opcode[Opcode[\"i32_const\"] = 65] = \"i32_const\";\r\n Opcode[Opcode[\"i64_const\"] = 66] = \"i64_const\";\r\n Opcode[Opcode[\"f32_const\"] = 67] = \"f32_const\";\r\n Opcode[Opcode[\"f64_const\"] = 68] = \"f64_const\";\r\n // i32_eqz = 0x45,\r\n // i32_eq = 0x46,\r\n // i32_ne = 0x47,\r\n // i32_lt_s = 0x48,\r\n // i32_lt_u = 0x49,\r\n // i32_gt_s = 0x4a,\r\n // i32_gt_u = 0x4b,\r\n // i32_le_s = 0x4c,\r\n // i32_le_u = 0x4d,\r\n // i32_ge_s = 0x4e,\r\n // i32_ge_u = 0x4f,\r\n // i64_eqz = 0x50,\r\n // i64_eq = 0x51,\r\n // i64_ne = 0x52,\r\n // i64_lt_s = 0x53,\r\n // i64_lt_u = 0x54,\r\n // i64_gt_s = 0x55,\r\n // i64_gt_u = 0x56,\r\n // i64_le_s = 0x57,\r\n // i64_le_u = 0x58,\r\n // i64_ge_s = 0x59,\r\n // i64_ge_u = 0x5a,\r\n // f32_eq = 0x5b,\r\n // f32_ne = 0x5c,\r\n // f32_lt = 0x5d,\r\n // f32_gt = 0x5e,\r\n // f32_le = 0x5f,\r\n // f32_ge = 0x60,\r\n // f64_eq = 0x61,\r\n // f64_ne = 0x62,\r\n // f64_lt = 0x63,\r\n // f64_gt = 0x64,\r\n // f64_le = 0x65,\r\n // f64_ge = 0x66,\r\n // i32_clz = 0x67,\r\n // i32_ctz = 0x68,\r\n // i32_popcnt = 0x69,\r\n // i32_add = 0x6a,\r\n // i32_sub = 0x6b,\r\n // i32_mul = 0x6c,\r\n // i32_div_s = 0x6d,\r\n // i32_div_u = 0x6e,\r\n // i32_rem_s = 0x6f,\r\n // i32_rem_u = 0x70,\r\n // i32_and = 0x71,\r\n // i32_or = 0x72,\r\n // i32_xor = 0x73,\r\n // i32_shl = 0x74,\r\n // i32_shr_s = 0x75,\r\n // i32_shr_u = 0x76,\r\n // i32_rotl = 0x77,\r\n // i32_rotr = 0x78,\r\n // i64_clz = 0x79,\r\n // i64_ctz = 0x7a,\r\n // i64_popcnt = 0x7b,\r\n // i64_add = 0x7c,\r\n // i64_sub = 0x7d,\r\n // i64_mul = 0x7e,\r\n // i64_div_s = 0x7f,\r\n // i64_div_u = 0x80,\r\n // i64_rem_s = 0x81,\r\n // i64_rem_u = 0x82,\r\n // i64_and = 0x83,\r\n // i64_or = 0x84,\r\n // i64_xor = 0x85,\r\n // i64_shl = 0x86,\r\n // i64_shr_s = 0x87,\r\n // i64_shr_u = 0x88,\r\n // i64_rotl = 0x89,\r\n // i64_rotr = 0x8a,\r\n // f32_abs = 0x8b,\r\n // f32_neg = 0x8c,\r\n // f32_ceil = 0x8d,\r\n // f32_floor = 0x8e,\r\n // f32_trunc = 0x8f,\r\n // f32_nearest = 0x90,\r\n // f32_sqrt = 0x91,\r\n // f32_add = 0x92,\r\n // f32_sub = 0x93,\r\n // f32_mul = 0x94,\r\n // f32_div = 0x95,\r\n // f32_min = 0x96,\r\n // f32_max = 0x97,\r\n // f32_copysign = 0x98,\r\n // f64_abs = 0x99,\r\n // f64_neg = 0x9a,\r\n // f64_ceil = 0x9b,\r\n // f64_floor = 0x9c,\r\n // f64_trunc = 0x9d,\r\n // f64_nearest = 0x9e,\r\n // f64_sqrt = 0x9f,\r\n // f64_add = 0xa0,\r\n // f64_sub = 0xa1,\r\n // f64_mul = 0xa2,\r\n // f64_div = 0xa3,\r\n // f64_min = 0xa4,\r\n // f64_max = 0xa5,\r\n // f64_copysign = 0xa6,\r\n // i32_wrap_i64 = 0xa7,\r\n // i32_trunc_s_f32 = 0xa8,\r\n // i32_trunc_u_f32 = 0xa9,\r\n // i32_trunc_s_f64 = 0xaa,\r\n // i32_trunc_u_f64 = 0xab,\r\n // i64_extend_s_i32 = 0xac,\r\n // i64_extend_u_i32 = 0xad,\r\n // i64_trunc_s_f32 = 0xae,\r\n // i64_trunc_u_f32 = 0xaf,\r\n // i64_trunc_s_f64 = 0xb0,\r\n // i64_trunc_u_f64 = 0xb1,\r\n // f32_convert_s_i32 = 0xb2,\r\n // f32_convert_u_i32 = 0xb3,\r\n // f32_convert_s_i64 = 0xb4,\r\n // f32_convert_u_i64 = 0xb5,\r\n // f32_demote_f64 = 0xb6,\r\n // f64_convert_s_i32 = 0xb7,\r\n // f64_convert_u_i32 = 0xb8,\r\n // f64_convert_s_i64 = 0xb9,\r\n // f64_convert_u_i64 = 0xba,\r\n // f64_promote_f32 = 0xbb,\r\n // i32_reinterpret_f32 = 0xbc,\r\n // i64_reinterpret_f64 = 0xbd,\r\n // f32_reinterpret_i32 = 0xbe,\r\n // f64_reinterpret_i64 = 0xbf\r\n})(Opcode = exports.Opcode || (exports.Opcode = {}));\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/lib/parse/package.json b/lib/parse/package.json index 23d02b8e..f81f9aef 100644 --- a/lib/parse/package.json +++ b/lib/parse/package.json @@ -5,7 +5,7 @@ "main": "index.js", "types": "index.d.ts", "scripts": { - "asbuild": "asc assembly/index.ts -O3 -b build/index.wasm -t build/index.wat --importMemory --sourceMap --validate", + "asbuild": "asc assembly/index.ts -O3 -b build/index.wasm -t build/index.wat --importMemory --runtime none --sourceMap --validate", "build": "npm run asbuild && webpack --mode production --display-modules", "test": "ts-node tests/" }, diff --git a/src/builtins.ts b/src/builtins.ts index c193c66f..63672ed1 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -467,8 +467,8 @@ export namespace BuiltinSymbols { export const v8x16_shuffle = "~lib/builtins/v8x16.shuffle"; // internals - export const HEAP_BASE = "~lib/heap/HEAP_BASE"; - export const RTTI_BASE = "~lib/rt/RTTI_BASE"; + export const heap_base = "~lib/heap/__heap_base"; + export const rtti_base = "~lib/rt/__rtti_base"; export const visit_globals = "~lib/rt/__visit_globals"; export const visit_members = "~lib/rt/__visit_members"; @@ -4198,9 +4198,9 @@ export function compileRTTI(compiler: Compiler): void { var segment = compiler.addMemorySegment(data); if (usizeType.size == 8) { let offset = segment.offset; - module.addGlobal(BuiltinSymbols.RTTI_BASE, NativeType.I64, false, module.i64(i64_low(offset), i64_high(offset))); + module.addGlobal(BuiltinSymbols.rtti_base, NativeType.I64, false, module.i64(i64_low(offset), i64_high(offset))); } else { - module.addGlobal(BuiltinSymbols.RTTI_BASE, NativeType.I32, false, module.i32(i64_low(segment.offset))); + module.addGlobal(BuiltinSymbols.rtti_base, NativeType.I32, false, module.i32(i64_low(segment.offset))); } } diff --git a/src/compiler.ts b/src/compiler.ts index 1708f74b..e39100c8 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -254,9 +254,9 @@ export const enum ContextualFlags { /** Runtime features to be activated by the compiler. */ export const enum RuntimeFeatures { NONE = 0, - /** Requires HEAP_BASE and heap setup. */ + /** Requires heap setup. */ HEAP = 1 << 0, - /** Requires RTTI_BASE and RTTI setup. */ + /** Requires runtime type information setup. */ RTTI = 1 << 1, /** Requires the built-in globals visitor. */ visitGlobals = 1 << 2, @@ -349,11 +349,11 @@ export class Compiler extends DiagnosticEmitter { // add a mutable heap and rtti base dummies if (options.isWasm64) { - module.addGlobal(BuiltinSymbols.HEAP_BASE, NativeType.I64, true, module.i64(0)); - module.addGlobal(BuiltinSymbols.RTTI_BASE, NativeType.I64, true, module.i64(0)); + module.addGlobal(BuiltinSymbols.heap_base, NativeType.I64, true, module.i64(0)); + module.addGlobal(BuiltinSymbols.rtti_base, NativeType.I64, true, module.i64(0)); } else { - module.addGlobal(BuiltinSymbols.HEAP_BASE, NativeType.I32, true, module.i32(0)); - module.addGlobal(BuiltinSymbols.RTTI_BASE, NativeType.I32, true, module.i32(0)); + module.addGlobal(BuiltinSymbols.heap_base, NativeType.I32, true, module.i32(0)); + module.addGlobal(BuiltinSymbols.rtti_base, NativeType.I32, true, module.i32(0)); } // compile entry file(s) while traversing reachable elements @@ -386,25 +386,25 @@ export class Compiler extends DiagnosticEmitter { // compile runtime features if (this.runtimeFeatures & RuntimeFeatures.visitGlobals) compileVisitGlobals(this); if (this.runtimeFeatures & RuntimeFeatures.visitMembers) compileVisitMembers(this); - module.removeGlobal(BuiltinSymbols.RTTI_BASE); + module.removeGlobal(BuiltinSymbols.rtti_base); if (this.runtimeFeatures & RuntimeFeatures.RTTI) compileRTTI(this); // update the heap base pointer var memoryOffset = this.memoryOffset; memoryOffset = i64_align(memoryOffset, options.usizeType.byteSize); this.memoryOffset = memoryOffset; - module.removeGlobal(BuiltinSymbols.HEAP_BASE); + module.removeGlobal(BuiltinSymbols.heap_base); if (this.runtimeFeatures & RuntimeFeatures.HEAP) { if (options.isWasm64) { module.addGlobal( - BuiltinSymbols.HEAP_BASE, + BuiltinSymbols.heap_base, NativeType.I64, false, module.i64(i64_low(memoryOffset), i64_high(memoryOffset)) ); } else { module.addGlobal( - BuiltinSymbols.HEAP_BASE, + BuiltinSymbols.heap_base, NativeType.I32, false, module.i32(i64_low(memoryOffset)) @@ -823,10 +823,10 @@ export class Compiler extends DiagnosticEmitter { } } - // Handle ambient builtins like 'HEAP_BASE' that need to be resolved but are added explicitly + // Handle ambient builtins like '__heap_base' that need to be resolved but are added explicitly if (global.is(CommonFlags.AMBIENT) && global.hasDecorator(DecoratorFlags.BUILTIN)) { - if (global.internalName == BuiltinSymbols.HEAP_BASE) this.runtimeFeatures |= RuntimeFeatures.HEAP; - else if (global.internalName == BuiltinSymbols.RTTI_BASE) this.runtimeFeatures |= RuntimeFeatures.RTTI; + if (global.internalName == BuiltinSymbols.heap_base) this.runtimeFeatures |= RuntimeFeatures.HEAP; + else if (global.internalName == BuiltinSymbols.rtti_base) this.runtimeFeatures |= RuntimeFeatures.RTTI; return true; } diff --git a/src/definitions.ts b/src/definitions.ts index 1ef6e381..990a079b 100644 --- a/src/definitions.ts +++ b/src/definitions.ts @@ -3,7 +3,7 @@ * @module definitions *//***/ -import { + import { CommonFlags } from "./common"; @@ -23,7 +23,8 @@ import { ConstantValueKind, Interface, Property, - PropertyPrototype + PropertyPrototype, + File } from "./program"; import { @@ -42,10 +43,8 @@ abstract class ExportsWalker { program: Program; /** Whether to include private members */ includePrivate: bool; - /** Elements still to do. */ - todo: Element[] = []; /** Already seen elements. */ - seen: Set = new Set(); + seen: Map = new Map(); /** Constructs a new Element walker. */ constructor(program: Program, includePrivate: bool = false) { @@ -56,57 +55,66 @@ abstract class ExportsWalker { /** Walks all elements and calls the respective handlers. */ walk(): void { for (let file of this.program.filesByName.values()) { - let members = file.members; - if (!members) continue; - for (let member of members.values()) { - // FIXME: doesn't honor the actual externally visible name - this.visitElement(member); - } + if (file.source.isEntry) this.visitFile(file); + } + } + + /** Visits all exported elements of a file. */ + visitFile(file: File): void { + var members = file.exports; + if (members) { + for (let [name, member] of members) this.visitElement(name, member); + } + var exportsStar = file.exportsStar; + if (exportsStar) { + for (let exportStar of exportsStar) this.visitFile(exportStar); } - var todo = this.todo; - for (let i = 0; i < todo.length; ) this.visitElement(todo[i]); } /** Visits an element.*/ - visitElement(element: Element): void { + visitElement(name: string, element: Element): void { if (element.is(CommonFlags.PRIVATE) && !this.includePrivate) return; - if (this.seen.has(element)) return; - this.seen.add(element); + var seen = this.seen; + if (seen.has(element)) { + this.visitAlias(name, element, seen.get(element)); + return; + } + seen.set(element, name); switch (element.kind) { case ElementKind.GLOBAL: { - if (element.is(CommonFlags.COMPILED)) this.visitGlobal(element); + if (element.is(CommonFlags.COMPILED)) this.visitGlobal(name, element); break; } case ElementKind.ENUM: { - if (element.is(CommonFlags.COMPILED)) this.visitEnum(element); + if (element.is(CommonFlags.COMPILED)) this.visitEnum(name, element); break; } case ElementKind.FUNCTION_PROTOTYPE: { - this.visitFunctionInstances(element); + this.visitFunctionInstances(name, element); break; } case ElementKind.CLASS_PROTOTYPE: { - this.visitClassInstances(element); + this.visitClassInstances(name, element); break; } case ElementKind.FIELD: { - if ((element).is(CommonFlags.COMPILED)) this.visitField(element); + if ((element).is(CommonFlags.COMPILED)) this.visitField(name, element); break; } case ElementKind.PROPERTY_PROTOTYPE: { - this.visitPropertyInstances(element); + this.visitPropertyInstances(name, element); break; } case ElementKind.PROPERTY: { let prop = element; let getter = prop.getterInstance; - if (getter) this.visitFunction(getter); + if (getter) this.visitFunction(name, getter); let setter = prop.setterInstance; - if (setter) this.visitFunction(setter); + if (setter) this.visitFunction(name, setter); break; } case ElementKind.NAMESPACE: { - if (hasCompiledMember(element)) this.visitNamespace(element); + if (hasCompiledMember(element)) this.visitNamespace(name, element); break; } case ElementKind.TYPEDEFINITION: break; @@ -114,25 +122,25 @@ abstract class ExportsWalker { } } - private visitFunctionInstances(element: FunctionPrototype): void { + private visitFunctionInstances(name: string, element: FunctionPrototype): void { var instances = element.instances; if (instances) { for (let instance of instances.values()) { - if (instance.is(CommonFlags.COMPILED)) this.visitFunction(instance); + if (instance.is(CommonFlags.COMPILED)) this.visitFunction(name, instance); } } } - private visitClassInstances(element: ClassPrototype): void { + private visitClassInstances(name: string, element: ClassPrototype): void { var instances = element.instances; if (instances) { for (let instance of instances.values()) { - if (instance.is(CommonFlags.COMPILED)) this.visitClass(instance); + if (instance.is(CommonFlags.COMPILED)) this.visitClass(name, instance); } } } - private visitPropertyInstances(element: PropertyPrototype): void { + private visitPropertyInstances(name: string, element: PropertyPrototype): void { // var instances = element.instances; // if (instances) { // for (let instance of instances.values()) { @@ -142,13 +150,14 @@ abstract class ExportsWalker { assert(false); } - abstract visitGlobal(element: Global): void; - abstract visitEnum(element: Enum): void; - abstract visitFunction(element: Function): void; - abstract visitClass(element: Class): void; - abstract visitInterface(element: Interface): void; - abstract visitField(element: Field): void; - abstract visitNamespace(element: Element): void; + abstract visitGlobal(name: string, element: Global): void; + abstract visitEnum(name: string, element: Enum): void; + abstract visitFunction(name: string, element: Function): void; + abstract visitClass(name: string, element: Class): void; + abstract visitInterface(name: string, element: Interface): void; + abstract visitField(name: string, element: Field): void; + abstract visitNamespace(name: string, element: Element): void; + abstract visitAlias(name: string, element: Element, originalName: string): void; } /** A WebIDL definitions builder. */ @@ -167,14 +176,14 @@ export class IDLBuilder extends ExportsWalker { super(program, includePrivate); } - visitGlobal(element: Global): void { + visitGlobal(name: string, element: Global): void { var sb = this.sb; var isConst = element.is(CommonFlags.INLINED); indent(sb, this.indentLevel); if (isConst) sb.push("const "); sb.push(this.typeToString(element.type)); sb.push(" "); - sb.push(element.name); + sb.push(name); if (isConst) { switch (element.constantValueKind) { case ConstantValueKind.INTEGER: { @@ -193,11 +202,11 @@ export class IDLBuilder extends ExportsWalker { sb.push(";\n"); } - visitEnum(element: Enum): void { + visitEnum(name: string, element: Enum): void { var sb = this.sb; indent(sb, this.indentLevel++); sb.push("interface "); - sb.push(element.name); + sb.push(name); sb.push(" {\n"); var members = element.members; if (members) { @@ -218,20 +227,20 @@ export class IDLBuilder extends ExportsWalker { } } for (let member of members.values()) { - if (member.kind != ElementKind.ENUMVALUE) this.visitElement(member); + if (member.kind != ElementKind.ENUMVALUE) this.visitElement(member.name, member); } } indent(sb, --this.indentLevel); sb.push("}\n"); } - visitFunction(element: Function): void { + visitFunction(name: string, element: Function): void { var sb = this.sb; var signature = element.signature; indent(sb, this.indentLevel); sb.push(this.typeToString(signature.returnType)); sb.push(" "); - sb.push(element.name); + sb.push(name); sb.push("("); var parameters = signature.parameterTypes; var numParameters = parameters.length; @@ -250,45 +259,49 @@ export class IDLBuilder extends ExportsWalker { sb.push("interface "); sb.push(element.name); sb.push(" {\n"); - for (let member of members.values()) this.visitElement(member); + for (let member of members.values()) this.visitElement(member.name, member); indent(sb, --this.indentLevel); sb.push("}\n"); } } - visitClass(element: Class): void { + visitClass(name: string, element: Class): void { var sb = this.sb; indent(sb, this.indentLevel++); sb.push("interface "); - sb.push(element.name); + sb.push(name); sb.push(" {\n"); // TODO indent(sb, --this.indentLevel); sb.push("}\n"); } - visitInterface(element: Interface): void { - this.visitClass(element); + visitInterface(name: string, element: Interface): void { + this.visitClass(name, element); } - visitField(element: Field): void { + visitField(name: string, element: Field): void { // TODO } - visitNamespace(element: Namespace): void { + visitNamespace(name: string, element: Namespace): void { var sb = this.sb; indent(sb, this.indentLevel++); sb.push("interface "); - sb.push(element.name); + sb.push(name); sb.push(" {\n"); var members = element.members; if (members) { - for (let member of members.values()) this.visitElement(member); + for (let member of members.values()) this.visitElement(member.name, member); } indent(sb, --this.indentLevel); sb.push("}\n"); } + visitAlias(name: string, element: Element, originalName: string): void { + // TODO + } + typeToString(type: Type): string { switch (type.kind) { case TypeKind.I8: return "byte"; @@ -335,13 +348,14 @@ export class TSDBuilder extends ExportsWalker { private sb: string[] = []; private indentLevel: i32 = 0; + private unknown: Set = new Set(); /** Constructs a new WebIDL builder. */ constructor(program: Program, includePrivate: bool = false) { super(program, includePrivate); } - visitGlobal(element: Global): void { + visitGlobal(name: string, element: Global): void { var sb = this.sb; var isConst = element.is(CommonFlags.INLINED); indent(sb, this.indentLevel); @@ -349,21 +363,21 @@ export class TSDBuilder extends ExportsWalker { if (isConst) sb.push("static readonly "); else sb.push("static "); } else { - if (isConst) sb.push("const "); - else sb.push("var "); + if (isConst) sb.push("export const "); + else sb.push("export var "); } - sb.push(element.name); + sb.push(name); sb.push(": "); sb.push(this.typeToString(element.type)); sb.push(";\n"); - this.visitNamespace(element); + this.visitNamespace(name, element); } - visitEnum(element: Enum): void { + visitEnum(name: string, element: Enum): void { var sb = this.sb; indent(sb, this.indentLevel++); - sb.push("enum "); - sb.push(element.name); + sb.push("export enum "); + sb.push(name); sb.push(" {\n"); var members = element.members; if (members) { @@ -381,13 +395,13 @@ export class TSDBuilder extends ExportsWalker { --numMembers; } } - if (numMembers) this.visitNamespace(element); + if (numMembers) this.visitNamespace(name, element); } indent(sb, --this.indentLevel); sb.push("}\n"); } - visitFunction(element: Function): void { + visitFunction(name: string, element: Function): void { if (element.isAny(CommonFlags.PRIVATE | CommonFlags.SET)) return; var sb = this.sb; var signature = element.signature; @@ -395,14 +409,15 @@ export class TSDBuilder extends ExportsWalker { if (element.is(CommonFlags.PROTECTED)) sb.push("protected "); if (element.is(CommonFlags.STATIC)) sb.push("static "); if (element.is(CommonFlags.GET)) { - sb.push(element.identifierNode.text); // 'get:funcName' internally - sb.push(": "); + sb.push("get "); + sb.push(name); // 'get:funcName' internally + sb.push("(): "); sb.push(this.typeToString(signature.returnType)); sb.push(";\n"); return; } else { - if (!element.isAny(CommonFlags.STATIC | CommonFlags.INSTANCE)) sb.push("function "); - sb.push(element.name); + if (!element.isAny(CommonFlags.STATIC | CommonFlags.INSTANCE)) sb.push("export function "); + sb.push(name); } sb.push("("); var parameters = signature.parameterTypes; @@ -422,73 +437,79 @@ export class TSDBuilder extends ExportsWalker { sb.push(this.typeToString(signature.returnType)); } sb.push(";\n"); - this.visitNamespace(element); + this.visitNamespace(name, element); } - visitClass(element: Class): void { + visitClass(name: string, element: Class): void { var sb = this.sb; var isInterface = element.kind == ElementKind.INTERFACE; indent(sb, this.indentLevel++); if (isInterface) { - sb.push("interface "); + sb.push("export interface "); } else { if (element.is(CommonFlags.ABSTRACT)) sb.push("abstract "); - sb.push("class "); - } - sb.push(element.name); - var base = element.base; - if (base && base.is(CommonFlags.COMPILED | CommonFlags.MODULE_EXPORT)) { - sb.push(" extends "); - sb.push(base.name); // TODO: fqn + sb.push("export class "); } + sb.push(name); + // var base = element.base; + // if (base && base.is(CommonFlags.COMPILED | CommonFlags.MODULE_EXPORT)) { + // sb.push(" extends "); + // sb.push(base.name); // TODO: fqn + // } sb.push(" {\n"); - var members = element.parent.members; // static - if (members) { - for (let member of members.values()) { - this.visitElement(member); - } + var staticMembers = element.prototype.members; + if (staticMembers) { + for (let member of staticMembers.values()) this.visitElement(member.name, member); } - var ctor = element.constructorInstance; - if (ctor) this.visitFunction(ctor); - members = element.members; // instance - if (members) { - for (let member of members.values()) this.visitElement(member); + var instanceMembers = element.members; + if (instanceMembers) { + for (let member of instanceMembers.values()) this.visitElement(member.name, member); } indent(sb, --this.indentLevel); sb.push("}\n"); } - visitInterface(element: Interface): void { - this.visitClass(element); + visitInterface(name: string, element: Interface): void { + this.visitClass(name, element); } - visitField(element: Field): void { + visitField(name: string, element: Field): void { if (element.is(CommonFlags.PRIVATE)) return; var sb = this.sb; indent(sb, this.indentLevel); if (element.is(CommonFlags.PROTECTED)) sb.push("protected "); if (element.is(CommonFlags.STATIC)) sb.push("static "); if (element.is(CommonFlags.READONLY)) sb.push("readonly "); - sb.push(element.name); + sb.push(name); sb.push(": "); sb.push(this.typeToString(element.type)); sb.push(";\n"); } - visitNamespace(element: Element): void { + visitNamespace(name: string, element: Element): void { var members = element.members; if (members && members.size) { let sb = this.sb; indent(sb, this.indentLevel++); - sb.push("namespace "); - sb.push(element.name); + sb.push("export namespace "); + sb.push(name); sb.push(" {\n"); - for (let member of members.values()) this.visitElement(member); + for (let member of members.values()) this.visitElement(member.name, member); indent(sb, --this.indentLevel); sb.push("}\n"); } } + visitAlias(name: string, element: Element, originalName: string): void { + var sb = this.sb; + indent(sb, this.indentLevel); + sb.push("export const "); + sb.push(name); + sb.push(" = typeof "); + sb.push(originalName); + sb.push(";\n"); + } + typeToString(type: Type): string { switch (type.kind) { case TypeKind.I8: return "i8"; @@ -510,7 +531,7 @@ export class TSDBuilder extends ExportsWalker { case TypeKind.VOID: return "void"; default: { assert(false); - return ""; + return "any"; } } } diff --git a/std/assembly/heap.ts b/std/assembly/heap.ts index 8fc375ce..4640442d 100644 --- a/std/assembly/heap.ts +++ b/std/assembly/heap.ts @@ -1,3 +1,3 @@ // @ts-ignore: decorator @builtin -export declare const HEAP_BASE: usize; +export declare const __heap_base: usize; diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 5e0a6ef9..ef00a17c 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -105,7 +105,7 @@ 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; +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. */ @@ -539,7 +539,7 @@ declare namespace v128 { export function mul(a: v128, b: v128): v128; // except i64 /** Divides each lane of two 128-bit vectors. */ export function div(a: v128, b: v128): v128; - /** Negates each lane of a 128-bit vector */ + /** Negates each lane of a 128-bit vector. */ export function neg(a: v128): v128; /** Adds each lane of two 128-bit vectors using saturation. */ export function add_saturate(a: v128, b: v128): v128; diff --git a/std/assembly/rt.ts b/std/assembly/rt.ts index 8eb2d788..de9b8553 100644 --- a/std/assembly/rt.ts +++ b/std/assembly/rt.ts @@ -5,7 +5,7 @@ import { ArrayBufferView } from "./arraybuffer"; // @ts-ignore: decorator @builtin -export declare const RTTI_BASE: usize; +export declare const __rtti_base: usize; // @ts-ignore: decorator @builtin @unsafe @@ -18,7 +18,7 @@ export declare function __visit_members(ref: usize, cookie: u32): void; // @ts-ignore: decorator @unsafe export function __typeinfo(id: u32): TypeinfoFlags { - var ptr = RTTI_BASE; + var ptr = __rtti_base; if (id > load(ptr)) throw new Error(E_INDEXOUTOFRANGE); return changetype(ptr + sizeof() + id * offsetof()).flags; } @@ -27,7 +27,7 @@ export function __typeinfo(id: u32): TypeinfoFlags { @unsafe export function __instanceof(ref: usize, superId: u32): bool { // keyword var id = changetype(ref - BLOCK_OVERHEAD).rtId; - var ptr = RTTI_BASE; + var ptr = __rtti_base; if (id <= load(ptr)) { do if (id == superId) return true; while (id = changetype(ptr + sizeof() + id * offsetof()).base); diff --git a/std/assembly/rt/index-full.ts b/std/assembly/rt/index-full.ts index ceed8e44..c9fa6549 100644 --- a/std/assembly/rt/index-full.ts +++ b/std/assembly/rt/index-full.ts @@ -1,3 +1,3 @@ export { __alloc } from "rt/tlsf"; export { __retain, __release, __collect } from "rt/pure"; -export { RTTI_BASE as __rtti } from "rt"; +export { __rtti_base } from "rt"; diff --git a/std/assembly/rt/index-stub.ts b/std/assembly/rt/index-stub.ts index b6956efa..251aa346 100644 --- a/std/assembly/rt/index-stub.ts +++ b/std/assembly/rt/index-stub.ts @@ -1,2 +1,2 @@ export { __alloc, __retain, __release, __collect } from "rt/stub"; -export { RTTI_BASE as __rtti } from "rt"; +export { __rtti_base } from "rt"; diff --git a/std/assembly/rt/pure.ts b/std/assembly/rt/pure.ts index 9487db2d..8fdc7d94 100644 --- a/std/assembly/rt/pure.ts +++ b/std/assembly/rt/pure.ts @@ -64,7 +64,7 @@ import { onincrement, ondecrement, onfree, onalloc } from "./rtrace"; // @ts-ignore: decorator @global @unsafe function __visit(ref: usize, cookie: i32): void { - if (ref < HEAP_BASE) return; + if (ref < __heap_base) return; var s = changetype(ref - BLOCK_OVERHEAD); switch (cookie) { case VISIT_DECREMENT: { @@ -251,12 +251,12 @@ function collectWhite(s: Block): void { // @ts-ignore: decorator @global @unsafe export function __retain(ref: usize): usize { - if (ref > HEAP_BASE) increment(changetype(ref - BLOCK_OVERHEAD)); + if (ref > __heap_base) increment(changetype(ref - BLOCK_OVERHEAD)); return ref; } // @ts-ignore: decorator @global @unsafe export function __release(ref: usize): void { - if (ref > HEAP_BASE) decrement(changetype(ref - BLOCK_OVERHEAD)); + if (ref > __heap_base) decrement(changetype(ref - BLOCK_OVERHEAD)); } diff --git a/std/assembly/rt/stub.ts b/std/assembly/rt/stub.ts index 510ab13a..9c4f10ac 100644 --- a/std/assembly/rt/stub.ts +++ b/std/assembly/rt/stub.ts @@ -2,7 +2,7 @@ import { AL_MASK, BLOCK, BLOCK_OVERHEAD, BLOCK_MAXSIZE } from "rt/common"; // @ts-ignore: decorator @lazy -var startOffset: usize = (HEAP_BASE + AL_MASK) & ~AL_MASK; +var startOffset: usize = (__heap_base + AL_MASK) & ~AL_MASK; // @ts-ignore: decorator @lazy diff --git a/std/assembly/rt/tlsf.ts b/std/assembly/rt/tlsf.ts index 350f9807..44366125 100644 --- a/std/assembly/rt/tlsf.ts +++ b/std/assembly/rt/tlsf.ts @@ -450,7 +450,7 @@ function prepareSize(size: usize): usize { /** Initilizes the root structure. */ export function initializeRoot(): void { - var rootOffset = (HEAP_BASE + AL_MASK) & ~AL_MASK; + var rootOffset = (__heap_base + AL_MASK) & ~AL_MASK; var pagesBefore = memory.size(); var pagesNeeded = ((((rootOffset + ROOT_SIZE) + 0xffff) & ~0xffff) >>> 16); if (pagesNeeded > pagesBefore && memory.grow(pagesNeeded - pagesBefore) < 0) unreachable(); diff --git a/std/assembly/shared/typeinfo.ts b/std/assembly/shared/typeinfo.ts index e20e8ff7..737ce3d7 100644 --- a/std/assembly/shared/typeinfo.ts +++ b/std/assembly/shared/typeinfo.ts @@ -3,7 +3,7 @@ // ╒═══════════════════ Typeinfo interpretation ═══════════════════╕ // 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 -// ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┤ ◄─ RTTI_BASE +// ├─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┤ ◄─ __rtti_base // │ count │ // ╞═══════════════════════════════════════════════════════════════╡ ┐ // │ Typeinfo#flags [id=0] │ id < count diff --git a/tests/allocators/buddy/assembly/buddy.ts b/tests/allocators/buddy/assembly/buddy.ts index 52cff567..2e8963f2 100644 --- a/tests/allocators/buddy/assembly/buddy.ts +++ b/tests/allocators/buddy/assembly/buddy.ts @@ -89,7 +89,7 @@ class List { * for that size. The bucket at index 0 corresponds to an allocation size of * MAX_ALLOC (i.e. the whole address space). */ -var BUCKETS_START: usize = HEAP_BASE; +var BUCKETS_START: usize = __heap_base; var BUCKETS_END: usize = BUCKETS_START + BUCKET_COUNT * List.SIZE; function buckets$get(index: usize): List { diff --git a/tests/allocators/buddy/untouched.wat b/tests/allocators/buddy/untouched.wat index c8c94697..7c408265 100644 --- a/tests/allocators/buddy/untouched.wat +++ b/tests/allocators/buddy/untouched.wat @@ -30,7 +30,7 @@ (global $assembly/buddy/base_ptr (mut i32) (i32.const 0)) (global $assembly/buddy/max_ptr (mut i32) (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 156)) + (global $~lib/heap/__heap_base i32 (i32.const 156)) (export "memory" (memory $0)) (export "memory.copy" (func $~lib/memory/memory.copy)) (export "memory.init" (func $~lib/memory/memory.init)) @@ -41,7 +41,7 @@ (export "__free" (func $assembly/buddy/__mem_free)) (start $start) (func $start:assembly/buddy (; 1 ;) (type $FUNCSIG$v) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base global.set $assembly/buddy/BUCKETS_START global.get $assembly/buddy/BUCKETS_START global.get $assembly/buddy/BUCKET_COUNT diff --git a/tests/allocators/rt-full/optimized.wat b/tests/allocators/rt-full/optimized.wat index eaffb45a..0e383fb2 100644 --- a/tests/allocators/rt-full/optimized.wat +++ b/tests/allocators/rt-full/optimized.wat @@ -20,13 +20,13 @@ (global $~lib/rt/pure/CUR (mut i32) (i32.const 0)) (global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 304)) + (global $~lib/rt/__rtti_base i32 (i32.const 304)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/tlsf/__alloc)) (export "__retain" (func $~lib/rt/pure/__retain)) (export "__release" (func $~lib/rt/pure/__release)) (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__rtti" (global $~lib/rt/RTTI_BASE)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) (export "memory.copy" (func $~lib/memory/memory.copy)) (export "memory.init" (func $~lib/memory/memory.init)) (export "memory.drop" (func $~lib/memory/memory.drop)) diff --git a/tests/allocators/rt-full/untouched.wat b/tests/allocators/rt-full/untouched.wat index 480e3ee0..addfbf47 100644 --- a/tests/allocators/rt-full/untouched.wat +++ b/tests/allocators/rt-full/untouched.wat @@ -24,14 +24,14 @@ (global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 352)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 380)) + (global $~lib/rt/__rtti_base i32 (i32.const 352)) + (global $~lib/heap/__heap_base i32 (i32.const 380)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/tlsf/__alloc)) (export "__retain" (func $~lib/rt/pure/__retain)) (export "__release" (func $~lib/rt/pure/__release)) (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__rtti" (global $~lib/rt/RTTI_BASE)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) (export "memory.copy" (func $~lib/memory/memory.copy)) (export "memory.init" (func $~lib/memory/memory.init)) (export "memory.drop" (func $~lib/memory/memory.drop)) @@ -216,30 +216,30 @@ i32.add i32.load offset=4 end - local.set $8 + local.set $9 block $~lib/rt/tlsf/SETSL|inlined.1 local.get $0 - local.set $11 + local.set $8 local.get $4 - local.set $10 - local.get $8 + local.set $11 + local.get $9 i32.const 1 local.get $5 i32.shl i32.const -1 i32.xor i32.and - local.tee $8 - local.set $9 + local.tee $9 + local.set $10 + local.get $8 local.get $11 - local.get $10 i32.const 2 i32.shl i32.add - local.get $9 + local.get $10 i32.store offset=4 end - local.get $8 + local.get $9 i32.eqz if local.get $0 @@ -371,17 +371,17 @@ if block $~lib/rt/tlsf/GETFREELEFT|inlined.0 (result i32) local.get $1 - local.set $3 - local.get $3 + local.set $6 + local.get $6 i32.const 4 i32.sub i32.load end - local.set $3 - local.get $3 - i32.load local.set $6 local.get $6 + i32.load + local.set $3 + local.get $3 i32.const 1 i32.and i32.eqz @@ -393,7 +393,7 @@ call $~lib/builtins/abort unreachable end - local.get $6 + local.get $3 i32.const 3 i32.const -1 i32.xor @@ -412,17 +412,17 @@ i32.lt_u if local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 local.get $6 + call $~lib/rt/tlsf/removeBlock + local.get $6 + local.get $3 i32.const 3 i32.and local.get $7 i32.or local.tee $2 i32.store - local.get $3 + local.get $6 local.set $1 end end @@ -531,16 +531,16 @@ end block $~lib/rt/tlsf/GETHEAD|inlined.1 (result i32) local.get $0 - local.set $3 - local.get $9 - local.set $6 - local.get $10 local.set $7 + local.get $9 + local.set $3 + local.get $10 + local.set $6 + local.get $7 local.get $3 - local.get $6 i32.const 4 i32.shl - local.get $7 + local.get $6 i32.add i32.const 2 i32.shl @@ -564,21 +564,21 @@ local.get $0 local.set $12 local.get $9 - local.set $3 - local.get $10 - local.set $6 - local.get $1 local.set $7 + local.get $10 + local.set $3 + local.get $1 + local.set $6 local.get $12 - local.get $3 + local.get $7 i32.const 4 i32.shl - local.get $6 + local.get $3 i32.add i32.const 2 i32.shl i32.add - local.get $7 + local.get $6 i32.store offset=96 end local.get $0 @@ -591,16 +591,16 @@ i32.store block $~lib/rt/tlsf/SETSL|inlined.2 local.get $0 - local.set $3 + local.set $13 local.get $9 - local.set $6 + local.set $12 block $~lib/rt/tlsf/GETSL|inlined.1 (result i32) local.get $0 - local.set $13 + local.set $3 local.get $9 - local.set $12 - local.get $13 - local.get $12 + local.set $6 + local.get $3 + local.get $6 i32.const 2 i32.shl i32.add @@ -611,8 +611,8 @@ i32.shl i32.or local.set $7 - local.get $3 - local.get $6 + local.get $13 + local.get $12 i32.const 2 i32.shl i32.add @@ -783,7 +783,7 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 @@ -837,9 +837,9 @@ end block $break|0 i32.const 0 - local.set $4 + local.set $5 loop $repeat|0 - local.get $4 + local.get $5 i32.const 23 i32.lt_u i32.eqz @@ -847,23 +847,23 @@ block $~lib/rt/tlsf/SETSL|inlined.0 local.get $3 local.set $7 - local.get $4 + local.get $5 local.set $6 i32.const 0 - local.set $5 + local.set $4 local.get $7 local.get $6 i32.const 2 i32.shl i32.add - local.get $5 + local.get $4 i32.store offset=4 end block $break|1 i32.const 0 - local.set $5 + local.set $7 loop $repeat|1 - local.get $5 + local.get $7 i32.const 16 i32.lt_u i32.eqz @@ -871,37 +871,37 @@ block $~lib/rt/tlsf/SETHEAD|inlined.0 local.get $3 local.set $9 - local.get $4 - local.set $8 local.get $5 - local.set $7 - i32.const 0 + local.set $8 + local.get $7 local.set $6 + i32.const 0 + local.set $4 local.get $9 local.get $8 i32.const 4 i32.shl - local.get $7 + local.get $6 i32.add i32.const 2 i32.shl i32.add - local.get $6 + local.get $4 i32.store offset=96 end - local.get $5 + local.get $7 i32.const 1 i32.add - local.set $5 + local.set $7 br $repeat|1 unreachable end unreachable end - local.get $4 + local.get $5 i32.const 1 i32.add - local.set $4 + local.set $5 br $repeat|0 unreachable end @@ -1067,23 +1067,23 @@ i32.add i32.shl i32.and - local.set $4 - local.get $4 + local.set $5 + local.get $5 i32.eqz if i32.const 0 local.set $7 else - local.get $4 + local.get $5 i32.ctz local.set $2 block $~lib/rt/tlsf/GETSL|inlined.3 (result i32) local.get $0 local.set $8 local.get $2 - local.set $5 + local.set $4 local.get $8 - local.get $5 + local.get $4 i32.const 2 i32.shl i32.add @@ -1107,12 +1107,12 @@ local.set $8 local.get $6 i32.ctz - local.set $5 + local.set $4 local.get $9 local.get $8 i32.const 4 i32.shl - local.get $5 + local.get $4 i32.add i32.const 2 i32.shl @@ -1124,14 +1124,14 @@ else block $~lib/rt/tlsf/GETHEAD|inlined.3 (result i32) local.get $0 - local.set $8 + local.set $9 local.get $2 - local.set $5 + local.set $8 local.get $6 i32.ctz local.set $4 + local.get $9 local.get $8 - local.get $5 i32.const 4 i32.shl local.get $4 @@ -1432,7 +1432,7 @@ ) (func $~lib/rt/pure/__retain (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -1471,7 +1471,7 @@ ) (func $~lib/rt/__typeinfo (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 @@ -3123,7 +3123,7 @@ ) (func $~lib/rt/pure/__release (; 21 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -3510,7 +3510,7 @@ (local $2 i32) (local $3 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.lt_u if return diff --git a/tests/allocators/rt-stub/optimized.wat b/tests/allocators/rt-stub/optimized.wat index 8c57d2c0..4efc9e12 100644 --- a/tests/allocators/rt-stub/optimized.wat +++ b/tests/allocators/rt-stub/optimized.wat @@ -13,13 +13,13 @@ (data (i32.const 104) "\03\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10") (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 104)) + (global $~lib/rt/__rtti_base i32 (i32.const 104)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/stub/__alloc)) (export "__retain" (func $~lib/rt/stub/__retain)) (export "__release" (func $~lib/rt/stub/__release)) (export "__collect" (func $~lib/rt/stub/__collect)) - (export "__rtti" (global $~lib/rt/RTTI_BASE)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) (export "memory.copy" (func $~lib/memory/memory.copy)) (export "memory.init" (func $~lib/memory/memory.init)) (export "memory.drop" (func $~lib/memory/memory.drop)) diff --git a/tests/allocators/rt-stub/untouched.wat b/tests/allocators/rt-stub/untouched.wat index 6c2ed563..97f25aae 100644 --- a/tests/allocators/rt-stub/untouched.wat +++ b/tests/allocators/rt-stub/untouched.wat @@ -16,14 +16,14 @@ (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 104)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 132)) + (global $~lib/rt/__rtti_base i32 (i32.const 104)) + (global $~lib/heap/__heap_base i32 (i32.const 132)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/stub/__alloc)) (export "__retain" (func $~lib/rt/stub/__retain)) (export "__release" (func $~lib/rt/stub/__release)) (export "__collect" (func $~lib/rt/stub/__collect)) - (export "__rtti" (global $~lib/rt/RTTI_BASE)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) (export "memory.copy" (func $~lib/memory/memory.copy)) (export "memory.init" (func $~lib/memory/memory.init)) (export "memory.drop" (func $~lib/memory/memory.drop)) @@ -1666,7 +1666,7 @@ global.set $~lib/rt/stub/offset ) (func $start (; 13 ;) (type $FUNCSIG$v) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/call-super.untouched.wat b/tests/compiler/call-super.untouched.wat index 82b396cc..0f3f15ca 100644 --- a/tests/compiler/call-super.untouched.wat +++ b/tests/compiler/call-super.untouched.wat @@ -11,7 +11,7 @@ (elem (i32.const 0) $null) (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 52)) + (global $~lib/heap/__heap_base i32 (i32.const 52)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/stub/__alloc (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -538,7 +538,7 @@ call $~lib/rt/stub/__release ) (func $start:call-super (; 19 ;) (type $FUNCSIG$v) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/constructor.untouched.wat b/tests/compiler/constructor.untouched.wat index 0587ee93..c9e07820 100644 --- a/tests/compiler/constructor.untouched.wat +++ b/tests/compiler/constructor.untouched.wat @@ -18,7 +18,7 @@ (global $constructor/ctorConditionallyReturns (mut i32) (i32.const 0)) (global $constructor/ctorAllocates (mut i32) (i32.const 0)) (global $constructor/ctorConditionallyAllocates (mut i32) (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 8)) + (global $~lib/heap/__heap_base i32 (i32.const 8)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/stub/__alloc (; 0 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -267,7 +267,7 @@ local.get $0 ) (func $start:constructor (; 12 ;) (type $FUNCSIG$v) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/empty.json b/tests/compiler/empty.json index 8ee35e6e..fc976a8b 100644 --- a/tests/compiler/empty.json +++ b/tests/compiler/empty.json @@ -1,6 +1,6 @@ { "asc_flags": [ - "--runtime half", + "--runtime none", "--use ASC_RTRACE=1" ] } diff --git a/tests/compiler/exports.untouched.wat b/tests/compiler/exports.untouched.wat index 482b3b2b..1284679a 100644 --- a/tests/compiler/exports.untouched.wat +++ b/tests/compiler/exports.untouched.wat @@ -17,7 +17,7 @@ (global $exports/outer.inner.a i32 (i32.const 42)) (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 8)) + (global $~lib/heap/__heap_base i32 (i32.const 8)) (global $~lib/argc (mut i32) (i32.const 0)) (global $exports/Car i32 (i32.const 3)) (global $exports/vehicles.Car i32 (i32.const 4)) @@ -231,7 +231,7 @@ nop ) (func $start (; 15 ;) (type $FUNCSIG$v) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/getter-call.untouched.wat b/tests/compiler/getter-call.untouched.wat index 6b77d6ed..fa86224e 100644 --- a/tests/compiler/getter-call.untouched.wat +++ b/tests/compiler/getter-call.untouched.wat @@ -10,7 +10,7 @@ (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) (global $~lib/argc (mut i32) (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 8)) + (global $~lib/heap/__heap_base i32 (i32.const 8)) (export "memory" (memory $0)) (export "test" (func $getter-call/test)) (start $start) @@ -149,7 +149,7 @@ local.get $1 ) (func $start (; 7 ;) (type $FUNCSIG$v) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/inlining.untouched.wat b/tests/compiler/inlining.untouched.wat index e30071b5..1c6969db 100644 --- a/tests/compiler/inlining.untouched.wat +++ b/tests/compiler/inlining.untouched.wat @@ -14,7 +14,7 @@ (global $~lib/argc (mut i32) (i32.const 0)) (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 48)) + (global $~lib/heap/__heap_base i32 (i32.const 48)) (export "memory" (memory $0)) (export "test" (func $inlining/test)) (start $start) @@ -518,7 +518,7 @@ unreachable end call $inlining/test_funcs - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/memset.ts b/tests/compiler/memset.ts index f1c028fe..5379fd82 100644 --- a/tests/compiler/memset.ts +++ b/tests/compiler/memset.ts @@ -66,7 +66,7 @@ function memset(dest: usize, c: u8, n: usize): usize { return ret; } -var dest = HEAP_BASE; +var dest = __heap_base; memset(dest, 1, 16); assert(load(dest) == 1); diff --git a/tests/compiler/memset.untouched.wat b/tests/compiler/memset.untouched.wat index 397e63c0..e9ebe3ba 100644 --- a/tests/compiler/memset.untouched.wat +++ b/tests/compiler/memset.untouched.wat @@ -8,7 +8,7 @@ (table $0 1 funcref) (elem (i32.const 0) $null) (global $memset/dest (mut i32) (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 44)) + (global $~lib/heap/__heap_base i32 (i32.const 44)) (export "memory" (memory $0)) (start $start) (func $memset/memset (; 1 ;) (type $FUNCSIG$iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) @@ -274,7 +274,7 @@ local.get $3 ) (func $start:memset (; 2 ;) (type $FUNCSIG$v) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base global.set $memset/dest global.get $memset/dest i32.const 1 diff --git a/tests/compiler/number.untouched.wat b/tests/compiler/number.untouched.wat index 4b8fd96a..eca663d2 100644 --- a/tests/compiler/number.untouched.wat +++ b/tests/compiler/number.untouched.wat @@ -58,7 +58,7 @@ (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 $~lib/heap/HEAP_BASE i32 (i32.const 1956)) + (global $~lib/heap/__heap_base i32 (i32.const 1956)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/stub/__retain (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) @@ -3636,7 +3636,7 @@ (local $8 i32) (local $9 i32) (local $10 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/optional-typeparameters.untouched.wat b/tests/compiler/optional-typeparameters.untouched.wat index f4aff580..a95982f0 100644 --- a/tests/compiler/optional-typeparameters.untouched.wat +++ b/tests/compiler/optional-typeparameters.untouched.wat @@ -11,7 +11,7 @@ (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) (global $optional-typeparameters/tConcrete (mut i32) (i32.const 0)) (global $optional-typeparameters/tDerived (mut i32) (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 8)) + (global $~lib/heap/__heap_base i32 (i32.const 8)) (export "memory" (memory $0)) (start $start) (func $optional-typeparameters/testConcrete (; 0 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) @@ -156,7 +156,7 @@ i32.const 2 call $optional-typeparameters/testDerived drop - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/rc/global-init.untouched.wat b/tests/compiler/rc/global-init.untouched.wat index 58134718..ee4ba17c 100644 --- a/tests/compiler/rc/global-init.untouched.wat +++ b/tests/compiler/rc/global-init.untouched.wat @@ -30,8 +30,8 @@ (global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 272)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 300)) + (global $~lib/rt/__rtti_base i32 (i32.const 272)) + (global $~lib/heap/__heap_base i32 (i32.const 300)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/pure/increment (; 5 ;) (type $FUNCSIG$vi) (param $0 i32) @@ -85,7 +85,7 @@ ) (func $~lib/rt/pure/__retain (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -712,7 +712,7 @@ ) (func $~lib/rt/__typeinfo (; 11 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 @@ -898,7 +898,7 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 @@ -3139,7 +3139,7 @@ ) (func $~lib/rt/pure/__release (; 26 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -3314,7 +3314,7 @@ (local $2 i32) (local $3 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.lt_u if return diff --git a/tests/compiler/rc/local-init.untouched.wat b/tests/compiler/rc/local-init.untouched.wat index 0d73932e..05e49cbe 100644 --- a/tests/compiler/rc/local-init.untouched.wat +++ b/tests/compiler/rc/local-init.untouched.wat @@ -28,8 +28,8 @@ (global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 272)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 308)) + (global $~lib/rt/__rtti_base i32 (i32.const 272)) + (global $~lib/heap/__heap_base i32 (i32.const 308)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/pure/increment (; 5 ;) (type $FUNCSIG$vi) (param $0 i32) @@ -83,7 +83,7 @@ ) (func $~lib/rt/pure/__retain (; 6 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -706,7 +706,7 @@ ) (func $~lib/rt/__typeinfo (; 10 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 @@ -892,7 +892,7 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 @@ -3133,7 +3133,7 @@ ) (func $~lib/rt/pure/__release (; 25 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -3307,7 +3307,7 @@ (local $2 i32) (local $3 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.lt_u if return diff --git a/tests/compiler/rc/logical-and-mismatch.untouched.wat b/tests/compiler/rc/logical-and-mismatch.untouched.wat index 6fabee37..c6114f86 100644 --- a/tests/compiler/rc/logical-and-mismatch.untouched.wat +++ b/tests/compiler/rc/logical-and-mismatch.untouched.wat @@ -28,8 +28,8 @@ (global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 256)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 292)) + (global $~lib/rt/__rtti_base i32 (i32.const 256)) + (global $~lib/heap/__heap_base i32 (i32.const 292)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/tlsf/removeBlock (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) @@ -777,7 +777,7 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 @@ -1430,7 +1430,7 @@ ) (func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -1487,7 +1487,7 @@ ) (func $~lib/rt/__typeinfo (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 @@ -3149,7 +3149,7 @@ ) (func $~lib/rt/pure/__release (; 27 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -3347,7 +3347,7 @@ (local $2 i32) (local $3 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.lt_u if return diff --git a/tests/compiler/rc/logical-or-mismatch.untouched.wat b/tests/compiler/rc/logical-or-mismatch.untouched.wat index 4b43b272..a5069543 100644 --- a/tests/compiler/rc/logical-or-mismatch.untouched.wat +++ b/tests/compiler/rc/logical-or-mismatch.untouched.wat @@ -28,8 +28,8 @@ (global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 256)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 292)) + (global $~lib/rt/__rtti_base i32 (i32.const 256)) + (global $~lib/heap/__heap_base i32 (i32.const 292)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/tlsf/removeBlock (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) @@ -777,7 +777,7 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 @@ -1430,7 +1430,7 @@ ) (func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -1487,7 +1487,7 @@ ) (func $~lib/rt/__typeinfo (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 @@ -3149,7 +3149,7 @@ ) (func $~lib/rt/pure/__release (; 27 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -3347,7 +3347,7 @@ (local $2 i32) (local $3 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.lt_u if return diff --git a/tests/compiler/rc/rereturn.optimized.wat b/tests/compiler/rc/rereturn.optimized.wat index 7dd52e46..7ba85c80 100644 --- a/tests/compiler/rc/rereturn.optimized.wat +++ b/tests/compiler/rc/rereturn.optimized.wat @@ -18,13 +18,13 @@ (global $~lib/rt/pure/CUR (mut i32) (i32.const 0)) (global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 256)) + (global $~lib/rt/__rtti_base i32 (i32.const 256)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/tlsf/__alloc)) (export "__retain" (func $~lib/rt/pure/__retain)) (export "__release" (func $~lib/rt/pure/__release)) (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__rtti" (global $~lib/rt/RTTI_BASE)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) (start $start) (func $~lib/rt/tlsf/removeBlock (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) diff --git a/tests/compiler/rc/rereturn.untouched.wat b/tests/compiler/rc/rereturn.untouched.wat index a2e9e495..4e97d973 100644 --- a/tests/compiler/rc/rereturn.untouched.wat +++ b/tests/compiler/rc/rereturn.untouched.wat @@ -23,14 +23,14 @@ (global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 256)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 292)) + (global $~lib/rt/__rtti_base i32 (i32.const 256)) + (global $~lib/heap/__heap_base i32 (i32.const 292)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/tlsf/__alloc)) (export "__retain" (func $~lib/rt/pure/__retain)) (export "__release" (func $~lib/rt/pure/__release)) (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__rtti" (global $~lib/rt/RTTI_BASE)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) (start $start) (func $~lib/rt/tlsf/removeBlock (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) @@ -777,7 +777,7 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 @@ -1426,7 +1426,7 @@ ) (func $~lib/rt/pure/__retain (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -1465,7 +1465,7 @@ ) (func $~lib/rt/__typeinfo (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 @@ -3117,7 +3117,7 @@ ) (func $~lib/rt/pure/__release (; 21 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -3423,7 +3423,7 @@ (local $2 i32) (local $3 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.lt_u if return diff --git a/tests/compiler/rc/ternary-mismatch.untouched.wat b/tests/compiler/rc/ternary-mismatch.untouched.wat index 6d763b4a..7c15cab1 100644 --- a/tests/compiler/rc/ternary-mismatch.untouched.wat +++ b/tests/compiler/rc/ternary-mismatch.untouched.wat @@ -28,8 +28,8 @@ (global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 256)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 292)) + (global $~lib/rt/__rtti_base i32 (i32.const 256)) + (global $~lib/heap/__heap_base i32 (i32.const 292)) (export "memory" (memory $0)) (export "test1" (func $rc/ternary-mismatch/test1)) (export "test2" (func $rc/ternary-mismatch/test2)) @@ -779,7 +779,7 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 @@ -1432,7 +1432,7 @@ ) (func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -1498,7 +1498,7 @@ ) (func $~lib/rt/__typeinfo (; 21 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 @@ -3160,7 +3160,7 @@ ) (func $~lib/rt/pure/__release (; 28 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -3323,7 +3323,7 @@ (local $2 i32) (local $3 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.lt_u if return diff --git a/tests/compiler/retain-release-sanity.untouched.wat b/tests/compiler/retain-release-sanity.untouched.wat index ec44ee1e..bc2bb378 100644 --- a/tests/compiler/retain-release-sanity.untouched.wat +++ b/tests/compiler/retain-release-sanity.untouched.wat @@ -37,8 +37,8 @@ (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) (global $~lib/started (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 680)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 748)) + (global $~lib/rt/__rtti_base i32 (i32.const 680)) + (global $~lib/heap/__heap_base i32 (i32.const 748)) (export "memory" (memory $0)) (export "main" (func $retain-release-sanity/main)) (func $~lib/rt/tlsf/removeBlock (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) @@ -786,7 +786,7 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 @@ -1439,7 +1439,7 @@ ) (func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -1480,7 +1480,7 @@ ) (func $~lib/rt/__typeinfo (; 18 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 @@ -3142,7 +3142,7 @@ ) (func $~lib/rt/pure/__release (; 25 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -4587,7 +4587,7 @@ (local $2 i32) (local $3 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.lt_u if return diff --git a/tests/compiler/retain-release.untouched.wat b/tests/compiler/retain-release.untouched.wat index cd08b479..88c66e38 100644 --- a/tests/compiler/retain-release.untouched.wat +++ b/tests/compiler/retain-release.untouched.wat @@ -17,7 +17,7 @@ (global $retain-release/glo (mut i32) (i32.const 0)) (global $retain-release/TARGET (mut i32) (i32.const 0)) (global $~lib/argc (mut i32) (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 92)) + (global $~lib/heap/__heap_base i32 (i32.const 92)) (export "memory" (memory $0)) (export "returnRef" (func $retain-release/returnRef)) (export "receiveRef" (func $retain-release/receiveRef)) @@ -177,7 +177,7 @@ local.get $0 ) (func $start:retain-release (; 5 ;) (type $FUNCSIG$v) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/rt/flags.untouched.wat b/tests/compiler/rt/flags.untouched.wat index aa2398b0..54958f42 100644 --- a/tests/compiler/rt/flags.untouched.wat +++ b/tests/compiler/rt/flags.untouched.wat @@ -13,12 +13,12 @@ (elem (i32.const 0) $null) (global $rt/flags/VALUE_ALIGN_REF i32 (i32.const 128)) (global $rt/flags/KEY_ALIGN_REF i32 (i32.const 65536)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 144)) + (global $~lib/rt/__rtti_base i32 (i32.const 144)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/__typeinfo (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 diff --git a/tests/compiler/rt/instanceof.untouched.wat b/tests/compiler/rt/instanceof.untouched.wat index 8f8ed4c3..79531bf7 100644 --- a/tests/compiler/rt/instanceof.untouched.wat +++ b/tests/compiler/rt/instanceof.untouched.wat @@ -21,8 +21,8 @@ (global $rt/instanceof/nullCat (mut i32) (i32.const 0)) (global $rt/instanceof/nullBlackcat (mut i32) (i32.const 0)) (global $~lib/started (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 56)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 108)) + (global $~lib/rt/__rtti_base i32 (i32.const 56)) + (global $~lib/heap/__heap_base i32 (i32.const 108)) (export "memory" (memory $0)) (export "main" (func $rt/instanceof/main)) (func $~lib/rt/stub/__alloc (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -174,7 +174,7 @@ i32.sub i32.load offset=8 local.set $2 - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $3 local.get $2 local.get $3 @@ -205,7 +205,7 @@ ) (func $start:rt/instanceof (; 7 ;) (type $FUNCSIG$v) (local $0 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/runtime-full.optimized.wat b/tests/compiler/runtime-full.optimized.wat index ed8965a0..d76b4910 100644 --- a/tests/compiler/runtime-full.optimized.wat +++ b/tests/compiler/runtime-full.optimized.wat @@ -18,13 +18,13 @@ (global $~lib/rt/pure/CUR (mut i32) (i32.const 0)) (global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 256)) + (global $~lib/rt/__rtti_base i32 (i32.const 256)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/tlsf/__alloc)) (export "__retain" (func $~lib/rt/pure/__retain)) (export "__release" (func $~lib/rt/pure/__release)) (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__rtti" (global $~lib/rt/RTTI_BASE)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) (func $~lib/rt/tlsf/removeBlock (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) diff --git a/tests/compiler/runtime-full.untouched.wat b/tests/compiler/runtime-full.untouched.wat index 56bf0c71..c639a3dd 100644 --- a/tests/compiler/runtime-full.untouched.wat +++ b/tests/compiler/runtime-full.untouched.wat @@ -22,14 +22,14 @@ (global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 256)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 284)) + (global $~lib/rt/__rtti_base i32 (i32.const 256)) + (global $~lib/heap/__heap_base i32 (i32.const 284)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/tlsf/__alloc)) (export "__retain" (func $~lib/rt/pure/__retain)) (export "__release" (func $~lib/rt/pure/__release)) (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__rtti" (global $~lib/rt/RTTI_BASE)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) (func $~lib/rt/tlsf/removeBlock (; 1 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) @@ -775,7 +775,7 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 @@ -1424,7 +1424,7 @@ ) (func $~lib/rt/pure/__retain (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -1463,7 +1463,7 @@ ) (func $~lib/rt/__typeinfo (; 14 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 @@ -3115,7 +3115,7 @@ ) (func $~lib/rt/pure/__release (; 21 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -3395,7 +3395,7 @@ (local $2 i32) (local $3 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.lt_u if return diff --git a/tests/compiler/runtime-stub.optimized.wat b/tests/compiler/runtime-stub.optimized.wat index b1ccf693..2de8c795 100644 --- a/tests/compiler/runtime-stub.optimized.wat +++ b/tests/compiler/runtime-stub.optimized.wat @@ -7,13 +7,13 @@ (data (i32.const 8) "\03\00\00\00\10\00\00\00\00\00\00\00\10\00\00\00\00\00\00\00\10") (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 8)) + (global $~lib/rt/__rtti_base i32 (i32.const 8)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/stub/__alloc)) (export "__retain" (func $~lib/rt/stub/__retain)) (export "__release" (func $~lib/rt/stub/__release)) (export "__collect" (func $~lib/rt/stub/__collect)) - (export "__rtti" (global $~lib/rt/RTTI_BASE)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) (start $start) (func $~lib/rt/stub/__alloc (; 0 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) diff --git a/tests/compiler/runtime-stub.untouched.wat b/tests/compiler/runtime-stub.untouched.wat index e5e19bc3..6d48c477 100644 --- a/tests/compiler/runtime-stub.untouched.wat +++ b/tests/compiler/runtime-stub.untouched.wat @@ -9,14 +9,14 @@ (elem (i32.const 0) $null) (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 8)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 36)) + (global $~lib/rt/__rtti_base i32 (i32.const 8)) + (global $~lib/heap/__heap_base i32 (i32.const 36)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/stub/__alloc)) (export "__retain" (func $~lib/rt/stub/__retain)) (export "__release" (func $~lib/rt/stub/__release)) (export "__collect" (func $~lib/rt/stub/__collect)) - (export "__rtti" (global $~lib/rt/RTTI_BASE)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) (start $start) (func $~lib/rt/stub/__alloc (; 0 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -120,7 +120,7 @@ nop ) (func $start (; 4 ;) (type $FUNCSIG$v) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/std/array-literal.untouched.wat b/tests/compiler/std/array-literal.untouched.wat index bef62e90..c84d58e3 100644 --- a/tests/compiler/std/array-literal.untouched.wat +++ b/tests/compiler/std/array-literal.untouched.wat @@ -43,8 +43,8 @@ (global $~lib/rt/pure/CUR (mut i32) (i32.const 0)) (global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 528)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 604)) + (global $~lib/rt/__rtti_base i32 (i32.const 528)) + (global $~lib/heap/__heap_base i32 (i32.const 604)) (export "memory" (memory $0)) (start $start) (func $~lib/array/Array#get:length (; 5 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) @@ -856,7 +856,7 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 @@ -1509,7 +1509,7 @@ ) (func $~lib/rt/pure/__retain (; 22 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -3038,7 +3038,7 @@ ) (func $~lib/rt/__typeinfo (; 31 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 @@ -3282,7 +3282,7 @@ ) (func $~lib/rt/pure/__release (; 36 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -3850,7 +3850,7 @@ (local $2 i32) (local $3 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.lt_u if return diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index a9e75a11..3c7ae0e9 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -232,13 +232,13 @@ (global $~lib/util/number/_frc_pow (mut i64) (i64.const 0)) (global $~lib/util/number/_exp_pow (mut i32) (i32.const 0)) (global $~lib/started (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 7248)) + (global $~lib/rt/__rtti_base i32 (i32.const 7248)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/tlsf/__alloc)) (export "__retain" (func $~lib/rt/pure/__retain)) (export "__release" (func $~lib/rt/pure/__release)) (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__rtti" (global $~lib/rt/RTTI_BASE)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) (export "main" (func $std/array/main)) (func $~lib/rt/tlsf/removeBlock (; 6 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index b63e92e6..a9562fa7 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -235,14 +235,14 @@ (global $~lib/builtins/u32.MAX_VALUE i32 (i32.const -1)) (global $~lib/builtins/i64.MAX_VALUE i64 (i64.const 9223372036854775807)) (global $~lib/started (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 7696)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 7908)) + (global $~lib/rt/__rtti_base i32 (i32.const 7696)) + (global $~lib/heap/__heap_base i32 (i32.const 7908)) (export "memory" (memory $0)) (export "__alloc" (func $~lib/rt/tlsf/__alloc)) (export "__retain" (func $~lib/rt/pure/__retain)) (export "__release" (func $~lib/rt/pure/__release)) (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__rtti" (global $~lib/rt/RTTI_BASE)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) (export "main" (func $std/array/main)) (func $~lib/rt/tlsf/removeBlock (; 6 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) (local $2 i32) @@ -989,7 +989,7 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 @@ -1642,7 +1642,7 @@ ) (func $~lib/rt/pure/__retain (; 17 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -1683,7 +1683,7 @@ ) (func $~lib/rt/__typeinfo (; 19 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 @@ -3345,7 +3345,7 @@ ) (func $~lib/rt/pure/__release (; 26 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -24031,7 +24031,7 @@ (local $2 i32) (local $3 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.lt_u if return diff --git a/tests/compiler/std/arraybuffer.untouched.wat b/tests/compiler/std/arraybuffer.untouched.wat index 3154123f..6dcf692c 100644 --- a/tests/compiler/std/arraybuffer.untouched.wat +++ b/tests/compiler/std/arraybuffer.untouched.wat @@ -23,7 +23,7 @@ (global $std/arraybuffer/sliced (mut i32) (i32.const 0)) (global $std/arraybuffer/arr8 (mut i32) (i32.const 0)) (global $~lib/argc (mut i32) (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 240)) + (global $~lib/heap/__heap_base i32 (i32.const 240)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/stub/__alloc (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -2974,7 +2974,7 @@ (local $1 i32) (local $2 i32) (local $3 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/std/dataview.untouched.wat b/tests/compiler/std/dataview.untouched.wat index 51f2aa26..6c07b12e 100644 --- a/tests/compiler/std/dataview.untouched.wat +++ b/tests/compiler/std/dataview.untouched.wat @@ -29,7 +29,7 @@ (global $std/dataview/array (mut i32) (i32.const 0)) (global $std/dataview/view (mut i32) (i32.const 0)) (global $~lib/argc (mut i32) (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 320)) + (global $~lib/heap/__heap_base i32 (i32.const 320)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/stub/__alloc (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -1141,7 +1141,7 @@ (local $0 i32) (local $1 i32) (local $2 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/std/date.untouched.wat b/tests/compiler/std/date.untouched.wat index a6a76476..ad6e7da3 100644 --- a/tests/compiler/std/date.untouched.wat +++ b/tests/compiler/std/date.untouched.wat @@ -19,7 +19,7 @@ (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) (global $std/date/date (mut i32) (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 48)) + (global $~lib/heap/__heap_base i32 (i32.const 48)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/stub/__alloc (; 3 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -283,7 +283,7 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index 6d96cc23..aa051bb8 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -39,8 +39,8 @@ (global $~lib/rt/pure/CUR (mut i32) (i32.const 0)) (global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 400)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 508)) + (global $~lib/rt/__rtti_base i32 (i32.const 400)) + (global $~lib/heap/__heap_base i32 (i32.const 508)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/tlsf/removeBlock (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) @@ -788,7 +788,7 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 @@ -1441,7 +1441,7 @@ ) (func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -1769,7 +1769,7 @@ ) (func $~lib/rt/__typeinfo (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 @@ -3431,7 +3431,7 @@ ) (func $~lib/rt/pure/__release (; 27 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -12561,7 +12561,7 @@ (local $2 i32) (local $3 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.lt_u if return diff --git a/tests/compiler/std/new.untouched.wat b/tests/compiler/std/new.untouched.wat index 00747a82..d3182e92 100644 --- a/tests/compiler/std/new.untouched.wat +++ b/tests/compiler/std/new.untouched.wat @@ -10,7 +10,7 @@ (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) (global $std/new/aClass (mut i32) (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 8)) + (global $~lib/heap/__heap_base i32 (i32.const 8)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/stub/__alloc (; 0 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -138,7 +138,7 @@ local.get $0 ) (func $start:std/new (; 3 ;) (type $FUNCSIG$v) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/std/object-literal.untouched.wat b/tests/compiler/std/object-literal.untouched.wat index 1388f5ec..507c5536 100644 --- a/tests/compiler/std/object-literal.untouched.wat +++ b/tests/compiler/std/object-literal.untouched.wat @@ -13,7 +13,7 @@ (elem (i32.const 0) $null) (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 108)) + (global $~lib/heap/__heap_base i32 (i32.const 108)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/stub/__alloc (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -331,7 +331,7 @@ (local $0 i32) (local $1 i32) (local $2 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/std/operator-overloading.untouched.wat b/tests/compiler/std/operator-overloading.untouched.wat index 09623d5d..dfedd2fd 100644 --- a/tests/compiler/std/operator-overloading.untouched.wat +++ b/tests/compiler/std/operator-overloading.untouched.wat @@ -81,7 +81,7 @@ (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 $~lib/heap/HEAP_BASE i32 (i32.const 80)) + (global $~lib/heap/__heap_base i32 (i32.const 80)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/stub/__alloc (; 1 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -2129,7 +2129,7 @@ (local $21 i32) (local $22 i32) (local $23 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index ba976195..0752b238 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -39,8 +39,8 @@ (global $~lib/rt/pure/CUR (mut i32) (i32.const 0)) (global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 400)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 508)) + (global $~lib/rt/__rtti_base i32 (i32.const 400)) + (global $~lib/heap/__heap_base i32 (i32.const 508)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/tlsf/removeBlock (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) @@ -788,7 +788,7 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 @@ -1441,7 +1441,7 @@ ) (func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -1769,7 +1769,7 @@ ) (func $~lib/rt/__typeinfo (; 20 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 @@ -3431,7 +3431,7 @@ ) (func $~lib/rt/pure/__release (; 27 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -11325,7 +11325,7 @@ (local $2 i32) (local $3 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.lt_u if return diff --git a/tests/compiler/std/static-array.untouched.wat b/tests/compiler/std/static-array.untouched.wat index 26516841..ec02fc8a 100644 --- a/tests/compiler/std/static-array.untouched.wat +++ b/tests/compiler/std/static-array.untouched.wat @@ -33,7 +33,7 @@ (global $~lib/rt/stub/startOffset (mut i32) (i32.const 0)) (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 452)) + (global $~lib/heap/__heap_base i32 (i32.const 452)) (export "memory" (memory $0)) (start $start) (func $~lib/array/Array#get:length (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) @@ -2224,7 +2224,7 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/std/string-utf8.untouched.wat b/tests/compiler/std/string-utf8.untouched.wat index e90dd64c..1fa46698 100644 --- a/tests/compiler/std/string-utf8.untouched.wat +++ b/tests/compiler/std/string-utf8.untouched.wat @@ -24,7 +24,7 @@ (global $~lib/rt/stub/offset (mut i32) (i32.const 0)) (global $std/string-utf8/ptr (mut i32) (i32.const 0)) (global $~lib/ASC_SHRINK_LEVEL i32 (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 252)) + (global $~lib/heap/__heap_base i32 (i32.const 252)) (export "memory" (memory $0)) (start $start) (func $~lib/string/String#get:length (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) @@ -2341,7 +2341,7 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/std/string.untouched.wat b/tests/compiler/std/string.untouched.wat index 4cfa93ac..640e247a 100644 --- a/tests/compiler/std/string.untouched.wat +++ b/tests/compiler/std/string.untouched.wat @@ -208,8 +208,8 @@ (global $~lib/builtins/f64.EPSILON f64 (f64.const 2.220446049250313e-16)) (global $~lib/builtins/f64.MAX_VALUE f64 (f64.const 1797693134862315708145274e284)) (global $~lib/started (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 7032)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 7100)) + (global $~lib/rt/__rtti_base i32 (i32.const 7032)) + (global $~lib/heap/__heap_base i32 (i32.const 7100)) (export "memory" (memory $0)) (export "getString" (func $std/string/getString)) (export "main" (func $std/string/main)) @@ -288,7 +288,7 @@ ) (func $~lib/rt/pure/__retain (; 8 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -911,7 +911,7 @@ ) (func $~lib/rt/__typeinfo (; 12 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 @@ -1097,7 +1097,7 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 @@ -3338,7 +3338,7 @@ ) (func $~lib/rt/pure/__release (; 27 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -12315,7 +12315,7 @@ (local $2 i32) (local $3 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.lt_u if return diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index 8cb87c5d..3e851935 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -53,7 +53,7 @@ (global $std/symbol/hasInstance (mut i32) (i32.const 0)) (global $~lib/symbol/_Symbol.isConcatSpreadable i32 (i32.const 2)) (global $std/symbol/isConcatSpreadable (mut i32) (i32.const 0)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 884)) + (global $~lib/heap/__heap_base i32 (i32.const 884)) (export "memory" (memory $0)) (start $start) (func $~lib/rt/stub/__retain (; 1 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) @@ -3654,7 +3654,7 @@ call $~lib/builtins/abort unreachable end - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index 574f9931..e95270a3 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -102,8 +102,8 @@ (global $std/typedarray/forEachValues (mut i32) (i32.const 1112)) (global $std/typedarray/testArrayReverseValues (mut i32) (i32.const 1480)) (global $~lib/started (mut i32) (i32.const 0)) - (global $~lib/rt/RTTI_BASE i32 (i32.const 1688)) - (global $~lib/heap/HEAP_BASE i32 (i32.const 1820)) + (global $~lib/rt/__rtti_base i32 (i32.const 1688)) + (global $~lib/heap/__heap_base i32 (i32.const 1820)) (export "memory" (memory $0)) (export "main" (func $std/typedarray/main)) (func $~lib/rt/tlsf/removeBlock (; 5 ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) @@ -851,7 +851,7 @@ (local $7 i32) (local $8 i32) (local $9 i32) - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.const 15 i32.add i32.const 15 @@ -1504,7 +1504,7 @@ ) (func $~lib/rt/pure/__retain (; 16 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -1545,7 +1545,7 @@ ) (func $~lib/rt/__typeinfo (; 18 ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) (local $1 i32) - global.get $~lib/rt/RTTI_BASE + global.get $~lib/rt/__rtti_base local.set $1 local.get $0 local.get $1 @@ -3207,7 +3207,7 @@ ) (func $~lib/rt/pure/__release (; 25 ;) (type $FUNCSIG$vi) (param $0 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.gt_u if local.get $0 @@ -23600,7 +23600,7 @@ (local $2 i32) (local $3 i32) local.get $0 - global.get $~lib/heap/HEAP_BASE + global.get $~lib/heap/__heap_base i32.lt_u if return