diff --git a/.gitignore b/.gitignore index 79f88211f5..a061461ccc 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ docs/ node_modules/ out/ raw/ +.history +.vscode +.idea diff --git a/bin/asinit b/bin/asinit old mode 100644 new mode 100755 diff --git a/cli/asc.js b/cli/asc.js index 09f7afb577..9d31afc64b 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -92,33 +92,41 @@ exports.definitionFiles = exports.isBundle ? BUNDLE_DEFINITIONS : (() => { // se })(); /** Convenience function that parses and compiles source strings directly. */ -exports.compileString = (sources, options) => { +exports.compileString = async (sources, options) => { if (typeof sources === "string") sources = { "input.ts": sources }; const output = Object.create({ stdout: createMemoryStream(), stderr: createMemoryStream() }); - var argv = [ - "--binaryFile", "binary", - "--textFile", "text", - ]; + debugger; + var argv = []; Object.keys(options || {}).forEach(key => { - var val = options[key]; - if (Array.isArray(val)) val.forEach(val => argv.push("--" + key, String(val))); - else argv.push("--" + key, String(val)); + if (key != "readFile" && key != 'writeFile'){ + var val = options[key]; + debugger; + if (Array.isArray(val)) val.forEach(val => argv.push("--" + key, String(val))); + else argv.push("--" + key, String(val)); + } }); - exports.main(argv.concat(Object.keys(sources)), { + await exports.main(argv.concat(Object.keys(sources)), { stdout: output.stdout, stderr: output.stderr, - readFile: name => sources.hasOwnProperty(name) ? sources[name] : null, - writeFile: (name, contents) => output[name] = contents, + readFile: async (name) => { + try { + return await options.readFile(name); + }catch (e){ + return null; + } + }, + writeFile: async (name, contents) => await options.writeFile(name, contents), listFiles: () => [] }); + debugger; return output; } /** Runs the command line utility using the specified arguments array. */ -exports.main = function main(argv, options, callback) { +exports.main = async function main(argv, options, callback) { if (typeof options === "function") { callback = options; options = {}; @@ -226,7 +234,7 @@ exports.main = function main(argv, options, callback) { // Begin parsing var parser = null; - + debugger; // Include library files if (!args.noLib) { Object.keys(exports.libraryFiles).forEach(libPath => { @@ -422,7 +430,9 @@ exports.main = function main(argv, options, callback) { assemblyscript.setNoTreeShaking(compilerOptions, args.noTreeShaking); assemblyscript.setNoAssert(compilerOptions, args.noAssert); assemblyscript.setImportMemory(compilerOptions, args.importMemory); + assemblyscript.setSharedMemory(compilerOptions, args.sharedMemory); assemblyscript.setImportTable(compilerOptions, args.importTable); + assemblyscript.ignoreDataSegments(compilerOptions, args.ignoreDataSegments); assemblyscript.setMemoryBase(compilerOptions, args.memoryBase >>> 0); assemblyscript.setSourceMap(compilerOptions, args.sourceMap != null); assemblyscript.setOptimizeLevelHints(compilerOptions, optimizeLevel, shrinkLevel); @@ -555,7 +565,7 @@ exports.main = function main(argv, options, callback) { args.binaryFile = args.outFile; } } - + debugger; // Write binary if (args.binaryFile != null) { let sourceMapURL = args.sourceMap != null @@ -583,7 +593,7 @@ exports.main = function main(argv, options, callback) { if (args.binaryFile.length) { let sourceMap = JSON.parse(wasm.sourceMap); sourceMap.sourceRoot = exports.sourceMapRoot; - sourceMap.sources.forEach((name, index) => { + sourceMap.sources.forEach(async (name, index) => { let text = null; if (name.startsWith(exports.libraryPrefix)) { let stdName = name.substring(exports.libraryPrefix.length).replace(/\.ts$/, ""); diff --git a/cli/asc.json b/cli/asc.json index 7ee80c7771..becfcd6ad9 100644 --- a/cli/asc.json +++ b/cli/asc.json @@ -106,6 +106,16 @@ "type": "b", "default": false }, + "sharedMemory": { + "description": "Declare memory as shared.", + "type": "i", + "default": 0 + }, + "ignoreDataSegments": { + "description": "Ingore data segments to binary. Default false.", + "type": "b", + "default": false + }, "memoryBase": { "description": "Sets the start offset of compiler-generated static memory.", "type": "i", diff --git a/examples/atomic-shared-memory/assembly/index.js b/examples/atomic-shared-memory/assembly/index.js new file mode 100644 index 0000000000..5621c90d80 --- /dev/null +++ b/examples/atomic-shared-memory/assembly/index.js @@ -0,0 +1,23 @@ +const fs = require("fs"); +const path = require("path"); + +const compiled = new WebAssembly.Module( + fs.readFileSync(path.resolve(__dirname, "..", "build", "atomic.builtins.wasm")) +); +const memory = new WebAssembly.Memory({ + initial: 256, + maximum: 256, + shared: true +}) +const imports = { + env: { + memory, + abort: (filename, line, column) => { + throw Error("abort called at " + line + ":" + colum); + } + } +}; + +Object.defineProperty(module, "exports", { + get: () => new WebAssembly.Instance(compiled, imports).exports +}); diff --git a/examples/atomic-shared-memory/assembly/index.ts b/examples/atomic-shared-memory/assembly/index.ts new file mode 100644 index 0000000000..ae85beb392 --- /dev/null +++ b/examples/atomic-shared-memory/assembly/index.ts @@ -0,0 +1,105 @@ +declare function log(v: i32): void; + +export function test(): void { + var i: i32 = 0; + var u: u32 = 0; + var I: i64 = 0; + var U: u64 = 0; + + // Atomic store + Atomic.store(120, 8); + Atomic.store(121, 16); + Atomic.store(123, 32); + + Atomic.store(120, 8); + Atomic.store(121, 16); + Atomic.store(123, 32); + Atomic.store(127, 64); + + // Atomic load + i = Atomic.load(120); + i = Atomic.load(121); + i = Atomic.load(123); + u = Atomic.load(120); + u = Atomic.load(121); + u = Atomic.load(123); + + I = Atomic.load(120); + I = Atomic.load(121); + I = Atomic.load(123); + I = Atomic.load(127); + U = Atomic.load(120); + U = Atomic.load(121); + U = Atomic.load(123); + U = Atomic.load(127); + + // Atomic add + i = Atomic.add(120, 1); + i = Atomic.add(121, 1); + i = Atomic.add(123, 1); + + I = Atomic.add(120, 1); + I = Atomic.add(121, 1); + I = Atomic.add(123, 1); + I = Atomic.add(127, 1); + + // Atomic subtract + Atomic.sub(120, 1); + Atomic.sub(121, 1); + Atomic.sub(123, 1); + + I = Atomic.sub(120, 1); + I = Atomic.sub(121, 1); + I = Atomic.sub(123, 1); + I = Atomic.sub(127, 1); + + // Atomic AND + Atomic.and(120, 1); + Atomic.and(121, 1); + Atomic.and(123, 1); + + I = Atomic.and(120, 1); + I = Atomic.and(121, 1); + I = Atomic.and(123, 1); + I = Atomic.and(127, 1); + + // Atomic OR + Atomic.or(120, 1); + Atomic.or(121, 1); + Atomic.or(123, 1); + + I = Atomic.or(120, 1); + I = Atomic.or(121, 1); + I = Atomic.or(123, 1); + I = Atomic.or(127, 1); + + // Atomic XOR + Atomic.xor(120, 1); + Atomic.xor(121, 1); + Atomic.xor(123, 1); + + I = Atomic.xor(120, 1); + I = Atomic.xor(121, 1); + I = Atomic.xor(123, 1); + I = Atomic.xor(127, 1); + + // Atomic xchg + Atomic.xchg(120, 1); + Atomic.xchg(121, 1); + Atomic.xchg(123, 1); + + I = Atomic.xchg(120, 1); + I = Atomic.xchg(121, 1); + I = Atomic.xchg(123, 1); + I = Atomic.xchg(127, 1); + + // Atomic cmpxchg + Atomic.cmpxchg(120, 1, 2); + Atomic.cmpxchg(121, 1, 2); + Atomic.cmpxchg(123, 1, 2); + + I = Atomic.cmpxchg(120, 1, 2); + I = Atomic.cmpxchg(121, 1, 2); + I = Atomic.cmpxchg(123, 1, 2); + I = Atomic.cmpxchg(127, 1, 2); +} diff --git a/examples/atomic-shared-memory/assembly/tsconfig.json b/examples/atomic-shared-memory/assembly/tsconfig.json new file mode 100644 index 0000000000..449ca07c76 --- /dev/null +++ b/examples/atomic-shared-memory/assembly/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../../../std/assembly.json", + "include": [ + "./**/*.ts" + ] +} \ No newline at end of file diff --git a/examples/atomic-shared-memory/build/index.asm.js b/examples/atomic-shared-memory/build/index.asm.js new file mode 100644 index 0000000000..1c7e54b859 --- /dev/null +++ b/examples/atomic-shared-memory/build/index.asm.js @@ -0,0 +1,77 @@ +function asmFunc(global, env, buffer) { + "almost asm"; + var HEAP8 = new global.Int8Array(buffer); + var HEAP16 = new global.Int16Array(buffer); + var HEAP32 = new global.Int32Array(buffer); + var HEAPU8 = new global.Uint8Array(buffer); + var HEAPU16 = new global.Uint16Array(buffer); + var HEAPU32 = new global.Uint32Array(buffer); + var HEAPF32 = new global.Float32Array(buffer); + var HEAPF64 = new global.Float64Array(buffer); + var Math_imul = global.Math.imul; + var Math_fround = global.Math.fround; + var Math_abs = global.Math.abs; + var Math_clz32 = global.Math.clz32; + var Math_min = global.Math.min; + var Math_max = global.Math.max; + var Math_floor = global.Math.floor; + var Math_ceil = global.Math.ceil; + var Math_sqrt = global.Math.sqrt; + var abort = env.abort; + var nan = global.NaN; + var infinity = global.Infinity; + var $0 = env.memory; + var $lib_allocator_arena_startOffset = 0; + var $lib_allocator_arena_offset = 0; + var assembly_index_str = 8; + var HEAP_BASE = 16; + var i64toi32_i32$HIGH_BITS = 0; + function assembly_index_read() { + return assembly_index_str | 0; + } + + function start() { + $lib_allocator_arena_startOffset = (HEAP_BASE + 7 | 0) & 4294967288 | 0; + $lib_allocator_arena_offset = $lib_allocator_arena_startOffset; + } + + function __wasm_grow_memory(pagesToAdd) { + pagesToAdd = pagesToAdd | 0; + var oldPages = __wasm_current_memory() | 0; + var newPages = oldPages + pagesToAdd | 0; + if ((oldPages < newPages) && (newPages < 65535)) { + var newBuffer = new ArrayBuffer(Math_imul(newPages, 65536)); + var newHEAP8 = new global.Int8Array(newBuffer); + newHEAP8.set(HEAP8); + HEAP8 = newHEAP8; + HEAP16 = new global.Int16Array(newBuffer); + HEAP32 = new global.Int32Array(newBuffer); + HEAPU8 = new global.Uint8Array(newBuffer); + HEAPU16 = new global.Uint16Array(newBuffer); + HEAPU32 = new global.Uint32Array(newBuffer); + HEAPF32 = new global.Float32Array(newBuffer); + HEAPF64 = new global.Float64Array(newBuffer); + buffer = newBuffer; + } + return oldPages; + } + + function __wasm_current_memory() { + return buffer.byteLength / 65536 | 0; + } + + return { + read: assembly_index_read, + memory: Object.create(Object.prototype, { + grow: { + value: __wasm_grow_memory + }, + buffer: { + get: function () { + return buffer; + } + + } + }) + }; +} diff --git a/examples/atomic-shared-memory/build/index.js b/examples/atomic-shared-memory/build/index.js new file mode 100644 index 0000000000..0870226f6f --- /dev/null +++ b/examples/atomic-shared-memory/build/index.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +require("allocator/arena"); +let str = "A"; +function read() { + return str; +} +exports.read = read; diff --git a/examples/atomic-shared-memory/build/optimized.wat b/examples/atomic-shared-memory/build/optimized.wat new file mode 100644 index 0000000000..7983a4cac9 --- /dev/null +++ b/examples/atomic-shared-memory/build/optimized.wat @@ -0,0 +1,410 @@ +(module + (type $v (func)) + (import "env" "memory" (memory $0 (shared 256 256))) + (export "memory" (memory $0)) + (export "test" (func $assembly/index/test)) + (func $assembly/index/test (; 0 ;) (; has Stack IR ;) (type $v) + (i32.atomic.store8 + (i32.const 120) + (i32.const 8) + ) + (i32.atomic.store16 + (i32.const 121) + (i32.const 16) + ) + (i32.atomic.store + (i32.const 123) + (i32.const 32) + ) + (i64.atomic.store8 + (i32.const 120) + (i64.const 8) + ) + (i64.atomic.store16 + (i32.const 121) + (i64.const 16) + ) + (i64.atomic.store32 + (i32.const 123) + (i64.const 32) + ) + (i64.atomic.store + (i32.const 127) + (i64.const 64) + ) + (drop + (i32.atomic.load8_u + (i32.const 120) + ) + ) + (drop + (i32.atomic.load16_u + (i32.const 121) + ) + ) + (drop + (i32.atomic.load + (i32.const 123) + ) + ) + (drop + (i32.atomic.load8_u + (i32.const 120) + ) + ) + (drop + (i32.atomic.load16_u + (i32.const 121) + ) + ) + (drop + (i32.atomic.load + (i32.const 123) + ) + ) + (drop + (i64.atomic.load8_u + (i32.const 120) + ) + ) + (drop + (i64.atomic.load16_u + (i32.const 121) + ) + ) + (drop + (i64.atomic.load32_u + (i32.const 123) + ) + ) + (drop + (i64.atomic.load + (i32.const 127) + ) + ) + (drop + (i64.atomic.load8_u + (i32.const 120) + ) + ) + (drop + (i64.atomic.load16_u + (i32.const 121) + ) + ) + (drop + (i64.atomic.load32_u + (i32.const 123) + ) + ) + (drop + (i64.atomic.load + (i32.const 127) + ) + ) + (drop + (i32.atomic.rmw8_u.add + (i32.const 120) + (i32.const 1) + ) + ) + (drop + (i32.atomic.rmw16_u.add + (i32.const 121) + (i32.const 1) + ) + ) + (drop + (i32.atomic.rmw.add + (i32.const 123) + (i32.const 1) + ) + ) + (drop + (i64.atomic.rmw8_u.add + (i32.const 120) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw16_u.add + (i32.const 121) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw32_u.add + (i32.const 123) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw.add + (i32.const 127) + (i64.const 1) + ) + ) + (drop + (i32.atomic.rmw8_u.sub + (i32.const 120) + (i32.const 1) + ) + ) + (drop + (i32.atomic.rmw16_u.sub + (i32.const 121) + (i32.const 1) + ) + ) + (drop + (i32.atomic.rmw.sub + (i32.const 123) + (i32.const 1) + ) + ) + (drop + (i64.atomic.rmw8_u.sub + (i32.const 120) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw16_u.sub + (i32.const 121) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw32_u.sub + (i32.const 123) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw.sub + (i32.const 127) + (i64.const 1) + ) + ) + (drop + (i32.atomic.rmw8_u.and + (i32.const 120) + (i32.const 1) + ) + ) + (drop + (i32.atomic.rmw16_u.and + (i32.const 121) + (i32.const 1) + ) + ) + (drop + (i32.atomic.rmw.and + (i32.const 123) + (i32.const 1) + ) + ) + (drop + (i64.atomic.rmw8_u.and + (i32.const 120) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw16_u.and + (i32.const 121) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw32_u.and + (i32.const 123) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw.and + (i32.const 127) + (i64.const 1) + ) + ) + (drop + (i32.atomic.rmw8_u.or + (i32.const 120) + (i32.const 1) + ) + ) + (drop + (i32.atomic.rmw16_u.or + (i32.const 121) + (i32.const 1) + ) + ) + (drop + (i32.atomic.rmw.or + (i32.const 123) + (i32.const 1) + ) + ) + (drop + (i64.atomic.rmw8_u.or + (i32.const 120) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw16_u.or + (i32.const 121) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw32_u.or + (i32.const 123) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw.or + (i32.const 127) + (i64.const 1) + ) + ) + (drop + (i32.atomic.rmw8_u.xor + (i32.const 120) + (i32.const 1) + ) + ) + (drop + (i32.atomic.rmw16_u.xor + (i32.const 121) + (i32.const 1) + ) + ) + (drop + (i32.atomic.rmw.xor + (i32.const 123) + (i32.const 1) + ) + ) + (drop + (i64.atomic.rmw8_u.xor + (i32.const 120) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw16_u.xor + (i32.const 121) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw32_u.xor + (i32.const 123) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw.xor + (i32.const 127) + (i64.const 1) + ) + ) + (drop + (i32.atomic.rmw8_u.xchg + (i32.const 120) + (i32.const 1) + ) + ) + (drop + (i32.atomic.rmw16_u.xchg + (i32.const 121) + (i32.const 1) + ) + ) + (drop + (i32.atomic.rmw.xchg + (i32.const 123) + (i32.const 1) + ) + ) + (drop + (i64.atomic.rmw8_u.xchg + (i32.const 120) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw16_u.xchg + (i32.const 121) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw32_u.xchg + (i32.const 123) + (i64.const 1) + ) + ) + (drop + (i64.atomic.rmw.xchg + (i32.const 127) + (i64.const 1) + ) + ) + (drop + (i32.atomic.rmw8_u.cmpxchg + (i32.const 120) + (i32.const 1) + (i32.const 2) + ) + ) + (drop + (i32.atomic.rmw16_u.cmpxchg + (i32.const 121) + (i32.const 1) + (i32.const 2) + ) + ) + (drop + (i32.atomic.rmw.cmpxchg + (i32.const 123) + (i32.const 1) + (i32.const 2) + ) + ) + (drop + (i64.atomic.rmw8_u.cmpxchg + (i32.const 120) + (i64.const 1) + (i64.const 2) + ) + ) + (drop + (i64.atomic.rmw16_u.cmpxchg + (i32.const 121) + (i64.const 1) + (i64.const 2) + ) + ) + (drop + (i64.atomic.rmw32_u.cmpxchg + (i32.const 123) + (i64.const 1) + (i64.const 2) + ) + ) + (drop + (i64.atomic.rmw.cmpxchg + (i32.const 127) + (i64.const 1) + (i64.const 2) + ) + ) + ) + (func $null (; 1 ;) (; has Stack IR ;) (type $v) + (nop) + ) +) diff --git a/examples/atomic-shared-memory/build/untouched.wat b/examples/atomic-shared-memory/build/untouched.wat new file mode 100644 index 0000000000..59edd97866 --- /dev/null +++ b/examples/atomic-shared-memory/build/untouched.wat @@ -0,0 +1,684 @@ +(module + (type $v (func)) + (import "env" "memory" (memory $0 (shared 256 256))) + (table 1 1 anyfunc) + (elem (i32.const 0) $null) + (global $HEAP_BASE i32 (i32.const 8)) + (export "memory" (memory $0)) + (export "test" (func $assembly/index/test)) + (func $assembly/index/test (; 0 ;) (type $v) + (local $0 i32) + (local $1 i32) + (local $2 i64) + (local $3 i64) + ;;@ assembly/index.ts:4:2 + (set_local $0 + ;;@ assembly/index.ts:4:15 + (i32.const 0) + ) + ;;@ assembly/index.ts:5:2 + (set_local $1 + ;;@ assembly/index.ts:5:15 + (i32.const 0) + ) + ;;@ assembly/index.ts:6:2 + (set_local $2 + ;;@ assembly/index.ts:6:15 + (i64.const 0) + ) + ;;@ assembly/index.ts:7:2 + (set_local $3 + ;;@ assembly/index.ts:7:15 + (i64.const 0) + ) + ;;@ assembly/index.ts:10:9 + (i32.atomic.store8 + ;;@ assembly/index.ts:10:19 + (i32.const 120) + ;;@ assembly/index.ts:10:24 + (i32.const 8) + ) + ;;@ assembly/index.ts:11:9 + (i32.atomic.store16 + ;;@ assembly/index.ts:11:20 + (i32.const 121) + ;;@ assembly/index.ts:11:25 + (i32.const 16) + ) + ;;@ assembly/index.ts:12:9 + (i32.atomic.store + ;;@ assembly/index.ts:12:20 + (i32.const 123) + ;;@ assembly/index.ts:12:25 + (i32.const 32) + ) + ;;@ assembly/index.ts:14:9 + (i64.atomic.store8 + ;;@ assembly/index.ts:14:19 + (i32.const 120) + ;;@ assembly/index.ts:14:24 + (i64.const 8) + ) + ;;@ assembly/index.ts:15:9 + (i64.atomic.store16 + ;;@ assembly/index.ts:15:20 + (i32.const 121) + ;;@ assembly/index.ts:15:25 + (i64.const 16) + ) + ;;@ assembly/index.ts:16:9 + (i64.atomic.store32 + ;;@ assembly/index.ts:16:20 + (i32.const 123) + ;;@ assembly/index.ts:16:25 + (i64.const 32) + ) + ;;@ assembly/index.ts:17:9 + (i64.atomic.store + ;;@ assembly/index.ts:17:20 + (i32.const 127) + ;;@ assembly/index.ts:17:25 + (i64.const 64) + ) + ;;@ assembly/index.ts:20:2 + (set_local $0 + ;;@ assembly/index.ts:20:13 + (i32.atomic.load8_u + ;;@ assembly/index.ts:20:22 + (i32.const 120) + ) + ) + ;;@ assembly/index.ts:21:2 + (set_local $0 + ;;@ assembly/index.ts:21:13 + (i32.atomic.load16_u + ;;@ assembly/index.ts:21:23 + (i32.const 121) + ) + ) + ;;@ assembly/index.ts:22:2 + (set_local $0 + ;;@ assembly/index.ts:22:13 + (i32.atomic.load + ;;@ assembly/index.ts:22:23 + (i32.const 123) + ) + ) + ;;@ assembly/index.ts:23:2 + (set_local $1 + ;;@ assembly/index.ts:23:13 + (i32.atomic.load8_u + ;;@ assembly/index.ts:23:22 + (i32.const 120) + ) + ) + ;;@ assembly/index.ts:24:2 + (set_local $1 + ;;@ assembly/index.ts:24:13 + (i32.atomic.load16_u + ;;@ assembly/index.ts:24:23 + (i32.const 121) + ) + ) + ;;@ assembly/index.ts:25:2 + (set_local $1 + ;;@ assembly/index.ts:25:13 + (i32.atomic.load + ;;@ assembly/index.ts:25:23 + (i32.const 123) + ) + ) + ;;@ assembly/index.ts:27:2 + (set_local $2 + ;;@ assembly/index.ts:27:13 + (i64.atomic.load8_u + ;;@ assembly/index.ts:27:22 + (i32.const 120) + ) + ) + ;;@ assembly/index.ts:28:2 + (set_local $2 + ;;@ assembly/index.ts:28:13 + (i64.atomic.load16_u + ;;@ assembly/index.ts:28:23 + (i32.const 121) + ) + ) + ;;@ assembly/index.ts:29:2 + (set_local $2 + ;;@ assembly/index.ts:29:13 + (i64.atomic.load32_u + ;;@ assembly/index.ts:29:23 + (i32.const 123) + ) + ) + ;;@ assembly/index.ts:30:2 + (set_local $2 + ;;@ assembly/index.ts:30:13 + (i64.atomic.load + ;;@ assembly/index.ts:30:23 + (i32.const 127) + ) + ) + ;;@ assembly/index.ts:31:2 + (set_local $3 + ;;@ assembly/index.ts:31:13 + (i64.atomic.load8_u + ;;@ assembly/index.ts:31:22 + (i32.const 120) + ) + ) + ;;@ assembly/index.ts:32:2 + (set_local $3 + ;;@ assembly/index.ts:32:13 + (i64.atomic.load16_u + ;;@ assembly/index.ts:32:23 + (i32.const 121) + ) + ) + ;;@ assembly/index.ts:33:2 + (set_local $3 + ;;@ assembly/index.ts:33:13 + (i64.atomic.load32_u + ;;@ assembly/index.ts:33:23 + (i32.const 123) + ) + ) + ;;@ assembly/index.ts:34:2 + (set_local $3 + ;;@ assembly/index.ts:34:13 + (i64.atomic.load + ;;@ assembly/index.ts:34:23 + (i32.const 127) + ) + ) + ;;@ assembly/index.ts:37:2 + (set_local $0 + ;;@ assembly/index.ts:37:13 + (i32.atomic.rmw8_u.add + ;;@ assembly/index.ts:37:21 + (i32.const 120) + ;;@ assembly/index.ts:37:26 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:38:2 + (set_local $0 + ;;@ assembly/index.ts:38:13 + (i32.atomic.rmw16_u.add + ;;@ assembly/index.ts:38:22 + (i32.const 121) + ;;@ assembly/index.ts:38:27 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:39:2 + (set_local $0 + ;;@ assembly/index.ts:39:13 + (i32.atomic.rmw.add + ;;@ assembly/index.ts:39:22 + (i32.const 123) + ;;@ assembly/index.ts:39:27 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:41:2 + (set_local $2 + ;;@ assembly/index.ts:41:13 + (i64.atomic.rmw8_u.add + ;;@ assembly/index.ts:41:21 + (i32.const 120) + ;;@ assembly/index.ts:41:26 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:42:2 + (set_local $2 + ;;@ assembly/index.ts:42:13 + (i64.atomic.rmw16_u.add + ;;@ assembly/index.ts:42:22 + (i32.const 121) + ;;@ assembly/index.ts:42:27 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:43:2 + (set_local $2 + ;;@ assembly/index.ts:43:13 + (i64.atomic.rmw32_u.add + ;;@ assembly/index.ts:43:22 + (i32.const 123) + ;;@ assembly/index.ts:43:27 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:44:2 + (set_local $2 + ;;@ assembly/index.ts:44:13 + (i64.atomic.rmw.add + ;;@ assembly/index.ts:44:22 + (i32.const 127) + ;;@ assembly/index.ts:44:27 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:47:9 + (drop + (i32.atomic.rmw8_u.sub + ;;@ assembly/index.ts:47:17 + (i32.const 120) + ;;@ assembly/index.ts:47:22 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:48:9 + (drop + (i32.atomic.rmw16_u.sub + ;;@ assembly/index.ts:48:18 + (i32.const 121) + ;;@ assembly/index.ts:48:23 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:49:9 + (drop + (i32.atomic.rmw.sub + ;;@ assembly/index.ts:49:18 + (i32.const 123) + ;;@ assembly/index.ts:49:23 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:51:2 + (set_local $2 + ;;@ assembly/index.ts:51:13 + (i64.atomic.rmw8_u.sub + ;;@ assembly/index.ts:51:21 + (i32.const 120) + ;;@ assembly/index.ts:51:26 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:52:2 + (set_local $2 + ;;@ assembly/index.ts:52:13 + (i64.atomic.rmw16_u.sub + ;;@ assembly/index.ts:52:22 + (i32.const 121) + ;;@ assembly/index.ts:52:27 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:53:2 + (set_local $2 + ;;@ assembly/index.ts:53:13 + (i64.atomic.rmw32_u.sub + ;;@ assembly/index.ts:53:22 + (i32.const 123) + ;;@ assembly/index.ts:53:27 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:54:2 + (set_local $2 + ;;@ assembly/index.ts:54:13 + (i64.atomic.rmw.sub + ;;@ assembly/index.ts:54:22 + (i32.const 127) + ;;@ assembly/index.ts:54:27 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:57:9 + (drop + (i32.atomic.rmw8_u.and + ;;@ assembly/index.ts:57:17 + (i32.const 120) + ;;@ assembly/index.ts:57:22 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:58:9 + (drop + (i32.atomic.rmw16_u.and + ;;@ assembly/index.ts:58:18 + (i32.const 121) + ;;@ assembly/index.ts:58:23 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:59:9 + (drop + (i32.atomic.rmw.and + ;;@ assembly/index.ts:59:18 + (i32.const 123) + ;;@ assembly/index.ts:59:23 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:61:2 + (set_local $2 + ;;@ assembly/index.ts:61:13 + (i64.atomic.rmw8_u.and + ;;@ assembly/index.ts:61:21 + (i32.const 120) + ;;@ assembly/index.ts:61:26 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:62:2 + (set_local $2 + ;;@ assembly/index.ts:62:13 + (i64.atomic.rmw16_u.and + ;;@ assembly/index.ts:62:22 + (i32.const 121) + ;;@ assembly/index.ts:62:27 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:63:2 + (set_local $2 + ;;@ assembly/index.ts:63:13 + (i64.atomic.rmw32_u.and + ;;@ assembly/index.ts:63:22 + (i32.const 123) + ;;@ assembly/index.ts:63:27 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:64:2 + (set_local $2 + ;;@ assembly/index.ts:64:13 + (i64.atomic.rmw.and + ;;@ assembly/index.ts:64:22 + (i32.const 127) + ;;@ assembly/index.ts:64:27 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:67:9 + (drop + (i32.atomic.rmw8_u.or + ;;@ assembly/index.ts:67:16 + (i32.const 120) + ;;@ assembly/index.ts:67:21 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:68:9 + (drop + (i32.atomic.rmw16_u.or + ;;@ assembly/index.ts:68:17 + (i32.const 121) + ;;@ assembly/index.ts:68:22 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:69:9 + (drop + (i32.atomic.rmw.or + ;;@ assembly/index.ts:69:17 + (i32.const 123) + ;;@ assembly/index.ts:69:22 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:71:2 + (set_local $2 + ;;@ assembly/index.ts:71:13 + (i64.atomic.rmw8_u.or + ;;@ assembly/index.ts:71:20 + (i32.const 120) + ;;@ assembly/index.ts:71:25 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:72:2 + (set_local $2 + ;;@ assembly/index.ts:72:13 + (i64.atomic.rmw16_u.or + ;;@ assembly/index.ts:72:21 + (i32.const 121) + ;;@ assembly/index.ts:72:26 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:73:2 + (set_local $2 + ;;@ assembly/index.ts:73:13 + (i64.atomic.rmw32_u.or + ;;@ assembly/index.ts:73:21 + (i32.const 123) + ;;@ assembly/index.ts:73:26 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:74:2 + (set_local $2 + ;;@ assembly/index.ts:74:13 + (i64.atomic.rmw.or + ;;@ assembly/index.ts:74:21 + (i32.const 127) + ;;@ assembly/index.ts:74:26 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:77:9 + (drop + (i32.atomic.rmw8_u.xor + ;;@ assembly/index.ts:77:17 + (i32.const 120) + ;;@ assembly/index.ts:77:22 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:78:9 + (drop + (i32.atomic.rmw16_u.xor + ;;@ assembly/index.ts:78:18 + (i32.const 121) + ;;@ assembly/index.ts:78:23 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:79:9 + (drop + (i32.atomic.rmw.xor + ;;@ assembly/index.ts:79:18 + (i32.const 123) + ;;@ assembly/index.ts:79:23 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:81:2 + (set_local $2 + ;;@ assembly/index.ts:81:13 + (i64.atomic.rmw8_u.xor + ;;@ assembly/index.ts:81:21 + (i32.const 120) + ;;@ assembly/index.ts:81:26 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:82:2 + (set_local $2 + ;;@ assembly/index.ts:82:13 + (i64.atomic.rmw16_u.xor + ;;@ assembly/index.ts:82:22 + (i32.const 121) + ;;@ assembly/index.ts:82:27 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:83:2 + (set_local $2 + ;;@ assembly/index.ts:83:13 + (i64.atomic.rmw32_u.xor + ;;@ assembly/index.ts:83:22 + (i32.const 123) + ;;@ assembly/index.ts:83:27 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:84:2 + (set_local $2 + ;;@ assembly/index.ts:84:13 + (i64.atomic.rmw.xor + ;;@ assembly/index.ts:84:22 + (i32.const 127) + ;;@ assembly/index.ts:84:27 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:87:9 + (drop + (i32.atomic.rmw8_u.xchg + ;;@ assembly/index.ts:87:18 + (i32.const 120) + ;;@ assembly/index.ts:87:23 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:88:9 + (drop + (i32.atomic.rmw16_u.xchg + ;;@ assembly/index.ts:88:19 + (i32.const 121) + ;;@ assembly/index.ts:88:24 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:89:9 + (drop + (i32.atomic.rmw.xchg + ;;@ assembly/index.ts:89:19 + (i32.const 123) + ;;@ assembly/index.ts:89:24 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:91:2 + (set_local $2 + ;;@ assembly/index.ts:91:13 + (i64.atomic.rmw8_u.xchg + ;;@ assembly/index.ts:91:22 + (i32.const 120) + ;;@ assembly/index.ts:91:27 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:92:2 + (set_local $2 + ;;@ assembly/index.ts:92:13 + (i64.atomic.rmw16_u.xchg + ;;@ assembly/index.ts:92:23 + (i32.const 121) + ;;@ assembly/index.ts:92:28 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:93:2 + (set_local $2 + ;;@ assembly/index.ts:93:13 + (i64.atomic.rmw32_u.xchg + ;;@ assembly/index.ts:93:23 + (i32.const 123) + ;;@ assembly/index.ts:93:28 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:94:2 + (set_local $2 + ;;@ assembly/index.ts:94:13 + (i64.atomic.rmw.xchg + ;;@ assembly/index.ts:94:23 + (i32.const 127) + ;;@ assembly/index.ts:94:28 + (i64.const 1) + ) + ) + ;;@ assembly/index.ts:97:9 + (drop + (i32.atomic.rmw8_u.cmpxchg + ;;@ assembly/index.ts:97:21 + (i32.const 120) + ;;@ assembly/index.ts:97:26 + (i32.const 1) + ;;@ assembly/index.ts:97:29 + (i32.const 2) + ) + ) + ;;@ assembly/index.ts:98:9 + (drop + (i32.atomic.rmw16_u.cmpxchg + ;;@ assembly/index.ts:98:22 + (i32.const 121) + ;;@ assembly/index.ts:98:27 + (i32.const 1) + ;;@ assembly/index.ts:98:30 + (i32.const 2) + ) + ) + ;;@ assembly/index.ts:99:9 + (drop + (i32.atomic.rmw.cmpxchg + ;;@ assembly/index.ts:99:22 + (i32.const 123) + ;;@ assembly/index.ts:99:27 + (i32.const 1) + ;;@ assembly/index.ts:99:30 + (i32.const 2) + ) + ) + ;;@ assembly/index.ts:101:2 + (set_local $2 + ;;@ assembly/index.ts:101:13 + (i64.atomic.rmw8_u.cmpxchg + ;;@ assembly/index.ts:101:25 + (i32.const 120) + ;;@ assembly/index.ts:101:30 + (i64.const 1) + ;;@ assembly/index.ts:101:38 + (i64.const 2) + ) + ) + ;;@ assembly/index.ts:102:2 + (set_local $2 + ;;@ assembly/index.ts:102:13 + (i64.atomic.rmw16_u.cmpxchg + ;;@ assembly/index.ts:102:26 + (i32.const 121) + ;;@ assembly/index.ts:102:31 + (i64.const 1) + ;;@ assembly/index.ts:102:39 + (i64.const 2) + ) + ) + ;;@ assembly/index.ts:103:2 + (set_local $2 + ;;@ assembly/index.ts:103:13 + (i64.atomic.rmw32_u.cmpxchg + ;;@ assembly/index.ts:103:26 + (i32.const 123) + ;;@ assembly/index.ts:103:31 + (i64.const 1) + ;;@ assembly/index.ts:103:39 + (i64.const 2) + ) + ) + ;;@ assembly/index.ts:104:2 + (set_local $2 + ;;@ assembly/index.ts:104:13 + (i64.atomic.rmw.cmpxchg + ;;@ assembly/index.ts:104:26 + (i32.const 127) + ;;@ assembly/index.ts:104:31 + (i64.const 1) + ;;@ assembly/index.ts:104:39 + (i64.const 2) + ) + ) + ) + (func $null (; 1 ;) (type $v) + ) +) diff --git a/examples/atomic-shared-memory/index.html b/examples/atomic-shared-memory/index.html new file mode 100644 index 0000000000..0e8dbd6b28 --- /dev/null +++ b/examples/atomic-shared-memory/index.html @@ -0,0 +1,103 @@ + + + + + Shared Memory - AssemblyScript + + + + + + +

+ Shared Memory in + AssemblyScript + ( + source ) +

+ + + + diff --git a/examples/atomic-shared-memory/package.json b/examples/atomic-shared-memory/package.json new file mode 100644 index 0000000000..6bb4f6c435 --- /dev/null +++ b/examples/atomic-shared-memory/package.json @@ -0,0 +1,16 @@ +{ + "name": "@assemblyscript/shared-memory-example", + "version": "1.0.0", + "private": true, + "scripts": { + "asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --sourceMap --importMemory --sharedMemory=256 --validate", + "asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -O3 --importMemory --sharedMemory=256 --validate --noDebug --noAssert", + "asbuild": "npm run asbuild:untouched && npm run asbuild:optimized", + "build": "npm run asbuild", + "server": "http-server . -o -c-1", + "test": "node tests" + }, + "devDependencies": { + "http-server": "^0.11.1" + } +} diff --git a/examples/atomic-wait-wake/assembly/index.js b/examples/atomic-wait-wake/assembly/index.js new file mode 100644 index 0000000000..5621c90d80 --- /dev/null +++ b/examples/atomic-wait-wake/assembly/index.js @@ -0,0 +1,23 @@ +const fs = require("fs"); +const path = require("path"); + +const compiled = new WebAssembly.Module( + fs.readFileSync(path.resolve(__dirname, "..", "build", "atomic.builtins.wasm")) +); +const memory = new WebAssembly.Memory({ + initial: 256, + maximum: 256, + shared: true +}) +const imports = { + env: { + memory, + abort: (filename, line, column) => { + throw Error("abort called at " + line + ":" + colum); + } + } +}; + +Object.defineProperty(module, "exports", { + get: () => new WebAssembly.Instance(compiled, imports).exports +}); diff --git a/examples/atomic-wait-wake/assembly/index.ts b/examples/atomic-wait-wake/assembly/index.ts new file mode 100644 index 0000000000..ee22b12953 --- /dev/null +++ b/examples/atomic-wait-wake/assembly/index.ts @@ -0,0 +1,39 @@ +import "allocator/atomic"; +import { itoa } from "internal/number"; +export { memory }; +declare function log_str(v: string): void; +declare function fetch(v: string, cb: int): void; + +var id = 1; +type int = i32; +// type int = i64; + +export function setId(_id: i32): void { + id = _id; +} + +declare function outsideWait(i: i32, v: int, t:i32): void; +declare function outsideWake(i: i32, v: int): void; + + +export function wait(mutexAddr: i32 = 0, value: int = 1): void { + log_str('[WASM][' + itoa(id) + '] waiting...'); + Atomic.store(mutexAddr, value); + log_str((Atomic.load(mutexAddr) == value) ? "true" : "false"); + outsideWait(mutexAddr, value, -1); + log_str('[WASM][' + itoa(id) + '] waken'); +} + +export function wake(mutexAddr: i32 = 0, value: int = 0, numAgents: i32 = 1): void { + log_str('[WASM][' + itoa(id) + '] waking '+ itoa(numAgents) + ' agent(s)...'); + Atomic.store(mutexAddr, value); + var count = Atomic.notify(mutexAddr, numAgents); + log_str('[WASM][' + itoa(id) + '] waken ' + itoa(count) + ' agent(s)'); +} + +export function wget(str: string = "https://google.com"): void { + fetch(str, 0); + wait(0, 0); + let res: string = changetype(Atomic.load(0)); + log_str(res); +} diff --git a/examples/atomic-wait-wake/assembly/tsconfig.json b/examples/atomic-wait-wake/assembly/tsconfig.json new file mode 100644 index 0000000000..449ca07c76 --- /dev/null +++ b/examples/atomic-wait-wake/assembly/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../../../std/assembly.json", + "include": [ + "./**/*.ts" + ] +} \ No newline at end of file diff --git a/examples/atomic-wait-wake/build/index.js b/examples/atomic-wait-wake/build/index.js new file mode 100644 index 0000000000..0870226f6f --- /dev/null +++ b/examples/atomic-wait-wake/build/index.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +require("allocator/arena"); +let str = "A"; +function read() { + return str; +} +exports.read = read; diff --git a/examples/atomic-wait-wake/index.html b/examples/atomic-wait-wake/index.html new file mode 100644 index 0000000000..199bf454db --- /dev/null +++ b/examples/atomic-wait-wake/index.html @@ -0,0 +1,127 @@ + + + + Atomic wait wake - AssemblyScript + + + + + + +

+ Atomic wait wake in + AssemblyScript ( + source + ) +
+

+
Open console to results
+ + + diff --git a/examples/atomic-wait-wake/js/worker1.js b/examples/atomic-wait-wake/js/worker1.js new file mode 100644 index 0000000000..2e0b7d4ed3 --- /dev/null +++ b/examples/atomic-wait-wake/js/worker1.js @@ -0,0 +1,135 @@ +addEventListener("message", onMessageReceived, false); +let memory = null; +let dataView = null; +let u8 = null; +let i32 = null; +let id = 0; +let _exports = null; +const mutexAddr = 0; +const numAgents = 1; +let instance = null; +let memory_allocate = null; +async function onMessageReceived(e) { + try { + const data = e.data; + switch (data.command) { + case "init": { + id = data.id; + memory = data.memory; + dataView = new DataView(memory.buffer); + u8 = new Uint8Array(memory.buffer); + i32 = new Int32Array(memory.buffer); + i16 = new Int16Array(memory.buffer); + instance = await WebAssembly.instantiate(data.wasm, { + env: { + memory, + abort: function() {}, + }, + index: { + fetch: _fetch, + log: console.log, + log_str, + outsideWait: (mutexAddr, value, i) => { + // setTimeout(() => { + // instance.exports.wake(mutexAddr, value+1); + // }, 2000 + console.log(Atomics.load(i32,mutexAddr)==value); + Atomics.wait(i32, mutexAddr, value); + }, + outsideWake: (mutexAddr, numAgents) => { + Atomics.notify(i32, mutexAddr, numAgents); + } + }, + }); + + _exports = instance.exports; + memory_allocate = _exports["memory.allocate"]; + _exports.setId(id); + self.postMessage({ command: "inited" }); + break; + } + case "wait": { + _exports.wait(mutexAddr, data.value); + break; + } + case "wait_i64": { + _exports.wait_i64(mutexAddr, data.value); + break; + } + case "wait_js": { + console.log(`[JS][${id}] waiting...`) + Atomics.store(i32, mutexAddr, data.value); + Atomics.wait(i32, mutexAddr, data.value); + console.log(`[JS][${id}] waken`); + break; + } + case "wake": { + _exports.wake(mutexAddr, data.value, numAgents); + console.log('-----') + break; + } + case "wake_i64": { + _exports.wake_i64(mutexAddr, data.value, numAgents); + console.log('-----') + break; + } + case "wake_js": { + console.log(`[JS][${id}] waking ${numAgents} agent(s)...`) + Atomics.store(i32, mutexAddr, data.value); + const count = Atomics.wake(i32, mutexAddr, numAgents); + console.log(`[JS][${id}] waken ${count} agent(s)`) + console.log('-----') + break; + } + case "wget": { + let ptr = newString("../build/untouched.wat"); + _exports.wget(ptr); + } + } + } catch (e) { + console.log(e); + } +} + +function newString(str) { + var dataLength = str.length< 2000 ? str.length : 2000; + var ptr = memory_allocate(4 + (dataLength << 1)); + var dataOffset = (4 + ptr) >>> 1; + // checkMem(); + i32[ptr >>> 2] = dataLength; + for (let i = 0; i < dataLength; ++i) i16[dataOffset + i] = str.charCodeAt(i); + return ptr; +} + +function _fetch(ptr, awaken){ + let url = readUTF16(ptr, dataView); + fetch(url, { + method: 'GET', + credentials: 'include', + headers: { + "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", + "Accept-Encoding": "gzip, deflate, br" + }, +}).then((res)=> { + var reader = new FileReader(); + reader.onload = function(event){ + let location = newString(reader.result); + instance.exports.wake(awaken, location); + } + res.blob().then(()=> reader.readAsText()); + }); +} + +function log_str(ptr) { + console.log(readUTF16(ptr, dataView)); +} + +function readUTF16(ptr, _memoryView) { + _memoryView = _memoryView || memoryView; + const u8a = new Uint8Array(_memoryView.buffer); + const str_len = _memoryView.getUint32(ptr, true); + const utf16 = u8a.subarray(ptr + 4, ptr + (str_len * 2) + 4); + const decoder = new TextDecoder("utf-16"); + const _utf16 = utf16.map(a => a); + return decoder.decode(_utf16); + } diff --git a/examples/atomic-wait-wake/js/worker2.js b/examples/atomic-wait-wake/js/worker2.js new file mode 100644 index 0000000000..c2723ed9a8 --- /dev/null +++ b/examples/atomic-wait-wake/js/worker2.js @@ -0,0 +1,19 @@ +addEventListener("message", onMessageReceived, false); +let memory = null; +let i32 = null; +function onMessageReceived(e) { + try { + const data = e.data; + switch (data.command) { + case "init": { + memory = data.memory; + i32 = new Int32Array(memory.buffer); + setTimeout(() => { + Atomics.store(i32, 0, 123); + console.log("Stored", 123); + Atomics.wake(i32, 0, 1); + }, 2000); + } + } + } catch (e) {} +} diff --git a/examples/atomic-wait-wake/package.json b/examples/atomic-wait-wake/package.json new file mode 100644 index 0000000000..2054a75c84 --- /dev/null +++ b/examples/atomic-wait-wake/package.json @@ -0,0 +1,16 @@ +{ + "name": "@assemblyscript/shared-memory-example", + "version": "1.0.0", + "private": true, + "scripts": { + "asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --sourceMap --importMemory --sharedMemory=256 --validate", + "asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -O3 --importMemory --sharedMemory=256 --validate --noAssert", + "asbuild": "npm run asbuild:untouched && npm run asbuild:optimized", + "build": "npm run asbuild", + "server": "http-server . -o -c-1", + "test": "node tests" + }, + "devDependencies": { + "http-server": "^0.11.1" + } +} diff --git a/examples/smallpt/assembly/index.js b/examples/smallpt/assembly/index.js new file mode 100644 index 0000000000..b25d0e4a67 --- /dev/null +++ b/examples/smallpt/assembly/index.js @@ -0,0 +1,18 @@ +const fs = require("fs"); +const path = require("path"); + +const compiled = new WebAssembly.Module( + fs.readFileSync(path.resolve(__dirname, "..", "build", "optimized.wasm")) +); + +const imports = { + env: { + abort: (filename, line, column) => { + throw Error("abort called at " + line + ":" + colum); + } + } +}; + +Object.defineProperty(module, "exports", { + get: () => new WebAssembly.Instance(compiled, imports).exports +}); diff --git a/examples/smallpt/assembly/index.ts b/examples/smallpt/assembly/index.ts new file mode 100644 index 0000000000..eacf606140 --- /dev/null +++ b/examples/smallpt/assembly/index.ts @@ -0,0 +1,530 @@ +// import "allocator/tlsf"; +// import "allocator/arena"; +// import "allocator/buddy"; +import "allocator/atomic"; + +type float = f64; +type int = i32; + +// Usage: time ./smallpt 5000 && xv image.ppm + +declare function logf(arg: float): void; +declare function logi(arg: i32): void; + +declare namespace FastMath { + function cos(x: f64): f64; + function sin(x: f64): f64; +} + +export function GET_MEMORY_TOP(): usize { + return allocator_get_offset(); +} + +export function SET_MEMORY_TOP(offset: usize): void { + allocator_set_offset(GET_MEMORY_TOP(), offset); +} + +export function seedRandom(value: f64): void { + NativeMath.seedRandom(reinterpret(value)); +} + +function rand(): float { + return NativeMath.random(); + // return JSMath.random(); +} + +export class Vec { + // position, also color (r,g,b) + constructor(public x: float = 0.0, public y: float = 0.0, public z: float = 0.0) {} + + free(): void { + __memory_free(this); + } + + // @operator("+") + add(b: Vec): Vec { + return new Vec(this.x + b.x, this.y + b.y, this.z + b.z); + } + add_in(b: Vec): Vec { + this.x = this.x + b.x; + this.y = this.y + b.y; + this.z = this.z + b.z; + return this; + } + add2(b: Vec, c: Vec): Vec { + c.x = this.x + b.x; + c.y = this.y + b.y; + c.z = this.z + b.z; + return c; + } + set(x: float, y: float, z: float): Vec { + this.x = x; + this.y = y; + this.z = z; + return this; + } + setFrom(b: Vec): Vec { + this.x = b.x; + this.y = b.y; + this.z = b.z; + return this; + } + // @operator("-") + sub(b: Vec, copyToB: bool = false): Vec { + if (copyToB) { + b.x = this.x - b.x; + b.y = this.y - b.y; + b.z = this.z - b.z; + return b; + } + return new Vec(this.x - b.x, this.y - b.y, this.z - b.z); + } + sub2(b: Vec, c: Vec): Vec { + c.x = this.x - b.x; + c.y = this.y - b.y; + c.z = this.z - b.z; + return c; + } + sub_in(b: Vec): Vec { + this.x = this.x - b.x; + this.y = this.y - b.y; + this.z = this.z - b.z; + return this; + } + + // @operator("*") + mul(b: Vec): Vec { + return new Vec(this.x * b.x, this.y * b.y, this.z * b.z); + } + mul_in(b: Vec): Vec { + this.x = this.x * b.x; + this.y = this.y * b.y; + this.z = this.z * b.z; + return this; + } + + multScalar(b: float): Vec { + return new Vec(this.x * b, this.y * b, this.z * b); + } + multScalar2(b: float, c: Vec): Vec { + c.x = this.x * b; + c.y = this.y * b; + c.z = this.z * b; + return c; + } + multScalar_in(b: float): Vec { + this.x = this.x * b; + this.y = this.y * b; + this.z = this.z * b; + return this; + } + // @operator("%") + mod(b: Vec): Vec { + return new Vec(this.y * b.z - this.z * b.y, this.z * b.x - this.x * b.z, this.x * b.y - this.y * b.x); + } + mod_in(b: Vec): Vec { + this.x = this.y * b.z - this.z * b.y; + this.y = this.z * b.x - this.x * b.z; + this.z = this.x * b.y - this.y * b.x; + return this; + } + mod2(b: Vec, c: Vec): Vec { + c.x = this.y * b.z - this.z * b.y; + c.y = this.z * b.x - this.x * b.z; + c.z = this.x * b.y - this.y * b.x; + return c; + } + + length(): float { + return sqrt(this.x * this.x + this.y * this.y + this.z * this.z); + } + + norm(): Vec { + var d = this.length(); + return new Vec(this.x / d, this.y / d, this.z / d); + } + + norm_in(): Vec { + var d = this.length(); + this.x = this.x / d; + this.y = this.y / d; + this.z = this.z / d; + return this; + } + + dot(b: Vec): float { + return this.x * b.x + this.y * b.y + this.z * b.z; + } + + clone(c: Vec = new Vec()): Vec { + c.x = this.x; + c.y = this.y; + c.z = this.z; + return c; + } +} + +class Ray { + constructor(public o: Vec = new Vec(), public d: Vec = new Vec()) {} + copy(r: Ray): void { + this.o.setFrom(r.o); + this.d.setFrom(r.d); + } + set(o: Vec, d: Vec): Ray { + this.o.setFrom(o); + this.d.setFrom(d); + return this; + } + free(): void { + this.o.free(); + this.d.free(); + __memory_free(this); + } +} + +enum Refl_t { + DIFF = 0x0, + SPEC = 0x1, + REFR = 0x2, +} // material types, used in radiance() + +class Sphere { + constructor(public rad: float, public p: Vec, public e: Vec, public c: Vec, public refl: Refl_t) {} + // double rad; // radius + // Vec p, e, c; // position, emission, color + // Refl_t refl; // reflection type (DIFFuse, SPECular, REFRactive) + // Sphere(double rad_, Vec p_, Vec e_, Vec c_, Refl_t refl_): + // rad(rad_), p(p_), e(e_), c(c_), refl(refl_) { } + intersect(r: Ray, locals: Locals): float { + // returns distance, 0 if nohit + // var op: Vec = (this.p - r.o); // Solve t^2*d.d + 2*t*(o-p).d + (o-p).(o-p)-R^2 = 0 + var op: Vec = this.p.sub2(r.o, locals.loc17); // Solve t^2*d.d + 2*t*(o-p).d + (o-p).(o-p)-R^2 = 0 + var t: float; + var eps = 1e-4; + var b = op.dot(r.d); + var det = b * b - op.dot(op) + this.rad * this.rad; + if (det < 0) { + return 0; + } else { + det = sqrt(det); + } + return (t = b - det) > eps ? t : (t = b + det) > eps ? t : 0; + } + + free(): void { + __memory_free(this); + } +} + +// function int(x: float): int { +// return x as int; +// } + +function clamp(x: float): float { + return x < 0.0 ? 0.0 : x > 1.0 ? 1.0 : x; +} +// function toInt(x: float): int { +// return int(Math.pow(clamp(x), 1.0 / 2.2) * 255.0 + 0.5); +// } +class Hit { + constructor(public ray: Ray = new Ray(), public t: float = 0, public id: int = -1) {} + free(): void { + __memory_free(this); + } +} + +function intersect(r: Ray, hit: Hit, locals: Locals): Hit { + var t: float = Infinity; + var id: int = -1; + var n: int = context.spheres.length; + var d: float = 0; + // var inf: float = (t = 1e20); + for (let i = 0; i < n; i++) { + d = context.spheres[i].intersect(r, locals); + if (d && d < t) { + t = d; + id = i; + } + } + hit.t = t; + hit.id = id; + + hit.ray.copy(r); + return hit; +} + +class Context { + pixels: Vec[]; + dir: Vec; + pos: Vec; + cam: Ray; + cx: Vec; + cy: Vec; + spheres: Sphere[]; + constructor(public width: int = 0, public height: int = 0) {} +} +var context: Context; + +class Locals { + black: Vec = new Vec(0, 0, 0); + red: Vec = new Vec(1, 0, 0); + hit: Hit = new Hit(); + _f: Vec = new Vec(); + loc1: Vec = new Vec(); + loc2: Vec = new Vec(); + loc3: Vec = new Vec(); + loc4: Vec = new Vec(); + loc5: Vec = new Vec(); + loc6: Vec = new Vec(); + loc7: Vec = new Vec(); + loc8: Vec = new Vec(); + loc9: Vec = new Vec(); + loc10: Vec = new Vec(); + loc11: Vec = new Vec(); + loc12: Vec = new Vec(); + loc13: Vec = new Vec(); + loc14: Vec = new Vec(); + loc15: Vec = new Vec(); + loc16: Vec = new Vec(); + loc17: Vec = new Vec(); + loc18: Vec = new Vec(); + loc19: Vec = new Vec(); + loc20: Vec = new Vec(); + result: Vec = new Vec(); + loc_r1: Ray = new Ray(); + loc_r2: Ray = new Ray(); + + constructor() {} +} + +export function getPixels(): Vec[] { + return context.pixels; +} + +export function setPixels(p: Vec[]): void { + context.pixels = p; +} + +export function setContext(ctx: Context): void { + context = ctx; +} + +export function getContext(): Context { + return context; +} + +export function createContext(w: int, h: int): Context { + context = new Context(); + context.spheres = [ + //Scene: radius, position, emission, color, material + new Sphere(1e5, new Vec(1e5 + 1, 40.8, 81.6), new Vec(), new Vec(0.75, 0, 0), Refl_t.DIFF), //Left + new Sphere(1e5, new Vec(-1e5 + 99, 40.8, 81.6), new Vec(), new Vec(0, 0.75, 0), Refl_t.DIFF), //Rght + new Sphere(1e5, new Vec(50, 40.8, 1e5), new Vec(), new Vec(0.75, 0.75, 0.75), Refl_t.DIFF), //Back + new Sphere(1e5, new Vec(50, 40.8, -1e5 + 170), new Vec(), new Vec(), Refl_t.DIFF), //Frnt + new Sphere(1e5, new Vec(50, 1e5, 81.6), new Vec(), new Vec(0.75, 0.75, 0.75), Refl_t.DIFF), //Botm + new Sphere(1e5, new Vec(50, -1e5 + 81.6, 81.6), new Vec(), new Vec(0.75, 0.75, 0.75), Refl_t.DIFF), //Top + new Sphere(16.5, new Vec(27, 16.5, 47), new Vec(), new Vec(0.999, 0.999, 0.999), Refl_t.SPEC), //Mirr + new Sphere(16.5, new Vec(73, 16.5, 78), new Vec(), new Vec(0.999, 0.999, 0.999), Refl_t.REFR), //Glas + new Sphere(600, new Vec(50, 681.6 - 0.27, 81.6), new Vec(112, 112, 112), new Vec(), Refl_t.DIFF), //Lite + ]; + context.dir = new Vec(0, -0.042612, -1); + context.pos = new Vec(50, 52, 295.6); + context.cam = new Ray(context.pos, context.dir.norm_in()); // cam pos, dir + context.cx = new Vec(); + context.cy = new Vec(); + context.width = w; + context.height = h; + context.cx.set((w * 0.5135) / h, 0, 0); + context.cx + .mod2(context.cam.d, context.cy) + .norm_in() + .multScalar_in(0.5135); + var len = w * h; + context.pixels = new Array(len); + for (let i = 0; i < len; i++) { + context.pixels[i] = new Vec(); + } + return context; +} + +export function createLocals(): Locals { + var locals = new Locals(); + return locals; +} + +function radiance(r: Ray, depth: int, f: Vec, locals: Locals): Vec { + // return locals.red; + intersect(r, locals.hit, locals); + + if (locals.hit.t == Infinity) { + return locals.black; // if miss, return black + } + // return locals.red.set(locals.hit.t, 0, 0); + var obj: Sphere = unchecked(context.spheres[locals.hit.id]); // the hit object + // var obj: Sphere = context.spheres[locals.hit.id]; // the hit object + r.d.multScalar2(locals.hit.t, locals.loc1); + + var x: Vec = locals.loc1.add2(r.o, locals.loc2); + var n: Vec = x.sub2(obj.p, locals.loc3).norm_in(); + var nl: Vec = n.dot(r.d) < 0 ? n.clone(locals.loc4) : n.multScalar2(-1, locals.loc4); + if (!f) { + f = locals._f; + } + f.setFrom(obj.c); + + var p: float = f.x > f.y && f.x > f.z ? f.x : f.y > f.z ? f.y : f.z; // max refl + if (++depth > 5) { + if (rand() < p) { + f.multScalar_in(1 / p); + f.setFrom(obj.e); //R.R. + return f; + } else { + f.setFrom(obj.e); //R.R. + return f; + } + } + + if (obj.refl == Refl_t.DIFF) { + // Ideal DIFFUSE reflection + let r1: float = 2 * Math.PI * rand(); + let r2: float = rand(); + let r2s: float = sqrt(r2); + let w: Vec = nl; + let u: Vec = locals.loc5; + if (abs(w.x) > 0.1) { + u.set(0, 1, 0); + } else { + u.set(1, 1, 0); + u.mod_in(w).norm_in(); + } + let v: Vec = w.mod2(u, locals.loc6); + let d: Vec = u + .multScalar_in(FastMath.cos(r1) * r2s) + .add_in(v.multScalar_in(FastMath.sin(r1) * r2s)) + .add_in(w.multScalar_in(sqrt(1.0 - r2))) + .norm_in(); + let ray = locals.loc_r1.set(x, d); + let rad = locals.loc7.set(0, 0, 0); + radiance(ray, depth, rad, locals); + f.mul_in(rad); + f.add_in(obj.e); + return f; + } else if (obj.refl == Refl_t.SPEC) { + // Ideal SPECULAR reflection + let d1 = r.d.sub2(n.multScalar_in(2 * n.dot(r.d)), locals.loc18); + let ray = locals.loc_r1.set(x, d1); + let rad = locals.loc7.set(0, 0, 0); + radiance(ray, depth, rad, locals); + f.mul_in(rad); + return f.add_in(obj.e); + } + + var d = n.multScalar2(2 * n.dot(r.d), locals.loc19); + r.d.sub(d, true); + var reflRay: Ray = locals.loc_r1.set(x, d); // Ideal dielectric REFRACTION + var into: bool = n.dot(nl) > 0; // Ray from outside going in? + var nc: float = 1; + var nt: float = 1.5; + var nnt: float = into ? nc / nt : nt / nc; + var ddn: float = r.d.dot(nl); + var cos2t: float = 0; + + if ((cos2t = 1 - nnt * nnt * (1 - ddn * ddn)) < 0) { + // Total internal reflection + let rad = locals.loc7.set(0, 0, 0); + radiance(reflRay, depth, rad, locals); + f.mul_in(rad); + return f.add_in(obj.e); + } + + var n1 = n.multScalar2((into ? 1 : -1) * (ddn * nnt + sqrt(cos2t)), locals.loc8); + var tdir: Vec = r.d + .multScalar2(nnt, locals.loc9) + .sub_in(n1) + .norm_in(); + var a: float = nt - nc; + var b: float = nt + nc; + var R0: float = (a * a) / (b * b); + var c: float = 1 - (into ? -ddn : tdir.dot(n)); + var Re: float = R0 + (1 - R0) * c * c * c * c * c; + var Tr: float = 1 - Re; + var P: float = 0.25 + 0.5 * Re; + var RP: float = Re / P; + var TP: float = Tr / (1 - P); + var ray = locals.loc_r1.set(x, tdir); + + var rad: Vec = locals.loc10.set(0, 0, 0); + if (depth > 2) { + if (rand() < P) { + radiance(reflRay, depth, rad, locals).multScalar_in(RP); + } else { + radiance(ray, depth, rad, locals).multScalar_in(TP); + } + } else { + radiance(ray, depth, locals.loc20, locals).multScalar_in(Tr); + radiance(reflRay, depth, rad, locals) + .multScalar_in(Re) + .add_in(locals.loc20); + } + f.mul_in(rad); + return f.add_in(obj.e); +} + +// export function render(locals: Locals, samps: int, ox: int, oy: int, w: int, h: int, subIterations: int): void { +// // Loop over image rows +// for (let __k: int = 0; __k < subIterations; __k++) { +// _render(locals, samps, ox, oy, w, h); +// } +// } + +export function render(locals: Locals, samps: int, ox: int, oy: int, w: int, h: int): void { + // Loop over image rows + for (let y: int = oy; y < oy + h; y++) { + // fprintf(stderr, "\rRendering (%d spp) %5.2f%%", samps * 4, 100. * y / (h - 1)); + // Loop cols + for (let x: int = ox; x < ox + w; x++) { + // 2x2 subpixel rows + for (let sy: int = 0; sy < 2; sy++) { + // let i = (context.height - y - 1) * context.width + x; + let i = y * context.width + x; + // 2x2 subpixel cols + for (let sx: int = 0; sx < 2; sx++) { + locals.result.set(0, 0, 0); + for (let s: int = 0; s < samps; s++) { + let r1: float = 2.0 * rand(); + let dx = r1 < 1.0 ? sqrt(r1) - 1.0 : 1.0 - sqrt(2.0 - r1); + let r2: float = 2.0 * rand(); + let dy = r2 < 1.0 ? sqrt(r2) - 1.0 : 1.0 - sqrt(2.0 - r2); + let d1 = context.cx.multScalar2( + (((sx + 0.5 + dx) / 2.0 + x) / context.width - 0.5), + locals.loc11, + ); + let d2 = context.cy.multScalar2( + (((sy + 0.5 + dy) / 2.0 + y) / context.height - 0.5), + locals.loc12, + ); + d1.add_in(d2); + d1.add_in(context.cam.d); + let d3 = d1.multScalar2(140, locals.loc13); + d3.add_in(context.cam.o); + let d4 = d1.norm_in(); + let _r1 = locals.loc_r2.set(d3, d4); + let _r2 = radiance(_r1, 0, locals.loc15, locals); + _r2.multScalar_in(1.0 / samps); + locals.result.add_in(_r2); + } + + // Camera rays are pushed ^^^^^ forward to start in interior + let _x = clamp(locals.result.x); + let _y = clamp(locals.result.y); + let _z = clamp(locals.result.z); + let v1 = locals.loc16.set(_x, _y, _z); + v1.multScalar_in(0.55); + + let _c = context.pixels[i]; + _c.add_in(v1); + } + } + } + } +} diff --git a/examples/smallpt/assembly/tsconfig.json b/examples/smallpt/assembly/tsconfig.json new file mode 100644 index 0000000000..449ca07c76 --- /dev/null +++ b/examples/smallpt/assembly/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../../../std/assembly.json", + "include": [ + "./**/*.ts" + ] +} \ No newline at end of file diff --git a/examples/smallpt/build/optimized.wat b/examples/smallpt/build/optimized.wat new file mode 100644 index 0000000000..fdcfa0a532 --- /dev/null +++ b/examples/smallpt/build/optimized.wat @@ -0,0 +1,6644 @@ +(module + (type $i (func (result i32))) + (type $iv (func (param i32))) + (type $iii (func (param i32 i32) (result i32))) + (type $iFFFi (func (param i32 f64 f64 f64) (result i32))) + (type $ii (func (param i32) (result i32))) + (type $iiii (func (param i32 i32 i32) (result i32))) + (type $iFi (func (param i32 f64) (result i32))) + (type $iFii (func (param i32 f64 i32) (result i32))) + (type $iF (func (param i32) (result f64))) + (type $iiF (func (param i32 i32) (result f64))) + (type $iiiiv (func (param i32 i32 i32 i32))) + (type $iiiv (func (param i32 i32 i32))) + (type $iiFii (func (param i32 i32 f64 i32) (result i32))) + (type $iiiiiiv (func (param i32 i32 i32 i32 i32 i32))) + (type $F (func (result f64))) + (type $iiiii (func (param i32 i32 i32 i32) (result i32))) + (type $iiiF (func (param i32 i32 i32) (result f64))) + (type $iiv (func (param i32 i32))) + (type $FF (func (param f64) (result f64))) + (type $v (func)) + (type $iFv (func (param i32 f64))) + (type $FUNCSIG$i (func (result i32))) + (type $FUNCSIG$idiiii (func (param f64 i32 i32 i32 i32) (result i32))) + (type $FUNCSIG$vii (func (param i32 i32))) + (type $FUNCSIG$ii (func (param i32) (result i32))) + (import "env" "memory" (memory $0 (shared 32767 32767))) + (data (i32.const 8) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s") + (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) + (import "JSMath" "random" (func $~lib/math/JSMath.random (result f64))) + (import "JSMath" "cos" (func $~lib/math/JSMath.cos (param f64) (result f64))) + (import "JSMath" "sin" (func $~lib/math/JSMath.sin (param f64) (result f64))) + (global $~lib/allocator/atomic/startOffset (mut i32) (i32.const 0)) + (global $~lib/allocator/atomic/offset_ptr (mut i32) (i32.const 0)) + (global $assembly/index/context (mut i32) (i32.const 0)) + (global $assembly/index/Refl_t.DIFF (mut i32) (i32.const 0)) + (global $assembly/index/Refl_t.SPEC (mut i32) (i32.const 1)) + (global $assembly/index/Refl_t.REFR (mut i32) (i32.const 2)) + (global $~argc (mut i32) (i32.const 0)) + (export "memory" (memory $0)) + (export "GET_MEMORY_TOP" (func $assembly/index/GET_MEMORY_TOP)) + (export "SET_MEMORY_TOP" (func $assembly/index/SET_MEMORY_TOP)) + (export "_setargc" (func $~setargc)) + (export "Vec#constructor" (func $assembly/index/Vec#constructor|trampoline)) + (export "Vec#get:x" (func $Vec#get:x)) + (export "Vec#set:x" (func $Vec#set:x)) + (export "Vec#get:y" (func $Vec#get:y)) + (export "Vec#set:y" (func $Vec#set:y)) + (export "Vec#get:z" (func $Vec#get:z)) + (export "Vec#set:z" (func $Vec#set:z)) + (export "Vec#free" (func $assembly/index/Vec#free)) + (export "Vec#add" (func $assembly/index/Vec#add)) + (export "Vec#add_in" (func $assembly/index/Vec#add_in)) + (export "Vec#add2" (func $assembly/index/Vec#add2)) + (export "Vec#set" (func $assembly/index/Vec#set)) + (export "Vec#setFrom" (func $assembly/index/Vec#setFrom)) + (export "Vec#sub" (func $assembly/index/Vec#sub|trampoline)) + (export "Vec#sub2" (func $assembly/index/Vec#sub2)) + (export "Vec#sub_in" (func $assembly/index/Vec#sub_in)) + (export "Vec#mul" (func $assembly/index/Vec#mul)) + (export "Vec#mul_in" (func $assembly/index/Vec#mul_in)) + (export "Vec#multScalar" (func $assembly/index/Vec#multScalar)) + (export "Vec#multScalar2" (func $assembly/index/Vec#multScalar2)) + (export "Vec#multScalar_in" (func $assembly/index/Vec#multScalar_in)) + (export "Vec#mod" (func $assembly/index/Vec#mod)) + (export "Vec#mod_in" (func $assembly/index/Vec#mod_in)) + (export "Vec#mod2" (func $assembly/index/Vec#mod2)) + (export "Vec#length" (func $assembly/index/Vec#length)) + (export "Vec#norm" (func $assembly/index/Vec#norm)) + (export "Vec#norm_in" (func $assembly/index/Vec#norm_in)) + (export "Vec#dot" (func $assembly/index/Vec#dot)) + (export "Vec#clone" (func $assembly/index/Vec#clone|trampoline)) + (export "getPixels" (func $assembly/index/getPixels)) + (export "setPixels" (func $assembly/index/setPixels)) + (export "setContext" (func $assembly/index/setContext)) + (export "getContext" (func $assembly/index/getContext)) + (export "createContext" (func $assembly/index/createContext)) + (export "createLocals" (func $assembly/index/createLocals)) + (export "render" (func $assembly/index/render)) + (start $start) + (func $assembly/index/GET_MEMORY_TOP (; 4 ;) (; has Stack IR ;) (type $i) (result i32) + (i32.atomic.load + (get_global $~lib/allocator/atomic/offset_ptr) + ) + ) + (func $assembly/index/SET_MEMORY_TOP (; 5 ;) (; has Stack IR ;) (type $iv) (param $0 i32) + (drop + (i32.atomic.rmw.cmpxchg + (get_global $~lib/allocator/atomic/offset_ptr) + (i32.atomic.load + (get_global $~lib/allocator/atomic/offset_ptr) + ) + (get_local $0) + ) + ) + ) + (func $~lib/allocator/atomic/__memory_allocate (; 6 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (if + (get_local $0) + (block + (if + (i32.gt_u + (get_local $0) + (i32.const 1073741824) + ) + (unreachable) + ) + (loop $continue|0 + (if + (i32.gt_u + (tee_local $2 + (i32.and + (i32.add + (i32.add + (tee_local $1 + (i32.atomic.load + (get_global $~lib/allocator/atomic/offset_ptr) + ) + ) + (get_local $0) + ) + (i32.const 7) + ) + (i32.const -8) + ) + ) + (i32.shl + (tee_local $3 + (current_memory) + ) + (i32.const 16) + ) + ) + (if + (i32.lt_s + (grow_memory + (select + (get_local $3) + (tee_local $4 + (i32.shr_u + (i32.and + (i32.add + (i32.sub + (get_local $2) + (get_local $1) + ) + (i32.const 65535) + ) + (i32.const -65536) + ) + (i32.const 16) + ) + ) + (i32.gt_s + (get_local $3) + (get_local $4) + ) + ) + ) + (i32.const 0) + ) + (if + (i32.lt_s + (grow_memory + (get_local $4) + ) + (i32.const 0) + ) + (unreachable) + ) + ) + ) + (br_if $continue|0 + (i32.ne + (i32.atomic.rmw.cmpxchg + (get_global $~lib/allocator/atomic/offset_ptr) + (get_local $1) + (get_local $2) + ) + (get_local $1) + ) + ) + ) + (return + (get_local $1) + ) + ) + ) + (i32.const 0) + ) + (func $assembly/index/Vec#constructor (; 7 ;) (; has Stack IR ;) (type $iFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32) + (if + (i32.eqz + (get_local $0) + ) + (block + (f64.store + (tee_local $0 + (call $~lib/allocator/atomic/__memory_allocate + (i32.const 24) + ) + ) + (get_local $1) + ) + (f64.store offset=8 + (get_local $0) + (get_local $2) + ) + (f64.store offset=16 + (get_local $0) + (get_local $3) + ) + ) + ) + (get_local $0) + ) + (func $assembly/index/Vec#free (; 8 ;) (; has Stack IR ;) (type $iv) (param $0 i32) + (nop) + ) + (func $assembly/index/Vec#add (; 9 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.add + (f64.load + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + (f64.add + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + (f64.add + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ) + (func $assembly/index/Vec#add_in (; 10 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (f64.store + (get_local $0) + (f64.add + (f64.load + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + ) + (f64.store offset=8 + (get_local $0) + (f64.add + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + ) + (f64.store offset=16 + (get_local $0) + (f64.add + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + ) + (get_local $0) + ) + (func $assembly/index/Vec#add2 (; 11 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (f64.store + (get_local $2) + (f64.add + (f64.load + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + ) + (f64.store offset=8 + (get_local $2) + (f64.add + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + ) + (f64.store offset=16 + (get_local $2) + (f64.add + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + ) + (get_local $2) + ) + (func $assembly/index/Vec#set (; 12 ;) (; has Stack IR ;) (type $iFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32) + (f64.store + (get_local $0) + (get_local $1) + ) + (f64.store offset=8 + (get_local $0) + (get_local $2) + ) + (f64.store offset=16 + (get_local $0) + (get_local $3) + ) + (get_local $0) + ) + (func $assembly/index/Vec#setFrom (; 13 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (f64.store + (get_local $0) + (f64.load + (get_local $1) + ) + ) + (f64.store offset=8 + (get_local $0) + (f64.load offset=8 + (get_local $1) + ) + ) + (f64.store offset=16 + (get_local $0) + (f64.load offset=16 + (get_local $1) + ) + ) + (get_local $0) + ) + (func $assembly/index/Vec#sub (; 14 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (block + (f64.store + (get_local $1) + (f64.sub + (f64.load + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + ) + (f64.store offset=8 + (get_local $1) + (f64.sub + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + ) + (f64.store offset=16 + (get_local $1) + (f64.sub + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + ) + (return + (get_local $1) + ) + ) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.sub + (f64.load + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + (f64.sub + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + (f64.sub + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ) + (func $assembly/index/Vec#sub2 (; 15 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (f64.store + (get_local $2) + (f64.sub + (f64.load + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + ) + (f64.store offset=8 + (get_local $2) + (f64.sub + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + ) + (f64.store offset=16 + (get_local $2) + (f64.sub + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + ) + (get_local $2) + ) + (func $assembly/index/Vec#sub_in (; 16 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (f64.store + (get_local $0) + (f64.sub + (f64.load + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + ) + (f64.store offset=8 + (get_local $0) + (f64.sub + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + ) + (f64.store offset=16 + (get_local $0) + (f64.sub + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + ) + (get_local $0) + ) + (func $assembly/index/Vec#mul (; 17 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.mul + (f64.load + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ) + (func $assembly/index/Vec#mul_in (; 18 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (f64.store + (get_local $0) + (f64.mul + (f64.load + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + ) + (f64.store offset=8 + (get_local $0) + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + ) + (f64.store offset=16 + (get_local $0) + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + ) + (get_local $0) + ) + (func $assembly/index/Vec#multScalar (; 19 ;) (; has Stack IR ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.mul + (f64.load + (get_local $0) + ) + (get_local $1) + ) + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (get_local $1) + ) + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (get_local $1) + ) + ) + ) + (func $assembly/index/Vec#multScalar2 (; 20 ;) (; has Stack IR ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) + (f64.store + (get_local $2) + (f64.mul + (f64.load + (get_local $0) + ) + (get_local $1) + ) + ) + (f64.store offset=8 + (get_local $2) + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (get_local $1) + ) + ) + (f64.store offset=16 + (get_local $2) + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (get_local $1) + ) + ) + (get_local $2) + ) + (func $assembly/index/Vec#multScalar_in (; 21 ;) (; has Stack IR ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (f64.store + (get_local $0) + (f64.mul + (f64.load + (get_local $0) + ) + (get_local $1) + ) + ) + (f64.store offset=8 + (get_local $0) + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (get_local $1) + ) + ) + (f64.store offset=16 + (get_local $0) + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (get_local $1) + ) + ) + (get_local $0) + ) + (func $assembly/index/Vec#mod (; 22 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.sub + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + ) + (f64.sub + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + (f64.mul + (f64.load + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + ) + (f64.sub + (f64.mul + (f64.load + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + ) + ) + ) + (func $assembly/index/Vec#mod_in (; 23 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (f64.store + (get_local $0) + (f64.sub + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $0) + (f64.sub + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + (f64.mul + (f64.load + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ) + (f64.store offset=16 + (get_local $0) + (f64.sub + (f64.mul + (f64.load + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + ) + ) + (get_local $0) + ) + (func $assembly/index/Vec#mod2 (; 24 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (f64.store + (get_local $2) + (f64.sub + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $2) + (f64.sub + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + (f64.mul + (f64.load + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ) + (f64.store offset=16 + (get_local $2) + (f64.sub + (f64.mul + (f64.load + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + ) + ) + (get_local $2) + ) + (func $assembly/index/Vec#length (; 25 ;) (; has Stack IR ;) (type $iF) (param $0 i32) (result f64) + (f64.sqrt + (f64.add + (f64.add + (f64.mul + (f64.load + (get_local $0) + ) + (f64.load + (get_local $0) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=8 + (get_local $0) + ) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=16 + (get_local $0) + ) + ) + ) + ) + ) + (func $assembly/index/Vec#norm (; 26 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (local $1 f64) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.div + (f64.load + (get_local $0) + ) + (tee_local $1 + (f64.sqrt + (f64.add + (f64.add + (f64.mul + (f64.load + (get_local $0) + ) + (f64.load + (get_local $0) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=8 + (get_local $0) + ) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=16 + (get_local $0) + ) + ) + ) + ) + ) + ) + (f64.div + (f64.load offset=8 + (get_local $0) + ) + (get_local $1) + ) + (f64.div + (f64.load offset=16 + (get_local $0) + ) + (get_local $1) + ) + ) + ) + (func $assembly/index/Vec#norm_in (; 27 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (local $1 f64) + (f64.store + (get_local $0) + (f64.div + (f64.load + (get_local $0) + ) + (tee_local $1 + (f64.sqrt + (f64.add + (f64.add + (f64.mul + (f64.load + (get_local $0) + ) + (f64.load + (get_local $0) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=8 + (get_local $0) + ) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=16 + (get_local $0) + ) + ) + ) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $0) + (f64.div + (f64.load offset=8 + (get_local $0) + ) + (get_local $1) + ) + ) + (f64.store offset=16 + (get_local $0) + (f64.div + (f64.load offset=16 + (get_local $0) + ) + (get_local $1) + ) + ) + (get_local $0) + ) + (func $assembly/index/Vec#dot (; 28 ;) (; has Stack IR ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + (f64.add + (f64.add + (f64.mul + (f64.load + (get_local $0) + ) + (f64.load + (get_local $1) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ) + (func $assembly/index/getPixels (; 29 ;) (; has Stack IR ;) (type $i) (result i32) + (i32.load + (get_global $assembly/index/context) + ) + ) + (func $assembly/index/setPixels (; 30 ;) (; has Stack IR ;) (type $iv) (param $0 i32) + (i32.store + (get_global $assembly/index/context) + (get_local $0) + ) + ) + (func $assembly/index/setContext (; 31 ;) (; has Stack IR ;) (type $iv) (param $0 i32) + (set_global $assembly/index/context + (get_local $0) + ) + ) + (func $assembly/index/getContext (; 32 ;) (; has Stack IR ;) (type $i) (result i32) + (get_global $assembly/index/context) + ) + (func $assembly/index/Context#constructor (; 33 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) + (local $0 i32) + (i32.store + (tee_local $0 + (call $~lib/allocator/atomic/__memory_allocate + (i32.const 36) + ) + ) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $0) + (i32.const 0) + ) + (i32.store offset=8 + (get_local $0) + (i32.const 0) + ) + (i32.store offset=12 + (get_local $0) + (i32.const 0) + ) + (i32.store offset=16 + (get_local $0) + (i32.const 0) + ) + (i32.store offset=20 + (get_local $0) + (i32.const 0) + ) + (i32.store offset=24 + (get_local $0) + (i32.const 0) + ) + (i32.store offset=28 + (get_local $0) + (i32.const 0) + ) + (i32.store offset=32 + (get_local $0) + (i32.const 0) + ) + (get_local $0) + ) + (func $assembly/index/Sphere#constructor (; 34 ;) (; has Stack IR ;) (type $FUNCSIG$idiiii) (param $0 f64) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) + (local $5 i32) + (f64.store + (tee_local $5 + (call $~lib/allocator/atomic/__memory_allocate + (i32.const 24) + ) + ) + (get_local $0) + ) + (i32.store offset=8 + (get_local $5) + (get_local $1) + ) + (i32.store offset=12 + (get_local $5) + (get_local $2) + ) + (i32.store offset=16 + (get_local $5) + (get_local $3) + ) + (i32.store offset=20 + (get_local $5) + (get_local $4) + ) + (get_local $5) + ) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 35 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (i32.store + (tee_local $1 + (call $~lib/allocator/atomic/__memory_allocate + (i32.shl + (i32.const 1) + (i32.sub + (i32.const 32) + (i32.clz + (i32.add + (get_local $0) + (i32.const 7) + ) + ) + ) + ) + ) + ) + (get_local $0) + ) + (get_local $1) + ) + (func $~lib/internal/memory/memset (; 36 ;) (; has Stack IR ;) (type $FUNCSIG$vii) (param $0 i32) (param $1 i32) + (local $2 i32) + (if + (i32.eqz + (get_local $1) + ) + (return) + ) + (i32.store8 + (get_local $0) + (i32.const 0) + ) + (i32.store8 + (i32.sub + (i32.add + (get_local $0) + (get_local $1) + ) + (i32.const 1) + ) + (i32.const 0) + ) + (if + (i32.le_u + (get_local $1) + (i32.const 2) + ) + (return) + ) + (i32.store8 + (i32.add + (get_local $0) + (i32.const 1) + ) + (i32.const 0) + ) + (i32.store8 + (i32.add + (get_local $0) + (i32.const 2) + ) + (i32.const 0) + ) + (i32.store8 + (i32.sub + (tee_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (i32.const 2) + ) + (i32.const 0) + ) + (i32.store8 + (i32.sub + (get_local $2) + (i32.const 3) + ) + (i32.const 0) + ) + (if + (i32.le_u + (get_local $1) + (i32.const 6) + ) + (return) + ) + (i32.store8 + (i32.add + (get_local $0) + (i32.const 3) + ) + (i32.const 0) + ) + (i32.store8 + (i32.sub + (i32.add + (get_local $0) + (get_local $1) + ) + (i32.const 4) + ) + (i32.const 0) + ) + (if + (i32.le_u + (get_local $1) + (i32.const 8) + ) + (return) + ) + (i32.store + (tee_local $0 + (i32.add + (get_local $0) + (tee_local $2 + (i32.and + (i32.sub + (i32.const 0) + (get_local $0) + ) + (i32.const 3) + ) + ) + ) + ) + (i32.const 0) + ) + (i32.store + (i32.sub + (i32.add + (get_local $0) + (tee_local $1 + (i32.and + (i32.sub + (get_local $1) + (get_local $2) + ) + (i32.const -4) + ) + ) + ) + (i32.const 4) + ) + (i32.const 0) + ) + (if + (i32.le_u + (get_local $1) + (i32.const 8) + ) + (return) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 4) + ) + (i32.const 0) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 8) + ) + (i32.const 0) + ) + (i32.store + (i32.sub + (tee_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (i32.const 12) + ) + (i32.const 0) + ) + (i32.store + (i32.sub + (get_local $2) + (i32.const 8) + ) + (i32.const 0) + ) + (if + (i32.le_u + (get_local $1) + (i32.const 24) + ) + (return) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 12) + ) + (i32.const 0) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 16) + ) + (i32.const 0) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 20) + ) + (i32.const 0) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 24) + ) + (i32.const 0) + ) + (i32.store + (i32.sub + (tee_local $2 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (i32.const 28) + ) + (i32.const 0) + ) + (i32.store + (i32.sub + (get_local $2) + (i32.const 24) + ) + (i32.const 0) + ) + (i32.store + (i32.sub + (get_local $2) + (i32.const 20) + ) + (i32.const 0) + ) + (i32.store + (i32.sub + (get_local $2) + (i32.const 16) + ) + (i32.const 0) + ) + (set_local $0 + (i32.add + (get_local $0) + (tee_local $2 + (i32.add + (i32.and + (get_local $0) + (i32.const 4) + ) + (i32.const 24) + ) + ) + ) + ) + (set_local $1 + (i32.sub + (get_local $1) + (get_local $2) + ) + ) + (loop $continue|0 + (if + (i32.ge_u + (get_local $1) + (i32.const 32) + ) + (block + (i64.store + (get_local $0) + (i64.const 0) + ) + (i64.store + (i32.add + (get_local $0) + (i32.const 8) + ) + (i64.const 0) + ) + (i64.store + (i32.add + (get_local $0) + (i32.const 16) + ) + (i64.const 0) + ) + (i64.store + (i32.add + (get_local $0) + (i32.const 24) + ) + (i64.const 0) + ) + (set_local $1 + (i32.sub + (get_local $1) + (i32.const 32) + ) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 32) + ) + ) + (br $continue|0) + ) + ) + ) + ) + (func $~lib/array/Array#constructor (; 37 ;) (; has Stack IR ;) (type $FUNCSIG$ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (if + (i32.gt_u + (get_local $0) + (i32.const 268435454) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 23) + (i32.const 39) + ) + (unreachable) + ) + ) + (set_local $2 + (call $~lib/internal/arraybuffer/allocateUnsafe + (tee_local $3 + (i32.shl + (get_local $0) + (i32.const 2) + ) + ) + ) + ) + (i32.store + (tee_local $1 + (call $~lib/allocator/atomic/__memory_allocate + (i32.const 8) + ) + ) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $1) + (i32.const 0) + ) + (i32.store + (get_local $1) + (get_local $2) + ) + (i32.store offset=4 + (get_local $1) + (get_local $0) + ) + (call $~lib/internal/memory/memset + (i32.add + (get_local $2) + (i32.const 8) + ) + (get_local $3) + ) + (get_local $1) + ) + (func $assembly/index/Ray#constructor (; 38 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (if + (i32.eqz + (get_local $0) + ) + (block + (i32.store + (tee_local $0 + (call $~lib/allocator/atomic/__memory_allocate + (i32.const 8) + ) + ) + (get_local $1) + ) + (i32.store offset=4 + (get_local $0) + (get_local $2) + ) + ) + ) + (get_local $0) + ) + (func $~lib/internal/memory/memcpy (; 39 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (loop $continue|0 + (if + (tee_local $3 + (if (result i32) + (get_local $2) + (i32.and + (get_local $1) + (i32.const 3) + ) + (get_local $2) + ) + ) + (block + (set_local $0 + (i32.add + (tee_local $4 + (get_local $0) + ) + (i32.const 1) + ) + ) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + (i32.store8 + (get_local $4) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|0) + ) + ) + ) + (if + (i32.eqz + (i32.and + (get_local $0) + (i32.const 3) + ) + ) + (block + (loop $continue|1 + (if + (i32.ge_u + (get_local $2) + (i32.const 16) + ) + (block + (i32.store + (get_local $0) + (i32.load + (get_local $1) + ) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 4) + ) + (i32.load + (i32.add + (get_local $1) + (i32.const 4) + ) + ) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 8) + ) + (i32.load + (i32.add + (get_local $1) + (i32.const 8) + ) + ) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 12) + ) + (i32.load + (i32.add + (get_local $1) + (i32.const 12) + ) + ) + ) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 16) + ) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 16) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 16) + ) + ) + (br $continue|1) + ) + ) + ) + (if + (i32.and + (get_local $2) + (i32.const 8) + ) + (block + (i32.store + (get_local $0) + (i32.load + (get_local $1) + ) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 4) + ) + (i32.load + (i32.add + (get_local $1) + (i32.const 4) + ) + ) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 8) + ) + ) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 8) + ) + ) + ) + ) + (if + (i32.and + (get_local $2) + (i32.const 4) + ) + (block + (i32.store + (get_local $0) + (i32.load + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 4) + ) + ) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 4) + ) + ) + ) + ) + (if + (i32.and + (get_local $2) + (i32.const 2) + ) + (block + (i32.store16 + (get_local $0) + (i32.load16_u + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 2) + ) + ) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 2) + ) + ) + ) + ) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (block + (set_local $3 + (get_local $1) + ) + (i32.store8 + (get_local $0) + (i32.load8_u + (get_local $1) + ) + ) + ) + ) + (return) + ) + ) + (if + (i32.ge_u + (get_local $2) + (i32.const 32) + ) + (block $break|2 + (block $case2|2 + (block $case1|2 + (if + (i32.ne + (tee_local $3 + (i32.and + (get_local $0) + (i32.const 3) + ) + ) + (i32.const 1) + ) + (block + (br_if $case1|2 + (i32.eq + (get_local $3) + (i32.const 2) + ) + ) + (br_if $case2|2 + (i32.eq + (get_local $3) + (i32.const 3) + ) + ) + (br $break|2) + ) + ) + (set_local $5 + (i32.load + (get_local $1) + ) + ) + (i32.store8 + (get_local $0) + (i32.load8_u + (tee_local $3 + (get_local $1) + ) + ) + ) + (set_local $0 + (tee_local $1 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $1) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $4 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + (i32.const 1) + ) + ) + (set_local $1 + (i32.add + (tee_local $3 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (i32.const 1) + ) + ) + (i32.store8 + (get_local $4) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 3) + ) + ) + (loop $continue|3 + (if + (i32.ge_u + (get_local $2) + (i32.const 17) + ) + (block + (i32.store + (get_local $0) + (i32.or + (i32.shr_u + (get_local $5) + (i32.const 24) + ) + (i32.shl + (tee_local $3 + (i32.load + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + (i32.const 8) + ) + ) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 4) + ) + (i32.or + (i32.shr_u + (get_local $3) + (i32.const 24) + ) + (i32.shl + (tee_local $5 + (i32.load + (i32.add + (get_local $1) + (i32.const 5) + ) + ) + ) + (i32.const 8) + ) + ) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 8) + ) + (i32.or + (i32.shr_u + (get_local $5) + (i32.const 24) + ) + (i32.shl + (tee_local $3 + (i32.load + (i32.add + (get_local $1) + (i32.const 9) + ) + ) + ) + (i32.const 8) + ) + ) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 12) + ) + (i32.or + (i32.shr_u + (get_local $3) + (i32.const 24) + ) + (i32.shl + (tee_local $5 + (i32.load + (i32.add + (get_local $1) + (i32.const 13) + ) + ) + ) + (i32.const 8) + ) + ) + ) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 16) + ) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 16) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 16) + ) + ) + (br $continue|3) + ) + ) + ) + (br $break|2) + ) + (set_local $5 + (i32.load + (get_local $1) + ) + ) + (i32.store8 + (get_local $0) + (i32.load8_u + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $4 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + (i32.const 1) + ) + ) + (set_local $1 + (i32.add + (tee_local $3 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (i32.const 1) + ) + ) + (i32.store8 + (get_local $4) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 2) + ) + ) + (loop $continue|4 + (if + (i32.ge_u + (get_local $2) + (i32.const 18) + ) + (block + (i32.store + (get_local $0) + (i32.or + (i32.shr_u + (get_local $5) + (i32.const 16) + ) + (i32.shl + (tee_local $3 + (i32.load + (i32.add + (get_local $1) + (i32.const 2) + ) + ) + ) + (i32.const 16) + ) + ) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 4) + ) + (i32.or + (i32.shr_u + (get_local $3) + (i32.const 16) + ) + (i32.shl + (tee_local $5 + (i32.load + (i32.add + (get_local $1) + (i32.const 6) + ) + ) + ) + (i32.const 16) + ) + ) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 8) + ) + (i32.or + (i32.shr_u + (get_local $5) + (i32.const 16) + ) + (i32.shl + (tee_local $3 + (i32.load + (i32.add + (get_local $1) + (i32.const 10) + ) + ) + ) + (i32.const 16) + ) + ) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 12) + ) + (i32.or + (i32.shr_u + (get_local $3) + (i32.const 16) + ) + (i32.shl + (tee_local $5 + (i32.load + (i32.add + (get_local $1) + (i32.const 14) + ) + ) + ) + (i32.const 16) + ) + ) + ) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 16) + ) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 16) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 16) + ) + ) + (br $continue|4) + ) + ) + ) + (br $break|2) + ) + (set_local $5 + (i32.load + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $4 + (get_local $0) + ) + (i32.const 1) + ) + ) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + (i32.store8 + (get_local $4) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + (loop $continue|5 + (if + (i32.ge_u + (get_local $2) + (i32.const 19) + ) + (block + (i32.store + (get_local $0) + (i32.or + (i32.shr_u + (get_local $5) + (i32.const 8) + ) + (i32.shl + (tee_local $3 + (i32.load + (i32.add + (get_local $1) + (i32.const 3) + ) + ) + ) + (i32.const 24) + ) + ) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 4) + ) + (i32.or + (i32.shr_u + (get_local $3) + (i32.const 8) + ) + (i32.shl + (tee_local $5 + (i32.load + (i32.add + (get_local $1) + (i32.const 7) + ) + ) + ) + (i32.const 24) + ) + ) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 8) + ) + (i32.or + (i32.shr_u + (get_local $5) + (i32.const 8) + ) + (i32.shl + (tee_local $3 + (i32.load + (i32.add + (get_local $1) + (i32.const 11) + ) + ) + ) + (i32.const 24) + ) + ) + ) + (i32.store + (i32.add + (get_local $0) + (i32.const 12) + ) + (i32.or + (i32.shr_u + (get_local $3) + (i32.const 8) + ) + (i32.shl + (tee_local $5 + (i32.load + (i32.add + (get_local $1) + (i32.const 15) + ) + ) + ) + (i32.const 24) + ) + ) + ) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 16) + ) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 16) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 16) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + (if + (i32.and + (get_local $2) + (i32.const 16) + ) + (block + (i32.store8 + (get_local $0) + (i32.load8_u + (tee_local $3 + (get_local $1) + ) + ) + ) + (set_local $0 + (tee_local $1 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $1) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $4 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + (i32.const 1) + ) + ) + (set_local $1 + (i32.add + (tee_local $3 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (i32.const 1) + ) + ) + (i32.store8 + (get_local $4) + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + (if + (i32.and + (get_local $2) + (i32.const 8) + ) + (block + (i32.store8 + (get_local $0) + (i32.load8_u + (tee_local $3 + (get_local $1) + ) + ) + ) + (set_local $0 + (tee_local $1 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $1) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $4 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + (i32.const 1) + ) + ) + (set_local $1 + (i32.add + (tee_local $3 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (i32.const 1) + ) + ) + (i32.store8 + (get_local $4) + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + (if + (i32.and + (get_local $2) + (i32.const 4) + ) + (block + (i32.store8 + (get_local $0) + (i32.load8_u + (tee_local $3 + (get_local $1) + ) + ) + ) + (set_local $0 + (tee_local $1 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $1) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (tee_local $3 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ) + (i32.store8 + (get_local $3) + (i32.load8_u + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + ) + (set_local $0 + (i32.add + (tee_local $4 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + (i32.const 1) + ) + ) + (set_local $1 + (i32.add + (tee_local $3 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (i32.const 1) + ) + ) + (i32.store8 + (get_local $4) + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + (if + (i32.and + (get_local $2) + (i32.const 2) + ) + (block + (i32.store8 + (get_local $0) + (i32.load8_u + (get_local $1) + ) + ) + (set_local $0 + (i32.add + (tee_local $4 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + (i32.const 1) + ) + ) + (set_local $1 + (i32.add + (tee_local $3 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (i32.const 1) + ) + ) + (i32.store8 + (get_local $4) + (i32.load8_u + (get_local $3) + ) + ) + ) + ) + (if + (i32.and + (get_local $2) + (i32.const 1) + ) + (block + (set_local $3 + (get_local $1) + ) + (i32.store8 + (get_local $0) + (i32.load8_u + (get_local $1) + ) + ) + ) + ) + ) + (func $~lib/internal/memory/memmove (; 40 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (if + (i32.eq + (get_local $0) + (get_local $1) + ) + (return) + ) + (if + (i32.eqz + (tee_local $3 + (i32.le_u + (i32.add + (get_local $1) + (get_local $2) + ) + (get_local $0) + ) + ) + ) + (set_local $3 + (i32.le_u + (i32.add + (get_local $0) + (get_local $2) + ) + (get_local $1) + ) + ) + ) + (if + (get_local $3) + (block + (call $~lib/internal/memory/memcpy + (get_local $0) + (get_local $1) + (get_local $2) + ) + (return) + ) + ) + (if + (i32.lt_u + (get_local $0) + (get_local $1) + ) + (block + (if + (i32.eq + (i32.and + (get_local $1) + (i32.const 7) + ) + (i32.and + (get_local $0) + (i32.const 7) + ) + ) + (block + (loop $continue|0 + (if + (i32.and + (get_local $0) + (i32.const 7) + ) + (block + (if + (i32.eqz + (get_local $2) + ) + (return) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + (set_local $0 + (i32.add + (tee_local $3 + (tee_local $4 + (get_local $0) + ) + ) + (i32.const 1) + ) + ) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + (i32.store8 + (get_local $4) + (i32.load8_u + (get_local $3) + ) + ) + (br $continue|0) + ) + ) + ) + (loop $continue|1 + (if + (i32.ge_u + (get_local $2) + (i32.const 8) + ) + (block + (i64.store + (get_local $0) + (i64.load + (get_local $1) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 8) + ) + ) + (set_local $0 + (i32.add + (get_local $0) + (i32.const 8) + ) + ) + (set_local $1 + (i32.add + (get_local $1) + (i32.const 8) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ) + (loop $continue|2 + (if + (get_local $2) + (block + (set_local $0 + (i32.add + (tee_local $3 + (tee_local $4 + (get_local $0) + ) + ) + (i32.const 1) + ) + ) + (set_local $1 + (i32.add + (tee_local $3 + (get_local $1) + ) + (i32.const 1) + ) + ) + (i32.store8 + (get_local $4) + (i32.load8_u + (get_local $3) + ) + ) + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + (br $continue|2) + ) + ) + ) + ) + (block + (if + (i32.eq + (i32.and + (get_local $1) + (i32.const 7) + ) + (i32.and + (get_local $0) + (i32.const 7) + ) + ) + (block + (loop $continue|3 + (if + (i32.and + (i32.add + (get_local $0) + (get_local $2) + ) + (i32.const 7) + ) + (block + (if + (i32.eqz + (get_local $2) + ) + (return) + ) + (i32.store8 + (i32.add + (get_local $0) + (tee_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ) + (i32.load8_u + (i32.add + (get_local $1) + (get_local $2) + ) + ) + ) + (br $continue|3) + ) + ) + ) + (loop $continue|4 + (if + (i32.ge_u + (get_local $2) + (i32.const 8) + ) + (block + (i64.store + (i32.add + (get_local $0) + (tee_local $2 + (i32.sub + (get_local $2) + (i32.const 8) + ) + ) + ) + (i64.load + (i32.add + (get_local $1) + (get_local $2) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ) + (loop $continue|5 + (if + (get_local $2) + (block + (i32.store8 + (i32.add + (get_local $0) + (tee_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ) + (i32.load8_u + (i32.add + (get_local $1) + (get_local $2) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ) + (func $~lib/internal/arraybuffer/reallocateUnsafe (; 41 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (if + (i32.gt_s + (get_local $1) + (tee_local $2 + (i32.load + (get_local $0) + ) + ) + ) + (if + (i32.le_s + (get_local $1) + (i32.sub + (i32.shl + (i32.const 1) + (i32.sub + (i32.const 32) + (i32.clz + (i32.add + (get_local $2) + (i32.const 7) + ) + ) + ) + ) + (i32.const 8) + ) + ) + (block + (i32.store + (get_local $0) + (get_local $1) + ) + (call $~lib/internal/memory/memset + (i32.add + (i32.add + (get_local $0) + (i32.const 8) + ) + (get_local $2) + ) + (i32.sub + (get_local $1) + (get_local $2) + ) + ) + ) + (block + (call $~lib/internal/memory/memmove + (tee_local $4 + (i32.add + (tee_local $3 + (call $~lib/internal/arraybuffer/allocateUnsafe + (get_local $1) + ) + ) + (i32.const 8) + ) + ) + (i32.add + (get_local $0) + (i32.const 8) + ) + (get_local $2) + ) + (call $~lib/internal/memory/memset + (i32.add + (get_local $4) + (get_local $2) + ) + (i32.sub + (get_local $1) + (get_local $2) + ) + ) + (return + (get_local $3) + ) + ) + ) + (if + (i32.lt_s + (get_local $1) + (get_local $2) + ) + (i32.store + (get_local $0) + (get_local $1) + ) + ) + ) + (get_local $0) + ) + (func $~lib/array/Array#__set (; 42 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (if + (i32.ge_u + (get_local $1) + (i32.shr_u + (i32.load + (tee_local $3 + (i32.load + (get_local $0) + ) + ) + ) + (i32.const 2) + ) + ) + (block + (if + (i32.ge_u + (get_local $1) + (i32.const 268435454) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 87) + (i32.const 41) + ) + (unreachable) + ) + ) + (i32.store + (get_local $0) + (tee_local $3 + (call $~lib/internal/arraybuffer/reallocateUnsafe + (get_local $3) + (i32.shl + (tee_local $4 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (i32.const 2) + ) + ) + ) + ) + (i32.store offset=4 + (get_local $0) + (get_local $4) + ) + ) + ) + (i32.store offset=8 + (i32.add + (get_local $3) + (i32.shl + (get_local $1) + (i32.const 2) + ) + ) + (get_local $2) + ) + ) + (func $assembly/index/createContext (; 43 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (set_global $assembly/index/context + (call $assembly/index/Context#constructor) + ) + (set_local $4 + (get_global $assembly/index/context) + ) + (set_local $2 + (call $~lib/array/Array#constructor + (i32.const 9) + ) + ) + (set_local $3 + (call $assembly/index/Sphere#constructor + (f64.const 1e5) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 100001) + (f64.const 40.8) + (f64.const 81.6) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0.75) + (f64.const 0) + (f64.const 0) + ) + (get_global $assembly/index/Refl_t.DIFF) + ) + ) + (i32.store offset=8 + (i32.load + (get_local $2) + ) + (get_local $3) + ) + (set_local $3 + (call $assembly/index/Sphere#constructor + (f64.const 1e5) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const -99901) + (f64.const 40.8) + (f64.const 81.6) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0.75) + (f64.const 0) + ) + (get_global $assembly/index/Refl_t.DIFF) + ) + ) + (i32.store offset=8 + (i32.add + (i32.load + (get_local $2) + ) + (i32.const 4) + ) + (get_local $3) + ) + (set_local $3 + (call $assembly/index/Sphere#constructor + (f64.const 1e5) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 50) + (f64.const 40.8) + (f64.const 1e5) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0.75) + (f64.const 0.75) + (f64.const 0.75) + ) + (get_global $assembly/index/Refl_t.DIFF) + ) + ) + (i32.store offset=8 + (i32.add + (i32.load + (get_local $2) + ) + (i32.const 8) + ) + (get_local $3) + ) + (set_local $3 + (call $assembly/index/Sphere#constructor + (f64.const 1e5) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 50) + (f64.const 40.8) + (f64.const -99830) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (get_global $assembly/index/Refl_t.DIFF) + ) + ) + (i32.store offset=8 + (i32.add + (i32.load + (get_local $2) + ) + (i32.const 12) + ) + (get_local $3) + ) + (set_local $3 + (call $assembly/index/Sphere#constructor + (f64.const 1e5) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 50) + (f64.const 1e5) + (f64.const 81.6) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0.75) + (f64.const 0.75) + (f64.const 0.75) + ) + (get_global $assembly/index/Refl_t.DIFF) + ) + ) + (i32.store offset=8 + (i32.add + (i32.load + (get_local $2) + ) + (i32.const 16) + ) + (get_local $3) + ) + (set_local $3 + (call $assembly/index/Sphere#constructor + (f64.const 1e5) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 50) + (f64.const -99918.4) + (f64.const 81.6) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0.75) + (f64.const 0.75) + (f64.const 0.75) + ) + (get_global $assembly/index/Refl_t.DIFF) + ) + ) + (i32.store offset=8 + (i32.add + (i32.load + (get_local $2) + ) + (i32.const 20) + ) + (get_local $3) + ) + (set_local $3 + (call $assembly/index/Sphere#constructor + (f64.const 16.5) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 27) + (f64.const 16.5) + (f64.const 47) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0.999) + (f64.const 0.999) + (f64.const 0.999) + ) + (get_global $assembly/index/Refl_t.SPEC) + ) + ) + (i32.store offset=8 + (i32.add + (i32.load + (get_local $2) + ) + (i32.const 24) + ) + (get_local $3) + ) + (set_local $3 + (call $assembly/index/Sphere#constructor + (f64.const 16.5) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 73) + (f64.const 16.5) + (f64.const 78) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0.999) + (f64.const 0.999) + (f64.const 0.999) + ) + (get_global $assembly/index/Refl_t.REFR) + ) + ) + (i32.store offset=8 + (i32.add + (i32.load + (get_local $2) + ) + (i32.const 28) + ) + (get_local $3) + ) + (set_local $3 + (call $assembly/index/Sphere#constructor + (f64.const 600) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 50) + (f64.const 681.33) + (f64.const 81.6) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 112) + (f64.const 112) + (f64.const 112) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + (get_global $assembly/index/Refl_t.DIFF) + ) + ) + (i32.store offset=8 + (i32.add + (i32.load + (get_local $2) + ) + (i32.const 32) + ) + (get_local $3) + ) + (i32.store offset=24 + (get_local $4) + (get_local $2) + ) + (i32.store offset=4 + (get_global $assembly/index/context) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const -0.042612) + (f64.const -1) + ) + ) + (i32.store offset=8 + (get_global $assembly/index/context) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 50) + (f64.const 52) + (f64.const 295.6) + ) + ) + (i32.store offset=12 + (get_global $assembly/index/context) + (call $assembly/index/Ray#constructor + (i32.const 0) + (i32.load offset=8 + (get_global $assembly/index/context) + ) + (call $assembly/index/Vec#norm_in + (i32.load offset=4 + (get_global $assembly/index/context) + ) + ) + ) + ) + (i32.store offset=16 + (get_global $assembly/index/context) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=20 + (get_global $assembly/index/context) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=28 + (get_global $assembly/index/context) + (get_local $0) + ) + (i32.store offset=32 + (get_global $assembly/index/context) + (get_local $1) + ) + (f64.store + (tee_local $2 + (i32.load offset=16 + (get_global $assembly/index/context) + ) + ) + (f64.div + (f64.mul + (f64.convert_s/i32 + (get_local $0) + ) + (f64.const 0.5135) + ) + (f64.convert_s/i32 + (get_local $1) + ) + ) + ) + (f64.store offset=8 + (get_local $2) + (f64.const 0) + ) + (f64.store offset=16 + (get_local $2) + (f64.const 0) + ) + (f64.store + (tee_local $2 + (call $assembly/index/Vec#norm_in + (call $assembly/index/Vec#mod2 + (i32.load offset=16 + (get_global $assembly/index/context) + ) + (i32.load offset=4 + (i32.load offset=12 + (get_global $assembly/index/context) + ) + ) + (i32.load offset=20 + (get_global $assembly/index/context) + ) + ) + ) + ) + (f64.mul + (f64.load + (get_local $2) + ) + (f64.const 0.5135) + ) + ) + (f64.store offset=8 + (get_local $2) + (f64.mul + (f64.load offset=8 + (get_local $2) + ) + (f64.const 0.5135) + ) + ) + (f64.store offset=16 + (get_local $2) + (f64.mul + (f64.load offset=16 + (get_local $2) + ) + (f64.const 0.5135) + ) + ) + (i32.store + (get_global $assembly/index/context) + (call $~lib/array/Array#constructor + (tee_local $0 + (i32.mul + (get_local $0) + (get_local $1) + ) + ) + ) + ) + (block $break|0 + (set_local $2 + (i32.const 0) + ) + (loop $repeat|0 + (br_if $break|0 + (i32.ge_s + (get_local $2) + (get_local $0) + ) + ) + (call $~lib/array/Array#__set + (i32.load + (get_global $assembly/index/context) + ) + (get_local $2) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (set_local $2 + (i32.add + (get_local $2) + (i32.const 1) + ) + ) + (br $repeat|0) + ) + ) + (get_global $assembly/index/context) + ) + (func $assembly/index/Hit#constructor (; 44 ;) (; has Stack IR ;) (type $iiFii) (param $0 i32) (param $1 i32) (param $2 f64) (param $3 i32) (result i32) + (if + (i32.eqz + (get_local $0) + ) + (block + (i32.store + (tee_local $0 + (call $~lib/allocator/atomic/__memory_allocate + (i32.const 20) + ) + ) + (get_local $1) + ) + (f64.store offset=8 + (get_local $0) + (get_local $2) + ) + (i32.store offset=16 + (get_local $0) + (get_local $3) + ) + ) + ) + (get_local $0) + ) + (func $assembly/index/Ray#constructor|trampoline (; 45 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) + (local $0 i32) + (local $1 i32) + (block $2of2 + (block $1of2 + (block $0of2 + (block $outOfRange + (br_table $0of2 $1of2 $2of2 $outOfRange + (get_global $~argc) + ) + ) + (unreachable) + ) + (set_local $1 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + ) + (set_local $0 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + ) + (call $assembly/index/Ray#constructor + (i32.const 0) + (get_local $1) + (get_local $0) + ) + ) + (func $assembly/index/Hit#constructor|trampoline (; 46 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) + (local $0 i32) + (local $1 i32) + (block $3of3 + (block $2of3 + (block $1of3 + (block $0of3 + (block $outOfRange + (br_table $0of3 $1of3 $2of3 $3of3 $outOfRange + (get_global $~argc) + ) + ) + (unreachable) + ) + (set_global $~argc + (i32.const 0) + ) + (set_local $1 + (call $assembly/index/Ray#constructor|trampoline) + ) + ) + ) + (set_local $0 + (i32.const -1) + ) + ) + (call $assembly/index/Hit#constructor + (i32.const 0) + (get_local $1) + (f64.const 0) + (get_local $0) + ) + ) + (func $assembly/index/Locals#constructor (; 47 ;) (; has Stack IR ;) (type $FUNCSIG$i) (result i32) + (local $0 i32) + (i32.store + (tee_local $0 + (call $~lib/allocator/atomic/__memory_allocate + (i32.const 108) + ) + ) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=4 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 1) + (f64.const 0) + (f64.const 0) + ) + ) + (set_global $~argc + (i32.const 0) + ) + (i32.store offset=8 + (get_local $0) + (call $assembly/index/Hit#constructor|trampoline) + ) + (i32.store offset=12 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=16 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=20 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=24 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=28 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=32 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=36 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=40 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=44 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=48 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=52 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=56 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=60 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=64 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=68 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=72 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=76 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=80 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=84 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=88 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=92 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=96 + (get_local $0) + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (set_global $~argc + (i32.const 0) + ) + (i32.store offset=100 + (get_local $0) + (call $assembly/index/Ray#constructor|trampoline) + ) + (set_global $~argc + (i32.const 0) + ) + (i32.store offset=104 + (get_local $0) + (call $assembly/index/Ray#constructor|trampoline) + ) + (get_local $0) + ) + (func $assembly/index/createLocals (; 48 ;) (; has Stack IR ;) (type $i) (result i32) + (call $assembly/index/Locals#constructor) + ) + (func $assembly/index/Ray#set (; 49 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (f64.store + (tee_local $3 + (i32.load + (get_local $0) + ) + ) + (f64.load + (get_local $1) + ) + ) + (f64.store offset=8 + (get_local $3) + (f64.load offset=8 + (get_local $1) + ) + ) + (f64.store offset=16 + (get_local $3) + (f64.load offset=16 + (get_local $1) + ) + ) + (f64.store + (tee_local $1 + (i32.load offset=4 + (get_local $0) + ) + ) + (f64.load + (get_local $2) + ) + ) + (f64.store offset=8 + (get_local $1) + (f64.load offset=8 + (get_local $2) + ) + ) + (f64.store offset=16 + (get_local $1) + (f64.load offset=16 + (get_local $2) + ) + ) + (get_local $0) + ) + (func $assembly/index/Sphere#intersect (; 50 ;) (; has Stack IR ;) (type $iiiF) (param $0 i32) (param $1 i32) (param $2 i32) (result f64) + (local $3 f64) + (local $4 f64) + (local $5 f64) + (set_local $3 + (if (result f64) + (f64.lt + (tee_local $3 + (f64.add + (f64.sub + (f64.mul + (tee_local $4 + (f64.add + (f64.add + (f64.mul + (f64.load + (tee_local $2 + (call $assembly/index/Vec#sub2 + (i32.load offset=8 + (get_local $0) + ) + (i32.load + (get_local $1) + ) + (i32.load offset=80 + (get_local $2) + ) + ) + ) + ) + (f64.load + (tee_local $1 + (i32.load offset=4 + (get_local $1) + ) + ) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $2) + ) + (f64.load offset=8 + (get_local $1) + ) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $2) + ) + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ) + (get_local $4) + ) + (f64.add + (f64.add + (f64.mul + (f64.load + (get_local $2) + ) + (f64.load + (get_local $2) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $2) + ) + (f64.load offset=8 + (get_local $2) + ) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $2) + ) + (f64.load offset=16 + (get_local $2) + ) + ) + ) + ) + (f64.mul + (f64.load + (get_local $0) + ) + (f64.load + (get_local $0) + ) + ) + ) + ) + (f64.const 0) + ) + (return + (f64.const 0) + ) + (f64.sqrt + (get_local $3) + ) + ) + ) + (if + (i32.eqz + (f64.gt + (tee_local $5 + (f64.sub + (get_local $4) + (get_local $3) + ) + ) + (f64.const 0.0001) + ) + ) + (if + (i32.eqz + (f64.gt + (tee_local $5 + (f64.add + (get_local $4) + (get_local $3) + ) + ) + (f64.const 0.0001) + ) + ) + (set_local $5 + (f64.const 0) + ) + ) + ) + (get_local $5) + ) + (func $assembly/index/Ray#copy (; 51 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (f64.store + (tee_local $2 + (i32.load + (get_local $0) + ) + ) + (f64.load + (tee_local $3 + (i32.load + (get_local $1) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $2) + (f64.load offset=8 + (get_local $3) + ) + ) + (f64.store offset=16 + (get_local $2) + (f64.load offset=16 + (get_local $3) + ) + ) + (f64.store + (tee_local $0 + (i32.load offset=4 + (get_local $0) + ) + ) + (f64.load + (tee_local $1 + (i32.load offset=4 + (get_local $1) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $0) + (f64.load offset=8 + (get_local $1) + ) + ) + (f64.store offset=16 + (get_local $0) + (f64.load offset=16 + (get_local $1) + ) + ) + ) + (func $assembly/index/intersect (; 52 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 f64) + (local $5 f64) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (set_local $4 + (f64.const inf) + ) + (set_local $6 + (i32.const -1) + ) + (set_local $8 + (i32.load offset=4 + (i32.load offset=24 + (get_global $assembly/index/context) + ) + ) + ) + (block $break|0 + (loop $repeat|0 + (br_if $break|0 + (i32.ge_s + (get_local $3) + (get_local $8) + ) + ) + (if + (f64.ne + (if (result f64) + (f64.ne + (tee_local $5 + (call $assembly/index/Sphere#intersect + (tee_local $7 + (if (result i32) + (i32.lt_u + (get_local $3) + (i32.shr_u + (i32.load + (tee_local $7 + (i32.load + (i32.load offset=24 + (get_global $assembly/index/context) + ) + ) + ) + ) + (i32.const 2) + ) + ) + (i32.load offset=8 + (i32.add + (get_local $7) + (i32.shl + (get_local $3) + (i32.const 2) + ) + ) + ) + (unreachable) + ) + ) + (get_local $0) + (get_local $2) + ) + ) + (f64.const 0) + ) + (f64.convert_u/i32 + (f64.lt + (get_local $5) + (get_local $4) + ) + ) + (get_local $5) + ) + (f64.const 0) + ) + (block + (set_local $4 + (get_local $5) + ) + (set_local $6 + (get_local $3) + ) + ) + ) + (set_local $3 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (br $repeat|0) + ) + ) + (f64.store offset=8 + (get_local $1) + (get_local $4) + ) + (i32.store offset=16 + (get_local $1) + (get_local $6) + ) + (call $assembly/index/Ray#copy + (i32.load + (get_local $1) + ) + (get_local $0) + ) + (get_local $1) + ) + (func $assembly/index/radiance (; 53 ;) (; has Stack IR ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (local $4 i32) + (local $5 f64) + (local $6 i32) + (local $7 i32) + (local $8 f64) + (local $9 f64) + (local $10 f64) + (local $11 i32) + (local $12 i32) + (local $13 i32) + (local $14 f64) + (local $15 i32) + (block $folding-inner0 + (drop + (call $assembly/index/intersect + (get_local $0) + (i32.load offset=8 + (get_local $3) + ) + (get_local $3) + ) + ) + (if + (f64.eq + (f64.load offset=8 + (i32.load offset=8 + (get_local $3) + ) + ) + (f64.const inf) + ) + (return + (i32.load + (get_local $3) + ) + ) + ) + (set_local $12 + (i32.load offset=8 + (i32.add + (i32.load + (i32.load offset=24 + (get_global $assembly/index/context) + ) + ) + (i32.shl + (i32.load offset=16 + (i32.load offset=8 + (get_local $3) + ) + ) + (i32.const 2) + ) + ) + ) + ) + (f64.store + (tee_local $4 + (i32.load offset=16 + (get_local $3) + ) + ) + (f64.mul + (f64.load + (tee_local $7 + (i32.load offset=4 + (get_local $0) + ) + ) + ) + (tee_local $5 + (f64.load offset=8 + (i32.load offset=8 + (get_local $3) + ) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $4) + (f64.mul + (f64.load offset=8 + (get_local $7) + ) + (get_local $5) + ) + ) + (f64.store offset=16 + (get_local $4) + (f64.mul + (f64.load offset=16 + (get_local $7) + ) + (get_local $5) + ) + ) + (if + (f64.lt + (f64.add + (f64.add + (f64.mul + (f64.load + (tee_local $6 + (call $assembly/index/Vec#norm_in + (call $assembly/index/Vec#sub2 + (tee_local $13 + (call $assembly/index/Vec#add2 + (i32.load offset=16 + (get_local $3) + ) + (i32.load + (get_local $0) + ) + (i32.load offset=20 + (get_local $3) + ) + ) + ) + (i32.load offset=8 + (get_local $12) + ) + (i32.load offset=24 + (get_local $3) + ) + ) + ) + ) + ) + (f64.load + (tee_local $4 + (i32.load offset=4 + (get_local $0) + ) + ) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $6) + ) + (f64.load offset=8 + (get_local $4) + ) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $6) + ) + (f64.load offset=16 + (get_local $4) + ) + ) + ) + (f64.const 0) + ) + (block + (f64.store + (tee_local $4 + (i32.load offset=28 + (get_local $3) + ) + ) + (f64.load + (get_local $6) + ) + ) + (f64.store offset=8 + (get_local $4) + (f64.load offset=8 + (get_local $6) + ) + ) + (f64.store offset=16 + (get_local $4) + (f64.load offset=16 + (get_local $6) + ) + ) + ) + (block + (f64.store + (tee_local $4 + (i32.load offset=28 + (get_local $3) + ) + ) + (f64.mul + (f64.load + (get_local $6) + ) + (f64.const -1) + ) + ) + (f64.store offset=8 + (get_local $4) + (f64.mul + (f64.load offset=8 + (get_local $6) + ) + (f64.const -1) + ) + ) + (f64.store offset=16 + (get_local $4) + (f64.mul + (f64.load offset=16 + (get_local $6) + ) + (f64.const -1) + ) + ) + ) + ) + (if + (i32.eqz + (get_local $2) + ) + (set_local $2 + (i32.load offset=12 + (get_local $3) + ) + ) + ) + (f64.store + (get_local $2) + (f64.load + (tee_local $7 + (i32.load offset=16 + (get_local $12) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $2) + (f64.load offset=8 + (get_local $7) + ) + ) + (f64.store offset=16 + (get_local $2) + (f64.load offset=16 + (get_local $7) + ) + ) + (if + (tee_local $7 + (f64.gt + (f64.load + (get_local $2) + ) + (f64.load offset=8 + (get_local $2) + ) + ) + ) + (set_local $7 + (f64.gt + (f64.load + (get_local $2) + ) + (f64.load offset=16 + (get_local $2) + ) + ) + ) + ) + (set_local $5 + (if (result f64) + (get_local $7) + (f64.load + (get_local $2) + ) + (if (result f64) + (f64.gt + (f64.load offset=8 + (get_local $2) + ) + (f64.load offset=16 + (get_local $2) + ) + ) + (f64.load offset=8 + (get_local $2) + ) + (f64.load offset=16 + (get_local $2) + ) + ) + ) + ) + (if + (i32.gt_s + (tee_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + (i32.const 5) + ) + (block + (if + (f64.lt + (call $~lib/math/JSMath.random) + (get_local $5) + ) + (block + (f64.store + (get_local $2) + (f64.mul + (f64.load + (get_local $2) + ) + (tee_local $5 + (f64.div + (f64.const 1) + (get_local $5) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $2) + (f64.mul + (f64.load offset=8 + (get_local $2) + ) + (get_local $5) + ) + ) + (f64.store offset=16 + (get_local $2) + (f64.mul + (f64.load offset=16 + (get_local $2) + ) + (get_local $5) + ) + ) + ) + ) + (f64.store + (get_local $2) + (f64.load + (tee_local $0 + (i32.load offset=12 + (get_local $12) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $2) + (f64.load offset=8 + (get_local $0) + ) + ) + (f64.store offset=16 + (get_local $2) + (f64.load offset=16 + (get_local $0) + ) + ) + (return + (get_local $2) + ) + ) + ) + (if + (i32.eq + (i32.load offset=20 + (get_local $12) + ) + (get_global $assembly/index/Refl_t.DIFF) + ) + (block + (set_local $5 + (f64.mul + (f64.const 6.283185307179586) + (call $~lib/math/JSMath.random) + ) + ) + (set_local $8 + (f64.sqrt + (tee_local $9 + (call $~lib/math/JSMath.random) + ) + ) + ) + (set_local $0 + (i32.load offset=32 + (get_local $3) + ) + ) + (if + (f64.gt + (f64.abs + (f64.load + (tee_local $7 + (get_local $4) + ) + ) + ) + (f64.const 0.1) + ) + (block + (f64.store + (get_local $0) + (f64.const 0) + ) + (f64.store offset=8 + (get_local $0) + (f64.const 1) + ) + (f64.store offset=16 + (get_local $0) + (f64.const 0) + ) + ) + (block + (f64.store + (get_local $0) + (f64.const 1) + ) + (f64.store offset=8 + (get_local $0) + (f64.const 1) + ) + (f64.store offset=16 + (get_local $0) + (f64.const 0) + ) + (drop + (call $assembly/index/Vec#norm_in + (call $assembly/index/Vec#mod_in + (get_local $0) + (get_local $7) + ) + ) + ) + ) + ) + (set_local $4 + (call $assembly/index/Vec#mod2 + (get_local $7) + (get_local $0) + (i32.load offset=36 + (get_local $3) + ) + ) + ) + (set_local $10 + (f64.mul + (call $~lib/math/JSMath.cos + (get_local $5) + ) + (get_local $8) + ) + ) + (f64.store + (get_local $0) + (f64.mul + (f64.load + (get_local $0) + ) + (get_local $10) + ) + ) + (f64.store offset=8 + (get_local $0) + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (get_local $10) + ) + ) + (f64.store offset=16 + (get_local $0) + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (get_local $10) + ) + ) + (set_local $5 + (f64.mul + (call $~lib/math/JSMath.sin + (get_local $5) + ) + (get_local $8) + ) + ) + (f64.store + (get_local $4) + (f64.mul + (f64.load + (get_local $4) + ) + (get_local $5) + ) + ) + (f64.store offset=8 + (get_local $4) + (f64.mul + (f64.load offset=8 + (get_local $4) + ) + (get_local $5) + ) + ) + (f64.store offset=16 + (get_local $4) + (f64.mul + (f64.load offset=16 + (get_local $4) + ) + (get_local $5) + ) + ) + (set_local $0 + (call $assembly/index/Vec#add_in + (get_local $0) + (get_local $4) + ) + ) + (f64.store + (get_local $7) + (f64.mul + (f64.load + (get_local $7) + ) + (tee_local $5 + (f64.sqrt + (f64.sub + (f64.const 1) + (get_local $9) + ) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $7) + (f64.mul + (f64.load offset=8 + (get_local $7) + ) + (get_local $5) + ) + ) + (f64.store offset=16 + (get_local $7) + (f64.mul + (f64.load offset=16 + (get_local $7) + ) + (get_local $5) + ) + ) + (set_local $0 + (call $assembly/index/Vec#norm_in + (call $assembly/index/Vec#add_in + (get_local $0) + (get_local $7) + ) + ) + ) + (set_local $4 + (call $assembly/index/Ray#set + (i32.load offset=100 + (get_local $3) + ) + (get_local $13) + (get_local $0) + ) + ) + (f64.store + (tee_local $0 + (i32.load offset=40 + (get_local $3) + ) + ) + (f64.const 0) + ) + (f64.store offset=8 + (get_local $0) + (f64.const 0) + ) + (f64.store offset=16 + (get_local $0) + (f64.const 0) + ) + (drop + (call $assembly/index/radiance + (get_local $4) + (get_local $1) + (get_local $0) + (get_local $3) + ) + ) + (drop + (call $assembly/index/Vec#mul_in + (get_local $2) + (get_local $0) + ) + ) + (drop + (call $assembly/index/Vec#add_in + (get_local $2) + (i32.load offset=12 + (get_local $12) + ) + ) + ) + (return + (get_local $2) + ) + ) + (if + (i32.eq + (i32.load offset=20 + (get_local $12) + ) + (get_global $assembly/index/Refl_t.SPEC) + ) + (block + (set_local $4 + (i32.load offset=4 + (get_local $0) + ) + ) + (f64.store + (get_local $6) + (f64.mul + (f64.load + (get_local $6) + ) + (tee_local $5 + (f64.mul + (f64.const 2) + (f64.add + (f64.add + (f64.mul + (f64.load + (get_local $6) + ) + (f64.load + (tee_local $0 + (i32.load offset=4 + (get_local $0) + ) + ) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $6) + ) + (f64.load offset=8 + (get_local $0) + ) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $6) + ) + (f64.load offset=16 + (get_local $0) + ) + ) + ) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $6) + (f64.mul + (f64.load offset=8 + (get_local $6) + ) + (get_local $5) + ) + ) + (f64.store offset=16 + (get_local $6) + (f64.mul + (f64.load offset=16 + (get_local $6) + ) + (get_local $5) + ) + ) + (set_local $0 + (call $assembly/index/Vec#sub2 + (get_local $4) + (get_local $6) + (i32.load offset=84 + (get_local $3) + ) + ) + ) + (set_local $4 + (call $assembly/index/Ray#set + (i32.load offset=100 + (get_local $3) + ) + (get_local $13) + (get_local $0) + ) + ) + (f64.store + (tee_local $0 + (i32.load offset=40 + (get_local $3) + ) + ) + (f64.const 0) + ) + (f64.store offset=8 + (get_local $0) + (f64.const 0) + ) + (f64.store offset=16 + (get_local $0) + (f64.const 0) + ) + (drop + (call $assembly/index/radiance + (get_local $4) + (get_local $1) + (get_local $0) + (get_local $3) + ) + ) + (br $folding-inner0) + ) + ) + ) + (f64.store + (tee_local $7 + (i32.load offset=88 + (get_local $3) + ) + ) + (f64.mul + (f64.load + (get_local $6) + ) + (tee_local $5 + (f64.mul + (f64.const 2) + (f64.add + (f64.add + (f64.mul + (f64.load + (get_local $6) + ) + (f64.load + (tee_local $11 + (i32.load offset=4 + (get_local $0) + ) + ) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $6) + ) + (f64.load offset=8 + (get_local $11) + ) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $6) + ) + (f64.load offset=16 + (get_local $11) + ) + ) + ) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $7) + (f64.mul + (f64.load offset=8 + (get_local $6) + ) + (get_local $5) + ) + ) + (f64.store offset=16 + (get_local $7) + (f64.mul + (f64.load offset=16 + (get_local $6) + ) + (get_local $5) + ) + ) + (drop + (call $assembly/index/Vec#sub + (i32.load offset=4 + (get_local $0) + ) + (get_local $7) + (i32.const 1) + ) + ) + (set_local $7 + (call $assembly/index/Ray#set + (i32.load offset=100 + (get_local $3) + ) + (get_local $13) + (get_local $7) + ) + ) + (if + (f64.lt + (tee_local $10 + (f64.sub + (f64.const 1) + (f64.mul + (f64.mul + (tee_local $5 + (if (result f64) + (tee_local $15 + (f64.gt + (f64.add + (f64.add + (f64.mul + (f64.load + (get_local $6) + ) + (f64.load + (get_local $4) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $6) + ) + (f64.load offset=8 + (get_local $4) + ) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $6) + ) + (f64.load offset=16 + (get_local $4) + ) + ) + ) + (f64.const 0) + ) + ) + (f64.const 0.6666666666666666) + (f64.const 1.5) + ) + ) + (get_local $5) + ) + (f64.sub + (f64.const 1) + (f64.mul + (tee_local $8 + (f64.add + (f64.add + (f64.mul + (f64.load + (tee_local $11 + (i32.load offset=4 + (get_local $0) + ) + ) + ) + (f64.load + (get_local $4) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $11) + ) + (f64.load offset=8 + (get_local $4) + ) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $11) + ) + (f64.load offset=16 + (get_local $4) + ) + ) + ) + ) + (get_local $8) + ) + ) + ) + ) + ) + (f64.const 0) + ) + (block + (f64.store + (tee_local $0 + (i32.load offset=40 + (get_local $3) + ) + ) + (f64.const 0) + ) + (f64.store offset=8 + (get_local $0) + (f64.const 0) + ) + (f64.store offset=16 + (get_local $0) + (f64.const 0) + ) + (drop + (call $assembly/index/radiance + (get_local $7) + (get_local $1) + (get_local $0) + (get_local $3) + ) + ) + (br $folding-inner0) + ) + ) + (f64.store + (tee_local $4 + (i32.load offset=44 + (get_local $3) + ) + ) + (f64.mul + (f64.load + (get_local $6) + ) + (tee_local $9 + (f64.mul + (tee_local $9 + (if (result f64) + (get_local $15) + (f64.const 1) + (f64.const -1) + ) + ) + (f64.add + (f64.mul + (get_local $8) + (get_local $5) + ) + (f64.sqrt + (get_local $10) + ) + ) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $4) + (f64.mul + (f64.load offset=8 + (get_local $6) + ) + (get_local $9) + ) + ) + (f64.store offset=16 + (get_local $4) + (f64.mul + (f64.load offset=16 + (get_local $6) + ) + (get_local $9) + ) + ) + (f64.store + (tee_local $11 + (i32.load offset=48 + (get_local $3) + ) + ) + (f64.mul + (f64.load + (tee_local $0 + (i32.load offset=4 + (get_local $0) + ) + ) + ) + (get_local $5) + ) + ) + (f64.store offset=8 + (get_local $11) + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (get_local $5) + ) + ) + (f64.store offset=16 + (get_local $11) + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (get_local $5) + ) + ) + (set_local $0 + (call $assembly/index/Vec#norm_in + (call $assembly/index/Vec#sub_in + (get_local $11) + (get_local $4) + ) + ) + ) + (set_local $8 + (f64.add + (f64.const 0.25) + (f64.mul + (f64.const 0.5) + (tee_local $5 + (f64.add + (f64.const 0.04) + (f64.mul + (f64.mul + (f64.mul + (f64.mul + (f64.mul + (f64.const 0.96) + (tee_local $5 + (f64.sub + (f64.const 1) + (tee_local $5 + (if (result f64) + (get_local $15) + (f64.neg + (get_local $8) + ) + (f64.add + (f64.add + (f64.mul + (f64.load + (get_local $0) + ) + (f64.load + (get_local $6) + ) + ) + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + (f64.load offset=8 + (get_local $6) + ) + ) + ) + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + (f64.load offset=16 + (get_local $6) + ) + ) + ) + ) + ) + ) + ) + ) + (get_local $5) + ) + (get_local $5) + ) + (get_local $5) + ) + (get_local $5) + ) + ) + ) + ) + ) + ) + (set_local $9 + (f64.div + (get_local $5) + (get_local $8) + ) + ) + (set_local $14 + (f64.div + (tee_local $10 + (f64.sub + (f64.const 1) + (get_local $5) + ) + ) + (f64.sub + (f64.const 1) + (get_local $8) + ) + ) + ) + (set_local $4 + (call $assembly/index/Ray#set + (i32.load offset=100 + (get_local $3) + ) + (get_local $13) + (get_local $0) + ) + ) + (f64.store + (tee_local $0 + (i32.load offset=52 + (get_local $3) + ) + ) + (f64.const 0) + ) + (f64.store offset=8 + (get_local $0) + (f64.const 0) + ) + (f64.store offset=16 + (get_local $0) + (f64.const 0) + ) + (if + (i32.gt_s + (get_local $1) + (i32.const 2) + ) + (if + (f64.lt + (call $~lib/math/JSMath.random) + (get_local $8) + ) + (block + (f64.store + (tee_local $1 + (call $assembly/index/radiance + (get_local $7) + (get_local $1) + (get_local $0) + (get_local $3) + ) + ) + (f64.mul + (f64.load + (get_local $1) + ) + (get_local $9) + ) + ) + (f64.store offset=8 + (get_local $1) + (f64.mul + (f64.load offset=8 + (get_local $1) + ) + (get_local $9) + ) + ) + (f64.store offset=16 + (get_local $1) + (f64.mul + (f64.load offset=16 + (get_local $1) + ) + (get_local $9) + ) + ) + ) + (block + (f64.store + (tee_local $1 + (call $assembly/index/radiance + (get_local $4) + (get_local $1) + (get_local $0) + (get_local $3) + ) + ) + (f64.mul + (f64.load + (get_local $1) + ) + (get_local $14) + ) + ) + (f64.store offset=8 + (get_local $1) + (f64.mul + (f64.load offset=8 + (get_local $1) + ) + (get_local $14) + ) + ) + (f64.store offset=16 + (get_local $1) + (f64.mul + (f64.load offset=16 + (get_local $1) + ) + (get_local $14) + ) + ) + ) + ) + (block + (f64.store + (tee_local $4 + (call $assembly/index/radiance + (get_local $4) + (get_local $1) + (i32.load offset=92 + (get_local $3) + ) + (get_local $3) + ) + ) + (f64.mul + (f64.load + (get_local $4) + ) + (get_local $10) + ) + ) + (f64.store offset=8 + (get_local $4) + (f64.mul + (f64.load offset=8 + (get_local $4) + ) + (get_local $10) + ) + ) + (f64.store offset=16 + (get_local $4) + (f64.mul + (f64.load offset=16 + (get_local $4) + ) + (get_local $10) + ) + ) + (f64.store + (tee_local $1 + (call $assembly/index/radiance + (get_local $7) + (get_local $1) + (get_local $0) + (get_local $3) + ) + ) + (f64.mul + (f64.load + (get_local $1) + ) + (get_local $5) + ) + ) + (f64.store offset=8 + (get_local $1) + (f64.mul + (f64.load offset=8 + (get_local $1) + ) + (get_local $5) + ) + ) + (f64.store offset=16 + (get_local $1) + (f64.mul + (f64.load offset=16 + (get_local $1) + ) + (get_local $5) + ) + ) + (drop + (call $assembly/index/Vec#add_in + (get_local $1) + (i32.load offset=92 + (get_local $3) + ) + ) + ) + ) + ) + (drop + (call $assembly/index/Vec#mul_in + (get_local $2) + (get_local $0) + ) + ) + (return + (call $assembly/index/Vec#add_in + (get_local $2) + (i32.load offset=12 + (get_local $12) + ) + ) + ) + ) + (drop + (call $assembly/index/Vec#mul_in + (get_local $2) + (get_local $0) + ) + ) + (call $assembly/index/Vec#add_in + (get_local $2) + (i32.load offset=12 + (get_local $12) + ) + ) + ) + (func $assembly/index/render (; 54 ;) (; has Stack IR ;) (type $iiiiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) + (local $6 i32) + (local $7 f64) + (local $8 i32) + (local $9 i32) + (local $10 f64) + (local $11 f64) + (local $12 i32) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + (block $break|0 + (set_local $12 + (get_local $3) + ) + (loop $repeat|0 + (br_if $break|0 + (i32.ge_s + (get_local $12) + (i32.add + (get_local $3) + (get_local $5) + ) + ) + ) + (block $break|1 + (set_local $13 + (get_local $2) + ) + (loop $repeat|1 + (br_if $break|1 + (i32.ge_s + (get_local $13) + (i32.add + (get_local $2) + (get_local $4) + ) + ) + ) + (block $break|2 + (set_local $14 + (i32.const 0) + ) + (loop $repeat|2 + (br_if $break|2 + (i32.ge_s + (get_local $14) + (i32.const 2) + ) + ) + (set_local $16 + (i32.add + (i32.mul + (get_local $12) + (i32.load offset=28 + (get_global $assembly/index/context) + ) + ) + (get_local $13) + ) + ) + (block $break|3 + (set_local $15 + (i32.const 0) + ) + (loop $repeat|3 + (br_if $break|3 + (i32.ge_s + (get_local $15) + (i32.const 2) + ) + ) + (f64.store + (tee_local $6 + (i32.load offset=96 + (get_local $0) + ) + ) + (f64.const 0) + ) + (f64.store offset=8 + (get_local $6) + (f64.const 0) + ) + (f64.store offset=16 + (get_local $6) + (f64.const 0) + ) + (block $break|4 + (set_local $8 + (i32.const 0) + ) + (loop $repeat|4 + (br_if $break|4 + (i32.ge_s + (get_local $8) + (get_local $1) + ) + ) + (set_local $10 + (if (result f64) + (f64.lt + (tee_local $7 + (f64.mul + (f64.const 2) + (call $~lib/math/JSMath.random) + ) + ) + (f64.const 1) + ) + (f64.sub + (f64.sqrt + (get_local $7) + ) + (f64.const 1) + ) + (f64.sub + (f64.const 1) + (f64.sqrt + (f64.sub + (f64.const 2) + (get_local $7) + ) + ) + ) + ) + ) + (set_local $7 + (if (result f64) + (f64.lt + (tee_local $11 + (f64.mul + (f64.const 2) + (call $~lib/math/JSMath.random) + ) + ) + (f64.const 1) + ) + (f64.sub + (f64.sqrt + (get_local $11) + ) + (f64.const 1) + ) + (f64.sub + (f64.const 1) + (f64.sqrt + (f64.sub + (f64.const 2) + (get_local $11) + ) + ) + ) + ) + ) + (f64.store + (tee_local $6 + (i32.load offset=56 + (get_local $0) + ) + ) + (f64.mul + (f64.load + (tee_local $9 + (i32.load offset=16 + (get_global $assembly/index/context) + ) + ) + ) + (tee_local $10 + (f64.sub + (f64.div + (f64.add + (f64.div + (f64.add + (f64.add + (f64.convert_s/i32 + (get_local $15) + ) + (f64.const 0.5) + ) + (get_local $10) + ) + (f64.const 2) + ) + (f64.convert_s/i32 + (get_local $13) + ) + ) + (f64.convert_s/i32 + (i32.load offset=28 + (get_global $assembly/index/context) + ) + ) + ) + (f64.const 0.5) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $6) + (f64.mul + (f64.load offset=8 + (get_local $9) + ) + (get_local $10) + ) + ) + (f64.store offset=16 + (get_local $6) + (f64.mul + (f64.load offset=16 + (get_local $9) + ) + (get_local $10) + ) + ) + (f64.store + (tee_local $9 + (i32.load offset=60 + (get_local $0) + ) + ) + (f64.mul + (f64.load + (tee_local $17 + (i32.load offset=20 + (get_global $assembly/index/context) + ) + ) + ) + (tee_local $7 + (f64.sub + (f64.div + (f64.add + (f64.div + (f64.add + (f64.add + (f64.convert_s/i32 + (get_local $14) + ) + (f64.const 0.5) + ) + (get_local $7) + ) + (f64.const 2) + ) + (f64.convert_s/i32 + (get_local $12) + ) + ) + (f64.convert_s/i32 + (i32.load offset=32 + (get_global $assembly/index/context) + ) + ) + ) + (f64.const 0.5) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $9) + (f64.mul + (f64.load offset=8 + (get_local $17) + ) + (get_local $7) + ) + ) + (f64.store offset=16 + (get_local $9) + (f64.mul + (f64.load offset=16 + (get_local $17) + ) + (get_local $7) + ) + ) + (drop + (call $assembly/index/Vec#add_in + (get_local $6) + (get_local $9) + ) + ) + (drop + (call $assembly/index/Vec#add_in + (get_local $6) + (i32.load offset=4 + (i32.load offset=12 + (get_global $assembly/index/context) + ) + ) + ) + ) + (f64.store + (tee_local $9 + (i32.load offset=64 + (get_local $0) + ) + ) + (f64.mul + (f64.load + (get_local $6) + ) + (f64.const 140) + ) + ) + (f64.store offset=8 + (get_local $9) + (f64.mul + (f64.load offset=8 + (get_local $6) + ) + (f64.const 140) + ) + ) + (f64.store offset=16 + (get_local $9) + (f64.mul + (f64.load offset=16 + (get_local $6) + ) + (f64.const 140) + ) + ) + (drop + (call $assembly/index/Vec#add_in + (get_local $9) + (i32.load + (i32.load offset=12 + (get_global $assembly/index/context) + ) + ) + ) + ) + (set_local $6 + (call $assembly/index/Vec#norm_in + (get_local $6) + ) + ) + (f64.store + (tee_local $6 + (call $assembly/index/radiance + (call $assembly/index/Ray#set + (i32.load offset=104 + (get_local $0) + ) + (get_local $9) + (get_local $6) + ) + (i32.const 0) + (i32.load offset=72 + (get_local $0) + ) + (get_local $0) + ) + ) + (f64.mul + (f64.load + (get_local $6) + ) + (tee_local $7 + (f64.div + (f64.const 1) + (f64.convert_s/i32 + (get_local $1) + ) + ) + ) + ) + ) + (f64.store offset=8 + (get_local $6) + (f64.mul + (f64.load offset=8 + (get_local $6) + ) + (get_local $7) + ) + ) + (f64.store offset=16 + (get_local $6) + (f64.mul + (f64.load offset=16 + (get_local $6) + ) + (get_local $7) + ) + ) + (drop + (call $assembly/index/Vec#add_in + (i32.load offset=96 + (get_local $0) + ) + (get_local $6) + ) + ) + (set_local $8 + (i32.add + (get_local $8) + (i32.const 1) + ) + ) + (br $repeat|4) + ) + ) + (if + (f64.lt + (tee_local $7 + (f64.load + (i32.load offset=96 + (get_local $0) + ) + ) + ) + (f64.const 0) + ) + (set_local $7 + (f64.const 0) + ) + (if + (f64.gt + (get_local $7) + (f64.const 1) + ) + (set_local $7 + (f64.const 1) + ) + ) + ) + (if + (f64.lt + (tee_local $11 + (f64.load offset=8 + (i32.load offset=96 + (get_local $0) + ) + ) + ) + (f64.const 0) + ) + (set_local $11 + (f64.const 0) + ) + (if + (f64.gt + (get_local $11) + (f64.const 1) + ) + (set_local $11 + (f64.const 1) + ) + ) + ) + (if + (f64.lt + (tee_local $10 + (f64.load offset=16 + (i32.load offset=96 + (get_local $0) + ) + ) + ) + (f64.const 0) + ) + (set_local $10 + (f64.const 0) + ) + (if + (f64.gt + (get_local $10) + (f64.const 1) + ) + (set_local $10 + (f64.const 1) + ) + ) + ) + (f64.store + (tee_local $8 + (i32.load offset=76 + (get_local $0) + ) + ) + (get_local $7) + ) + (f64.store offset=8 + (get_local $8) + (get_local $11) + ) + (f64.store offset=16 + (get_local $8) + (get_local $10) + ) + (f64.store + (get_local $8) + (f64.mul + (f64.load + (get_local $8) + ) + (f64.const 0.55) + ) + ) + (f64.store offset=8 + (get_local $8) + (f64.mul + (f64.load offset=8 + (get_local $8) + ) + (f64.const 0.55) + ) + ) + (f64.store offset=16 + (get_local $8) + (f64.mul + (f64.load offset=16 + (get_local $8) + ) + (f64.const 0.55) + ) + ) + (drop + (call $assembly/index/Vec#add_in + (tee_local $6 + (if (result i32) + (i32.lt_u + (get_local $16) + (i32.shr_u + (i32.load + (tee_local $6 + (i32.load + (i32.load + (get_global $assembly/index/context) + ) + ) + ) + ) + (i32.const 2) + ) + ) + (i32.load offset=8 + (i32.add + (get_local $6) + (i32.shl + (get_local $16) + (i32.const 2) + ) + ) + ) + (unreachable) + ) + ) + (get_local $8) + ) + ) + (set_local $15 + (i32.add + (get_local $15) + (i32.const 1) + ) + ) + (br $repeat|3) + ) + ) + (set_local $14 + (i32.add + (get_local $14) + (i32.const 1) + ) + ) + (br $repeat|2) + ) + ) + (set_local $13 + (i32.add + (get_local $13) + (i32.const 1) + ) + ) + (br $repeat|1) + ) + ) + (set_local $12 + (i32.add + (get_local $12) + (i32.const 1) + ) + ) + (br $repeat|0) + ) + ) + ) + (func $start (; 55 ;) (; has Stack IR ;) (type $v) + (set_global $~lib/allocator/atomic/startOffset + (i32.const 40) + ) + (set_global $~lib/allocator/atomic/offset_ptr + (get_global $~lib/allocator/atomic/startOffset) + ) + (i32.store + (get_global $~lib/allocator/atomic/offset_ptr) + (i32.const 48) + ) + ) + (func $null (; 56 ;) (; has Stack IR ;) (type $v) + (nop) + ) + (func $assembly/index/Vec#constructor|trampoline (; 57 ;) (; has Stack IR ;) (type $iFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32) + (block $3of3 + (block $2of3 + (block $1of3 + (block $0of3 + (block $outOfRange + (br_table $0of3 $1of3 $2of3 $3of3 $outOfRange + (get_global $~argc) + ) + ) + (unreachable) + ) + (set_local $1 + (f64.const 0) + ) + ) + (set_local $2 + (f64.const 0) + ) + ) + (set_local $3 + (f64.const 0) + ) + ) + (call $assembly/index/Vec#constructor + (get_local $0) + (get_local $1) + (get_local $2) + (get_local $3) + ) + ) + (func $~setargc (; 58 ;) (; has Stack IR ;) (type $iv) (param $0 i32) + (set_global $~argc + (get_local $0) + ) + ) + (func $Vec#get:x (; 59 ;) (; has Stack IR ;) (type $iF) (param $0 i32) (result f64) + (f64.load + (get_local $0) + ) + ) + (func $Vec#set:x (; 60 ;) (; has Stack IR ;) (type $iFv) (param $0 i32) (param $1 f64) + (f64.store + (get_local $0) + (get_local $1) + ) + ) + (func $Vec#get:y (; 61 ;) (; has Stack IR ;) (type $iF) (param $0 i32) (result f64) + (f64.load offset=8 + (get_local $0) + ) + ) + (func $Vec#set:y (; 62 ;) (; has Stack IR ;) (type $iFv) (param $0 i32) (param $1 f64) + (f64.store offset=8 + (get_local $0) + (get_local $1) + ) + ) + (func $Vec#get:z (; 63 ;) (; has Stack IR ;) (type $iF) (param $0 i32) (result f64) + (f64.load offset=16 + (get_local $0) + ) + ) + (func $Vec#set:z (; 64 ;) (; has Stack IR ;) (type $iFv) (param $0 i32) (param $1 f64) + (f64.store offset=16 + (get_local $0) + (get_local $1) + ) + ) + (func $assembly/index/Vec#sub|trampoline (; 65 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (block $1of1 + (block $0of1 + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange + (i32.sub + (get_global $~argc) + (i32.const 1) + ) + ) + ) + (unreachable) + ) + (set_local $2 + (i32.const 0) + ) + ) + (call $assembly/index/Vec#sub + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $assembly/index/Vec#clone|trampoline (; 66 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (block $1of1 + (block $0of1 + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange + (get_global $~argc) + ) + ) + (unreachable) + ) + (set_local $1 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + ) + (f64.store + (get_local $1) + (f64.load + (get_local $0) + ) + ) + (f64.store offset=8 + (get_local $1) + (f64.load offset=8 + (get_local $0) + ) + ) + (f64.store offset=16 + (get_local $1) + (f64.load offset=16 + (get_local $0) + ) + ) + (get_local $1) + ) +) diff --git a/examples/smallpt/build/untouched.wat b/examples/smallpt/build/untouched.wat new file mode 100644 index 0000000000..506442c826 --- /dev/null +++ b/examples/smallpt/build/untouched.wat @@ -0,0 +1,8841 @@ +(module + (type $i (func (result i32))) + (type $iv (func (param i32))) + (type $iii (func (param i32 i32) (result i32))) + (type $iFFFi (func (param i32 f64 f64 f64) (result i32))) + (type $ii (func (param i32) (result i32))) + (type $iiii (func (param i32 i32 i32) (result i32))) + (type $iFi (func (param i32 f64) (result i32))) + (type $iFii (func (param i32 f64 i32) (result i32))) + (type $iF (func (param i32) (result f64))) + (type $iiF (func (param i32 i32) (result f64))) + (type $iFiiiii (func (param i32 f64 i32 i32 i32 i32) (result i32))) + (type $iiiiv (func (param i32 i32 i32 i32))) + (type $iiiv (func (param i32 i32 i32))) + (type $iiFii (func (param i32 i32 f64 i32) (result i32))) + (type $iiiiiiv (func (param i32 i32 i32 i32 i32 i32))) + (type $F (func (result f64))) + (type $iiiii (func (param i32 i32 i32 i32) (result i32))) + (type $iiiF (func (param i32 i32 i32) (result f64))) + (type $iiv (func (param i32 i32))) + (type $FF (func (param f64) (result f64))) + (type $v (func)) + (type $iFv (func (param i32 f64))) + (import "env" "memory" (memory $0 (shared 32767 32767))) + (data (i32.const 8) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00") + (data (i32.const 40) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") + (table 1 1 anyfunc) + (elem (i32.const 0) $null) + (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) + (import "JSMath" "random" (func $~lib/math/JSMath.random (result f64))) + (import "JSMath" "cos" (func $~lib/math/JSMath.cos (param f64) (result f64))) + (import "JSMath" "sin" (func $~lib/math/JSMath.sin (param f64) (result f64))) + (global $~lib/internal/allocator/AL_BITS i32 (i32.const 3)) + (global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8)) + (global $~lib/internal/allocator/AL_MASK i32 (i32.const 7)) + (global $~lib/internal/allocator/MAX_SIZE_32 i32 (i32.const 1073741824)) + (global $~lib/allocator/atomic/startOffset (mut i32) (i32.const 0)) + (global $~lib/allocator/atomic/offset_ptr (mut i32) (i32.const 0)) + (global $assembly/index/context (mut i32) (i32.const 0)) + (global $assembly/index/Refl_t.DIFF (mut i32) (i32.const 0)) + (global $assembly/index/Refl_t.SPEC (mut i32) (i32.const 1)) + (global $assembly/index/Refl_t.REFR (mut i32) (i32.const 2)) + (global $~lib/internal/arraybuffer/HEADER_SIZE i32 (i32.const 8)) + (global $~lib/internal/arraybuffer/MAX_BLENGTH i32 (i32.const 1073741816)) + (global $~argc (mut i32) (i32.const 0)) + (global $Infinity f64 (f64.const inf)) + (global $~lib/math/NativeMath.PI f64 (f64.const 3.141592653589793)) + (global $HEAP_BASE i32 (i32.const 100)) + (export "memory" (memory $0)) + (export "GET_MEMORY_TOP" (func $assembly/index/GET_MEMORY_TOP)) + (export "SET_MEMORY_TOP" (func $assembly/index/SET_MEMORY_TOP)) + (export "_setargc" (func $~setargc)) + (export "Vec#constructor" (func $assembly/index/Vec#constructor|trampoline)) + (export "Vec#get:x" (func $Vec#get:x)) + (export "Vec#set:x" (func $Vec#set:x)) + (export "Vec#get:y" (func $Vec#get:y)) + (export "Vec#set:y" (func $Vec#set:y)) + (export "Vec#get:z" (func $Vec#get:z)) + (export "Vec#set:z" (func $Vec#set:z)) + (export "Vec#free" (func $assembly/index/Vec#free)) + (export "Vec#add" (func $assembly/index/Vec#add)) + (export "Vec#add_in" (func $assembly/index/Vec#add_in)) + (export "Vec#add2" (func $assembly/index/Vec#add2)) + (export "Vec#set" (func $assembly/index/Vec#set)) + (export "Vec#setFrom" (func $assembly/index/Vec#setFrom)) + (export "Vec#sub" (func $assembly/index/Vec#sub|trampoline)) + (export "Vec#sub2" (func $assembly/index/Vec#sub2)) + (export "Vec#sub_in" (func $assembly/index/Vec#sub_in)) + (export "Vec#mul" (func $assembly/index/Vec#mul)) + (export "Vec#mul_in" (func $assembly/index/Vec#mul_in)) + (export "Vec#multScalar" (func $assembly/index/Vec#multScalar)) + (export "Vec#multScalar2" (func $assembly/index/Vec#multScalar2)) + (export "Vec#multScalar_in" (func $assembly/index/Vec#multScalar_in)) + (export "Vec#mod" (func $assembly/index/Vec#mod)) + (export "Vec#mod_in" (func $assembly/index/Vec#mod_in)) + (export "Vec#mod2" (func $assembly/index/Vec#mod2)) + (export "Vec#length" (func $assembly/index/Vec#length)) + (export "Vec#norm" (func $assembly/index/Vec#norm)) + (export "Vec#norm_in" (func $assembly/index/Vec#norm_in)) + (export "Vec#dot" (func $assembly/index/Vec#dot)) + (export "Vec#clone" (func $assembly/index/Vec#clone|trampoline)) + (export "getPixels" (func $assembly/index/getPixels)) + (export "setPixels" (func $assembly/index/setPixels)) + (export "setContext" (func $assembly/index/setContext)) + (export "getContext" (func $assembly/index/getContext)) + (export "createContext" (func $assembly/index/createContext)) + (export "createLocals" (func $assembly/index/createLocals)) + (export "render" (func $assembly/index/render)) + (start $start) + (func $~lib/allocator/atomic/allocator_get_offset (; 4 ;) (type $i) (result i32) + ;;@ ~lib/allocator/atomic.ts:8:38 + (i32.atomic.load + ;;@ ~lib/allocator/atomic.ts:8:28 + (get_global $~lib/allocator/atomic/offset_ptr) + ) + ) + (func $assembly/index/GET_MEMORY_TOP (; 5 ;) (type $i) (result i32) + ;;@ assembly/index.ts:15:32 + (call $~lib/allocator/atomic/allocator_get_offset) + ) + (func $~lib/allocator/atomic/allocator_set_offset (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + ;;@ ~lib/allocator/atomic.ts:12:65 + (i32.atomic.rmw.cmpxchg + ;;@ ~lib/allocator/atomic.ts:12:31 + (get_global $~lib/allocator/atomic/offset_ptr) + ;;@ ~lib/allocator/atomic.ts:12:43 + (get_local $0) + ;;@ ~lib/allocator/atomic.ts:12:55 + (get_local $1) + ) + ) + (func $assembly/index/SET_MEMORY_TOP (; 7 ;) (type $iv) (param $0 i32) + ;;@ assembly/index.ts:19:4 + (drop + (call $~lib/allocator/atomic/allocator_set_offset + ;;@ assembly/index.ts:19:25 + (call $assembly/index/GET_MEMORY_TOP) + ;;@ assembly/index.ts:19:43 + (get_local $0) + ) + ) + ) + (func $~lib/allocator/atomic/__memory_allocate (; 8 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + ;;@ ~lib/allocator/atomic.ts:16:2 + (if + ;;@ ~lib/allocator/atomic.ts:16:6 + (get_local $0) + ;;@ ~lib/allocator/atomic.ts:16:12 + (block + ;;@ ~lib/allocator/atomic.ts:17:4 + (if + ;;@ ~lib/allocator/atomic.ts:17:8 + (i32.gt_u + (get_local $0) + ;;@ ~lib/allocator/atomic.ts:17:15 + (get_global $~lib/internal/allocator/MAX_SIZE_32) + ) + ;;@ ~lib/allocator/atomic.ts:17:28 + (unreachable) + ) + ;;@ ~lib/allocator/atomic.ts:20:4 + (block $break|0 + (loop $continue|0 + ;;@ ~lib/allocator/atomic.ts:20:7 + (block + ;;@ ~lib/allocator/atomic.ts:21:6 + (set_local $1 + ;;@ ~lib/allocator/atomic.ts:21:22 + (call $~lib/allocator/atomic/allocator_get_offset) + ) + ;;@ ~lib/allocator/atomic.ts:22:6 + (set_local $2 + ;;@ ~lib/allocator/atomic.ts:22:12 + (i32.and + (i32.add + ;;@ ~lib/allocator/atomic.ts:22:13 + (i32.add + (get_local $1) + ;;@ ~lib/allocator/atomic.ts:22:29 + (get_local $0) + ) + ;;@ ~lib/allocator/atomic.ts:22:36 + (get_global $~lib/internal/allocator/AL_MASK) + ) + ;;@ ~lib/allocator/atomic.ts:22:47 + (i32.xor + ;;@ ~lib/allocator/atomic.ts:22:48 + (get_global $~lib/internal/allocator/AL_MASK) + (i32.const -1) + ) + ) + ) + ;;@ ~lib/allocator/atomic.ts:23:6 + (set_local $3 + ;;@ ~lib/allocator/atomic.ts:23:31 + (current_memory) + ) + ;;@ ~lib/allocator/atomic.ts:24:6 + (if + ;;@ ~lib/allocator/atomic.ts:24:10 + (i32.gt_u + (get_local $2) + ;;@ ~lib/allocator/atomic.ts:24:16 + (i32.shl + (get_local $3) + ;;@ ~lib/allocator/atomic.ts:24:40 + (i32.const 16) + ) + ) + ;;@ ~lib/allocator/atomic.ts:24:44 + (block + ;;@ ~lib/allocator/atomic.ts:25:8 + (set_local $4 + ;;@ ~lib/allocator/atomic.ts:25:26 + (i32.shr_u + (i32.and + ;;@ ~lib/allocator/atomic.ts:25:27 + (i32.add + ;;@ ~lib/allocator/atomic.ts:25:28 + (i32.sub + (get_local $2) + ;;@ ~lib/allocator/atomic.ts:25:34 + (get_local $1) + ) + ;;@ ~lib/allocator/atomic.ts:25:50 + (i32.const 65535) + ) + ;;@ ~lib/allocator/atomic.ts:25:60 + (i32.xor + ;;@ ~lib/allocator/atomic.ts:25:61 + (i32.const 65535) + (i32.const -1) + ) + ) + ;;@ ~lib/allocator/atomic.ts:25:73 + (i32.const 16) + ) + ) + ;;@ ~lib/allocator/atomic.ts:26:8 + (set_local $5 + ;;@ ~lib/allocator/atomic.ts:26:26 + (select + (tee_local $5 + ;;@ ~lib/allocator/atomic.ts:26:30 + (get_local $3) + ) + (tee_local $6 + ;;@ ~lib/allocator/atomic.ts:26:43 + (get_local $4) + ) + (i32.gt_s + (get_local $5) + (get_local $6) + ) + ) + ) + ;;@ ~lib/allocator/atomic.ts:27:8 + (if + ;;@ ~lib/allocator/atomic.ts:27:12 + (i32.lt_s + ;;@ ~lib/allocator/atomic.ts:27:19 + (grow_memory + ;;@ ~lib/allocator/atomic.ts:27:24 + (get_local $5) + ) + ;;@ ~lib/allocator/atomic.ts:27:39 + (i32.const 0) + ) + ;;@ ~lib/allocator/atomic.ts:27:42 + (if + ;;@ ~lib/allocator/atomic.ts:28:14 + (i32.lt_s + ;;@ ~lib/allocator/atomic.ts:28:21 + (grow_memory + ;;@ ~lib/allocator/atomic.ts:28:26 + (get_local $4) + ) + ;;@ ~lib/allocator/atomic.ts:28:41 + (i32.const 0) + ) + ;;@ ~lib/allocator/atomic.ts:28:44 + (unreachable) + ) + ) + ) + ) + ) + (br_if $continue|0 + ;;@ ~lib/allocator/atomic.ts:34:6 + (i32.ne + ;;@ ~lib/allocator/atomic.ts:34:13 + (i32.atomic.rmw.cmpxchg + ;;@ ~lib/allocator/atomic.ts:34:28 + (get_global $~lib/allocator/atomic/offset_ptr) + ;;@ ~lib/allocator/atomic.ts:34:40 + (get_local $1) + ;;@ ~lib/allocator/atomic.ts:34:55 + (get_local $2) + ) + ;;@ ~lib/allocator/atomic.ts:34:63 + (get_local $1) + ) + ) + ) + ) + ;;@ ~lib/allocator/atomic.ts:37:11 + (return + (get_local $1) + ) + ) + ) + ;;@ ~lib/allocator/atomic.ts:39:9 + (i32.const 0) + ) + (func $~lib/memory/memory.allocate (; 9 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:41:4 + (return + ;;@ ~lib/memory.ts:41:45 + (call $~lib/allocator/atomic/__memory_allocate + ;;@ ~lib/memory.ts:41:63 + (get_local $0) + ) + ) + ) + (func $assembly/index/Vec#constructor (; 10 ;) (type $iFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32) + (local $4 i32) + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $4 + (call $~lib/memory/memory.allocate + (i32.const 24) + ) + ) + (f64.store + (get_local $4) + (get_local $1) + ) + (f64.store offset=8 + (get_local $4) + (get_local $2) + ) + (f64.store offset=16 + (get_local $4) + (get_local $3) + ) + (get_local $4) + ) + ) + ) + ) + ) + (func $~lib/allocator/atomic/__memory_free (; 11 ;) (type $iv) (param $0 i32) + (nop) + ) + (func $assembly/index/Vec#free (; 12 ;) (type $iv) (param $0 i32) + ;;@ assembly/index.ts:32:8 + (call $~lib/allocator/atomic/__memory_free + ;;@ assembly/index.ts:32:22 + (get_local $0) + ) + ) + (func $assembly/index/Vec#add (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + ;;@ assembly/index.ts:37:63 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:37:23 + (f64.add + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:37:32 + (f64.load + (get_local $1) + ) + ) + ;;@ assembly/index.ts:37:37 + (f64.add + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:37:46 + (f64.load offset=8 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:37:51 + (f64.add + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:37:60 + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ) + (func $assembly/index/Vec#add_in (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + ;;@ assembly/index.ts:40:8 + (f64.store + (get_local $0) + ;;@ assembly/index.ts:40:17 + (f64.add + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:40:26 + (f64.load + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:41:8 + (f64.store offset=8 + (get_local $0) + ;;@ assembly/index.ts:41:17 + (f64.add + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:41:26 + (f64.load offset=8 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:42:8 + (f64.store offset=16 + (get_local $0) + ;;@ assembly/index.ts:42:17 + (f64.add + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:42:26 + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:43:15 + (get_local $0) + ) + (func $assembly/index/Vec#add2 (; 15 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + ;;@ assembly/index.ts:46:8 + (f64.store + (get_local $2) + ;;@ assembly/index.ts:46:14 + (f64.add + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:46:23 + (f64.load + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:47:8 + (f64.store offset=8 + (get_local $2) + ;;@ assembly/index.ts:47:14 + (f64.add + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:47:23 + (f64.load offset=8 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:48:8 + (f64.store offset=16 + (get_local $2) + ;;@ assembly/index.ts:48:14 + (f64.add + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:48:23 + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:49:15 + (get_local $2) + ) + (func $assembly/index/Vec#set (; 16 ;) (type $iFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32) + ;;@ assembly/index.ts:52:8 + (f64.store + (get_local $0) + ;;@ assembly/index.ts:52:17 + (get_local $1) + ) + ;;@ assembly/index.ts:53:8 + (f64.store offset=8 + (get_local $0) + ;;@ assembly/index.ts:53:17 + (get_local $2) + ) + ;;@ assembly/index.ts:54:8 + (f64.store offset=16 + (get_local $0) + ;;@ assembly/index.ts:54:17 + (get_local $3) + ) + ;;@ assembly/index.ts:55:15 + (get_local $0) + ) + (func $assembly/index/Vec#setFrom (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + ;;@ assembly/index.ts:58:8 + (f64.store + (get_local $0) + ;;@ assembly/index.ts:58:17 + (f64.load + (get_local $1) + ) + ) + ;;@ assembly/index.ts:59:8 + (f64.store offset=8 + (get_local $0) + ;;@ assembly/index.ts:59:17 + (f64.load offset=8 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:60:8 + (f64.store offset=16 + (get_local $0) + ;;@ assembly/index.ts:60:17 + (f64.load offset=16 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:61:15 + (get_local $0) + ) + (func $assembly/index/Vec#sub (; 18 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + ;;@ assembly/index.ts:65:8 + (if + (i32.and + ;;@ assembly/index.ts:65:12 + (get_local $2) + (i32.const 1) + ) + ;;@ assembly/index.ts:65:21 + (block + ;;@ assembly/index.ts:66:12 + (f64.store + (get_local $1) + ;;@ assembly/index.ts:66:18 + (f64.sub + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:66:27 + (f64.load + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:67:12 + (f64.store offset=8 + (get_local $1) + ;;@ assembly/index.ts:67:18 + (f64.sub + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:67:27 + (f64.load offset=8 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:68:12 + (f64.store offset=16 + (get_local $1) + ;;@ assembly/index.ts:68:18 + (f64.sub + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:68:27 + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:69:19 + (return + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:71:63 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:71:23 + (f64.sub + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:71:32 + (f64.load + (get_local $1) + ) + ) + ;;@ assembly/index.ts:71:37 + (f64.sub + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:71:46 + (f64.load offset=8 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:71:51 + (f64.sub + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:71:60 + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ) + (func $assembly/index/Vec#sub2 (; 19 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + ;;@ assembly/index.ts:74:8 + (f64.store + (get_local $2) + ;;@ assembly/index.ts:74:14 + (f64.sub + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:74:23 + (f64.load + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:75:8 + (f64.store offset=8 + (get_local $2) + ;;@ assembly/index.ts:75:14 + (f64.sub + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:75:23 + (f64.load offset=8 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:76:8 + (f64.store offset=16 + (get_local $2) + ;;@ assembly/index.ts:76:14 + (f64.sub + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:76:23 + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:77:15 + (get_local $2) + ) + (func $assembly/index/Vec#sub_in (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + ;;@ assembly/index.ts:80:8 + (f64.store + (get_local $0) + ;;@ assembly/index.ts:80:17 + (f64.sub + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:80:26 + (f64.load + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:81:8 + (f64.store offset=8 + (get_local $0) + ;;@ assembly/index.ts:81:17 + (f64.sub + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:81:26 + (f64.load offset=8 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:82:8 + (f64.store offset=16 + (get_local $0) + ;;@ assembly/index.ts:82:17 + (f64.sub + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:82:26 + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:83:15 + (get_local $0) + ) + (func $assembly/index/Vec#mul (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + ;;@ assembly/index.ts:88:63 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:88:23 + (f64.mul + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:88:32 + (f64.load + (get_local $1) + ) + ) + ;;@ assembly/index.ts:88:37 + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:88:46 + (f64.load offset=8 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:88:51 + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:88:60 + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ) + (func $assembly/index/Vec#mul_in (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + ;;@ assembly/index.ts:91:8 + (f64.store + (get_local $0) + ;;@ assembly/index.ts:91:17 + (f64.mul + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:91:26 + (f64.load + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:92:8 + (f64.store offset=8 + (get_local $0) + ;;@ assembly/index.ts:92:17 + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:92:26 + (f64.load offset=8 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:93:8 + (f64.store offset=16 + (get_local $0) + ;;@ assembly/index.ts:93:17 + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:93:26 + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:94:15 + (get_local $0) + ) + (func $assembly/index/Vec#multScalar (; 23 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + ;;@ assembly/index.ts:98:57 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:98:23 + (f64.mul + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:98:32 + (get_local $1) + ) + ;;@ assembly/index.ts:98:35 + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:98:44 + (get_local $1) + ) + ;;@ assembly/index.ts:98:47 + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:98:56 + (get_local $1) + ) + ) + ) + (func $assembly/index/Vec#multScalar2 (; 24 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) + ;;@ assembly/index.ts:101:8 + (f64.store + (get_local $2) + ;;@ assembly/index.ts:101:14 + (f64.mul + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:101:23 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:102:8 + (f64.store offset=8 + (get_local $2) + ;;@ assembly/index.ts:102:14 + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:102:23 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:103:8 + (f64.store offset=16 + (get_local $2) + ;;@ assembly/index.ts:103:14 + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:103:23 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:104:15 + (get_local $2) + ) + (func $assembly/index/Vec#multScalar_in (; 25 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + ;;@ assembly/index.ts:107:8 + (f64.store + (get_local $0) + ;;@ assembly/index.ts:107:17 + (f64.mul + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:107:26 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:108:8 + (f64.store offset=8 + (get_local $0) + ;;@ assembly/index.ts:108:17 + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:108:26 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:109:8 + (f64.store offset=16 + (get_local $0) + ;;@ assembly/index.ts:109:17 + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:109:26 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:110:15 + (get_local $0) + ) + (func $assembly/index/Vec#mod (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + ;;@ assembly/index.ts:114:108 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:114:23 + (f64.sub + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:114:32 + (f64.load offset=16 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:114:38 + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:114:47 + (f64.load offset=8 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:114:52 + (f64.sub + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:114:61 + (f64.load + (get_local $1) + ) + ) + ;;@ assembly/index.ts:114:67 + (f64.mul + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:114:76 + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:114:81 + (f64.sub + (f64.mul + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:114:90 + (f64.load offset=8 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:114:96 + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:114:105 + (f64.load + (get_local $1) + ) + ) + ) + ) + ) + (func $assembly/index/Vec#mod_in (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + ;;@ assembly/index.ts:117:8 + (f64.store + (get_local $0) + ;;@ assembly/index.ts:117:17 + (f64.sub + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:117:26 + (f64.load offset=16 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:117:32 + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:117:41 + (f64.load offset=8 + (get_local $1) + ) + ) + ) + ) + ;;@ assembly/index.ts:118:8 + (f64.store offset=8 + (get_local $0) + ;;@ assembly/index.ts:118:17 + (f64.sub + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:118:26 + (f64.load + (get_local $1) + ) + ) + ;;@ assembly/index.ts:118:32 + (f64.mul + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:118:41 + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ) + ;;@ assembly/index.ts:119:8 + (f64.store offset=16 + (get_local $0) + ;;@ assembly/index.ts:119:17 + (f64.sub + (f64.mul + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:119:26 + (f64.load offset=8 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:119:32 + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:119:41 + (f64.load + (get_local $1) + ) + ) + ) + ) + ;;@ assembly/index.ts:120:15 + (get_local $0) + ) + (func $assembly/index/Vec#mod2 (; 28 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + ;;@ assembly/index.ts:123:8 + (f64.store + (get_local $2) + ;;@ assembly/index.ts:123:14 + (f64.sub + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:123:23 + (f64.load offset=16 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:123:29 + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:123:38 + (f64.load offset=8 + (get_local $1) + ) + ) + ) + ) + ;;@ assembly/index.ts:124:8 + (f64.store offset=8 + (get_local $2) + ;;@ assembly/index.ts:124:14 + (f64.sub + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:124:23 + (f64.load + (get_local $1) + ) + ) + ;;@ assembly/index.ts:124:29 + (f64.mul + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:124:38 + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ) + ;;@ assembly/index.ts:125:8 + (f64.store offset=16 + (get_local $2) + ;;@ assembly/index.ts:125:14 + (f64.sub + (f64.mul + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:125:23 + (f64.load offset=8 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:125:29 + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:125:38 + (f64.load + (get_local $1) + ) + ) + ) + ) + ;;@ assembly/index.ts:126:15 + (get_local $2) + ) + (func $assembly/index/Vec#length (; 29 ;) (type $iF) (param $0 i32) (result f64) + ;;@ assembly/index.ts:130:78 + (f64.sqrt + ;;@ assembly/index.ts:130:27 + (f64.add + (f64.add + (f64.mul + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:130:36 + (f64.load + (get_local $0) + ) + ) + ;;@ assembly/index.ts:130:45 + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:130:54 + (f64.load offset=8 + (get_local $0) + ) + ) + ) + ;;@ assembly/index.ts:130:63 + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:130:72 + (f64.load offset=16 + (get_local $0) + ) + ) + ) + ) + ) + (func $assembly/index/Vec#norm (; 30 ;) (type $ii) (param $0 i32) (result i32) + (local $1 f64) + ;;@ assembly/index.ts:134:8 + (set_local $1 + ;;@ assembly/index.ts:134:21 + (call $assembly/index/Vec#length + ;;@ assembly/index.ts:134:16 + (get_local $0) + ) + ) + ;;@ assembly/index.ts:135:57 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:135:23 + (f64.div + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:135:32 + (get_local $1) + ) + ;;@ assembly/index.ts:135:35 + (f64.div + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:135:44 + (get_local $1) + ) + ;;@ assembly/index.ts:135:47 + (f64.div + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:135:56 + (get_local $1) + ) + ) + ) + (func $assembly/index/Vec#norm_in (; 31 ;) (type $ii) (param $0 i32) (result i32) + (local $1 f64) + ;;@ assembly/index.ts:139:8 + (set_local $1 + ;;@ assembly/index.ts:139:21 + (call $assembly/index/Vec#length + ;;@ assembly/index.ts:139:16 + (get_local $0) + ) + ) + ;;@ assembly/index.ts:140:8 + (f64.store + (get_local $0) + ;;@ assembly/index.ts:140:17 + (f64.div + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:140:26 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:141:8 + (f64.store offset=8 + (get_local $0) + ;;@ assembly/index.ts:141:17 + (f64.div + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:141:26 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:142:8 + (f64.store offset=16 + (get_local $0) + ;;@ assembly/index.ts:142:17 + (f64.div + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:142:26 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:143:15 + (get_local $0) + ) + (func $assembly/index/Vec#dot (; 32 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + ;;@ assembly/index.ts:147:56 + (f64.add + ;;@ assembly/index.ts:147:15 + (f64.add + (f64.mul + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:147:24 + (f64.load + (get_local $1) + ) + ) + ;;@ assembly/index.ts:147:30 + (f64.mul + (f64.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:147:39 + (f64.load offset=8 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:147:45 + (f64.mul + (f64.load offset=16 + (get_local $0) + ) + ;;@ assembly/index.ts:147:54 + (f64.load offset=16 + (get_local $1) + ) + ) + ) + ) + (func $assembly/index/Vec#clone (; 33 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + ;;@ assembly/index.ts:151:8 + (f64.store + (get_local $1) + ;;@ assembly/index.ts:151:14 + (f64.load + (get_local $0) + ) + ) + ;;@ assembly/index.ts:152:8 + (f64.store offset=8 + (get_local $1) + ;;@ assembly/index.ts:152:14 + (f64.load offset=8 + (get_local $0) + ) + ) + ;;@ assembly/index.ts:153:8 + (f64.store offset=16 + (get_local $1) + ;;@ assembly/index.ts:153:14 + (f64.load offset=16 + (get_local $0) + ) + ) + ;;@ assembly/index.ts:154:15 + (get_local $1) + ) + (func $assembly/index/getPixels (; 34 ;) (type $i) (result i32) + ;;@ assembly/index.ts:292:19 + (i32.load + ;;@ assembly/index.ts:292:11 + (get_global $assembly/index/context) + ) + ) + (func $assembly/index/setPixels (; 35 ;) (type $iv) (param $0 i32) + ;;@ assembly/index.ts:296:4 + (i32.store + (get_global $assembly/index/context) + ;;@ assembly/index.ts:296:21 + (get_local $0) + ) + ) + (func $assembly/index/setContext (; 36 ;) (type $iv) (param $0 i32) + ;;@ assembly/index.ts:300:4 + (set_global $assembly/index/context + ;;@ assembly/index.ts:300:14 + (get_local $0) + ) + ) + (func $assembly/index/getContext (; 37 ;) (type $i) (result i32) + ;;@ assembly/index.ts:304:11 + (get_global $assembly/index/context) + ) + (func $assembly/index/Context#constructor (; 38 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $3 + (call $~lib/memory/memory.allocate + (i32.const 36) + ) + ) + (i32.store + (get_local $3) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $3) + (i32.const 0) + ) + (i32.store offset=8 + (get_local $3) + (i32.const 0) + ) + (i32.store offset=12 + (get_local $3) + (i32.const 0) + ) + (i32.store offset=16 + (get_local $3) + (i32.const 0) + ) + (i32.store offset=20 + (get_local $3) + (i32.const 0) + ) + (i32.store offset=24 + (get_local $3) + (i32.const 0) + ) + (i32.store offset=28 + (get_local $3) + (get_local $1) + ) + (i32.store offset=32 + (get_local $3) + (get_local $2) + ) + (get_local $3) + ) + ) + ) + ) + ) + (func $assembly/index/Sphere#constructor (; 39 ;) (type $iFiiiii) (param $0 i32) (param $1 f64) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) (result i32) + (local $6 i32) + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $6 + (call $~lib/memory/memory.allocate + (i32.const 24) + ) + ) + (f64.store + (get_local $6) + (get_local $1) + ) + (i32.store offset=8 + (get_local $6) + (get_local $2) + ) + (i32.store offset=12 + (get_local $6) + (get_local $3) + ) + (i32.store offset=16 + (get_local $6) + (get_local $4) + ) + (i32.store offset=20 + (get_local $6) + (get_local $5) + ) + (get_local $6) + ) + ) + ) + ) + ) + (func $~lib/internal/arraybuffer/computeSize (; 40 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/internal/arraybuffer.ts:15:77 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:15:9 + (i32.const 1) + ;;@ ~lib/internal/arraybuffer.ts:15:21 + (i32.sub + ;;@ ~lib/internal/arraybuffer.ts:15:29 + (i32.const 32) + ;;@ ~lib/internal/arraybuffer.ts:15:39 + (i32.clz + ;;@ ~lib/internal/arraybuffer.ts:15:48 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/arraybuffer.ts:15:61 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ;;@ ~lib/internal/arraybuffer.ts:15:75 + (i32.const 1) + ) + ) + ) + ) + ) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 41 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + ;;@ ~lib/internal/arraybuffer.ts:23:2 + (if + (i32.eqz + ;;@ ~lib/internal/arraybuffer.ts:23:9 + (i32.le_u + (get_local $0) + ;;@ ~lib/internal/arraybuffer.ts:23:28 + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 40) + (i32.const 23) + (i32.const 2) + ) + (unreachable) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:25:2 + (set_local $1 + ;;@ ~lib/internal/arraybuffer.ts:28:20 + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $2 + ;;@ ~lib/internal/arraybuffer.ts:28:29 + (call $~lib/internal/arraybuffer/computeSize + ;;@ ~lib/internal/arraybuffer.ts:28:41 + (get_local $0) + ) + ) + ;;@ ~lib/memory.ts:41:4 + (br $~lib/memory/memory.allocate|inlined.0 + ;;@ ~lib/memory.ts:41:45 + (call $~lib/allocator/atomic/__memory_allocate + ;;@ ~lib/memory.ts:41:63 + (get_local $2) + ) + ) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:30:2 + (i32.store + ;;@ ~lib/internal/arraybuffer.ts:30:13 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:30:21 + (get_local $0) + ) + ;;@ ~lib/internal/arraybuffer.ts:31:39 + (get_local $1) + ) + (func $~lib/internal/memory/memset (; 42 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i64) + ;;@ ~lib/internal/memory.ts:191:2 + (if + ;;@ ~lib/internal/memory.ts:191:6 + (i32.eqz + ;;@ ~lib/internal/memory.ts:191:7 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:191:10 + (return) + ) + ;;@ ~lib/internal/memory.ts:192:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:192:12 + (get_local $0) + ;;@ ~lib/internal/memory.ts:192:18 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:193:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:193:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:193:19 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:193:23 + (i32.const 1) + ) + ;;@ ~lib/internal/memory.ts:193:26 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:194:2 + (if + ;;@ ~lib/internal/memory.ts:194:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:194:11 + (i32.const 2) + ) + ;;@ ~lib/internal/memory.ts:194:14 + (return) + ) + ;;@ ~lib/internal/memory.ts:196:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:196:12 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:196:19 + (i32.const 1) + ) + ;;@ ~lib/internal/memory.ts:196:22 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:197:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:197:12 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:197:19 + (i32.const 2) + ) + ;;@ ~lib/internal/memory.ts:197:22 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:198:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:198:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:198:19 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:198:23 + (i32.const 2) + ) + ;;@ ~lib/internal/memory.ts:198:26 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:199:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:199:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:199:19 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:199:23 + (i32.const 3) + ) + ;;@ ~lib/internal/memory.ts:199:26 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:200:2 + (if + ;;@ ~lib/internal/memory.ts:200:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:200:11 + (i32.const 6) + ) + ;;@ ~lib/internal/memory.ts:200:14 + (return) + ) + ;;@ ~lib/internal/memory.ts:201:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:201:12 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:201:19 + (i32.const 3) + ) + ;;@ ~lib/internal/memory.ts:201:22 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:202:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:202:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:202:19 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:202:23 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:202:26 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:203:2 + (if + ;;@ ~lib/internal/memory.ts:203:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:203:11 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:203:14 + (return) + ) + ;;@ ~lib/internal/memory.ts:206:2 + (set_local $3 + ;;@ ~lib/internal/memory.ts:206:17 + (i32.and + (i32.sub + (i32.const 0) + ;;@ ~lib/internal/memory.ts:206:18 + (get_local $0) + ) + ;;@ ~lib/internal/memory.ts:206:25 + (i32.const 3) + ) + ) + ;;@ ~lib/internal/memory.ts:207:2 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:207:10 + (get_local $3) + ) + ) + ;;@ ~lib/internal/memory.ts:208:2 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:208:7 + (get_local $3) + ) + ) + ;;@ ~lib/internal/memory.ts:209:2 + (set_local $2 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:209:7 + (i32.const -4) + ) + ) + ;;@ ~lib/internal/memory.ts:211:2 + (set_local $4 + ;;@ ~lib/internal/memory.ts:211:17 + (i32.mul + (i32.div_u + (i32.const -1) + ;;@ ~lib/internal/memory.ts:211:27 + (i32.const 255) + ) + (i32.and + ;;@ ~lib/internal/memory.ts:211:33 + (get_local $1) + (i32.const 255) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:214:2 + (i32.store + ;;@ ~lib/internal/memory.ts:214:13 + (get_local $0) + ;;@ ~lib/internal/memory.ts:214:19 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:215:2 + (i32.store + ;;@ ~lib/internal/memory.ts:215:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:215:20 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:215:24 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:215:27 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:216:2 + (if + ;;@ ~lib/internal/memory.ts:216:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:216:11 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:216:14 + (return) + ) + ;;@ ~lib/internal/memory.ts:217:2 + (i32.store + ;;@ ~lib/internal/memory.ts:217:13 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:217:20 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:217:23 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:218:2 + (i32.store + ;;@ ~lib/internal/memory.ts:218:13 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:218:20 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:218:23 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:219:2 + (i32.store + ;;@ ~lib/internal/memory.ts:219:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:219:20 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:219:24 + (i32.const 12) + ) + ;;@ ~lib/internal/memory.ts:219:28 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:220:2 + (i32.store + ;;@ ~lib/internal/memory.ts:220:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:220:20 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:220:24 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:220:27 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:221:2 + (if + ;;@ ~lib/internal/memory.ts:221:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:221:11 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:221:15 + (return) + ) + ;;@ ~lib/internal/memory.ts:222:2 + (i32.store + ;;@ ~lib/internal/memory.ts:222:13 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:222:20 + (i32.const 12) + ) + ;;@ ~lib/internal/memory.ts:222:24 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:223:2 + (i32.store + ;;@ ~lib/internal/memory.ts:223:13 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:223:20 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:223:24 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:224:2 + (i32.store + ;;@ ~lib/internal/memory.ts:224:13 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:224:20 + (i32.const 20) + ) + ;;@ ~lib/internal/memory.ts:224:24 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:225:2 + (i32.store + ;;@ ~lib/internal/memory.ts:225:13 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:225:20 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:225:24 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:226:2 + (i32.store + ;;@ ~lib/internal/memory.ts:226:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:226:20 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:226:24 + (i32.const 28) + ) + ;;@ ~lib/internal/memory.ts:226:28 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:227:2 + (i32.store + ;;@ ~lib/internal/memory.ts:227:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:227:20 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:227:24 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:227:28 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:228:2 + (i32.store + ;;@ ~lib/internal/memory.ts:228:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:228:20 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:228:24 + (i32.const 20) + ) + ;;@ ~lib/internal/memory.ts:228:28 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:229:2 + (i32.store + ;;@ ~lib/internal/memory.ts:229:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:229:20 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:229:24 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:229:28 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:232:2 + (set_local $3 + ;;@ ~lib/internal/memory.ts:232:6 + (i32.add + (i32.const 24) + ;;@ ~lib/internal/memory.ts:232:11 + (i32.and + ;;@ ~lib/internal/memory.ts:232:12 + (get_local $0) + ;;@ ~lib/internal/memory.ts:232:19 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:233:2 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:233:10 + (get_local $3) + ) + ) + ;;@ ~lib/internal/memory.ts:234:2 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:234:7 + (get_local $3) + ) + ) + ;;@ ~lib/internal/memory.ts:237:2 + (set_local $5 + ;;@ ~lib/internal/memory.ts:237:17 + (i64.or + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:237:28 + (i64.shl + ;;@ ~lib/internal/memory.ts:237:29 + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:237:41 + (i64.const 32) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:238:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/internal/memory.ts:238:9 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:238:14 + (i32.const 32) + ) + (block + ;;@ ~lib/internal/memory.ts:238:18 + (block + ;;@ ~lib/internal/memory.ts:239:4 + (i64.store + ;;@ ~lib/internal/memory.ts:239:15 + (get_local $0) + ;;@ ~lib/internal/memory.ts:239:21 + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:240:4 + (i64.store + ;;@ ~lib/internal/memory.ts:240:15 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:240:22 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:240:25 + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:241:4 + (i64.store + ;;@ ~lib/internal/memory.ts:241:15 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:241:22 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:241:26 + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:242:4 + (i64.store + ;;@ ~lib/internal/memory.ts:242:15 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:242:22 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:242:26 + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:243:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:243:9 + (i32.const 32) + ) + ) + ;;@ ~lib/internal/memory.ts:244:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:244:12 + (i32.const 32) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ) + (func $~lib/array/Array#constructor (; 43 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + ;;@ ~lib/array.ts:23:4 + (if + ;;@ ~lib/array.ts:23:8 + (i32.gt_u + (get_local $1) + ;;@ ~lib/array.ts:23:22 + (i32.const 268435454) + ) + ;;@ ~lib/array.ts:23:39 + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 23) + (i32.const 39) + ) + (unreachable) + ) + ) + ;;@ ~lib/array.ts:24:4 + (set_local $2 + ;;@ ~lib/array.ts:24:21 + (i32.shl + (get_local $1) + ;;@ ~lib/array.ts:24:31 + (i32.const 2) + ) + ) + ;;@ ~lib/array.ts:25:4 + (set_local $3 + ;;@ ~lib/array.ts:25:17 + (call $~lib/internal/arraybuffer/allocateUnsafe + ;;@ ~lib/array.ts:25:32 + (get_local $2) + ) + ) + ;;@ ~lib/array.ts:26:4 + (i32.store + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $4 + (call $~lib/memory/memory.allocate + (i32.const 8) + ) + ) + (i32.store + (get_local $4) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $4) + (i32.const 0) + ) + (get_local $4) + ) + ) + ) + ) + ;;@ ~lib/array.ts:26:19 + (get_local $3) + ) + ;;@ ~lib/array.ts:27:4 + (i32.store offset=4 + (get_local $0) + ;;@ ~lib/array.ts:27:19 + (get_local $1) + ) + ;;@ ~lib/array.ts:28:11 + (block $~lib/memory/memory.fill|inlined.0 + (set_local $4 + ;;@ ~lib/array.ts:29:6 + (i32.add + (get_local $3) + ;;@ ~lib/array.ts:29:34 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + ;;@ ~lib/array.ts:30:6 + (i32.const 0) + ) + ;;@ ~lib/memory.ts:15:4 + (call $~lib/internal/memory/memset + ;;@ ~lib/memory.ts:15:11 + (get_local $4) + ;;@ ~lib/memory.ts:15:17 + (get_local $5) + ;;@ ~lib/memory.ts:15:20 + (get_local $2) + ) + ) + (get_local $0) + ) + (func $~lib/array/Array#__unchecked_set (; 44 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + ;;@ ~lib/array.ts:98:4 + (block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + (set_local $3 + ;;@ ~lib/array.ts:98:21 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:72:2 + (i32.store offset=8 + ;;@ ~lib/internal/arraybuffer.ts:72:11 + (i32.add + (get_local $3) + ;;@ ~lib/internal/arraybuffer.ts:72:39 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:72:40 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:72:56 + (i32.const 2) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:72:71 + (get_local $2) + ) + ) + ) + (func $assembly/index/Ray#constructor (; 45 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $3 + (call $~lib/memory/memory.allocate + (i32.const 8) + ) + ) + (i32.store + (get_local $3) + (get_local $1) + ) + (i32.store offset=4 + (get_local $3) + (get_local $2) + ) + (get_local $3) + ) + ) + ) + ) + ) + (func $~lib/array/Array#constructor (; 46 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + ;;@ ~lib/array.ts:23:4 + (if + ;;@ ~lib/array.ts:23:8 + (i32.gt_u + (get_local $1) + ;;@ ~lib/array.ts:23:22 + (i32.const 268435454) + ) + ;;@ ~lib/array.ts:23:39 + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 23) + (i32.const 39) + ) + (unreachable) + ) + ) + ;;@ ~lib/array.ts:24:4 + (set_local $2 + ;;@ ~lib/array.ts:24:21 + (i32.shl + (get_local $1) + ;;@ ~lib/array.ts:24:31 + (i32.const 2) + ) + ) + ;;@ ~lib/array.ts:25:4 + (set_local $3 + ;;@ ~lib/array.ts:25:17 + (call $~lib/internal/arraybuffer/allocateUnsafe + ;;@ ~lib/array.ts:25:32 + (get_local $2) + ) + ) + ;;@ ~lib/array.ts:26:4 + (i32.store + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $4 + (call $~lib/memory/memory.allocate + (i32.const 8) + ) + ) + (i32.store + (get_local $4) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $4) + (i32.const 0) + ) + (get_local $4) + ) + ) + ) + ) + ;;@ ~lib/array.ts:26:19 + (get_local $3) + ) + ;;@ ~lib/array.ts:27:4 + (i32.store offset=4 + (get_local $0) + ;;@ ~lib/array.ts:27:19 + (get_local $1) + ) + ;;@ ~lib/array.ts:28:11 + (block $~lib/memory/memory.fill|inlined.1 + (set_local $4 + ;;@ ~lib/array.ts:29:6 + (i32.add + (get_local $3) + ;;@ ~lib/array.ts:29:34 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + ;;@ ~lib/array.ts:30:6 + (i32.const 0) + ) + ;;@ ~lib/memory.ts:15:4 + (call $~lib/internal/memory/memset + ;;@ ~lib/memory.ts:15:11 + (get_local $4) + ;;@ ~lib/memory.ts:15:17 + (get_local $5) + ;;@ ~lib/memory.ts:15:20 + (get_local $2) + ) + ) + (get_local $0) + ) + (func $~lib/internal/memory/memcpy (; 47 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + ;;@ ~lib/internal/memory.ts:6:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/internal/memory.ts:6:9 + (if (result i32) + (get_local $2) + ;;@ ~lib/internal/memory.ts:6:14 + (i32.and + ;;@ ~lib/internal/memory.ts:6:15 + (get_local $1) + ;;@ ~lib/internal/memory.ts:6:21 + (i32.const 3) + ) + (get_local $2) + ) + (block + ;;@ ~lib/internal/memory.ts:6:25 + (block + ;;@ ~lib/internal/memory.ts:7:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:7:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:7:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:7:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:8:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:12:2 + (if + ;;@ ~lib/internal/memory.ts:12:6 + (i32.eq + (i32.and + ;;@ ~lib/internal/memory.ts:12:7 + (get_local $0) + ;;@ ~lib/internal/memory.ts:12:14 + (i32.const 3) + ) + ;;@ ~lib/internal/memory.ts:12:20 + (i32.const 0) + ) + ;;@ ~lib/internal/memory.ts:12:23 + (block + ;;@ ~lib/internal/memory.ts:13:4 + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/internal/memory.ts:13:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:13:16 + (i32.const 16) + ) + (block + ;;@ ~lib/internal/memory.ts:13:20 + (block + ;;@ ~lib/internal/memory.ts:14:6 + (i32.store + ;;@ ~lib/internal/memory.ts:14:17 + (get_local $0) + ;;@ ~lib/internal/memory.ts:14:28 + (i32.load + ;;@ ~lib/internal/memory.ts:14:38 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:15:6 + (i32.store + ;;@ ~lib/internal/memory.ts:15:17 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:15:25 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:15:28 + (i32.load + ;;@ ~lib/internal/memory.ts:15:38 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:15:45 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:16:6 + (i32.store + ;;@ ~lib/internal/memory.ts:16:17 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:16:25 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:16:28 + (i32.load + ;;@ ~lib/internal/memory.ts:16:38 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:16:45 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:17:6 + (i32.store + ;;@ ~lib/internal/memory.ts:17:17 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:17:24 + (i32.const 12) + ) + ;;@ ~lib/internal/memory.ts:17:28 + (i32.load + ;;@ ~lib/internal/memory.ts:17:38 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:17:44 + (i32.const 12) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:18:6 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:18:13 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:18:17 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:18:25 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:18:29 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:18:34 + (i32.const 16) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:20:4 + (if + ;;@ ~lib/internal/memory.ts:20:8 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:20:12 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:20:15 + (block + ;;@ ~lib/internal/memory.ts:21:6 + (i32.store + ;;@ ~lib/internal/memory.ts:21:17 + (get_local $0) + ;;@ ~lib/internal/memory.ts:21:27 + (i32.load + ;;@ ~lib/internal/memory.ts:21:37 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:22:6 + (i32.store + ;;@ ~lib/internal/memory.ts:22:17 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:22:24 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:22:27 + (i32.load + ;;@ ~lib/internal/memory.ts:22:37 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:22:43 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:23:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:23:14 + (i32.const 8) + ) + ) + ;;@ ~lib/internal/memory.ts:23:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:23:24 + (i32.const 8) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:25:4 + (if + ;;@ ~lib/internal/memory.ts:25:8 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:25:12 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:25:15 + (block + ;;@ ~lib/internal/memory.ts:26:6 + (i32.store + ;;@ ~lib/internal/memory.ts:26:17 + (get_local $0) + ;;@ ~lib/internal/memory.ts:26:23 + (i32.load + ;;@ ~lib/internal/memory.ts:26:33 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:27:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:27:14 + (i32.const 4) + ) + ) + ;;@ ~lib/internal/memory.ts:27:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:27:24 + (i32.const 4) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:29:4 + (if + ;;@ ~lib/internal/memory.ts:29:8 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:29:12 + (i32.const 2) + ) + ;;@ ~lib/internal/memory.ts:29:15 + (block + ;;@ ~lib/internal/memory.ts:30:6 + (i32.store16 + ;;@ ~lib/internal/memory.ts:30:17 + (get_local $0) + ;;@ ~lib/internal/memory.ts:30:23 + (i32.load16_u + ;;@ ~lib/internal/memory.ts:30:33 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:31:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:31:14 + (i32.const 2) + ) + ) + ;;@ ~lib/internal/memory.ts:31:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:31:24 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:33:4 + (if + ;;@ ~lib/internal/memory.ts:33:8 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:33:12 + (i32.const 1) + ) + ;;@ ~lib/internal/memory.ts:33:15 + (i32.store8 + ;;@ ~lib/internal/memory.ts:34:16 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:34:24 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:34:33 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:36:4 + (return) + ) + ) + ;;@ ~lib/internal/memory.ts:41:2 + (if + ;;@ ~lib/internal/memory.ts:41:6 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:41:11 + (i32.const 32) + ) + ;;@ ~lib/internal/memory.ts:41:15 + (block $break|2 + (block $case2|2 + (block $case1|2 + (block $case0|2 + (set_local $5 + ;;@ ~lib/internal/memory.ts:42:12 + (i32.and + (get_local $0) + ;;@ ~lib/internal/memory.ts:42:19 + (i32.const 3) + ) + ) + (br_if $case0|2 + (i32.eq + (get_local $5) + ;;@ ~lib/internal/memory.ts:44:11 + (i32.const 1) + ) + ) + (br_if $case1|2 + (i32.eq + (get_local $5) + ;;@ ~lib/internal/memory.ts:63:11 + (i32.const 2) + ) + ) + (br_if $case2|2 + (i32.eq + (get_local $5) + ;;@ ~lib/internal/memory.ts:81:11 + (i32.const 3) + ) + ) + (br $break|2) + ) + ;;@ ~lib/internal/memory.ts:44:14 + (block + ;;@ ~lib/internal/memory.ts:45:8 + (set_local $3 + ;;@ ~lib/internal/memory.ts:45:12 + (i32.load + ;;@ ~lib/internal/memory.ts:45:22 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:46:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:46:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:46:26 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:46:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:47:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:47:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:47:26 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:47:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:48:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:48:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:48:26 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:48:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:49:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:49:13 + (i32.const 3) + ) + ) + ;;@ ~lib/internal/memory.ts:50:8 + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/internal/memory.ts:50:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:50:20 + (i32.const 17) + ) + (block + ;;@ ~lib/internal/memory.ts:50:24 + (block + ;;@ ~lib/internal/memory.ts:51:10 + (set_local $4 + ;;@ ~lib/internal/memory.ts:51:14 + (i32.load + ;;@ ~lib/internal/memory.ts:51:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:51:30 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:52:10 + (i32.store + ;;@ ~lib/internal/memory.ts:52:21 + (get_local $0) + ;;@ ~lib/internal/memory.ts:52:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/internal/memory.ts:52:32 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:52:37 + (i32.shl + (get_local $4) + ;;@ ~lib/internal/memory.ts:52:42 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:53:10 + (set_local $3 + ;;@ ~lib/internal/memory.ts:53:14 + (i32.load + ;;@ ~lib/internal/memory.ts:53:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:53:30 + (i32.const 5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:54:10 + (i32.store + ;;@ ~lib/internal/memory.ts:54:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:54:28 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:54:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/internal/memory.ts:54:36 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:54:41 + (i32.shl + (get_local $3) + ;;@ ~lib/internal/memory.ts:54:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:55:10 + (set_local $4 + ;;@ ~lib/internal/memory.ts:55:14 + (i32.load + ;;@ ~lib/internal/memory.ts:55:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:55:30 + (i32.const 9) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:56:10 + (i32.store + ;;@ ~lib/internal/memory.ts:56:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:56:28 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:56:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/internal/memory.ts:56:36 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:56:41 + (i32.shl + (get_local $4) + ;;@ ~lib/internal/memory.ts:56:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:57:10 + (set_local $3 + ;;@ ~lib/internal/memory.ts:57:14 + (i32.load + ;;@ ~lib/internal/memory.ts:57:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:57:30 + (i32.const 13) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:58:10 + (i32.store + ;;@ ~lib/internal/memory.ts:58:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:58:28 + (i32.const 12) + ) + ;;@ ~lib/internal/memory.ts:58:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/internal/memory.ts:58:37 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:58:42 + (i32.shl + (get_local $3) + ;;@ ~lib/internal/memory.ts:58:47 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:59:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:59:17 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:59:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:59:29 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:59:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:59:38 + (i32.const 16) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:61:8 + (br $break|2) + ) + ) + ;;@ ~lib/internal/memory.ts:63:14 + (block + ;;@ ~lib/internal/memory.ts:64:8 + (set_local $3 + ;;@ ~lib/internal/memory.ts:64:12 + (i32.load + ;;@ ~lib/internal/memory.ts:64:22 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:65:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:65:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:65:26 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:65:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:66:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:66:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:66:26 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:66:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:67:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:67:13 + (i32.const 2) + ) + ) + ;;@ ~lib/internal/memory.ts:68:8 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/internal/memory.ts:68:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:68:20 + (i32.const 18) + ) + (block + ;;@ ~lib/internal/memory.ts:68:24 + (block + ;;@ ~lib/internal/memory.ts:69:10 + (set_local $4 + ;;@ ~lib/internal/memory.ts:69:14 + (i32.load + ;;@ ~lib/internal/memory.ts:69:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:69:30 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:70:10 + (i32.store + ;;@ ~lib/internal/memory.ts:70:21 + (get_local $0) + ;;@ ~lib/internal/memory.ts:70:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/internal/memory.ts:70:32 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:70:37 + (i32.shl + (get_local $4) + ;;@ ~lib/internal/memory.ts:70:42 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:71:10 + (set_local $3 + ;;@ ~lib/internal/memory.ts:71:14 + (i32.load + ;;@ ~lib/internal/memory.ts:71:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:71:30 + (i32.const 6) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:72:10 + (i32.store + ;;@ ~lib/internal/memory.ts:72:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:72:28 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:72:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/internal/memory.ts:72:36 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:72:41 + (i32.shl + (get_local $3) + ;;@ ~lib/internal/memory.ts:72:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:73:10 + (set_local $4 + ;;@ ~lib/internal/memory.ts:73:14 + (i32.load + ;;@ ~lib/internal/memory.ts:73:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:73:30 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:74:10 + (i32.store + ;;@ ~lib/internal/memory.ts:74:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:74:28 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:74:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/internal/memory.ts:74:36 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:74:41 + (i32.shl + (get_local $4) + ;;@ ~lib/internal/memory.ts:74:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:75:10 + (set_local $3 + ;;@ ~lib/internal/memory.ts:75:14 + (i32.load + ;;@ ~lib/internal/memory.ts:75:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:75:30 + (i32.const 14) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:76:10 + (i32.store + ;;@ ~lib/internal/memory.ts:76:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:76:28 + (i32.const 12) + ) + ;;@ ~lib/internal/memory.ts:76:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/internal/memory.ts:76:37 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:76:42 + (i32.shl + (get_local $3) + ;;@ ~lib/internal/memory.ts:76:47 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:77:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:77:17 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:77:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:77:29 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:77:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:77:38 + (i32.const 16) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:79:8 + (br $break|2) + ) + ) + ;;@ ~lib/internal/memory.ts:81:14 + (block + ;;@ ~lib/internal/memory.ts:82:8 + (set_local $3 + ;;@ ~lib/internal/memory.ts:82:12 + (i32.load + ;;@ ~lib/internal/memory.ts:82:22 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:83:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:83:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:83:26 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:83:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:84:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:84:13 + (i32.const 1) + ) + ) + ;;@ ~lib/internal/memory.ts:85:8 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/internal/memory.ts:85:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:85:20 + (i32.const 19) + ) + (block + ;;@ ~lib/internal/memory.ts:85:24 + (block + ;;@ ~lib/internal/memory.ts:86:10 + (set_local $4 + ;;@ ~lib/internal/memory.ts:86:14 + (i32.load + ;;@ ~lib/internal/memory.ts:86:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:86:30 + (i32.const 3) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:87:10 + (i32.store + ;;@ ~lib/internal/memory.ts:87:21 + (get_local $0) + ;;@ ~lib/internal/memory.ts:87:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/internal/memory.ts:87:32 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:87:36 + (i32.shl + (get_local $4) + ;;@ ~lib/internal/memory.ts:87:41 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:88:10 + (set_local $3 + ;;@ ~lib/internal/memory.ts:88:14 + (i32.load + ;;@ ~lib/internal/memory.ts:88:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:88:30 + (i32.const 7) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:89:10 + (i32.store + ;;@ ~lib/internal/memory.ts:89:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:89:28 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:89:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/internal/memory.ts:89:36 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:89:40 + (i32.shl + (get_local $3) + ;;@ ~lib/internal/memory.ts:89:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:90:10 + (set_local $4 + ;;@ ~lib/internal/memory.ts:90:14 + (i32.load + ;;@ ~lib/internal/memory.ts:90:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:90:30 + (i32.const 11) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:91:10 + (i32.store + ;;@ ~lib/internal/memory.ts:91:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:91:28 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:91:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/internal/memory.ts:91:36 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:91:40 + (i32.shl + (get_local $4) + ;;@ ~lib/internal/memory.ts:91:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:92:10 + (set_local $3 + ;;@ ~lib/internal/memory.ts:92:14 + (i32.load + ;;@ ~lib/internal/memory.ts:92:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:92:30 + (i32.const 15) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:93:10 + (i32.store + ;;@ ~lib/internal/memory.ts:93:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:93:28 + (i32.const 12) + ) + ;;@ ~lib/internal/memory.ts:93:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/internal/memory.ts:93:37 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:93:41 + (i32.shl + (get_local $3) + ;;@ ~lib/internal/memory.ts:93:46 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:94:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:94:17 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:94:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:94:29 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:94:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:94:38 + (i32.const 16) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:96:8 + (br $break|2) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:102:2 + (if + ;;@ ~lib/internal/memory.ts:102:6 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:102:10 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:102:14 + (block + ;;@ ~lib/internal/memory.ts:103:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:103:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:103:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:103:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:104:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:104:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:104:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:104:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:105:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:105:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:105:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:105:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:106:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:106:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:106:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:106:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:107:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:107:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:107:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:107:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:108:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:108:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:108:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:108:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:109:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:109:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:109:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:109:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:110:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:110:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:110:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:110:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:111:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:111:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:111:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:111:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:112:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:112:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:112:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:112:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:113:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:113:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:113:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:113:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:114:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:114:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:114:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:114:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:115:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:115:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:115:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:115:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:116:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:116:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:116:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:116:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:117:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:117:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:117:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:117:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:118:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:118:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:118:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:118:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:120:2 + (if + ;;@ ~lib/internal/memory.ts:120:6 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:120:10 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:120:13 + (block + ;;@ ~lib/internal/memory.ts:121:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:121:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:121:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:121:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:122:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:122:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:122:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:122:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:123:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:123:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:123:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:123:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:124:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:124:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:124:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:124:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:125:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:125:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:125:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:125:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:126:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:126:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:126:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:126:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:127:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:127:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:127:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:127:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:128:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:128:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:128:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:128:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:130:2 + (if + ;;@ ~lib/internal/memory.ts:130:6 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:130:10 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:130:13 + (block + ;;@ ~lib/internal/memory.ts:131:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:131:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:131:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:131:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:132:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:132:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:132:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:132:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:133:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:133:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:133:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:133:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:134:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:134:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:134:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:134:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:136:2 + (if + ;;@ ~lib/internal/memory.ts:136:6 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:136:10 + (i32.const 2) + ) + ;;@ ~lib/internal/memory.ts:136:13 + (block + ;;@ ~lib/internal/memory.ts:137:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:137:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:137:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:137:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:138:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:138:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:138:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:138:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:140:2 + (if + ;;@ ~lib/internal/memory.ts:140:6 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:140:10 + (i32.const 1) + ) + ;;@ ~lib/internal/memory.ts:140:13 + (i32.store8 + ;;@ ~lib/internal/memory.ts:141:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:141:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:141:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + (func $~lib/internal/memory/memmove (; 48 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + ;;@ ~lib/internal/memory.ts:147:2 + (if + ;;@ ~lib/internal/memory.ts:147:6 + (i32.eq + (get_local $0) + ;;@ ~lib/internal/memory.ts:147:14 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:147:19 + (return) + ) + ;;@ ~lib/internal/memory.ts:148:2 + (if + ;;@ ~lib/internal/memory.ts:148:6 + (if (result i32) + (tee_local $3 + (i32.le_u + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:148:12 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:148:17 + (get_local $0) + ) + ) + (get_local $3) + ;;@ ~lib/internal/memory.ts:148:25 + (i32.le_u + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:148:32 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:148:37 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:148:42 + (block + ;;@ ~lib/internal/memory.ts:149:4 + (call $~lib/internal/memory/memcpy + ;;@ ~lib/internal/memory.ts:149:11 + (get_local $0) + ;;@ ~lib/internal/memory.ts:149:17 + (get_local $1) + ;;@ ~lib/internal/memory.ts:149:22 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:150:4 + (return) + ) + ) + ;;@ ~lib/internal/memory.ts:152:2 + (if + ;;@ ~lib/internal/memory.ts:152:6 + (i32.lt_u + (get_local $0) + ;;@ ~lib/internal/memory.ts:152:13 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:152:18 + (block + ;;@ ~lib/internal/memory.ts:153:4 + (if + ;;@ ~lib/internal/memory.ts:153:8 + (i32.eq + (i32.and + ;;@ ~lib/internal/memory.ts:153:9 + (get_local $1) + ;;@ ~lib/internal/memory.ts:153:15 + (i32.const 7) + ) + ;;@ ~lib/internal/memory.ts:153:21 + (i32.and + ;;@ ~lib/internal/memory.ts:153:22 + (get_local $0) + ;;@ ~lib/internal/memory.ts:153:29 + (i32.const 7) + ) + ) + ;;@ ~lib/internal/memory.ts:153:33 + (block + ;;@ ~lib/internal/memory.ts:154:6 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/internal/memory.ts:154:13 + (i32.and + (get_local $0) + ;;@ ~lib/internal/memory.ts:154:20 + (i32.const 7) + ) + (block + ;;@ ~lib/internal/memory.ts:154:23 + (block + ;;@ ~lib/internal/memory.ts:155:8 + (if + ;;@ ~lib/internal/memory.ts:155:12 + (i32.eqz + ;;@ ~lib/internal/memory.ts:155:13 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:155:16 + (return) + ) + ;;@ ~lib/internal/memory.ts:156:8 + (set_local $2 + (i32.sub + ;;@ ~lib/internal/memory.ts:156:10 + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/internal/memory.ts:157:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:157:18 + (block (result i32) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ;;@ ~lib/internal/memory.ts:157:26 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:157:35 + (block (result i32) + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:159:6 + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/internal/memory.ts:159:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:159:18 + (i32.const 8) + ) + (block + ;;@ ~lib/internal/memory.ts:159:21 + (block + ;;@ ~lib/internal/memory.ts:160:8 + (i64.store + ;;@ ~lib/internal/memory.ts:160:19 + (get_local $0) + ;;@ ~lib/internal/memory.ts:160:25 + (i64.load + ;;@ ~lib/internal/memory.ts:160:35 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:161:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:161:16 + (i32.const 8) + ) + ) + ;;@ ~lib/internal/memory.ts:162:8 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:162:16 + (i32.const 8) + ) + ) + ;;@ ~lib/internal/memory.ts:163:8 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:163:16 + (i32.const 8) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:166:4 + (block $break|2 + (loop $continue|2 + (if + ;;@ ~lib/internal/memory.ts:166:11 + (get_local $2) + (block + ;;@ ~lib/internal/memory.ts:166:14 + (block + ;;@ ~lib/internal/memory.ts:167:6 + (i32.store8 + ;;@ ~lib/internal/memory.ts:167:16 + (block (result i32) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ;;@ ~lib/internal/memory.ts:167:24 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:167:33 + (block (result i32) + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:168:6 + (set_local $2 + (i32.sub + ;;@ ~lib/internal/memory.ts:168:8 + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|2) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:170:9 + (block + ;;@ ~lib/internal/memory.ts:171:4 + (if + ;;@ ~lib/internal/memory.ts:171:8 + (i32.eq + (i32.and + ;;@ ~lib/internal/memory.ts:171:9 + (get_local $1) + ;;@ ~lib/internal/memory.ts:171:15 + (i32.const 7) + ) + ;;@ ~lib/internal/memory.ts:171:21 + (i32.and + ;;@ ~lib/internal/memory.ts:171:22 + (get_local $0) + ;;@ ~lib/internal/memory.ts:171:29 + (i32.const 7) + ) + ) + ;;@ ~lib/internal/memory.ts:171:33 + (block + ;;@ ~lib/internal/memory.ts:172:6 + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/internal/memory.ts:172:13 + (i32.and + (i32.add + ;;@ ~lib/internal/memory.ts:172:14 + (get_local $0) + ;;@ ~lib/internal/memory.ts:172:21 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:172:26 + (i32.const 7) + ) + (block + ;;@ ~lib/internal/memory.ts:172:29 + (block + ;;@ ~lib/internal/memory.ts:173:8 + (if + ;;@ ~lib/internal/memory.ts:173:12 + (i32.eqz + ;;@ ~lib/internal/memory.ts:173:13 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:173:16 + (return) + ) + ;;@ ~lib/internal/memory.ts:174:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:174:18 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:174:25 + (tee_local $2 + (i32.sub + ;;@ ~lib/internal/memory.ts:174:27 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:174:30 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:174:39 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:174:45 + (get_local $2) + ) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:176:6 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/internal/memory.ts:176:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:176:18 + (i32.const 8) + ) + (block + ;;@ ~lib/internal/memory.ts:176:21 + (block + ;;@ ~lib/internal/memory.ts:177:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:177:13 + (i32.const 8) + ) + ) + ;;@ ~lib/internal/memory.ts:178:8 + (i64.store + ;;@ ~lib/internal/memory.ts:178:19 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:178:26 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:178:29 + (i64.load + ;;@ ~lib/internal/memory.ts:178:39 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:178:45 + (get_local $2) + ) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:181:4 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/internal/memory.ts:181:11 + (get_local $2) + (block + ;;@ ~lib/internal/memory.ts:181:14 + (i32.store8 + ;;@ ~lib/internal/memory.ts:182:16 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:182:23 + (tee_local $2 + (i32.sub + ;;@ ~lib/internal/memory.ts:182:25 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:182:28 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:182:37 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:182:43 + (get_local $2) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ) + ) + (func $~lib/internal/arraybuffer/reallocateUnsafe (; 49 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + ;;@ ~lib/internal/arraybuffer.ts:35:2 + (set_local $2 + ;;@ ~lib/internal/arraybuffer.ts:35:22 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:36:2 + (if + ;;@ ~lib/internal/arraybuffer.ts:36:6 + (i32.gt_s + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:36:22 + (get_local $2) + ) + ;;@ ~lib/internal/arraybuffer.ts:36:37 + (block + ;;@ ~lib/internal/arraybuffer.ts:37:4 + (if + (i32.eqz + ;;@ ~lib/internal/arraybuffer.ts:37:11 + (i32.le_s + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:37:28 + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 40) + (i32.const 37) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:38:4 + (if + ;;@ ~lib/internal/arraybuffer.ts:38:8 + (i32.le_s + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:38:25 + (i32.sub + ;;@ ~lib/internal/arraybuffer.ts:38:31 + (call $~lib/internal/arraybuffer/computeSize + ;;@ ~lib/internal/arraybuffer.ts:38:43 + (get_local $2) + ) + ;;@ ~lib/internal/arraybuffer.ts:38:60 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:38:74 + (block + ;;@ ~lib/internal/arraybuffer.ts:39:6 + (i32.store + ;;@ ~lib/internal/arraybuffer.ts:39:17 + (get_local $0) + ;;@ ~lib/internal/arraybuffer.ts:39:44 + (get_local $1) + ) + ;;@ ~lib/internal/arraybuffer.ts:40:13 + (block $~lib/memory/memory.fill|inlined.2 + (set_local $3 + ;;@ ~lib/internal/arraybuffer.ts:41:8 + (i32.add + (i32.add + (get_local $0) + ;;@ ~lib/internal/arraybuffer.ts:41:36 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ;;@ ~lib/internal/arraybuffer.ts:41:50 + (get_local $2) + ) + ) + (set_local $4 + ;;@ ~lib/internal/arraybuffer.ts:42:8 + (i32.const 0) + ) + (set_local $5 + ;;@ ~lib/internal/arraybuffer.ts:43:8 + (i32.sub + ;;@ ~lib/internal/arraybuffer.ts:43:16 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:43:32 + (get_local $2) + ) + ) + (call $~lib/internal/memory/memset + (get_local $3) + (get_local $4) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:45:11 + (block + ;;@ ~lib/internal/arraybuffer.ts:46:6 + (set_local $5 + ;;@ ~lib/internal/arraybuffer.ts:46:22 + (call $~lib/internal/arraybuffer/allocateUnsafe + ;;@ ~lib/internal/arraybuffer.ts:46:37 + (get_local $1) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:47:13 + (block $~lib/memory/memory.copy|inlined.0 + (set_local $4 + ;;@ ~lib/internal/arraybuffer.ts:48:8 + (i32.add + (get_local $5) + ;;@ ~lib/internal/arraybuffer.ts:48:39 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $3 + ;;@ ~lib/internal/arraybuffer.ts:49:8 + (i32.add + (get_local $0) + ;;@ ~lib/internal/arraybuffer.ts:49:36 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + ;;@ ~lib/memory.ts:20:4 + (call $~lib/internal/memory/memmove + ;;@ ~lib/memory.ts:20:12 + (get_local $4) + ;;@ ~lib/memory.ts:20:18 + (get_local $3) + ;;@ ~lib/memory.ts:20:23 + (get_local $2) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:52:13 + (block $~lib/memory/memory.fill|inlined.3 + (set_local $3 + ;;@ ~lib/internal/arraybuffer.ts:53:8 + (i32.add + (i32.add + (get_local $5) + ;;@ ~lib/internal/arraybuffer.ts:53:39 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ;;@ ~lib/internal/arraybuffer.ts:53:53 + (get_local $2) + ) + ) + (set_local $4 + ;;@ ~lib/internal/arraybuffer.ts:54:8 + (i32.const 0) + ) + (set_local $6 + ;;@ ~lib/internal/arraybuffer.ts:55:8 + (i32.sub + ;;@ ~lib/internal/arraybuffer.ts:55:16 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:55:32 + (get_local $2) + ) + ) + ;;@ ~lib/memory.ts:15:4 + (call $~lib/internal/memory/memset + ;;@ ~lib/memory.ts:15:11 + (get_local $3) + ;;@ ~lib/memory.ts:15:17 + (get_local $4) + ;;@ ~lib/memory.ts:15:20 + (get_local $6) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:57:13 + (return + (get_local $5) + ) + ) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:59:9 + (if + ;;@ ~lib/internal/arraybuffer.ts:59:13 + (i32.lt_s + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:59:29 + (get_local $2) + ) + ;;@ ~lib/internal/arraybuffer.ts:59:44 + (block + ;;@ ~lib/internal/arraybuffer.ts:61:4 + (if + (i32.eqz + ;;@ ~lib/internal/arraybuffer.ts:61:11 + (i32.ge_s + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:61:28 + (i32.const 0) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 40) + (i32.const 61) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:62:4 + (i32.store + ;;@ ~lib/internal/arraybuffer.ts:62:15 + (get_local $0) + ;;@ ~lib/internal/arraybuffer.ts:62:42 + (get_local $1) + ) + ) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:64:9 + (get_local $0) + ) + (func $~lib/array/Array#__set (; 50 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + ;;@ ~lib/array.ts:83:4 + (set_local $3 + ;;@ ~lib/array.ts:83:17 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:84:4 + (set_local $4 + ;;@ ~lib/array.ts:84:19 + (i32.shr_u + (i32.load + (get_local $3) + ) + ;;@ ~lib/array.ts:84:41 + (i32.const 2) + ) + ) + ;;@ ~lib/array.ts:85:4 + (if + ;;@ ~lib/array.ts:85:8 + (i32.ge_u + (get_local $1) + ;;@ ~lib/array.ts:85:22 + (get_local $4) + ) + ;;@ ~lib/array.ts:85:37 + (block + ;;@ ~lib/array.ts:87:6 + (if + ;;@ ~lib/array.ts:87:10 + (i32.ge_u + (get_local $1) + ;;@ ~lib/array.ts:87:24 + (i32.const 268435454) + ) + ;;@ ~lib/array.ts:87:41 + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 87) + (i32.const 41) + ) + (unreachable) + ) + ) + ;;@ ~lib/array.ts:88:6 + (set_local $3 + ;;@ ~lib/array.ts:88:15 + (call $~lib/internal/arraybuffer/reallocateUnsafe + ;;@ ~lib/array.ts:88:32 + (get_local $3) + ;;@ ~lib/array.ts:88:40 + (i32.shl + (i32.add + ;;@ ~lib/array.ts:88:41 + (get_local $1) + ;;@ ~lib/array.ts:88:49 + (i32.const 1) + ) + ;;@ ~lib/array.ts:88:55 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/array.ts:89:6 + (i32.store + (get_local $0) + ;;@ ~lib/array.ts:89:21 + (get_local $3) + ) + ;;@ ~lib/array.ts:90:6 + (i32.store offset=4 + (get_local $0) + ;;@ ~lib/array.ts:90:21 + (i32.add + (get_local $1) + ;;@ ~lib/array.ts:90:29 + (i32.const 1) + ) + ) + ) + ) + ;;@ ~lib/array.ts:92:4 + (block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + ;;@ ~lib/internal/arraybuffer.ts:72:2 + (i32.store offset=8 + ;;@ ~lib/internal/arraybuffer.ts:72:11 + (i32.add + (get_local $3) + ;;@ ~lib/internal/arraybuffer.ts:72:39 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:72:40 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:72:56 + (i32.const 2) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:72:71 + (get_local $2) + ) + ) + ) + (func $assembly/index/createContext (; 51 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + ;;@ assembly/index.ts:308:4 + (set_global $assembly/index/context + ;;@ assembly/index.ts:308:14 + (call $assembly/index/Context#constructor + (i32.const 0) + ;;@ assembly/index.ts:255:36 + (i32.const 0) + ;;@ assembly/index.ts:255:60 + (i32.const 0) + ) + ) + ;;@ assembly/index.ts:309:4 + (i32.store offset=24 + (get_global $assembly/index/context) + ;;@ assembly/index.ts:309:22 + (block (result i32) + (set_local $2 + (call $~lib/array/Array#constructor + (i32.const 0) + (i32.const 9) + ) + ) + (call $~lib/array/Array#__unchecked_set + (get_local $2) + (i32.const 0) + ;;@ assembly/index.ts:311:8 + (call $assembly/index/Sphere#constructor + (i32.const 0) + ;;@ assembly/index.ts:311:19 + (f64.const 1e5) + ;;@ assembly/index.ts:311:24 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 100001) + ;;@ assembly/index.ts:311:41 + (f64.const 40.8) + ;;@ assembly/index.ts:311:47 + (f64.const 81.6) + ) + ;;@ assembly/index.ts:311:54 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ;;@ assembly/index.ts:311:65 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:311:73 + (f64.const 0.75) + ;;@ assembly/index.ts:311:79 + (f64.const 0) + ;;@ assembly/index.ts:311:82 + (f64.const 0) + ) + ;;@ assembly/index.ts:311:86 + (get_global $assembly/index/Refl_t.DIFF) + ) + ) + (call $~lib/array/Array#__unchecked_set + (get_local $2) + (i32.const 1) + ;;@ assembly/index.ts:312:8 + (call $assembly/index/Sphere#constructor + (i32.const 0) + ;;@ assembly/index.ts:312:19 + (f64.const 1e5) + ;;@ assembly/index.ts:312:24 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:312:32 + (f64.add + (f64.const -1e5) + ;;@ assembly/index.ts:312:39 + (f64.const 99) + ) + ;;@ assembly/index.ts:312:43 + (f64.const 40.8) + ;;@ assembly/index.ts:312:49 + (f64.const 81.6) + ) + ;;@ assembly/index.ts:312:56 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ;;@ assembly/index.ts:312:67 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:312:75 + (f64.const 0) + ;;@ assembly/index.ts:312:78 + (f64.const 0.75) + ;;@ assembly/index.ts:312:84 + (f64.const 0) + ) + ;;@ assembly/index.ts:312:88 + (get_global $assembly/index/Refl_t.DIFF) + ) + ) + (call $~lib/array/Array#__unchecked_set + (get_local $2) + (i32.const 2) + ;;@ assembly/index.ts:313:8 + (call $assembly/index/Sphere#constructor + (i32.const 0) + ;;@ assembly/index.ts:313:19 + (f64.const 1e5) + ;;@ assembly/index.ts:313:24 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:313:32 + (f64.const 50) + ;;@ assembly/index.ts:313:36 + (f64.const 40.8) + ;;@ assembly/index.ts:313:42 + (f64.const 1e5) + ) + ;;@ assembly/index.ts:313:48 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ;;@ assembly/index.ts:313:59 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:313:67 + (f64.const 0.75) + ;;@ assembly/index.ts:313:73 + (f64.const 0.75) + ;;@ assembly/index.ts:313:79 + (f64.const 0.75) + ) + ;;@ assembly/index.ts:313:86 + (get_global $assembly/index/Refl_t.DIFF) + ) + ) + (call $~lib/array/Array#__unchecked_set + (get_local $2) + (i32.const 3) + ;;@ assembly/index.ts:314:8 + (call $assembly/index/Sphere#constructor + (i32.const 0) + ;;@ assembly/index.ts:314:19 + (f64.const 1e5) + ;;@ assembly/index.ts:314:24 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:314:32 + (f64.const 50) + ;;@ assembly/index.ts:314:36 + (f64.const 40.8) + ;;@ assembly/index.ts:314:42 + (f64.add + (f64.const -1e5) + ;;@ assembly/index.ts:314:49 + (f64.const 170) + ) + ) + ;;@ assembly/index.ts:314:55 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ;;@ assembly/index.ts:314:66 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ;;@ assembly/index.ts:314:77 + (get_global $assembly/index/Refl_t.DIFF) + ) + ) + (call $~lib/array/Array#__unchecked_set + (get_local $2) + (i32.const 4) + ;;@ assembly/index.ts:315:8 + (call $assembly/index/Sphere#constructor + (i32.const 0) + ;;@ assembly/index.ts:315:19 + (f64.const 1e5) + ;;@ assembly/index.ts:315:24 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:315:32 + (f64.const 50) + ;;@ assembly/index.ts:315:36 + (f64.const 1e5) + ;;@ assembly/index.ts:315:41 + (f64.const 81.6) + ) + ;;@ assembly/index.ts:315:48 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ;;@ assembly/index.ts:315:59 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:315:67 + (f64.const 0.75) + ;;@ assembly/index.ts:315:73 + (f64.const 0.75) + ;;@ assembly/index.ts:315:79 + (f64.const 0.75) + ) + ;;@ assembly/index.ts:315:86 + (get_global $assembly/index/Refl_t.DIFF) + ) + ) + (call $~lib/array/Array#__unchecked_set + (get_local $2) + (i32.const 5) + ;;@ assembly/index.ts:316:8 + (call $assembly/index/Sphere#constructor + (i32.const 0) + ;;@ assembly/index.ts:316:19 + (f64.const 1e5) + ;;@ assembly/index.ts:316:24 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:316:32 + (f64.const 50) + ;;@ assembly/index.ts:316:36 + (f64.add + (f64.const -1e5) + ;;@ assembly/index.ts:316:43 + (f64.const 81.6) + ) + ;;@ assembly/index.ts:316:49 + (f64.const 81.6) + ) + ;;@ assembly/index.ts:316:56 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ;;@ assembly/index.ts:316:67 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:316:75 + (f64.const 0.75) + ;;@ assembly/index.ts:316:81 + (f64.const 0.75) + ;;@ assembly/index.ts:316:87 + (f64.const 0.75) + ) + ;;@ assembly/index.ts:316:94 + (get_global $assembly/index/Refl_t.DIFF) + ) + ) + (call $~lib/array/Array#__unchecked_set + (get_local $2) + (i32.const 6) + ;;@ assembly/index.ts:317:8 + (call $assembly/index/Sphere#constructor + (i32.const 0) + ;;@ assembly/index.ts:317:19 + (f64.const 16.5) + ;;@ assembly/index.ts:317:25 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:317:33 + (f64.const 27) + ;;@ assembly/index.ts:317:37 + (f64.const 16.5) + ;;@ assembly/index.ts:317:43 + (f64.const 47) + ) + ;;@ assembly/index.ts:317:48 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ;;@ assembly/index.ts:317:59 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:317:67 + (f64.const 0.999) + ;;@ assembly/index.ts:317:74 + (f64.const 0.999) + ;;@ assembly/index.ts:317:81 + (f64.const 0.999) + ) + ;;@ assembly/index.ts:317:89 + (get_global $assembly/index/Refl_t.SPEC) + ) + ) + (call $~lib/array/Array#__unchecked_set + (get_local $2) + (i32.const 7) + ;;@ assembly/index.ts:318:8 + (call $assembly/index/Sphere#constructor + (i32.const 0) + ;;@ assembly/index.ts:318:19 + (f64.const 16.5) + ;;@ assembly/index.ts:318:25 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:318:33 + (f64.const 73) + ;;@ assembly/index.ts:318:37 + (f64.const 16.5) + ;;@ assembly/index.ts:318:43 + (f64.const 78) + ) + ;;@ assembly/index.ts:318:48 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ;;@ assembly/index.ts:318:59 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:318:67 + (f64.const 0.999) + ;;@ assembly/index.ts:318:74 + (f64.const 0.999) + ;;@ assembly/index.ts:318:81 + (f64.const 0.999) + ) + ;;@ assembly/index.ts:318:89 + (get_global $assembly/index/Refl_t.REFR) + ) + ) + (call $~lib/array/Array#__unchecked_set + (get_local $2) + (i32.const 8) + ;;@ assembly/index.ts:319:8 + (call $assembly/index/Sphere#constructor + (i32.const 0) + ;;@ assembly/index.ts:319:19 + (f64.const 600) + ;;@ assembly/index.ts:319:24 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:319:32 + (f64.const 50) + ;;@ assembly/index.ts:319:36 + (f64.sub + (f64.const 681.6) + ;;@ assembly/index.ts:319:44 + (f64.const 0.27) + ) + ;;@ assembly/index.ts:319:50 + (f64.const 81.6) + ) + ;;@ assembly/index.ts:319:57 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:319:65 + (f64.const 112) + ;;@ assembly/index.ts:319:70 + (f64.const 112) + ;;@ assembly/index.ts:319:75 + (f64.const 112) + ) + ;;@ assembly/index.ts:319:81 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ;;@ assembly/index.ts:319:92 + (get_global $assembly/index/Refl_t.DIFF) + ) + ) + (get_local $2) + ) + ) + ;;@ assembly/index.ts:321:4 + (i32.store offset=4 + (get_global $assembly/index/context) + ;;@ assembly/index.ts:321:18 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:321:26 + (f64.const 0) + ;;@ assembly/index.ts:321:29 + (f64.const -0.042612) + ;;@ assembly/index.ts:321:40 + (f64.const -1) + ) + ) + ;;@ assembly/index.ts:322:4 + (i32.store offset=8 + (get_global $assembly/index/context) + ;;@ assembly/index.ts:322:18 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:322:26 + (f64.const 50) + ;;@ assembly/index.ts:322:30 + (f64.const 52) + ;;@ assembly/index.ts:322:34 + (f64.const 295.6) + ) + ) + ;;@ assembly/index.ts:323:4 + (i32.store offset=12 + (get_global $assembly/index/context) + ;;@ assembly/index.ts:323:18 + (call $assembly/index/Ray#constructor + (i32.const 0) + ;;@ assembly/index.ts:323:26 + (i32.load offset=8 + (get_global $assembly/index/context) + ) + ;;@ assembly/index.ts:323:51 + (call $assembly/index/Vec#norm_in + ;;@ assembly/index.ts:323:39 + (i32.load offset=4 + (get_global $assembly/index/context) + ) + ) + ) + ) + ;;@ assembly/index.ts:324:4 + (i32.store offset=16 + (get_global $assembly/index/context) + ;;@ assembly/index.ts:324:17 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + ;;@ assembly/index.ts:325:4 + (i32.store offset=20 + (get_global $assembly/index/context) + ;;@ assembly/index.ts:325:17 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + ;;@ assembly/index.ts:326:4 + (i32.store offset=28 + (get_global $assembly/index/context) + ;;@ assembly/index.ts:326:20 + (get_local $0) + ) + ;;@ assembly/index.ts:327:4 + (i32.store offset=32 + (get_global $assembly/index/context) + ;;@ assembly/index.ts:327:21 + (get_local $1) + ) + ;;@ assembly/index.ts:328:15 + (drop + (call $assembly/index/Vec#set + ;;@ assembly/index.ts:328:4 + (i32.load offset=16 + (get_global $assembly/index/context) + ) + ;;@ assembly/index.ts:328:19 + (f64.div + (f64.mul + ;;@ assembly/index.ts:328:20 + (f64.convert_s/i32 + (get_local $0) + ) + ;;@ assembly/index.ts:328:31 + (f64.const 0.5135) + ) + ;;@ assembly/index.ts:328:41 + (f64.convert_s/i32 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:328:51 + (f64.const 0) + ;;@ assembly/index.ts:328:54 + (f64.const 0) + ) + ) + ;;@ assembly/index.ts:332:9 + (drop + (call $assembly/index/Vec#multScalar_in + ;;@ assembly/index.ts:331:9 + (call $assembly/index/Vec#norm_in + ;;@ assembly/index.ts:330:9 + (call $assembly/index/Vec#mod2 + ;;@ assembly/index.ts:329:4 + (i32.load offset=16 + (get_global $assembly/index/context) + ) + ;;@ assembly/index.ts:330:14 + (i32.load offset=4 + (i32.load offset=12 + (get_global $assembly/index/context) + ) + ) + ;;@ assembly/index.ts:330:29 + (i32.load offset=20 + (get_global $assembly/index/context) + ) + ) + ) + ;;@ assembly/index.ts:332:23 + (f64.const 0.5135) + ) + ) + ;;@ assembly/index.ts:333:4 + (set_local $3 + ;;@ assembly/index.ts:333:14 + (i32.mul + (get_local $0) + ;;@ assembly/index.ts:333:18 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:334:4 + (i32.store + (get_global $assembly/index/context) + ;;@ assembly/index.ts:334:21 + (call $~lib/array/Array#constructor + (i32.const 0) + ;;@ assembly/index.ts:334:36 + (get_local $3) + ) + ) + ;;@ assembly/index.ts:335:4 + (block $break|0 + ;;@ assembly/index.ts:335:9 + (set_local $2 + ;;@ assembly/index.ts:335:17 + (i32.const 0) + ) + (loop $repeat|0 + (br_if $break|0 + (i32.eqz + ;;@ assembly/index.ts:335:20 + (i32.lt_s + (get_local $2) + ;;@ assembly/index.ts:335:24 + (get_local $3) + ) + ) + ) + ;;@ assembly/index.ts:336:8 + (call $~lib/array/Array#__set + (i32.load + (get_global $assembly/index/context) + ) + ;;@ assembly/index.ts:336:23 + (get_local $2) + ;;@ assembly/index.ts:336:28 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:29:34 + (f64.const 0) + ;;@ assembly/index.ts:29:57 + (f64.const 0) + ;;@ assembly/index.ts:29:80 + (f64.const 0) + ) + ) + ;;@ assembly/index.ts:335:29 + (set_local $2 + (i32.add + (get_local $2) + (i32.const 1) + ) + ) + (br $repeat|0) + ) + ) + ;;@ assembly/index.ts:338:11 + (get_global $assembly/index/context) + ) + (func $assembly/index/Hit#constructor (; 52 ;) (type $iiFii) (param $0 i32) (param $1 i32) (param $2 f64) (param $3 i32) (result i32) + (local $4 i32) + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $4 + (call $~lib/memory/memory.allocate + (i32.const 20) + ) + ) + (i32.store + (get_local $4) + (get_local $1) + ) + (f64.store offset=8 + (get_local $4) + (get_local $2) + ) + (i32.store offset=16 + (get_local $4) + (get_local $3) + ) + (get_local $4) + ) + ) + ) + ) + ) + (func $assembly/index/Ray#constructor|trampoline (; 53 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (block $2of2 + (block $1of2 + (block $0of2 + (block $outOfRange + (br_table $0of2 $1of2 $2of2 $outOfRange + (get_global $~argc) + ) + ) + (unreachable) + ) + (set_local $1 + ;;@ assembly/index.ts:159:32 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + ) + (set_local $2 + ;;@ assembly/index.ts:159:59 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:29:34 + (f64.const 0) + ;;@ assembly/index.ts:29:57 + (f64.const 0) + ;;@ assembly/index.ts:29:80 + (f64.const 0) + ) + ) + ) + (call $assembly/index/Ray#constructor + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $assembly/index/Hit#constructor|trampoline (; 54 ;) (type $iiFii) (param $0 i32) (param $1 i32) (param $2 f64) (param $3 i32) (result i32) + (block $3of3 + (block $2of3 + (block $1of3 + (block $0of3 + (block $outOfRange + (br_table $0of3 $1of3 $2of3 $3of3 $outOfRange + (get_global $~argc) + ) + ) + (unreachable) + ) + (set_local $1 + ;;@ assembly/index.ts:221:34 + (block (result i32) + (set_global $~argc + (i32.const 0) + ) + (call $assembly/index/Ray#constructor|trampoline + (i32.const 0) + (i32.const 0) + (i32.const 0) + ) + ) + ) + ) + (set_local $2 + ;;@ assembly/index.ts:221:63 + (f64.const 0) + ) + ) + (set_local $3 + ;;@ assembly/index.ts:221:83 + (i32.const -1) + ) + ) + (call $assembly/index/Hit#constructor + (get_local $0) + (get_local $1) + (get_local $2) + (get_local $3) + ) + ) + (func $assembly/index/Locals#constructor (; 55 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $1 + (call $~lib/memory/memory.allocate + (i32.const 108) + ) + ) + (i32.store + (get_local $1) + ;;@ assembly/index.ts:260:17 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:260:25 + (f64.const 0) + ;;@ assembly/index.ts:260:28 + (f64.const 0) + ;;@ assembly/index.ts:260:31 + (f64.const 0) + ) + ) + (i32.store offset=4 + (get_local $1) + ;;@ assembly/index.ts:261:15 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:261:23 + (f64.const 1) + ;;@ assembly/index.ts:261:26 + (f64.const 0) + ;;@ assembly/index.ts:261:29 + (f64.const 0) + ) + ) + (i32.store offset=8 + (get_local $1) + ;;@ assembly/index.ts:262:15 + (block (result i32) + (set_global $~argc + (i32.const 0) + ) + (call $assembly/index/Hit#constructor|trampoline + (i32.const 0) + (i32.const 0) + (f64.const 0) + (i32.const 0) + ) + ) + ) + (i32.store offset=12 + (get_local $1) + ;;@ assembly/index.ts:263:14 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=16 + (get_local $1) + ;;@ assembly/index.ts:264:16 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=20 + (get_local $1) + ;;@ assembly/index.ts:265:16 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=24 + (get_local $1) + ;;@ assembly/index.ts:266:16 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=28 + (get_local $1) + ;;@ assembly/index.ts:267:16 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=32 + (get_local $1) + ;;@ assembly/index.ts:268:16 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=36 + (get_local $1) + ;;@ assembly/index.ts:269:16 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=40 + (get_local $1) + ;;@ assembly/index.ts:270:16 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=44 + (get_local $1) + ;;@ assembly/index.ts:271:16 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=48 + (get_local $1) + ;;@ assembly/index.ts:272:16 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=52 + (get_local $1) + ;;@ assembly/index.ts:273:17 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=56 + (get_local $1) + ;;@ assembly/index.ts:274:17 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=60 + (get_local $1) + ;;@ assembly/index.ts:275:17 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=64 + (get_local $1) + ;;@ assembly/index.ts:276:17 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=68 + (get_local $1) + ;;@ assembly/index.ts:277:17 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=72 + (get_local $1) + ;;@ assembly/index.ts:278:17 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=76 + (get_local $1) + ;;@ assembly/index.ts:279:17 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=80 + (get_local $1) + ;;@ assembly/index.ts:280:17 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=84 + (get_local $1) + ;;@ assembly/index.ts:281:17 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=88 + (get_local $1) + ;;@ assembly/index.ts:282:17 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=92 + (get_local $1) + ;;@ assembly/index.ts:283:17 + (call $assembly/index/Vec#constructor + (i32.const 0) + (f64.const 0) + (f64.const 0) + (f64.const 0) + ) + ) + (i32.store offset=96 + (get_local $1) + ;;@ assembly/index.ts:284:18 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:29:34 + (f64.const 0) + ;;@ assembly/index.ts:29:57 + (f64.const 0) + ;;@ assembly/index.ts:29:80 + (f64.const 0) + ) + ) + (i32.store offset=100 + (get_local $1) + ;;@ assembly/index.ts:285:18 + (block (result i32) + (set_global $~argc + (i32.const 0) + ) + (call $assembly/index/Ray#constructor|trampoline + (i32.const 0) + (i32.const 0) + (i32.const 0) + ) + ) + ) + (i32.store offset=104 + (get_local $1) + ;;@ assembly/index.ts:286:18 + (block (result i32) + (set_global $~argc + (i32.const 0) + ) + (call $assembly/index/Ray#constructor|trampoline + (i32.const 0) + (i32.const 0) + (i32.const 0) + ) + ) + ) + (get_local $1) + ) + ) + ) + ) + ) + (func $assembly/index/createLocals (; 56 ;) (type $i) (result i32) + (local $0 i32) + ;;@ assembly/index.ts:342:4 + (set_local $0 + ;;@ assembly/index.ts:342:17 + (call $assembly/index/Locals#constructor + (i32.const 0) + ) + ) + ;;@ assembly/index.ts:343:11 + (get_local $0) + ) + (func $assembly/index/rand (; 57 ;) (type $F) (result f64) + ;;@ assembly/index.ts:24:25 + (call $~lib/math/JSMath.random) + ) + (func $assembly/index/Ray#set (; 58 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + ;;@ assembly/index.ts:165:15 + (drop + (call $assembly/index/Vec#setFrom + ;;@ assembly/index.ts:165:8 + (i32.load + (get_local $0) + ) + ;;@ assembly/index.ts:165:23 + (get_local $1) + ) + ) + ;;@ assembly/index.ts:166:15 + (drop + (call $assembly/index/Vec#setFrom + ;;@ assembly/index.ts:166:8 + (i32.load offset=4 + (get_local $0) + ) + ;;@ assembly/index.ts:166:23 + (get_local $2) + ) + ) + ;;@ assembly/index.ts:167:15 + (get_local $0) + ) + (func $~lib/array/Array#__get (; 59 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + ;;@ ~lib/array.ts:70:4 + (set_local $2 + ;;@ ~lib/array.ts:70:17 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:73:23 + (if (result i32) + ;;@ ~lib/array.ts:71:11 + (i32.lt_u + (get_local $1) + ;;@ ~lib/array.ts:71:24 + (i32.shr_u + ;;@ ~lib/array.ts:71:30 + (i32.load + (get_local $2) + ) + ;;@ ~lib/array.ts:71:52 + (i32.const 2) + ) + ) + ;;@ ~lib/array.ts:72:8 + (block $~lib/internal/arraybuffer/loadUnsafe|inlined.0 (result i32) + ;;@ ~lib/internal/arraybuffer.ts:68:91 + (i32.load offset=8 + ;;@ ~lib/internal/arraybuffer.ts:68:20 + (i32.add + (get_local $2) + ;;@ ~lib/internal/arraybuffer.ts:68:48 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:68:49 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:68:65 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/array.ts:73:8 + (unreachable) + ) + ) + (func $assembly/index/Sphere#intersect (; 60 ;) (type $iiiF) (param $0 i32) (param $1 i32) (param $2 i32) (result f64) + (local $3 i32) + (local $4 f64) + (local $5 f64) + (local $6 f64) + (local $7 f64) + ;;@ assembly/index.ts:192:8 + (set_local $3 + ;;@ assembly/index.ts:192:29 + (call $assembly/index/Vec#sub2 + ;;@ assembly/index.ts:192:22 + (i32.load offset=8 + (get_local $0) + ) + ;;@ assembly/index.ts:192:34 + (i32.load + (get_local $1) + ) + ;;@ assembly/index.ts:192:39 + (i32.load offset=80 + (get_local $2) + ) + ) + ) + ;;@ assembly/index.ts:194:8 + (set_local $5 + ;;@ assembly/index.ts:194:18 + (f64.const 0.0001) + ) + ;;@ assembly/index.ts:195:8 + (set_local $6 + ;;@ assembly/index.ts:195:19 + (call $assembly/index/Vec#dot + ;;@ assembly/index.ts:195:16 + (get_local $3) + ;;@ assembly/index.ts:195:23 + (i32.load offset=4 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:196:8 + (set_local $7 + ;;@ assembly/index.ts:196:18 + (f64.add + (f64.sub + (f64.mul + (get_local $6) + ;;@ assembly/index.ts:196:22 + (get_local $6) + ) + ;;@ assembly/index.ts:196:29 + (call $assembly/index/Vec#dot + ;;@ assembly/index.ts:196:26 + (get_local $3) + ;;@ assembly/index.ts:196:33 + (get_local $3) + ) + ) + ;;@ assembly/index.ts:196:39 + (f64.mul + (f64.load + (get_local $0) + ) + ;;@ assembly/index.ts:196:50 + (f64.load + (get_local $0) + ) + ) + ) + ) + ;;@ assembly/index.ts:197:8 + (if + ;;@ assembly/index.ts:197:12 + (f64.lt + (get_local $7) + ;;@ assembly/index.ts:197:18 + (f64.const 0) + ) + ;;@ assembly/index.ts:197:21 + (return + ;;@ assembly/index.ts:198:19 + (f64.const 0) + ) + ;;@ assembly/index.ts:199:15 + (set_local $7 + ;;@ assembly/index.ts:200:18 + (f64.sqrt + ;;@ assembly/index.ts:200:30 + (get_local $7) + ) + ) + ) + ;;@ assembly/index.ts:202:67 + (if (result f64) + ;;@ assembly/index.ts:202:15 + (f64.gt + (tee_local $4 + ;;@ assembly/index.ts:202:20 + (f64.sub + (get_local $6) + ;;@ assembly/index.ts:202:24 + (get_local $7) + ) + ) + ;;@ assembly/index.ts:202:31 + (get_local $5) + ) + ;;@ assembly/index.ts:202:37 + (get_local $4) + ;;@ assembly/index.ts:202:41 + (if (result f64) + (f64.gt + (tee_local $4 + ;;@ assembly/index.ts:202:46 + (f64.add + (get_local $6) + ;;@ assembly/index.ts:202:50 + (get_local $7) + ) + ) + ;;@ assembly/index.ts:202:57 + (get_local $5) + ) + ;;@ assembly/index.ts:202:63 + (get_local $4) + ;;@ assembly/index.ts:202:67 + (f64.const 0) + ) + ) + ) + (func $assembly/index/Ray#copy (; 61 ;) (type $iiv) (param $0 i32) (param $1 i32) + ;;@ assembly/index.ts:161:15 + (drop + (call $assembly/index/Vec#setFrom + ;;@ assembly/index.ts:161:8 + (i32.load + (get_local $0) + ) + ;;@ assembly/index.ts:161:23 + (i32.load + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:162:15 + (drop + (call $assembly/index/Vec#setFrom + ;;@ assembly/index.ts:162:8 + (i32.load offset=4 + (get_local $0) + ) + ;;@ assembly/index.ts:162:23 + (i32.load offset=4 + (get_local $1) + ) + ) + ) + ) + (func $assembly/index/intersect (; 62 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 f64) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 f64) + ;;@ assembly/index.ts:228:4 + (set_local $3 + ;;@ assembly/index.ts:228:19 + (f64.const inf) + ) + ;;@ assembly/index.ts:229:4 + (set_local $4 + ;;@ assembly/index.ts:229:18 + (i32.const -1) + ) + ;;@ assembly/index.ts:230:4 + (set_local $6 + ;;@ assembly/index.ts:230:17 + (block $~lib/array/Array#get:length|inlined.0 (result i32) + (set_local $5 + (i32.load offset=24 + (get_global $assembly/index/context) + ) + ) + ;;@ ~lib/array.ts:37:16 + (i32.load offset=4 + ;;@ ~lib/array.ts:37:11 + (get_local $5) + ) + ) + ) + ;;@ assembly/index.ts:231:4 + (set_local $7 + ;;@ assembly/index.ts:231:19 + (f64.const 0) + ) + ;;@ assembly/index.ts:233:4 + (block $break|0 + ;;@ assembly/index.ts:233:9 + (set_local $5 + ;;@ assembly/index.ts:233:17 + (i32.const 0) + ) + (loop $repeat|0 + (br_if $break|0 + (i32.eqz + ;;@ assembly/index.ts:233:20 + (i32.lt_s + (get_local $5) + ;;@ assembly/index.ts:233:24 + (get_local $6) + ) + ) + ) + ;;@ assembly/index.ts:233:32 + (block + ;;@ assembly/index.ts:234:8 + (set_local $7 + ;;@ assembly/index.ts:234:31 + (call $assembly/index/Sphere#intersect + ;;@ assembly/index.ts:234:12 + (call $~lib/array/Array#__get + (i32.load offset=24 + (get_global $assembly/index/context) + ) + ;;@ assembly/index.ts:234:28 + (get_local $5) + ) + ;;@ assembly/index.ts:234:41 + (get_local $0) + ;;@ assembly/index.ts:234:44 + (get_local $2) + ) + ) + ;;@ assembly/index.ts:235:8 + (if + (f64.ne + ;;@ assembly/index.ts:235:12 + (if (result f64) + (f64.ne + (get_local $7) + (f64.const 0) + ) + ;;@ assembly/index.ts:235:17 + (f64.convert_u/i32 + (f64.lt + (get_local $7) + ;;@ assembly/index.ts:235:21 + (get_local $3) + ) + ) + (get_local $7) + ) + (f64.const 0) + ) + ;;@ assembly/index.ts:235:24 + (block + ;;@ assembly/index.ts:236:12 + (set_local $3 + ;;@ assembly/index.ts:236:16 + (get_local $7) + ) + ;;@ assembly/index.ts:237:12 + (set_local $4 + ;;@ assembly/index.ts:237:17 + (get_local $5) + ) + ) + ) + ) + ;;@ assembly/index.ts:233:27 + (set_local $5 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (br $repeat|0) + ) + ) + ;;@ assembly/index.ts:240:4 + (f64.store offset=8 + (get_local $1) + ;;@ assembly/index.ts:240:12 + (get_local $3) + ) + ;;@ assembly/index.ts:241:4 + (i32.store offset=16 + (get_local $1) + ;;@ assembly/index.ts:241:13 + (get_local $4) + ) + ;;@ assembly/index.ts:243:12 + (call $assembly/index/Ray#copy + ;;@ assembly/index.ts:243:4 + (i32.load + (get_local $1) + ) + ;;@ assembly/index.ts:243:17 + (get_local $0) + ) + ;;@ assembly/index.ts:244:11 + (get_local $1) + ) + (func $~lib/array/Array#__unchecked_get (; 63 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + ;;@ ~lib/array.ts:78:46 + (block $~lib/internal/arraybuffer/loadUnsafe|inlined.1 (result i32) + (set_local $2 + ;;@ ~lib/array.ts:78:27 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:68:91 + (i32.load offset=8 + ;;@ ~lib/internal/arraybuffer.ts:68:20 + (i32.add + (get_local $2) + ;;@ ~lib/internal/arraybuffer.ts:68:48 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:68:49 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:68:65 + (i32.const 2) + ) + ) + ) + ) + ) + (func $assembly/index/radiance (; 64 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 f64) + (local $10 f64) + (local $11 f64) + (local $12 f64) + (local $13 i32) + (local $14 i32) + (local $15 i32) + (local $16 i32) + (local $17 i32) + (local $18 i32) + (local $19 i32) + (local $20 i32) + (local $21 f64) + (local $22 f64) + (local $23 f64) + (local $24 f64) + (local $25 f64) + (local $26 i32) + (local $27 i32) + (local $28 f64) + (local $29 f64) + (local $30 f64) + (local $31 f64) + (local $32 f64) + (local $33 f64) + (local $34 f64) + (local $35 f64) + (local $36 f64) + (local $37 i32) + (local $38 i32) + ;;@ assembly/index.ts:348:4 + (drop + (call $assembly/index/intersect + ;;@ assembly/index.ts:348:14 + (get_local $0) + ;;@ assembly/index.ts:348:17 + (i32.load offset=8 + (get_local $3) + ) + ;;@ assembly/index.ts:348:29 + (get_local $3) + ) + ) + ;;@ assembly/index.ts:350:4 + (if + ;;@ assembly/index.ts:350:8 + (f64.eq + (f64.load offset=8 + (i32.load offset=8 + (get_local $3) + ) + ) + ;;@ assembly/index.ts:350:24 + (f64.const inf) + ) + ;;@ assembly/index.ts:350:34 + (return + ;;@ assembly/index.ts:351:15 + (i32.load + (get_local $3) + ) + ) + ) + ;;@ assembly/index.ts:354:4 + (set_local $4 + ;;@ assembly/index.ts:354:22 + (call $~lib/array/Array#__unchecked_get + ;;@ assembly/index.ts:354:32 + (i32.load offset=24 + (get_global $assembly/index/context) + ) + ;;@ assembly/index.ts:354:48 + (i32.load offset=16 + (i32.load offset=8 + (get_local $3) + ) + ) + ) + ) + ;;@ assembly/index.ts:356:8 + (drop + (call $assembly/index/Vec#multScalar2 + ;;@ assembly/index.ts:356:4 + (i32.load offset=4 + (get_local $0) + ) + ;;@ assembly/index.ts:356:20 + (f64.load offset=8 + (i32.load offset=8 + (get_local $3) + ) + ) + ;;@ assembly/index.ts:356:34 + (i32.load offset=16 + (get_local $3) + ) + ) + ) + ;;@ assembly/index.ts:358:4 + (set_local $5 + ;;@ assembly/index.ts:358:29 + (call $assembly/index/Vec#add2 + ;;@ assembly/index.ts:358:17 + (i32.load offset=16 + (get_local $3) + ) + ;;@ assembly/index.ts:358:34 + (i32.load + (get_local $0) + ) + ;;@ assembly/index.ts:358:39 + (i32.load offset=20 + (get_local $3) + ) + ) + ) + ;;@ assembly/index.ts:359:4 + (set_local $6 + ;;@ assembly/index.ts:359:44 + (call $assembly/index/Vec#norm_in + ;;@ assembly/index.ts:359:19 + (call $assembly/index/Vec#sub2 + ;;@ assembly/index.ts:359:17 + (get_local $5) + ;;@ assembly/index.ts:359:24 + (i32.load offset=8 + (get_local $4) + ) + ;;@ assembly/index.ts:359:31 + (i32.load offset=24 + (get_local $3) + ) + ) + ) + ) + ;;@ assembly/index.ts:360:4 + (set_local $7 + ;;@ assembly/index.ts:360:18 + (if (result i32) + (f64.lt + ;;@ assembly/index.ts:360:20 + (call $assembly/index/Vec#dot + ;;@ assembly/index.ts:360:18 + (get_local $6) + ;;@ assembly/index.ts:360:24 + (i32.load offset=4 + (get_local $0) + ) + ) + ;;@ assembly/index.ts:360:31 + (f64.const 0) + ) + ;;@ assembly/index.ts:360:37 + (call $assembly/index/Vec#clone + ;;@ assembly/index.ts:360:35 + (get_local $6) + ;;@ assembly/index.ts:360:43 + (i32.load offset=28 + (get_local $3) + ) + ) + ;;@ assembly/index.ts:360:60 + (call $assembly/index/Vec#multScalar2 + ;;@ assembly/index.ts:360:58 + (get_local $6) + ;;@ assembly/index.ts:360:72 + (f64.const -1) + ;;@ assembly/index.ts:360:76 + (i32.load offset=28 + (get_local $3) + ) + ) + ) + ) + ;;@ assembly/index.ts:361:4 + (if + ;;@ assembly/index.ts:361:8 + (i32.eqz + ;;@ assembly/index.ts:361:9 + (get_local $2) + ) + ;;@ assembly/index.ts:361:12 + (set_local $2 + ;;@ assembly/index.ts:362:12 + (i32.load offset=12 + (get_local $3) + ) + ) + ) + ;;@ assembly/index.ts:364:6 + (drop + (call $assembly/index/Vec#setFrom + ;;@ assembly/index.ts:364:4 + (get_local $2) + ;;@ assembly/index.ts:364:14 + (i32.load offset=16 + (get_local $4) + ) + ) + ) + ;;@ assembly/index.ts:366:4 + (set_local $9 + ;;@ assembly/index.ts:366:19 + (if (result f64) + (if (result i32) + (tee_local $8 + (f64.gt + (f64.load + (get_local $2) + ) + ;;@ assembly/index.ts:366:25 + (f64.load offset=8 + (get_local $2) + ) + ) + ) + ;;@ assembly/index.ts:366:32 + (f64.gt + (f64.load + (get_local $2) + ) + ;;@ assembly/index.ts:366:38 + (f64.load offset=16 + (get_local $2) + ) + ) + (get_local $8) + ) + ;;@ assembly/index.ts:366:44 + (f64.load + (get_local $2) + ) + ;;@ assembly/index.ts:366:50 + (if (result f64) + (f64.gt + (f64.load offset=8 + (get_local $2) + ) + ;;@ assembly/index.ts:366:56 + (f64.load offset=16 + (get_local $2) + ) + ) + ;;@ assembly/index.ts:366:62 + (f64.load offset=8 + (get_local $2) + ) + ;;@ assembly/index.ts:366:68 + (f64.load offset=16 + (get_local $2) + ) + ) + ) + ) + ;;@ assembly/index.ts:367:4 + (if + ;;@ assembly/index.ts:367:8 + (i32.gt_s + (tee_local $1 + (i32.add + ;;@ assembly/index.ts:367:10 + (get_local $1) + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:367:18 + (i32.const 5) + ) + ;;@ assembly/index.ts:367:21 + (block + ;;@ assembly/index.ts:368:8 + (if + ;;@ assembly/index.ts:368:12 + (f64.lt + (call $assembly/index/rand) + ;;@ assembly/index.ts:368:21 + (get_local $9) + ) + ;;@ assembly/index.ts:368:24 + (block + ;;@ assembly/index.ts:369:14 + (drop + (call $assembly/index/Vec#multScalar_in + ;;@ assembly/index.ts:369:12 + (get_local $2) + ;;@ assembly/index.ts:369:28 + (f64.div + (f64.const 1) + ;;@ assembly/index.ts:369:32 + (get_local $9) + ) + ) + ) + ;;@ assembly/index.ts:370:14 + (drop + (call $assembly/index/Vec#setFrom + ;;@ assembly/index.ts:370:12 + (get_local $2) + ;;@ assembly/index.ts:370:22 + (i32.load offset=12 + (get_local $4) + ) + ) + ) + ;;@ assembly/index.ts:371:19 + (return + (get_local $2) + ) + ) + ;;@ assembly/index.ts:372:15 + (block + ;;@ assembly/index.ts:373:14 + (drop + (call $assembly/index/Vec#setFrom + ;;@ assembly/index.ts:373:12 + (get_local $2) + ;;@ assembly/index.ts:373:22 + (i32.load offset=12 + (get_local $4) + ) + ) + ) + ;;@ assembly/index.ts:374:19 + (return + (get_local $2) + ) + ) + ) + (unreachable) + ) + ) + ;;@ assembly/index.ts:378:4 + (if + ;;@ assembly/index.ts:378:8 + (i32.eq + (i32.load offset=20 + (get_local $4) + ) + ;;@ assembly/index.ts:378:20 + (get_global $assembly/index/Refl_t.DIFF) + ) + ;;@ assembly/index.ts:378:33 + (block + ;;@ assembly/index.ts:380:8 + (set_local $10 + ;;@ assembly/index.ts:380:24 + (f64.mul + (f64.mul + (f64.const 2) + ;;@ assembly/index.ts:380:28 + (get_global $~lib/math/NativeMath.PI) + ) + ;;@ assembly/index.ts:380:38 + (call $assembly/index/rand) + ) + ) + ;;@ assembly/index.ts:381:8 + (set_local $11 + ;;@ assembly/index.ts:381:24 + (call $assembly/index/rand) + ) + ;;@ assembly/index.ts:382:8 + (set_local $12 + ;;@ assembly/index.ts:382:25 + (f64.sqrt + ;;@ assembly/index.ts:382:37 + (get_local $11) + ) + ) + ;;@ assembly/index.ts:383:8 + (set_local $8 + ;;@ assembly/index.ts:383:21 + (get_local $7) + ) + ;;@ assembly/index.ts:384:8 + (set_local $13 + ;;@ assembly/index.ts:384:21 + (i32.load offset=32 + (get_local $3) + ) + ) + ;;@ assembly/index.ts:385:8 + (if + ;;@ assembly/index.ts:385:12 + (f64.gt + (f64.abs + ;;@ assembly/index.ts:385:23 + (f64.load + (get_local $8) + ) + ) + ;;@ assembly/index.ts:385:30 + (f64.const 0.1) + ) + ;;@ assembly/index.ts:385:35 + (drop + (call $assembly/index/Vec#set + ;;@ assembly/index.ts:386:12 + (get_local $13) + ;;@ assembly/index.ts:386:18 + (f64.const 0) + ;;@ assembly/index.ts:386:21 + (f64.const 1) + ;;@ assembly/index.ts:386:24 + (f64.const 0) + ) + ) + ;;@ assembly/index.ts:387:15 + (block + ;;@ assembly/index.ts:388:14 + (drop + (call $assembly/index/Vec#set + ;;@ assembly/index.ts:388:12 + (get_local $13) + ;;@ assembly/index.ts:388:18 + (f64.const 1) + ;;@ assembly/index.ts:388:21 + (f64.const 1) + ;;@ assembly/index.ts:388:24 + (f64.const 0) + ) + ) + ;;@ assembly/index.ts:389:24 + (drop + (call $assembly/index/Vec#norm_in + ;;@ assembly/index.ts:389:14 + (call $assembly/index/Vec#mod_in + ;;@ assembly/index.ts:389:12 + (get_local $13) + ;;@ assembly/index.ts:389:21 + (get_local $8) + ) + ) + ) + ) + ) + ;;@ assembly/index.ts:391:8 + (set_local $14 + ;;@ assembly/index.ts:391:23 + (call $assembly/index/Vec#mod2 + ;;@ assembly/index.ts:391:21 + (get_local $8) + ;;@ assembly/index.ts:391:28 + (get_local $13) + ;;@ assembly/index.ts:391:31 + (i32.load offset=36 + (get_local $3) + ) + ) + ) + ;;@ assembly/index.ts:392:8 + (set_local $15 + ;;@ assembly/index.ts:396:13 + (call $assembly/index/Vec#norm_in + ;;@ assembly/index.ts:395:13 + (call $assembly/index/Vec#add_in + ;;@ assembly/index.ts:394:13 + (call $assembly/index/Vec#add_in + ;;@ assembly/index.ts:393:13 + (call $assembly/index/Vec#multScalar_in + ;;@ assembly/index.ts:392:21 + (get_local $13) + ;;@ assembly/index.ts:393:27 + (f64.mul + ;;@ assembly/index.ts:393:34 + (call $~lib/math/JSMath.cos + ;;@ assembly/index.ts:393:38 + (get_local $10) + ) + ;;@ assembly/index.ts:393:44 + (get_local $12) + ) + ) + ;;@ assembly/index.ts:394:22 + (call $assembly/index/Vec#multScalar_in + ;;@ assembly/index.ts:394:20 + (get_local $14) + ;;@ assembly/index.ts:394:36 + (f64.mul + ;;@ assembly/index.ts:394:43 + (call $~lib/math/JSMath.sin + ;;@ assembly/index.ts:394:47 + (get_local $10) + ) + ;;@ assembly/index.ts:394:53 + (get_local $12) + ) + ) + ) + ;;@ assembly/index.ts:395:22 + (call $assembly/index/Vec#multScalar_in + ;;@ assembly/index.ts:395:20 + (get_local $8) + ;;@ assembly/index.ts:395:36 + (f64.sqrt + ;;@ assembly/index.ts:395:48 + (f64.sub + (f64.const 1) + ;;@ assembly/index.ts:395:54 + (get_local $11) + ) + ) + ) + ) + ) + ) + ;;@ assembly/index.ts:397:8 + (set_local $16 + ;;@ assembly/index.ts:397:32 + (call $assembly/index/Ray#set + ;;@ assembly/index.ts:397:18 + (i32.load offset=100 + (get_local $3) + ) + ;;@ assembly/index.ts:397:36 + (get_local $5) + ;;@ assembly/index.ts:397:39 + (get_local $15) + ) + ) + ;;@ assembly/index.ts:398:8 + (set_local $17 + ;;@ assembly/index.ts:398:30 + (call $assembly/index/Vec#set + ;;@ assembly/index.ts:398:18 + (i32.load offset=40 + (get_local $3) + ) + ;;@ assembly/index.ts:398:34 + (f64.const 0) + ;;@ assembly/index.ts:398:37 + (f64.const 0) + ;;@ assembly/index.ts:398:40 + (f64.const 0) + ) + ) + ;;@ assembly/index.ts:399:8 + (drop + (call $assembly/index/radiance + ;;@ assembly/index.ts:399:17 + (get_local $16) + ;;@ assembly/index.ts:399:22 + (get_local $1) + ;;@ assembly/index.ts:399:29 + (get_local $17) + ;;@ assembly/index.ts:399:34 + (get_local $3) + ) + ) + ;;@ assembly/index.ts:400:10 + (drop + (call $assembly/index/Vec#mul_in + ;;@ assembly/index.ts:400:8 + (get_local $2) + ;;@ assembly/index.ts:400:17 + (get_local $17) + ) + ) + ;;@ assembly/index.ts:401:10 + (drop + (call $assembly/index/Vec#add_in + ;;@ assembly/index.ts:401:8 + (get_local $2) + ;;@ assembly/index.ts:401:17 + (i32.load offset=12 + (get_local $4) + ) + ) + ) + ;;@ assembly/index.ts:402:15 + (return + (get_local $2) + ) + ) + ;;@ assembly/index.ts:403:11 + (if + ;;@ assembly/index.ts:403:15 + (i32.eq + (i32.load offset=20 + (get_local $4) + ) + ;;@ assembly/index.ts:403:27 + (get_global $assembly/index/Refl_t.SPEC) + ) + ;;@ assembly/index.ts:403:40 + (block + ;;@ assembly/index.ts:405:8 + (set_local $17 + ;;@ assembly/index.ts:405:21 + (call $assembly/index/Vec#sub2 + ;;@ assembly/index.ts:405:17 + (i32.load offset=4 + (get_local $0) + ) + ;;@ assembly/index.ts:405:28 + (call $assembly/index/Vec#multScalar_in + ;;@ assembly/index.ts:405:26 + (get_local $6) + ;;@ assembly/index.ts:405:42 + (f64.mul + (f64.const 2) + ;;@ assembly/index.ts:405:48 + (call $assembly/index/Vec#dot + ;;@ assembly/index.ts:405:46 + (get_local $6) + ;;@ assembly/index.ts:405:52 + (i32.load offset=4 + (get_local $0) + ) + ) + ) + ) + ;;@ assembly/index.ts:405:59 + (i32.load offset=84 + (get_local $3) + ) + ) + ) + ;;@ assembly/index.ts:406:8 + (set_local $16 + ;;@ assembly/index.ts:406:32 + (call $assembly/index/Ray#set + ;;@ assembly/index.ts:406:18 + (i32.load offset=100 + (get_local $3) + ) + ;;@ assembly/index.ts:406:36 + (get_local $5) + ;;@ assembly/index.ts:406:39 + (get_local $17) + ) + ) + ;;@ assembly/index.ts:407:8 + (set_local $15 + ;;@ assembly/index.ts:407:30 + (call $assembly/index/Vec#set + ;;@ assembly/index.ts:407:18 + (i32.load offset=40 + (get_local $3) + ) + ;;@ assembly/index.ts:407:34 + (f64.const 0) + ;;@ assembly/index.ts:407:37 + (f64.const 0) + ;;@ assembly/index.ts:407:40 + (f64.const 0) + ) + ) + ;;@ assembly/index.ts:408:8 + (drop + (call $assembly/index/radiance + ;;@ assembly/index.ts:408:17 + (get_local $16) + ;;@ assembly/index.ts:408:22 + (get_local $1) + ;;@ assembly/index.ts:408:29 + (get_local $15) + ;;@ assembly/index.ts:408:34 + (get_local $3) + ) + ) + ;;@ assembly/index.ts:409:10 + (drop + (call $assembly/index/Vec#mul_in + ;;@ assembly/index.ts:409:8 + (get_local $2) + ;;@ assembly/index.ts:409:17 + (get_local $15) + ) + ) + ;;@ assembly/index.ts:410:29 + (return + ;;@ assembly/index.ts:410:17 + (call $assembly/index/Vec#add_in + ;;@ assembly/index.ts:410:15 + (get_local $2) + ;;@ assembly/index.ts:410:24 + (i32.load offset=12 + (get_local $4) + ) + ) + ) + ) + ) + ) + ;;@ assembly/index.ts:413:4 + (set_local $18 + ;;@ assembly/index.ts:413:14 + (call $assembly/index/Vec#multScalar2 + ;;@ assembly/index.ts:413:12 + (get_local $6) + ;;@ assembly/index.ts:413:26 + (f64.mul + (f64.const 2) + ;;@ assembly/index.ts:413:32 + (call $assembly/index/Vec#dot + ;;@ assembly/index.ts:413:30 + (get_local $6) + ;;@ assembly/index.ts:413:36 + (i32.load offset=4 + (get_local $0) + ) + ) + ) + ;;@ assembly/index.ts:413:42 + (i32.load offset=88 + (get_local $3) + ) + ) + ) + ;;@ assembly/index.ts:414:8 + (drop + (call $assembly/index/Vec#sub + ;;@ assembly/index.ts:414:4 + (i32.load offset=4 + (get_local $0) + ) + ;;@ assembly/index.ts:414:12 + (get_local $18) + ;;@ assembly/index.ts:414:15 + (i32.const 1) + ) + ) + ;;@ assembly/index.ts:415:4 + (set_local $19 + ;;@ assembly/index.ts:415:37 + (call $assembly/index/Ray#set + ;;@ assembly/index.ts:415:23 + (i32.load offset=100 + (get_local $3) + ) + ;;@ assembly/index.ts:415:41 + (get_local $5) + ;;@ assembly/index.ts:415:44 + (get_local $18) + ) + ) + ;;@ assembly/index.ts:416:4 + (set_local $20 + ;;@ assembly/index.ts:416:21 + (f64.gt + ;;@ assembly/index.ts:416:23 + (call $assembly/index/Vec#dot + ;;@ assembly/index.ts:416:21 + (get_local $6) + ;;@ assembly/index.ts:416:27 + (get_local $7) + ) + ;;@ assembly/index.ts:416:33 + (f64.const 0) + ) + ) + (set_local $21 + ;;@ assembly/index.ts:417:20 + (f64.const 1) + ) + (set_local $22 + ;;@ assembly/index.ts:418:13 + (f64.const 1.5) + ) + ;;@ assembly/index.ts:419:4 + (set_local $23 + ;;@ assembly/index.ts:419:21 + (if (result f64) + (get_local $20) + ;;@ assembly/index.ts:419:28 + (f64.div + (get_local $21) + ;;@ assembly/index.ts:419:33 + (get_local $22) + ) + ;;@ assembly/index.ts:419:38 + (f64.div + (get_local $22) + ;;@ assembly/index.ts:419:43 + (get_local $21) + ) + ) + ) + ;;@ assembly/index.ts:420:4 + (set_local $24 + ;;@ assembly/index.ts:420:25 + (call $assembly/index/Vec#dot + ;;@ assembly/index.ts:420:21 + (i32.load offset=4 + (get_local $0) + ) + ;;@ assembly/index.ts:420:29 + (get_local $7) + ) + ) + ;;@ assembly/index.ts:421:4 + (set_local $25 + ;;@ assembly/index.ts:421:23 + (f64.const 0) + ) + ;;@ assembly/index.ts:423:4 + (if + ;;@ assembly/index.ts:423:8 + (f64.lt + (tee_local $25 + ;;@ assembly/index.ts:423:17 + (f64.sub + (f64.const 1) + ;;@ assembly/index.ts:423:21 + (f64.mul + (f64.mul + (get_local $23) + ;;@ assembly/index.ts:423:27 + (get_local $23) + ) + ;;@ assembly/index.ts:423:33 + (f64.sub + ;;@ assembly/index.ts:423:34 + (f64.const 1) + ;;@ assembly/index.ts:423:38 + (f64.mul + (get_local $24) + ;;@ assembly/index.ts:423:44 + (get_local $24) + ) + ) + ) + ) + ) + ;;@ assembly/index.ts:423:52 + (f64.const 0) + ) + ;;@ assembly/index.ts:423:55 + (block + ;;@ assembly/index.ts:425:8 + (set_local $15 + ;;@ assembly/index.ts:425:30 + (call $assembly/index/Vec#set + ;;@ assembly/index.ts:425:18 + (i32.load offset=40 + (get_local $3) + ) + ;;@ assembly/index.ts:425:34 + (f64.const 0) + ;;@ assembly/index.ts:425:37 + (f64.const 0) + ;;@ assembly/index.ts:425:40 + (f64.const 0) + ) + ) + ;;@ assembly/index.ts:426:8 + (drop + (call $assembly/index/radiance + ;;@ assembly/index.ts:426:17 + (get_local $19) + ;;@ assembly/index.ts:426:26 + (get_local $1) + ;;@ assembly/index.ts:426:33 + (get_local $15) + ;;@ assembly/index.ts:426:38 + (get_local $3) + ) + ) + ;;@ assembly/index.ts:427:10 + (drop + (call $assembly/index/Vec#mul_in + ;;@ assembly/index.ts:427:8 + (get_local $2) + ;;@ assembly/index.ts:427:17 + (get_local $15) + ) + ) + ;;@ assembly/index.ts:428:29 + (return + ;;@ assembly/index.ts:428:17 + (call $assembly/index/Vec#add_in + ;;@ assembly/index.ts:428:15 + (get_local $2) + ;;@ assembly/index.ts:428:24 + (i32.load offset=12 + (get_local $4) + ) + ) + ) + ) + ) + ;;@ assembly/index.ts:431:4 + (set_local $26 + ;;@ assembly/index.ts:431:15 + (call $assembly/index/Vec#multScalar2 + ;;@ assembly/index.ts:431:13 + (get_local $6) + ;;@ assembly/index.ts:431:27 + (f64.mul + (if (result f64) + ;;@ assembly/index.ts:431:28 + (get_local $20) + ;;@ assembly/index.ts:431:35 + (f64.const 1) + ;;@ assembly/index.ts:431:39 + (f64.const -1) + ) + ;;@ assembly/index.ts:431:45 + (f64.add + ;;@ assembly/index.ts:431:46 + (f64.mul + (get_local $24) + ;;@ assembly/index.ts:431:52 + (get_local $23) + ) + ;;@ assembly/index.ts:431:58 + (f64.sqrt + ;;@ assembly/index.ts:431:70 + (get_local $25) + ) + ) + ) + ;;@ assembly/index.ts:431:79 + (i32.load offset=44 + (get_local $3) + ) + ) + ) + ;;@ assembly/index.ts:432:4 + (set_local $27 + ;;@ assembly/index.ts:435:9 + (call $assembly/index/Vec#norm_in + ;;@ assembly/index.ts:434:9 + (call $assembly/index/Vec#sub_in + ;;@ assembly/index.ts:433:9 + (call $assembly/index/Vec#multScalar2 + ;;@ assembly/index.ts:432:20 + (i32.load offset=4 + (get_local $0) + ) + ;;@ assembly/index.ts:433:21 + (get_local $23) + ;;@ assembly/index.ts:433:26 + (i32.load offset=48 + (get_local $3) + ) + ) + ;;@ assembly/index.ts:434:16 + (get_local $26) + ) + ) + ) + (set_local $28 + ;;@ assembly/index.ts:436:19 + (f64.sub + (get_local $22) + ;;@ assembly/index.ts:436:24 + (get_local $21) + ) + ) + (set_local $29 + ;;@ assembly/index.ts:437:12 + (f64.add + (get_local $22) + ;;@ assembly/index.ts:437:17 + (get_local $21) + ) + ) + (set_local $30 + ;;@ assembly/index.ts:438:13 + (f64.div + (f64.mul + ;;@ assembly/index.ts:438:14 + (get_local $28) + ;;@ assembly/index.ts:438:18 + (get_local $28) + ) + ;;@ assembly/index.ts:438:23 + (f64.mul + ;;@ assembly/index.ts:438:24 + (get_local $29) + ;;@ assembly/index.ts:438:28 + (get_local $29) + ) + ) + ) + (set_local $31 + ;;@ assembly/index.ts:439:12 + (f64.sub + (f64.convert_s/i32 + (i32.const 1) + ) + ;;@ assembly/index.ts:439:16 + (if (result f64) + ;;@ assembly/index.ts:439:17 + (get_local $20) + ;;@ assembly/index.ts:439:24 + (f64.neg + ;;@ assembly/index.ts:439:25 + (get_local $24) + ) + ;;@ assembly/index.ts:439:36 + (call $assembly/index/Vec#dot + ;;@ assembly/index.ts:439:31 + (get_local $27) + ;;@ assembly/index.ts:439:40 + (get_local $6) + ) + ) + ) + ) + (set_local $32 + ;;@ assembly/index.ts:440:20 + (f64.add + (get_local $30) + ;;@ assembly/index.ts:440:25 + (f64.mul + (f64.mul + (f64.mul + (f64.mul + (f64.mul + (f64.sub + ;;@ assembly/index.ts:440:26 + (f64.const 1) + ;;@ assembly/index.ts:440:30 + (get_local $30) + ) + ;;@ assembly/index.ts:440:36 + (get_local $31) + ) + ;;@ assembly/index.ts:440:40 + (get_local $31) + ) + ;;@ assembly/index.ts:440:44 + (get_local $31) + ) + ;;@ assembly/index.ts:440:48 + (get_local $31) + ) + ;;@ assembly/index.ts:440:52 + (get_local $31) + ) + ) + ) + (set_local $33 + ;;@ assembly/index.ts:441:13 + (f64.sub + (f64.convert_s/i32 + (i32.const 1) + ) + ;;@ assembly/index.ts:441:17 + (get_local $32) + ) + ) + (set_local $34 + ;;@ assembly/index.ts:442:12 + (f64.add + (f64.const 0.25) + ;;@ assembly/index.ts:442:19 + (f64.mul + (f64.const 0.5) + ;;@ assembly/index.ts:442:25 + (get_local $32) + ) + ) + ) + (set_local $35 + ;;@ assembly/index.ts:443:13 + (f64.div + (get_local $32) + ;;@ assembly/index.ts:443:18 + (get_local $34) + ) + ) + (set_local $36 + ;;@ assembly/index.ts:444:13 + (f64.div + (get_local $33) + ;;@ assembly/index.ts:444:18 + (f64.sub + ;;@ assembly/index.ts:444:19 + (f64.const 1) + ;;@ assembly/index.ts:444:23 + (get_local $34) + ) + ) + ) + ;;@ assembly/index.ts:445:4 + (set_local $37 + ;;@ assembly/index.ts:445:28 + (call $assembly/index/Ray#set + ;;@ assembly/index.ts:445:14 + (i32.load offset=100 + (get_local $3) + ) + ;;@ assembly/index.ts:445:32 + (get_local $5) + ;;@ assembly/index.ts:445:35 + (get_local $27) + ) + ) + ;;@ assembly/index.ts:447:4 + (set_local $38 + ;;@ assembly/index.ts:447:32 + (call $assembly/index/Vec#set + ;;@ assembly/index.ts:447:19 + (i32.load offset=52 + (get_local $3) + ) + ;;@ assembly/index.ts:447:36 + (f64.const 0) + ;;@ assembly/index.ts:447:39 + (f64.const 0) + ;;@ assembly/index.ts:447:42 + (f64.const 0) + ) + ) + ;;@ assembly/index.ts:448:4 + (if + ;;@ assembly/index.ts:448:8 + (i32.gt_s + (get_local $1) + ;;@ assembly/index.ts:448:16 + (i32.const 2) + ) + ;;@ assembly/index.ts:448:19 + (if + ;;@ assembly/index.ts:449:12 + (f64.lt + (call $assembly/index/rand) + ;;@ assembly/index.ts:449:21 + (get_local $34) + ) + ;;@ assembly/index.ts:449:24 + (drop + (call $assembly/index/Vec#multScalar_in + ;;@ assembly/index.ts:450:12 + (call $assembly/index/radiance + ;;@ assembly/index.ts:450:21 + (get_local $19) + ;;@ assembly/index.ts:450:30 + (get_local $1) + ;;@ assembly/index.ts:450:37 + (get_local $38) + ;;@ assembly/index.ts:450:42 + (get_local $3) + ) + ;;@ assembly/index.ts:450:64 + (get_local $35) + ) + ) + ;;@ assembly/index.ts:451:15 + (drop + (call $assembly/index/Vec#multScalar_in + ;;@ assembly/index.ts:452:12 + (call $assembly/index/radiance + ;;@ assembly/index.ts:452:21 + (get_local $37) + ;;@ assembly/index.ts:452:26 + (get_local $1) + ;;@ assembly/index.ts:452:33 + (get_local $38) + ;;@ assembly/index.ts:452:38 + (get_local $3) + ) + ;;@ assembly/index.ts:452:60 + (get_local $36) + ) + ) + ) + ;;@ assembly/index.ts:454:11 + (block + ;;@ assembly/index.ts:455:51 + (drop + (call $assembly/index/Vec#multScalar_in + ;;@ assembly/index.ts:455:8 + (call $assembly/index/radiance + ;;@ assembly/index.ts:455:17 + (get_local $37) + ;;@ assembly/index.ts:455:22 + (get_local $1) + ;;@ assembly/index.ts:455:29 + (i32.load offset=92 + (get_local $3) + ) + ;;@ assembly/index.ts:455:43 + (get_local $3) + ) + ;;@ assembly/index.ts:455:65 + (get_local $33) + ) + ) + ;;@ assembly/index.ts:458:13 + (drop + (call $assembly/index/Vec#add_in + ;;@ assembly/index.ts:457:13 + (call $assembly/index/Vec#multScalar_in + ;;@ assembly/index.ts:456:8 + (call $assembly/index/radiance + ;;@ assembly/index.ts:456:17 + (get_local $19) + ;;@ assembly/index.ts:456:26 + (get_local $1) + ;;@ assembly/index.ts:456:33 + (get_local $38) + ;;@ assembly/index.ts:456:38 + (get_local $3) + ) + ;;@ assembly/index.ts:457:27 + (get_local $32) + ) + ;;@ assembly/index.ts:458:20 + (i32.load offset=92 + (get_local $3) + ) + ) + ) + ) + ) + ;;@ assembly/index.ts:460:6 + (drop + (call $assembly/index/Vec#mul_in + ;;@ assembly/index.ts:460:4 + (get_local $2) + ;;@ assembly/index.ts:460:13 + (get_local $38) + ) + ) + ;;@ assembly/index.ts:461:25 + (call $assembly/index/Vec#add_in + ;;@ assembly/index.ts:461:11 + (get_local $2) + ;;@ assembly/index.ts:461:20 + (i32.load offset=12 + (get_local $4) + ) + ) + ) + (func $assembly/index/clamp (; 65 ;) (type $FF) (param $0 f64) (result f64) + ;;@ assembly/index.ts:215:43 + (if (result f64) + ;;@ assembly/index.ts:215:11 + (f64.lt + (get_local $0) + ;;@ assembly/index.ts:215:15 + (f64.const 0) + ) + ;;@ assembly/index.ts:215:21 + (f64.const 0) + ;;@ assembly/index.ts:215:27 + (if (result f64) + (f64.gt + (get_local $0) + ;;@ assembly/index.ts:215:31 + (f64.const 1) + ) + ;;@ assembly/index.ts:215:37 + (f64.const 1) + ;;@ assembly/index.ts:215:43 + (get_local $0) + ) + ) + ) + (func $~lib/array/Array#__get (; 66 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + ;;@ ~lib/array.ts:70:4 + (set_local $2 + ;;@ ~lib/array.ts:70:17 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:73:23 + (if (result i32) + ;;@ ~lib/array.ts:71:11 + (i32.lt_u + (get_local $1) + ;;@ ~lib/array.ts:71:24 + (i32.shr_u + ;;@ ~lib/array.ts:71:30 + (i32.load + (get_local $2) + ) + ;;@ ~lib/array.ts:71:52 + (i32.const 2) + ) + ) + ;;@ ~lib/array.ts:72:8 + (block $~lib/internal/arraybuffer/loadUnsafe|inlined.0 (result i32) + ;;@ ~lib/internal/arraybuffer.ts:68:91 + (i32.load offset=8 + ;;@ ~lib/internal/arraybuffer.ts:68:20 + (i32.add + (get_local $2) + ;;@ ~lib/internal/arraybuffer.ts:68:48 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:68:49 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:68:65 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/array.ts:73:8 + (unreachable) + ) + ) + (func $assembly/index/render (; 67 ;) (type $iiiiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (param $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 f64) + (local $13 f64) + (local $14 f64) + (local $15 f64) + (local $16 i32) + (local $17 i32) + (local $18 i32) + (local $19 i32) + (local $20 i32) + (local $21 i32) + ;;@ assembly/index.ts:466:4 + (block $break|0 + ;;@ assembly/index.ts:466:9 + (set_local $6 + ;;@ assembly/index.ts:466:22 + (get_local $3) + ) + (loop $repeat|0 + (br_if $break|0 + (i32.eqz + ;;@ assembly/index.ts:466:26 + (i32.lt_s + (get_local $6) + ;;@ assembly/index.ts:466:30 + (i32.add + (get_local $3) + ;;@ assembly/index.ts:466:35 + (get_local $5) + ) + ) + ) + ) + ;;@ assembly/index.ts:469:8 + (block $break|1 + ;;@ assembly/index.ts:469:13 + (set_local $7 + ;;@ assembly/index.ts:469:26 + (get_local $2) + ) + (loop $repeat|1 + (br_if $break|1 + (i32.eqz + ;;@ assembly/index.ts:469:30 + (i32.lt_s + (get_local $7) + ;;@ assembly/index.ts:469:34 + (i32.add + (get_local $2) + ;;@ assembly/index.ts:469:39 + (get_local $4) + ) + ) + ) + ) + ;;@ assembly/index.ts:471:12 + (block $break|2 + ;;@ assembly/index.ts:471:17 + (set_local $8 + ;;@ assembly/index.ts:471:31 + (i32.const 0) + ) + (loop $repeat|2 + (br_if $break|2 + (i32.eqz + ;;@ assembly/index.ts:471:34 + (i32.lt_s + (get_local $8) + ;;@ assembly/index.ts:471:39 + (i32.const 2) + ) + ) + ) + ;;@ assembly/index.ts:471:48 + (block + ;;@ assembly/index.ts:473:16 + (set_local $9 + ;;@ assembly/index.ts:473:24 + (i32.add + (i32.mul + (get_local $6) + ;;@ assembly/index.ts:473:28 + (i32.load offset=28 + (get_global $assembly/index/context) + ) + ) + ;;@ assembly/index.ts:473:44 + (get_local $7) + ) + ) + ;;@ assembly/index.ts:475:16 + (block $break|3 + ;;@ assembly/index.ts:475:21 + (set_local $10 + ;;@ assembly/index.ts:475:35 + (i32.const 0) + ) + (loop $repeat|3 + (br_if $break|3 + (i32.eqz + ;;@ assembly/index.ts:475:38 + (i32.lt_s + (get_local $10) + ;;@ assembly/index.ts:475:43 + (i32.const 2) + ) + ) + ) + ;;@ assembly/index.ts:475:52 + (block + ;;@ assembly/index.ts:476:34 + (drop + (call $assembly/index/Vec#set + ;;@ assembly/index.ts:476:20 + (i32.load offset=96 + (get_local $0) + ) + ;;@ assembly/index.ts:476:38 + (f64.const 0) + ;;@ assembly/index.ts:476:41 + (f64.const 0) + ;;@ assembly/index.ts:476:44 + (f64.const 0) + ) + ) + ;;@ assembly/index.ts:477:20 + (block $break|4 + ;;@ assembly/index.ts:477:25 + (set_local $11 + ;;@ assembly/index.ts:477:38 + (i32.const 0) + ) + (loop $repeat|4 + (br_if $break|4 + (i32.eqz + ;;@ assembly/index.ts:477:41 + (i32.lt_s + (get_local $11) + ;;@ assembly/index.ts:477:45 + (get_local $1) + ) + ) + ) + ;;@ assembly/index.ts:477:57 + (block + ;;@ assembly/index.ts:478:24 + (set_local $12 + ;;@ assembly/index.ts:478:40 + (f64.mul + (f64.const 2) + ;;@ assembly/index.ts:478:46 + (call $assembly/index/rand) + ) + ) + ;;@ assembly/index.ts:479:24 + (set_local $13 + ;;@ assembly/index.ts:479:33 + (if (result f64) + (f64.lt + (get_local $12) + ;;@ assembly/index.ts:479:38 + (f64.const 1) + ) + ;;@ assembly/index.ts:479:44 + (f64.sub + (f64.sqrt + ;;@ assembly/index.ts:479:56 + (get_local $12) + ) + ;;@ assembly/index.ts:479:62 + (f64.const 1) + ) + ;;@ assembly/index.ts:479:68 + (f64.sub + (f64.const 1) + ;;@ assembly/index.ts:479:74 + (f64.sqrt + ;;@ assembly/index.ts:479:86 + (f64.sub + (f64.const 2) + ;;@ assembly/index.ts:479:92 + (get_local $12) + ) + ) + ) + ) + ) + ;;@ assembly/index.ts:480:24 + (set_local $14 + ;;@ assembly/index.ts:480:40 + (f64.mul + (f64.const 2) + ;;@ assembly/index.ts:480:46 + (call $assembly/index/rand) + ) + ) + ;;@ assembly/index.ts:481:24 + (set_local $15 + ;;@ assembly/index.ts:481:33 + (if (result f64) + (f64.lt + (get_local $14) + ;;@ assembly/index.ts:481:38 + (f64.const 1) + ) + ;;@ assembly/index.ts:481:44 + (f64.sub + (f64.sqrt + ;;@ assembly/index.ts:481:56 + (get_local $14) + ) + ;;@ assembly/index.ts:481:62 + (f64.const 1) + ) + ;;@ assembly/index.ts:481:68 + (f64.sub + (f64.const 1) + ;;@ assembly/index.ts:481:74 + (f64.sqrt + ;;@ assembly/index.ts:481:86 + (f64.sub + (f64.const 2) + ;;@ assembly/index.ts:481:92 + (get_local $14) + ) + ) + ) + ) + ) + ;;@ assembly/index.ts:482:24 + (set_local $16 + ;;@ assembly/index.ts:482:44 + (call $assembly/index/Vec#multScalar2 + ;;@ assembly/index.ts:482:33 + (i32.load offset=16 + (get_global $assembly/index/context) + ) + ;;@ assembly/index.ts:483:28 + (f64.sub + ;;@ assembly/index.ts:483:36 + (f64.div + (f64.add + ;;@ assembly/index.ts:483:37 + (f64.div + (f64.add + ;;@ assembly/index.ts:483:38 + (f64.add + (f64.convert_s/i32 + (get_local $10) + ) + ;;@ assembly/index.ts:483:43 + (f64.const 0.5) + ) + ;;@ assembly/index.ts:483:49 + (get_local $13) + ) + ;;@ assembly/index.ts:483:55 + (f64.const 2) + ) + (f64.convert_s/i32 + ;;@ assembly/index.ts:483:61 + (get_local $7) + ) + ) + (f64.convert_s/i32 + ;;@ assembly/index.ts:483:66 + (i32.load offset=28 + (get_global $assembly/index/context) + ) + ) + ) + ;;@ assembly/index.ts:483:82 + (f64.const 0.5) + ) + ;;@ assembly/index.ts:484:28 + (i32.load offset=56 + (get_local $0) + ) + ) + ) + ;;@ assembly/index.ts:486:24 + (set_local $17 + ;;@ assembly/index.ts:486:44 + (call $assembly/index/Vec#multScalar2 + ;;@ assembly/index.ts:486:33 + (i32.load offset=20 + (get_global $assembly/index/context) + ) + ;;@ assembly/index.ts:487:28 + (f64.sub + ;;@ assembly/index.ts:487:36 + (f64.div + (f64.add + ;;@ assembly/index.ts:487:37 + (f64.div + (f64.add + ;;@ assembly/index.ts:487:38 + (f64.add + (f64.convert_s/i32 + (get_local $8) + ) + ;;@ assembly/index.ts:487:43 + (f64.const 0.5) + ) + ;;@ assembly/index.ts:487:49 + (get_local $15) + ) + ;;@ assembly/index.ts:487:55 + (f64.const 2) + ) + (f64.convert_s/i32 + ;;@ assembly/index.ts:487:61 + (get_local $6) + ) + ) + (f64.convert_s/i32 + ;;@ assembly/index.ts:487:66 + (i32.load offset=32 + (get_global $assembly/index/context) + ) + ) + ) + ;;@ assembly/index.ts:487:83 + (f64.const 0.5) + ) + ;;@ assembly/index.ts:488:28 + (i32.load offset=60 + (get_local $0) + ) + ) + ) + ;;@ assembly/index.ts:490:27 + (drop + (call $assembly/index/Vec#add_in + ;;@ assembly/index.ts:490:24 + (get_local $16) + ;;@ assembly/index.ts:490:34 + (get_local $17) + ) + ) + ;;@ assembly/index.ts:491:27 + (drop + (call $assembly/index/Vec#add_in + ;;@ assembly/index.ts:491:24 + (get_local $16) + ;;@ assembly/index.ts:491:34 + (i32.load offset=4 + (i32.load offset=12 + (get_global $assembly/index/context) + ) + ) + ) + ) + ;;@ assembly/index.ts:492:24 + (set_local $18 + ;;@ assembly/index.ts:492:36 + (call $assembly/index/Vec#multScalar2 + ;;@ assembly/index.ts:492:33 + (get_local $16) + ;;@ assembly/index.ts:492:48 + (f64.const 140) + ;;@ assembly/index.ts:492:53 + (i32.load offset=64 + (get_local $0) + ) + ) + ) + ;;@ assembly/index.ts:493:27 + (drop + (call $assembly/index/Vec#add_in + ;;@ assembly/index.ts:493:24 + (get_local $18) + ;;@ assembly/index.ts:493:34 + (i32.load + (i32.load offset=12 + (get_global $assembly/index/context) + ) + ) + ) + ) + ;;@ assembly/index.ts:494:24 + (set_local $19 + ;;@ assembly/index.ts:494:36 + (call $assembly/index/Vec#norm_in + ;;@ assembly/index.ts:494:33 + (get_local $16) + ) + ) + ;;@ assembly/index.ts:495:24 + (set_local $20 + ;;@ assembly/index.ts:495:48 + (call $assembly/index/Ray#set + ;;@ assembly/index.ts:495:34 + (i32.load offset=104 + (get_local $0) + ) + ;;@ assembly/index.ts:495:52 + (get_local $18) + ;;@ assembly/index.ts:495:56 + (get_local $19) + ) + ) + ;;@ assembly/index.ts:496:24 + (set_local $21 + ;;@ assembly/index.ts:496:34 + (call $assembly/index/radiance + ;;@ assembly/index.ts:496:43 + (get_local $20) + ;;@ assembly/index.ts:496:48 + (i32.const 0) + ;;@ assembly/index.ts:496:51 + (i32.load offset=72 + (get_local $0) + ) + ;;@ assembly/index.ts:496:65 + (get_local $0) + ) + ) + ;;@ assembly/index.ts:497:28 + (drop + (call $assembly/index/Vec#multScalar_in + ;;@ assembly/index.ts:497:24 + (get_local $21) + ;;@ assembly/index.ts:497:42 + (f64.div + (f64.const 1) + ;;@ assembly/index.ts:497:48 + (f64.convert_s/i32 + (get_local $1) + ) + ) + ) + ) + ;;@ assembly/index.ts:498:38 + (drop + (call $assembly/index/Vec#add_in + ;;@ assembly/index.ts:498:24 + (i32.load offset=96 + (get_local $0) + ) + ;;@ assembly/index.ts:498:45 + (get_local $21) + ) + ) + ) + ;;@ assembly/index.ts:477:52 + (set_local $11 + (i32.add + (get_local $11) + (i32.const 1) + ) + ) + (br $repeat|4) + ) + ) + ;;@ assembly/index.ts:502:20 + (set_local $15 + ;;@ assembly/index.ts:502:29 + (call $assembly/index/clamp + ;;@ assembly/index.ts:502:35 + (f64.load + (i32.load offset=96 + (get_local $0) + ) + ) + ) + ) + ;;@ assembly/index.ts:503:20 + (set_local $14 + ;;@ assembly/index.ts:503:29 + (call $assembly/index/clamp + ;;@ assembly/index.ts:503:35 + (f64.load offset=8 + (i32.load offset=96 + (get_local $0) + ) + ) + ) + ) + ;;@ assembly/index.ts:504:20 + (set_local $13 + ;;@ assembly/index.ts:504:29 + (call $assembly/index/clamp + ;;@ assembly/index.ts:504:35 + (f64.load offset=16 + (i32.load offset=96 + (get_local $0) + ) + ) + ) + ) + ;;@ assembly/index.ts:505:20 + (set_local $11 + ;;@ assembly/index.ts:505:42 + (call $assembly/index/Vec#set + ;;@ assembly/index.ts:505:29 + (i32.load offset=76 + (get_local $0) + ) + ;;@ assembly/index.ts:505:46 + (get_local $15) + ;;@ assembly/index.ts:505:50 + (get_local $14) + ;;@ assembly/index.ts:505:54 + (get_local $13) + ) + ) + ;;@ assembly/index.ts:506:23 + (drop + (call $assembly/index/Vec#multScalar_in + ;;@ assembly/index.ts:506:20 + (get_local $11) + ;;@ assembly/index.ts:506:37 + (f64.const 0.55) + ) + ) + ;;@ assembly/index.ts:508:20 + (set_local $21 + ;;@ assembly/index.ts:508:29 + (call $~lib/array/Array#__get + (i32.load + (get_global $assembly/index/context) + ) + ;;@ assembly/index.ts:508:44 + (get_local $9) + ) + ) + ;;@ assembly/index.ts:509:23 + (drop + (call $assembly/index/Vec#add_in + ;;@ assembly/index.ts:509:20 + (get_local $21) + ;;@ assembly/index.ts:509:30 + (get_local $11) + ) + ) + ) + ;;@ assembly/index.ts:475:46 + (set_local $10 + (i32.add + (get_local $10) + (i32.const 1) + ) + ) + (br $repeat|3) + ) + ) + ) + ;;@ assembly/index.ts:471:42 + (set_local $8 + (i32.add + (get_local $8) + (i32.const 1) + ) + ) + (br $repeat|2) + ) + ) + ;;@ assembly/index.ts:469:42 + (set_local $7 + (i32.add + (get_local $7) + (i32.const 1) + ) + ) + (br $repeat|1) + ) + ) + ;;@ assembly/index.ts:466:38 + (set_local $6 + (i32.add + (get_local $6) + (i32.const 1) + ) + ) + (br $repeat|0) + ) + ) + ) + (func $start (; 68 ;) (type $v) + (set_global $~lib/allocator/atomic/startOffset + ;;@ ~lib/allocator/atomic.ts:3:25 + (i32.and + (i32.add + ;;@ ~lib/allocator/atomic.ts:3:26 + (get_global $HEAP_BASE) + ;;@ ~lib/allocator/atomic.ts:3:38 + (get_global $~lib/internal/allocator/AL_MASK) + ) + ;;@ ~lib/allocator/atomic.ts:3:49 + (i32.xor + ;;@ ~lib/allocator/atomic.ts:3:50 + (get_global $~lib/internal/allocator/AL_MASK) + (i32.const -1) + ) + ) + ) + (set_global $~lib/allocator/atomic/offset_ptr + ;;@ ~lib/allocator/atomic.ts:4:24 + (get_global $~lib/allocator/atomic/startOffset) + ) + ;;@ ~lib/allocator/atomic.ts:5:0 + (i32.store + ;;@ ~lib/allocator/atomic.ts:5:13 + (get_global $~lib/allocator/atomic/offset_ptr) + ;;@ ~lib/allocator/atomic.ts:5:25 + (i32.and + (i32.add + ;;@ ~lib/allocator/atomic.ts:5:26 + (i32.add + (get_global $HEAP_BASE) + ;;@ ~lib/allocator/atomic.ts:5:38 + (i32.const 4) + ) + ;;@ ~lib/allocator/atomic.ts:5:42 + (get_global $~lib/internal/allocator/AL_MASK) + ) + ;;@ ~lib/allocator/atomic.ts:5:53 + (i32.xor + ;;@ ~lib/allocator/atomic.ts:5:54 + (get_global $~lib/internal/allocator/AL_MASK) + (i32.const -1) + ) + ) + ) + (nop) + (nop) + ) + (func $null (; 69 ;) (type $v) + ) + (func $assembly/index/Vec#constructor|trampoline (; 70 ;) (type $iFFFi) (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f64) (result i32) + (block $3of3 + (block $2of3 + (block $1of3 + (block $0of3 + (block $outOfRange + (br_table $0of3 $1of3 $2of3 $3of3 $outOfRange + (get_global $~argc) + ) + ) + (unreachable) + ) + (set_local $1 + ;;@ assembly/index.ts:29:34 + (f64.const 0) + ) + ) + (set_local $2 + ;;@ assembly/index.ts:29:57 + (f64.const 0) + ) + ) + (set_local $3 + ;;@ assembly/index.ts:29:80 + (f64.const 0) + ) + ) + (call $assembly/index/Vec#constructor + (get_local $0) + (get_local $1) + (get_local $2) + (get_local $3) + ) + ) + (func $~setargc (; 71 ;) (type $iv) (param $0 i32) + (set_global $~argc + (get_local $0) + ) + ) + (func $Vec#get:x (; 72 ;) (type $iF) (param $0 i32) (result f64) + (f64.load + (get_local $0) + ) + ) + (func $Vec#set:x (; 73 ;) (type $iFv) (param $0 i32) (param $1 f64) + (f64.store + (get_local $0) + (get_local $1) + ) + ) + (func $Vec#get:y (; 74 ;) (type $iF) (param $0 i32) (result f64) + (f64.load offset=8 + (get_local $0) + ) + ) + (func $Vec#set:y (; 75 ;) (type $iFv) (param $0 i32) (param $1 f64) + (f64.store offset=8 + (get_local $0) + (get_local $1) + ) + ) + (func $Vec#get:z (; 76 ;) (type $iF) (param $0 i32) (result f64) + (f64.load offset=16 + (get_local $0) + ) + ) + (func $Vec#set:z (; 77 ;) (type $iFv) (param $0 i32) (param $1 f64) + (f64.store offset=16 + (get_local $0) + (get_local $1) + ) + ) + (func $assembly/index/Vec#sub|trampoline (; 78 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (block $1of1 + (block $0of1 + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange + (i32.sub + (get_global $~argc) + (i32.const 1) + ) + ) + ) + (unreachable) + ) + (set_local $2 + ;;@ assembly/index.ts:64:32 + (i32.const 0) + ) + ) + (call $assembly/index/Vec#sub + (get_local $0) + (get_local $1) + (get_local $2) + ) + ) + (func $assembly/index/Vec#clone|trampoline (; 79 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (block $1of1 + (block $0of1 + (block $outOfRange + (br_table $0of1 $1of1 $outOfRange + (get_global $~argc) + ) + ) + (unreachable) + ) + (set_local $1 + ;;@ assembly/index.ts:150:19 + (call $assembly/index/Vec#constructor + (i32.const 0) + ;;@ assembly/index.ts:29:34 + (f64.const 0) + ;;@ assembly/index.ts:29:57 + (f64.const 0) + ;;@ assembly/index.ts:29:80 + (f64.const 0) + ) + ) + ) + (call $assembly/index/Vec#clone + (get_local $0) + (get_local $1) + ) + ) +) diff --git a/examples/smallpt/index.html b/examples/smallpt/index.html new file mode 100644 index 0000000000..dfbc35aef4 --- /dev/null +++ b/examples/smallpt/index.html @@ -0,0 +1,91 @@ + + + + + Path Tracing 3D Rendering - AssemblyScript + + + + + + +

+ Path Tracing 3D Rendering in + AssemblyScript + ( + source + ) + +

+
+

CPU Profile

+
+
+ +
START
+
+ + + + diff --git a/examples/smallpt/js/index.js b/examples/smallpt/js/index.js new file mode 100644 index 0000000000..a8769d9dc1 --- /dev/null +++ b/examples/smallpt/js/index.js @@ -0,0 +1,294 @@ +"use strict"; +var width = 64 * 10; +var height = 64 * 10; +var bucketSize = 64; +const canvas = document.getElementById("viewport"); +const stage = document.getElementById("stage"); +const startStopBtn = document.getElementById("startStopBtn"); +const profiler = document.getElementById("profiler"); +canvas.width = width; +canvas.height = height; +stage.style.width = `${width}px`; +stage.style.height = `${height}px`; +stage.style.left = `calc((100vw - ${width}px)/2)`; +stage.style.top = `calc(calc((100vh - ${height}px)/2) - 90px)`; +const ctx = canvas.getContext("2d"); +let imageData = ctx.getImageData(0, 0, width, height); +let data = imageData.data; + +const memory = new WebAssembly.Memory({ + initial: 32767, + maximum: 32767, + shared: true, +}); +const numCPU = navigator.hardwareConcurrency - 1; +let profiles = []; +let workers = []; +let numWorkersInited = 0; +let numWorkersDone = 0; +let numWorkersStarted = 0; +let workersReady = false; +let batchDone = false; +let isTracing = false; +let jobs = []; +let queue = []; +var context_ptr; +var pixels_ptr; +var iterations = 0; +var maxIterations = 1; +let startTime = 0; +let wasmModule; +let wasmLibModule; +var memoryView = new DataView(memory.buffer); + +async function init() { + const res = await fetch("build/optimized.wasm"); + const libRes = await fetch("lib/lib.wasm"); + const buffer = await res.arrayBuffer(); + const libBuffer = await libRes.arrayBuffer(); + wasmModule = await WebAssembly.compile(buffer); + wasmLibModule = await WebAssembly.compile(libBuffer); + for (let i = 0; i < numCPU; i++) { + let worker = new Worker("./js/worker.js"); + worker.onmessage = onWorkerMessage; + workers.push(worker); + let cpuTime = document.createElement("div", { class: "cpu-time" }); + profiler.appendChild(cpuTime); + profiles.push({ el: cpuTime, time: 0 }); + } + + var col = width / bucketSize; + var row = height / bucketSize; + var count = 0; + for (var j = 0; j < row; j++) { + for (var i = 0; i < col; i++) { + jobs.push({ + id: j + "_" + i, + iterations: 1, + startTime: 0, + duration: ++count, + samples: 4, + width: bucketSize, + height: bucketSize, + xoffset: i * bucketSize, + yoffset: j * bucketSize, + }); + } + } + initWorker(0); + // requestAnimationFrame(render) +} + +function initWorker(index, memoryTop) { + workers[index].postMessage({ + command: "init", + id: index + 1, + wasmModule, + wasmLibModule, + memory, + width, + height, + memoryTop, + context_ptr, + }); +} + +function onWorkerMessage(e) { + const data = e.data; + // console.log(data) + switch (data.event) { + case "inited": { + if (data.pixels_ptr) { + pixels_ptr = data.pixels_ptr; + console.log("pixels_ptr:" + pixels_ptr); + } + if (data.context_ptr) { + context_ptr = data.context_ptr; + console.log("context_ptr:" + context_ptr); + } + numWorkersInited++; + if (numWorkersInited === workers.length) { + workersReady = true; + startStopBtn.onclick = toggleTracer; + if (isTracing) { + start(); + } + } else { + initWorker(numWorkersInited, data.memoryTop); + } + break; + } + case "done": { + numWorkersDone++; + let job = jobs.find(job => job.id === data.job.id); + if (job) { + job.duration = Date.now() - job.startTime; + const index = data.id - 1; + if (profiles[index]) { + profiles[index].el.innerText = "Thread #" + data.id + " " + job.duration + " ms"; + } else { + console.log(index); + } + } + + updateFrame(data.job); + if (numWorkersDone >= numWorkersStarted) { + batchDone = true; + numWorkersDone = 0; + numWorkersStarted = 0; + if (iterations > maxIterations) { + const time = Date.now() - startTime; + console.log(`Finished ${Math.round(time / 1000)}`); + return; + } + start(); + } + break; + } + } +} + +function toggleTracer() { + isTracing = !isTracing; + if (isTracing) { + startStopBtn.innerText = "STOP"; + if (workersReady) { + startTime = Date.now(); + start(); + } + } else { + startStopBtn.innerText = "START"; + } +} + +async function run(job, worker) { + if (!isTracing) { + return; + } + return new Promise(async function(resolve) { + updateIndicator(job); + await sleep(); + job.startTime = Date.now(); + worker.postMessage({ command: "run", job }); + job.iterations++; + await sleep(); + resolve(); + }); +} + +async function start() { + await render(); +} + +async function sleep() { + return new Promise(function(resolve) { + setTimeout(resolve, 0); + }); +} + +async function render() { + // console.time('rendered in') + if (!isTracing) { + return; + } + if (queue.length == 0) { + queue = jobs.sort((a, b) => a.duration - b.duration).concat(); + iterations++; + } + let promises = []; + workers.forEach((worker, i) => { + let job = queue.shift(); + if (job) { + promises.push(run(job, worker)); + numWorkersStarted++; + } + }); + await Promise.all(promises); +} + +function updateFrame(job) { + let pixels = readPixels(pixels_ptr, memoryView); + // console.timeEnd('rendered in') + // console.time('write time') + for (let y = job.yoffset; y < job.yoffset + job.height; y++) { + for (let x = job.xoffset; x < job.xoffset + job.width; x++) { + // let i = (height - y - 1) * width + x + var i = y * (width * 4) + x * 4; + var pi = y * (width * 3) + x * 3; + + data[i] = (pixels[pi] / job.iterations) * 255; + data[i + 1] = (pixels[pi + 1] / job.iterations) * 255; + data[i + 2] = (pixels[pi + 2] / job.iterations) * 255; + + data[i + 3] = 255; + } + } + + ctx.putImageData(imageData, 0, 0); +} + +function readPixels(ptr, memory, arrayType = "Float64") { + const floatSize = + arrayType.indexOf("8") > -1 + ? 1 + : arrayType.indexOf("16") > -1 + ? 2 + : arrayType.indexOf("32") > -1 + ? 4 + : arrayType.indexOf("64") > -1 + ? 8 + : 1; + + const AB_ptr = memory.getUint32(ptr, true); + const length = memory.getUint32(ptr + 4, true); + let element_ptr = AB_ptr + 8; + let rgb = new self[arrayType + "Array"](length * 3); + let p = 0; + + for (let i = 0; i < length; i++) { + const vec_ptr = memory.getUint32(element_ptr, true); + + rgb[p++] = memory["get" + arrayType](vec_ptr, true); + rgb[p++] = memory["get" + arrayType](vec_ptr + floatSize, true); + rgb[p++] = memory["get" + arrayType](vec_ptr + 2 * floatSize, true); + + element_ptr += 4; + } + + return rgb; +} + +function updateIndicator(rect) { + var color = { r: Math.random(), g: Math.random(), b: Math.random() }; + + //top-left + fillRect({ x: rect.xoffset, y: rect.yoffset, width: 4, height: 1 }, color); + fillRect({ x: rect.xoffset, y: rect.yoffset + 1, width: 1, height: 3 }, color); + + //top-right + fillRect({ x: rect.xoffset + rect.width - 4, y: rect.yoffset, width: 4, height: 1 }, color); + fillRect({ x: rect.xoffset + rect.width - 1, y: rect.yoffset + 1, width: 1, height: 3 }, color); + + //bottom-left + fillRect({ x: rect.xoffset, y: rect.yoffset + rect.height - 4, width: 1, height: 4 }, color); + fillRect({ x: rect.xoffset + 1, y: rect.yoffset + rect.height - 1, width: 3, height: 1 }, color); + + //bottom-right + fillRect({ x: rect.xoffset + rect.width - 4, y: rect.yoffset + rect.height - 1, width: 4, height: 1 }, color); + fillRect({ x: rect.xoffset + rect.width - 1, y: rect.yoffset + rect.height - 4, width: 1, height: 3 }, color); + + ctx.putImageData(imageData, 0, 0); +} +function fillRect(rect, color) { + for (var y = rect.y; y < rect.y + rect.height; y++) { + for (var x = rect.x; x < rect.x + rect.width; x++) { + var i = y * (width * 4) + x * 4; + data[i] = color.r * 255; + data[i + 1] = color.g * 255; + data[i + 2] = color.b * 255; + data[i + 3] = 255; + } + } + ctx.putImageData(imageData, 0, 0); +} +init(); diff --git a/examples/smallpt/js/worker.js b/examples/smallpt/js/worker.js new file mode 100644 index 0000000000..2441f24fbb --- /dev/null +++ b/examples/smallpt/js/worker.js @@ -0,0 +1,70 @@ +addEventListener("message", onMessageReceived, false); + +let wasmInstance; +let wasmExp; +let pixels_ptr; +let context_ptr; +let locals_ptr; +let id; + +async function onMessageReceived(e) { + try { + const data = e.data; + + switch (data.command) { + case "init": { + id = data.id; + const lib = await WebAssembly.instantiate(data.wasmLibModule, { + env: { + __syscall2: Date.now + } + }) + console.log(lib) + const instance = await WebAssembly.instantiate(data.wasmModule, { + env: { + memory: data.memory, + abort: function () { }, + }, + lib: lib.exports, + JSMath: Math, + index: { + id: data.id, + logf: f => console.log("float:" + f), + logi: i => console.log("int:" + i), + }, + }); + + wasmInstance = instance; + wasmExp = instance.exports; + if (id == 1) { + context_ptr = wasmExp.createContext(data.width, data.height); + pixels_ptr = wasmExp.getPixels(); + locals_ptr = wasmExp.createLocals(); + let memoryTop = wasmExp.GET_MEMORY_TOP(); + postMessage({ event: "inited", context_ptr, memoryTop, pixels_ptr }); + } else { + wasmExp.SET_MEMORY_TOP(data.memoryTop); + // setTimeout(() => { + context_ptr = data.context_ptr; + wasmExp.setContext(context_ptr); + pixels_ptr = wasmExp.getPixels(); + locals_ptr = wasmExp.createLocals(); + let memoryTop = wasmExp.GET_MEMORY_TOP(); + postMessage({ event: "inited", memoryTop }); + // }, id * 100); + } + // console.log(`-----------------------------------`); + break; + } + case "run": { + pixels_ptr = wasmExp.getPixels(); + const { job } = data; + wasmExp.render(locals_ptr, job.samples, job.xoffset, job.yoffset, job.width, job.height); + postMessage({ event: "done", job, id }); + break; + } + } + } catch(e) { + console.log(e); + } +} diff --git a/examples/smallpt/package.json b/examples/smallpt/package.json new file mode 100644 index 0000000000..66f195e374 --- /dev/null +++ b/examples/smallpt/package.json @@ -0,0 +1,15 @@ +{ + "name": "@assemblyscript/shared-memory-example", + "version": "1.0.0", + "private": true, + "scripts": { + "asbuild:untouched": "asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --sourceMap --importMemory --sharedMemory=32767 --validate", + "asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat -O3 --importMemory --sharedMemory=32767 --validate --noDebug --noAssert", + "asbuild": "npm run asbuild:untouched && npm run asbuild:optimized", + "build": "npm run asbuild", + "watch": "nodemon --exec 'npm run asbuild:untouched' ./assembly/index.ts", + "server": "http-server . -o -c-1", + "test": "node tests" + }, + "devDependencies": {} +} diff --git a/examples/smallpt/yarn.lock b/examples/smallpt/yarn.lock new file mode 100644 index 0000000000..fb57ccd13a --- /dev/null +++ b/examples/smallpt/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + diff --git a/lib/parse/assembly/buffer/index.ts b/lib/parse/assembly/buffer/index.ts new file mode 100644 index 0000000000..647a901440 --- /dev/null +++ b/lib/parse/assembly/buffer/index.ts @@ -0,0 +1,94 @@ +import "allocator/arena"; + +export class Buffer { + buffer: Uint8Array; + length: usize; + off: usize; + + /** Current offset in memory. */ + constructor(array: Uint8Array){ + this.buffer = array + this.off = array.buffer.data; + this.length = array.byteLength; + } + + + /** Reads an unsigned integer from memory. */ + readUint(): u32 { + var pos = this.off; + var val = load(pos); + this.off = pos + sizeof(); + return val; + } + + peakUint(): u32 { + return (load(this.off)); + } + + /** Reads an unsigned 64-bit integer from memory. */ + readUint64(): u64 { + var pos = this.off; + var val = load(pos); + this.off = pos + 8; + return val; + } + + /** Reads a LEB128-encoded unsigned integer from memory. */ + readVaruint(size: u32): u32 { + var val: u32 = 0; + var shl: u32 = 0; + var byt: u32; + var pos = this.off; + do { + byt = load(pos++); + val |= (byt & 0x7F) << shl; + if (!(byt & 0x80)) break; + shl += 7; + } while (true); + this.off = pos; + return val; + } + + peekVaruint(size: u32): u32 { + let before = this.off; + let res = this.readVaruint(size); + this .off = before; + return res; + } + + /** Reads a LEB128-encoded signed integer from memory. */ + readVarint(size: u32): i32 { + var val: u32 = 0; + var shl: u32 = 0; + var byt: u32; + var pos = this.off; + do { + byt = load(pos++); + val |= (byt & 0x7F) << shl; + shl += 7; + } while (byt & 0x80); + this.off = pos; + return select(val | (~0 << shl), val, shl < size && (byt & 0x40) != 0); + } + + readVarint8(size: u32): i8 { + return changetype(this.readVarint(size)); + } + + /** Reads a LEB128-encoded signed 64-bit integer from memory. */ + readVarint64(): i64 { + var val: u64 = 0; + var shl: u64 = 0; + var byt: u64; + var pos = this.off; + do { + byt = load(pos++); + val |= (byt & 0x7F) << shl; + shl += 7; + } while (byt & 0x80); + this.off = pos; + return select(val | (~0 << shl), val, shl < 64 && (byt & 0x40) != 0); + } + + +} diff --git a/lib/parse/assembly/host/index.ts b/lib/parse/assembly/host/index.ts new file mode 100644 index 0000000000..a5ab069c08 --- /dev/null +++ b/lib/parse/assembly/host/index.ts @@ -0,0 +1,26 @@ +// Imported callbacks +export declare function _log(x: T, size: usize): void; +export declare function _log_str(x: string): void; +export declare function _logi(x: i32): void; +export declare function _logf(x: f32): void; + + +export function log(item: T):void { + if (isReference()) { + if (isString()) { + _log_str(changetype(item)); + } else { + _log(changetype(item), offsetof()); + } + } else { + if (isInteger()) { + _logi(item); + } else { + _logf(item); + } + } +} + +export function log_str(item: string): void { + log(item); +} diff --git a/lib/parse/assembly/index.ts b/lib/parse/assembly/index.ts index ed11da9a3f..7a156dfff5 100644 --- a/lib/parse/assembly/index.ts +++ b/lib/parse/assembly/index.ts @@ -11,397 +11,114 @@ import { Opcode } from "../src/common"; -import * as opt from "./options"; +export {memory} +import {Buffer} from './buffer'; +import {SectionHeader, + TypeSection, + Module} from './module'; +import {log} from './host'; -/** Current offset in memory. */ -var off: usize = 0; +declare function debug():void; -/** Reads an unsigned integer from memory. */ -function readUint(): u32 { - var pos = off; - var val = load(pos); - off = pos + sizeof(); - return val; -} +// type FunctionName = string | symbol; +// type Instance = [Function, Object]; +// +// let instance: Object; +// let methods: Map = new Map(); -/** Reads an unsigned 64-bit integer from memory. */ -function readUint64(): u64 { - var pos = off; - var val = load(pos); - off = pos + 8; - return val; -} +// function registerClass(name:string): any { +// type Ctor = new (...args: any[]) => T; +// return (target: T): Ctor => { +// // Save a reference to the original constructor +// const Original = target; +// let self:T = this; +// debugger; +// // the new constructor behaviour +// let decoratedConstructor: any = function(...args: any[]): void { +// // log("Before construction:"); +// // +// Original.apply(this, args); +// instance = this; +// // console.log("After construction: ", self.instance !== undefined); +// }; +// +// // Copy prototype so intanceof operator still works +// decoratedConstructor.prototype = Original.prototype; +// // Copy static members too +// Object.keys(Original).forEach((name: string) => +// { decoratedConstructor[name] = (Original)[name]; }); +// +// // Return new constructor (will override original) +// return decoratedConstructor; +// }; +// +// } -/** Reads a LEB128-encoded unsigned integer from memory. */ -function readVaruint(size: u32): u32 { - var val: u32 = 0; - var shl: u32 = 0; - var byt: u32; - var pos = off; - do { - byt = load(pos++); - val |= (byt & 0x7F) << shl; - if (!(byt & 0x80)) break; - shl += 7; - } while (true); - off = pos; - return val; -} +let type: TypeSection; -/** Reads a LEB128-encoded signed integer from memory. */ -function readVarint(size: u32): i32 { - var val: u32 = 0; - var shl: u32 = 0; - var byt: u32; - var pos = off; - do { - byt = load(pos++); - val |= (byt & 0x7F) << shl; - shl += 7; - } while (byt & 0x80); - off = pos; - return select(val | (~0 << shl), val, shl < size && (byt & 0x40) != 0); +export function getType(m: Module): string { + let headers:SectionHeader[] = m.getID(SectionId.Type); + let section = new TypeSection(headers[0]); + type = section.parse(m.buf); + return type.toString(); } -/** Reads a LEB128-encoded signed 64-bit integer from memory. */ -function readVarint64(): i64 { - var val: u64 = 0; - var shl: u64 = 0; - var byt: u64; - var pos = off; - do { - byt = load(pos++); - val |= (byt & 0x7F) << shl; - shl += 7; - } while (byt & 0x80); - off = pos; - return select(val | (~0 << shl), val, shl < 64 && (byt & 0x40) != 0); +export function toString(t:TypeSection): string { + return t.toString(); } -function skipInitExpr(): void { - var op = readUint(); - switch (op) { - case Opcode.i32_const: { - readVarint(32); - break; - } - case Opcode.i64_const: { - readVarint64(); - break; - } - case Opcode.f32_const: { - readUint(); - break; - } - case Opcode.f64_const: { - readUint64(); - break; - } - case Opcode.get_global: { - readVaruint(32); - break; - } - default: unreachable(); // MVP - } - if (readUint() != Opcode.end) unreachable(); -} +export class Parser { + buf: Buffer; + module: Module; + constructor(buf: Buffer){ + this.buf = buf; + this.module = new Module(buf); + } + + parseString(): String { + return String.fromUTF8(this.buf.off,this.buf.readVaruint(32)); + } + + readVaruint(len: usize): u32 { + return this.buf.readVaruint(len); + } + + get off(): usize { + return this.buf.off; + } + + set off(u: usize) { + this.buf.off = u; + } /** Starts parsing the module that has been placed in memory. */ -export function parse(begin: usize, end: usize): void { - off = begin; - var magic = readUint(); - if (magic != 0x6D736100) unreachable(); - var version = readUint(); - if (version != 1) unreachable(); - var fun_space_index: u32 = 0; - var glo_space_index: u32 = 0; - var mem_space_index: u32 = 0; - var tbl_space_index: u32 = 0; - while (off < end) { - let section_off = off; - let id = readVaruint(7); - let payload_len = readVaruint(32); - let name_off = 0; - let name_len = 0; - if (!id) { - let before = off; - name_len = readVaruint(32); - name_off = off; - off += name_len; - payload_len -= off - before; - } else if (id > SectionId.Data) unreachable(); - let payload_off = off; - if (opt.onSection( - id, - payload_off, - payload_len, - name_off, - name_len - )) { - switch (id) { - case SectionId.Type: { - let count = readVaruint(32); - for (let index: u32 = 0; index < count; ++index) { - let form = readVarint(7) & 0x7f; - opt.onType( - index, - form - ); - let paramCount = readVaruint(32); - for (let paramIndex: u32 = 0; paramIndex < paramCount; ++paramIndex) { - let paramType = readVarint(7) & 0x7f; - opt.onTypeParam( - index, - paramIndex, - paramType - ); - } - let returnCount = readVaruint(1); // MVP - for (let returnIndex: u32 = 0; returnIndex < returnCount; ++returnIndex) { - let returnType = readVarint(7) & 0x7f; - opt.onTypeReturn( - index, - returnIndex, - returnType - ); - } - } - break; - } - case SectionId.Import: { - let count = readVaruint(32); - for (let index: u32 = 0; index < count; ++index) { - let module_len = readVaruint(32); - let module_off = off; - off += module_len; - let field_len = readVaruint(32); - let field_off = off; - off += field_len; - let kind = readUint(); - opt.onImport( - index, - kind, - module_off, - module_len, - field_off, - field_len - ); - switch (kind) { - case ExternalKind.Function: { - let type = readVaruint(32); - opt.onFunctionImport( - fun_space_index++, - type - ); - break; - } - case ExternalKind.Table: { - let type = readVarint(7) & 0x7f; - let flags = readVaruint(1); - let initial = readVaruint(32); - let maximum = flags & 1 ? readVaruint(32) : MAX_ELEMS; - opt.onTableImport( - tbl_space_index++, - type, - initial, - maximum, - flags - ); - break; - } - case ExternalKind.Memory: { - let flags = readVaruint(1); - let initial = readVaruint(32); - let maximum = flags & 1 ? readVaruint(32) : MAX_PAGES; - opt.onMemoryImport( - mem_space_index++, - initial, - maximum, - flags - ); - break; - } - case ExternalKind.Global: { - let type = readVarint(7) & 0x7f; - let mutability = readVaruint(1); - opt.onGlobalImport( - glo_space_index++, - type, - mutability - ); - break; - } - default: unreachable(); - } - } - break; - } - case SectionId.Function: { - let count = readVaruint(32); - for (let i: u32 = 0; i < count; ++i) { - let typeIndex = readVaruint(32); - opt.onFunction( - fun_space_index++, - typeIndex - ); - } - break; - } - case SectionId.Table: { - let count = readVaruint(32); - for (let index: u32 = 0; index < count; ++index) { - let type = readVaruint(7) & 0x7f; - let flags = readVaruint(1); - let initial = readVaruint(32); - let maximum = flags & 1 ? readVaruint(32) : MAX_ELEMS; - opt.onTable( - tbl_space_index++, - type, - initial, - maximum, - flags - ); - } - break; - } - case SectionId.Memory: { - let count = readVaruint(32); - for (let index: u32 = 0; index < count; ++index) { - let flags = readVaruint(1); - let initial = readVaruint(32); - let maximum = flags & 1 ? readVaruint(32) : MAX_PAGES; - opt.onMemory( - mem_space_index++, - initial, - maximum, - flags - ); - } - break; - } - case SectionId.Global: { - let count = readVaruint(32); - for (let i: u32 = 0; i < count; ++i) { - let type = readVarint(7) & 0x7f; - let mutability = readVaruint(1); - skipInitExpr(); - opt.onGlobal( - glo_space_index++, - type, - mutability - ); - } - break; - } - case SectionId.Export: { - let count = readVaruint(32); - for (let index: u32 = 0; index < count; ++index) { - let field_len = readVaruint(32); - let field_off = off; - off += field_len; - let kind = readUint(); - let kind_index = readVaruint(32); - opt.onExport( - index, - kind, - kind_index, - field_off, - field_len - ); - } - break; - } - case SectionId.Start: { - let index = readVaruint(32); - opt.onStart( - index - ); - break; - } - case SectionId.Custom: { - if ( - name_len == 4 && - load(name_off) == 0x656D616E // "name" - ) { - let name_type = readVaruint(7); - let name_payload_len = readVaruint(32); - let name_payload_off = off; - switch (name_type) { - case NameType.Module: { - let module_name_len = readVaruint(32); - let module_name_off = off; - opt.onModuleName( - module_name_off, - module_name_len - ); - break; - } - case NameType.Function: { - let count = readVaruint(32); - for (let i: u32 = 0; i < count; ++i) { - let fn_index = readVaruint(32); - let fn_name_len = readVaruint(32); - let fn_name_off = off; - off += fn_name_len; - opt.onFunctionName( - fn_index, - fn_name_off, - fn_name_len - ); - } - break; - } - case NameType.Local: { - let count = readVaruint(32); - for (let i: u32 = 0; i < count; ++i) { - let fn_index = readVaruint(32); - let lc_count = readVaruint(32); - for (let j: u32 = 0; j < lc_count; ++j) { - let lc_index = readVaruint(32); - let lc_name_len = readVaruint(32); - let lc_name_off = off; - off += lc_name_len; - opt.onLocalName( - fn_index, - lc_index, - lc_name_off, - lc_name_len - ); - } - } - break; - } - default: unreachable(); - } - off = name_payload_off + name_payload_len; // ignore errors - break; - } else if ( - name_len == 16 && - load(name_off ) == 0x614D656372756F73 && // "sourceMa" - load(name_off + 8) == 0x4C5255676E697070 // "ppingURL" - ) { - let url_len = readVaruint(32); - let url_off = off; - off += url_len; - opt.onSourceMappingURL( - url_off, - url_len - ); - } - off = payload_off + payload_len; // ignore errors - break; - } - case SectionId.Element: - case SectionId.Code: - case SectionId.Data: { // skip - off += payload_len; - break; - } - default: unreachable(); - } - } else { // skip - off += payload_len; + parse(): void { + var magic = this.buf.readUint(); + if (magic != 0x6D736100) unreachable(); + var version = this.buf.readUint(); + if (version != 1) unreachable(); + var fun_space_index: u32 = 0; + var glo_space_index: u32 = 0; + var mem_space_index: u32 = 0; + var tbl_space_index: u32 = 0; + while (this.buf.off < this.buf.length) { + // log("parsing next section", true); + let header: SectionHeader = new SectionHeader(this.buf); + this.module.parseSection(header); + this.off = header.end; + // log(this.off); } + // log(this.buf.length); + // if (this.off != this.buf.length) unreachable(); } - if (off != end) unreachable(); + +} + +export function newParser(buf: Uint8Array): Parser { + let buffer = new Buffer(buf); + return new Parser(buffer); +} +export function parse(p: Parser): Module { + p.parse(); + return p.module; } diff --git a/lib/parse/assembly/module/exports.ts b/lib/parse/assembly/module/exports.ts new file mode 100644 index 0000000000..e1ba6bb519 --- /dev/null +++ b/lib/parse/assembly/module/exports.ts @@ -0,0 +1,14 @@ + + +export class Export { + name: String; + + constructor(public index: u32, public kind: u32, public kindIndex: u32, public nameOffset: u32, nameLength: u32){ + this.name = String.fromUTF8(nameOffset, nameLength); + + } +} + +export function onExport(index: u32, kind: u32, kindIndex: u32, nameOffset: u32, nameLength: u32): Export { + return new Export(index, kind, kindIndex, nameOffset, nameLength); +} diff --git a/lib/parse/assembly/module/imports.ts b/lib/parse/assembly/module/imports.ts new file mode 100644 index 0000000000..dbbd223f85 --- /dev/null +++ b/lib/parse/assembly/module/imports.ts @@ -0,0 +1,10 @@ + + +export class Import { + + constructor(public index: u32, public kind: u32, public moduleOff: u32, public moduleLen: u32, public fieldOff: u32, public fieldLen: u32){} +} + +export function onImport(index: u32, kind: u32, moduleOff: u32, moduleLen: u32, fieldOff: u32, fieldLen: u32): Import { + return new Import(index, kind, moduleOff, moduleLen, fieldOff, fieldLen); +} diff --git a/lib/parse/assembly/module/index.ts b/lib/parse/assembly/module/index.ts new file mode 100644 index 0000000000..34db29b570 --- /dev/null +++ b/lib/parse/assembly/module/index.ts @@ -0,0 +1,493 @@ +import { + Type, + SectionId, + ExternalKind, + NameType, + MAX_PAGES, + MAX_ELEMS, + Opcode +} from "../../src/common"; + +import {Buffer} from '../buffer'; + +import {log, log_str} from "../host"; + +import {itoa} from 'internal/number'; + +type byte = u8; + + +export class Module { + Headers: SectionHeader[]; + buf: Buffer; + // Custom: TypeSection[]; + + constructor(buf: Buffer){ + this.buf = buf; + this.Headers = []; + } + + + get Type(): SectionHeader[]{ + return this.getID(SectionId.Type); + } + // Import: TypeSection[]; + // Function: TypeSection[]; + // Table: TypeSection[]; + // Memory: TypeSection[]; + // Global: TypeSection[]; + // Export: TypeSection[]; + // Start: TypeSection[]; + // Element: TypeSection[]; + // Code: TypeSection[]; + // Data: TypeSection[]; + + + parseSection(header: SectionHeader): void { + this.Headers.push(header); + switch (header.id){ + case SectionId.Type: + // this._Type.push(header); + break; + default: + } + // log_str(header.name); + } + + public getID(id: SectionId): SectionHeader[] { + let res: SectionHeader[] = []; + let x: i32 = this.Headers.length; + for (let i=0; i < x; i++){ + if (this.Headers[i].id == id){ + res.push(this.Headers[i]); + } + } + return res; + } + + getType(): TypeSection { + let Types = this.Type; + let section = new TypeSection(Types[0]); + return section.parse(this.buf); + } + +} + +function typeName(t: Type): string{ + switch (t){ + case 0x7f: + return 'i32'; + case 0x7e: + return 'i64'; + case 0x7d: + return 'f32'; + case 0x7c: + return 'f64'; + case 0x70: + return 'anyfunc'; + case 0x60: + return 'func'; + case 0x40: + return 'none'; + default: + unreachable(); + } + return "" +} + +function sectionName(s: SectionId): string { + switch (s){ + case 0: + return "Custom" + case 1: + return "Type" + case 2: + return "Import" + case 3: + return "Function" + case 4: + return "Table" + case 5: + return "Memory" + case 6: + return "Global" + case 7: + return "Export" + case 8: + return "Start" + case 9: + return "Element" + case 10: + return "Code" + case 11: + return "Data" + default: + unreachable(); + } + + return ""; +} + +export class SectionHeader { + public ref: u32; + public id: u32; + public payload_len: u32; + public payload_off: u32; + public name: string = ""; + + constructor (buf: Buffer){ + this.ref = buf.off; + this.id = buf.readVaruint(7); + this.payload_len = buf.readVaruint(32); + if (this.id == 0){ + let before = buf.off; + let name_len = buf.readVaruint(32); + let name_off = buf.off; + this.name = "'" + String.fromUTF8(name_off, name_len) + "'"; + buf.off += name_len; + this.payload_len -= buf.off - before; + } else if (this.id <= SectionId.Data){ + this.name = sectionName(this.id); + } else { + unreachable(); + } + this.payload_off = buf.off; + } + + get end(): u32{ + return this.payload_off + this.payload_len; + } + +} + +class Section { + constructor(public header: SectionHeader){} +} +// static create(buf: Buffer): Section { +// // log("Creating Section", true); +// let header = new SectionHeader(buf); +// let off = buf.off; +// let id = buf.peekVaruint(7); +// assert (off == buf.off); +// switch (id){ +// case SectionId.Type: +// let s = new TypeSection(header); +// return (s.parse(buf)); +// default: +// } +// let s = (new BaseSection(header)) +// return s.parse(buf); +// } +// } +// +// +// export class BaseSection extends Section { +// +// // constructor(public header: SectionHeader){} +// +// parse(buf: Buffer): BaseSection { +// log("SubClass", true); +// return this; +// } +// } + + +class FuncType { + public parameters: i32[]; + public returnVals: i32[]; + constructor(public index: u32, public form: i8){ + } + + + + toString(): string { + let index = itoa(this.index); + let form = typeName(this.form); + let parameters:string = ""; + for (let i = 0; i< this.parameters.length; i++){ + parameters += typeName(this.parameters[i]); + parameters = i < this.parameters.length -1 ? parameters += ", ": parameters; + } + let returnVal = this.returnVals.length == 1 ? typeName(this.returnVals[0]) : "void"; + return "index: " + index + ", " + "form: " + form + ", (" + parameters + ") => " + returnVal; + } +} + +export class TypeSection { + header: SectionHeader + funcs: FuncType[]; + constructor(header: SectionHeader){ + this.header = header; + this.funcs = []; + } + + // constructor(public header: SectionHeader){} + parse(buf: Buffer): TypeSection { + buf.off = this.header.payload_off; + let count = buf.readVaruint(32); + let func: FuncType[] = new Array(count); + for (let index: u32 = 0; index < count; ++index) { + let form = buf.readVarint8(7) & 0x7f; + let fun = new FuncType(index, form); + func[index] = fun; + let paramCount = buf.readVaruint(32); + fun.parameters = new Array(paramCount); + for (let paramIndex: u32 = 0; paramIndex < paramCount; ++paramIndex) { + let paramType = buf.readVarint8(7) & 0x7f; + func[index].parameters[paramIndex]=paramType; + } + + let returnCount = buf.readVaruint(1); // MVP + func[index].returnVals = new Array(returnCount); + for (let returnIndex: u32 = 0; returnIndex < returnCount; ++returnIndex) { + let returnType = buf.readVarint8(7) & 0x7f; + func[index].returnVals[returnIndex] = returnType; + } + log(func[index].toString()); + } + return this; + } + + toString(): string { + let strs: string[] = []; + for (let i=0; i< this.funcs.length; i++){ + strs.push(this.funcs[i].toString()); + } + return strs.join('\n'); + } + +} + +/* +case SectionId.Import: { + let count = buf.readVaruint(32); + for (let index: u32 = 0; index < count; ++index) { + let module_len = buf.readVaruint(32); + let module_off = off; + off += module_len; + let field_len = buf.readVaruint(32); + let field_off = off; + off += field_len; + let kind = readUint(); + opt.onImport( + index, + kind, + module_off, + module_len, + field_off, + field_len + ); + switch (kind) { + case ExternalKind.Function: { + let type = buf.readVaruint(32); + opt.onFunctionImport( + fun_space_index++, + type + ); + break; + } + case ExternalKind.Table: { + let type = buf.readVarint(7) & 0x7f; + let flags = buf.readVaruint(1); + let initial = buf.readVaruint(32); + let maximum = flags & 1 ? buf.readVaruint(32) : MAX_ELEMS; + opt.onTableImport( + tbl_space_index++, + type, + initial, + maximum, + flags + ); + break; + } + case ExternalKind.Memory: { + let flags = buf.readVaruint(1); + let initial = buf.readVaruint(32); + let maximum = flags & 1 ? buf.readVaruint(32) : MAX_PAGES; + opt.onMemoryImport( + mem_space_index++, + initial, + maximum, + flags + ); + break; + } + case ExternalKind.Global: { + let type = buf.readVarint(7) & 0x7f; + let mutability = buf.readVaruint(1); + opt.onGlobalImport( + glo_space_index++, + type, + mutability + ); + break; + } + default: unreachable(); + } + } + break; +} +case SectionId.Function: { + let count = buf.readVaruint(32); + for (let i: u32 = 0; i < count; ++i) { + let typeIndex = buf.readVaruint(32); + opt.onFunction( + fun_space_index++, + typeIndex + ); + } + break; +} +case SectionId.Table: { + let count = buf.readVaruint(32); + for (let index: u32 = 0; index < count; ++index) { + let type = buf.readVaruint(7) & 0x7f; + let flags = buf.readVaruint(1); + let initial = buf.readVaruint(32); + let maximum = flags & 1 ? buf.readVaruint(32) : MAX_ELEMS; + opt.onTable( + tbl_space_index++, + type, + initial, + maximum, + flags + ); + } + break; +} +case SectionId.Memory: { + let count = buf.readVaruint(32); + for (let index: u32 = 0; index < count; ++index) { + let flags = buf.readVaruint(1); + let initial = buf.readVaruint(32); + let maximum = flags & 1 ? buf.readVaruint(32) : MAX_PAGES; + opt.onMemory( + mem_space_index++, + initial, + maximum, + flags + ); + } + break; +} +case SectionId.Global: { + let count = buf.readVaruint(32); + for (let i: u32 = 0; i < count; ++i) { + let type = buf.readVarint(7) & 0x7f; + let mutability = buf.readVaruint(1); + skipInitExpr(); + opt.onGlobal( + glo_space_index++, + type, + mutability + ); + } + break; +} +case SectionId.Export: { + let count = buf.readVaruint(32); + for (let index: u32 = 0; index < count; ++index) { + let field_len = buf.readVaruint(32); + let field_off = off; + off += field_len; + let kind = readUint(); + let kind_index = buf.readVaruint(32); + opt.onExport( + index, + kind, + kind_index, + field_off, + field_len + ); + } + break; +} +case SectionId.Start: { + let index = buf.readVaruint(32); + opt.onStart( + index + ); + break; +} +case SectionId.Custom: { + if ( + name_len == 4 && + load(name_off) == 0x656D616E // "name" + ) { + let name_type = buf.readVaruint(7); + let name_payload_len = buf.readVaruint(32); + let name_payload_off = off; + switch (name_type) { + case NameType.Module: { + let module_name_len = buf.readVaruint(32); + let module_name_off = off; + opt.onModuleName( + module_name_off, + module_name_len + ); + break; + } + case NameType.Function: { + let count = buf.readVaruint(32); + for (let i: u32 = 0; i < count; ++i) { + let fn_index = buf.readVaruint(32); + let fn_name_len = buf.readVaruint(32); + let fn_name_off = off; + off += fn_name_len; + opt.onFunctionName( + fn_index, + fn_name_off, + fn_name_len + ); + } + break; + } + case NameType.Local: { + let count = buf.readVaruint(32); + for (let i: u32 = 0; i < count; ++i) { + let fn_index = buf.readVaruint(32); + let lc_count = buf.readVaruint(32); + for (let j: u32 = 0; j < lc_count; ++j) { + let lc_index = buf.readVaruint(32); + let lc_name_len = buf.readVaruint(32); + let lc_name_off = off; + off += lc_name_len; + opt.onLocalName( + fn_index, + lc_index, + lc_name_off, + lc_name_len + ); + } + } + break; + } + default: unreachable(); + } + off = name_payload_off + name_payload_len; // ignore errors + break; + } else if ( + name_len == 16 && + load(name_off ) == 0x614D656372756F73 && // "sourceMa" + load(name_off + 8) == 0x4C5255676E697070 // "ppingURL" + ) { + let url_len = buf.readVaruint(32); + let url_off = off; + off += url_len; + opt.onSourceMappingURL( + url_off, + url_len + ); + } + off = payload_off + payload_len; // ignore errors + break; +} +case SectionId.Element: +case SectionId.Code: +case SectionId.Data: { // skip + off += payload_len; + break; +} +default: unreachable(); +} +*/ diff --git a/lib/parse/assembly/module/instructions/index.ts b/lib/parse/assembly/module/instructions/index.ts new file mode 100644 index 0000000000..ed78d5e57a --- /dev/null +++ b/lib/parse/assembly/module/instructions/index.ts @@ -0,0 +1,360 @@ + +import { + Type, + Opcode +} from "../../src/common"; + +import {Buffer} from "../buffer"; + + +// export function parseExpr(): Instruction[] { +// let inst = Instruction.parse(); +// let instructions: Instruction[] = []; +// while (inst.opcode != Opcode.end && inst.opcode != Opcode.else_){ +// instructions.push(inst); +// // inst = Instruction.parse(); +// } +// instructions.push(inst) +// return instructions +// +// } + +export class Instruction { + constructor(public opcode: Opcode){ + } + + static parse(buf: Buffer): Instruction { + let byte: u8 = changetype(buf.readUint()); + switch(byte){ + case Opcode.unreachable: + case Opcode.nop: + case Opcode.block: + case Opcode.loop: + case Opcode.if_: + case Opcode.else_: + case Opcode.end: + case Opcode.br: + case Opcode.br_if: + case Opcode.br_table: + case Opcode.return_: + case Opcode.call: + case Opcode.call_indirect: { + return ControlInstruction.parse(byte); + } + case Opcode.drop: + case Opcode.select: + return new ParametricInstruction(byte); + case Opcode.get_local: + case Opcode.set_local: + case Opcode.tee_local: + case Opcode.get_global: + case Opcode.set_global: + return new VariableInstruction(byte); + case Opcode.i32_load: + case Opcode.i64_load: + case Opcode.f32_load: + case Opcode.f64_load: + case Opcode.i32_load8_s: + case Opcode.i32_load8_u: + case Opcode.i32_load16_s: + case Opcode.i32_load16_u: + case Opcode.i64_load8_s: + case Opcode.i64_load8_u: + case Opcode.i64_load16_s: + case Opcode.i64_load16_u: + case Opcode.i64_load32_s: + case Opcode.i64_load32_u: + case Opcode.i32_store: + case Opcode.i64_store: + case Opcode.f32_store: + case Opcode.f64_store: + case Opcode.i32_store8: + case Opcode.i32_store16: + case Opcode.i64_store8: + case Opcode.i64_store16: + case Opcode.i64_store32: + case Opcode.current_memory: + case Opcode.grow_memory: + return new MemoryInstruction(byte); + case Opcode.i32_const: + return new I32_Const(byte); + case Opcode.i64_const: + return new I64_Const(byte); + case Opcode.f32_const: + return new F32_Const(byte); + case Opcode.f64_const: + return new F64_Const(byte); + case Opcode.i32_eqz: + case Opcode.i32_eq: + case Opcode.i32_ne: + case Opcode.i32_lt_s: + case Opcode.i32_lt_u: + case Opcode.i32_gt_s: + case Opcode.i32_gt_u: + case Opcode.i32_le_s: + case Opcode.i32_le_u: + case Opcode.i32_ge_s: + case Opcode.i32_ge_u: + case Opcode.i64_eqz: + case Opcode.i64_eq: + case Opcode.i64_ne: + case Opcode.i64_lt_s: + case Opcode.i64_lt_u: + case Opcode.i64_gt_s: + case Opcode.i64_gt_u: + case Opcode.i64_le_s: + case Opcode.i64_le_u: + case Opcode.i64_ge_s: + case Opcode.i64_ge_u: + case Opcode.f32_eq: + case Opcode.f32_ne: + case Opcode.f32_lt: + case Opcode.f32_gt: + case Opcode.f32_le: + case Opcode.f32_ge: + case Opcode.f64_eq: + case Opcode.f64_ne: + case Opcode.f64_lt: + case Opcode.f64_gt: + case Opcode.f64_le: + case Opcode.f64_ge: + case Opcode.i32_clz: + case Opcode.i32_ctz: + case Opcode.i32_popcnt: + case Opcode.i32_add: + case Opcode.i32_sub: + case Opcode.i32_mul: + case Opcode.i32_div_s: + case Opcode.i32_div_u: + case Opcode.i32_rem_s: + case Opcode.i32_rem_u: + case Opcode.i32_and: + case Opcode.i32_or: + case Opcode.i32_xor: + case Opcode.i32_shl: + case Opcode.i32_shr_s: + case Opcode.i32_shr_u: + case Opcode.i32_rotl: + case Opcode.i32_rotr: + case Opcode.i64_clz: + case Opcode.i64_ctz: + case Opcode.i64_popcnt: + case Opcode.i64_add: + case Opcode.i64_sub: + case Opcode.i64_mul: + case Opcode.i64_div_s: + case Opcode.i64_div_u: + case Opcode.i64_rem_s: + case Opcode.i64_rem_u: + case Opcode.i64_and: + case Opcode.i64_or: + case Opcode.i64_xor: + case Opcode.i64_shl: + case Opcode.i64_shr_s: + case Opcode.i64_shr_u: + case Opcode.i64_rotl: + case Opcode.i64_rotr: + case Opcode.f32_abs: + case Opcode.f32_neg: + case Opcode.f32_ceil: + case Opcode.f32_floor: + case Opcode.f32_trunc: + case Opcode.f32_nearest: + case Opcode.f32_sqrt: + case Opcode.f32_add: + case Opcode.f32_sub: + case Opcode.f32_mul: + case Opcode.f32_div: + case Opcode.f32_min: + case Opcode.f32_max: + case Opcode.f32_copysign: + case Opcode.f64_abs: + case Opcode.f64_neg: + case Opcode.f64_ceil: + case Opcode.f64_floor: + case Opcode.f64_trunc: + case Opcode.f64_nearest: + case Opcode.f64_sqrt: + case Opcode.f64_add: + case Opcode.f64_sub: + case Opcode.f64_mul: + case Opcode.f64_div: + case Opcode.f64_min: + case Opcode.f64_max: + case Opcode.f64_copysign: + case Opcode.i32_wrap_i64: + case Opcode.i32_trunc_s_f32: + case Opcode.i32_trunc_u_f32: + case Opcode.i32_trunc_s_f64: + case Opcode.i32_trunc_u_f64: + case Opcode.i64_extend_s_i32: + case Opcode.i64_extend_u_i32: + case Opcode.i64_trunc_s_f32: + case Opcode.i64_trunc_u_f32: + case Opcode.i64_trunc_s_f64: + case Opcode.i64_trunc_u_f64: + case Opcode.f32_convert_s_i32: + case Opcode.f32_convert_u_i32: + case Opcode.f32_convert_s_i64: + case Opcode.f32_convert_u_i64: + case Opcode.f32_demote_f64: + case Opcode.f64_convert_s_i32: + case Opcode.f64_convert_u_i32: + case Opcode.f64_convert_s_i64: + case Opcode.f64_convert_u_i64: + case Opcode.f64_promote_f32: + case Opcode.i32_reinterpret_f32: + case Opcode.i64_reinterpret_f64: + case Opcode.f32_reinterpret_i32: + case Opcode.f64_reinterpret_i64: + return new NumericInstruction(byte); + default: + return new Instruction(byte); + + } + + } +} + +class ControlInstruction extends Instruction{ + internalInstructions:Instruction[] = []; + elseInstructions: Instruction[] = []; + blockType: Type; + isNested: bool = false; + label: u32; + labels: u32[] = []; + constructor(opcode: u8){ + super(opcode); + switch (this.opcode){ + case Opcode.unreachable: + case Opcode.nop: + case Opcode.return_: + break; + case Opcode.block: + case Opcode.loop:{ + this.isNested = true; + this.blockType = readUint(); + // this.internalInstructions = parseExpr(); + break; + } + case Opcode.if_: + case Opcode.else_:{ + this.isNested = true; + this.blockType = readUint(); + // this.internalInstructions = parseExpr(); + // if (this.peak().opcode == Opcode.else_){ + // this.elseInstructions = parseExpr(); + // } + break; + } + case Opcode.br_table: + let length = readVaruint(32); + for (let i:u32 = 0; i < length; i++){ + this.labels.push(readVaruint(32)); + } + this.label = readVaruint(32); + break; + case Opcode.call: + case Opcode.call_indirect: + case Opcode.br: + case Opcode.br_if: + this.label = readVaruint(32); + break; + + } + } + + peak(): Instruction { + return this.internalInstructions[this.internalInstructions.length-1]; + } +} +// +class ParametricInstruction extends Instruction{ + +} + +class VariableInstruction extends Instruction{ + index: u32; + constructor(opcode: u8){ + super(opcode); + this.index = readVaruint(32); + } +} + +class MemoryInstruction extends Instruction{ + align: u32; + offset: u32; + + constructor(opcode: u8){ + super(opcode); + switch (opcode){ + case Opcode.i32_load: + case Opcode.i64_load: + case Opcode.f32_load: + case Opcode.f64_load: + case Opcode.i32_load8_s: + case Opcode.i32_load8_u: + case Opcode.i32_load16_s: + case Opcode.i32_load16_u: + case Opcode.i64_load8_s: + case Opcode.i64_load8_u: + case Opcode.i64_load16_s: + case Opcode.i64_load16_u: + case Opcode.i64_load32_s: + case Opcode.i64_load32_u: + case Opcode.i32_store: + case Opcode.i64_store: + case Opcode.f32_store: + case Opcode.f64_store: + case Opcode.i32_store8: + case Opcode.i32_store16: + case Opcode.i64_store8: + case Opcode.i64_store16: + case Opcode.i64_store32:{ + this.align = readVaruint(32); + this.offset = readVaruint(32); + break; + } + case Opcode.current_memory: + case Opcode.grow_memory: + let end = readUint(); + break; + default: + break; + } + } +} + +class ConstInstruction extends Instruction{} + +export class I32_Const extends ConstInstruction { + value: u32; + constructor(opcode: Opcode){ + super(opcode); + this.value = readVaruint(32); + } +} +class F32_Const extends ConstInstruction { + value: u32; + constructor(opcode: u8){ + super(opcode); + this.value = readVaruint(32); + } +} + +class I64_Const extends ConstInstruction { + value: u64; + constructor(opcode: u8){ + super(opcode); + this.value = readVaruint(64); + } +} +class F64_Const extends Instruction { + value: u64; + constructor(opcode: u8){ + super(opcode); + this.value = readVaruint(64); + } +} + +class NumericInstruction extends Instruction{} diff --git a/lib/parse/assembly/options.ts b/lib/parse/assembly/options.ts deleted file mode 100644 index e4ca8ad219..0000000000 --- a/lib/parse/assembly/options.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Imported callbacks -export declare function onSection(id: u32, offset: u32, length: u32, nameOffset: u32, nameLength: u32): bool; -export declare function onType(index: u32, form: u32): void; -export declare function onTypeParam(index: u32, paramIndex: u32, paramType: u32): void; -export declare function onTypeReturn(index: u32, returnIndex: u32, returnType: u32): void; -export declare function onImport(index: u32, kind: u32, moduleOff: u32, moduleLen: u32, fieldOff: u32, fieldLen: u32): void; -export declare function onFunctionImport(index: u32, type: u32): void; -export declare function onTableImport(index: u32, type: u32, initial: u32, maximum: u32, flags: u32): void; -export declare function onMemoryImport(index: u32, initial: u32, maximum: u32, flags: u32): void; -export declare function onGlobalImport(index: u32, type: u32, mutability: u32): void; -export declare function onMemory(index: u32, initial: u32, maximum: u32, flags: u32): void; -export declare function onFunction(index: u32, typeIndex: u32): void; -export declare function onTable(index: u32, type: u32, initial: u32, maximum: u32, flags: u32): void; -export declare function onGlobal(index: u32, type: u32, mutability: u32): void; -export declare function onExport(index: u32, kind: u32, kindIndex: u32, nameOffset: u32, nameLength: u32): void; -export declare function onStart(index: u32): void; -export declare function onSourceMappingURL(offset: u32, length: u32): void; -export declare function onModuleName(offset: u32, length: u32): void; -export declare function onFunctionName(index: u32, offset: u32, length: u32): void; -export declare function onLocalName(funcIndex: u32, index: u32, offset: u32, length: u32): void; diff --git a/lib/parse/build/index.wat b/lib/parse/build/index.wat index 8b73ae0014..8937421334 100644 --- a/lib/parse/build/index.wat +++ b/lib/parse/build/index.wat @@ -1,38 +1,99 @@ (module - (type $iiv (func (param i32 i32))) - (type $ii (func (param i32) (result i32))) - (type $iiiiii (func (param i32 i32 i32 i32 i32) (result i32))) (type $iiiv (func (param i32 i32 i32))) - (type $iiiiiiv (func (param i32 i32 i32 i32 i32 i32))) - (type $iiiiiv (func (param i32 i32 i32 i32 i32))) + (type $iiii (func (param i32 i32 i32) (result i32))) + (type $ii (func (param i32) (result i32))) + (type $iiv (func (param i32 i32))) (type $iiiiv (func (param i32 i32 i32 i32))) - (type $v (func)) - (type $I (func (result i64))) + (type $iii (func (param i32 i32) (result i32))) (type $iv (func (param i32))) - (type $FUNCSIG$i (func (result i32))) - (import "env" "memory" (memory $0 0)) - (import "options" "onSection" (func $assembly/options/onSection (param i32 i32 i32 i32 i32) (result i32))) - (import "options" "onType" (func $assembly/options/onType (param i32 i32))) - (import "options" "onTypeParam" (func $assembly/options/onTypeParam (param i32 i32 i32))) - (import "options" "onTypeReturn" (func $assembly/options/onTypeReturn (param i32 i32 i32))) - (import "options" "onImport" (func $assembly/options/onImport (param i32 i32 i32 i32 i32 i32))) - (import "options" "onFunctionImport" (func $assembly/options/onFunctionImport (param i32 i32))) - (import "options" "onTableImport" (func $assembly/options/onTableImport (param i32 i32 i32 i32 i32))) - (import "options" "onMemoryImport" (func $assembly/options/onMemoryImport (param i32 i32 i32 i32))) - (import "options" "onGlobalImport" (func $assembly/options/onGlobalImport (param i32 i32 i32))) - (import "options" "onFunction" (func $assembly/options/onFunction (param i32 i32))) - (import "options" "onTable" (func $assembly/options/onTable (param i32 i32 i32 i32 i32))) - (import "options" "onMemory" (func $assembly/options/onMemory (param i32 i32 i32 i32))) - (import "options" "onGlobal" (func $assembly/options/onGlobal (param i32 i32 i32))) - (import "options" "onExport" (func $assembly/options/onExport (param i32 i32 i32 i32 i32))) - (import "options" "onStart" (func $assembly/options/onStart (param i32))) - (import "options" "onModuleName" (func $assembly/options/onModuleName (param i32 i32))) - (import "options" "onFunctionName" (func $assembly/options/onFunctionName (param i32 i32 i32))) - (import "options" "onLocalName" (func $assembly/options/onLocalName (param i32 i32 i32 i32))) - (import "options" "onSourceMappingURL" (func $assembly/options/onSourceMappingURL (param i32 i32))) - (table $0 1 anyfunc) + (type $v (func)) + (type $iiiiiv (func (param i32 i32 i32 i32 i32))) + (import "env" "memory" (memory $0 1)) + (data (i32.const 8) "\16\00\00\00~\00l\00i\00b\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00/\00t\00l\00s\00f\00.\00t\00s\00") + (data (i32.const 56) "\00\00\00\00\00\00\00\00") + (data (i32.const 64) "8\00\00\00\00\00\00\00") + (data (i32.const 72) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00") + (data (i32.const 104) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") + (data (i32.const 168) "\00\00\00\00\00\00\00\00") + (data (i32.const 176) "\a8\00\00\00\00\00\00\00") + (data (i32.const 184) "\01\00\00\000\00") + (data (i32.const 192) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") + (data (i32.const 248) "\90\01\00\00\00\00\00\000\000\000\001\000\002\000\003\000\004\000\005\000\006\000\007\000\008\000\009\001\000\001\001\001\002\001\003\001\004\001\005\001\006\001\007\001\008\001\009\002\000\002\001\002\002\002\003\002\004\002\005\002\006\002\007\002\008\002\009\003\000\003\001\003\002\003\003\003\004\003\005\003\006\003\007\003\008\003\009\004\000\004\001\004\002\004\003\004\004\004\005\004\006\004\007\004\008\004\009\005\000\005\001\005\002\005\003\005\004\005\005\005\006\005\007\005\008\005\009\006\000\006\001\006\002\006\003\006\004\006\005\006\006\006\007\006\008\006\009\007\000\007\001\007\002\007\003\007\004\007\005\007\006\007\007\007\008\007\009\008\000\008\001\008\002\008\003\008\004\008\005\008\006\008\007\008\008\008\009\009\000\009\001\009\002\009\003\009\004\009\005\009\006\009\007\009\008\009\009\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data (i32.const 760) "\f8\00\00\00d\00\00\00") + (data (i32.const 768) "\03\00\00\00i\003\002\00") + (data (i32.const 784) "\03\00\00\00i\006\004\00") + (data (i32.const 800) "\03\00\00\00f\003\002\00") + (data (i32.const 816) "\03\00\00\00f\006\004\00") + (data (i32.const 832) "\07\00\00\00a\00n\00y\00f\00u\00n\00c\00") + (data (i32.const 856) "\04\00\00\00f\00u\00n\00c\00") + (data (i32.const 872) "\04\00\00\00n\00o\00n\00e\00") + (data (i32.const 888) "\00\00\00\00") + (data (i32.const 896) "\04\00\00\00n\00u\00l\00l\00") + (data (i32.const 912) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") + (data (i32.const 944) "\02\00\00\00,\00 \00") + (data (i32.const 952) "\04\00\00\00v\00o\00i\00d\00") + (data (i32.const 968) "\07\00\00\00i\00n\00d\00e\00x\00:\00 \00") + (data (i32.const 992) "\06\00\00\00f\00o\00r\00m\00:\00 \00") + (data (i32.const 1008) "\03\00\00\00,\00 \00(\00") + (data (i32.const 1024) "\05\00\00\00)\00 \00=\00>\00 \00") + (data (i32.const 1040) "\00\00\00\00\00\00\00\00") + (data (i32.const 1048) "\10\04\00\00\00\00\00\00") + (data (i32.const 1056) "\01\00\00\00\n\00") + (data (i32.const 1064) "\00\00\00\00\00\00\00\00") + (data (i32.const 1072) "(\04\00\00\00\00\00\00") + (data (i32.const 1080) "\01\00\00\00\'\00") + (data (i32.const 1088) "\06\00\00\00C\00u\00s\00t\00o\00m\00") + (data (i32.const 1104) "\04\00\00\00T\00y\00p\00e\00") + (data (i32.const 1120) "\06\00\00\00I\00m\00p\00o\00r\00t\00") + (data (i32.const 1136) "\08\00\00\00F\00u\00n\00c\00t\00i\00o\00n\00") + (data (i32.const 1160) "\05\00\00\00T\00a\00b\00l\00e\00") + (data (i32.const 1176) "\06\00\00\00M\00e\00m\00o\00r\00y\00") + (data (i32.const 1192) "\06\00\00\00G\00l\00o\00b\00a\00l\00") + (data (i32.const 1208) "\06\00\00\00E\00x\00p\00o\00r\00t\00") + (data (i32.const 1224) "\05\00\00\00S\00t\00a\00r\00t\00") + (data (i32.const 1240) "\07\00\00\00E\00l\00e\00m\00e\00n\00t\00") + (data (i32.const 1264) "\04\00\00\00C\00o\00d\00e\00") + (data (i32.const 1280) "\04\00\00\00D\00a\00t\00a\00") + (table 1 anyfunc) (elem (i32.const 0) $null) - (global $assembly/index/off (mut i32) (i32.const 0)) + (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) + (import "index" "_log_str" (func $assembly/host/index/_log_str (param i32))) + (global $src/common/MAX_PAGES i32 (i32.const 65535)) + (global $src/common/MAX_ELEMS i32 (i32.const -1)) + (global $~lib/allocator/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/internal/allocator/AL_BITS i32 (i32.const 3)) + (global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8)) + (global $~lib/internal/allocator/AL_MASK i32 (i32.const 7)) + (global $~lib/allocator/tlsf/Root.SL_START i32 (i32.const 4)) + (global $~lib/allocator/tlsf/SL_BITS i32 (i32.const 5)) + (global $~lib/allocator/tlsf/SB_BITS i32 (i32.const 8)) + (global $~lib/allocator/tlsf/FL_BITS i32 (i32.const 22)) + (global $~lib/allocator/tlsf/Root.SL_END i32 (i32.const 92)) + (global $~lib/allocator/tlsf/Root.HL_START i32 (i32.const 96)) + (global $~lib/allocator/tlsf/SL_SIZE i32 (i32.const 32)) + (global $~lib/allocator/tlsf/Root.HL_END i32 (i32.const 2912)) + (global $~lib/allocator/tlsf/Root.SIZE i32 (i32.const 2916)) + (global $~lib/allocator/tlsf/Block.INFO i32 (i32.const 8)) + (global $~lib/allocator/tlsf/Block.MIN_SIZE i32 (i32.const 16)) + (global $~lib/allocator/tlsf/FREE i32 (i32.const 1)) + (global $~lib/allocator/tlsf/LEFT_FREE i32 (i32.const 2)) + (global $~lib/allocator/tlsf/TAGS i32 (i32.const 3)) + (global $~lib/allocator/tlsf/Block.MAX_SIZE i32 (i32.const 1073741824)) + (global $~lib/allocator/tlsf/SB_SIZE i32 (i32.const 256)) + (global $~lib/internal/allocator/MAX_SIZE_32 i32 (i32.const 1073741824)) + (global $~lib/internal/arraybuffer/HEADER_SIZE i32 (i32.const 8)) + (global $~lib/internal/arraybuffer/MAX_BLENGTH i32 (i32.const 1073741816)) + (global $~lib/internal/string/HEADER_SIZE i32 (i32.const 4)) + (global $~lib/internal/string/MAX_LENGTH i32 (i32.const 536870910)) + (global $~lib/internal/number/MAX_DOUBLE_LENGTH i32 (i32.const 28)) + (global $~lib/internal/number/_K (mut i32) (i32.const 0)) + (global $~lib/internal/number/_frc (mut i64) (i64.const 0)) + (global $~lib/internal/number/_exp (mut i32) (i32.const 0)) + (global $~lib/internal/number/_frc_minus (mut i64) (i64.const 0)) + (global $~lib/internal/number/_frc_plus (mut i64) (i64.const 0)) + (global $~lib/internal/number/_frc_pow (mut i64) (i64.const 0)) + (global $~lib/internal/number/_exp_pow (mut i32) (i32.const 0)) + (global $assembly/index/type (mut i32) (i32.const 0)) (global $src/common/SectionId.Custom (mut i32) (i32.const 0)) (global $src/common/SectionId.Type (mut i32) (i32.const 1)) (global $src/common/SectionId.Import (mut i32) (i32.const 2)) @@ -45,273 +106,8991 @@ (global $src/common/SectionId.Element (mut i32) (i32.const 9)) (global $src/common/SectionId.Code (mut i32) (i32.const 10)) (global $src/common/SectionId.Data (mut i32) (i32.const 11)) - (global $src/common/ExternalKind.Function (mut i32) (i32.const 0)) - (global $src/common/ExternalKind.Table (mut i32) (i32.const 1)) - (global $src/common/ExternalKind.Memory (mut i32) (i32.const 2)) - (global $src/common/ExternalKind.Global (mut i32) (i32.const 3)) - (global $src/common/Opcode.end (mut i32) (i32.const 11)) - (global $src/common/Opcode.get_global (mut i32) (i32.const 35)) - (global $src/common/Opcode.i32_const (mut i32) (i32.const 65)) - (global $src/common/Opcode.i64_const (mut i32) (i32.const 66)) - (global $src/common/Opcode.f32_const (mut i32) (i32.const 67)) - (global $src/common/Opcode.f64_const (mut i32) (i32.const 68)) - (global $src/common/NameType.Module (mut i32) (i32.const 0)) - (global $src/common/NameType.Function (mut i32) (i32.const 1)) - (global $src/common/NameType.Local (mut i32) (i32.const 2)) + (global $ASC_SHRINK_LEVEL i32 (i32.const 0)) + (global $~lib/internal/string/CharCode.PLUS i32 (i32.const 43)) + (global $~lib/internal/string/CharCode.MINUS i32 (i32.const 45)) + (global $~lib/internal/string/CharCode.DOT i32 (i32.const 46)) + (global $~lib/internal/string/CharCode._0 i32 (i32.const 48)) + (global $~lib/internal/string/CharCode._1 i32 (i32.const 49)) + (global $~lib/internal/string/CharCode._2 i32 (i32.const 50)) + (global $~lib/internal/string/CharCode._3 i32 (i32.const 51)) + (global $~lib/internal/string/CharCode._4 i32 (i32.const 52)) + (global $~lib/internal/string/CharCode._5 i32 (i32.const 53)) + (global $~lib/internal/string/CharCode._6 i32 (i32.const 54)) + (global $~lib/internal/string/CharCode._7 i32 (i32.const 55)) + (global $~lib/internal/string/CharCode._8 i32 (i32.const 56)) + (global $~lib/internal/string/CharCode._9 i32 (i32.const 57)) + (global $~lib/internal/string/CharCode.A i32 (i32.const 65)) + (global $~lib/internal/string/CharCode.B i32 (i32.const 66)) + (global $~lib/internal/string/CharCode.E i32 (i32.const 69)) + (global $~lib/internal/string/CharCode.N i32 (i32.const 78)) + (global $~lib/internal/string/CharCode.O i32 (i32.const 79)) + (global $~lib/internal/string/CharCode.X i32 (i32.const 88)) + (global $~lib/internal/string/CharCode.Z i32 (i32.const 90)) + (global $~lib/internal/string/CharCode.a i32 (i32.const 97)) + (global $~lib/internal/string/CharCode.b i32 (i32.const 98)) + (global $~lib/internal/string/CharCode.e i32 (i32.const 101)) + (global $~lib/internal/string/CharCode.n i32 (i32.const 110)) + (global $~lib/internal/string/CharCode.o i32 (i32.const 111)) + (global $~lib/internal/string/CharCode.x i32 (i32.const 120)) + (global $~lib/internal/string/CharCode.z i32 (i32.const 122)) + (global $HEAP_BASE i32 (i32.const 1292)) (export "memory" (memory $0)) (export "table" (table $0)) + (export "getType" (func $assembly/index/getType)) + (export "toString" (func $assembly/index/toString)) + (export "Parser#constructor" (func $assembly/index/Parser#constructor)) + (export "Parser#get:buf" (func $Parser#get:buf)) + (export "Parser#set:buf" (func $Parser#set:buf)) + (export "Parser#get:module" (func $Parser#get:module)) + (export "Parser#set:module" (func $Parser#set:module)) + (export "Parser#parseString" (func $assembly/index/Parser#parseString)) + (export "Parser#readVaruint" (func $assembly/index/Parser#readVaruint)) + (export "Parser#get:off" (func $assembly/index/Parser#get:off)) + (export "Parser#set:off" (func $assembly/index/Parser#set:off)) + (export "Parser#parse" (func $assembly/index/Parser#parse)) + (export "newParser" (func $assembly/index/newParser)) (export "parse" (func $assembly/index/parse)) - (func $assembly/index/readVaruint (; 19 ;) (type $FUNCSIG$i) (result i32) - (local $0 i32) + (export "memory.fill" (func $~lib/memory/memory.fill)) + (export "memory.copy" (func $~lib/memory/memory.copy)) + (export "memory.compare" (func $~lib/memory/memory.compare)) + (export "memory.allocate" (func $~lib/memory/memory.allocate)) + (export "memory.free" (func $~lib/memory/memory.free)) + (export "memory.reset" (func $~lib/memory/memory.reset)) + (start $start) + (func $~lib/internal/memory/memset (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i64) + ;;@ ~lib/internal/memory.ts:191:2 + (if + ;;@ ~lib/internal/memory.ts:191:6 + (i32.eqz + ;;@ ~lib/internal/memory.ts:191:7 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:191:10 + (return) + ) + ;;@ ~lib/internal/memory.ts:192:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:192:12 + (get_local $0) + ;;@ ~lib/internal/memory.ts:192:18 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:193:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:193:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:193:19 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:193:23 + (i32.const 1) + ) + ;;@ ~lib/internal/memory.ts:193:26 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:194:2 + (if + ;;@ ~lib/internal/memory.ts:194:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:194:11 + (i32.const 2) + ) + ;;@ ~lib/internal/memory.ts:194:14 + (return) + ) + ;;@ ~lib/internal/memory.ts:196:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:196:12 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:196:19 + (i32.const 1) + ) + ;;@ ~lib/internal/memory.ts:196:22 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:197:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:197:12 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:197:19 + (i32.const 2) + ) + ;;@ ~lib/internal/memory.ts:197:22 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:198:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:198:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:198:19 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:198:23 + (i32.const 2) + ) + ;;@ ~lib/internal/memory.ts:198:26 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:199:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:199:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:199:19 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:199:23 + (i32.const 3) + ) + ;;@ ~lib/internal/memory.ts:199:26 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:200:2 + (if + ;;@ ~lib/internal/memory.ts:200:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:200:11 + (i32.const 6) + ) + ;;@ ~lib/internal/memory.ts:200:14 + (return) + ) + ;;@ ~lib/internal/memory.ts:201:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:201:12 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:201:19 + (i32.const 3) + ) + ;;@ ~lib/internal/memory.ts:201:22 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:202:2 + (i32.store8 + ;;@ ~lib/internal/memory.ts:202:12 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:202:19 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:202:23 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:202:26 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:203:2 + (if + ;;@ ~lib/internal/memory.ts:203:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:203:11 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:203:14 + (return) + ) + ;;@ ~lib/internal/memory.ts:206:2 + (set_local $3 + ;;@ ~lib/internal/memory.ts:206:17 + (i32.and + (i32.sub + (i32.const 0) + ;;@ ~lib/internal/memory.ts:206:18 + (get_local $0) + ) + ;;@ ~lib/internal/memory.ts:206:25 + (i32.const 3) + ) + ) + ;;@ ~lib/internal/memory.ts:207:2 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:207:10 + (get_local $3) + ) + ) + ;;@ ~lib/internal/memory.ts:208:2 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:208:7 + (get_local $3) + ) + ) + ;;@ ~lib/internal/memory.ts:209:2 + (set_local $2 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:209:7 + (i32.const -4) + ) + ) + ;;@ ~lib/internal/memory.ts:211:2 + (set_local $4 + ;;@ ~lib/internal/memory.ts:211:17 + (i32.mul + (i32.div_u + (i32.const -1) + ;;@ ~lib/internal/memory.ts:211:27 + (i32.const 255) + ) + (i32.and + ;;@ ~lib/internal/memory.ts:211:33 + (get_local $1) + (i32.const 255) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:214:2 + (i32.store + ;;@ ~lib/internal/memory.ts:214:13 + (get_local $0) + ;;@ ~lib/internal/memory.ts:214:19 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:215:2 + (i32.store + ;;@ ~lib/internal/memory.ts:215:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:215:20 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:215:24 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:215:27 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:216:2 + (if + ;;@ ~lib/internal/memory.ts:216:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:216:11 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:216:14 + (return) + ) + ;;@ ~lib/internal/memory.ts:217:2 + (i32.store + ;;@ ~lib/internal/memory.ts:217:13 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:217:20 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:217:23 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:218:2 + (i32.store + ;;@ ~lib/internal/memory.ts:218:13 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:218:20 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:218:23 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:219:2 + (i32.store + ;;@ ~lib/internal/memory.ts:219:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:219:20 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:219:24 + (i32.const 12) + ) + ;;@ ~lib/internal/memory.ts:219:28 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:220:2 + (i32.store + ;;@ ~lib/internal/memory.ts:220:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:220:20 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:220:24 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:220:27 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:221:2 + (if + ;;@ ~lib/internal/memory.ts:221:6 + (i32.le_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:221:11 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:221:15 + (return) + ) + ;;@ ~lib/internal/memory.ts:222:2 + (i32.store + ;;@ ~lib/internal/memory.ts:222:13 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:222:20 + (i32.const 12) + ) + ;;@ ~lib/internal/memory.ts:222:24 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:223:2 + (i32.store + ;;@ ~lib/internal/memory.ts:223:13 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:223:20 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:223:24 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:224:2 + (i32.store + ;;@ ~lib/internal/memory.ts:224:13 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:224:20 + (i32.const 20) + ) + ;;@ ~lib/internal/memory.ts:224:24 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:225:2 + (i32.store + ;;@ ~lib/internal/memory.ts:225:13 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:225:20 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:225:24 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:226:2 + (i32.store + ;;@ ~lib/internal/memory.ts:226:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:226:20 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:226:24 + (i32.const 28) + ) + ;;@ ~lib/internal/memory.ts:226:28 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:227:2 + (i32.store + ;;@ ~lib/internal/memory.ts:227:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:227:20 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:227:24 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:227:28 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:228:2 + (i32.store + ;;@ ~lib/internal/memory.ts:228:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:228:20 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:228:24 + (i32.const 20) + ) + ;;@ ~lib/internal/memory.ts:228:28 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:229:2 + (i32.store + ;;@ ~lib/internal/memory.ts:229:13 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:229:20 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:229:24 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:229:28 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:232:2 + (set_local $3 + ;;@ ~lib/internal/memory.ts:232:6 + (i32.add + (i32.const 24) + ;;@ ~lib/internal/memory.ts:232:11 + (i32.and + ;;@ ~lib/internal/memory.ts:232:12 + (get_local $0) + ;;@ ~lib/internal/memory.ts:232:19 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:233:2 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:233:10 + (get_local $3) + ) + ) + ;;@ ~lib/internal/memory.ts:234:2 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:234:7 + (get_local $3) + ) + ) + ;;@ ~lib/internal/memory.ts:237:2 + (set_local $5 + ;;@ ~lib/internal/memory.ts:237:17 + (i64.or + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:237:28 + (i64.shl + ;;@ ~lib/internal/memory.ts:237:29 + (i64.extend_u/i32 + (get_local $4) + ) + ;;@ ~lib/internal/memory.ts:237:41 + (i64.const 32) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:238:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/internal/memory.ts:238:9 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:238:14 + (i32.const 32) + ) + (block + ;;@ ~lib/internal/memory.ts:238:18 + (block + ;;@ ~lib/internal/memory.ts:239:4 + (i64.store + ;;@ ~lib/internal/memory.ts:239:15 + (get_local $0) + ;;@ ~lib/internal/memory.ts:239:21 + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:240:4 + (i64.store + ;;@ ~lib/internal/memory.ts:240:15 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:240:22 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:240:25 + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:241:4 + (i64.store + ;;@ ~lib/internal/memory.ts:241:15 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:241:22 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:241:26 + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:242:4 + (i64.store + ;;@ ~lib/internal/memory.ts:242:15 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:242:22 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:242:26 + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:243:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:243:9 + (i32.const 32) + ) + ) + ;;@ ~lib/internal/memory.ts:244:4 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:244:12 + (i32.const 32) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.fill (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/memory.ts:15:4 + (call $~lib/internal/memory/memset + ;;@ ~lib/memory.ts:15:11 + (get_local $0) + ;;@ ~lib/memory.ts:15:17 + (get_local $1) + ;;@ ~lib/memory.ts:15:20 + (get_local $2) + ) + ) + (func $~lib/internal/memory/memcpy (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + ;;@ ~lib/internal/memory.ts:6:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/internal/memory.ts:6:9 + (if (result i32) + (get_local $2) + ;;@ ~lib/internal/memory.ts:6:14 + (i32.and + ;;@ ~lib/internal/memory.ts:6:15 + (get_local $1) + ;;@ ~lib/internal/memory.ts:6:21 + (i32.const 3) + ) + (get_local $2) + ) + (block + ;;@ ~lib/internal/memory.ts:6:25 + (block + ;;@ ~lib/internal/memory.ts:7:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:7:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:7:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:7:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:8:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:12:2 + (if + ;;@ ~lib/internal/memory.ts:12:6 + (i32.eq + (i32.and + ;;@ ~lib/internal/memory.ts:12:7 + (get_local $0) + ;;@ ~lib/internal/memory.ts:12:14 + (i32.const 3) + ) + ;;@ ~lib/internal/memory.ts:12:20 + (i32.const 0) + ) + ;;@ ~lib/internal/memory.ts:12:23 + (block + ;;@ ~lib/internal/memory.ts:13:4 + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/internal/memory.ts:13:11 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:13:16 + (i32.const 16) + ) + (block + ;;@ ~lib/internal/memory.ts:13:20 + (block + ;;@ ~lib/internal/memory.ts:14:6 + (i32.store + ;;@ ~lib/internal/memory.ts:14:17 + (get_local $0) + ;;@ ~lib/internal/memory.ts:14:28 + (i32.load + ;;@ ~lib/internal/memory.ts:14:38 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:15:6 + (i32.store + ;;@ ~lib/internal/memory.ts:15:17 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:15:25 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:15:28 + (i32.load + ;;@ ~lib/internal/memory.ts:15:38 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:15:45 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:16:6 + (i32.store + ;;@ ~lib/internal/memory.ts:16:17 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:16:25 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:16:28 + (i32.load + ;;@ ~lib/internal/memory.ts:16:38 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:16:45 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:17:6 + (i32.store + ;;@ ~lib/internal/memory.ts:17:17 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:17:24 + (i32.const 12) + ) + ;;@ ~lib/internal/memory.ts:17:28 + (i32.load + ;;@ ~lib/internal/memory.ts:17:38 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:17:44 + (i32.const 12) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:18:6 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:18:13 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:18:17 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:18:25 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:18:29 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:18:34 + (i32.const 16) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:20:4 + (if + ;;@ ~lib/internal/memory.ts:20:8 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:20:12 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:20:15 + (block + ;;@ ~lib/internal/memory.ts:21:6 + (i32.store + ;;@ ~lib/internal/memory.ts:21:17 + (get_local $0) + ;;@ ~lib/internal/memory.ts:21:27 + (i32.load + ;;@ ~lib/internal/memory.ts:21:37 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:22:6 + (i32.store + ;;@ ~lib/internal/memory.ts:22:17 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:22:24 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:22:27 + (i32.load + ;;@ ~lib/internal/memory.ts:22:37 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:22:43 + (i32.const 4) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:23:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:23:14 + (i32.const 8) + ) + ) + ;;@ ~lib/internal/memory.ts:23:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:23:24 + (i32.const 8) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:25:4 + (if + ;;@ ~lib/internal/memory.ts:25:8 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:25:12 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:25:15 + (block + ;;@ ~lib/internal/memory.ts:26:6 + (i32.store + ;;@ ~lib/internal/memory.ts:26:17 + (get_local $0) + ;;@ ~lib/internal/memory.ts:26:23 + (i32.load + ;;@ ~lib/internal/memory.ts:26:33 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:27:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:27:14 + (i32.const 4) + ) + ) + ;;@ ~lib/internal/memory.ts:27:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:27:24 + (i32.const 4) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:29:4 + (if + ;;@ ~lib/internal/memory.ts:29:8 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:29:12 + (i32.const 2) + ) + ;;@ ~lib/internal/memory.ts:29:15 + (block + ;;@ ~lib/internal/memory.ts:30:6 + (i32.store16 + ;;@ ~lib/internal/memory.ts:30:17 + (get_local $0) + ;;@ ~lib/internal/memory.ts:30:23 + (i32.load16_u + ;;@ ~lib/internal/memory.ts:30:33 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:31:6 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:31:14 + (i32.const 2) + ) + ) + ;;@ ~lib/internal/memory.ts:31:17 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:31:24 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:33:4 + (if + ;;@ ~lib/internal/memory.ts:33:8 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:33:12 + (i32.const 1) + ) + ;;@ ~lib/internal/memory.ts:33:15 + (i32.store8 + ;;@ ~lib/internal/memory.ts:34:16 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:34:24 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:34:33 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:36:4 + (return) + ) + ) + ;;@ ~lib/internal/memory.ts:41:2 + (if + ;;@ ~lib/internal/memory.ts:41:6 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:41:11 + (i32.const 32) + ) + ;;@ ~lib/internal/memory.ts:41:15 + (block $break|2 + (block $case2|2 + (block $case1|2 + (block $case0|2 + (set_local $5 + ;;@ ~lib/internal/memory.ts:42:12 + (i32.and + (get_local $0) + ;;@ ~lib/internal/memory.ts:42:19 + (i32.const 3) + ) + ) + (br_if $case0|2 + (i32.eq + (get_local $5) + ;;@ ~lib/internal/memory.ts:44:11 + (i32.const 1) + ) + ) + (br_if $case1|2 + (i32.eq + (get_local $5) + ;;@ ~lib/internal/memory.ts:63:11 + (i32.const 2) + ) + ) + (br_if $case2|2 + (i32.eq + (get_local $5) + ;;@ ~lib/internal/memory.ts:81:11 + (i32.const 3) + ) + ) + (br $break|2) + ) + ;;@ ~lib/internal/memory.ts:44:14 + (block + ;;@ ~lib/internal/memory.ts:45:8 + (set_local $3 + ;;@ ~lib/internal/memory.ts:45:12 + (i32.load + ;;@ ~lib/internal/memory.ts:45:22 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:46:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:46:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:46:26 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:46:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:47:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:47:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:47:26 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:47:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:48:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:48:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:48:26 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:48:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:49:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:49:13 + (i32.const 3) + ) + ) + ;;@ ~lib/internal/memory.ts:50:8 + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/internal/memory.ts:50:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:50:20 + (i32.const 17) + ) + (block + ;;@ ~lib/internal/memory.ts:50:24 + (block + ;;@ ~lib/internal/memory.ts:51:10 + (set_local $4 + ;;@ ~lib/internal/memory.ts:51:14 + (i32.load + ;;@ ~lib/internal/memory.ts:51:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:51:30 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:52:10 + (i32.store + ;;@ ~lib/internal/memory.ts:52:21 + (get_local $0) + ;;@ ~lib/internal/memory.ts:52:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/internal/memory.ts:52:32 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:52:37 + (i32.shl + (get_local $4) + ;;@ ~lib/internal/memory.ts:52:42 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:53:10 + (set_local $3 + ;;@ ~lib/internal/memory.ts:53:14 + (i32.load + ;;@ ~lib/internal/memory.ts:53:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:53:30 + (i32.const 5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:54:10 + (i32.store + ;;@ ~lib/internal/memory.ts:54:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:54:28 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:54:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/internal/memory.ts:54:36 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:54:41 + (i32.shl + (get_local $3) + ;;@ ~lib/internal/memory.ts:54:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:55:10 + (set_local $4 + ;;@ ~lib/internal/memory.ts:55:14 + (i32.load + ;;@ ~lib/internal/memory.ts:55:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:55:30 + (i32.const 9) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:56:10 + (i32.store + ;;@ ~lib/internal/memory.ts:56:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:56:28 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:56:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/internal/memory.ts:56:36 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:56:41 + (i32.shl + (get_local $4) + ;;@ ~lib/internal/memory.ts:56:46 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:57:10 + (set_local $3 + ;;@ ~lib/internal/memory.ts:57:14 + (i32.load + ;;@ ~lib/internal/memory.ts:57:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:57:30 + (i32.const 13) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:58:10 + (i32.store + ;;@ ~lib/internal/memory.ts:58:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:58:28 + (i32.const 12) + ) + ;;@ ~lib/internal/memory.ts:58:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/internal/memory.ts:58:37 + (i32.const 24) + ) + ;;@ ~lib/internal/memory.ts:58:42 + (i32.shl + (get_local $3) + ;;@ ~lib/internal/memory.ts:58:47 + (i32.const 8) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:59:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:59:17 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:59:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:59:29 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:59:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:59:38 + (i32.const 16) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:61:8 + (br $break|2) + ) + ) + ;;@ ~lib/internal/memory.ts:63:14 + (block + ;;@ ~lib/internal/memory.ts:64:8 + (set_local $3 + ;;@ ~lib/internal/memory.ts:64:12 + (i32.load + ;;@ ~lib/internal/memory.ts:64:22 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:65:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:65:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:65:26 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:65:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:66:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:66:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:66:26 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:66:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:67:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:67:13 + (i32.const 2) + ) + ) + ;;@ ~lib/internal/memory.ts:68:8 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/internal/memory.ts:68:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:68:20 + (i32.const 18) + ) + (block + ;;@ ~lib/internal/memory.ts:68:24 + (block + ;;@ ~lib/internal/memory.ts:69:10 + (set_local $4 + ;;@ ~lib/internal/memory.ts:69:14 + (i32.load + ;;@ ~lib/internal/memory.ts:69:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:69:30 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:70:10 + (i32.store + ;;@ ~lib/internal/memory.ts:70:21 + (get_local $0) + ;;@ ~lib/internal/memory.ts:70:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/internal/memory.ts:70:32 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:70:37 + (i32.shl + (get_local $4) + ;;@ ~lib/internal/memory.ts:70:42 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:71:10 + (set_local $3 + ;;@ ~lib/internal/memory.ts:71:14 + (i32.load + ;;@ ~lib/internal/memory.ts:71:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:71:30 + (i32.const 6) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:72:10 + (i32.store + ;;@ ~lib/internal/memory.ts:72:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:72:28 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:72:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/internal/memory.ts:72:36 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:72:41 + (i32.shl + (get_local $3) + ;;@ ~lib/internal/memory.ts:72:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:73:10 + (set_local $4 + ;;@ ~lib/internal/memory.ts:73:14 + (i32.load + ;;@ ~lib/internal/memory.ts:73:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:73:30 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:74:10 + (i32.store + ;;@ ~lib/internal/memory.ts:74:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:74:28 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:74:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/internal/memory.ts:74:36 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:74:41 + (i32.shl + (get_local $4) + ;;@ ~lib/internal/memory.ts:74:46 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:75:10 + (set_local $3 + ;;@ ~lib/internal/memory.ts:75:14 + (i32.load + ;;@ ~lib/internal/memory.ts:75:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:75:30 + (i32.const 14) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:76:10 + (i32.store + ;;@ ~lib/internal/memory.ts:76:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:76:28 + (i32.const 12) + ) + ;;@ ~lib/internal/memory.ts:76:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/internal/memory.ts:76:37 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:76:42 + (i32.shl + (get_local $3) + ;;@ ~lib/internal/memory.ts:76:47 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:77:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:77:17 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:77:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:77:29 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:77:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:77:38 + (i32.const 16) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:79:8 + (br $break|2) + ) + ) + ;;@ ~lib/internal/memory.ts:81:14 + (block + ;;@ ~lib/internal/memory.ts:82:8 + (set_local $3 + ;;@ ~lib/internal/memory.ts:82:12 + (i32.load + ;;@ ~lib/internal/memory.ts:82:22 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:83:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:83:18 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:83:26 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:83:35 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:84:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:84:13 + (i32.const 1) + ) + ) + ;;@ ~lib/internal/memory.ts:85:8 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/internal/memory.ts:85:15 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:85:20 + (i32.const 19) + ) + (block + ;;@ ~lib/internal/memory.ts:85:24 + (block + ;;@ ~lib/internal/memory.ts:86:10 + (set_local $4 + ;;@ ~lib/internal/memory.ts:86:14 + (i32.load + ;;@ ~lib/internal/memory.ts:86:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:86:30 + (i32.const 3) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:87:10 + (i32.store + ;;@ ~lib/internal/memory.ts:87:21 + (get_local $0) + ;;@ ~lib/internal/memory.ts:87:27 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/internal/memory.ts:87:32 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:87:36 + (i32.shl + (get_local $4) + ;;@ ~lib/internal/memory.ts:87:41 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:88:10 + (set_local $3 + ;;@ ~lib/internal/memory.ts:88:14 + (i32.load + ;;@ ~lib/internal/memory.ts:88:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:88:30 + (i32.const 7) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:89:10 + (i32.store + ;;@ ~lib/internal/memory.ts:89:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:89:28 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:89:31 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/internal/memory.ts:89:36 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:89:40 + (i32.shl + (get_local $3) + ;;@ ~lib/internal/memory.ts:89:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:90:10 + (set_local $4 + ;;@ ~lib/internal/memory.ts:90:14 + (i32.load + ;;@ ~lib/internal/memory.ts:90:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:90:30 + (i32.const 11) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:91:10 + (i32.store + ;;@ ~lib/internal/memory.ts:91:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:91:28 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:91:31 + (i32.or + (i32.shr_u + (get_local $3) + ;;@ ~lib/internal/memory.ts:91:36 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:91:40 + (i32.shl + (get_local $4) + ;;@ ~lib/internal/memory.ts:91:45 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:92:10 + (set_local $3 + ;;@ ~lib/internal/memory.ts:92:14 + (i32.load + ;;@ ~lib/internal/memory.ts:92:24 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:92:30 + (i32.const 15) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:93:10 + (i32.store + ;;@ ~lib/internal/memory.ts:93:21 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:93:28 + (i32.const 12) + ) + ;;@ ~lib/internal/memory.ts:93:32 + (i32.or + (i32.shr_u + (get_local $4) + ;;@ ~lib/internal/memory.ts:93:37 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:93:41 + (i32.shl + (get_local $3) + ;;@ ~lib/internal/memory.ts:93:46 + (i32.const 24) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:94:10 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:94:17 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:94:21 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:94:29 + (i32.const 16) + ) + ) + ;;@ ~lib/internal/memory.ts:94:33 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:94:38 + (i32.const 16) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:96:8 + (br $break|2) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:102:2 + (if + ;;@ ~lib/internal/memory.ts:102:6 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:102:10 + (i32.const 16) + ) + ;;@ ~lib/internal/memory.ts:102:14 + (block + ;;@ ~lib/internal/memory.ts:103:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:103:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:103:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:103:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:104:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:104:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:104:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:104:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:105:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:105:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:105:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:105:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:106:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:106:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:106:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:106:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:107:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:107:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:107:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:107:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:108:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:108:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:108:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:108:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:109:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:109:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:109:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:109:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:110:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:110:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:110:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:110:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:111:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:111:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:111:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:111:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:112:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:112:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:112:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:112:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:113:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:113:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:113:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:113:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:114:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:114:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:114:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:114:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:115:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:115:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:115:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:115:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:116:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:116:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:116:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:116:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:117:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:117:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:117:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:117:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:118:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:118:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:118:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:118:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:120:2 + (if + ;;@ ~lib/internal/memory.ts:120:6 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:120:10 + (i32.const 8) + ) + ;;@ ~lib/internal/memory.ts:120:13 + (block + ;;@ ~lib/internal/memory.ts:121:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:121:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:121:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:121:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:122:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:122:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:122:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:122:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:123:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:123:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:123:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:123:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:124:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:124:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:124:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:124:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:125:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:125:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:125:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:125:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:126:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:126:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:126:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:126:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:127:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:127:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:127:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:127:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:128:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:128:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:128:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:128:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:130:2 + (if + ;;@ ~lib/internal/memory.ts:130:6 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:130:10 + (i32.const 4) + ) + ;;@ ~lib/internal/memory.ts:130:13 + (block + ;;@ ~lib/internal/memory.ts:131:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:131:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:131:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:131:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:132:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:132:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:132:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:132:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:133:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:133:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:133:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:133:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:134:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:134:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:134:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:134:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:136:2 + (if + ;;@ ~lib/internal/memory.ts:136:6 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:136:10 + (i32.const 2) + ) + ;;@ ~lib/internal/memory.ts:136:13 + (block + ;;@ ~lib/internal/memory.ts:137:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:137:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:137:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:137:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:138:4 + (i32.store8 + ;;@ ~lib/internal/memory.ts:138:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:138:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:138:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:140:2 + (if + ;;@ ~lib/internal/memory.ts:140:6 + (i32.and + (get_local $2) + ;;@ ~lib/internal/memory.ts:140:10 + (i32.const 1) + ) + ;;@ ~lib/internal/memory.ts:140:13 + (i32.store8 + ;;@ ~lib/internal/memory.ts:141:14 + (block (result i32) + (set_local $5 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ;;@ ~lib/internal/memory.ts:141:22 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:141:31 + (block (result i32) + (set_local $5 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $5) + (i32.const 1) + ) + ) + (get_local $5) + ) + ) + ) + ) + ) + (func $~lib/internal/memory/memmove (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + ;;@ ~lib/internal/memory.ts:147:2 + (if + ;;@ ~lib/internal/memory.ts:147:6 + (i32.eq + (get_local $0) + ;;@ ~lib/internal/memory.ts:147:14 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:147:19 + (return) + ) + ;;@ ~lib/internal/memory.ts:148:2 + (if + ;;@ ~lib/internal/memory.ts:148:6 + (if (result i32) + (tee_local $3 + (i32.le_u + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:148:12 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:148:17 + (get_local $0) + ) + ) + (get_local $3) + ;;@ ~lib/internal/memory.ts:148:25 + (i32.le_u + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:148:32 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:148:37 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:148:42 + (block + ;;@ ~lib/internal/memory.ts:149:4 + (call $~lib/internal/memory/memcpy + ;;@ ~lib/internal/memory.ts:149:11 + (get_local $0) + ;;@ ~lib/internal/memory.ts:149:17 + (get_local $1) + ;;@ ~lib/internal/memory.ts:149:22 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:150:4 + (return) + ) + ) + ;;@ ~lib/internal/memory.ts:152:2 + (if + ;;@ ~lib/internal/memory.ts:152:6 + (i32.lt_u + (get_local $0) + ;;@ ~lib/internal/memory.ts:152:13 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:152:18 + (block + ;;@ ~lib/internal/memory.ts:153:4 + (if + ;;@ ~lib/internal/memory.ts:153:8 + (i32.eq + (i32.and + ;;@ ~lib/internal/memory.ts:153:9 + (get_local $1) + ;;@ ~lib/internal/memory.ts:153:15 + (i32.const 7) + ) + ;;@ ~lib/internal/memory.ts:153:21 + (i32.and + ;;@ ~lib/internal/memory.ts:153:22 + (get_local $0) + ;;@ ~lib/internal/memory.ts:153:29 + (i32.const 7) + ) + ) + ;;@ ~lib/internal/memory.ts:153:33 + (block + ;;@ ~lib/internal/memory.ts:154:6 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/internal/memory.ts:154:13 + (i32.and + (get_local $0) + ;;@ ~lib/internal/memory.ts:154:20 + (i32.const 7) + ) + (block + ;;@ ~lib/internal/memory.ts:154:23 + (block + ;;@ ~lib/internal/memory.ts:155:8 + (if + ;;@ ~lib/internal/memory.ts:155:12 + (i32.eqz + ;;@ ~lib/internal/memory.ts:155:13 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:155:16 + (return) + ) + ;;@ ~lib/internal/memory.ts:156:8 + (set_local $2 + (i32.sub + ;;@ ~lib/internal/memory.ts:156:10 + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/internal/memory.ts:157:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:157:18 + (block (result i32) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ;;@ ~lib/internal/memory.ts:157:26 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:157:35 + (block (result i32) + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:159:6 + (block $break|1 + (loop $continue|1 + (if + ;;@ ~lib/internal/memory.ts:159:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:159:18 + (i32.const 8) + ) + (block + ;;@ ~lib/internal/memory.ts:159:21 + (block + ;;@ ~lib/internal/memory.ts:160:8 + (i64.store + ;;@ ~lib/internal/memory.ts:160:19 + (get_local $0) + ;;@ ~lib/internal/memory.ts:160:25 + (i64.load + ;;@ ~lib/internal/memory.ts:160:35 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:161:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:161:16 + (i32.const 8) + ) + ) + ;;@ ~lib/internal/memory.ts:162:8 + (set_local $0 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:162:16 + (i32.const 8) + ) + ) + ;;@ ~lib/internal/memory.ts:163:8 + (set_local $1 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:163:16 + (i32.const 8) + ) + ) + ) + (br $continue|1) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:166:4 + (block $break|2 + (loop $continue|2 + (if + ;;@ ~lib/internal/memory.ts:166:11 + (get_local $2) + (block + ;;@ ~lib/internal/memory.ts:166:14 + (block + ;;@ ~lib/internal/memory.ts:167:6 + (i32.store8 + ;;@ ~lib/internal/memory.ts:167:16 + (block (result i32) + (set_local $3 + (get_local $0) + ) + (set_local $0 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ;;@ ~lib/internal/memory.ts:167:24 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:167:33 + (block (result i32) + (set_local $3 + (get_local $1) + ) + (set_local $1 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:168:6 + (set_local $2 + (i32.sub + ;;@ ~lib/internal/memory.ts:168:8 + (get_local $2) + (i32.const 1) + ) + ) + ) + (br $continue|2) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:170:9 + (block + ;;@ ~lib/internal/memory.ts:171:4 + (if + ;;@ ~lib/internal/memory.ts:171:8 + (i32.eq + (i32.and + ;;@ ~lib/internal/memory.ts:171:9 + (get_local $1) + ;;@ ~lib/internal/memory.ts:171:15 + (i32.const 7) + ) + ;;@ ~lib/internal/memory.ts:171:21 + (i32.and + ;;@ ~lib/internal/memory.ts:171:22 + (get_local $0) + ;;@ ~lib/internal/memory.ts:171:29 + (i32.const 7) + ) + ) + ;;@ ~lib/internal/memory.ts:171:33 + (block + ;;@ ~lib/internal/memory.ts:172:6 + (block $break|3 + (loop $continue|3 + (if + ;;@ ~lib/internal/memory.ts:172:13 + (i32.and + (i32.add + ;;@ ~lib/internal/memory.ts:172:14 + (get_local $0) + ;;@ ~lib/internal/memory.ts:172:21 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:172:26 + (i32.const 7) + ) + (block + ;;@ ~lib/internal/memory.ts:172:29 + (block + ;;@ ~lib/internal/memory.ts:173:8 + (if + ;;@ ~lib/internal/memory.ts:173:12 + (i32.eqz + ;;@ ~lib/internal/memory.ts:173:13 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:173:16 + (return) + ) + ;;@ ~lib/internal/memory.ts:174:8 + (i32.store8 + ;;@ ~lib/internal/memory.ts:174:18 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:174:25 + (tee_local $2 + (i32.sub + ;;@ ~lib/internal/memory.ts:174:27 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:174:30 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:174:39 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:174:45 + (get_local $2) + ) + ) + ) + ) + (br $continue|3) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:176:6 + (block $break|4 + (loop $continue|4 + (if + ;;@ ~lib/internal/memory.ts:176:13 + (i32.ge_u + (get_local $2) + ;;@ ~lib/internal/memory.ts:176:18 + (i32.const 8) + ) + (block + ;;@ ~lib/internal/memory.ts:176:21 + (block + ;;@ ~lib/internal/memory.ts:177:8 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/memory.ts:177:13 + (i32.const 8) + ) + ) + ;;@ ~lib/internal/memory.ts:178:8 + (i64.store + ;;@ ~lib/internal/memory.ts:178:19 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:178:26 + (get_local $2) + ) + ;;@ ~lib/internal/memory.ts:178:29 + (i64.load + ;;@ ~lib/internal/memory.ts:178:39 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:178:45 + (get_local $2) + ) + ) + ) + ) + (br $continue|4) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:181:4 + (block $break|5 + (loop $continue|5 + (if + ;;@ ~lib/internal/memory.ts:181:11 + (get_local $2) + (block + ;;@ ~lib/internal/memory.ts:181:14 + (i32.store8 + ;;@ ~lib/internal/memory.ts:182:16 + (i32.add + (get_local $0) + ;;@ ~lib/internal/memory.ts:182:23 + (tee_local $2 + (i32.sub + ;;@ ~lib/internal/memory.ts:182:25 + (get_local $2) + (i32.const 1) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:182:28 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:182:37 + (i32.add + (get_local $1) + ;;@ ~lib/internal/memory.ts:182:43 + (get_local $2) + ) + ) + ) + (br $continue|5) + ) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.copy (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/memory.ts:20:4 + (call $~lib/internal/memory/memmove + ;;@ ~lib/memory.ts:20:12 + (get_local $0) + ;;@ ~lib/memory.ts:20:18 + (get_local $1) + ;;@ ~lib/memory.ts:20:23 + (get_local $2) + ) + ) + (func $~lib/internal/memory/memcmp (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + ;;@ ~lib/internal/memory.ts:249:2 + (if + ;;@ ~lib/internal/memory.ts:249:6 + (i32.eq + (get_local $0) + ;;@ ~lib/internal/memory.ts:249:12 + (get_local $1) + ) + ;;@ ~lib/internal/memory.ts:249:23 + (return + (i32.const 0) + ) + ) + ;;@ ~lib/internal/memory.ts:250:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/internal/memory.ts:250:9 + (if (result i32) + (tee_local $3 + (i32.ne + (get_local $2) + ;;@ ~lib/internal/memory.ts:250:14 + (i32.const 0) + ) + ) + ;;@ ~lib/internal/memory.ts:250:19 + (i32.eq + (i32.load8_u + ;;@ ~lib/internal/memory.ts:250:28 + (get_local $0) + ) + ;;@ ~lib/internal/memory.ts:250:35 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:250:44 + (get_local $1) + ) + ) + (get_local $3) + ) + (block + ;;@ ~lib/internal/memory.ts:250:49 + (block + ;;@ ~lib/internal/memory.ts:251:4 + (set_local $2 + (i32.sub + (get_local $2) + (i32.const 1) + ) + ) + ;;@ ~lib/internal/memory.ts:251:9 + (set_local $0 + (i32.add + (get_local $0) + (i32.const 1) + ) + ) + ;;@ ~lib/internal/memory.ts:251:15 + (set_local $1 + (i32.add + (get_local $1) + (i32.const 1) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/internal/memory.ts:253:53 + (if (result i32) + ;;@ ~lib/internal/memory.ts:253:9 + (get_local $2) + ;;@ ~lib/internal/memory.ts:253:13 + (i32.sub + (i32.load8_u + ;;@ ~lib/internal/memory.ts:253:27 + (get_local $0) + ) + ;;@ ~lib/internal/memory.ts:253:33 + (i32.load8_u + ;;@ ~lib/internal/memory.ts:253:47 + (get_local $1) + ) + ) + ;;@ ~lib/internal/memory.ts:253:53 + (i32.const 0) + ) + ) + (func $~lib/memory/memory.compare (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + ;;@ ~lib/memory.ts:25:27 + (call $~lib/internal/memory/memcmp + ;;@ ~lib/memory.ts:25:18 + (get_local $0) + ;;@ ~lib/memory.ts:25:22 + (get_local $1) + ;;@ ~lib/memory.ts:25:26 + (get_local $2) + ) + ) + (func $~lib/allocator/tlsf/Root#set:tailRef (; 9 ;) (type $iiv) (param $0 i32) (param $1 i32) + ;;@ ~lib/allocator/tlsf.ts:181:30 + (i32.store offset=2912 + ;;@ ~lib/allocator/tlsf.ts:181:43 + (i32.const 0) + ;;@ ~lib/allocator/tlsf.ts:181:46 + (get_local $1) + ) + ) + (func $~lib/allocator/tlsf/Root#setSLMap (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/allocator/tlsf.ts:144:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:144:11 + (i32.lt_u + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:144:16 + (get_global $~lib/allocator/tlsf/FL_BITS) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 144) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:145:4 + (i32.store offset=4 + ;;@ ~lib/allocator/tlsf.ts:145:15 + (i32.add + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:145:41 + (i32.mul + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:145:46 + (i32.const 4) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:145:49 + (get_local $2) + ) + ) + (func $~lib/allocator/tlsf/Root#setHead (; 11 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + ;;@ ~lib/allocator/tlsf.ts:167:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:167:11 + (i32.lt_u + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:167:16 + (get_global $~lib/allocator/tlsf/FL_BITS) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 167) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:168:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:168:11 + (i32.lt_u + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:168:16 + (get_global $~lib/allocator/tlsf/SL_SIZE) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 168) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:169:4 + (i32.store offset=96 + ;;@ ~lib/allocator/tlsf.ts:170:6 + (i32.add + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:170:32 + (i32.mul + (i32.add + ;;@ ~lib/allocator/tlsf.ts:170:33 + (i32.mul + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:170:38 + (get_global $~lib/allocator/tlsf/SL_SIZE) + ) + ;;@ ~lib/allocator/tlsf.ts:170:48 + (get_local $2) + ) + ;;@ ~lib/allocator/tlsf.ts:170:61 + (i32.const 4) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:171:6 + (get_local $3) + ) + ) + (func $~lib/allocator/tlsf/Root#get:tailRef (; 12 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/allocator/tlsf.ts:180:58 + (i32.load offset=2912 + ;;@ ~lib/allocator/tlsf.ts:180:44 + (i32.const 0) + ) + ) + (func $~lib/allocator/tlsf/Block#get:right (; 13 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) + ;;@ ~lib/allocator/tlsf.ts:89:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:89:11 + (i32.and + (i32.load + (get_local $0) + ) + ;;@ ~lib/allocator/tlsf.ts:89:23 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:89:24 + (get_global $~lib/allocator/tlsf/TAGS) + (i32.const -1) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 89) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:94:4 + (if (result i32) + (i32.eqz + (tee_local $1 + ;;@ ~lib/allocator/tlsf.ts:91:6 + (i32.add + ;;@ ~lib/allocator/tlsf.ts:92:8 + (i32.add + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:92:34 + (get_global $~lib/allocator/tlsf/Block.INFO) + ) + ;;@ ~lib/allocator/tlsf.ts:92:47 + (i32.and + ;;@ ~lib/allocator/tlsf.ts:92:48 + (i32.load + (get_local $0) + ) + ;;@ ~lib/allocator/tlsf.ts:92:60 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:92:61 + (get_global $~lib/allocator/tlsf/TAGS) + (i32.const -1) + ) + ) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 90) + (i32.const 11) + ) + (unreachable) + ) + (get_local $1) + ) + ) + (func $~lib/allocator/tlsf/fls (; 14 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/allocator/tlsf.ts:428:2 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:428:9 + (i32.ne + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:428:17 + (i32.const 0) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 428) + (i32.const 2) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:430:26 + (i32.sub + ;;@ ~lib/allocator/tlsf.ts:430:9 + (i32.const 31) + ;;@ ~lib/allocator/tlsf.ts:430:15 + (i32.clz + ;;@ ~lib/allocator/tlsf.ts:430:22 + (get_local $0) + ) + ) + ) + (func $~lib/allocator/tlsf/Root#getHead (; 15 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + ;;@ ~lib/allocator/tlsf.ts:158:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:158:11 + (i32.lt_u + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:158:16 + (get_global $~lib/allocator/tlsf/FL_BITS) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 158) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:159:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:159:11 + (i32.lt_u + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:159:16 + (get_global $~lib/allocator/tlsf/SL_SIZE) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 159) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:162:20 + (i32.load offset=96 + ;;@ ~lib/allocator/tlsf.ts:161:6 + (i32.add + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:161:32 + (i32.mul + (i32.add + ;;@ ~lib/allocator/tlsf.ts:161:33 + (i32.mul + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:161:38 + (get_global $~lib/allocator/tlsf/SL_SIZE) + ) + ;;@ ~lib/allocator/tlsf.ts:161:48 + (get_local $2) + ) + ;;@ ~lib/allocator/tlsf.ts:161:61 + (i32.const 4) + ) + ) + ) + ) + (func $~lib/allocator/tlsf/Root#getSLMap (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + ;;@ ~lib/allocator/tlsf.ts:138:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:138:11 + (i32.lt_u + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:138:16 + (get_global $~lib/allocator/tlsf/FL_BITS) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 138) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:139:68 + (i32.load offset=4 + ;;@ ~lib/allocator/tlsf.ts:139:21 + (i32.add + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:139:47 + (i32.mul + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:139:52 + (i32.const 4) + ) + ) + ) + ) + (func $~lib/allocator/tlsf/Root#remove (; 17 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) - get_global $assembly/index/off - set_local $0 - block $break|0 - loop $continue|0 - get_local $0 - tee_local $1 - i32.const 1 - i32.add - set_local $0 - get_local $2 - get_local $1 - i32.load8_u - tee_local $1 - i32.const 127 - i32.and - get_local $3 - i32.shl - i32.or - set_local $2 - get_local $1 - i32.const 128 - i32.and - i32.eqz - br_if $break|0 - get_local $3 - i32.const 7 - i32.add - set_local $3 - br $continue|0 - unreachable - end - unreachable - end - get_local $0 - set_global $assembly/index/off - get_local $2 - ) - (func $assembly/index/readVarint (; 20 ;) (type $ii) (param $0 i32) (result i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + ;;@ ~lib/allocator/tlsf.ts:257:4 + (set_local $2 + ;;@ ~lib/allocator/tlsf.ts:257:20 + (i32.load + (get_local $1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:258:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:258:11 + (i32.and + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:258:23 + (get_global $~lib/allocator/tlsf/FREE) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 258) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:259:4 + (set_local $3 + ;;@ ~lib/allocator/tlsf.ts:259:15 + (i32.and + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:259:27 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:259:28 + (get_global $~lib/allocator/tlsf/TAGS) + (i32.const -1) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:260:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:260:11 + (if (result i32) + (tee_local $4 + (i32.ge_u + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:260:19 + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:260:37 + (i32.lt_u + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:260:44 + (get_global $~lib/allocator/tlsf/Block.MAX_SIZE) + ) + (get_local $4) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 260) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:264:4 + (if + ;;@ ~lib/allocator/tlsf.ts:264:8 + (i32.lt_u + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:264:15 + (get_global $~lib/allocator/tlsf/SB_SIZE) + ) + ;;@ ~lib/allocator/tlsf.ts:264:24 + (block + ;;@ ~lib/allocator/tlsf.ts:265:6 + (set_local $5 + ;;@ ~lib/allocator/tlsf.ts:265:11 + (i32.const 0) + ) + ;;@ ~lib/allocator/tlsf.ts:266:6 + (set_local $6 + ;;@ ~lib/allocator/tlsf.ts:266:11 + (i32.div_u + ;;@ ~lib/allocator/tlsf.ts:266:17 + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:266:24 + (get_global $~lib/internal/allocator/AL_SIZE) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:267:11 + (block + ;;@ ~lib/allocator/tlsf.ts:268:6 + (set_local $5 + ;;@ ~lib/allocator/tlsf.ts:268:11 + (call $~lib/allocator/tlsf/fls + ;;@ ~lib/allocator/tlsf.ts:268:22 + (get_local $3) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:269:6 + (set_local $6 + ;;@ ~lib/allocator/tlsf.ts:269:11 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:269:17 + (i32.shr_u + ;;@ ~lib/allocator/tlsf.ts:269:18 + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:269:26 + (i32.sub + ;;@ ~lib/allocator/tlsf.ts:269:27 + (get_local $5) + ;;@ ~lib/allocator/tlsf.ts:269:32 + (get_global $~lib/allocator/tlsf/SL_BITS) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:269:44 + (i32.shl + ;;@ ~lib/allocator/tlsf.ts:269:45 + (i32.const 1) + ;;@ ~lib/allocator/tlsf.ts:269:50 + (get_global $~lib/allocator/tlsf/SL_BITS) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:270:6 + (set_local $5 + (i32.sub + (get_local $5) + ;;@ ~lib/allocator/tlsf.ts:270:12 + (i32.sub + (get_global $~lib/allocator/tlsf/SB_BITS) + ;;@ ~lib/allocator/tlsf.ts:270:22 + (i32.const 1) + ) + ) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:274:4 + (set_local $7 + ;;@ ~lib/allocator/tlsf.ts:274:15 + (i32.load offset=4 + (get_local $1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:275:4 + (set_local $8 + ;;@ ~lib/allocator/tlsf.ts:275:15 + (i32.load offset=8 + (get_local $1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:276:4 + (if + ;;@ ~lib/allocator/tlsf.ts:276:8 + (get_local $7) + ;;@ ~lib/allocator/tlsf.ts:276:14 + (i32.store offset=8 + (get_local $7) + ;;@ ~lib/allocator/tlsf.ts:276:26 + (get_local $8) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:277:4 + (if + ;;@ ~lib/allocator/tlsf.ts:277:8 + (get_local $8) + ;;@ ~lib/allocator/tlsf.ts:277:14 + (i32.store offset=4 + (get_local $8) + ;;@ ~lib/allocator/tlsf.ts:277:26 + (get_local $7) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:280:4 + (if + ;;@ ~lib/allocator/tlsf.ts:280:8 + (i32.eq + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:280:22 + (call $~lib/allocator/tlsf/Root#getHead + ;;@ ~lib/allocator/tlsf.ts:280:17 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:280:30 + (get_local $5) + ;;@ ~lib/allocator/tlsf.ts:280:34 + (get_local $6) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:280:39 + (block + ;;@ ~lib/allocator/tlsf.ts:281:11 + (call $~lib/allocator/tlsf/Root#setHead + ;;@ ~lib/allocator/tlsf.ts:281:6 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:281:19 + (get_local $5) + ;;@ ~lib/allocator/tlsf.ts:281:23 + (get_local $6) + ;;@ ~lib/allocator/tlsf.ts:281:27 + (get_local $8) + ) + ;;@ ~lib/allocator/tlsf.ts:284:6 + (if + ;;@ ~lib/allocator/tlsf.ts:284:10 + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:284:11 + (get_local $8) + ) + ;;@ ~lib/allocator/tlsf.ts:284:17 + (block + ;;@ ~lib/allocator/tlsf.ts:285:8 + (set_local $4 + ;;@ ~lib/allocator/tlsf.ts:285:25 + (call $~lib/allocator/tlsf/Root#getSLMap + ;;@ ~lib/allocator/tlsf.ts:285:20 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:285:34 + (get_local $5) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:286:13 + (call $~lib/allocator/tlsf/Root#setSLMap + ;;@ ~lib/allocator/tlsf.ts:286:8 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:286:22 + (get_local $5) + ;;@ ~lib/allocator/tlsf.ts:286:26 + (tee_local $4 + (i32.and + (get_local $4) + ;;@ ~lib/allocator/tlsf.ts:286:35 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:286:36 + (i32.shl + ;;@ ~lib/allocator/tlsf.ts:286:37 + (i32.const 1) + ;;@ ~lib/allocator/tlsf.ts:286:42 + (get_local $6) + ) + (i32.const -1) + ) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:289:8 + (if + ;;@ ~lib/allocator/tlsf.ts:289:12 + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:289:13 + (get_local $4) + ) + ;;@ ~lib/allocator/tlsf.ts:289:20 + (i32.store + (get_local $0) + (i32.and + (i32.load + (get_local $0) + ) + ;;@ ~lib/allocator/tlsf.ts:289:34 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:289:35 + (i32.shl + ;;@ ~lib/allocator/tlsf.ts:289:36 + (i32.const 1) + ;;@ ~lib/allocator/tlsf.ts:289:41 + (get_local $5) + ) + (i32.const -1) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (func $~lib/allocator/tlsf/Block#get:left (; 18 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) + ;;@ ~lib/allocator/tlsf.ts:81:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:81:11 + (i32.and + (i32.load + (get_local $0) + ) + ;;@ ~lib/allocator/tlsf.ts:81:23 + (get_global $~lib/allocator/tlsf/LEFT_FREE) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 81) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:84:4 + (if (result i32) + (i32.eqz + (tee_local $1 + ;;@ ~lib/allocator/tlsf.ts:83:6 + (i32.load + ;;@ ~lib/allocator/tlsf.ts:83:18 + (i32.sub + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:83:44 + (i32.const 4) + ) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 82) + (i32.const 11) + ) + (unreachable) + ) + (get_local $1) + ) + ) + (func $~lib/allocator/tlsf/Root#setJump (; 19 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + ;;@ ~lib/allocator/tlsf.ts:334:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:334:11 + (i32.and + (i32.load + (get_local $1) + ) + ;;@ ~lib/allocator/tlsf.ts:334:23 + (get_global $~lib/allocator/tlsf/FREE) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 334) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:335:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:335:11 + (i32.eq + (call $~lib/allocator/tlsf/Block#get:right + (get_local $1) + ) + ;;@ ~lib/allocator/tlsf.ts:335:25 + (get_local $2) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 335) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:336:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:336:11 + (i32.and + (i32.load + (get_local $2) + ) + ;;@ ~lib/allocator/tlsf.ts:336:24 + (get_global $~lib/allocator/tlsf/LEFT_FREE) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 336) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:337:4 + (i32.store + ;;@ ~lib/allocator/tlsf.ts:338:6 + (i32.sub + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:338:33 + (i32.const 4) + ) + ;;@ ~lib/allocator/tlsf.ts:339:6 + (get_local $1) + ) + ) + (func $~lib/allocator/tlsf/Root#insert (; 20 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - get_global $assembly/index/off - set_local $2 - loop $continue|0 - get_local $2 - tee_local $4 - i32.const 1 - i32.add - set_local $2 - get_local $3 - get_local $4 - i32.load8_u - tee_local $5 - i32.const 127 - i32.and - get_local $1 - i32.shl - i32.or - set_local $3 - get_local $1 - i32.const 7 - i32.add - set_local $1 - get_local $5 - i32.const 128 - i32.and - br_if $continue|0 - end - get_local $2 - set_global $assembly/index/off - get_local $3 - i32.const -1 - get_local $1 - i32.shl - i32.or - set_local $2 - get_local $1 - get_local $0 - i32.lt_u - tee_local $4 - if - get_local $5 - i32.const 64 - i32.and - i32.const 0 - i32.ne - set_local $4 - end - get_local $2 - get_local $3 - get_local $4 - select - ) - (func $assembly/index/readVarint64 (; 21 ;) (type $I) (result i64) - (local $0 i64) - (local $1 i64) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + ;;@ ~lib/allocator/tlsf.ts:189:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:189:11 + (get_local $1) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 189) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:190:4 + (set_local $2 + ;;@ ~lib/allocator/tlsf.ts:190:20 + (i32.load + (get_local $1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:191:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:191:11 + (i32.and + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:191:23 + (get_global $~lib/allocator/tlsf/FREE) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 191) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:193:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:194:6 + (if (result i32) + (tee_local $4 + (i32.ge_u + (tee_local $3 + ;;@ ~lib/allocator/tlsf.ts:194:14 + (i32.and + (i32.load + (get_local $1) + ) + ;;@ ~lib/allocator/tlsf.ts:194:27 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:194:28 + (get_global $~lib/allocator/tlsf/TAGS) + (i32.const -1) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:194:37 + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:194:55 + (i32.lt_u + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:194:62 + (get_global $~lib/allocator/tlsf/Block.MAX_SIZE) + ) + (get_local $4) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 193) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:197:4 + (set_local $5 + ;;@ ~lib/allocator/tlsf.ts:197:23 + (if (result i32) + (i32.eqz + (tee_local $4 + ;;@ ~lib/allocator/tlsf.ts:197:30 + (call $~lib/allocator/tlsf/Block#get:right + (get_local $1) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 197) + (i32.const 23) + ) + (unreachable) + ) + (get_local $4) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:198:4 + (set_local $6 + ;;@ ~lib/allocator/tlsf.ts:198:20 + (i32.load + (get_local $5) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:201:4 + (if + ;;@ ~lib/allocator/tlsf.ts:201:8 + (i32.and + (get_local $6) + ;;@ ~lib/allocator/tlsf.ts:201:20 + (get_global $~lib/allocator/tlsf/FREE) + ) + ;;@ ~lib/allocator/tlsf.ts:201:26 + (block + ;;@ ~lib/allocator/tlsf.ts:202:11 + (call $~lib/allocator/tlsf/Root#remove + ;;@ ~lib/allocator/tlsf.ts:202:6 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:202:18 + (get_local $5) + ) + ;;@ ~lib/allocator/tlsf.ts:203:6 + (i32.store + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:203:19 + (tee_local $2 + (i32.add + ;;@ ~lib/allocator/tlsf.ts:203:20 + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:203:33 + (i32.add + (get_global $~lib/allocator/tlsf/Block.INFO) + ;;@ ~lib/allocator/tlsf.ts:203:46 + (i32.and + ;;@ ~lib/allocator/tlsf.ts:203:47 + (get_local $6) + ;;@ ~lib/allocator/tlsf.ts:203:59 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:203:60 + (get_global $~lib/allocator/tlsf/TAGS) + (i32.const -1) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:204:6 + (set_local $5 + ;;@ ~lib/allocator/tlsf.ts:204:14 + (call $~lib/allocator/tlsf/Block#get:right + (get_local $1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:205:6 + (set_local $6 + ;;@ ~lib/allocator/tlsf.ts:205:18 + (i32.load + (get_local $5) + ) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:210:4 + (if + ;;@ ~lib/allocator/tlsf.ts:210:8 + (i32.and + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:210:20 + (get_global $~lib/allocator/tlsf/LEFT_FREE) + ) + ;;@ ~lib/allocator/tlsf.ts:210:31 + (block + ;;@ ~lib/allocator/tlsf.ts:211:6 + (set_local $4 + ;;@ ~lib/allocator/tlsf.ts:211:24 + (if (result i32) + (i32.eqz + (tee_local $4 + ;;@ ~lib/allocator/tlsf.ts:211:31 + (call $~lib/allocator/tlsf/Block#get:left + (get_local $1) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 211) + (i32.const 24) + ) + (unreachable) + ) + (get_local $4) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:212:6 + (set_local $7 + ;;@ ~lib/allocator/tlsf.ts:212:21 + (i32.load + (get_local $4) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:213:6 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:213:13 + (i32.and + (get_local $7) + ;;@ ~lib/allocator/tlsf.ts:213:24 + (get_global $~lib/allocator/tlsf/FREE) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 213) + (i32.const 6) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:214:11 + (call $~lib/allocator/tlsf/Root#remove + ;;@ ~lib/allocator/tlsf.ts:214:6 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:214:18 + (get_local $4) + ) + ;;@ ~lib/allocator/tlsf.ts:215:6 + (i32.store + (get_local $4) + ;;@ ~lib/allocator/tlsf.ts:215:18 + (tee_local $7 + (i32.add + ;;@ ~lib/allocator/tlsf.ts:215:19 + (get_local $7) + ;;@ ~lib/allocator/tlsf.ts:215:31 + (i32.add + (get_global $~lib/allocator/tlsf/Block.INFO) + ;;@ ~lib/allocator/tlsf.ts:215:44 + (i32.and + ;;@ ~lib/allocator/tlsf.ts:215:45 + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:215:57 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:215:58 + (get_global $~lib/allocator/tlsf/TAGS) + (i32.const -1) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:216:6 + (set_local $1 + ;;@ ~lib/allocator/tlsf.ts:216:14 + (get_local $4) + ) + ;;@ ~lib/allocator/tlsf.ts:217:6 + (set_local $2 + ;;@ ~lib/allocator/tlsf.ts:217:18 + (get_local $7) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:221:4 + (i32.store + (get_local $5) + ;;@ ~lib/allocator/tlsf.ts:221:17 + (i32.or + (get_local $6) + ;;@ ~lib/allocator/tlsf.ts:221:29 + (get_global $~lib/allocator/tlsf/LEFT_FREE) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:222:9 + (call $~lib/allocator/tlsf/Root#setJump + ;;@ ~lib/allocator/tlsf.ts:222:4 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:222:17 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:222:24 + (get_local $5) + ) + ;;@ ~lib/allocator/tlsf.ts:225:4 + (set_local $3 + ;;@ ~lib/allocator/tlsf.ts:225:11 + (i32.and + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:225:23 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:225:24 + (get_global $~lib/allocator/tlsf/TAGS) + (i32.const -1) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:226:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:226:11 + (if (result i32) + (tee_local $7 + (i32.ge_u + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:226:19 + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:226:37 + (i32.lt_u + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:226:44 + (get_global $~lib/allocator/tlsf/Block.MAX_SIZE) + ) + (get_local $7) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 226) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:230:4 + (if + ;;@ ~lib/allocator/tlsf.ts:230:8 + (i32.lt_u + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:230:15 + (get_global $~lib/allocator/tlsf/SB_SIZE) + ) + ;;@ ~lib/allocator/tlsf.ts:230:24 + (block + ;;@ ~lib/allocator/tlsf.ts:231:6 + (set_local $8 + ;;@ ~lib/allocator/tlsf.ts:231:11 + (i32.const 0) + ) + ;;@ ~lib/allocator/tlsf.ts:232:6 + (set_local $9 + ;;@ ~lib/allocator/tlsf.ts:232:11 + (i32.div_u + ;;@ ~lib/allocator/tlsf.ts:232:17 + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:232:24 + (get_global $~lib/internal/allocator/AL_SIZE) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:233:11 + (block + ;;@ ~lib/allocator/tlsf.ts:234:6 + (set_local $8 + ;;@ ~lib/allocator/tlsf.ts:234:11 + (call $~lib/allocator/tlsf/fls + ;;@ ~lib/allocator/tlsf.ts:234:22 + (get_local $3) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:235:6 + (set_local $9 + ;;@ ~lib/allocator/tlsf.ts:235:11 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:235:17 + (i32.shr_u + ;;@ ~lib/allocator/tlsf.ts:235:18 + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:235:26 + (i32.sub + ;;@ ~lib/allocator/tlsf.ts:235:27 + (get_local $8) + ;;@ ~lib/allocator/tlsf.ts:235:32 + (get_global $~lib/allocator/tlsf/SL_BITS) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:235:44 + (i32.shl + ;;@ ~lib/allocator/tlsf.ts:235:45 + (i32.const 1) + ;;@ ~lib/allocator/tlsf.ts:235:50 + (get_global $~lib/allocator/tlsf/SL_BITS) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:236:6 + (set_local $8 + (i32.sub + (get_local $8) + ;;@ ~lib/allocator/tlsf.ts:236:12 + (i32.sub + (get_global $~lib/allocator/tlsf/SB_BITS) + ;;@ ~lib/allocator/tlsf.ts:236:22 + (i32.const 1) + ) + ) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:240:4 + (set_local $10 + ;;@ ~lib/allocator/tlsf.ts:240:20 + (call $~lib/allocator/tlsf/Root#getHead + ;;@ ~lib/allocator/tlsf.ts:240:15 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:240:28 + (get_local $8) + ;;@ ~lib/allocator/tlsf.ts:240:32 + (get_local $9) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:241:4 + (i32.store offset=4 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:241:17 + (i32.const 0) + ) + ;;@ ~lib/allocator/tlsf.ts:242:4 + (i32.store offset=8 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:242:17 + (get_local $10) + ) + ;;@ ~lib/allocator/tlsf.ts:243:4 + (if + ;;@ ~lib/allocator/tlsf.ts:243:8 + (get_local $10) + ;;@ ~lib/allocator/tlsf.ts:243:14 + (i32.store offset=4 + (get_local $10) + ;;@ ~lib/allocator/tlsf.ts:243:26 + (get_local $1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:244:9 + (call $~lib/allocator/tlsf/Root#setHead + ;;@ ~lib/allocator/tlsf.ts:244:4 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:244:17 + (get_local $8) + ;;@ ~lib/allocator/tlsf.ts:244:21 + (get_local $9) + ;;@ ~lib/allocator/tlsf.ts:244:25 + (get_local $1) + ) + ;;@ ~lib/allocator/tlsf.ts:247:4 + (i32.store + (get_local $0) + (i32.or + (i32.load + (get_local $0) + ) + ;;@ ~lib/allocator/tlsf.ts:247:18 + (i32.shl + ;;@ ~lib/allocator/tlsf.ts:247:19 + (i32.const 1) + ;;@ ~lib/allocator/tlsf.ts:247:24 + (get_local $8) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:248:9 + (call $~lib/allocator/tlsf/Root#setSLMap + ;;@ ~lib/allocator/tlsf.ts:248:4 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:248:18 + (get_local $8) + ;;@ ~lib/allocator/tlsf.ts:248:22 + (i32.or + ;;@ ~lib/allocator/tlsf.ts:248:27 + (call $~lib/allocator/tlsf/Root#getSLMap + ;;@ ~lib/allocator/tlsf.ts:248:22 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:248:36 + (get_local $8) + ) + ;;@ ~lib/allocator/tlsf.ts:248:42 + (i32.shl + ;;@ ~lib/allocator/tlsf.ts:248:43 + (i32.const 1) + ;;@ ~lib/allocator/tlsf.ts:248:48 + (get_local $9) + ) + ) + ) + ) + (func $~lib/allocator/tlsf/Root#addMemory (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + ;;@ ~lib/allocator/tlsf.ts:377:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:377:11 + (i32.le_u + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:377:20 + (get_local $2) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 377) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:378:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:378:11 + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:378:12 + (i32.and + ;;@ ~lib/allocator/tlsf.ts:378:13 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:378:21 + (get_global $~lib/internal/allocator/AL_MASK) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 378) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:379:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:379:11 + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:379:12 + (i32.and + ;;@ ~lib/allocator/tlsf.ts:379:13 + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:379:19 + (get_global $~lib/internal/allocator/AL_MASK) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 379) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:381:4 + (set_local $3 + ;;@ ~lib/allocator/tlsf.ts:381:18 + (call $~lib/allocator/tlsf/Root#get:tailRef + (get_local $0) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:382:4 + (set_local $4 + ;;@ ~lib/allocator/tlsf.ts:382:26 + (i32.const 0) + ) + ;;@ ~lib/allocator/tlsf.ts:383:4 + (if + ;;@ ~lib/allocator/tlsf.ts:383:8 + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:383:17 + (block + ;;@ ~lib/allocator/tlsf.ts:384:6 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:384:13 + (i32.ge_u + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:384:22 + (i32.add + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:384:32 + (i32.const 4) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 384) + (i32.const 6) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:387:6 + (if + ;;@ ~lib/allocator/tlsf.ts:387:10 + (i32.eq + (i32.sub + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:387:18 + (get_global $~lib/allocator/tlsf/Block.INFO) + ) + ;;@ ~lib/allocator/tlsf.ts:387:32 + (get_local $3) + ) + ;;@ ~lib/allocator/tlsf.ts:387:41 + (block + ;;@ ~lib/allocator/tlsf.ts:388:8 + (set_local $1 + (i32.sub + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:388:17 + (get_global $~lib/allocator/tlsf/Block.INFO) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:389:8 + (set_local $4 + ;;@ ~lib/allocator/tlsf.ts:389:19 + (i32.load + (get_local $3) + ) + ) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:392:11 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:393:13 + (i32.ge_u + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:393:22 + (i32.add + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:393:48 + (get_global $~lib/allocator/tlsf/Root.SIZE) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 393) + (i32.const 6) + ) + (unreachable) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:397:4 + (set_local $5 + ;;@ ~lib/allocator/tlsf.ts:397:15 + (i32.sub + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:397:21 + (get_local $1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:398:4 + (if + ;;@ ~lib/allocator/tlsf.ts:398:8 + (i32.lt_u + (get_local $5) + ;;@ ~lib/allocator/tlsf.ts:398:15 + (i32.add + (i32.add + (get_global $~lib/allocator/tlsf/Block.INFO) + ;;@ ~lib/allocator/tlsf.ts:398:28 + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) + ) + ;;@ ~lib/allocator/tlsf.ts:398:45 + (get_global $~lib/allocator/tlsf/Block.INFO) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:398:57 + (return + ;;@ ~lib/allocator/tlsf.ts:399:13 + (i32.const 0) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:403:4 + (set_local $6 + ;;@ ~lib/allocator/tlsf.ts:403:19 + (i32.sub + (get_local $5) + ;;@ ~lib/allocator/tlsf.ts:403:26 + (i32.mul + (i32.const 2) + ;;@ ~lib/allocator/tlsf.ts:403:30 + (get_global $~lib/allocator/tlsf/Block.INFO) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:404:4 + (set_local $7 + ;;@ ~lib/allocator/tlsf.ts:404:15 + (get_local $1) + ) + ;;@ ~lib/allocator/tlsf.ts:405:4 + (i32.store + (get_local $7) + ;;@ ~lib/allocator/tlsf.ts:405:16 + (i32.or + (i32.or + (get_local $6) + ;;@ ~lib/allocator/tlsf.ts:405:27 + (get_global $~lib/allocator/tlsf/FREE) + ) + ;;@ ~lib/allocator/tlsf.ts:405:34 + (i32.and + ;;@ ~lib/allocator/tlsf.ts:405:35 + (get_local $4) + ;;@ ~lib/allocator/tlsf.ts:405:46 + (get_global $~lib/allocator/tlsf/LEFT_FREE) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:406:4 + (i32.store offset=4 + (get_local $7) + ;;@ ~lib/allocator/tlsf.ts:406:16 + (i32.const 0) + ) + ;;@ ~lib/allocator/tlsf.ts:407:4 + (i32.store offset=8 + (get_local $7) + ;;@ ~lib/allocator/tlsf.ts:407:16 + (i32.const 0) + ) + ;;@ ~lib/allocator/tlsf.ts:410:4 + (set_local $8 + ;;@ ~lib/allocator/tlsf.ts:410:15 + (i32.sub + ;;@ ~lib/allocator/tlsf.ts:410:33 + (i32.add + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:410:41 + (get_local $5) + ) + ;;@ ~lib/allocator/tlsf.ts:410:48 + (get_global $~lib/allocator/tlsf/Block.INFO) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:411:4 + (i32.store + (get_local $8) + ;;@ ~lib/allocator/tlsf.ts:411:16 + (i32.or + (i32.const 0) + ;;@ ~lib/allocator/tlsf.ts:411:20 + (get_global $~lib/allocator/tlsf/LEFT_FREE) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:412:4 + (call $~lib/allocator/tlsf/Root#set:tailRef + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:412:19 + (get_local $8) + ) + ;;@ ~lib/allocator/tlsf.ts:414:9 + (call $~lib/allocator/tlsf/Root#insert + ;;@ ~lib/allocator/tlsf.ts:414:4 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:414:16 + (get_local $7) + ) + ;;@ ~lib/allocator/tlsf.ts:416:11 + (i32.const 1) + ) + (func $~lib/allocator/tlsf/ffs (; 22 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/allocator/tlsf.ts:422:2 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:422:9 + (i32.ne + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:422:17 + (i32.const 0) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 422) + (i32.const 2) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:423:20 + (i32.ctz + ;;@ ~lib/allocator/tlsf.ts:423:16 + (get_local $0) + ) + ) + (func $~lib/allocator/tlsf/ffs (; 23 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/allocator/tlsf.ts:422:2 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:422:9 + (i32.ne + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:422:17 + (i32.const 0) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 422) + (i32.const 2) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:423:20 + (i32.ctz + ;;@ ~lib/allocator/tlsf.ts:423:16 + (get_local $0) + ) + ) + (func $~lib/allocator/tlsf/Root#search (; 24 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) - (local $4 i64) - (local $5 i64) - get_global $assembly/index/off - set_local $3 - loop $continue|0 - get_local $3 - tee_local $2 - i32.const 1 - i32.add - set_local $3 - get_local $1 - get_local $2 - i64.load8_u - tee_local $4 - i64.const 127 - i64.and - get_local $0 - i64.shl - i64.or - set_local $1 - get_local $0 - i64.const 7 - i64.add - set_local $0 - get_local $4 - i64.const 128 - i64.and - i64.const 0 - i64.ne - br_if $continue|0 - end - get_local $3 - set_global $assembly/index/off - get_local $1 - i64.const -1 - get_local $0 - i64.shl - i64.or - set_local $5 - get_local $0 - i64.const 64 - i64.lt_u - tee_local $2 - if - get_local $4 - i64.const 64 - i64.and - i64.const 0 - i64.ne - set_local $2 - end - get_local $5 - get_local $1 - get_local $2 - select - ) - (func $assembly/index/skipInitExpr (; 22 ;) (type $v) - (local $0 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + ;;@ ~lib/allocator/tlsf.ts:296:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:296:11 + (if (result i32) + (tee_local $2 + (i32.ge_u + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:296:19 + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:296:37 + (i32.lt_u + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:296:44 + (get_global $~lib/allocator/tlsf/Block.MAX_SIZE) + ) + (get_local $2) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 296) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:300:4 + (if + ;;@ ~lib/allocator/tlsf.ts:300:8 + (i32.lt_u + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:300:15 + (get_global $~lib/allocator/tlsf/SB_SIZE) + ) + ;;@ ~lib/allocator/tlsf.ts:300:24 + (block + ;;@ ~lib/allocator/tlsf.ts:301:6 + (set_local $3 + ;;@ ~lib/allocator/tlsf.ts:301:11 + (i32.const 0) + ) + ;;@ ~lib/allocator/tlsf.ts:302:6 + (set_local $4 + ;;@ ~lib/allocator/tlsf.ts:302:11 + (i32.div_u + ;;@ ~lib/allocator/tlsf.ts:302:17 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:302:24 + (get_global $~lib/internal/allocator/AL_SIZE) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:303:11 + (block + ;;@ ~lib/allocator/tlsf.ts:305:6 + (set_local $3 + ;;@ ~lib/allocator/tlsf.ts:305:11 + (call $~lib/allocator/tlsf/fls + ;;@ ~lib/allocator/tlsf.ts:305:22 + (get_local $1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:306:6 + (set_local $4 + ;;@ ~lib/allocator/tlsf.ts:306:11 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:306:17 + (i32.shr_u + ;;@ ~lib/allocator/tlsf.ts:306:18 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:306:26 + (i32.sub + ;;@ ~lib/allocator/tlsf.ts:306:27 + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:306:32 + (get_global $~lib/allocator/tlsf/SL_BITS) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:306:44 + (i32.shl + ;;@ ~lib/allocator/tlsf.ts:306:45 + (i32.const 1) + ;;@ ~lib/allocator/tlsf.ts:306:50 + (get_global $~lib/allocator/tlsf/SL_BITS) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:307:6 + (set_local $3 + (i32.sub + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:307:12 + (i32.sub + (get_global $~lib/allocator/tlsf/SB_BITS) + ;;@ ~lib/allocator/tlsf.ts:307:22 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:309:6 + (if + ;;@ ~lib/allocator/tlsf.ts:309:10 + (i32.lt_u + (get_local $4) + ;;@ ~lib/allocator/tlsf.ts:309:15 + (i32.sub + (get_global $~lib/allocator/tlsf/SL_SIZE) + ;;@ ~lib/allocator/tlsf.ts:309:25 + (i32.const 1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:309:28 + (set_local $4 + (i32.add + ;;@ ~lib/allocator/tlsf.ts:309:30 + (get_local $4) + (i32.const 1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:310:11 + (block + (set_local $3 + (i32.add + ;;@ ~lib/allocator/tlsf.ts:310:13 + (get_local $3) + (i32.const 1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:310:17 + (set_local $4 + ;;@ ~lib/allocator/tlsf.ts:310:22 + (i32.const 0) + ) + ) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:314:4 + (set_local $5 + ;;@ ~lib/allocator/tlsf.ts:314:16 + (i32.and + ;;@ ~lib/allocator/tlsf.ts:314:21 + (call $~lib/allocator/tlsf/Root#getSLMap + ;;@ ~lib/allocator/tlsf.ts:314:16 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:314:30 + (get_local $3) + ) + ;;@ ~lib/allocator/tlsf.ts:314:36 + (i32.shl + ;;@ ~lib/allocator/tlsf.ts:314:37 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:314:38 + (i32.const 0) + (i32.const -1) + ) + ;;@ ~lib/allocator/tlsf.ts:314:43 + (get_local $4) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:316:4 + (if + ;;@ ~lib/allocator/tlsf.ts:316:8 + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:316:9 + (get_local $5) + ) + ;;@ ~lib/allocator/tlsf.ts:316:16 + (block + ;;@ ~lib/allocator/tlsf.ts:318:6 + (set_local $2 + ;;@ ~lib/allocator/tlsf.ts:318:18 + (i32.and + (i32.load + (get_local $0) + ) + ;;@ ~lib/allocator/tlsf.ts:318:31 + (i32.shl + ;;@ ~lib/allocator/tlsf.ts:318:32 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:318:33 + (i32.const 0) + (i32.const -1) + ) + ;;@ ~lib/allocator/tlsf.ts:318:38 + (i32.add + ;;@ ~lib/allocator/tlsf.ts:318:39 + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:318:44 + (i32.const 1) + ) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:319:6 + (if + ;;@ ~lib/allocator/tlsf.ts:319:10 + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:319:11 + (get_local $2) + ) + ;;@ ~lib/allocator/tlsf.ts:319:18 + (set_local $6 + ;;@ ~lib/allocator/tlsf.ts:320:15 + (i32.const 0) + ) + ;;@ ~lib/allocator/tlsf.ts:321:13 + (block + ;;@ ~lib/allocator/tlsf.ts:322:8 + (set_local $3 + ;;@ ~lib/allocator/tlsf.ts:322:13 + (call $~lib/allocator/tlsf/ffs + ;;@ ~lib/allocator/tlsf.ts:322:24 + (get_local $2) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:323:8 + (set_local $5 + ;;@ ~lib/allocator/tlsf.ts:323:16 + (if (result i32) + (tee_local $7 + ;;@ ~lib/allocator/tlsf.ts:323:28 + (call $~lib/allocator/tlsf/Root#getSLMap + ;;@ ~lib/allocator/tlsf.ts:323:23 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:323:37 + (get_local $3) + ) + ) + (get_local $7) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 323) + (i32.const 16) + ) + (unreachable) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:324:8 + (set_local $6 + ;;@ ~lib/allocator/tlsf.ts:324:20 + (call $~lib/allocator/tlsf/Root#getHead + ;;@ ~lib/allocator/tlsf.ts:324:15 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:324:28 + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:324:32 + (call $~lib/allocator/tlsf/ffs + ;;@ ~lib/allocator/tlsf.ts:324:41 + (get_local $5) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:326:11 + (set_local $6 + ;;@ ~lib/allocator/tlsf.ts:327:18 + (call $~lib/allocator/tlsf/Root#getHead + ;;@ ~lib/allocator/tlsf.ts:327:13 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:327:26 + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:327:30 + (call $~lib/allocator/tlsf/ffs + ;;@ ~lib/allocator/tlsf.ts:327:39 + (get_local $5) + ) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:329:11 + (get_local $6) + ) + (func $~lib/allocator/tlsf/Root#use (; 25 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + ;;@ ~lib/allocator/tlsf.ts:347:4 + (set_local $3 + ;;@ ~lib/allocator/tlsf.ts:347:20 + (i32.load + (get_local $1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:348:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:348:11 + (i32.and + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:348:23 + (get_global $~lib/allocator/tlsf/FREE) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 348) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:349:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:349:11 + (if (result i32) + (tee_local $4 + (i32.ge_u + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:349:19 + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:349:37 + (i32.lt_u + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:349:44 + (get_global $~lib/allocator/tlsf/Block.MAX_SIZE) + ) + (get_local $4) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 349) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:350:4 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:350:11 + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:350:12 + (i32.and + ;;@ ~lib/allocator/tlsf.ts:350:13 + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:350:20 + (get_global $~lib/internal/allocator/AL_MASK) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 350) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:352:9 + (call $~lib/allocator/tlsf/Root#remove + ;;@ ~lib/allocator/tlsf.ts:352:4 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:352:16 + (get_local $1) + ) + ;;@ ~lib/allocator/tlsf.ts:355:4 + (set_local $5 + ;;@ ~lib/allocator/tlsf.ts:355:20 + (i32.sub + (i32.and + ;;@ ~lib/allocator/tlsf.ts:355:21 + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:355:33 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:355:34 + (get_global $~lib/allocator/tlsf/TAGS) + (i32.const -1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:355:42 + (get_local $2) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:356:4 + (if + ;;@ ~lib/allocator/tlsf.ts:356:8 + (i32.ge_u + (get_local $5) + ;;@ ~lib/allocator/tlsf.ts:356:21 + (i32.add + (get_global $~lib/allocator/tlsf/Block.INFO) + ;;@ ~lib/allocator/tlsf.ts:356:34 + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:356:50 + (block + ;;@ ~lib/allocator/tlsf.ts:357:6 + (i32.store + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:357:19 + (i32.or + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:357:26 + (i32.and + ;;@ ~lib/allocator/tlsf.ts:357:27 + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:357:39 + (get_global $~lib/allocator/tlsf/LEFT_FREE) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:359:6 + (set_local $4 + ;;@ ~lib/allocator/tlsf.ts:359:18 + (i32.add + ;;@ ~lib/allocator/tlsf.ts:360:8 + (i32.add + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:360:35 + (get_global $~lib/allocator/tlsf/Block.INFO) + ) + ;;@ ~lib/allocator/tlsf.ts:360:48 + (get_local $2) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:362:6 + (i32.store + (get_local $4) + ;;@ ~lib/allocator/tlsf.ts:362:19 + (i32.or + (i32.sub + ;;@ ~lib/allocator/tlsf.ts:362:20 + (get_local $5) + ;;@ ~lib/allocator/tlsf.ts:362:32 + (get_global $~lib/allocator/tlsf/Block.INFO) + ) + ;;@ ~lib/allocator/tlsf.ts:362:46 + (get_global $~lib/allocator/tlsf/FREE) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:363:11 + (call $~lib/allocator/tlsf/Root#insert + ;;@ ~lib/allocator/tlsf.ts:363:6 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:363:18 + (get_local $4) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:366:11 + (block + ;;@ ~lib/allocator/tlsf.ts:367:6 + (i32.store + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:367:19 + (i32.and + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:367:31 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:367:32 + (get_global $~lib/allocator/tlsf/FREE) + (i32.const -1) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:368:6 + (set_local $4 + ;;@ ~lib/allocator/tlsf.ts:368:25 + (if (result i32) + (i32.eqz + (tee_local $4 + ;;@ ~lib/allocator/tlsf.ts:368:32 + (call $~lib/allocator/tlsf/Block#get:right + (get_local $1) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 368) + (i32.const 25) + ) + (unreachable) + ) + (get_local $4) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:369:6 + (i32.store + (get_local $4) + (i32.and + (i32.load + (get_local $4) + ) + ;;@ ~lib/allocator/tlsf.ts:369:20 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:369:21 + (get_global $~lib/allocator/tlsf/LEFT_FREE) + (i32.const -1) + ) + ) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:372:44 + (i32.add + ;;@ ~lib/allocator/tlsf.ts:372:11 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:372:38 + (get_global $~lib/allocator/tlsf/Block.INFO) + ) + ) + (func $~lib/allocator/tlsf/__memory_allocate (; 26 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) - block $break|0 - block $case5|0 - block $case4|0 - block $case3|0 - block $case2|0 - block $case1|0 - get_global $assembly/index/off - tee_local $1 - i32.load8_u - set_local $0 - get_local $1 - i32.const 1 - i32.add - set_global $assembly/index/off - get_local $0 - get_global $src/common/Opcode.i32_const - i32.ne - if - get_local $0 - get_global $src/common/Opcode.i64_const - i32.eq - br_if $case1|0 - get_local $0 - get_global $src/common/Opcode.f32_const - i32.eq - br_if $case2|0 - get_local $0 - get_global $src/common/Opcode.f64_const - i32.eq - br_if $case3|0 - get_local $0 - get_global $src/common/Opcode.get_global - i32.eq - br_if $case4|0 - br $case5|0 - end - i32.const 32 - call $assembly/index/readVarint - drop - br $break|0 - end - call $assembly/index/readVarint64 - drop - br $break|0 - end - get_global $assembly/index/off - tee_local $0 - i32.load - drop - get_local $0 - i32.const 4 - i32.add - set_global $assembly/index/off - br $break|0 - end - get_global $assembly/index/off - tee_local $0 - i64.load - drop - get_local $0 - i32.const 8 - i32.add - set_global $assembly/index/off - br $break|0 - end - call $assembly/index/readVaruint - drop - br $break|0 - end - unreachable - end - get_global $assembly/index/off - tee_local $1 - i32.load8_u - set_local $0 - get_local $1 - i32.const 1 - i32.add - set_global $assembly/index/off - get_local $0 - get_global $src/common/Opcode.end - i32.ne - if - unreachable - end - ) - (func $assembly/index/parse (; 23 ;) (type $iiv) (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + ;;@ ~lib/allocator/tlsf.ts:442:2 + (set_local $1 + ;;@ ~lib/allocator/tlsf.ts:442:13 + (get_global $~lib/allocator/tlsf/ROOT) + ) + ;;@ ~lib/allocator/tlsf.ts:443:2 + (if + ;;@ ~lib/allocator/tlsf.ts:443:6 + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:443:7 + (get_local $1) + ) + ;;@ ~lib/allocator/tlsf.ts:443:13 + (block + ;;@ ~lib/allocator/tlsf.ts:444:4 + (set_local $2 + ;;@ ~lib/allocator/tlsf.ts:444:21 + (i32.and + (i32.add + ;;@ ~lib/allocator/tlsf.ts:444:22 + (get_global $HEAP_BASE) + ;;@ ~lib/allocator/tlsf.ts:444:34 + (get_global $~lib/internal/allocator/AL_MASK) + ) + ;;@ ~lib/allocator/tlsf.ts:444:45 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:444:46 + (get_global $~lib/internal/allocator/AL_MASK) + (i32.const -1) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:445:4 + (set_local $3 + ;;@ ~lib/allocator/tlsf.ts:445:29 + (current_memory) + ) + ;;@ ~lib/allocator/tlsf.ts:446:4 + (set_local $4 + ;;@ ~lib/allocator/tlsf.ts:446:22 + (i32.shr_u + ;;@ ~lib/allocator/tlsf.ts:446:28 + (i32.and + ;;@ ~lib/allocator/tlsf.ts:446:29 + (i32.add + ;;@ ~lib/allocator/tlsf.ts:446:30 + (i32.add + ;;@ ~lib/allocator/tlsf.ts:446:31 + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:446:44 + (get_global $~lib/allocator/tlsf/Root.SIZE) + ) + ;;@ ~lib/allocator/tlsf.ts:446:57 + (i32.const 65535) + ) + ;;@ ~lib/allocator/tlsf.ts:446:67 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:446:68 + (i32.const 65535) + (i32.const -1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:446:80 + (i32.const 16) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:447:4 + (if + ;;@ ~lib/allocator/tlsf.ts:447:8 + (if (result i32) + (tee_local $5 + (i32.gt_s + (get_local $4) + ;;@ ~lib/allocator/tlsf.ts:447:22 + (get_local $3) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:447:37 + (i32.lt_s + ;;@ ~lib/allocator/tlsf.ts:447:44 + (grow_memory + ;;@ ~lib/allocator/tlsf.ts:447:49 + (i32.sub + (get_local $4) + ;;@ ~lib/allocator/tlsf.ts:447:63 + (get_local $3) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:447:78 + (i32.const 0) + ) + (get_local $5) + ) + ;;@ ~lib/allocator/tlsf.ts:447:81 + (unreachable) + ) + ;;@ ~lib/allocator/tlsf.ts:448:4 + (set_global $~lib/allocator/tlsf/ROOT + ;;@ ~lib/allocator/tlsf.ts:448:11 + (tee_local $1 + ;;@ ~lib/allocator/tlsf.ts:448:18 + (get_local $2) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:449:4 + (call $~lib/allocator/tlsf/Root#set:tailRef + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:449:19 + (i32.const 0) + ) + ;;@ ~lib/allocator/tlsf.ts:450:4 + (i32.store + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:450:17 + (i32.const 0) + ) + ;;@ ~lib/allocator/tlsf.ts:451:4 + (block $break|0 + ;;@ ~lib/allocator/tlsf.ts:451:9 + (set_local $5 + ;;@ ~lib/allocator/tlsf.ts:451:25 + (i32.const 0) + ) + (loop $repeat|0 + (br_if $break|0 + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:451:28 + (i32.lt_u + (get_local $5) + ;;@ ~lib/allocator/tlsf.ts:451:33 + (get_global $~lib/allocator/tlsf/FL_BITS) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:451:48 + (block + ;;@ ~lib/allocator/tlsf.ts:452:11 + (call $~lib/allocator/tlsf/Root#setSLMap + ;;@ ~lib/allocator/tlsf.ts:452:6 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:452:20 + (get_local $5) + ;;@ ~lib/allocator/tlsf.ts:452:24 + (i32.const 0) + ) + ;;@ ~lib/allocator/tlsf.ts:453:6 + (block $break|1 + ;;@ ~lib/allocator/tlsf.ts:453:11 + (set_local $6 + ;;@ ~lib/allocator/tlsf.ts:453:25 + (i32.const 0) + ) + (loop $repeat|1 + (br_if $break|1 + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:453:28 + (i32.lt_u + (get_local $6) + ;;@ ~lib/allocator/tlsf.ts:453:33 + (get_global $~lib/allocator/tlsf/SL_SIZE) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:454:13 + (call $~lib/allocator/tlsf/Root#setHead + ;;@ ~lib/allocator/tlsf.ts:454:8 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:454:21 + (get_local $5) + ;;@ ~lib/allocator/tlsf.ts:454:25 + (get_local $6) + ;;@ ~lib/allocator/tlsf.ts:454:29 + (i32.const 0) + ) + ;;@ ~lib/allocator/tlsf.ts:453:42 + (set_local $6 + (i32.add + ;;@ ~lib/allocator/tlsf.ts:453:44 + (get_local $6) + (i32.const 1) + ) + ) + (br $repeat|1) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:451:42 + (set_local $5 + (i32.add + ;;@ ~lib/allocator/tlsf.ts:451:44 + (get_local $5) + (i32.const 1) + ) + ) + (br $repeat|0) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:457:9 + (drop + (call $~lib/allocator/tlsf/Root#addMemory + ;;@ ~lib/allocator/tlsf.ts:457:4 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:457:19 + (i32.and + (i32.add + ;;@ ~lib/allocator/tlsf.ts:457:20 + (i32.add + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:457:33 + (get_global $~lib/allocator/tlsf/Root.SIZE) + ) + ;;@ ~lib/allocator/tlsf.ts:457:45 + (get_global $~lib/internal/allocator/AL_MASK) + ) + ;;@ ~lib/allocator/tlsf.ts:457:56 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:457:57 + (get_global $~lib/internal/allocator/AL_MASK) + (i32.const -1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:457:66 + (i32.shl + ;;@ ~lib/allocator/tlsf.ts:457:73 + (current_memory) + ;;@ ~lib/allocator/tlsf.ts:457:83 + (i32.const 16) + ) + ) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:461:2 + (if + ;;@ ~lib/allocator/tlsf.ts:461:6 + (i32.gt_u + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:461:13 + (get_global $~lib/allocator/tlsf/Block.MAX_SIZE) + ) + ;;@ ~lib/allocator/tlsf.ts:461:29 + (unreachable) + ) + ;;@ ~lib/allocator/tlsf.ts:464:2 + (set_local $0 + ;;@ ~lib/allocator/tlsf.ts:464:9 + (select + (tee_local $4 + ;;@ ~lib/allocator/tlsf.ts:464:20 + (i32.and + (i32.add + ;;@ ~lib/allocator/tlsf.ts:464:21 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:464:28 + (get_global $~lib/internal/allocator/AL_MASK) + ) + ;;@ ~lib/allocator/tlsf.ts:464:39 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:464:40 + (get_global $~lib/internal/allocator/AL_MASK) + (i32.const -1) + ) + ) + ) + (tee_local $3 + ;;@ ~lib/allocator/tlsf.ts:464:49 + (get_global $~lib/allocator/tlsf/Block.MIN_SIZE) + ) + (i32.gt_u + (get_local $4) + (get_local $3) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:466:2 + (set_local $7 + ;;@ ~lib/allocator/tlsf.ts:466:19 + (call $~lib/allocator/tlsf/Root#search + ;;@ ~lib/allocator/tlsf.ts:466:14 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:466:26 + (get_local $0) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:467:2 + (if + ;;@ ~lib/allocator/tlsf.ts:467:6 + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:467:7 + (get_local $7) + ) + ;;@ ~lib/allocator/tlsf.ts:467:14 + (block + ;;@ ~lib/allocator/tlsf.ts:470:4 + (set_local $4 + ;;@ ~lib/allocator/tlsf.ts:470:29 + (current_memory) + ) + ;;@ ~lib/allocator/tlsf.ts:471:4 + (set_local $3 + ;;@ ~lib/allocator/tlsf.ts:471:22 + (i32.shr_u + ;;@ ~lib/allocator/tlsf.ts:471:28 + (i32.and + ;;@ ~lib/allocator/tlsf.ts:471:29 + (i32.add + ;;@ ~lib/allocator/tlsf.ts:471:30 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:471:37 + (i32.const 65535) + ) + ;;@ ~lib/allocator/tlsf.ts:471:47 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:471:48 + (i32.const 65535) + (i32.const -1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:471:60 + (i32.const 16) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:472:4 + (set_local $2 + ;;@ ~lib/allocator/tlsf.ts:472:22 + (select + (tee_local $2 + ;;@ ~lib/allocator/tlsf.ts:472:26 + (get_local $4) + ) + (tee_local $5 + ;;@ ~lib/allocator/tlsf.ts:472:39 + (get_local $3) + ) + (i32.gt_s + (get_local $2) + (get_local $5) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:473:4 + (if + ;;@ ~lib/allocator/tlsf.ts:473:8 + (i32.lt_s + ;;@ ~lib/allocator/tlsf.ts:473:15 + (grow_memory + ;;@ ~lib/allocator/tlsf.ts:473:20 + (get_local $2) + ) + ;;@ ~lib/allocator/tlsf.ts:473:35 + (i32.const 0) + ) + ;;@ ~lib/allocator/tlsf.ts:473:38 + (if + ;;@ ~lib/allocator/tlsf.ts:474:10 + (i32.lt_s + ;;@ ~lib/allocator/tlsf.ts:474:17 + (grow_memory + ;;@ ~lib/allocator/tlsf.ts:474:22 + (get_local $3) + ) + ;;@ ~lib/allocator/tlsf.ts:474:37 + (i32.const 0) + ) + ;;@ ~lib/allocator/tlsf.ts:474:40 + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:478:4 + (set_local $5 + ;;@ ~lib/allocator/tlsf.ts:478:28 + (current_memory) + ) + ;;@ ~lib/allocator/tlsf.ts:479:9 + (drop + (call $~lib/allocator/tlsf/Root#addMemory + ;;@ ~lib/allocator/tlsf.ts:479:4 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:479:19 + (i32.shl + (get_local $4) + ;;@ ~lib/allocator/tlsf.ts:479:41 + (i32.const 16) + ) + ;;@ ~lib/allocator/tlsf.ts:479:45 + (i32.shl + (get_local $5) + ;;@ ~lib/allocator/tlsf.ts:479:66 + (i32.const 16) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:480:4 + (set_local $7 + ;;@ ~lib/allocator/tlsf.ts:480:12 + (if (result i32) + (i32.eqz + (tee_local $6 + ;;@ ~lib/allocator/tlsf.ts:480:24 + (call $~lib/allocator/tlsf/Root#search + ;;@ ~lib/allocator/tlsf.ts:480:19 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:480:31 + (get_local $0) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 480) + (i32.const 12) + ) + (unreachable) + ) + (get_local $6) + ) + ) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:483:2 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:483:9 + (i32.ge_u + (i32.and + ;;@ ~lib/allocator/tlsf.ts:483:10 + (i32.load + (get_local $7) + ) + ;;@ ~lib/allocator/tlsf.ts:483:23 + (i32.xor + ;;@ ~lib/allocator/tlsf.ts:483:24 + (get_global $~lib/allocator/tlsf/TAGS) + (i32.const -1) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:483:33 + (get_local $0) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 483) + (i32.const 2) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:484:36 + (call $~lib/allocator/tlsf/Root#use + ;;@ ~lib/allocator/tlsf.ts:484:9 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:484:18 + (get_local $7) + ;;@ ~lib/allocator/tlsf.ts:484:32 + (get_local $0) + ) + ) + (func $~lib/memory/memory.allocate (; 27 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/memory.ts:41:4 + (return + ;;@ ~lib/memory.ts:41:45 + (call $~lib/allocator/tlsf/__memory_allocate + ;;@ ~lib/memory.ts:41:63 + (get_local $0) + ) + ) + ) + (func $~lib/allocator/tlsf/__memory_free (; 28 ;) (type $iv) (param $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + ;;@ ~lib/allocator/tlsf.ts:489:2 + (if + ;;@ ~lib/allocator/tlsf.ts:489:6 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:489:12 + (block + ;;@ ~lib/allocator/tlsf.ts:490:4 + (set_local $1 + ;;@ ~lib/allocator/tlsf.ts:490:15 + (get_global $~lib/allocator/tlsf/ROOT) + ) + ;;@ ~lib/allocator/tlsf.ts:491:4 + (if + ;;@ ~lib/allocator/tlsf.ts:491:8 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:491:14 + (block + ;;@ ~lib/allocator/tlsf.ts:492:6 + (set_local $2 + ;;@ ~lib/allocator/tlsf.ts:492:18 + (i32.sub + ;;@ ~lib/allocator/tlsf.ts:492:36 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:492:43 + (get_global $~lib/allocator/tlsf/Block.INFO) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:493:6 + (set_local $3 + ;;@ ~lib/allocator/tlsf.ts:493:22 + (i32.load + (get_local $2) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:494:6 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:494:13 + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:494:14 + (i32.and + ;;@ ~lib/allocator/tlsf.ts:494:15 + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:494:27 + (get_global $~lib/allocator/tlsf/FREE) + ) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 494) + (i32.const 6) + ) + (unreachable) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:495:6 + (i32.store + (get_local $2) + ;;@ ~lib/allocator/tlsf.ts:495:19 + (i32.or + (get_local $3) + ;;@ ~lib/allocator/tlsf.ts:495:31 + (get_global $~lib/allocator/tlsf/FREE) + ) + ) + ;;@ ~lib/allocator/tlsf.ts:496:11 + (call $~lib/allocator/tlsf/Root#insert + ;;@ ~lib/allocator/tlsf.ts:496:6 + (get_local $1) + ;;@ ~lib/allocator/tlsf.ts:496:18 + (i32.sub + ;;@ ~lib/allocator/tlsf.ts:496:36 + (get_local $0) + ;;@ ~lib/allocator/tlsf.ts:496:43 + (get_global $~lib/allocator/tlsf/Block.INFO) + ) + ) + ) + ) + ) + ) + ) + (func $~lib/memory/memory.free (; 29 ;) (type $iv) (param $0 i32) + ;;@ ~lib/memory.ts:47:36 + (call $~lib/allocator/tlsf/__memory_free + ;;@ ~lib/memory.ts:47:50 + (get_local $0) + ) + ;;@ ~lib/memory.ts:47:56 + (return) + ) + (func $~lib/allocator/tlsf/__memory_reset (; 30 ;) (type $v) + ;;@ ~lib/allocator/tlsf.ts:502:2 + (unreachable) + ) + (func $~lib/memory/memory.reset (; 31 ;) (type $v) + ;;@ ~lib/memory.ts:53:37 + (call $~lib/allocator/tlsf/__memory_reset) + ;;@ ~lib/memory.ts:53:55 + (return) + ) + (func $~lib/array/Array#__get (; 32 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + ;;@ ~lib/array.ts:84:4 + (set_local $2 + ;;@ ~lib/array.ts:84:17 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:87:23 + (if (result i32) + ;;@ ~lib/array.ts:85:11 + (i32.lt_u + (get_local $1) + ;;@ ~lib/array.ts:85:24 + (i32.shr_u + ;;@ ~lib/array.ts:85:30 + (i32.load + (get_local $2) + ) + ;;@ ~lib/array.ts:85:52 + (i32.const 2) + ) + ) + ;;@ ~lib/array.ts:86:8 + (block $~lib/internal/arraybuffer/loadUnsafe|inlined.0 (result i32) + ;;@ ~lib/internal/arraybuffer.ts:68:91 + (i32.load offset=8 + ;;@ ~lib/internal/arraybuffer.ts:68:20 + (i32.add + (get_local $2) + ;;@ ~lib/internal/arraybuffer.ts:68:48 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:68:49 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:68:65 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/array.ts:87:8 + (unreachable) + ) + ) + (func $~lib/internal/arraybuffer/computeSize (; 33 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/internal/arraybuffer.ts:15:77 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:15:9 + (i32.const 1) + ;;@ ~lib/internal/arraybuffer.ts:15:21 + (i32.sub + ;;@ ~lib/internal/arraybuffer.ts:15:29 + (i32.const 32) + ;;@ ~lib/internal/arraybuffer.ts:15:39 + (i32.clz + ;;@ ~lib/internal/arraybuffer.ts:15:48 + (i32.sub + (i32.add + (get_local $0) + ;;@ ~lib/internal/arraybuffer.ts:15:61 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ;;@ ~lib/internal/arraybuffer.ts:15:75 + (i32.const 1) + ) + ) + ) + ) + ) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 34 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + ;;@ ~lib/internal/arraybuffer.ts:23:2 + (if + (i32.eqz + ;;@ ~lib/internal/arraybuffer.ts:23:9 + (i32.le_u + (get_local $0) + ;;@ ~lib/internal/arraybuffer.ts:23:28 + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 104) + (i32.const 23) + (i32.const 2) + ) + (unreachable) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:25:2 + (set_local $1 + ;;@ ~lib/internal/arraybuffer.ts:28:20 + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $2 + ;;@ ~lib/internal/arraybuffer.ts:28:29 + (call $~lib/internal/arraybuffer/computeSize + ;;@ ~lib/internal/arraybuffer.ts:28:41 + (get_local $0) + ) + ) + ;;@ ~lib/memory.ts:41:4 + (br $~lib/memory/memory.allocate|inlined.0 + ;;@ ~lib/memory.ts:41:45 + (call $~lib/allocator/tlsf/__memory_allocate + ;;@ ~lib/memory.ts:41:63 + (get_local $2) + ) + ) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:30:2 + (i32.store + ;;@ ~lib/internal/arraybuffer.ts:30:13 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:30:21 + (get_local $0) + ) + ;;@ ~lib/internal/arraybuffer.ts:31:39 + (get_local $1) + ) + (func $~lib/internal/arraybuffer/reallocateUnsafe (; 35 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + ;;@ ~lib/internal/arraybuffer.ts:35:2 + (set_local $2 + ;;@ ~lib/internal/arraybuffer.ts:35:22 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:36:2 + (if + ;;@ ~lib/internal/arraybuffer.ts:36:6 + (i32.gt_s + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:36:22 + (get_local $2) + ) + ;;@ ~lib/internal/arraybuffer.ts:36:37 + (block + ;;@ ~lib/internal/arraybuffer.ts:37:4 + (if + (i32.eqz + ;;@ ~lib/internal/arraybuffer.ts:37:11 + (i32.le_s + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:37:28 + (get_global $~lib/internal/arraybuffer/MAX_BLENGTH) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 104) + (i32.const 37) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:38:4 + (if + ;;@ ~lib/internal/arraybuffer.ts:38:8 + (i32.le_s + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:38:25 + (i32.sub + ;;@ ~lib/internal/arraybuffer.ts:38:31 + (call $~lib/internal/arraybuffer/computeSize + ;;@ ~lib/internal/arraybuffer.ts:38:43 + (get_local $2) + ) + ;;@ ~lib/internal/arraybuffer.ts:38:60 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:38:74 + (block + ;;@ ~lib/internal/arraybuffer.ts:39:6 + (i32.store + ;;@ ~lib/internal/arraybuffer.ts:39:17 + (get_local $0) + ;;@ ~lib/internal/arraybuffer.ts:39:44 + (get_local $1) + ) + ;;@ ~lib/internal/arraybuffer.ts:40:13 + (block $~lib/memory/memory.fill|inlined.0 + (set_local $3 + ;;@ ~lib/internal/arraybuffer.ts:41:8 + (i32.add + (i32.add + (get_local $0) + ;;@ ~lib/internal/arraybuffer.ts:41:36 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ;;@ ~lib/internal/arraybuffer.ts:41:50 + (get_local $2) + ) + ) + (set_local $4 + ;;@ ~lib/internal/arraybuffer.ts:42:8 + (i32.const 0) + ) + (set_local $5 + ;;@ ~lib/internal/arraybuffer.ts:43:8 + (i32.sub + ;;@ ~lib/internal/arraybuffer.ts:43:16 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:43:32 + (get_local $2) + ) + ) + (call $~lib/internal/memory/memset + (get_local $3) + (get_local $4) + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:45:11 + (block + ;;@ ~lib/internal/arraybuffer.ts:46:6 + (set_local $5 + ;;@ ~lib/internal/arraybuffer.ts:46:22 + (call $~lib/internal/arraybuffer/allocateUnsafe + ;;@ ~lib/internal/arraybuffer.ts:46:37 + (get_local $1) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:47:13 + (block $~lib/memory/memory.copy|inlined.0 + (set_local $4 + ;;@ ~lib/internal/arraybuffer.ts:48:8 + (i32.add + (get_local $5) + ;;@ ~lib/internal/arraybuffer.ts:48:39 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $3 + ;;@ ~lib/internal/arraybuffer.ts:49:8 + (i32.add + (get_local $0) + ;;@ ~lib/internal/arraybuffer.ts:49:36 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + ;;@ ~lib/memory.ts:20:4 + (call $~lib/internal/memory/memmove + ;;@ ~lib/memory.ts:20:12 + (get_local $4) + ;;@ ~lib/memory.ts:20:18 + (get_local $3) + ;;@ ~lib/memory.ts:20:23 + (get_local $2) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:52:13 + (block $~lib/memory/memory.fill|inlined.1 + (set_local $3 + ;;@ ~lib/internal/arraybuffer.ts:53:8 + (i32.add + (i32.add + (get_local $5) + ;;@ ~lib/internal/arraybuffer.ts:53:39 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ;;@ ~lib/internal/arraybuffer.ts:53:53 + (get_local $2) + ) + ) + (set_local $4 + ;;@ ~lib/internal/arraybuffer.ts:54:8 + (i32.const 0) + ) + (set_local $6 + ;;@ ~lib/internal/arraybuffer.ts:55:8 + (i32.sub + ;;@ ~lib/internal/arraybuffer.ts:55:16 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:55:32 + (get_local $2) + ) + ) + ;;@ ~lib/memory.ts:15:4 + (call $~lib/internal/memory/memset + ;;@ ~lib/memory.ts:15:11 + (get_local $3) + ;;@ ~lib/memory.ts:15:17 + (get_local $4) + ;;@ ~lib/memory.ts:15:20 + (get_local $6) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:57:13 + (return + (get_local $5) + ) + ) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:59:9 + (if + ;;@ ~lib/internal/arraybuffer.ts:59:13 + (i32.lt_s + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:59:29 + (get_local $2) + ) + ;;@ ~lib/internal/arraybuffer.ts:59:44 + (block + ;;@ ~lib/internal/arraybuffer.ts:61:4 + (if + (i32.eqz + ;;@ ~lib/internal/arraybuffer.ts:61:11 + (i32.ge_s + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:61:28 + (i32.const 0) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 104) + (i32.const 61) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:62:4 + (i32.store + ;;@ ~lib/internal/arraybuffer.ts:62:15 + (get_local $0) + ;;@ ~lib/internal/arraybuffer.ts:62:42 + (get_local $1) + ) + ) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:64:9 + (get_local $0) + ) + (func $~lib/array/Array#push (; 36 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + ;;@ ~lib/array.ts:166:4 + (set_local $2 + ;;@ ~lib/array.ts:166:17 + (i32.load offset=4 + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:167:4 + (set_local $3 + ;;@ ~lib/array.ts:167:17 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:168:4 + (set_local $4 + ;;@ ~lib/array.ts:168:19 + (i32.shr_u + (i32.load + (get_local $3) + ) + ;;@ ~lib/array.ts:168:41 + (i32.const 2) + ) + ) + ;;@ ~lib/array.ts:169:4 + (set_local $5 + ;;@ ~lib/array.ts:169:20 + (i32.add + (get_local $2) + ;;@ ~lib/array.ts:169:29 + (i32.const 1) + ) + ) + ;;@ ~lib/array.ts:170:4 + (if + ;;@ ~lib/array.ts:170:8 + (i32.ge_u + (get_local $2) + ;;@ ~lib/array.ts:170:23 + (get_local $4) + ) + ;;@ ~lib/array.ts:170:38 + (block + ;;@ ~lib/array.ts:172:6 + (if + ;;@ ~lib/array.ts:172:10 + (i32.ge_u + (get_local $2) + ;;@ ~lib/array.ts:172:25 + (i32.const 268435454) + ) + ;;@ ~lib/array.ts:172:42 + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 72) + (i32.const 172) + (i32.const 42) + ) + (unreachable) + ) + ) + ;;@ ~lib/array.ts:173:6 + (set_local $3 + ;;@ ~lib/array.ts:173:15 + (call $~lib/internal/arraybuffer/reallocateUnsafe + ;;@ ~lib/array.ts:173:32 + (get_local $3) + ;;@ ~lib/array.ts:173:40 + (i32.shl + (get_local $5) + ;;@ ~lib/array.ts:173:53 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/array.ts:174:6 + (i32.store + (get_local $0) + ;;@ ~lib/array.ts:174:21 + (get_local $3) + ) + ) + ) + ;;@ ~lib/array.ts:176:4 + (i32.store offset=4 + (get_local $0) + ;;@ ~lib/array.ts:176:19 + (get_local $5) + ) + ;;@ ~lib/array.ts:177:4 + (block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + ;;@ ~lib/internal/arraybuffer.ts:72:2 + (i32.store offset=8 + ;;@ ~lib/internal/arraybuffer.ts:72:11 + (i32.add + (get_local $3) + ;;@ ~lib/internal/arraybuffer.ts:72:39 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:72:40 + (get_local $2) + ;;@ ~lib/internal/arraybuffer.ts:72:56 + (i32.const 2) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:72:71 + (get_local $1) + ) + ) + ;;@ ~lib/array.ts:179:11 + (get_local $5) + ) + (func $assembly/module/index/Module#getID (; 37 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + ;;@ assembly/module/index.ts:58:4 + (set_local $2 + ;;@ assembly/module/index.ts:58:31 + (i32.const 64) + ) + ;;@ assembly/module/index.ts:59:4 + (set_local $3 + ;;@ assembly/module/index.ts:59:17 + (block $~lib/array/Array#get:length|inlined.0 (result i32) + (set_local $3 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:51:16 + (i32.load offset=4 + ;;@ ~lib/array.ts:51:11 + (get_local $3) + ) + ) + ) + ;;@ assembly/module/index.ts:60:4 + (block $break|0 + ;;@ assembly/module/index.ts:60:9 + (set_local $4 + ;;@ assembly/module/index.ts:60:15 + (i32.const 0) + ) + (loop $repeat|0 + (br_if $break|0 + (i32.eqz + ;;@ assembly/module/index.ts:60:18 + (i32.lt_s + (get_local $4) + ;;@ assembly/module/index.ts:60:22 + (get_local $3) + ) + ) + ) + ;;@ assembly/module/index.ts:61:6 + (if + ;;@ assembly/module/index.ts:61:10 + (i32.eq + (i32.load offset=4 + (call $~lib/array/Array#__get + (i32.load + (get_local $0) + ) + ;;@ assembly/module/index.ts:61:23 + (get_local $4) + ) + ) + ;;@ assembly/module/index.ts:61:32 + (get_local $1) + ) + ;;@ assembly/module/index.ts:61:35 + (drop + (call $~lib/array/Array#push + ;;@ assembly/module/index.ts:62:8 + (get_local $2) + ;;@ assembly/module/index.ts:62:17 + (call $~lib/array/Array#__get + (i32.load + (get_local $0) + ) + ;;@ assembly/module/index.ts:62:30 + (get_local $4) + ) + ) + ) + ) + ;;@ assembly/module/index.ts:60:25 + (set_local $4 + (i32.add + (get_local $4) + (i32.const 1) + ) + ) + (br $repeat|0) + ) + ) + ;;@ assembly/module/index.ts:65:11 + (get_local $2) + ) + (func $assembly/module/index/TypeSection#constructor (; 38 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + ;;@ assembly/module/index.ts:220:4 + (i32.store + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $2 + (call $~lib/memory/memory.allocate + (i32.const 8) + ) + ) + (i32.store + (get_local $2) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $2) + (i32.const 0) + ) + (get_local $2) + ) + ) + ) + ) + ;;@ assembly/module/index.ts:220:18 + (get_local $1) + ) + ;;@ assembly/module/index.ts:221:4 + (i32.store offset=4 + (get_local $0) + ;;@ assembly/module/index.ts:221:17 + (i32.const 176) + ) + (get_local $0) + ) + (func $assembly/buffer/index/Buffer#readVaruint (; 39 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + ;;@ assembly/buffer/index.ts:38:4 + (set_local $2 + ;;@ assembly/buffer/index.ts:38:19 + (i32.const 0) + ) + ;;@ assembly/buffer/index.ts:39:4 + (set_local $3 + ;;@ assembly/buffer/index.ts:39:19 + (i32.const 0) + ) + ;;@ assembly/buffer/index.ts:41:4 + (set_local $5 + ;;@ assembly/buffer/index.ts:41:15 + (i32.load offset=8 + (get_local $0) + ) + ) + ;;@ assembly/buffer/index.ts:42:4 + (block $break|0 + (loop $continue|0 + ;;@ assembly/buffer/index.ts:42:7 + (block + ;;@ assembly/buffer/index.ts:43:6 + (set_local $4 + ;;@ assembly/buffer/index.ts:43:12 + (i32.load8_u + ;;@ assembly/buffer/index.ts:43:21 + (block (result i32) + (set_local $6 + (get_local $5) + ) + (set_local $5 + (i32.add + (get_local $6) + (i32.const 1) + ) + ) + (get_local $6) + ) + ) + ) + ;;@ assembly/buffer/index.ts:44:6 + (set_local $2 + (i32.or + (get_local $2) + ;;@ assembly/buffer/index.ts:44:13 + (i32.shl + (i32.and + ;;@ assembly/buffer/index.ts:44:14 + (get_local $4) + ;;@ assembly/buffer/index.ts:44:20 + (i32.const 127) + ) + ;;@ assembly/buffer/index.ts:44:29 + (get_local $3) + ) + ) + ) + ;;@ assembly/buffer/index.ts:45:6 + (if + ;;@ assembly/buffer/index.ts:45:10 + (i32.eqz + ;;@ assembly/buffer/index.ts:45:11 + (i32.and + ;;@ assembly/buffer/index.ts:45:12 + (get_local $4) + ;;@ assembly/buffer/index.ts:45:18 + (i32.const 128) + ) + ) + ;;@ assembly/buffer/index.ts:45:25 + (br $break|0) + ) + ;;@ assembly/buffer/index.ts:46:6 + (set_local $3 + (i32.add + (get_local $3) + ;;@ assembly/buffer/index.ts:46:13 + (i32.const 7) + ) + ) + ) + (br_if $continue|0 + ;;@ assembly/buffer/index.ts:47:13 + (i32.const 1) + ) + ) + ) + ;;@ assembly/buffer/index.ts:48:5 + (i32.store offset=8 + (get_local $0) + ;;@ assembly/buffer/index.ts:48:16 + (get_local $5) + ) + ;;@ assembly/buffer/index.ts:49:11 + (get_local $2) + ) + (func $~lib/array/Array#constructor (; 40 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + ;;@ ~lib/array.ts:37:4 + (if + ;;@ ~lib/array.ts:37:8 + (i32.gt_u + (get_local $1) + ;;@ ~lib/array.ts:37:22 + (i32.const 268435454) + ) + ;;@ ~lib/array.ts:37:39 + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 72) + (i32.const 37) + (i32.const 39) + ) + (unreachable) + ) + ) + ;;@ ~lib/array.ts:38:4 + (set_local $2 + ;;@ ~lib/array.ts:38:21 + (i32.shl + (get_local $1) + ;;@ ~lib/array.ts:38:31 + (i32.const 2) + ) + ) + ;;@ ~lib/array.ts:39:4 + (set_local $3 + ;;@ ~lib/array.ts:39:17 + (call $~lib/internal/arraybuffer/allocateUnsafe + ;;@ ~lib/array.ts:39:32 + (get_local $2) + ) + ) + ;;@ ~lib/array.ts:40:4 + (i32.store + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $4 + (call $~lib/memory/memory.allocate + (i32.const 8) + ) + ) + (i32.store + (get_local $4) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $4) + (i32.const 0) + ) + (get_local $4) + ) + ) + ) + ) + ;;@ ~lib/array.ts:40:19 + (get_local $3) + ) + ;;@ ~lib/array.ts:41:4 + (i32.store offset=4 + (get_local $0) + ;;@ ~lib/array.ts:41:19 + (get_local $1) + ) + ;;@ ~lib/array.ts:42:11 + (block $~lib/memory/memory.fill|inlined.2 + (set_local $4 + ;;@ ~lib/array.ts:43:6 + (i32.add + (get_local $3) + ;;@ ~lib/array.ts:43:34 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + ;;@ ~lib/array.ts:44:6 + (i32.const 0) + ) + ;;@ ~lib/memory.ts:15:4 + (call $~lib/internal/memory/memset + ;;@ ~lib/memory.ts:15:11 + (get_local $4) + ;;@ ~lib/memory.ts:15:17 + (get_local $5) + ;;@ ~lib/memory.ts:15:20 + (get_local $2) + ) + ) + (get_local $0) + ) + (func $assembly/buffer/index/Buffer#readVarint (; 41 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + ;;@ assembly/buffer/index.ts:61:4 + (set_local $2 + ;;@ assembly/buffer/index.ts:61:19 + (i32.const 0) + ) + ;;@ assembly/buffer/index.ts:62:4 + (set_local $3 + ;;@ assembly/buffer/index.ts:62:19 + (i32.const 0) + ) + ;;@ assembly/buffer/index.ts:64:4 + (set_local $5 + ;;@ assembly/buffer/index.ts:64:15 + (i32.load offset=8 + (get_local $0) + ) + ) + ;;@ assembly/buffer/index.ts:65:4 + (block $break|0 + (loop $continue|0 + ;;@ assembly/buffer/index.ts:65:7 + (block + ;;@ assembly/buffer/index.ts:66:6 + (set_local $4 + ;;@ assembly/buffer/index.ts:66:12 + (i32.load8_u + ;;@ assembly/buffer/index.ts:66:21 + (block (result i32) + (set_local $6 + (get_local $5) + ) + (set_local $5 + (i32.add + (get_local $6) + (i32.const 1) + ) + ) + (get_local $6) + ) + ) + ) + ;;@ assembly/buffer/index.ts:67:6 + (set_local $2 + (i32.or + (get_local $2) + ;;@ assembly/buffer/index.ts:67:13 + (i32.shl + (i32.and + ;;@ assembly/buffer/index.ts:67:14 + (get_local $4) + ;;@ assembly/buffer/index.ts:67:20 + (i32.const 127) + ) + ;;@ assembly/buffer/index.ts:67:29 + (get_local $3) + ) + ) + ) + ;;@ assembly/buffer/index.ts:68:6 + (set_local $3 + (i32.add + (get_local $3) + ;;@ assembly/buffer/index.ts:68:13 + (i32.const 7) + ) + ) + ) + (br_if $continue|0 + ;;@ assembly/buffer/index.ts:69:13 + (i32.and + (get_local $4) + ;;@ assembly/buffer/index.ts:69:19 + (i32.const 128) + ) + ) + ) + ) + ;;@ assembly/buffer/index.ts:70:5 + (i32.store offset=8 + (get_local $0) + ;;@ assembly/buffer/index.ts:70:16 + (get_local $5) + ) + ;;@ assembly/buffer/index.ts:71:78 + (select + ;;@ assembly/buffer/index.ts:71:23 + (i32.or + (get_local $2) + ;;@ assembly/buffer/index.ts:71:29 + (i32.shl + ;;@ assembly/buffer/index.ts:71:30 + (i32.xor + ;;@ assembly/buffer/index.ts:71:31 + (i32.const 0) + (i32.const -1) + ) + ;;@ assembly/buffer/index.ts:71:36 + (get_local $3) + ) + ) + ;;@ assembly/buffer/index.ts:71:42 + (get_local $2) + ;;@ assembly/buffer/index.ts:71:47 + (if (result i32) + (tee_local $6 + (i32.lt_u + (get_local $3) + ;;@ assembly/buffer/index.ts:71:53 + (get_local $1) + ) + ) + ;;@ assembly/buffer/index.ts:71:61 + (i32.ne + (i32.and + ;;@ assembly/buffer/index.ts:71:62 + (get_local $4) + ;;@ assembly/buffer/index.ts:71:68 + (i32.const 64) + ) + ;;@ assembly/buffer/index.ts:71:77 + (i32.const 0) + ) + (get_local $6) + ) + ) + ) + (func $assembly/buffer/index/Buffer#readVarint8 (; 42 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + ;;@ assembly/buffer/index.ts:75:47 + (call $assembly/buffer/index/Buffer#readVarint + ;;@ assembly/buffer/index.ts:75:26 + (get_local $0) + ;;@ assembly/buffer/index.ts:75:42 + (get_local $1) + ) + ) + (func $assembly/module/index/FuncType#constructor (; 43 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $3 + (call $~lib/memory/memory.allocate + (i32.const 13) + ) + ) + (i32.store + (get_local $3) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $3) + (i32.const 0) + ) + (i32.store offset=8 + (get_local $3) + (get_local $1) + ) + (i32.store8 offset=12 + (get_local $3) + (get_local $2) + ) + (get_local $3) + ) + ) + ) + ) + ) + (func $~lib/array/Array#__set (; 44 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + ;;@ ~lib/array.ts:97:4 + (set_local $3 + ;;@ ~lib/array.ts:97:17 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:98:4 + (set_local $4 + ;;@ ~lib/array.ts:98:19 + (i32.shr_u + (i32.load + (get_local $3) + ) + ;;@ ~lib/array.ts:98:41 + (i32.const 2) + ) + ) + ;;@ ~lib/array.ts:99:4 + (if + ;;@ ~lib/array.ts:99:8 + (i32.ge_u + (get_local $1) + ;;@ ~lib/array.ts:99:22 + (get_local $4) + ) + ;;@ ~lib/array.ts:99:37 + (block + ;;@ ~lib/array.ts:101:6 + (if + ;;@ ~lib/array.ts:101:10 + (i32.ge_u + (get_local $1) + ;;@ ~lib/array.ts:101:24 + (i32.const 268435454) + ) + ;;@ ~lib/array.ts:101:41 + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 72) + (i32.const 101) + (i32.const 41) + ) + (unreachable) + ) + ) + ;;@ ~lib/array.ts:102:6 + (set_local $3 + ;;@ ~lib/array.ts:102:15 + (call $~lib/internal/arraybuffer/reallocateUnsafe + ;;@ ~lib/array.ts:102:32 + (get_local $3) + ;;@ ~lib/array.ts:102:40 + (i32.shl + (i32.add + ;;@ ~lib/array.ts:102:41 + (get_local $1) + ;;@ ~lib/array.ts:102:49 + (i32.const 1) + ) + ;;@ ~lib/array.ts:102:55 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/array.ts:103:6 + (i32.store + (get_local $0) + ;;@ ~lib/array.ts:103:21 + (get_local $3) + ) + ;;@ ~lib/array.ts:104:6 + (i32.store offset=4 + (get_local $0) + ;;@ ~lib/array.ts:104:21 + (i32.add + (get_local $1) + ;;@ ~lib/array.ts:104:29 + (i32.const 1) + ) + ) + ) + ) + ;;@ ~lib/array.ts:106:4 + (block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + ;;@ ~lib/internal/arraybuffer.ts:72:2 + (i32.store offset=8 + ;;@ ~lib/internal/arraybuffer.ts:72:11 + (i32.add + (get_local $3) + ;;@ ~lib/internal/arraybuffer.ts:72:39 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:72:40 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:72:56 + (i32.const 2) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:72:71 + (get_local $2) + ) + ) + ) + (func $~lib/array/Array#constructor (; 45 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + ;;@ ~lib/array.ts:37:4 + (if + ;;@ ~lib/array.ts:37:8 + (i32.gt_u + (get_local $1) + ;;@ ~lib/array.ts:37:22 + (i32.const 268435454) + ) + ;;@ ~lib/array.ts:37:39 + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 72) + (i32.const 37) + (i32.const 39) + ) + (unreachable) + ) + ) + ;;@ ~lib/array.ts:38:4 + (set_local $2 + ;;@ ~lib/array.ts:38:21 + (i32.shl + (get_local $1) + ;;@ ~lib/array.ts:38:31 + (i32.const 2) + ) + ) + ;;@ ~lib/array.ts:39:4 + (set_local $3 + ;;@ ~lib/array.ts:39:17 + (call $~lib/internal/arraybuffer/allocateUnsafe + ;;@ ~lib/array.ts:39:32 + (get_local $2) + ) + ) + ;;@ ~lib/array.ts:40:4 + (i32.store + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $4 + (call $~lib/memory/memory.allocate + (i32.const 8) + ) + ) + (i32.store + (get_local $4) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $4) + (i32.const 0) + ) + (get_local $4) + ) + ) + ) + ) + ;;@ ~lib/array.ts:40:19 + (get_local $3) + ) + ;;@ ~lib/array.ts:41:4 + (i32.store offset=4 + (get_local $0) + ;;@ ~lib/array.ts:41:19 + (get_local $1) + ) + ;;@ ~lib/array.ts:42:11 + (block $~lib/memory/memory.fill|inlined.3 + (set_local $4 + ;;@ ~lib/array.ts:43:6 + (i32.add + (get_local $3) + ;;@ ~lib/array.ts:43:34 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + ;;@ ~lib/array.ts:44:6 + (i32.const 0) + ) + ;;@ ~lib/memory.ts:15:4 + (call $~lib/internal/memory/memset + ;;@ ~lib/memory.ts:15:11 + (get_local $4) + ;;@ ~lib/memory.ts:15:17 + (get_local $5) + ;;@ ~lib/memory.ts:15:20 + (get_local $2) + ) + ) + (get_local $0) + ) + (func $~lib/array/Array#__get (; 46 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + ;;@ ~lib/array.ts:84:4 + (set_local $2 + ;;@ ~lib/array.ts:84:17 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:87:23 + (if (result i32) + ;;@ ~lib/array.ts:85:11 + (i32.lt_u + (get_local $1) + ;;@ ~lib/array.ts:85:24 + (i32.shr_u + ;;@ ~lib/array.ts:85:30 + (i32.load + (get_local $2) + ) + ;;@ ~lib/array.ts:85:52 + (i32.const 2) + ) + ) + ;;@ ~lib/array.ts:86:8 + (block $~lib/internal/arraybuffer/loadUnsafe|inlined.0 (result i32) + ;;@ ~lib/internal/arraybuffer.ts:68:91 + (i32.load offset=8 + ;;@ ~lib/internal/arraybuffer.ts:68:20 + (i32.add + (get_local $2) + ;;@ ~lib/internal/arraybuffer.ts:68:48 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:68:49 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:68:65 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/array.ts:87:8 + (unreachable) + ) + ) + (func $~lib/array/Array#__set (; 47 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + ;;@ ~lib/array.ts:97:4 + (set_local $3 + ;;@ ~lib/array.ts:97:17 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:98:4 + (set_local $4 + ;;@ ~lib/array.ts:98:19 + (i32.shr_u + (i32.load + (get_local $3) + ) + ;;@ ~lib/array.ts:98:41 + (i32.const 2) + ) + ) + ;;@ ~lib/array.ts:99:4 + (if + ;;@ ~lib/array.ts:99:8 + (i32.ge_u + (get_local $1) + ;;@ ~lib/array.ts:99:22 + (get_local $4) + ) + ;;@ ~lib/array.ts:99:37 + (block + ;;@ ~lib/array.ts:101:6 + (if + ;;@ ~lib/array.ts:101:10 + (i32.ge_u + (get_local $1) + ;;@ ~lib/array.ts:101:24 + (i32.const 268435454) + ) + ;;@ ~lib/array.ts:101:41 + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 72) + (i32.const 101) + (i32.const 41) + ) + (unreachable) + ) + ) + ;;@ ~lib/array.ts:102:6 + (set_local $3 + ;;@ ~lib/array.ts:102:15 + (call $~lib/internal/arraybuffer/reallocateUnsafe + ;;@ ~lib/array.ts:102:32 + (get_local $3) + ;;@ ~lib/array.ts:102:40 + (i32.shl + (i32.add + ;;@ ~lib/array.ts:102:41 + (get_local $1) + ;;@ ~lib/array.ts:102:49 + (i32.const 1) + ) + ;;@ ~lib/array.ts:102:55 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/array.ts:103:6 + (i32.store + (get_local $0) + ;;@ ~lib/array.ts:103:21 + (get_local $3) + ) + ;;@ ~lib/array.ts:104:6 + (i32.store offset=4 + (get_local $0) + ;;@ ~lib/array.ts:104:21 + (i32.add + (get_local $1) + ;;@ ~lib/array.ts:104:29 + (i32.const 1) + ) + ) + ) + ) + ;;@ ~lib/array.ts:106:4 + (block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + ;;@ ~lib/internal/arraybuffer.ts:72:2 + (i32.store offset=8 + ;;@ ~lib/internal/arraybuffer.ts:72:11 + (i32.add + (get_local $3) + ;;@ ~lib/internal/arraybuffer.ts:72:39 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:72:40 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:72:56 + (i32.const 2) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:72:71 + (get_local $2) + ) + ) + ) + (func $~lib/internal/number/decimalCount32 (; 48 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + ;;@ ~lib/internal/number.ts:131:4 + (if + ;;@ ~lib/internal/number.ts:131:8 + (i32.lt_u + (get_local $0) + ;;@ ~lib/internal/number.ts:131:16 + (i32.const 100000) + ) + ;;@ ~lib/internal/number.ts:131:24 + (block + ;;@ ~lib/internal/number.ts:132:6 + (if + ;;@ ~lib/internal/number.ts:132:10 + (i32.lt_u + (get_local $0) + ;;@ ~lib/internal/number.ts:132:18 + (i32.const 100) + ) + ;;@ ~lib/internal/number.ts:132:23 + (return + ;;@ ~lib/internal/number.ts:133:15 + (select + ;;@ ~lib/internal/number.ts:133:27 + (i32.const 1) + ;;@ ~lib/internal/number.ts:133:30 + (i32.const 2) + ;;@ ~lib/internal/number.ts:133:33 + (i32.lt_u + (get_local $0) + ;;@ ~lib/internal/number.ts:133:41 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/internal/number.ts:134:13 + (block + ;;@ ~lib/internal/number.ts:135:8 + (set_local $1 + ;;@ ~lib/internal/number.ts:135:16 + (select + ;;@ ~lib/internal/number.ts:135:28 + (i32.const 4) + ;;@ ~lib/internal/number.ts:135:31 + (i32.const 5) + ;;@ ~lib/internal/number.ts:135:34 + (i32.lt_u + (get_local $0) + ;;@ ~lib/internal/number.ts:135:42 + (i32.const 10000) + ) + ) + ) + ;;@ ~lib/internal/number.ts:136:45 + (return + ;;@ ~lib/internal/number.ts:136:15 + (select + ;;@ ~lib/internal/number.ts:136:27 + (i32.const 3) + ;;@ ~lib/internal/number.ts:136:30 + (get_local $1) + ;;@ ~lib/internal/number.ts:136:33 + (i32.lt_u + (get_local $0) + ;;@ ~lib/internal/number.ts:136:41 + (i32.const 1000) + ) + ) + ) + ) + ) + (unreachable) + ) + ;;@ ~lib/internal/number.ts:138:11 + (block + ;;@ ~lib/internal/number.ts:139:6 + (if + ;;@ ~lib/internal/number.ts:139:10 + (i32.lt_u + (get_local $0) + ;;@ ~lib/internal/number.ts:139:18 + (i32.const 10000000) + ) + ;;@ ~lib/internal/number.ts:139:28 + (return + ;;@ ~lib/internal/number.ts:140:15 + (select + ;;@ ~lib/internal/number.ts:140:27 + (i32.const 6) + ;;@ ~lib/internal/number.ts:140:30 + (i32.const 7) + ;;@ ~lib/internal/number.ts:140:33 + (i32.lt_u + (get_local $0) + ;;@ ~lib/internal/number.ts:140:41 + (i32.const 1000000) + ) + ) + ) + ;;@ ~lib/internal/number.ts:141:13 + (block + ;;@ ~lib/internal/number.ts:142:8 + (set_local $1 + ;;@ ~lib/internal/number.ts:142:16 + (select + ;;@ ~lib/internal/number.ts:142:28 + (i32.const 9) + ;;@ ~lib/internal/number.ts:142:31 + (i32.const 10) + ;;@ ~lib/internal/number.ts:142:35 + (i32.lt_u + (get_local $0) + ;;@ ~lib/internal/number.ts:142:43 + (i32.const 1000000000) + ) + ) + ) + ;;@ ~lib/internal/number.ts:143:50 + (return + ;;@ ~lib/internal/number.ts:143:15 + (select + ;;@ ~lib/internal/number.ts:143:27 + (i32.const 8) + ;;@ ~lib/internal/number.ts:143:30 + (get_local $1) + ;;@ ~lib/internal/number.ts:143:33 + (i32.lt_u + (get_local $0) + ;;@ ~lib/internal/number.ts:143:41 + (i32.const 100000000) + ) + ) + ) + ) + ) + (unreachable) + ) + ) + (unreachable) + ) + (func $~lib/internal/string/allocateUnsafe (; 49 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + ;;@ ~lib/internal/string.ts:14:2 + (if + (i32.eqz + ;;@ ~lib/internal/string.ts:14:9 + (if (result i32) + (tee_local $1 + (i32.gt_s + (get_local $0) + ;;@ ~lib/internal/string.ts:14:18 + (i32.const 0) + ) + ) + ;;@ ~lib/internal/string.ts:14:23 + (i32.le_s + (get_local $0) + ;;@ ~lib/internal/string.ts:14:33 + (get_global $~lib/internal/string/MAX_LENGTH) + ) + (get_local $1) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 192) + (i32.const 14) + (i32.const 2) + ) + (unreachable) + ) + ) + ;;@ ~lib/internal/string.ts:16:2 + (set_local $2 + ;;@ ~lib/internal/string.ts:19:20 + (block $~lib/memory/memory.allocate|inlined.1 (result i32) + (set_local $1 + ;;@ ~lib/internal/string.ts:19:29 + (i32.add + (get_global $~lib/internal/string/HEADER_SIZE) + ;;@ ~lib/internal/string.ts:19:43 + (i32.shl + ;;@ ~lib/internal/string.ts:19:44 + (get_local $0) + ;;@ ~lib/internal/string.ts:19:61 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/memory.ts:41:4 + (br $~lib/memory/memory.allocate|inlined.1 + ;;@ ~lib/memory.ts:41:45 + (call $~lib/allocator/tlsf/__memory_allocate + ;;@ ~lib/memory.ts:41:63 + (get_local $1) + ) + ) + ) + ) + ;;@ ~lib/internal/string.ts:21:2 + (i32.store + ;;@ ~lib/internal/string.ts:21:13 + (get_local $2) + ;;@ ~lib/internal/string.ts:21:21 + (get_local $0) + ) + ;;@ ~lib/internal/string.ts:22:34 + (get_local $2) + ) + (func $~lib/internal/number/utoa32_lut (; 50 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i64) + (local $9 i64) + ;;@ ~lib/internal/number.ts:180:2 + (set_local $3 + ;;@ ~lib/internal/number.ts:180:15 + (i32.load + ;;@ ~lib/internal/number.ts:180:28 + (block $~lib/internal/number/DIGITS|inlined.0 (result i32) + ;;@ ~lib/internal/number.ts:70:9 + (i32.const 760) + ) + ) + ) + ;;@ ~lib/internal/number.ts:182:2 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/internal/number.ts:182:9 + (i32.ge_u + (get_local $1) + ;;@ ~lib/internal/number.ts:182:16 + (i32.const 10000) + ) + (block + ;;@ ~lib/internal/number.ts:182:23 + (block + ;;@ ~lib/internal/number.ts:184:4 + (set_local $4 + ;;@ ~lib/internal/number.ts:184:12 + (i32.div_u + (get_local $1) + ;;@ ~lib/internal/number.ts:184:18 + (i32.const 10000) + ) + ) + ;;@ ~lib/internal/number.ts:185:4 + (set_local $5 + ;;@ ~lib/internal/number.ts:185:12 + (i32.rem_u + (get_local $1) + ;;@ ~lib/internal/number.ts:185:18 + (i32.const 10000) + ) + ) + ;;@ ~lib/internal/number.ts:186:4 + (set_local $1 + ;;@ ~lib/internal/number.ts:186:10 + (get_local $4) + ) + ;;@ ~lib/internal/number.ts:188:4 + (set_local $6 + ;;@ ~lib/internal/number.ts:188:13 + (i32.div_u + (get_local $5) + ;;@ ~lib/internal/number.ts:188:17 + (i32.const 100) + ) + ) + ;;@ ~lib/internal/number.ts:189:4 + (set_local $7 + ;;@ ~lib/internal/number.ts:189:13 + (i32.rem_u + (get_local $5) + ;;@ ~lib/internal/number.ts:189:17 + (i32.const 100) + ) + ) + ;;@ ~lib/internal/number.ts:191:4 + (set_local $8 + ;;@ ~lib/internal/number.ts:191:18 + (block $~lib/internal/arraybuffer/loadUnsafe|inlined.0 (result i64) + (i64.load32_u offset=8 + (i32.add + (get_local $3) + (i32.shl + (get_local $6) + (i32.const 2) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/number.ts:192:4 + (set_local $9 + ;;@ ~lib/internal/number.ts:192:18 + (block $~lib/internal/arraybuffer/loadUnsafe|inlined.1 (result i64) + (i64.load32_u offset=8 + (i32.add + (get_local $3) + (i32.shl + (get_local $7) + (i32.const 2) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/number.ts:194:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/number.ts:194:14 + (i32.const 4) + ) + ) + ;;@ ~lib/internal/number.ts:195:4 + (i64.store offset=4 + ;;@ ~lib/internal/number.ts:195:15 + (i32.add + (get_local $0) + ;;@ ~lib/internal/number.ts:195:24 + (i32.shl + ;;@ ~lib/internal/number.ts:195:25 + (get_local $2) + ;;@ ~lib/internal/number.ts:195:35 + (i32.const 1) + ) + ) + ;;@ ~lib/internal/number.ts:195:39 + (i64.or + (get_local $8) + ;;@ ~lib/internal/number.ts:195:49 + (i64.shl + ;;@ ~lib/internal/number.ts:195:50 + (get_local $9) + ;;@ ~lib/internal/number.ts:195:61 + (i64.const 32) + ) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/internal/number.ts:198:2 + (if + ;;@ ~lib/internal/number.ts:198:6 + (i32.ge_u + (get_local $1) + ;;@ ~lib/internal/number.ts:198:13 + (i32.const 100) + ) + ;;@ ~lib/internal/number.ts:198:18 + (block + ;;@ ~lib/internal/number.ts:199:4 + (set_local $7 + ;;@ ~lib/internal/number.ts:199:13 + (i32.div_u + (get_local $1) + ;;@ ~lib/internal/number.ts:199:19 + (i32.const 100) + ) + ) + ;;@ ~lib/internal/number.ts:200:4 + (set_local $6 + ;;@ ~lib/internal/number.ts:200:13 + (i32.rem_u + (get_local $1) + ;;@ ~lib/internal/number.ts:200:19 + (i32.const 100) + ) + ) + ;;@ ~lib/internal/number.ts:201:4 + (set_local $1 + ;;@ ~lib/internal/number.ts:201:10 + (get_local $7) + ) + ;;@ ~lib/internal/number.ts:202:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/number.ts:202:14 + (i32.const 2) + ) + ) + ;;@ ~lib/internal/number.ts:203:4 + (set_local $5 + ;;@ ~lib/internal/number.ts:203:17 + (block $~lib/internal/arraybuffer/loadUnsafe|inlined.0 (result i32) + (i32.load offset=8 + (i32.add + (get_local $3) + (i32.shl + (get_local $6) + (i32.const 2) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/number.ts:204:4 + (i32.store offset=4 + ;;@ ~lib/internal/number.ts:204:15 + (i32.add + (get_local $0) + ;;@ ~lib/internal/number.ts:204:24 + (i32.shl + ;;@ ~lib/internal/number.ts:204:25 + (get_local $2) + ;;@ ~lib/internal/number.ts:204:35 + (i32.const 1) + ) + ) + ;;@ ~lib/internal/number.ts:204:39 + (get_local $5) + ) + ) + ) + ;;@ ~lib/internal/number.ts:207:2 + (if + ;;@ ~lib/internal/number.ts:207:6 + (i32.ge_u + (get_local $1) + ;;@ ~lib/internal/number.ts:207:13 + (i32.const 10) + ) + ;;@ ~lib/internal/number.ts:207:17 + (block + ;;@ ~lib/internal/number.ts:208:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/number.ts:208:14 + (i32.const 2) + ) + ) + ;;@ ~lib/internal/number.ts:209:4 + (set_local $5 + ;;@ ~lib/internal/number.ts:209:17 + (block $~lib/internal/arraybuffer/loadUnsafe|inlined.1 (result i32) + ;;@ ~lib/internal/arraybuffer.ts:68:91 + (i32.load offset=8 + ;;@ ~lib/internal/arraybuffer.ts:68:20 + (i32.add + (get_local $3) + ;;@ ~lib/internal/arraybuffer.ts:68:48 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:68:49 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:68:65 + (i32.const 2) + ) + ) + ) + ) + ) + ;;@ ~lib/internal/number.ts:210:4 + (i32.store offset=4 + ;;@ ~lib/internal/number.ts:210:15 + (i32.add + (get_local $0) + ;;@ ~lib/internal/number.ts:210:24 + (i32.shl + ;;@ ~lib/internal/number.ts:210:25 + (get_local $2) + ;;@ ~lib/internal/number.ts:210:35 + (i32.const 1) + ) + ) + ;;@ ~lib/internal/number.ts:210:39 + (get_local $5) + ) + ) + ;;@ ~lib/internal/number.ts:211:9 + (block + ;;@ ~lib/internal/number.ts:212:4 + (set_local $2 + (i32.sub + (get_local $2) + ;;@ ~lib/internal/number.ts:212:14 + (i32.const 1) + ) + ) + ;;@ ~lib/internal/number.ts:213:4 + (set_local $5 + ;;@ ~lib/internal/number.ts:213:16 + (i32.add + (get_global $~lib/internal/string/CharCode._0) + ;;@ ~lib/internal/number.ts:213:30 + (get_local $1) + ) + ) + ;;@ ~lib/internal/number.ts:214:4 + (i32.store16 offset=4 + ;;@ ~lib/internal/number.ts:214:15 + (i32.add + (get_local $0) + ;;@ ~lib/internal/number.ts:214:24 + (i32.shl + ;;@ ~lib/internal/number.ts:214:25 + (get_local $2) + ;;@ ~lib/internal/number.ts:214:35 + (i32.const 1) + ) + ) + ;;@ ~lib/internal/number.ts:214:39 + (get_local $5) + ) + ) + ) + ) + (func $~lib/internal/number/utoa32 (; 51 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + ;;@ ~lib/internal/number.ts:279:2 + (if + ;;@ ~lib/internal/number.ts:279:6 + (i32.eqz + ;;@ ~lib/internal/number.ts:279:7 + (get_local $0) + ) + ;;@ ~lib/internal/number.ts:279:21 + (return + (i32.const 184) + ) + ) + ;;@ ~lib/internal/number.ts:281:2 + (set_local $1 + ;;@ ~lib/internal/number.ts:281:17 + (call $~lib/internal/number/decimalCount32 + ;;@ ~lib/internal/number.ts:281:32 + (get_local $0) + ) + ) + ;;@ ~lib/internal/number.ts:282:2 + (set_local $2 + ;;@ ~lib/internal/number.ts:282:17 + (call $~lib/internal/string/allocateUnsafe + ;;@ ~lib/internal/number.ts:282:38 + (get_local $1) + ) + ) + ;;@ ~lib/internal/number.ts:284:2 + (block $~lib/internal/number/utoa32_core|inlined.0 + ;;@ ~lib/internal/number.ts:262:2 + (call $~lib/internal/number/utoa32_lut + ;;@ ~lib/internal/number.ts:265:15 + (get_local $2) + ;;@ ~lib/internal/number.ts:265:23 + (get_local $0) + ;;@ ~lib/internal/number.ts:265:28 + (get_local $1) + ) + ) + ;;@ ~lib/internal/number.ts:285:9 + (get_local $2) + ) + (func $~lib/internal/number/itoa (; 52 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/internal/number.ts:343:2 + (return + ;;@ ~lib/internal/number.ts:354:15 + (call $~lib/internal/number/utoa32 + ;;@ ~lib/internal/number.ts:354:22 + (get_local $0) + ) + ) + ) + (func $assembly/module/index/typeName (; 53 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + ;;@ assembly/module/index.ts:77:2 + (block $break|0 + (block $case7|0 + (block $case6|0 + (block $case5|0 + (block $case4|0 + (block $case3|0 + (block $case2|0 + (block $case1|0 + (block $case0|0 + (set_local $1 + ;;@ assembly/module/index.ts:77:10 + (get_local $0) + ) + (br_if $case0|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:78:9 + (i32.const 127) + ) + ) + (br_if $case1|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:80:9 + (i32.const 126) + ) + ) + (br_if $case2|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:82:9 + (i32.const 125) + ) + ) + (br_if $case3|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:84:9 + (i32.const 124) + ) + ) + (br_if $case4|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:86:9 + (i32.const 112) + ) + ) + (br_if $case5|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:88:9 + (i32.const 96) + ) + ) + (br_if $case6|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:90:9 + (i32.const 64) + ) + ) + (br $case7|0) + ) + ;;@ assembly/module/index.ts:79:13 + (return + (i32.const 768) + ) + ) + ;;@ assembly/module/index.ts:81:13 + (return + (i32.const 784) + ) + ) + ;;@ assembly/module/index.ts:83:13 + (return + (i32.const 800) + ) + ) + ;;@ assembly/module/index.ts:85:13 + (return + (i32.const 816) + ) + ) + ;;@ assembly/module/index.ts:87:13 + (return + (i32.const 832) + ) + ) + ;;@ assembly/module/index.ts:89:13 + (return + (i32.const 856) + ) + ) + ;;@ assembly/module/index.ts:91:13 + (return + (i32.const 872) + ) + ) + ;;@ assembly/module/index.ts:93:6 + (unreachable) + ) + ;;@ assembly/module/index.ts:95:9 + (i32.const 888) + ) + (func $~lib/array/Array#__get (; 54 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + ;;@ ~lib/array.ts:84:4 + (set_local $2 + ;;@ ~lib/array.ts:84:17 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:87:23 + (if (result i32) + ;;@ ~lib/array.ts:85:11 + (i32.lt_u + (get_local $1) + ;;@ ~lib/array.ts:85:24 + (i32.shr_u + ;;@ ~lib/array.ts:85:30 + (i32.load + (get_local $2) + ) + ;;@ ~lib/array.ts:85:52 + (i32.const 2) + ) + ) + ;;@ ~lib/array.ts:86:8 + (block $~lib/internal/arraybuffer/loadUnsafe|inlined.0 (result i32) + ;;@ ~lib/internal/arraybuffer.ts:68:91 + (i32.load offset=8 + ;;@ ~lib/internal/arraybuffer.ts:68:20 + (i32.add + (get_local $2) + ;;@ ~lib/internal/arraybuffer.ts:68:48 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:68:49 + (get_local $1) + ;;@ ~lib/internal/arraybuffer.ts:68:65 + (i32.const 2) + ) + ) + ) + ) + ;;@ ~lib/array.ts:87:8 + (unreachable) + ) + ) + (func $~lib/internal/string/copyUnsafe (; 55 ;) (type $iiiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + ;;@ ~lib/internal/string.ts:34:9 + (block $~lib/memory/memory.copy|inlined.1 + (set_local $5 + ;;@ ~lib/internal/string.ts:35:4 + (i32.add + (i32.add + (get_local $0) + ;;@ ~lib/internal/string.ts:35:30 + (i32.shl + ;;@ ~lib/internal/string.ts:35:31 + (get_local $1) + ;;@ ~lib/internal/string.ts:35:45 + (i32.const 1) + ) + ) + ;;@ ~lib/internal/string.ts:35:50 + (get_global $~lib/internal/string/HEADER_SIZE) + ) + ) + (set_local $6 + ;;@ ~lib/internal/string.ts:36:4 + (i32.add + (i32.add + (get_local $2) + ;;@ ~lib/internal/string.ts:36:30 + (i32.shl + ;;@ ~lib/internal/string.ts:36:31 + (get_local $3) + ;;@ ~lib/internal/string.ts:36:45 + (i32.const 1) + ) + ) + ;;@ ~lib/internal/string.ts:36:50 + (get_global $~lib/internal/string/HEADER_SIZE) + ) + ) + (set_local $7 + ;;@ ~lib/internal/string.ts:37:4 + (i32.shl + (get_local $4) + ;;@ ~lib/internal/string.ts:37:11 + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:20:4 + (call $~lib/internal/memory/memmove + ;;@ ~lib/memory.ts:20:12 + (get_local $5) + ;;@ ~lib/memory.ts:20:18 + (get_local $6) + ;;@ ~lib/memory.ts:20:23 + (get_local $7) + ) + ) + ) + (func $~lib/string/String#concat (; 56 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + ;;@ ~lib/string.ts:110:4 + (if + (i32.eqz + ;;@ ~lib/string.ts:110:11 + (i32.ne + (get_local $0) + ;;@ ~lib/string.ts:110:20 + (i32.const 0) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 912) + (i32.const 110) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/string.ts:111:4 + (if + ;;@ ~lib/string.ts:111:8 + (i32.eq + (get_local $1) + ;;@ ~lib/string.ts:111:18 + (i32.const 0) + ) + ;;@ ~lib/string.ts:111:24 + (set_local $1 + ;;@ ~lib/string.ts:111:32 + (i32.const 896) + ) + ) + ;;@ ~lib/string.ts:113:4 + (set_local $2 + ;;@ ~lib/string.ts:113:25 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/string.ts:114:4 + (set_local $3 + ;;@ ~lib/string.ts:114:26 + (i32.load + (get_local $1) + ) + ) + ;;@ ~lib/string.ts:115:4 + (set_local $4 + ;;@ ~lib/string.ts:115:24 + (i32.add + (get_local $2) + ;;@ ~lib/string.ts:115:34 + (get_local $3) + ) + ) + ;;@ ~lib/string.ts:116:4 + (if + ;;@ ~lib/string.ts:116:8 + (i32.eq + (get_local $4) + ;;@ ~lib/string.ts:116:18 + (i32.const 0) + ) + ;;@ ~lib/string.ts:116:49 + (return + ;;@ ~lib/string.ts:116:28 + (i32.const 888) + ) + ) + ;;@ ~lib/string.ts:117:4 + (set_local $5 + ;;@ ~lib/string.ts:117:14 + (call $~lib/internal/string/allocateUnsafe + ;;@ ~lib/string.ts:117:29 + (get_local $4) + ) + ) + ;;@ ~lib/string.ts:118:4 + (call $~lib/internal/string/copyUnsafe + ;;@ ~lib/string.ts:118:15 + (get_local $5) + ;;@ ~lib/string.ts:118:20 + (i32.const 0) + ;;@ ~lib/string.ts:118:23 + (get_local $0) + ;;@ ~lib/string.ts:118:29 + (i32.const 0) + ;;@ ~lib/string.ts:118:32 + (get_local $2) + ) + ;;@ ~lib/string.ts:119:4 + (call $~lib/internal/string/copyUnsafe + ;;@ ~lib/string.ts:119:15 + (get_local $5) + ;;@ ~lib/string.ts:119:20 + (get_local $2) + ;;@ ~lib/string.ts:119:29 + (get_local $1) + ;;@ ~lib/string.ts:119:36 + (i32.const 0) + ;;@ ~lib/string.ts:119:39 + (get_local $3) + ) + ;;@ ~lib/string.ts:120:11 + (get_local $5) + ) + (func $~lib/string/String.__concat (; 57 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + ;;@ ~lib/string.ts:105:4 + (if + ;;@ ~lib/string.ts:105:8 + (i32.eqz + ;;@ ~lib/string.ts:105:9 + (get_local $0) + ) + ;;@ ~lib/string.ts:105:34 + (set_local $0 + ;;@ ~lib/string.ts:105:41 + (i32.const 896) + ) + ) + ;;@ ~lib/string.ts:106:28 + (call $~lib/string/String#concat + ;;@ ~lib/string.ts:106:11 + (get_local $0) + ;;@ ~lib/string.ts:106:23 + (get_local $1) + ) + ) + (func $assembly/module/index/FuncType#toString (; 58 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + ;;@ assembly/module/index.ts:204:4 + (set_local $1 + ;;@ assembly/module/index.ts:204:16 + (call $~lib/internal/number/itoa + ;;@ assembly/module/index.ts:204:26 + (i32.load offset=8 + (get_local $0) + ) + ) + ) + ;;@ assembly/module/index.ts:205:4 + (set_local $2 + ;;@ assembly/module/index.ts:205:15 + (call $assembly/module/index/typeName + ;;@ assembly/module/index.ts:205:24 + (i32.load8_s offset=12 + (get_local $0) + ) + ) + ) + ;;@ assembly/module/index.ts:206:4 + (set_local $3 + ;;@ assembly/module/index.ts:206:28 + (i32.const 888) + ) + ;;@ assembly/module/index.ts:207:4 + (block $break|0 + ;;@ assembly/module/index.ts:207:9 + (set_local $4 + ;;@ assembly/module/index.ts:207:17 + (i32.const 0) + ) + (loop $repeat|0 + (br_if $break|0 + (i32.eqz + ;;@ assembly/module/index.ts:207:20 + (i32.lt_s + (get_local $4) + ;;@ assembly/module/index.ts:207:23 + (block $~lib/array/Array#get:length|inlined.1 (result i32) + (set_local $5 + (i32.load + (get_local $0) + ) + ) + (i32.load offset=4 + (get_local $5) + ) + ) + ) + ) + ) + ;;@ assembly/module/index.ts:207:51 + (block + ;;@ assembly/module/index.ts:208:6 + (set_local $3 + (call $~lib/string/String.__concat + (get_local $3) + ;;@ assembly/module/index.ts:208:20 + (call $assembly/module/index/typeName + ;;@ assembly/module/index.ts:208:29 + (call $~lib/array/Array#__get + (i32.load + (get_local $0) + ) + ;;@ assembly/module/index.ts:208:45 + (get_local $4) + ) + ) + ) + ) + ;;@ assembly/module/index.ts:209:6 + (set_local $3 + ;;@ assembly/module/index.ts:209:19 + (if (result i32) + (i32.lt_s + (get_local $4) + ;;@ assembly/module/index.ts:209:23 + (i32.sub + (block $~lib/array/Array#get:length|inlined.3 (result i32) + (set_local $5 + (i32.load + (get_local $0) + ) + ) + (i32.load offset=4 + (get_local $5) + ) + ) + ;;@ assembly/module/index.ts:209:47 + (i32.const 1) + ) + ) + ;;@ assembly/module/index.ts:209:51 + (tee_local $3 + (call $~lib/string/String.__concat + (get_local $3) + ;;@ assembly/module/index.ts:209:65 + (i32.const 944) + ) + ) + ;;@ assembly/module/index.ts:209:71 + (get_local $3) + ) + ) + ) + ;;@ assembly/module/index.ts:207:47 + (set_local $4 + (i32.add + (get_local $4) + (i32.const 1) + ) + ) + (br $repeat|0) + ) + ) + ;;@ assembly/module/index.ts:211:4 + (set_local $4 + ;;@ assembly/module/index.ts:211:20 + (if (result i32) + (i32.eq + (block $~lib/array/Array#get:length|inlined.5 (result i32) + (set_local $4 + (i32.load offset=4 + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:51:16 + (i32.load offset=4 + ;;@ ~lib/array.ts:51:11 + (get_local $4) + ) + ) + ;;@ assembly/module/index.ts:211:46 + (i32.const 1) + ) + ;;@ assembly/module/index.ts:211:50 + (call $assembly/module/index/typeName + ;;@ assembly/module/index.ts:211:59 + (call $~lib/array/Array#__get + (i32.load offset=4 + (get_local $0) + ) + ;;@ assembly/module/index.ts:211:75 + (i32.const 0) + ) + ) + ;;@ assembly/module/index.ts:211:81 + (i32.const 952) + ) + ) + ;;@ assembly/module/index.ts:212:87 + (call $~lib/string/String.__concat + ;;@ assembly/module/index.ts:212:11 + (call $~lib/string/String.__concat + (call $~lib/string/String.__concat + (call $~lib/string/String.__concat + (call $~lib/string/String.__concat + (call $~lib/string/String.__concat + (call $~lib/string/String.__concat + (call $~lib/string/String.__concat + (i32.const 968) + ;;@ assembly/module/index.ts:212:23 + (get_local $1) + ) + ;;@ assembly/module/index.ts:212:31 + (i32.const 944) + ) + ;;@ assembly/module/index.ts:212:38 + (i32.const 992) + ) + ;;@ assembly/module/index.ts:212:49 + (get_local $2) + ) + ;;@ assembly/module/index.ts:212:56 + (i32.const 1008) + ) + ;;@ assembly/module/index.ts:212:64 + (get_local $3) + ) + ;;@ assembly/module/index.ts:212:77 + (i32.const 1024) + ) + ;;@ assembly/module/index.ts:212:87 + (get_local $4) + ) + ) + (func $assembly/host/index/log (; 59 ;) (type $iv) (param $0 i32) + ;;@ assembly/host/index.ts:9:2 + (call $assembly/host/index/_log_str + ;;@ assembly/host/index.ts:11:15 + (get_local $0) + ) + ) + (func $assembly/module/index/TypeSection#parse (; 60 ;) (type $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 $9 i32) + (local $10 i32) + ;;@ assembly/module/index.ts:226:4 + (i32.store offset=8 + (get_local $1) + ;;@ assembly/module/index.ts:226:14 + (i32.load offset=12 + (i32.load + (get_local $0) + ) + ) + ) + ;;@ assembly/module/index.ts:227:4 + (set_local $2 + ;;@ assembly/module/index.ts:227:20 + (call $assembly/buffer/index/Buffer#readVaruint + ;;@ assembly/module/index.ts:227:16 + (get_local $1) + ;;@ assembly/module/index.ts:227:32 + (i32.const 32) + ) + ) + ;;@ assembly/module/index.ts:228:4 + (set_local $3 + ;;@ assembly/module/index.ts:228:27 + (call $~lib/array/Array#constructor + (i32.const 0) + ;;@ assembly/module/index.ts:228:47 + (get_local $2) + ) + ) + ;;@ assembly/module/index.ts:229:4 + (block $break|0 + ;;@ assembly/module/index.ts:229:9 + (set_local $4 + ;;@ assembly/module/index.ts:229:26 + (i32.const 0) + ) + (loop $repeat|0 + (br_if $break|0 + (i32.eqz + ;;@ assembly/module/index.ts:229:29 + (i32.lt_u + (get_local $4) + ;;@ assembly/module/index.ts:229:37 + (get_local $2) + ) + ) + ) + ;;@ assembly/module/index.ts:229:53 + (block + ;;@ assembly/module/index.ts:230:6 + (set_local $5 + ;;@ assembly/module/index.ts:230:17 + (i32.and + ;;@ assembly/module/index.ts:230:21 + (call $assembly/buffer/index/Buffer#readVarint8 + ;;@ assembly/module/index.ts:230:17 + (get_local $1) + ;;@ assembly/module/index.ts:230:33 + (i32.const 7) + ) + ;;@ assembly/module/index.ts:230:38 + (i32.const 127) + ) + ) + ;;@ assembly/module/index.ts:231:6 + (set_local $6 + ;;@ assembly/module/index.ts:231:16 + (call $assembly/module/index/FuncType#constructor + (i32.const 0) + ;;@ assembly/module/index.ts:231:29 + (get_local $4) + ;;@ assembly/module/index.ts:231:36 + (get_local $5) + ) + ) + ;;@ assembly/module/index.ts:232:6 + (call $~lib/array/Array#__set + (get_local $3) + ;;@ assembly/module/index.ts:232:11 + (get_local $4) + ;;@ assembly/module/index.ts:232:20 + (get_local $6) + ) + ;;@ assembly/module/index.ts:233:6 + (set_local $7 + ;;@ assembly/module/index.ts:233:27 + (call $assembly/buffer/index/Buffer#readVaruint + ;;@ assembly/module/index.ts:233:23 + (get_local $1) + ;;@ assembly/module/index.ts:233:39 + (i32.const 32) + ) + ) + ;;@ assembly/module/index.ts:234:6 + (i32.store + (get_local $6) + ;;@ assembly/module/index.ts:234:23 + (call $~lib/array/Array#constructor + (i32.const 0) + ;;@ assembly/module/index.ts:234:38 + (get_local $7) + ) + ) + ;;@ assembly/module/index.ts:235:6 + (block $break|1 + ;;@ assembly/module/index.ts:235:11 + (set_local $8 + ;;@ assembly/module/index.ts:235:33 + (i32.const 0) + ) + (loop $repeat|1 + (br_if $break|1 + (i32.eqz + ;;@ assembly/module/index.ts:235:36 + (i32.lt_u + (get_local $8) + ;;@ assembly/module/index.ts:235:49 + (get_local $7) + ) + ) + ) + ;;@ assembly/module/index.ts:235:75 + (block + ;;@ assembly/module/index.ts:236:8 + (set_local $9 + ;;@ assembly/module/index.ts:236:24 + (i32.and + ;;@ assembly/module/index.ts:236:28 + (call $assembly/buffer/index/Buffer#readVarint8 + ;;@ assembly/module/index.ts:236:24 + (get_local $1) + ;;@ assembly/module/index.ts:236:40 + (i32.const 7) + ) + ;;@ assembly/module/index.ts:236:45 + (i32.const 127) + ) + ) + ;;@ assembly/module/index.ts:237:8 + (call $~lib/array/Array#__set + (i32.load + (call $~lib/array/Array#__get + (get_local $3) + ;;@ assembly/module/index.ts:237:13 + (get_local $4) + ) + ) + ;;@ assembly/module/index.ts:237:31 + (get_local $8) + ;;@ assembly/module/index.ts:237:43 + (get_local $9) + ) + ) + ;;@ assembly/module/index.ts:235:61 + (set_local $8 + (i32.add + ;;@ assembly/module/index.ts:235:63 + (get_local $8) + (i32.const 1) + ) + ) + (br $repeat|1) + ) + ) + ;;@ assembly/module/index.ts:240:6 + (set_local $8 + ;;@ assembly/module/index.ts:240:28 + (call $assembly/buffer/index/Buffer#readVaruint + ;;@ assembly/module/index.ts:240:24 + (get_local $1) + ;;@ assembly/module/index.ts:240:40 + (i32.const 1) + ) + ) + ;;@ assembly/module/index.ts:241:6 + (i32.store offset=4 + (call $~lib/array/Array#__get + (get_local $3) + ;;@ assembly/module/index.ts:241:11 + (get_local $4) + ) + ;;@ assembly/module/index.ts:241:31 + (call $~lib/array/Array#constructor + (i32.const 0) + ;;@ assembly/module/index.ts:241:46 + (get_local $8) + ) + ) + ;;@ assembly/module/index.ts:242:6 + (block $break|2 + ;;@ assembly/module/index.ts:242:11 + (set_local $9 + ;;@ assembly/module/index.ts:242:34 + (i32.const 0) + ) + (loop $repeat|2 + (br_if $break|2 + (i32.eqz + ;;@ assembly/module/index.ts:242:37 + (i32.lt_u + (get_local $9) + ;;@ assembly/module/index.ts:242:51 + (get_local $8) + ) + ) + ) + ;;@ assembly/module/index.ts:242:79 + (block + ;;@ assembly/module/index.ts:243:8 + (set_local $10 + ;;@ assembly/module/index.ts:243:25 + (i32.and + ;;@ assembly/module/index.ts:243:29 + (call $assembly/buffer/index/Buffer#readVarint8 + ;;@ assembly/module/index.ts:243:25 + (get_local $1) + ;;@ assembly/module/index.ts:243:41 + (i32.const 7) + ) + ;;@ assembly/module/index.ts:243:46 + (i32.const 127) + ) + ) + ;;@ assembly/module/index.ts:244:8 + (call $~lib/array/Array#__set + (i32.load offset=4 + (call $~lib/array/Array#__get + (get_local $3) + ;;@ assembly/module/index.ts:244:13 + (get_local $4) + ) + ) + ;;@ assembly/module/index.ts:244:31 + (get_local $9) + ;;@ assembly/module/index.ts:244:46 + (get_local $10) + ) + ) + ;;@ assembly/module/index.ts:242:64 + (set_local $9 + (i32.add + ;;@ assembly/module/index.ts:242:66 + (get_local $9) + (i32.const 1) + ) + ) + (br $repeat|2) + ) + ) + ;;@ assembly/module/index.ts:246:6 + (call $assembly/host/index/log + ;;@ assembly/module/index.ts:246:22 + (call $assembly/module/index/FuncType#toString + ;;@ assembly/module/index.ts:246:10 + (call $~lib/array/Array#__get + (get_local $3) + ;;@ assembly/module/index.ts:246:15 + (get_local $4) + ) + ) + ) + ) + ;;@ assembly/module/index.ts:229:44 + (set_local $4 + (i32.add + ;;@ assembly/module/index.ts:229:46 + (get_local $4) + (i32.const 1) + ) + ) + (br $repeat|0) + ) + ) + ;;@ assembly/module/index.ts:248:11 + (get_local $0) + ) + (func $~lib/array/Array#push (; 61 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + ;;@ ~lib/array.ts:166:4 + (set_local $2 + ;;@ ~lib/array.ts:166:17 + (i32.load offset=4 + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:167:4 + (set_local $3 + ;;@ ~lib/array.ts:167:17 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:168:4 + (set_local $4 + ;;@ ~lib/array.ts:168:19 + (i32.shr_u + (i32.load + (get_local $3) + ) + ;;@ ~lib/array.ts:168:41 + (i32.const 2) + ) + ) + ;;@ ~lib/array.ts:169:4 + (set_local $5 + ;;@ ~lib/array.ts:169:20 + (i32.add + (get_local $2) + ;;@ ~lib/array.ts:169:29 + (i32.const 1) + ) + ) + ;;@ ~lib/array.ts:170:4 + (if + ;;@ ~lib/array.ts:170:8 + (i32.ge_u + (get_local $2) + ;;@ ~lib/array.ts:170:23 + (get_local $4) + ) + ;;@ ~lib/array.ts:170:38 + (block + ;;@ ~lib/array.ts:172:6 + (if + ;;@ ~lib/array.ts:172:10 + (i32.ge_u + (get_local $2) + ;;@ ~lib/array.ts:172:25 + (i32.const 268435454) + ) + ;;@ ~lib/array.ts:172:42 + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 72) + (i32.const 172) + (i32.const 42) + ) + (unreachable) + ) + ) + ;;@ ~lib/array.ts:173:6 + (set_local $3 + ;;@ ~lib/array.ts:173:15 + (call $~lib/internal/arraybuffer/reallocateUnsafe + ;;@ ~lib/array.ts:173:32 + (get_local $3) + ;;@ ~lib/array.ts:173:40 + (i32.shl + (get_local $5) + ;;@ ~lib/array.ts:173:53 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/array.ts:174:6 + (i32.store + (get_local $0) + ;;@ ~lib/array.ts:174:21 + (get_local $3) + ) + ) + ) + ;;@ ~lib/array.ts:176:4 + (i32.store offset=4 + (get_local $0) + ;;@ ~lib/array.ts:176:19 + (get_local $5) + ) + ;;@ ~lib/array.ts:177:4 + (block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + ;;@ ~lib/internal/arraybuffer.ts:72:2 + (i32.store offset=8 + ;;@ ~lib/internal/arraybuffer.ts:72:11 + (i32.add + (get_local $3) + ;;@ ~lib/internal/arraybuffer.ts:72:39 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:72:40 + (get_local $2) + ;;@ ~lib/internal/arraybuffer.ts:72:56 + (i32.const 2) + ) + ) + ;;@ ~lib/internal/arraybuffer.ts:72:71 + (get_local $1) + ) + ) + ;;@ ~lib/array.ts:179:11 + (get_local $5) + ) + (func $~lib/array/Array#join (; 62 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -323,796 +9102,1924 @@ (local $10 i32) (local $11 i32) (local $12 i32) - (local $13 i32) - (local $14 i32) - get_local $0 - set_global $assembly/index/off - get_global $assembly/index/off - tee_local $6 - i32.load - set_local $0 - get_local $6 - i32.const 4 - i32.add - set_global $assembly/index/off - get_local $0 - i32.const 1836278016 - i32.ne - if - unreachable - end - get_global $assembly/index/off - tee_local $6 - i32.load - set_local $0 - get_local $6 - i32.const 4 - i32.add - set_global $assembly/index/off - get_local $0 - i32.const 1 - i32.ne - if - unreachable - end - loop $continue|0 - get_global $assembly/index/off - get_local $1 - i32.lt_u - if - call $assembly/index/readVaruint - set_local $2 - call $assembly/index/readVaruint - set_local $8 - i32.const 0 - set_local $5 - i32.const 0 - set_local $0 - get_local $2 - if - get_local $2 - get_global $src/common/SectionId.Data - i32.gt_u - if - unreachable - end - else - get_global $assembly/index/off - set_local $4 - call $assembly/index/readVaruint - set_local $0 - get_global $assembly/index/off - set_local $5 - get_global $assembly/index/off - get_local $0 - i32.add - set_global $assembly/index/off - get_local $8 - get_global $assembly/index/off - get_local $4 - i32.sub - i32.sub - set_local $8 - end - get_local $2 - get_global $assembly/index/off - tee_local $4 - get_local $8 - get_local $5 - get_local $0 - call $assembly/options/onSection - i32.const 1 - i32.and - if - block $break|1 - block $case12|1 - block $case11|1 - block $case8|1 - block $case7|1 - block $case6|1 - block $case5|1 - block $case4|1 - block $case3|1 - block $case2|1 - block $case1|1 - get_local $2 - get_global $src/common/SectionId.Type - i32.ne - if - get_local $2 - get_global $src/common/SectionId.Import - i32.eq - br_if $case1|1 - get_local $2 - get_global $src/common/SectionId.Function - i32.eq - br_if $case2|1 - get_local $2 - get_global $src/common/SectionId.Table - i32.eq - br_if $case3|1 - get_local $2 - get_global $src/common/SectionId.Memory - i32.eq - br_if $case4|1 - get_local $2 - get_global $src/common/SectionId.Global - i32.eq - br_if $case5|1 - get_local $2 - get_global $src/common/SectionId.Export - i32.eq - br_if $case6|1 - get_local $2 - get_global $src/common/SectionId.Start - i32.eq - br_if $case7|1 - get_local $2 - get_global $src/common/SectionId.Custom - i32.eq - br_if $case8|1 - get_local $2 - get_global $src/common/SectionId.Element - i32.eq - br_if $case11|1 - get_local $2 - get_global $src/common/SectionId.Code - i32.eq - br_if $case11|1 - get_local $2 - get_global $src/common/SectionId.Data - i32.eq - br_if $case11|1 - br $case12|1 - end - call $assembly/index/readVaruint - set_local $2 - block $break|2 - i32.const 0 - set_local $3 - loop $repeat|2 - get_local $3 - get_local $2 - i32.ge_u - br_if $break|2 - get_local $3 - i32.const 7 - call $assembly/index/readVarint - i32.const 127 - i32.and - call $assembly/options/onType - call $assembly/index/readVaruint - set_local $4 - block $break|3 - i32.const 0 - set_local $7 - loop $repeat|3 - get_local $7 - get_local $4 - i32.ge_u - br_if $break|3 - get_local $3 - get_local $7 - i32.const 7 - call $assembly/index/readVarint - i32.const 127 - i32.and - call $assembly/options/onTypeParam - get_local $7 - i32.const 1 - i32.add - set_local $7 - br $repeat|3 - unreachable - end - unreachable - end - call $assembly/index/readVaruint - set_local $7 - block $break|4 - i32.const 0 - set_local $5 - loop $repeat|4 - get_local $5 - get_local $7 - i32.ge_u - br_if $break|4 - get_local $3 - get_local $5 - i32.const 7 - call $assembly/index/readVarint - i32.const 127 - i32.and - call $assembly/options/onTypeReturn - get_local $5 - i32.const 1 - i32.add - set_local $5 - br $repeat|4 - unreachable - end - unreachable - end - get_local $3 - i32.const 1 - i32.add - set_local $3 - br $repeat|2 - unreachable - end - unreachable - end - br $break|1 - end - call $assembly/index/readVaruint - set_local $2 - block $break|5 - i32.const 0 - set_local $3 - loop $repeat|5 - get_local $3 - get_local $2 - i32.ge_u - br_if $break|5 - call $assembly/index/readVaruint - set_local $7 - get_global $assembly/index/off - set_local $4 - get_global $assembly/index/off - get_local $7 - i32.add - set_global $assembly/index/off - call $assembly/index/readVaruint - set_local $9 - get_global $assembly/index/off - set_local $5 - get_global $assembly/index/off - get_local $9 - i32.add - set_global $assembly/index/off - get_global $assembly/index/off - tee_local $6 - i32.load8_u - set_local $0 - get_local $6 - i32.const 1 - i32.add - set_global $assembly/index/off - get_local $3 - get_local $0 - get_local $4 - get_local $7 - get_local $5 - get_local $9 - call $assembly/options/onImport - block $break|6 - block $case4|6 - block $case3|6 - block $case2|6 - block $case1|6 - get_local $0 - tee_local $6 - get_global $src/common/ExternalKind.Function - i32.ne - if - get_local $6 - get_global $src/common/ExternalKind.Table - i32.eq - br_if $case1|6 - get_local $6 - get_global $src/common/ExternalKind.Memory - i32.eq - br_if $case2|6 - get_local $6 - get_global $src/common/ExternalKind.Global - i32.eq - br_if $case3|6 - br $case4|6 - end - get_local $11 - tee_local $10 - i32.const 1 - i32.add - set_local $11 - get_local $10 - call $assembly/index/readVaruint - call $assembly/options/onFunctionImport - br $break|6 - end - i32.const 7 - call $assembly/index/readVarint - i32.const 127 - i32.and - set_local $6 - call $assembly/index/readVaruint - set_local $10 - get_local $12 - tee_local $0 - i32.const 1 - i32.add - set_local $12 - get_local $0 - get_local $6 - call $assembly/index/readVaruint - tee_local $4 - get_local $10 - i32.const 1 - i32.and - if (result i32) - call $assembly/index/readVaruint - else - i32.const -1 - end - tee_local $8 - get_local $10 - call $assembly/options/onTableImport - br $break|6 - end - call $assembly/index/readVaruint - set_local $8 - get_local $13 - tee_local $6 - i32.const 1 - i32.add - set_local $13 - get_local $6 - call $assembly/index/readVaruint - tee_local $0 - get_local $8 - i32.const 1 - i32.and - if (result i32) - call $assembly/index/readVaruint - else - i32.const 65535 - end - tee_local $10 - get_local $8 - call $assembly/options/onMemoryImport - br $break|6 - end - get_local $14 - tee_local $8 - i32.const 1 - i32.add - set_local $14 - get_local $8 - i32.const 7 - call $assembly/index/readVarint - i32.const 127 - i32.and - call $assembly/index/readVaruint - call $assembly/options/onGlobalImport - br $break|6 - end - unreachable - end - get_local $3 - i32.const 1 - i32.add - set_local $3 - br $repeat|5 - unreachable - end - unreachable - end - br $break|1 - end - call $assembly/index/readVaruint - set_local $2 - block $break|7 - i32.const 0 - set_local $3 - loop $repeat|7 - get_local $3 - get_local $2 - i32.ge_u - br_if $break|7 - get_local $11 - tee_local $5 - i32.const 1 - i32.add - set_local $11 - get_local $5 - call $assembly/index/readVaruint - call $assembly/options/onFunction - get_local $3 - i32.const 1 - i32.add - set_local $3 - br $repeat|7 - unreachable - end - unreachable - end - br $break|1 - end - call $assembly/index/readVaruint - set_local $2 - block $break|8 - i32.const 0 - set_local $3 - loop $repeat|8 - get_local $3 - get_local $2 - i32.ge_u - br_if $break|8 - call $assembly/index/readVaruint - i32.const 127 - i32.and - set_local $0 - call $assembly/index/readVaruint - set_local $5 - get_local $12 - tee_local $7 - i32.const 1 - i32.add - set_local $12 - get_local $7 - get_local $0 - call $assembly/index/readVaruint - tee_local $6 - get_local $5 - i32.const 1 - i32.and - if (result i32) - call $assembly/index/readVaruint - else - i32.const -1 - end - tee_local $4 - get_local $5 - call $assembly/options/onTable - get_local $3 - i32.const 1 - i32.add - set_local $3 - br $repeat|8 - unreachable - end - unreachable - end - br $break|1 - end - call $assembly/index/readVaruint - set_local $2 - block $break|9 - i32.const 0 - set_local $3 - loop $repeat|9 - get_local $3 - get_local $2 - i32.ge_u - br_if $break|9 - call $assembly/index/readVaruint - set_local $4 - get_local $13 - tee_local $0 - i32.const 1 - i32.add - set_local $13 - get_local $0 - call $assembly/index/readVaruint - tee_local $6 - get_local $4 - i32.const 1 - i32.and - if (result i32) - call $assembly/index/readVaruint - else - i32.const 65535 - end - tee_local $5 - get_local $4 - call $assembly/options/onMemory - get_local $3 - i32.const 1 - i32.add - set_local $3 - br $repeat|9 - unreachable - end - unreachable - end - br $break|1 - end - call $assembly/index/readVaruint - set_local $2 - block $break|10 - i32.const 0 - set_local $3 - loop $repeat|10 - get_local $3 - get_local $2 - i32.ge_u - br_if $break|10 - i32.const 7 - call $assembly/index/readVarint - i32.const 127 - i32.and - set_local $5 - call $assembly/index/readVaruint - set_local $9 - call $assembly/index/skipInitExpr - get_local $14 - tee_local $4 - i32.const 1 - i32.add - set_local $14 - get_local $4 - get_local $5 - get_local $9 - call $assembly/options/onGlobal - get_local $3 - i32.const 1 - i32.add - set_local $3 - br $repeat|10 - unreachable - end - unreachable - end - br $break|1 - end - call $assembly/index/readVaruint - set_local $2 - block $break|11 - i32.const 0 - set_local $3 - loop $repeat|11 - get_local $3 - get_local $2 - i32.ge_u - br_if $break|11 - call $assembly/index/readVaruint - set_local $9 - get_global $assembly/index/off - set_local $5 - get_global $assembly/index/off - get_local $9 - i32.add - set_global $assembly/index/off - get_global $assembly/index/off - tee_local $6 - i32.load8_u - set_local $0 - get_local $6 - i32.const 1 - i32.add - set_global $assembly/index/off - get_local $3 - get_local $0 - call $assembly/index/readVaruint - get_local $5 - get_local $9 - call $assembly/options/onExport - get_local $3 - i32.const 1 - i32.add - set_local $3 - br $repeat|11 - unreachable - end - unreachable - end - br $break|1 - end - call $assembly/index/readVaruint - call $assembly/options/onStart - br $break|1 - end - get_local $0 - i32.const 4 - i32.eq - tee_local $2 - if - get_local $5 - i32.load - i32.const 1701667182 - i32.eq - set_local $2 - end - get_local $2 - if - call $assembly/index/readVaruint - set_local $2 - call $assembly/index/readVaruint - set_local $3 - get_global $assembly/index/off - set_local $0 - block $break|12 - block $case3|12 - block $case2|12 - block $case1|12 - get_local $2 - tee_local $4 - get_global $src/common/NameType.Module - i32.ne - if - get_local $4 - get_global $src/common/NameType.Function - i32.eq - br_if $case1|12 - get_local $4 - get_global $src/common/NameType.Local - i32.eq - br_if $case2|12 - br $case3|12 - end - call $assembly/index/readVaruint - set_local $4 - get_global $assembly/index/off - get_local $4 - call $assembly/options/onModuleName - br $break|12 - end - call $assembly/index/readVaruint - set_local $5 - block $break|13 - i32.const 0 - set_local $4 - loop $repeat|13 - get_local $4 - get_local $5 - i32.ge_u - br_if $break|13 - call $assembly/index/readVaruint - set_local $9 - call $assembly/index/readVaruint - set_local $7 - get_global $assembly/index/off - set_local $2 - get_global $assembly/index/off - get_local $7 - i32.add - set_global $assembly/index/off - get_local $9 - get_local $2 - get_local $7 - call $assembly/options/onFunctionName - get_local $4 - i32.const 1 - i32.add - set_local $4 - br $repeat|13 - unreachable - end - unreachable - end - br $break|12 - end - call $assembly/index/readVaruint - set_local $5 - block $break|14 - i32.const 0 - set_local $4 - loop $repeat|14 - get_local $4 - get_local $5 - i32.ge_u - br_if $break|14 - call $assembly/index/readVaruint - set_local $2 - call $assembly/index/readVaruint - set_local $7 - block $break|15 - i32.const 0 - set_local $9 - loop $repeat|15 - get_local $9 - get_local $7 - i32.ge_u - br_if $break|15 - call $assembly/index/readVaruint - set_local $10 - call $assembly/index/readVaruint - set_local $8 - get_global $assembly/index/off - set_local $6 - get_global $assembly/index/off - get_local $8 - i32.add - set_global $assembly/index/off - get_local $2 - get_local $10 - get_local $6 - get_local $8 - call $assembly/options/onLocalName - get_local $9 - i32.const 1 - i32.add - set_local $9 - br $repeat|15 - unreachable - end - unreachable - end - get_local $4 - i32.const 1 - i32.add - set_local $4 - br $repeat|14 - unreachable - end - unreachable - end - br $break|12 - end - unreachable - end - get_local $0 - get_local $3 - i32.add - set_global $assembly/index/off - br $break|1 - else - get_local $0 - i32.const 16 - i32.eq - tee_local $0 - if - get_local $5 - i64.load - i64.const 7011371672682196851 - i64.eq - set_local $0 - end - get_local $0 - if - get_local $5 - i32.const 8 - i32.add - i64.load - i64.const 5499551997695193200 - i64.eq - set_local $0 - end - get_local $0 - if - call $assembly/index/readVaruint - set_local $0 - get_global $assembly/index/off - set_local $3 - get_global $assembly/index/off - get_local $0 - i32.add - set_global $assembly/index/off - get_local $3 - get_local $0 - call $assembly/options/onSourceMappingURL - end - end - get_local $4 - get_local $8 - i32.add - set_global $assembly/index/off - br $break|1 - end - get_global $assembly/index/off - get_local $8 - i32.add - set_global $assembly/index/off - br $break|1 - end - unreachable - end - else - get_global $assembly/index/off - get_local $8 - i32.add - set_global $assembly/index/off - end - br $continue|0 - end - end - get_global $assembly/index/off - get_local $1 - i32.ne - if - unreachable - end - ) - (func $null (; 24 ;) (type $v) - nop + ;;@ ~lib/array.ts:367:4 + (set_local $2 + ;;@ ~lib/array.ts:367:20 + (i32.sub + (i32.load offset=4 + (get_local $0) + ) + ;;@ ~lib/array.ts:367:35 + (i32.const 1) + ) + ) + ;;@ ~lib/array.ts:368:4 + (if + ;;@ ~lib/array.ts:368:8 + (i32.lt_s + (get_local $2) + ;;@ ~lib/array.ts:368:20 + (i32.const 0) + ) + ;;@ ~lib/array.ts:368:30 + (return + (i32.const 888) + ) + ) + ;;@ ~lib/array.ts:369:4 + (set_local $3 + ;;@ ~lib/array.ts:369:17 + (i32.const 888) + ) + ;;@ ~lib/array.ts:371:4 + (set_local $5 + ;;@ ~lib/array.ts:371:17 + (i32.load + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:372:4 + (set_local $6 + ;;@ ~lib/array.ts:372:17 + (i32.load + (get_local $1) + ) + ) + ;;@ ~lib/array.ts:373:4 + (set_local $7 + ;;@ ~lib/array.ts:373:23 + (i32.ne + (get_local $6) + ;;@ ~lib/array.ts:373:33 + (i32.const 0) + ) + ) + ;;@ ~lib/array.ts:452:6 + (if + ;;@ ~lib/array.ts:452:10 + (i32.eqz + ;;@ ~lib/array.ts:452:11 + (get_local $2) + ) + ;;@ ~lib/array.ts:452:22 + (return + ;;@ ~lib/array.ts:453:15 + (block $~lib/internal/arraybuffer/loadUnsafe|inlined.0 (result i32) + (set_local $8 + ;;@ ~lib/array.ts:453:44 + (i32.const 0) + ) + (i32.load offset=8 + (i32.add + (get_local $5) + (i32.shl + (get_local $8) + (i32.const 2) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/array.ts:455:6 + (set_local $8 + ;;@ ~lib/array.ts:455:19 + (i32.const 0) + ) + ;;@ ~lib/array.ts:456:6 + (block $break|0 + ;;@ ~lib/array.ts:456:11 + (block + (set_local $9 + ;;@ ~lib/array.ts:456:19 + (i32.const 0) + ) + (set_local $10 + ;;@ ~lib/array.ts:456:28 + (i32.add + (get_local $2) + ;;@ ~lib/array.ts:456:40 + (i32.const 1) + ) + ) + ) + (loop $repeat|0 + (br_if $break|0 + (i32.eqz + ;;@ ~lib/array.ts:456:43 + (i32.lt_s + (get_local $9) + ;;@ ~lib/array.ts:456:47 + (get_local $10) + ) + ) + ) + ;;@ ~lib/array.ts:457:8 + (set_local $8 + (i32.add + (get_local $8) + ;;@ ~lib/array.ts:457:18 + (i32.load + (block $~lib/internal/arraybuffer/loadUnsafe|inlined.1 (result i32) + (i32.load offset=8 + (i32.add + (get_local $5) + (i32.shl + (get_local $9) + (i32.const 2) + ) + ) + ) + ) + ) + ) + ) + ;;@ ~lib/array.ts:456:52 + (set_local $9 + (i32.add + ;;@ ~lib/array.ts:456:54 + (get_local $9) + (i32.const 1) + ) + ) + (br $repeat|0) + ) + ) + ;;@ ~lib/array.ts:459:6 + (set_local $10 + ;;@ ~lib/array.ts:459:19 + (i32.const 0) + ) + ;;@ ~lib/array.ts:460:6 + (set_local $9 + ;;@ ~lib/array.ts:460:19 + (call $~lib/internal/string/allocateUnsafe + ;;@ ~lib/array.ts:460:40 + (i32.add + (get_local $8) + ;;@ ~lib/array.ts:460:49 + (i32.mul + (get_local $6) + ;;@ ~lib/array.ts:460:58 + (get_local $2) + ) + ) + ) + ) + ;;@ ~lib/array.ts:461:6 + (block $break|1 + ;;@ ~lib/array.ts:461:11 + (set_local $11 + ;;@ ~lib/array.ts:461:19 + (i32.const 0) + ) + (loop $repeat|1 + (br_if $break|1 + (i32.eqz + ;;@ ~lib/array.ts:461:22 + (i32.lt_s + (get_local $11) + ;;@ ~lib/array.ts:461:26 + (get_local $2) + ) + ) + ) + ;;@ ~lib/array.ts:461:42 + (block + ;;@ ~lib/array.ts:462:8 + (set_local $4 + ;;@ ~lib/array.ts:462:16 + (block $~lib/internal/arraybuffer/loadUnsafe|inlined.2 (result i32) + (i32.load offset=8 + (i32.add + (get_local $5) + (i32.shl + (get_local $11) + (i32.const 2) + ) + ) + ) + ) + ) + ;;@ ~lib/array.ts:463:8 + (if + ;;@ ~lib/array.ts:463:12 + (get_local $4) + ;;@ ~lib/array.ts:463:19 + (block + ;;@ ~lib/array.ts:464:10 + (set_local $12 + ;;@ ~lib/array.ts:464:25 + (i32.load + (get_local $4) + ) + ) + ;;@ ~lib/array.ts:465:10 + (call $~lib/internal/string/copyUnsafe + ;;@ ~lib/array.ts:465:27 + (get_local $9) + ;;@ ~lib/array.ts:465:35 + (get_local $10) + ;;@ ~lib/array.ts:465:43 + (get_local $4) + ;;@ ~lib/array.ts:465:50 + (i32.const 0) + ;;@ ~lib/array.ts:465:53 + (get_local $12) + ) + ;;@ ~lib/array.ts:466:10 + (set_local $10 + (i32.add + (get_local $10) + ;;@ ~lib/array.ts:466:20 + (get_local $12) + ) + ) + ) + ) + ;;@ ~lib/array.ts:468:8 + (if + ;;@ ~lib/array.ts:468:12 + (get_local $7) + ;;@ ~lib/array.ts:468:26 + (block + ;;@ ~lib/array.ts:469:10 + (call $~lib/internal/string/copyUnsafe + ;;@ ~lib/array.ts:469:27 + (get_local $9) + ;;@ ~lib/array.ts:469:35 + (get_local $10) + ;;@ ~lib/array.ts:469:43 + (get_local $1) + ;;@ ~lib/array.ts:469:54 + (i32.const 0) + ;;@ ~lib/array.ts:469:57 + (get_local $6) + ) + ;;@ ~lib/array.ts:470:10 + (set_local $10 + (i32.add + (get_local $10) + ;;@ ~lib/array.ts:470:20 + (get_local $6) + ) + ) + ) + ) + ) + ;;@ ~lib/array.ts:461:37 + (set_local $11 + (i32.add + ;;@ ~lib/array.ts:461:39 + (get_local $11) + (i32.const 1) + ) + ) + (br $repeat|1) + ) + ) + ;;@ ~lib/array.ts:473:6 + (set_local $4 + ;;@ ~lib/array.ts:473:14 + (block $~lib/internal/arraybuffer/loadUnsafe|inlined.3 (result i32) + ;;@ ~lib/internal/arraybuffer.ts:68:91 + (i32.load offset=8 + ;;@ ~lib/internal/arraybuffer.ts:68:20 + (i32.add + (get_local $5) + ;;@ ~lib/internal/arraybuffer.ts:68:48 + (i32.shl + ;;@ ~lib/internal/arraybuffer.ts:68:49 + (get_local $2) + ;;@ ~lib/internal/arraybuffer.ts:68:65 + (i32.const 2) + ) + ) + ) + ) + ) + ;;@ ~lib/array.ts:474:6 + (if + ;;@ ~lib/array.ts:474:10 + (get_local $4) + ;;@ ~lib/array.ts:474:17 + (block + ;;@ ~lib/array.ts:475:8 + (set_local $11 + ;;@ ~lib/array.ts:475:23 + (i32.load + (get_local $4) + ) + ) + ;;@ ~lib/array.ts:476:8 + (call $~lib/internal/string/copyUnsafe + ;;@ ~lib/array.ts:476:25 + (get_local $9) + ;;@ ~lib/array.ts:476:33 + (get_local $10) + ;;@ ~lib/array.ts:476:41 + (get_local $4) + ;;@ ~lib/array.ts:476:48 + (i32.const 0) + ;;@ ~lib/array.ts:476:51 + (get_local $11) + ) + ) + ) + ;;@ ~lib/array.ts:478:13 + (return + (get_local $9) + ) + ) + (func $assembly/module/index/TypeSection#toString (; 63 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + ;;@ assembly/module/index.ts:252:4 + (set_local $1 + ;;@ assembly/module/index.ts:252:25 + (i32.const 1048) + ) + ;;@ assembly/module/index.ts:253:4 + (block $break|0 + ;;@ assembly/module/index.ts:253:9 + (set_local $2 + ;;@ assembly/module/index.ts:253:15 + (i32.const 0) + ) + (loop $repeat|0 + (br_if $break|0 + (i32.eqz + ;;@ assembly/module/index.ts:253:18 + (i32.lt_s + (get_local $2) + ;;@ assembly/module/index.ts:253:21 + (block $~lib/array/Array#get:length|inlined.1 (result i32) + (set_local $3 + (i32.load offset=4 + (get_local $0) + ) + ) + ;;@ ~lib/array.ts:51:16 + (i32.load offset=4 + ;;@ ~lib/array.ts:51:11 + (get_local $3) + ) + ) + ) + ) + ) + ;;@ assembly/module/index.ts:254:11 + (drop + (call $~lib/array/Array#push + ;;@ assembly/module/index.ts:254:6 + (get_local $1) + ;;@ assembly/module/index.ts:254:30 + (call $assembly/module/index/FuncType#toString + ;;@ assembly/module/index.ts:254:16 + (call $~lib/array/Array#__get + (i32.load offset=4 + (get_local $0) + ) + ;;@ assembly/module/index.ts:254:27 + (get_local $2) + ) + ) + ) + ) + ;;@ assembly/module/index.ts:253:40 + (set_local $2 + (i32.add + (get_local $2) + (i32.const 1) + ) + ) + (br $repeat|0) + ) + ) + ;;@ assembly/module/index.ts:256:25 + (call $~lib/array/Array#join + ;;@ assembly/module/index.ts:256:11 + (get_local $1) + ;;@ assembly/module/index.ts:256:21 + (i32.const 1056) + ) + ) + (func $assembly/index/getType (; 64 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + ;;@ assembly/index.ts:60:2 + (set_local $1 + ;;@ assembly/index.ts:60:34 + (call $assembly/module/index/Module#getID + ;;@ assembly/index.ts:60:32 + (get_local $0) + ;;@ assembly/index.ts:60:40 + (get_global $src/common/SectionId.Type) + ) + ) + ;;@ assembly/index.ts:61:2 + (set_local $2 + ;;@ assembly/index.ts:61:16 + (call $assembly/module/index/TypeSection#constructor + (i32.const 0) + ;;@ assembly/index.ts:61:32 + (call $~lib/array/Array#__get + (get_local $1) + ;;@ assembly/index.ts:61:40 + (i32.const 0) + ) + ) + ) + ;;@ assembly/index.ts:62:2 + (set_global $assembly/index/type + ;;@ assembly/index.ts:62:17 + (call $assembly/module/index/TypeSection#parse + ;;@ assembly/index.ts:62:9 + (get_local $2) + ;;@ assembly/index.ts:62:23 + (i32.load offset=4 + (get_local $0) + ) + ) + ) + ;;@ assembly/index.ts:63:23 + (call $assembly/module/index/TypeSection#toString + ;;@ assembly/index.ts:63:9 + (get_global $assembly/index/type) + ) + ) + (func $assembly/index/toString (; 65 ;) (type $ii) (param $0 i32) (result i32) + ;;@ assembly/index.ts:67:20 + (call $assembly/module/index/TypeSection#toString + ;;@ assembly/index.ts:67:9 + (get_local $0) + ) + ) + (func $assembly/module/index/Module#constructor (; 66 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + ;;@ assembly/module/index.ts:26:4 + (i32.store offset=4 + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $2 + (call $~lib/memory/memory.allocate + (i32.const 8) + ) + ) + (i32.store + (get_local $2) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $2) + (i32.const 0) + ) + (get_local $2) + ) + ) + ) + ) + ;;@ assembly/module/index.ts:26:15 + (get_local $1) + ) + ;;@ assembly/module/index.ts:27:4 + (i32.store + (get_local $0) + ;;@ assembly/module/index.ts:27:19 + (i32.const 1072) + ) + (get_local $0) + ) + (func $assembly/index/Parser#constructor (; 67 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + ;;@ assembly/index.ts:74:3 + (i32.store + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $2 + (call $~lib/memory/memory.allocate + (i32.const 8) + ) + ) + (i32.store + (get_local $2) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $2) + (i32.const 0) + ) + (get_local $2) + ) + ) + ) + ) + ;;@ assembly/index.ts:74:14 + (get_local $1) + ) + ;;@ assembly/index.ts:75:3 + (i32.store offset=4 + (get_local $0) + ;;@ assembly/index.ts:75:17 + (call $assembly/module/index/Module#constructor + (i32.const 0) + ;;@ assembly/index.ts:75:28 + (get_local $1) + ) + ) + (get_local $0) + ) + (func $~lib/string/String.fromUTF8 (; 68 ;) (type $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) + ;;@ ~lib/string.ts:500:4 + (if + ;;@ ~lib/string.ts:500:8 + (i32.lt_u + (get_local $1) + ;;@ ~lib/string.ts:500:14 + (i32.const 1) + ) + ;;@ ~lib/string.ts:500:45 + (return + ;;@ ~lib/string.ts:500:24 + (i32.const 888) + ) + ) + ;;@ ~lib/string.ts:501:4 + (set_local $2 + ;;@ ~lib/string.ts:501:17 + (i32.const 0) + ) + ;;@ ~lib/string.ts:502:4 + (set_local $4 + ;;@ ~lib/string.ts:502:21 + (block $~lib/memory/memory.allocate|inlined.2 (result i32) + (set_local $3 + ;;@ ~lib/string.ts:502:30 + (i32.shl + (get_local $1) + ;;@ ~lib/string.ts:502:44 + (i32.const 1) + ) + ) + ;;@ ~lib/memory.ts:41:4 + (br $~lib/memory/memory.allocate|inlined.2 + ;;@ ~lib/memory.ts:41:45 + (call $~lib/allocator/tlsf/__memory_allocate + ;;@ ~lib/memory.ts:41:63 + (get_local $3) + ) + ) + ) + ) + ;;@ ~lib/string.ts:503:4 + (set_local $5 + ;;@ ~lib/string.ts:503:17 + (i32.const 0) + ) + ;;@ ~lib/string.ts:504:4 + (block $break|0 + (loop $continue|0 + (if + ;;@ ~lib/string.ts:504:11 + (i32.lt_u + (get_local $2) + ;;@ ~lib/string.ts:504:20 + (get_local $1) + ) + (block + ;;@ ~lib/string.ts:504:25 + (block + ;;@ ~lib/string.ts:505:6 + (set_local $3 + ;;@ ~lib/string.ts:505:15 + (i32.load8_u + ;;@ ~lib/string.ts:505:29 + (i32.add + (get_local $0) + ;;@ ~lib/string.ts:505:35 + (block (result i32) + (set_local $3 + (get_local $2) + ) + (set_local $2 + (i32.add + (get_local $3) + (i32.const 1) + ) + ) + (get_local $3) + ) + ) + ) + ) + ;;@ ~lib/string.ts:506:6 + (if + ;;@ ~lib/string.ts:506:10 + (i32.lt_u + (get_local $3) + ;;@ ~lib/string.ts:506:15 + (i32.const 128) + ) + ;;@ ~lib/string.ts:506:20 + (block + ;;@ ~lib/string.ts:507:8 + (i32.store16 + ;;@ ~lib/string.ts:507:19 + (i32.add + (get_local $4) + ;;@ ~lib/string.ts:507:25 + (get_local $5) + ) + ;;@ ~lib/string.ts:507:33 + (get_local $3) + ) + ;;@ ~lib/string.ts:508:8 + (set_local $5 + (i32.add + (get_local $5) + ;;@ ~lib/string.ts:508:18 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/string.ts:509:13 + (if + ;;@ ~lib/string.ts:509:17 + (if (result i32) + (tee_local $6 + (i32.gt_u + (get_local $3) + ;;@ ~lib/string.ts:509:22 + (i32.const 191) + ) + ) + ;;@ ~lib/string.ts:509:29 + (i32.lt_u + (get_local $3) + ;;@ ~lib/string.ts:509:34 + (i32.const 224) + ) + (get_local $6) + ) + ;;@ ~lib/string.ts:509:39 + (block + ;;@ ~lib/string.ts:510:8 + (if + (i32.eqz + ;;@ ~lib/string.ts:510:15 + (i32.le_u + (i32.add + (get_local $2) + ;;@ ~lib/string.ts:510:24 + (i32.const 1) + ) + ;;@ ~lib/string.ts:510:29 + (get_local $1) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 912) + (i32.const 510) + (i32.const 8) + ) + (unreachable) + ) + ) + ;;@ ~lib/string.ts:511:8 + (i32.store16 + ;;@ ~lib/string.ts:511:19 + (i32.add + (get_local $4) + ;;@ ~lib/string.ts:511:25 + (get_local $5) + ) + ;;@ ~lib/string.ts:511:33 + (i32.or + (i32.shl + (i32.and + ;;@ ~lib/string.ts:511:34 + (get_local $3) + ;;@ ~lib/string.ts:511:39 + (i32.const 31) + ) + ;;@ ~lib/string.ts:511:46 + (i32.const 6) + ) + ;;@ ~lib/string.ts:511:50 + (i32.and + (i32.load8_u + ;;@ ~lib/string.ts:511:59 + (i32.add + (get_local $0) + ;;@ ~lib/string.ts:511:65 + (block (result i32) + (set_local $6 + (get_local $2) + ) + (set_local $2 + (i32.add + (get_local $6) + (i32.const 1) + ) + ) + (get_local $6) + ) + ) + ) + ;;@ ~lib/string.ts:511:77 + (i32.const 63) + ) + ) + ) + ;;@ ~lib/string.ts:512:8 + (set_local $5 + (i32.add + (get_local $5) + ;;@ ~lib/string.ts:512:18 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/string.ts:513:13 + (if + ;;@ ~lib/string.ts:513:17 + (if (result i32) + (tee_local $6 + (i32.gt_u + (get_local $3) + ;;@ ~lib/string.ts:513:22 + (i32.const 239) + ) + ) + ;;@ ~lib/string.ts:513:29 + (i32.lt_u + (get_local $3) + ;;@ ~lib/string.ts:513:34 + (i32.const 365) + ) + (get_local $6) + ) + ;;@ ~lib/string.ts:513:39 + (block + ;;@ ~lib/string.ts:514:8 + (if + (i32.eqz + ;;@ ~lib/string.ts:514:15 + (i32.le_u + (i32.add + (get_local $2) + ;;@ ~lib/string.ts:514:24 + (i32.const 3) + ) + ;;@ ~lib/string.ts:514:29 + (get_local $1) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 912) + (i32.const 514) + (i32.const 8) + ) + (unreachable) + ) + ) + ;;@ ~lib/string.ts:515:8 + (set_local $3 + ;;@ ~lib/string.ts:515:13 + (i32.sub + (i32.or + ;;@ ~lib/string.ts:516:10 + (i32.or + (i32.or + (i32.shl + (i32.and + ;;@ ~lib/string.ts:516:11 + (get_local $3) + ;;@ ~lib/string.ts:516:39 + (i32.const 7) + ) + ;;@ ~lib/string.ts:516:45 + (i32.const 18) + ) + ;;@ ~lib/string.ts:517:10 + (i32.shl + (i32.and + ;;@ ~lib/string.ts:517:11 + (i32.load8_u + ;;@ ~lib/string.ts:517:20 + (i32.add + (get_local $0) + ;;@ ~lib/string.ts:517:26 + (block (result i32) + (set_local $6 + (get_local $2) + ) + (set_local $2 + (i32.add + (get_local $6) + (i32.const 1) + ) + ) + (get_local $6) + ) + ) + ) + ;;@ ~lib/string.ts:517:38 + (i32.const 63) + ) + ;;@ ~lib/string.ts:517:45 + (i32.const 12) + ) + ) + ;;@ ~lib/string.ts:518:10 + (i32.shl + (i32.and + ;;@ ~lib/string.ts:518:11 + (i32.load8_u + ;;@ ~lib/string.ts:518:20 + (i32.add + (get_local $0) + ;;@ ~lib/string.ts:518:26 + (block (result i32) + (set_local $6 + (get_local $2) + ) + (set_local $2 + (i32.add + (get_local $6) + (i32.const 1) + ) + ) + (get_local $6) + ) + ) + ) + ;;@ ~lib/string.ts:518:38 + (i32.const 63) + ) + ;;@ ~lib/string.ts:518:45 + (i32.const 6) + ) + ) + ;;@ ~lib/string.ts:519:11 + (i32.and + (i32.load8_u + ;;@ ~lib/string.ts:519:20 + (i32.add + (get_local $0) + ;;@ ~lib/string.ts:519:26 + (block (result i32) + (set_local $6 + (get_local $2) + ) + (set_local $2 + (i32.add + (get_local $6) + (i32.const 1) + ) + ) + (get_local $6) + ) + ) + ) + ;;@ ~lib/string.ts:519:38 + (i32.const 63) + ) + ) + ;;@ ~lib/string.ts:520:12 + (i32.const 65536) + ) + ) + ;;@ ~lib/string.ts:521:8 + (i32.store16 + ;;@ ~lib/string.ts:521:19 + (i32.add + (get_local $4) + ;;@ ~lib/string.ts:521:25 + (get_local $5) + ) + ;;@ ~lib/string.ts:521:33 + (i32.add + (i32.const 55296) + ;;@ ~lib/string.ts:521:42 + (i32.shr_u + ;;@ ~lib/string.ts:521:43 + (get_local $3) + ;;@ ~lib/string.ts:521:49 + (i32.const 10) + ) + ) + ) + ;;@ ~lib/string.ts:522:8 + (set_local $5 + (i32.add + (get_local $5) + ;;@ ~lib/string.ts:522:18 + (i32.const 2) + ) + ) + ;;@ ~lib/string.ts:523:8 + (i32.store16 + ;;@ ~lib/string.ts:523:19 + (i32.add + (get_local $4) + ;;@ ~lib/string.ts:523:25 + (get_local $5) + ) + ;;@ ~lib/string.ts:523:33 + (i32.add + (i32.const 56320) + ;;@ ~lib/string.ts:523:42 + (i32.and + ;;@ ~lib/string.ts:523:43 + (get_local $3) + ;;@ ~lib/string.ts:523:48 + (i32.const 1023) + ) + ) + ) + ;;@ ~lib/string.ts:524:8 + (set_local $5 + (i32.add + (get_local $5) + ;;@ ~lib/string.ts:524:18 + (i32.const 2) + ) + ) + ) + ;;@ ~lib/string.ts:525:13 + (block + ;;@ ~lib/string.ts:526:8 + (if + (i32.eqz + ;;@ ~lib/string.ts:526:15 + (i32.le_u + (i32.add + (get_local $2) + ;;@ ~lib/string.ts:526:24 + (i32.const 2) + ) + ;;@ ~lib/string.ts:526:29 + (get_local $1) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 912) + (i32.const 526) + (i32.const 8) + ) + (unreachable) + ) + ) + ;;@ ~lib/string.ts:527:8 + (i32.store16 + ;;@ ~lib/string.ts:527:19 + (i32.add + (get_local $4) + ;;@ ~lib/string.ts:527:25 + (get_local $5) + ) + ;;@ ~lib/string.ts:528:10 + (i32.or + (i32.or + (i32.shl + (i32.and + ;;@ ~lib/string.ts:528:11 + (get_local $3) + ;;@ ~lib/string.ts:528:38 + (i32.const 15) + ) + ;;@ ~lib/string.ts:528:45 + (i32.const 12) + ) + ;;@ ~lib/string.ts:529:10 + (i32.shl + (i32.and + ;;@ ~lib/string.ts:529:11 + (i32.load8_u + ;;@ ~lib/string.ts:529:20 + (i32.add + (get_local $0) + ;;@ ~lib/string.ts:529:26 + (block (result i32) + (set_local $6 + (get_local $2) + ) + (set_local $2 + (i32.add + (get_local $6) + (i32.const 1) + ) + ) + (get_local $6) + ) + ) + ) + ;;@ ~lib/string.ts:529:38 + (i32.const 63) + ) + ;;@ ~lib/string.ts:529:45 + (i32.const 6) + ) + ) + ;;@ ~lib/string.ts:530:11 + (i32.and + (i32.load8_u + ;;@ ~lib/string.ts:530:20 + (i32.add + (get_local $0) + ;;@ ~lib/string.ts:530:26 + (block (result i32) + (set_local $6 + (get_local $2) + ) + (set_local $2 + (i32.add + (get_local $6) + (i32.const 1) + ) + ) + (get_local $6) + ) + ) + ) + ;;@ ~lib/string.ts:530:38 + (i32.const 63) + ) + ) + ) + ;;@ ~lib/string.ts:532:8 + (set_local $5 + (i32.add + (get_local $5) + ;;@ ~lib/string.ts:532:18 + (i32.const 2) + ) + ) + ) + ) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ;;@ ~lib/string.ts:535:4 + (if + (i32.eqz + ;;@ ~lib/string.ts:535:11 + (i32.eq + (get_local $2) + ;;@ ~lib/string.ts:535:21 + (get_local $1) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 912) + (i32.const 535) + (i32.const 4) + ) + (unreachable) + ) + ) + ;;@ ~lib/string.ts:536:4 + (set_local $7 + ;;@ ~lib/string.ts:536:14 + (call $~lib/internal/string/allocateUnsafe + ;;@ ~lib/string.ts:536:29 + (i32.shr_u + ;;@ ~lib/string.ts:536:35 + (get_local $5) + ;;@ ~lib/string.ts:536:45 + (i32.const 1) + ) + ) + ) + ;;@ ~lib/string.ts:537:11 + (block $~lib/memory/memory.copy|inlined.2 + (set_local $3 + ;;@ ~lib/string.ts:537:16 + (i32.add + (get_local $7) + ;;@ ~lib/string.ts:537:41 + (get_global $~lib/internal/string/HEADER_SIZE) + ) + ) + ;;@ ~lib/memory.ts:20:4 + (call $~lib/internal/memory/memmove + ;;@ ~lib/memory.ts:20:12 + (get_local $3) + ;;@ ~lib/memory.ts:20:18 + (get_local $4) + ;;@ ~lib/memory.ts:20:23 + (get_local $5) + ) + ) + ;;@ ~lib/string.ts:538:11 + (block $~lib/memory/memory.free|inlined.0 + ;;@ ~lib/memory.ts:47:4 + (block + ;;@ ~lib/memory.ts:47:36 + (call $~lib/allocator/tlsf/__memory_free + ;;@ ~lib/memory.ts:47:50 + (get_local $4) + ) + ;;@ ~lib/memory.ts:47:56 + (br $~lib/memory/memory.free|inlined.0) + ) + ) + ;;@ ~lib/string.ts:539:11 + (get_local $7) + ) + (func $assembly/index/Parser#parseString (; 69 ;) (type $ii) (param $0 i32) (result i32) + ;;@ assembly/index.ts:79:63 + (call $~lib/string/String.fromUTF8 + ;;@ assembly/index.ts:79:26 + (i32.load offset=8 + (i32.load + (get_local $0) + ) + ) + ;;@ assembly/index.ts:79:48 + (call $assembly/buffer/index/Buffer#readVaruint + ;;@ assembly/index.ts:79:39 + (i32.load + (get_local $0) + ) + ;;@ assembly/index.ts:79:60 + (i32.const 32) + ) + ) + ) + (func $assembly/index/Parser#readVaruint (; 70 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + ;;@ assembly/index.ts:83:34 + (call $assembly/buffer/index/Buffer#readVaruint + ;;@ assembly/index.ts:83:10 + (i32.load + (get_local $0) + ) + ;;@ assembly/index.ts:83:31 + (get_local $1) + ) + ) + (func $assembly/index/Parser#get:off (; 71 ;) (type $ii) (param $0 i32) (result i32) + ;;@ assembly/index.ts:87:19 + (i32.load offset=8 + ;;@ assembly/index.ts:87:10 + (i32.load + (get_local $0) + ) + ) + ) + (func $assembly/index/Parser#set:off (; 72 ;) (type $iiv) (param $0 i32) (param $1 i32) + ;;@ assembly/index.ts:91:3 + (i32.store offset=8 + (i32.load + (get_local $0) + ) + ;;@ assembly/index.ts:91:18 + (get_local $1) + ) + ) + (func $assembly/buffer/index/Buffer#readUint (; 73 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + ;;@ assembly/buffer/index.ts:18:4 + (set_local $1 + ;;@ assembly/buffer/index.ts:18:14 + (i32.load offset=8 + (get_local $0) + ) + ) + ;;@ assembly/buffer/index.ts:19:4 + (set_local $2 + ;;@ assembly/buffer/index.ts:19:14 + (i32.load + ;;@ assembly/buffer/index.ts:19:27 + (get_local $1) + ) + ) + ;;@ assembly/buffer/index.ts:20:4 + (i32.store offset=8 + (get_local $0) + ;;@ assembly/buffer/index.ts:20:15 + (i32.add + (get_local $1) + ;;@ assembly/buffer/index.ts:20:21 + (i32.const 4) + ) + ) + ;;@ assembly/buffer/index.ts:21:11 + (get_local $2) + ) + (func $assembly/module/index/sectionName (; 74 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + ;;@ assembly/module/index.ts:99:2 + (block $break|0 + (block $case12|0 + (block $case11|0 + (block $case10|0 + (block $case9|0 + (block $case8|0 + (block $case7|0 + (block $case6|0 + (block $case5|0 + (block $case4|0 + (block $case3|0 + (block $case2|0 + (block $case1|0 + (block $case0|0 + (set_local $1 + ;;@ assembly/module/index.ts:99:10 + (get_local $0) + ) + (br_if $case0|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:100:9 + (i32.const 0) + ) + ) + (br_if $case1|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:102:9 + (i32.const 1) + ) + ) + (br_if $case2|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:104:10 + (i32.const 2) + ) + ) + (br_if $case3|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:106:10 + (i32.const 3) + ) + ) + (br_if $case4|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:108:10 + (i32.const 4) + ) + ) + (br_if $case5|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:110:10 + (i32.const 5) + ) + ) + (br_if $case6|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:112:10 + (i32.const 6) + ) + ) + (br_if $case7|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:114:10 + (i32.const 7) + ) + ) + (br_if $case8|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:116:10 + (i32.const 8) + ) + ) + (br_if $case9|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:118:10 + (i32.const 9) + ) + ) + (br_if $case10|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:120:10 + (i32.const 10) + ) + ) + (br_if $case11|0 + (i32.eq + (get_local $1) + ;;@ assembly/module/index.ts:122:10 + (i32.const 11) + ) + ) + (br $case12|0) + ) + ;;@ assembly/module/index.ts:101:13 + (return + (i32.const 1088) + ) + ) + ;;@ assembly/module/index.ts:103:13 + (return + (i32.const 1104) + ) + ) + ;;@ assembly/module/index.ts:105:10 + (return + (i32.const 1120) + ) + ) + ;;@ assembly/module/index.ts:107:10 + (return + (i32.const 1136) + ) + ) + ;;@ assembly/module/index.ts:109:10 + (return + (i32.const 1160) + ) + ) + ;;@ assembly/module/index.ts:111:10 + (return + (i32.const 1176) + ) + ) + ;;@ assembly/module/index.ts:113:10 + (return + (i32.const 1192) + ) + ) + ;;@ assembly/module/index.ts:115:10 + (return + (i32.const 1208) + ) + ) + ;;@ assembly/module/index.ts:117:10 + (return + (i32.const 1224) + ) + ) + ;;@ assembly/module/index.ts:119:10 + (return + (i32.const 1240) + ) + ) + ;;@ assembly/module/index.ts:121:10 + (return + (i32.const 1264) + ) + ) + ;;@ assembly/module/index.ts:123:10 + (return + (i32.const 1280) + ) + ) + ;;@ assembly/module/index.ts:125:6 + (unreachable) + ) + ;;@ assembly/module/index.ts:128:9 + (i32.const 888) + ) + (func $assembly/module/index/SectionHeader#constructor (; 75 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + ;;@ assembly/module/index.ts:139:4 + (i32.store + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $2 + (call $~lib/memory/memory.allocate + (i32.const 20) + ) + ) + (i32.store + (get_local $2) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $2) + (i32.const 0) + ) + (i32.store offset=8 + (get_local $2) + (i32.const 0) + ) + (i32.store offset=12 + (get_local $2) + (i32.const 0) + ) + (i32.store offset=16 + (get_local $2) + ;;@ assembly/module/index.ts:136:24 + (i32.const 888) + ) + (get_local $2) + ) + ) + ) + ) + ;;@ assembly/module/index.ts:139:15 + (i32.load offset=8 + (get_local $1) + ) + ) + ;;@ assembly/module/index.ts:140:4 + (i32.store offset=4 + (get_local $0) + ;;@ assembly/module/index.ts:140:18 + (call $assembly/buffer/index/Buffer#readVaruint + ;;@ assembly/module/index.ts:140:14 + (get_local $1) + ;;@ assembly/module/index.ts:140:30 + (i32.const 7) + ) + ) + ;;@ assembly/module/index.ts:141:4 + (i32.store offset=8 + (get_local $0) + ;;@ assembly/module/index.ts:141:27 + (call $assembly/buffer/index/Buffer#readVaruint + ;;@ assembly/module/index.ts:141:23 + (get_local $1) + ;;@ assembly/module/index.ts:141:39 + (i32.const 32) + ) + ) + ;;@ assembly/module/index.ts:142:4 + (if + ;;@ assembly/module/index.ts:142:8 + (i32.eq + (i32.load offset=4 + (get_local $0) + ) + ;;@ assembly/module/index.ts:142:19 + (i32.const 0) + ) + ;;@ assembly/module/index.ts:142:21 + (block + ;;@ assembly/module/index.ts:143:6 + (set_local $2 + ;;@ assembly/module/index.ts:143:19 + (i32.load offset=8 + (get_local $1) + ) + ) + ;;@ assembly/module/index.ts:144:6 + (set_local $3 + ;;@ assembly/module/index.ts:144:25 + (call $assembly/buffer/index/Buffer#readVaruint + ;;@ assembly/module/index.ts:144:21 + (get_local $1) + ;;@ assembly/module/index.ts:144:37 + (i32.const 32) + ) + ) + ;;@ assembly/module/index.ts:145:6 + (set_local $4 + ;;@ assembly/module/index.ts:145:21 + (i32.load offset=8 + (get_local $1) + ) + ) + ;;@ assembly/module/index.ts:146:6 + (i32.store offset=16 + (get_local $0) + ;;@ assembly/module/index.ts:146:18 + (call $~lib/string/String.__concat + (call $~lib/string/String.__concat + (i32.const 1080) + ;;@ assembly/module/index.ts:146:31 + (call $~lib/string/String.fromUTF8 + ;;@ assembly/module/index.ts:146:40 + (get_local $4) + ;;@ assembly/module/index.ts:146:50 + (get_local $3) + ) + ) + ;;@ assembly/module/index.ts:146:62 + (i32.const 1080) + ) + ) + ;;@ assembly/module/index.ts:147:6 + (i32.store offset=8 + (get_local $1) + (i32.add + (i32.load offset=8 + (get_local $1) + ) + ;;@ assembly/module/index.ts:147:17 + (get_local $3) + ) + ) + ;;@ assembly/module/index.ts:148:6 + (i32.store offset=8 + (get_local $0) + (i32.sub + (i32.load offset=8 + (get_local $0) + ) + ;;@ assembly/module/index.ts:148:26 + (i32.sub + (i32.load offset=8 + (get_local $1) + ) + ;;@ assembly/module/index.ts:148:36 + (get_local $2) + ) + ) + ) + ) + ;;@ assembly/module/index.ts:149:11 + (if + ;;@ assembly/module/index.ts:149:15 + (i32.le_u + (i32.load offset=4 + (get_local $0) + ) + ;;@ assembly/module/index.ts:149:26 + (get_global $src/common/SectionId.Data) + ) + ;;@ assembly/module/index.ts:149:47 + (i32.store offset=16 + ;;@ assembly/module/index.ts:150:6 + (get_local $0) + ;;@ assembly/module/index.ts:150:18 + (call $assembly/module/index/sectionName + ;;@ assembly/module/index.ts:150:30 + (i32.load offset=4 + (get_local $0) + ) + ) + ) + ;;@ assembly/module/index.ts:151:11 + (unreachable) + ) + ) + ;;@ assembly/module/index.ts:154:4 + (i32.store offset=12 + (get_local $0) + ;;@ assembly/module/index.ts:154:23 + (i32.load offset=8 + (get_local $1) + ) + ) + (get_local $0) + ) + (func $assembly/module/index/Module#parseSection (; 76 ;) (type $iiv) (param $0 i32) (param $1 i32) + (local $2 i32) + ;;@ assembly/module/index.ts:47:17 + (drop + (call $~lib/array/Array#push + ;;@ assembly/module/index.ts:47:4 + (i32.load + (get_local $0) + ) + ;;@ assembly/module/index.ts:47:22 + (get_local $1) + ) + ) + ;;@ assembly/module/index.ts:48:4 + (block $break|0 + (block $case1|0 + (block $case0|0 + (set_local $2 + ;;@ assembly/module/index.ts:48:12 + (i32.load offset=4 + (get_local $1) + ) + ) + (br_if $case0|0 + (i32.eq + (get_local $2) + ;;@ assembly/module/index.ts:49:11 + (get_global $src/common/SectionId.Type) + ) + ) + (br $case1|0) + ) + ;;@ assembly/module/index.ts:51:8 + (br $break|0) + ) + ) + ) + (func $assembly/module/index/SectionHeader#get:end (; 77 ;) (type $ii) (param $0 i32) (result i32) + ;;@ assembly/module/index.ts:158:35 + (i32.add + ;;@ assembly/module/index.ts:158:11 + (i32.load offset=12 + (get_local $0) + ) + ;;@ assembly/module/index.ts:158:30 + (i32.load offset=8 + (get_local $0) + ) + ) + ) + (func $assembly/index/Parser#parse (; 78 ;) (type $iv) (param $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + ;;@ assembly/index.ts:96:4 + (set_local $1 + ;;@ assembly/index.ts:96:25 + (call $assembly/buffer/index/Buffer#readUint + ;;@ assembly/index.ts:96:16 + (i32.load + (get_local $0) + ) + ) + ) + ;;@ assembly/index.ts:97:4 + (if + ;;@ assembly/index.ts:97:8 + (i32.ne + (get_local $1) + ;;@ assembly/index.ts:97:17 + (i32.const 1836278016) + ) + ;;@ assembly/index.ts:97:29 + (unreachable) + ) + ;;@ assembly/index.ts:98:4 + (set_local $2 + ;;@ assembly/index.ts:98:27 + (call $assembly/buffer/index/Buffer#readUint + ;;@ assembly/index.ts:98:18 + (i32.load + (get_local $0) + ) + ) + ) + ;;@ assembly/index.ts:99:4 + (if + ;;@ assembly/index.ts:99:8 + (i32.ne + (get_local $2) + ;;@ assembly/index.ts:99:19 + (i32.const 1) + ) + ;;@ assembly/index.ts:99:22 + (unreachable) + ) + ;;@ assembly/index.ts:100:4 + (set_local $3 + ;;@ assembly/index.ts:100:31 + (i32.const 0) + ) + ;;@ assembly/index.ts:101:4 + (set_local $4 + ;;@ assembly/index.ts:101:31 + (i32.const 0) + ) + ;;@ assembly/index.ts:102:4 + (set_local $5 + ;;@ assembly/index.ts:102:31 + (i32.const 0) + ) + ;;@ assembly/index.ts:103:4 + (set_local $6 + ;;@ assembly/index.ts:103:31 + (i32.const 0) + ) + ;;@ assembly/index.ts:104:4 + (block $break|0 + (loop $continue|0 + (if + ;;@ assembly/index.ts:104:11 + (i32.lt_u + (i32.load offset=8 + (i32.load + (get_local $0) + ) + ) + ;;@ assembly/index.ts:104:26 + (i32.load offset=4 + (i32.load + (get_local $0) + ) + ) + ) + (block + ;;@ assembly/index.ts:104:43 + (block + ;;@ assembly/index.ts:106:6 + (set_local $7 + ;;@ assembly/index.ts:106:34 + (call $assembly/module/index/SectionHeader#constructor + (i32.const 0) + ;;@ assembly/index.ts:106:52 + (i32.load + (get_local $0) + ) + ) + ) + ;;@ assembly/index.ts:107:18 + (call $assembly/module/index/Module#parseSection + ;;@ assembly/index.ts:107:6 + (i32.load offset=4 + (get_local $0) + ) + ;;@ assembly/index.ts:107:31 + (get_local $7) + ) + ;;@ assembly/index.ts:108:6 + (call $assembly/index/Parser#set:off + (get_local $0) + ;;@ assembly/index.ts:108:17 + (call $assembly/module/index/SectionHeader#get:end + (get_local $7) + ) + ) + ) + (br $continue|0) + ) + ) + ) + ) + ) + (func $~lib/arraybuffer/ArrayBuffer#get:data (; 79 ;) (type $ii) (param $0 i32) (result i32) + ;;@ ~lib/arraybuffer.ts:13:55 + (i32.add + ;;@ ~lib/arraybuffer.ts:13:29 + (get_local $0) + ;;@ ~lib/arraybuffer.ts:13:55 + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (func $assembly/buffer/index/Buffer#constructor (; 80 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + ;;@ assembly/buffer/index.ts:10:4 + (i32.store + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $2 + (call $~lib/memory/memory.allocate + (i32.const 12) + ) + ) + (i32.store + (get_local $2) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $2) + (i32.const 0) + ) + (i32.store offset=8 + (get_local $2) + (i32.const 0) + ) + (get_local $2) + ) + ) + ) + ) + ;;@ assembly/buffer/index.ts:10:18 + (get_local $1) + ) + ;;@ assembly/buffer/index.ts:11:4 + (i32.store offset=8 + (get_local $0) + ;;@ assembly/buffer/index.ts:11:15 + (call $~lib/arraybuffer/ArrayBuffer#get:data + (i32.load + (get_local $1) + ) + ) + ) + ;;@ assembly/buffer/index.ts:12:4 + (i32.store offset=4 + (get_local $0) + ;;@ assembly/buffer/index.ts:12:18 + (i32.load offset=8 + (get_local $1) + ) + ) + (get_local $0) + ) + (func $assembly/index/newParser (; 81 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + ;;@ assembly/index.ts:118:2 + (set_local $1 + ;;@ assembly/index.ts:118:15 + (call $assembly/buffer/index/Buffer#constructor + (i32.const 0) + ;;@ assembly/index.ts:118:26 + (get_local $0) + ) + ) + ;;@ assembly/index.ts:119:26 + (call $assembly/index/Parser#constructor + (i32.const 0) + ;;@ assembly/index.ts:119:20 + (get_local $1) + ) + ) + (func $assembly/index/parse (; 82 ;) (type $ii) (param $0 i32) (result i32) + ;;@ assembly/index.ts:122:4 + (call $assembly/index/Parser#parse + ;;@ assembly/index.ts:122:2 + (get_local $0) + ) + ;;@ assembly/index.ts:123:11 + (i32.load offset=4 + ;;@ assembly/index.ts:123:9 + (get_local $0) + ) + ) + (func $start (; 83 ;) (type $v) + ;;@ ~lib/allocator/tlsf.ts:122:0 + (if + (i32.eqz + ;;@ ~lib/allocator/tlsf.ts:122:7 + (i32.le_s + (i32.shl + ;;@ ~lib/allocator/tlsf.ts:122:8 + (i32.const 1) + ;;@ ~lib/allocator/tlsf.ts:122:13 + (get_global $~lib/allocator/tlsf/SL_BITS) + ) + ;;@ ~lib/allocator/tlsf.ts:122:25 + (i32.const 32) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 8) + (i32.const 122) + (i32.const 0) + ) + (unreachable) + ) + ) + (nop) + ) + (func $null (; 84 ;) (type $v) + ) + (func $Parser#get:buf (; 85 ;) (type $ii) (param $0 i32) (result i32) + (i32.load + (get_local $0) + ) + ) + (func $Parser#set:buf (; 86 ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store + (get_local $0) + (get_local $1) + ) + ) + (func $Parser#get:module (; 87 ;) (type $ii) (param $0 i32) (result i32) + (i32.load offset=4 + (get_local $0) + ) + ) + (func $Parser#set:module (; 88 ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store offset=4 + (get_local $0) + (get_local $1) + ) ) ) diff --git a/lib/parse/index.js b/lib/parse/index.js index ea789fee70..e71a40c87f 100644 --- a/lib/parse/index.js +++ b/lib/parse/index.js @@ -1,2 +1,2 @@ -!function(A,Q){"object"==typeof exports&&"object"==typeof module?module.exports=Q():"function"==typeof define&&define.amd?define([],Q):"object"==typeof exports?exports.asparse=Q():A.asparse=Q()}("undefined"!=typeof self?self:this,function(){return function(A){var Q={};function n(e){if(Q[e])return Q[e].exports;var E=Q[e]={i:e,l:!1,exports:{}};return A[e].call(E.exports,E,E.exports,n),E.l=!0,E.exports}return n.m=A,n.c=Q,n.d=function(A,Q,e){n.o(A,Q)||Object.defineProperty(A,Q,{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,Q){if(1&Q&&(A=n(A)),8&Q)return A;if(4&Q&&"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&Q&&"string"!=typeof A)for(var E in A)n.d(e,E,function(Q){return A[Q]}.bind(null,E));return e},n.n=function(A){var Q=A&&A.__esModule?function(){return A.default}:function(){return A};return n.d(Q,"a",Q),Q},n.o=function(A,Q){return Object.prototype.hasOwnProperty.call(A,Q)},n.p="",n(n.s=0)}([function(A,Q,n){A.exports=n(1)},function(A,Q,n){"use strict";Q.__esModule=!0;var e=n(2);Q.Type=e.Type,Q.SectionId=e.SectionId,Q.ExternalKind=e.ExternalKind;var E=null;Q.parse=function A(Q,n){n||(n={}),E||(E=new WebAssembly.Module(function(A){var Q=A.length;if(Q){for(var n=0,e=Q;--e%4>1&&61===A.charCodeAt(e);)++n;Q=Math.ceil(3*Q)/4-n}for(var E=new Uint8Array(Q),I=0,B=0,t=0,i=0,C=A.length;i1)break;if(void 0===(r=o[r]))throw Error();switch(I){case 0:t=r,I=1;break;case 1:E[B++]=t<<2|(48&r)>>4,t=r,I=2;break;case 2:E[B++]=(15&t)<<4|(60&r)>>2,t=r,I=3;break;case 3:E[B++]=(3&t)<<6|r,I=0}}if(1===I)throw Error();return E}("AGFzbQEAAAABQQtgAn9/AGABfwF/YAV/f39/fwF/YAN/f38AYAZ/f39/f38AYAV/f39/fwBgBH9/f38AYAAAYAABfmABfwBgAAF/Aq4DFAdvcHRpb25zCW9uU2VjdGlvbgACB29wdGlvbnMGb25UeXBlAAAHb3B0aW9ucwtvblR5cGVQYXJhbQADB29wdGlvbnMMb25UeXBlUmV0dXJuAAMHb3B0aW9ucwhvbkltcG9ydAAEB29wdGlvbnMQb25GdW5jdGlvbkltcG9ydAAAB29wdGlvbnMNb25UYWJsZUltcG9ydAAFB29wdGlvbnMOb25NZW1vcnlJbXBvcnQABgdvcHRpb25zDm9uR2xvYmFsSW1wb3J0AAMHb3B0aW9ucwpvbkZ1bmN0aW9uAAAHb3B0aW9ucwdvblRhYmxlAAUHb3B0aW9ucwhvbk1lbW9yeQAGB29wdGlvbnMIb25HbG9iYWwAAwdvcHRpb25zCG9uRXhwb3J0AAUHb3B0aW9ucwdvblN0YXJ0AAkHb3B0aW9ucwxvbk1vZHVsZU5hbWUAAAdvcHRpb25zDm9uRnVuY3Rpb25OYW1lAAMHb3B0aW9ucwtvbkxvY2FsTmFtZQAGB29wdGlvbnMSb25Tb3VyY2VNYXBwaW5nVVJMAAADZW52Bm1lbW9yeQIAAAMHBgoBCAcABwQEAXAAAQaHARp/AUEAC38BQQALfwFBAQt/AUECC38BQQMLfwFBBAt/AUEFC38BQQYLfwFBBwt/AUEIC38BQQkLfwFBCgt/AUELC38BQQALfwFBAQt/AUECC38BQQMLfwFBCwt/AUEjC38BQcEAC38BQcIAC38BQcMAC38BQcQAC38BQQALfwFBAQt/AUECCwcaAwZtZW1vcnkCAAV0YWJsZQEABXBhcnNlABcJBwEAQQALARgKwg4GRAEEfyMAIQACQANAIAAiAUEBaiEAIAIgAS0AACIBQf8AcSADdHIhAiABQYABcUUNASADQQdqIQMMAAALAAsgACQAIAILYAEFfyMAIQIDQCACIgRBAWohAiADIAQtAAAiBUH/AHEgAXRyIQMgAUEHaiEBIAVBgAFxDQALIAIkACADQX8gAXRyIQIgASAASSIEBEAgBUHAAHFBAEchBAsgAiADIAQbC2YCAn8EfiMAIQEDQCABIgBBAWohASADIAAxAAAiBEL/AIMgAoaEIQMgAkIHfCECIARCgAGDQgBSDQALIAEkACADQn8gAoaEIQUgAkLAAFQiAARAIARCwACDQgBSIQALIAUgAyAAGwuZAQECfwJAAkACQAJAAkACQCMAIgEtAAAhACABQQFqJAAgACMTRwRAIAAjFEYNASAAIxVGDQIgACMWRg0DIAAjEkYNBAwFC0EgEBQaDAULEBUaDAQLIwAiACgCABogAEEEaiQADAMLIwAiACkDABogAEEIaiQADAILEBMaDAELAAsjACIBLQAAIQAgAUEBaiQAIAAjEUcEQAALC5MLAQ1/IAAkACMAIgYoAgAhACAGQQRqJAAgAEGAws3rBkcEQAALIwAiBigCACEAIAZBBGokACAAQQFHBEAACwNAIwAgAUkEQBATIQIQEyEIQQAhBUEAIQAgAgRAIAIjDEsEQAALBSMAIQQQEyEAIwAhBSMAIABqJAAgCCMAIARrayEICyACIwAiBCAIIAUgABAAQQFxBEACQAJAAkACQAJAAkACQAJAAkACQAJAIAIjAkcEQCACIwNGDQEgAiMERg0CIAIjBUYNAyACIwZGDQQgAiMHRg0FIAIjCEYNBiACIwlGDQcgAiMBRg0IIAIjCkYNCSACIwtGDQkgAiMMRg0JDAoLEBMhAgJAQQAhAwNAIAMgAk8NASADQQcQFEH/AHEQARATIQQCQEEAIQcDQCAHIARPDQEgAyAHQQcQFEH/AHEQAiAHQQFqIQcMAAALAAsQEyEHAkBBACEFA0AgBSAHTw0BIAMgBUEHEBRB/wBxEAMgBUEBaiEFDAAACwALIANBAWohAwwAAAsACwwKCxATIQICQEEAIQMDQCADIAJPDQEQEyEHIwAhBCMAIAdqJAAQEyEJIwAhBSMAIAlqJAAjACIGLQAAIQAgBkEBaiQAIAMgACAEIAcgBSAJEAQCQAJAAkACQAJAIAAiBiMNRwRAIAYjDkYNASAGIw9GDQIgBiMQRg0DDAQLIAsiCkEBaiELIAoQExAFDAQLQQcQFEH/AHEhBhATIQogDCIAQQFqIQwgACAGEBMiBCAKQQFxBH8QEwVBfwsiCCAKEAYMAwsQEyEIIA0iBkEBaiENIAYQEyIAIAhBAXEEfxATBUH//wMLIgogCBAHDAILIA4iCEEBaiEOIAhBBxAUQf8AcRATEAgMAQsACyADQQFqIQMMAAALAAsMCQsQEyECAkBBACEDA0AgAyACTw0BIAsiBUEBaiELIAUQExAJIANBAWohAwwAAAsACwwICxATIQICQEEAIQMDQCADIAJPDQEQE0H/AHEhABATIQUgDCIHQQFqIQwgByAAEBMiBiAFQQFxBH8QEwVBfwsiBCAFEAogA0EBaiEDDAAACwALDAcLEBMhAgJAQQAhAwNAIAMgAk8NARATIQQgDSIAQQFqIQ0gABATIgYgBEEBcQR/EBMFQf//AwsiBSAEEAsgA0EBaiEDDAAACwALDAYLEBMhAgJAQQAhAwNAIAMgAk8NAUEHEBRB/wBxIQUQEyEJEBYgDiIEQQFqIQ4gBCAFIAkQDCADQQFqIQMMAAALAAsMBQsQEyECAkBBACEDA0AgAyACTw0BEBMhCSMAIQUjACAJaiQAIwAiBi0AACEAIAZBAWokACADIAAQEyAFIAkQDSADQQFqIQMMAAALAAsMBAsQExAODAMLIABBBEYiAgRAIAUoAgBB7sK1qwZGIQILIAIEQBATIQIQEyEDIwAhAAJAAkACQAJAIAIiBCMXRwRAIAQjGEYNASAEIxlGDQIMAwsQEyEEIwAgBBAPDAMLEBMhBQJAQQAhBANAIAQgBU8NARATIQkQEyEHIwAhAiMAIAdqJAAgCSACIAcQECAEQQFqIQQMAAALAAsMAgsQEyEFAkBBACEEA0AgBCAFTw0BEBMhAhATIQcCQEEAIQkDQCAJIAdPDQEQEyEKEBMhCCMAIQYjACAIaiQAIAIgCiAGIAgQESAJQQFqIQkMAAALAAsgBEEBaiEEDAAACwALDAELAAsgACADaiQADAMFIABBEEYiAARAIAUpAwBC897Vk7es2abhAFEhAAsgAARAIAVBCGopAwBC8OCl8/aslanMAFEhAAsgAARAEBMhACMAIQMjACAAaiQAIAMgABASCwsgBCAIaiQADAILIwAgCGokAAwBCwALBSMAIAhqJAALDAELCyMAIAFHBEAACwsDAAELACAQc291cmNlTWFwcGluZ1VSTA5pbmRleC53YXNtLm1hcA==")));var e=Q.length,I=(e+65535&-65536)>>16,B=new WebAssembly.Memory({initial:I}),t=new Uint8Array(B.buffer);t.set(Q),A.readString=function(A,Q){return function(A,Q,n){if(n-Q<1)return"";for(var e=null,E=[],o=0,I=0;Q191&&I<224?E[o++]=(31&I)<<6|63&A[Q++]:I>239&&I<365?(I=((7&I)<<18|(63&A[Q++])<<12|(63&A[Q++])<<6|63&A[Q++])-65536,E[o++]=55296+(I>>10),E[o++]=56320+(1023&I)):E[o++]=(15&I)<<12|(63&A[Q++])<<6|63&A[Q++],o>8191&&((e||(e=[])).push(String.fromCharCode.apply(String,E)),o=0);return e?(o&&e.push(String.fromCharCode.apply(String,E.slice(0,o))),e.join("")):String.fromCharCode.apply(String,E.slice(0,o))}(t,A,A+Q)};var i={env:{memory:B},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(E,i).exports.parse(0,e)};for(var o=new Array(123),I=0;I<64;)o[I<26?I+65:I<52?I+71:I<62?I-4:I-59|43]=I++},function(A,Q,n){"use strict";Q.__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"}(Q.Type||(Q.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"}(Q.SectionId||(Q.SectionId={})),function(A){A[A.Function=0]="Function",A[A.Table=1]="Table",A[A.Memory=2]="Memory",A[A.Global=3]="Global"}(Q.ExternalKind||(Q.ExternalKind={})),function(A){A[A.Module=0]="Module",A[A.Function=1]="Function",A[A.Local=2]="Local"}(Q.NameType||(Q.NameType={})),Q.MAX_PAGES=65535,Q.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"}(Q.Opcode||(Q.Opcode={}))}])}); +!function(A,Q){"object"==typeof exports&&"object"==typeof module?module.exports=Q():"function"==typeof define&&define.amd?define([],Q):"object"==typeof exports?exports.asparse=Q():A.asparse=Q()}("undefined"!=typeof self?self:this,function(){return function(A){var Q={};function n(B){if(Q[B])return Q[B].exports;var e=Q[B]={i:B,l:!1,exports:{}};return A[B].call(e.exports,e,e.exports,n),e.l=!0,e.exports}return n.m=A,n.c=Q,n.d=function(A,Q,B){n.o(A,Q)||Object.defineProperty(A,Q,{enumerable:!0,get:B})},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,Q){if(1&Q&&(A=n(A)),8&Q)return A;if(4&Q&&"object"==typeof A&&A&&A.__esModule)return A;var B=Object.create(null);if(n.r(B),Object.defineProperty(B,"default",{enumerable:!0,value:A}),2&Q&&"string"!=typeof A)for(var e in A)n.d(B,e,function(Q){return A[Q]}.bind(null,e));return B},n.n=function(A){var Q=A&&A.__esModule?function(){return A.default}:function(){return A};return n.d(Q,"a",Q),Q},n.o=function(A,Q){return Object.prototype.hasOwnProperty.call(A,Q)},n.p="",n(n.s=0)}([function(A,Q,n){A.exports=n(1)},function(A,Q,n){"use strict";Q.__esModule=!0;var B=n(2);Q.Type=B.Type,Q.SectionId=B.SectionId,Q.ExternalKind=B.ExternalKind;var e=null;Q.parse=function A(Q,n){n||(n={}),e||(e=new WebAssembly.Module(function(A){var Q=A.length;if(Q){for(var n=0,B=Q;--B%4>1&&61===A.charCodeAt(B);)++n;Q=Math.ceil(3*Q)/4-n}for(var e=new Uint8Array(Q),t=0,E=0,o=0,C=0,b=A.length;C1)break;if(void 0===(c=I[c]))throw Error();switch(t){case 0:o=c,t=1;break;case 1:e[E++]=o<<2|(48&c)>>4,o=c,t=2;break;case 2:e[E++]=(15&o)<<4|(60&c)>>2,o=c,t=3;break;case 3:e[E++]=(3&o)<<6|c,t=0}}if(1===t)throw Error();return e}("AGFzbQEAAAABRQxgAn9/AGAAAX9gAX8Bf2AFf39/f38Bf2ADf39/AGAGf39/f39/AGAFf39/f38AYAR/f39/AGAAAGAAAX5gAX8AYAABfwKuAxQHb3B0aW9ucwlvblNlY3Rpb24AAwdvcHRpb25zBm9uVHlwZQAAB29wdGlvbnMLb25UeXBlUGFyYW0ABAdvcHRpb25zDG9uVHlwZVJldHVybgAEB29wdGlvbnMIb25JbXBvcnQABQdvcHRpb25zEG9uRnVuY3Rpb25JbXBvcnQAAAdvcHRpb25zDW9uVGFibGVJbXBvcnQABgdvcHRpb25zDm9uTWVtb3J5SW1wb3J0AAcHb3B0aW9ucw5vbkdsb2JhbEltcG9ydAAEB29wdGlvbnMKb25GdW5jdGlvbgAAB29wdGlvbnMHb25UYWJsZQAGB29wdGlvbnMIb25NZW1vcnkABwdvcHRpb25zCG9uR2xvYmFsAAQHb3B0aW9ucwhvbkV4cG9ydAAGB29wdGlvbnMHb25TdGFydAAKB29wdGlvbnMMb25Nb2R1bGVOYW1lAAAHb3B0aW9ucw5vbkZ1bmN0aW9uTmFtZQAEB29wdGlvbnMLb25Mb2NhbE5hbWUABwdvcHRpb25zEm9uU291cmNlTWFwcGluZ1VSTAAAA2VudgZtZW1vcnkCAAADCgkBCwIBCQkIAAgEBAFwAAEGhwEafwFBAAt/AUEAC38BQQELfwFBAgt/AUEDC38BQQQLfwFBBQt/AUEGC38BQQcLfwFBCAt/AUEJC38BQQoLfwFBCwt/AUEAC38BQQELfwFBAgt/AUEDC38BQQsLfwFBIwt/AUHBAAt/AUHCAAt/AUHDAAt/AUHEAAt/AUEAC38BQQELfwFBAgsHGgMGbWVtb3J5AgAFdGFibGUBAAVwYXJzZQAaCQcBAEEACwEbCsoOCRYBAn8jACIAKAIAIQEgAEEEaiQAIAELRAEEfyMAIQACQANAIAAiAUEBaiEAIAIgAS0AACIBQf8AcSADdHIhAiABQYABcUUNASADQQdqIQMMAAALAAsgACQAIAILYAEFfyMAIQIDQCACIgRBAWohAiADIAQtAAAiBUH/AHEgAXRyIQMgAUEHaiEBIAVBgAFxDQALIAIkACADQX8gAXRyIQIgASAASSIEBEAgBUHAAHFBAEchBAsgAiADIAQbCxYBAn8jACIALQAAIQEgAEEBaiQAIAELZgICfwR+IwAhAQNAIAEiAEEBaiEBIAMgADEAACIEQv8AgyAChoQhAyACQgd8IQIgBEKAAYNCAFINAAsgASQAIANCfyAChoQhBSACQsAAVCIABEAgBELAAINCAFIhAAsgBSADIAAbCxgCAX8BfiMAIgApAwAhASAAQQhqJAAgAQtjAQF/AkACQAJAAkACQAJAEBYiACMTRwRAIAAjFEYNASAAIxVGDQIgACMWRg0DIAAjEkYNBAwFC0EgEBUaDAULEBcaDAQLEBMaDAMLEBgaDAILEBQaDAELAAsQFiMRRwRAAAsLiwsBDn8gACQAEBNBgMLN6wZHBEAACxATQQFHBEAACwNAIwAgAUkEQBAUIQMQFCEHQQAhBEEAIQAgAwRAIAMjDEsEQAALBSMAIQUQFCEAIwAhBCMAIABqJAAgByMAIAVrayEHCyADIwAiBSAHIAQgABAAQQFxBEACQAJAAkACQAJAAkACQAJAAkACQAJAIAMjAkcEQCADIwNGDQEgAyMERg0CIAMjBUYNAyADIwZGDQQgAyMHRg0FIAMjCEYNBiADIwlGDQcgAyMBRg0IIAMjCkYNCSADIwtGDQkgAyMMRg0JDAoLEBQhAwJAQQAhAgNAIAIgA08NAUEHEBVB/wBxIQYgAiAGEAEQFCEFAkBBACEIA0AgCCAFTw0BQQcQFUH/AHEhBCACIAggBBACIAhBAWohCAwAAAsACxAUIQgCQEEAIQQDQCAEIAhPDQFBBxAVQf8AcSEAIAIgBCAAEAMgBEEBaiEEDAAACwALIAJBAWohAgwAAAsACwwKCxAUIQMCQEEAIQIDQCACIANPDQEQFCEIIwAhBSMAIAhqJAAQFCEGIwAhBCMAIAZqJAAQFiEAIAIgACAFIAggBCAGEAQCQAJAAkACQAJAIAAiCSMNRwRAIAkjDkYNASAJIw9GDQIgCSMQRg0DDAQLEBQhCSAMIgpBAWohDCAKIAkQBQwEC0EHEBVB/wBxIQkQFCEKEBQhCyAKQQFxBH8QFAVBfwshByAPIgBBAWohDyAAIAkgCyAHIAoQBgwDCxAUIQcQFCELIAdBAXEEfxAUBUH//wMLIQogDiIJQQFqIQ4gCSALIAogBxAHDAILQQcQFUH/AHEhChAUIQsgDSIHQQFqIQ0gByAKIAsQCAwBCwALIAJBAWohAgwAAAsACwwJCxAUIQMCQEEAIQIDQCACIANPDQEQFCEAIAwiBEEBaiEMIAQgABAJIAJBAWohAgwAAAsACwwICxAUIQMCQEEAIQIDQCACIANPDQEQFEH/AHEhABAUIQQQFCEGIARBAXEEfxAUBUF/CyEFIA8iCEEBaiEPIAggACAGIAUgBBAKIAJBAWohAgwAAAsACwwHCxAUIQMCQEEAIQIDQCACIANPDQEQFCEFEBQhBiAFQQFxBH8QFAVB//8DCyEEIA4iAEEBaiEOIAAgBiAEIAUQCyACQQFqIQIMAAALAAsMBgsQFCEDAkBBACECA0AgAiADTw0BQQcQFUH/AHEhBBAUIQYQGSANIgVBAWohDSAFIAQgBhAMIAJBAWohAgwAAAsACwwFCxAUIQMCQEEAIQIDQCACIANPDQEQFCEGIwAhBCMAIAZqJAAQFiEFEBQhACACIAUgACAEIAYQDSACQQFqIQIMAAALAAsMBAsQFBAODAMLIABBBEYiAwRAIAQoAgBB7sK1qwZGIQMLIAMEQBAUIQMQFCECIwAhAAJAAkACQAJAIAMiBSMXRwRAIAUjGEYNASAFIxlGDQIMAwsQFCEFIwAgBRAPDAMLEBQhBAJAQQAhBQNAIAUgBE8NARAUIQYQFCEIIwAhCyMAIAhqJAAgBiALIAgQECAFQQFqIQUMAAALAAsMAgsQFCEEAkBBACEFA0AgBSAETw0BEBQhCxAUIQgCQEEAIQYDQCAGIAhPDQEQFCEKEBQhByMAIQkjACAHaiQAIAsgCiAJIAcQESAGQQFqIQYMAAALAAsgBUEBaiEFDAAACwALDAELAAsgACACaiQADAMFIABBEEYiAARAIAQpAwBC897Vk7es2abhAFEhAAsgAARAIARBCGopAwBC8OCl8/aslanMAFEhAAsgAARAEBQhACMAIQIjACAAaiQAIAIgABASCwsgBSAHaiQADAILIwAgB2okAAwBCwALBSMAIAdqJAALDAELCyMAIAFHBEAACwsDAAELAKMGBG5hbWUBmwYcABphc3NlbWJseS9vcHRpb25zL29uU2VjdGlvbgEXYXNzZW1ibHkvb3B0aW9ucy9vblR5cGUCHGFzc2VtYmx5L29wdGlvbnMvb25UeXBlUGFyYW0DHWFzc2VtYmx5L29wdGlvbnMvb25UeXBlUmV0dXJuBBlhc3NlbWJseS9vcHRpb25zL29uSW1wb3J0BSFhc3NlbWJseS9vcHRpb25zL29uRnVuY3Rpb25JbXBvcnQGHmFzc2VtYmx5L29wdGlvbnMvb25UYWJsZUltcG9ydAcfYXNzZW1ibHkvb3B0aW9ucy9vbk1lbW9yeUltcG9ydAgfYXNzZW1ibHkvb3B0aW9ucy9vbkdsb2JhbEltcG9ydAkbYXNzZW1ibHkvb3B0aW9ucy9vbkZ1bmN0aW9uChhhc3NlbWJseS9vcHRpb25zL29uVGFibGULGWFzc2VtYmx5L29wdGlvbnMvb25NZW1vcnkMGWFzc2VtYmx5L29wdGlvbnMvb25HbG9iYWwNGWFzc2VtYmx5L29wdGlvbnMvb25FeHBvcnQOGGFzc2VtYmx5L29wdGlvbnMvb25TdGFydA8dYXNzZW1ibHkvb3B0aW9ucy9vbk1vZHVsZU5hbWUQH2Fzc2VtYmx5L29wdGlvbnMvb25GdW5jdGlvbk5hbWURHGFzc2VtYmx5L29wdGlvbnMvb25Mb2NhbE5hbWUSI2Fzc2VtYmx5L29wdGlvbnMvb25Tb3VyY2VNYXBwaW5nVVJMExxhc3NlbWJseS9pbmRleC9yZWFkVWludDx1MzI+FBphc3NlbWJseS9pbmRleC9yZWFkVmFydWludBUZYXNzZW1ibHkvaW5kZXgvcmVhZFZhcmludBYbYXNzZW1ibHkvaW5kZXgvcmVhZFVpbnQ8dTg+Fxthc3NlbWJseS9pbmRleC9yZWFkVmFyaW50NjQYGWFzc2VtYmx5L2luZGV4L3JlYWRVaW50NjQZG2Fzc2VtYmx5L2luZGV4L3NraXBJbml0RXhwchoUYXNzZW1ibHkvaW5kZXgvcGFyc2UbBG51bGwAIBBzb3VyY2VNYXBwaW5nVVJMDmluZGV4Lndhc20ubWFw")));var B=Q.length,t=(B+65535&-65536)>>16,E=new WebAssembly.Memory({initial:t}),o=new Uint8Array(E.buffer);o.set(Q),A.readString=function(A,Q){return function(A,Q,n){if(n-Q<1)return"";for(var B=null,e=[],I=0,t=0;Q191&&t<224?e[I++]=(31&t)<<6|63&A[Q++]:t>239&&t<365?(t=((7&t)<<18|(63&A[Q++])<<12|(63&A[Q++])<<6|63&A[Q++])-65536,e[I++]=55296+(t>>10),e[I++]=56320+(1023&t)):e[I++]=(15&t)<<12|(63&A[Q++])<<6|63&A[Q++],I>8191&&((B||(B=[])).push(String.fromCharCode.apply(String,e)),I=0);return B?(I&&B.push(String.fromCharCode.apply(String,e.slice(0,I))),B.join("")):String.fromCharCode.apply(String,e.slice(0,I))}(o,A,A+Q)},A.readUint32=function(A){return o[A]};var C={env:{memory:E},options:{}};["onSection","onType","onTypeParam","onTypeReturn","onImport","onFunctionImport","onTableImport","onMemoryImport","onGlobalImport","onMemory","onFunction","onTable","onGlobal","onExport","onStart","onSourceMappingURL","onModuleName","onFunctionName","onLocalName"].forEach(function(A){return C.options[A]=n[A]||function(){}}),new WebAssembly.Instance(e,C).exports.parse(0,B)};for(var I=new Array(123),t=0;t<64;)I[t<26?t+65:t<52?t+71:t<62?t-4:t-59|43]=t++},function(A,Q,n){"use strict";Q.__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"}(Q.Type||(Q.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"}(Q.SectionId||(Q.SectionId={})),function(A){A[A.Function=0]="Function",A[A.Table=1]="Table",A[A.Memory=2]="Memory",A[A.Global=3]="Global"}(Q.ExternalKind||(Q.ExternalKind={})),function(A){A[A.Module=0]="Module",A[A.Function=1]="Function",A[A.Local=2]="Local"}(Q.NameType||(Q.NameType={})),Q.MAX_PAGES=65535,Q.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"}(Q.Opcode||(Q.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 1884afb2f9..e04a7bcdf5 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":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,UAAAH,GACA,iBAAAC,QACAA,QAAA,QAAAD,IAEAD,EAAA,QAAAC,IARA,CASC,oBAAAK,UAAAC,KAAA,WACD,mBCTA,IAAAC,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAR,QAGA,IAAAC,EAAAK,EAAAE,IACAC,EAAAD,EACAE,GAAA,EACAV,YAUA,OANAW,EAAAH,GAAAI,KAAAX,EAAAD,QAAAC,IAAAD,QAAAO,GAGAN,EAAAS,GAAA,EAGAT,EAAAD,QA0DA,OArDAO,EAAAM,EAAAF,EAGAJ,EAAAO,EAAAR,EAGAC,EAAAQ,EAAA,SAAAf,EAAAgB,EAAAC,GACAV,EAAAW,EAAAlB,EAAAgB,IACAG,OAAAC,eAAApB,EAAAgB,GAA0CK,YAAA,EAAAC,IAAAL,KAK1CV,EAAAgB,EAAA,SAAAvB,GACA,oBAAAwB,eAAAC,aACAN,OAAAC,eAAApB,EAAAwB,OAAAC,aAAwDC,MAAA,WAExDP,OAAAC,eAAApB,EAAA,cAAiD0B,OAAA,KAQjDnB,EAAAoB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAAnB,EAAAmB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFAxB,EAAAgB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC,EAAAE,GAAA,iBAAAF,EAAA,QAAAM,KAAAN,EAAAnB,EAAAQ,EAAAe,EAAAE,EAAA,SAAAA,GAAgH,OAAAN,EAAAM,IAAqBC,KAAA,KAAAD,IACrI,OAAAF,GAIAvB,EAAA2B,EAAA,SAAAjC,GACA,IAAAgB,EAAAhB,KAAA4B,WACA,WAA2B,OAAA5B,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAM,EAAAQ,EAAAE,EAAA,IAAAA,GACAA,GAIAV,EAAAW,EAAA,SAAAiB,EAAAC,GAAsD,OAAAjB,OAAAkB,UAAAC,eAAA1B,KAAAuB,EAAAC,IAGtD7B,EAAAgC,EAAA,GAIAhC,IAAAiC,EAAA,kECjFAxC,EAAA6B,YAAA,EACA,IAAAY,EAAelC,EAAQ,GACvBP,EAAA0C,KAAAD,EAAAC,KACA1C,EAAA2C,UAAAF,EAAAE,UACA3C,EAAA4C,aAAAH,EAAAG,aAEA,IAAAC,EAAA,KAgDA7C,EAAA8C,MA5CA,SAAAA,EAAAC,EAAAC,GACAA,IACAA,MAEAH,IACAA,EAAA,IAAAI,YAAAC,OA4EA,SAAAC,GACA,IAAAC,EAAAD,EAAAC,OACA,GAAAA,EAAA,CAEA,IADA,IAAAlB,EAAA,EAAAK,EAAAa,IACAb,EAAA,UAAAY,EAAAE,WAAAd,MACAL,EACAkB,EAAAE,KAAAC,KAAA,EAAAH,GAAA,EAAAlB,EAIA,IAFA,IAAAsB,EAAA,IAAAC,WAAAL,GACAM,EAAA,EAAAxC,EAAA,EAAAS,EAAA,EACAlB,EAAA,EAAAkD,EAAAR,EAAAC,OAAsC3C,EAAAkD,GAAO,CAC7C,IAAA7C,EAAAqC,EAAAE,WAAA5C,KACA,QAAAK,GAAA4C,EAAA,EACA,MACA,QAAAE,KAAA9C,EAAA+C,EAAA/C,IACA,MAAAgD,QACA,OAAAJ,GACA,OACA/B,EAAAb,EACA4C,EAAA,EACA,MAEA,OACAF,EAAAtC,KAAAS,GAAA,MAAAb,IAAA,EACAa,EAAAb,EACA4C,EAAA,EACA,MAEA,OACAF,EAAAtC,MAAA,GAAAS,IAAA,MAAAb,IAAA,EACAa,EAAAb,EACA4C,EAAA,EACA,MAEA,OACAF,EAAAtC,MAAA,EAAAS,IAAA,EAAAb,EACA4C,EAAA,GAKA,OAAAA,EACA,MAAAI,QACA,OAAAN,EAvHAO,CAAwD,04GAExD,IAAAC,EAAAjB,EAAAK,OACAa,GAAAD,EAAA,kBACAE,EAAA,IAAAjB,YAAAkB,QAAyCC,QAAAH,IACzCT,EAAA,IAAAC,WAAAS,EAAAV,QACAA,EAAAa,IAAAtB,GAEAD,EAAAwB,WAAA,SAAAC,EAAAnB,GAAkD,OAiClD,SAAAI,EAAAgB,EAAAC,GAEA,GADAA,EAAAD,EACA,EACA,SAGA,IAFA,IAAAE,EAAA,KAAAC,KAAAlE,EAAA,EACAkB,EAAA,EACA6C,EAAAC,IACA9C,EAAA6B,EAAAgB,MACA,IACAG,EAAAlE,KAAAkB,EAEAA,EAAA,KAAAA,EAAA,IACAgD,EAAAlE,MAAA,GAAAkB,IAAA,KAAA6B,EAAAgB,KAEA7C,EAAA,KAAAA,EAAA,KACAA,IAAA,EAAAA,IAAA,OAAA6B,EAAAgB,OAAA,OAAAhB,EAAAgB,OAAA,KAAAhB,EAAAgB,MAAA,MACAG,EAAAlE,KAAA,OAAAkB,GAAA,IACAgD,EAAAlE,KAAA,YAAAkB,IAGAgD,EAAAlE,MAAA,GAAAkB,IAAA,OAAA6B,EAAAgB,OAAA,KAAAhB,EAAAgB,KAEA/D,EAAA,QACAiE,WAAAE,KAAAC,OAAAC,aAAAC,MAAAF,OAAAF,IACAlE,EAAA,GAGA,OAAAiE,GACAjE,GACAiE,EAAAE,KAAAC,OAAAC,aAAAC,MAAAF,OAAAF,EAAAK,MAAA,EAAAvE,KACAiE,EAAAO,KAAA,KAEAJ,OAAAC,aAAAC,MAAAF,OAAAF,EAAAK,MAAA,EAAAvE,IAjEkDyE,CAAA1B,EAAAe,IAAAnB,IAElD,IAAA+B,GACAC,KACAlB,UAEAlB,aAEA,YACA,SACA,cACA,eACA,WACA,mBACA,gBACA,iBACA,iBACA,WACA,aACA,UACA,WACA,WACA,UACA,qBACA,eACA,iBACA,eACAqC,QAAA,SAAArE,GAA+B,OAAAmE,EAAAnC,QAAAhC,GAAAgC,EAAAhC,IAAA,eAC/B,IAAAiC,YAAAqC,SAAAzC,EAAAsC,GACAnF,QAAA8C,MAAA,EAAAkB,IAqFA,IADA,IAAAH,EAAA,IAAA0B,MAAA,KACA9E,EAAA,EAAeA,EAAA,IACfoD,EAAApD,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,EAAAA,EAAA,OAAAA,kCCzIAT,EAAA6B,YAAA,EAGA,SAAAa,GACAA,IAAA,eACAA,IAAA,eACAA,IAAA,eACAA,IAAA,eACAA,IAAA,uBACAA,IAAA,gBACAA,IAAA,gBAPA,CAQC1C,EAAA0C,OAAA1C,EAAA0C,UAGD,SAAAC,GACAA,IAAA,mBACAA,IAAA,eACAA,IAAA,mBACAA,IAAA,uBACAA,IAAA,iBACAA,IAAA,mBACAA,IAAA,mBACAA,IAAA,mBACAA,IAAA,iBACAA,IAAA,qBACAA,IAAA,gBACAA,IAAA,gBAZA,CAaC3C,EAAA2C,YAAA3C,EAAA2C,eAGD,SAAAC,GACAA,IAAA,uBACAA,IAAA,iBACAA,IAAA,mBACAA,IAAA,mBAJA,CAKC5C,EAAA4C,eAAA5C,EAAA4C,kBAGD,SAAA4C,GACAA,IAAA,mBACAA,IAAA,uBACAA,IAAA,iBAHA,CAICxF,EAAAwF,WAAAxF,EAAAwF,cAEDxF,EAAAyF,UAAA,MAEAzF,EAAA0F,UAAA,WAGA,SAAAC,GAOAA,IAAA,cAYAA,IAAA,4BA2BAA,IAAA,0BACAA,IAAA,0BACAA,IAAA,0BACAA,IAAA,0BAjDA,CA6KC3F,EAAA2F,SAAA3F,EAAA2F","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","readUint32","index","imports","env","forEach","Instance","Array","NameType","MAX_PAGES","MAX_ELEMS","Opcode"],"mappings":"CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,UAAAH,GACA,iBAAAC,QACAA,QAAA,QAAAD,IAEAD,EAAA,QAAAC,IARA,CASC,oBAAAK,UAAAC,KAAA,WACD,mBCTA,IAAAC,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAR,QAGA,IAAAC,EAAAK,EAAAE,IACAC,EAAAD,EACAE,GAAA,EACAV,YAUA,OANAW,EAAAH,GAAAI,KAAAX,EAAAD,QAAAC,IAAAD,QAAAO,GAGAN,EAAAS,GAAA,EAGAT,EAAAD,QA0DA,OArDAO,EAAAM,EAAAF,EAGAJ,EAAAO,EAAAR,EAGAC,EAAAQ,EAAA,SAAAf,EAAAgB,EAAAC,GACAV,EAAAW,EAAAlB,EAAAgB,IACAG,OAAAC,eAAApB,EAAAgB,GAA0CK,YAAA,EAAAC,IAAAL,KAK1CV,EAAAgB,EAAA,SAAAvB,GACA,oBAAAwB,eAAAC,aACAN,OAAAC,eAAApB,EAAAwB,OAAAC,aAAwDC,MAAA,WAExDP,OAAAC,eAAApB,EAAA,cAAiD0B,OAAA,KAQjDnB,EAAAoB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAAnB,EAAAmB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFAxB,EAAAgB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC,EAAAE,GAAA,iBAAAF,EAAA,QAAAM,KAAAN,EAAAnB,EAAAQ,EAAAe,EAAAE,EAAA,SAAAA,GAAgH,OAAAN,EAAAM,IAAqBC,KAAA,KAAAD,IACrI,OAAAF,GAIAvB,EAAA2B,EAAA,SAAAjC,GACA,IAAAgB,EAAAhB,KAAA4B,WACA,WAA2B,OAAA5B,EAAA,SAC3B,WAAiC,OAAAA,GAEjC,OADAM,EAAAQ,EAAAE,EAAA,IAAAA,GACAA,GAIAV,EAAAW,EAAA,SAAAiB,EAAAC,GAAsD,OAAAjB,OAAAkB,UAAAC,eAAA1B,KAAAuB,EAAAC,IAGtD7B,EAAAgC,EAAA,GAIAhC,IAAAiC,EAAA,kECjFAxC,EAAA6B,YAAA,EACA,IAAAY,EAAelC,EAAQ,GACvBP,EAAA0C,KAAAD,EAAAC,KACA1C,EAAA2C,UAAAF,EAAAE,UACA3C,EAAA4C,aAAAH,EAAAG,aAEA,IAAAC,EAAA,KAmDA7C,EAAA8C,MA/CA,SAAAA,EAAAC,EAAAC,GACAA,IACAA,MAEAH,IACAA,EAAA,IAAAI,YAAAC,OA+EA,SAAAC,GACA,IAAAC,EAAAD,EAAAC,OACA,GAAAA,EAAA,CAEA,IADA,IAAAlB,EAAA,EAAAK,EAAAa,IACAb,EAAA,UAAAY,EAAAE,WAAAd,MACAL,EACAkB,EAAAE,KAAAC,KAAA,EAAAH,GAAA,EAAAlB,EAIA,IAFA,IAAAsB,EAAA,IAAAC,WAAAL,GACAM,EAAA,EAAAxC,EAAA,EAAAS,EAAA,EACAlB,EAAA,EAAAkD,EAAAR,EAAAC,OAAsC3C,EAAAkD,GAAO,CAC7C,IAAA7C,EAAAqC,EAAAE,WAAA5C,KACA,QAAAK,GAAA4C,EAAA,EACA,MACA,QAAAE,KAAA9C,EAAA+C,EAAA/C,IACA,MAAAgD,QACA,OAAAJ,GACA,OACA/B,EAAAb,EACA4C,EAAA,EACA,MAEA,OACAF,EAAAtC,KAAAS,GAAA,MAAAb,IAAA,EACAa,EAAAb,EACA4C,EAAA,EACA,MAEA,OACAF,EAAAtC,MAAA,GAAAS,IAAA,MAAAb,IAAA,EACAa,EAAAb,EACA4C,EAAA,EACA,MAEA,OACAF,EAAAtC,MAAA,EAAAS,IAAA,EAAAb,EACA4C,EAAA,GAKA,OAAAA,EACA,MAAAI,QACA,OAAAN,EA1HAO,CAAwD,88IAExD,IAAAC,EAAAjB,EAAAK,OACAa,GAAAD,EAAA,kBACAE,EAAA,IAAAjB,YAAAkB,QAAyCC,QAAAH,IACzCT,EAAA,IAAAC,WAAAS,EAAAV,QACAA,EAAAa,IAAAtB,GAEAD,EAAAwB,WAAA,SAAAC,EAAAnB,GAAkD,OAoClD,SAAAI,EAAAgB,EAAAC,GAEA,GADAA,EAAAD,EACA,EACA,SAGA,IAFA,IAAAE,EAAA,KAAAC,KAAAlE,EAAA,EACAkB,EAAA,EACA6C,EAAAC,IACA9C,EAAA6B,EAAAgB,MACA,IACAG,EAAAlE,KAAAkB,EAEAA,EAAA,KAAAA,EAAA,IACAgD,EAAAlE,MAAA,GAAAkB,IAAA,KAAA6B,EAAAgB,KAEA7C,EAAA,KAAAA,EAAA,KACAA,IAAA,EAAAA,IAAA,OAAA6B,EAAAgB,OAAA,OAAAhB,EAAAgB,OAAA,KAAAhB,EAAAgB,MAAA,MACAG,EAAAlE,KAAA,OAAAkB,GAAA,IACAgD,EAAAlE,KAAA,YAAAkB,IAGAgD,EAAAlE,MAAA,GAAAkB,IAAA,OAAA6B,EAAAgB,OAAA,KAAAhB,EAAAgB,KAEA/D,EAAA,QACAiE,WAAAE,KAAAC,OAAAC,aAAAC,MAAAF,OAAAF,IACAlE,EAAA,GAGA,OAAAiE,GACAjE,GACAiE,EAAAE,KAAAC,OAAAC,aAAAC,MAAAF,OAAAF,EAAAK,MAAA,EAAAvE,KACAiE,EAAAO,KAAA,KAEAJ,OAAAC,aAAAC,MAAAF,OAAAF,EAAAK,MAAA,EAAAvE,IApEkDyE,CAAA1B,EAAAe,IAAAnB,IAClDN,EAAAqC,WAAA,SAAAC,GACA,OAAA5B,EAAA4B,IAGA,IAAAC,GACAC,KACApB,UAEAlB,aAEA,YACA,SACA,cACA,eACA,WACA,mBACA,gBACA,iBACA,iBACA,WACA,aACA,UACA,WACA,WACA,UACA,qBACA,eACA,iBACA,eACAuC,QAAA,SAAAvE,GAA+B,OAAAqE,EAAArC,QAAAhC,GAAAgC,EAAAhC,IAAA,eAC/B,IAAAiC,YAAAuC,SAAA3C,EAAAwC,GACArF,QAAA8C,MAAA,EAAAkB,IAqFA,IADA,IAAAH,EAAA,IAAA4B,MAAA,KACAhF,EAAA,EAAeA,EAAA,IACfoD,EAAApD,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,GAAAA,EAAA,EAAAA,EAAA,OAAAA,kCC5IAT,EAAA6B,YAAA,EAGA,SAAAa,GACAA,IAAA,eACAA,IAAA,eACAA,IAAA,eACAA,IAAA,eACAA,IAAA,uBACAA,IAAA,gBACAA,IAAA,gBAPA,CAQC1C,EAAA0C,OAAA1C,EAAA0C,UAGD,SAAAC,GACAA,IAAA,mBACAA,IAAA,eACAA,IAAA,mBACAA,IAAA,uBACAA,IAAA,iBACAA,IAAA,mBACAA,IAAA,mBACAA,IAAA,mBACAA,IAAA,iBACAA,IAAA,qBACAA,IAAA,gBACAA,IAAA,gBAZA,CAaC3C,EAAA2C,YAAA3C,EAAA2C,eAGD,SAAAC,GACAA,IAAA,uBACAA,IAAA,iBACAA,IAAA,mBACAA,IAAA,mBAJA,CAKC5C,EAAA4C,eAAA5C,EAAA4C,kBAGD,SAAA8C,GACAA,IAAA,mBACAA,IAAA,uBACAA,IAAA,iBAHA,CAIC1F,EAAA0F,WAAA1F,EAAA0F,cAED1F,EAAA2F,UAAA,MAEA3F,EAAA4F,UAAA,WAGA,SAAAC,GAOAA,IAAA,cAYAA,IAAA,4BA2BAA,IAAA,0BACAA,IAAA,0BACAA,IAAA,0BACAA,IAAA,0BAjDA,CA6KC7F,EAAA6F,SAAA7F,EAAA6F","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\";\nexports.__esModule = true;\nvar common_1 = require(\"./common\");\nexports.Type = common_1.Type;\nexports.SectionId = common_1.SectionId;\nexports.ExternalKind = common_1.ExternalKind;\n/** Cached compiled parser. */\nvar compiled = null;\nif (typeof WASM_DATA !== \"string\")\n WASM_DATA = require(\"fs\").readFileSync(__dirname + \"/../build/index.wasm\", \"base64\");\n/** Parses the contents of a WebAssembly binary according to the specified options. */\nfunction parse(binary, options) {\n if (!options)\n options = {};\n // compile the parser if not yet compiled\n if (!compiled)\n compiled = new WebAssembly.Module(base64_decode(WASM_DATA));\n // use the binary as the parser's memory\n var nBytes = binary.length;\n var nPages = ((nBytes + 0xffff) & ~0xffff) >> 16;\n var memory = new WebAssembly.Memory({ initial: nPages });\n var buffer = new Uint8Array(memory.buffer);\n buffer.set(binary);\n // provide a way to read strings from memory\n parse.readString = function (offset, length) { return utf8_read(buffer, offset, offset + length); };\n parse.readUint32 = function (index) {\n return buffer[index];\n };\n // instantiate the parser and return its exports\n var imports = {\n env: {\n memory: memory\n },\n options: {}\n };\n [\"onSection\",\n \"onType\",\n \"onTypeParam\",\n \"onTypeReturn\",\n \"onImport\",\n \"onFunctionImport\",\n \"onTableImport\",\n \"onMemoryImport\",\n \"onGlobalImport\",\n \"onMemory\",\n \"onFunction\",\n \"onTable\",\n \"onGlobal\",\n \"onExport\",\n \"onStart\",\n \"onSourceMappingURL\",\n \"onModuleName\",\n \"onFunctionName\",\n \"onLocalName\"\n ].forEach(function (name) { return imports.options[name] = options[name] || function () { }; });\n var instance = new WebAssembly.Instance(compiled, imports);\n instance.exports.parse(0, nBytes);\n}\nexports.parse = parse;\n// see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/utf8\nfunction utf8_read(buffer, start, end) {\n var len = end - start;\n if (len < 1)\n return \"\";\n var parts = null, chunk = [], i = 0, // char offset\n t = 0; // temporary\n while (start < end) {\n t = buffer[start++];\n if (t < 128) {\n chunk[i++] = t;\n }\n else if (t > 191 && t < 224) {\n chunk[i++] = (t & 31) << 6 | buffer[start++] & 63;\n }\n else if (t > 239 && t < 365) {\n t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000;\n chunk[i++] = 0xD800 + (t >> 10);\n chunk[i++] = 0xDC00 + (t & 1023);\n }\n else {\n chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;\n }\n if (i > 8191) {\n (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));\n i = 0;\n }\n }\n if (parts) {\n if (i)\n parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));\n return parts.join(\"\");\n }\n return String.fromCharCode.apply(String, chunk.slice(0, i));\n}\n// see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/base64\nfunction base64_decode(string) {\n var length = string.length;\n if (length) {\n var n = 0, p = length;\n while (--p % 4 > 1 && string.charCodeAt(p) === 61)\n ++n;\n length = Math.ceil(length * 3) / 4 - n;\n }\n var buffer = new Uint8Array(length);\n var j = 0, o = 0, t = 0;\n for (var i = 0, k = string.length; i < k;) {\n var c = string.charCodeAt(i++);\n if (c === 61 && j > 1)\n break;\n if ((c = s64[c]) === undefined)\n throw Error();\n switch (j) {\n case 0: {\n t = c;\n j = 1;\n break;\n }\n case 1: {\n buffer[o++] = t << 2 | (c & 48) >> 4;\n t = c;\n j = 2;\n break;\n }\n case 2: {\n buffer[o++] = (t & 15) << 4 | (c & 60) >> 2;\n t = c;\n j = 3;\n break;\n }\n case 3: {\n buffer[o++] = (t & 3) << 6 | c;\n j = 0;\n break;\n }\n }\n }\n if (j === 1)\n throw Error();\n return buffer;\n}\nvar s64 = new Array(123);\nfor (var i = 0; i < 64;)\n s64[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;\n","\"use strict\";\n/** Common constants shared between AssemblyScript and TypeScript. */\nexports.__esModule = true;\n/** WebAssembly types. */\nvar Type;\n(function (Type) {\n Type[Type[\"i32\"] = 127] = \"i32\";\n Type[Type[\"i64\"] = 126] = \"i64\";\n Type[Type[\"f32\"] = 125] = \"f32\";\n Type[Type[\"f64\"] = 124] = \"f64\";\n Type[Type[\"anyfunc\"] = 112] = \"anyfunc\";\n Type[Type[\"func\"] = 96] = \"func\";\n Type[Type[\"none\"] = 64] = \"none\";\n})(Type = exports.Type || (exports.Type = {}));\n/** WebAssembly section ids. */\nvar SectionId;\n(function (SectionId) {\n SectionId[SectionId[\"Custom\"] = 0] = \"Custom\";\n SectionId[SectionId[\"Type\"] = 1] = \"Type\";\n SectionId[SectionId[\"Import\"] = 2] = \"Import\";\n SectionId[SectionId[\"Function\"] = 3] = \"Function\";\n SectionId[SectionId[\"Table\"] = 4] = \"Table\";\n SectionId[SectionId[\"Memory\"] = 5] = \"Memory\";\n SectionId[SectionId[\"Global\"] = 6] = \"Global\";\n SectionId[SectionId[\"Export\"] = 7] = \"Export\";\n SectionId[SectionId[\"Start\"] = 8] = \"Start\";\n SectionId[SectionId[\"Element\"] = 9] = \"Element\";\n SectionId[SectionId[\"Code\"] = 10] = \"Code\";\n SectionId[SectionId[\"Data\"] = 11] = \"Data\";\n})(SectionId = exports.SectionId || (exports.SectionId = {}));\n/** WebAssembly external kinds. */\nvar ExternalKind;\n(function (ExternalKind) {\n ExternalKind[ExternalKind[\"Function\"] = 0] = \"Function\";\n ExternalKind[ExternalKind[\"Table\"] = 1] = \"Table\";\n ExternalKind[ExternalKind[\"Memory\"] = 2] = \"Memory\";\n ExternalKind[ExternalKind[\"Global\"] = 3] = \"Global\";\n})(ExternalKind = exports.ExternalKind || (exports.ExternalKind = {}));\n/** Name section types. */\nvar NameType;\n(function (NameType) {\n NameType[NameType[\"Module\"] = 0] = \"Module\";\n NameType[NameType[\"Function\"] = 1] = \"Function\";\n NameType[NameType[\"Local\"] = 2] = \"Local\";\n})(NameType = exports.NameType || (exports.NameType = {}));\n/** Maximum number of memory pages. */\nexports.MAX_PAGES = 0xffff;\n/** Maximum number of table elements. */\nexports.MAX_ELEMS = 0xffffffff;\n/** WebAssembly opcodes. */\nvar Opcode;\n(function (Opcode) {\n // unreachable = 0x00,\n // nop = 0x01,\n // block = 0x02,\n // loop = 0x03,\n // if_ = 0x04,\n // else_ = 0x05,\n Opcode[Opcode[\"end\"] = 11] = \"end\";\n // br = 0x0c,\n // br_if = 0x0d,\n // br_table = 0x0e,\n // return_ = 0x0f,\n // call = 0x10,\n // call_indirect = 0x11,\n // drop = 0x1a,\n // select = 0x1b,\n // get_local = 0x20,\n // set_local = 0x21,\n // tee_local = 0x22,\n Opcode[Opcode[\"get_global\"] = 35] = \"get_global\";\n // set_global = 0x24,\n // i32_load = 0x28,\n // i64_load = 0x29,\n // f32_load = 0x2a,\n // f64_load = 0x2b,\n // i32_load8_s = 0x2c,\n // i32_load8_u = 0x2d,\n // i32_load16_s = 0x2e,\n // i32_load16_u = 0x2f,\n // i64_load8_s = 0x30,\n // i64_load8_u = 0x31,\n // i64_load16_s = 0x32,\n // i64_load16_u = 0x33,\n // i64_load32_s = 0x34,\n // i64_load32_u = 0x35,\n // i32_store = 0x36,\n // i64_store = 0x37,\n // f32_store = 0x38,\n // f64_store = 0x39,\n // i32_store8 = 0x3a,\n // i32_store16 = 0x3b,\n // i64_store8 = 0x3c,\n // i64_store16 = 0x3d,\n // i64_store32 = 0x3e,\n // current_memory = 0x3f,\n // grow_memory = 0x40,\n Opcode[Opcode[\"i32_const\"] = 65] = \"i32_const\";\n Opcode[Opcode[\"i64_const\"] = 66] = \"i64_const\";\n Opcode[Opcode[\"f32_const\"] = 67] = \"f32_const\";\n Opcode[Opcode[\"f64_const\"] = 68] = \"f64_const\";\n // i32_eqz = 0x45,\n // i32_eq = 0x46,\n // i32_ne = 0x47,\n // i32_lt_s = 0x48,\n // i32_lt_u = 0x49,\n // i32_gt_s = 0x4a,\n // i32_gt_u = 0x4b,\n // i32_le_s = 0x4c,\n // i32_le_u = 0x4d,\n // i32_ge_s = 0x4e,\n // i32_ge_u = 0x4f,\n // i64_eqz = 0x50,\n // i64_eq = 0x51,\n // i64_ne = 0x52,\n // i64_lt_s = 0x53,\n // i64_lt_u = 0x54,\n // i64_gt_s = 0x55,\n // i64_gt_u = 0x56,\n // i64_le_s = 0x57,\n // i64_le_u = 0x58,\n // i64_ge_s = 0x59,\n // i64_ge_u = 0x5a,\n // f32_eq = 0x5b,\n // f32_ne = 0x5c,\n // f32_lt = 0x5d,\n // f32_gt = 0x5e,\n // f32_le = 0x5f,\n // f32_ge = 0x60,\n // f64_eq = 0x61,\n // f64_ne = 0x62,\n // f64_lt = 0x63,\n // f64_gt = 0x64,\n // f64_le = 0x65,\n // f64_ge = 0x66,\n // i32_clz = 0x67,\n // i32_ctz = 0x68,\n // i32_popcnt = 0x69,\n // i32_add = 0x6a,\n // i32_sub = 0x6b,\n // i32_mul = 0x6c,\n // i32_div_s = 0x6d,\n // i32_div_u = 0x6e,\n // i32_rem_s = 0x6f,\n // i32_rem_u = 0x70,\n // i32_and = 0x71,\n // i32_or = 0x72,\n // i32_xor = 0x73,\n // i32_shl = 0x74,\n // i32_shr_s = 0x75,\n // i32_shr_u = 0x76,\n // i32_rotl = 0x77,\n // i32_rotr = 0x78,\n // i64_clz = 0x79,\n // i64_ctz = 0x7a,\n // i64_popcnt = 0x7b,\n // i64_add = 0x7c,\n // i64_sub = 0x7d,\n // i64_mul = 0x7e,\n // i64_div_s = 0x7f,\n // i64_div_u = 0x80,\n // i64_rem_s = 0x81,\n // i64_rem_u = 0x82,\n // i64_and = 0x83,\n // i64_or = 0x84,\n // i64_xor = 0x85,\n // i64_shl = 0x86,\n // i64_shr_s = 0x87,\n // i64_shr_u = 0x88,\n // i64_rotl = 0x89,\n // i64_rotr = 0x8a,\n // f32_abs = 0x8b,\n // f32_neg = 0x8c,\n // f32_ceil = 0x8d,\n // f32_floor = 0x8e,\n // f32_trunc = 0x8f,\n // f32_nearest = 0x90,\n // f32_sqrt = 0x91,\n // f32_add = 0x92,\n // f32_sub = 0x93,\n // f32_mul = 0x94,\n // f32_div = 0x95,\n // f32_min = 0x96,\n // f32_max = 0x97,\n // f32_copysign = 0x98,\n // f64_abs = 0x99,\n // f64_neg = 0x9a,\n // f64_ceil = 0x9b,\n // f64_floor = 0x9c,\n // f64_trunc = 0x9d,\n // f64_nearest = 0x9e,\n // f64_sqrt = 0x9f,\n // f64_add = 0xa0,\n // f64_sub = 0xa1,\n // f64_mul = 0xa2,\n // f64_div = 0xa3,\n // f64_min = 0xa4,\n // f64_max = 0xa5,\n // f64_copysign = 0xa6,\n // i32_wrap_i64 = 0xa7,\n // i32_trunc_s_f32 = 0xa8,\n // i32_trunc_u_f32 = 0xa9,\n // i32_trunc_s_f64 = 0xaa,\n // i32_trunc_u_f64 = 0xab,\n // i64_extend_s_i32 = 0xac,\n // i64_extend_u_i32 = 0xad,\n // i64_trunc_s_f32 = 0xae,\n // i64_trunc_u_f32 = 0xaf,\n // i64_trunc_s_f64 = 0xb0,\n // i64_trunc_u_f64 = 0xb1,\n // f32_convert_s_i32 = 0xb2,\n // f32_convert_u_i32 = 0xb3,\n // f32_convert_s_i64 = 0xb4,\n // f32_convert_u_i64 = 0xb5,\n // f32_demote_f64 = 0xb6,\n // f64_convert_s_i32 = 0xb7,\n // f64_convert_u_i32 = 0xb8,\n // f64_convert_s_i64 = 0xb9,\n // f64_convert_u_i64 = 0xba,\n // f64_promote_f32 = 0xbb,\n // i32_reinterpret_f32 = 0xbc,\n // i64_reinterpret_f64 = 0xbd,\n // f32_reinterpret_i32 = 0xbe,\n // f64_reinterpret_i64 = 0xbf\n})(Opcode = exports.Opcode || (exports.Opcode = {}));\n"],"sourceRoot":""} \ No newline at end of file diff --git a/lib/parse/package.json b/lib/parse/package.json index 23d02b8e43..a08657e4d4 100644 --- a/lib/parse/package.json +++ b/lib/parse/package.json @@ -6,6 +6,7 @@ "types": "index.d.ts", "scripts": { "asbuild": "asc assembly/index.ts -O3 -b build/index.wasm -t build/index.wat --importMemory --sourceMap --validate", + "asbuild:untouched": "asc assembly/index.ts -b build/index.wasm -t build/index.wat --importMemory --sourceMap --validate", "build": "npm run asbuild && webpack --mode production --display-modules", "test": "ts-node tests/" }, diff --git a/lib/parse/src/common.ts b/lib/parse/src/common.ts index e45100db5f..92794f2580 100644 --- a/lib/parse/src/common.ts +++ b/lib/parse/src/common.ts @@ -50,176 +50,179 @@ export const MAX_ELEMS = 0xffffffff; /** WebAssembly opcodes. */ export enum Opcode { // just a few of these are actually used - // unreachable = 0x00, - // nop = 0x01, - // block = 0x02, - // loop = 0x03, - // if_ = 0x04, - // else_ = 0x05, + unreachable = 0x00, + nop = 0x01, + block = 0x02, + loop = 0x03, + if_ = 0x04, + else_ = 0x05, end = 0x0b, - // br = 0x0c, - // br_if = 0x0d, - // br_table = 0x0e, - // return_ = 0x0f, - // call = 0x10, - // call_indirect = 0x11, - // drop = 0x1a, - // select = 0x1b, - // get_local = 0x20, - // set_local = 0x21, - // tee_local = 0x22, + br = 0x0c, + br_if = 0x0d, + br_table = 0x0e, + return_ = 0x0f, + call = 0x10, + call_indirect = 0x11, + drop = 0x1a, + select = 0x1b, + get_local = 0x20, + set_local = 0x21, + tee_local = 0x22, get_global = 0x23, - // set_global = 0x24, - // i32_load = 0x28, - // i64_load = 0x29, - // f32_load = 0x2a, - // f64_load = 0x2b, - // i32_load8_s = 0x2c, - // i32_load8_u = 0x2d, - // i32_load16_s = 0x2e, - // i32_load16_u = 0x2f, - // i64_load8_s = 0x30, - // i64_load8_u = 0x31, - // i64_load16_s = 0x32, - // i64_load16_u = 0x33, - // i64_load32_s = 0x34, - // i64_load32_u = 0x35, - // i32_store = 0x36, - // i64_store = 0x37, - // f32_store = 0x38, - // f64_store = 0x39, - // i32_store8 = 0x3a, - // i32_store16 = 0x3b, - // i64_store8 = 0x3c, - // i64_store16 = 0x3d, - // i64_store32 = 0x3e, - // current_memory = 0x3f, - // grow_memory = 0x40, + set_global = 0x24, + i32_load = 0x28, + i64_load = 0x29, + f32_load = 0x2a, + f64_load = 0x2b, + i32_load8_s = 0x2c, + i32_load8_u = 0x2d, + i32_load16_s = 0x2e, + i32_load16_u = 0x2f, + i64_load8_s = 0x30, + i64_load8_u = 0x31, + i64_load16_s = 0x32, + i64_load16_u = 0x33, + i64_load32_s = 0x34, + i64_load32_u = 0x35, + i32_store = 0x36, + i64_store = 0x37, + f32_store = 0x38, + f64_store = 0x39, + i32_store8 = 0x3a, + i32_store16 = 0x3b, + i64_store8 = 0x3c, + i64_store16 = 0x3d, + i64_store32 = 0x3e, + current_memory = 0x3f, + grow_memory = 0x40, i32_const = 0x41, i64_const = 0x42, f32_const = 0x43, - f64_const = 0x44 - // i32_eqz = 0x45, - // i32_eq = 0x46, - // i32_ne = 0x47, - // i32_lt_s = 0x48, - // i32_lt_u = 0x49, - // i32_gt_s = 0x4a, - // i32_gt_u = 0x4b, - // i32_le_s = 0x4c, - // i32_le_u = 0x4d, - // i32_ge_s = 0x4e, - // i32_ge_u = 0x4f, - // i64_eqz = 0x50, - // i64_eq = 0x51, - // i64_ne = 0x52, - // i64_lt_s = 0x53, - // i64_lt_u = 0x54, - // i64_gt_s = 0x55, - // i64_gt_u = 0x56, - // i64_le_s = 0x57, - // i64_le_u = 0x58, - // i64_ge_s = 0x59, - // i64_ge_u = 0x5a, - // f32_eq = 0x5b, - // f32_ne = 0x5c, - // f32_lt = 0x5d, - // f32_gt = 0x5e, - // f32_le = 0x5f, - // f32_ge = 0x60, - // f64_eq = 0x61, - // f64_ne = 0x62, - // f64_lt = 0x63, - // f64_gt = 0x64, - // f64_le = 0x65, - // f64_ge = 0x66, - // i32_clz = 0x67, - // i32_ctz = 0x68, - // i32_popcnt = 0x69, - // i32_add = 0x6a, - // i32_sub = 0x6b, - // i32_mul = 0x6c, - // i32_div_s = 0x6d, - // i32_div_u = 0x6e, - // i32_rem_s = 0x6f, - // i32_rem_u = 0x70, - // i32_and = 0x71, - // i32_or = 0x72, - // i32_xor = 0x73, - // i32_shl = 0x74, - // i32_shr_s = 0x75, - // i32_shr_u = 0x76, - // i32_rotl = 0x77, - // i32_rotr = 0x78, - // i64_clz = 0x79, - // i64_ctz = 0x7a, - // i64_popcnt = 0x7b, - // i64_add = 0x7c, - // i64_sub = 0x7d, - // i64_mul = 0x7e, - // i64_div_s = 0x7f, - // i64_div_u = 0x80, - // i64_rem_s = 0x81, - // i64_rem_u = 0x82, - // i64_and = 0x83, - // i64_or = 0x84, - // i64_xor = 0x85, - // i64_shl = 0x86, - // i64_shr_s = 0x87, - // i64_shr_u = 0x88, - // i64_rotl = 0x89, - // i64_rotr = 0x8a, - // f32_abs = 0x8b, - // f32_neg = 0x8c, - // f32_ceil = 0x8d, - // f32_floor = 0x8e, - // f32_trunc = 0x8f, - // f32_nearest = 0x90, - // f32_sqrt = 0x91, - // f32_add = 0x92, - // f32_sub = 0x93, - // f32_mul = 0x94, - // f32_div = 0x95, - // f32_min = 0x96, - // f32_max = 0x97, - // f32_copysign = 0x98, - // f64_abs = 0x99, - // f64_neg = 0x9a, - // f64_ceil = 0x9b, - // f64_floor = 0x9c, - // f64_trunc = 0x9d, - // f64_nearest = 0x9e, - // f64_sqrt = 0x9f, - // f64_add = 0xa0, - // f64_sub = 0xa1, - // f64_mul = 0xa2, - // f64_div = 0xa3, - // f64_min = 0xa4, - // f64_max = 0xa5, - // f64_copysign = 0xa6, - // i32_wrap_i64 = 0xa7, - // i32_trunc_s_f32 = 0xa8, - // i32_trunc_u_f32 = 0xa9, - // i32_trunc_s_f64 = 0xaa, - // i32_trunc_u_f64 = 0xab, - // i64_extend_s_i32 = 0xac, - // i64_extend_u_i32 = 0xad, - // i64_trunc_s_f32 = 0xae, - // i64_trunc_u_f32 = 0xaf, - // i64_trunc_s_f64 = 0xb0, - // i64_trunc_u_f64 = 0xb1, - // f32_convert_s_i32 = 0xb2, - // f32_convert_u_i32 = 0xb3, - // f32_convert_s_i64 = 0xb4, - // f32_convert_u_i64 = 0xb5, - // f32_demote_f64 = 0xb6, - // f64_convert_s_i32 = 0xb7, - // f64_convert_u_i32 = 0xb8, - // f64_convert_s_i64 = 0xb9, - // f64_convert_u_i64 = 0xba, - // f64_promote_f32 = 0xbb, - // i32_reinterpret_f32 = 0xbc, - // i64_reinterpret_f64 = 0xbd, - // f32_reinterpret_i32 = 0xbe, - // f64_reinterpret_i64 = 0xbf + f64_const = 0x44, + i32_eqz = 0x45, + i32_eq = 0x46, + i32_ne = 0x47, + i32_lt_s = 0x48, + i32_lt_u = 0x49, + i32_gt_s = 0x4a, + i32_gt_u = 0x4b, + i32_le_s = 0x4c, + i32_le_u = 0x4d, + i32_ge_s = 0x4e, + i32_ge_u = 0x4f, + i64_eqz = 0x50, + i64_eq = 0x51, + i64_ne = 0x52, + i64_lt_s = 0x53, + i64_lt_u = 0x54, + i64_gt_s = 0x55, + i64_gt_u = 0x56, + i64_le_s = 0x57, + i64_le_u = 0x58, + i64_ge_s = 0x59, + i64_ge_u = 0x5a, + f32_eq = 0x5b, + f32_ne = 0x5c, + f32_lt = 0x5d, + f32_gt = 0x5e, + f32_le = 0x5f, + f32_ge = 0x60, + f64_eq = 0x61, + f64_ne = 0x62, + f64_lt = 0x63, + f64_gt = 0x64, + f64_le = 0x65, + f64_ge = 0x66, + i32_clz = 0x67, + i32_ctz = 0x68, + i32_popcnt = 0x69, + i32_add = 0x6a, + i32_sub = 0x6b, + i32_mul = 0x6c, + i32_div_s = 0x6d, + i32_div_u = 0x6e, + i32_rem_s = 0x6f, + i32_rem_u = 0x70, + i32_and = 0x71, + i32_or = 0x72, + i32_xor = 0x73, + i32_shl = 0x74, + i32_shr_s = 0x75, + i32_shr_u = 0x76, + i32_rotl = 0x77, + i32_rotr = 0x78, + i64_clz = 0x79, + i64_ctz = 0x7a, + i64_popcnt = 0x7b, + i64_add = 0x7c, + i64_sub = 0x7d, + i64_mul = 0x7e, + i64_div_s = 0x7f, + i64_div_u = 0x80, + i64_rem_s = 0x81, + i64_rem_u = 0x82, + i64_and = 0x83, + i64_or = 0x84, + i64_xor = 0x85, + i64_shl = 0x86, + i64_shr_s = 0x87, + i64_shr_u = 0x88, + i64_rotl = 0x89, + i64_rotr = 0x8a, + f32_abs = 0x8b, + f32_neg = 0x8c, + f32_ceil = 0x8d, + f32_floor = 0x8e, + f32_trunc = 0x8f, + f32_nearest = 0x90, + f32_sqrt = 0x91, + f32_add = 0x92, + f32_sub = 0x93, + f32_mul = 0x94, + f32_div = 0x95, + f32_min = 0x96, + f32_max = 0x97, + f32_copysign = 0x98, + f64_abs = 0x99, + f64_neg = 0x9a, + f64_ceil = 0x9b, + f64_floor = 0x9c, + f64_trunc = 0x9d, + f64_nearest = 0x9e, + f64_sqrt = 0x9f, + f64_add = 0xa0, + f64_sub = 0xa1, + f64_mul = 0xa2, + f64_div = 0xa3, + f64_min = 0xa4, + f64_max = 0xa5, + f64_copysign = 0xa6, + i32_wrap_i64 = 0xa7, + i32_trunc_s_f32 = 0xa8, + i32_trunc_u_f32 = 0xa9, + i32_trunc_s_f64 = 0xaa, + i32_trunc_u_f64 = 0xab, + i64_extend_s_i32 = 0xac, + i64_extend_u_i32 = 0xad, + i64_trunc_s_f32 = 0xae, + i64_trunc_u_f32 = 0xaf, + i64_trunc_s_f64 = 0xb0, + i64_trunc_u_f64 = 0xb1, + f32_convert_s_i32 = 0xb2, + f32_convert_u_i32 = 0xb3, + f32_convert_s_i64 = 0xb4, + f32_convert_u_i64 = 0xb5, + f32_demote_f64 = 0xb6, + f64_convert_s_i32 = 0xb7, + f64_convert_u_i32 = 0xb8, + f64_convert_s_i64 = 0xb9, + f64_convert_u_i64 = 0xba, + f64_promote_f32 = 0xbb, + i32_reinterpret_f32 = 0xbc, + i64_reinterpret_f64 = 0xbd, + f32_reinterpret_i32 = 0xbe, + f64_reinterpret_i64 = 0xbf } + +export declare function parse(p: any): number; +export declare function newParser(p: any):number[]; diff --git a/lib/parse/src/index.ts b/lib/parse/src/index.ts index 69d5a2c8a6..dc187db5fc 100644 --- a/lib/parse/src/index.ts +++ b/lib/parse/src/index.ts @@ -1,10 +1,16 @@ -import { Type, SectionId, ExternalKind } from "./common"; +import { Type, SectionId, ExternalKind, newParser } from "./common"; +import assert = require("assert"); export { Type, SectionId, ExternalKind }; +import * as loader from "../../loader"; + +type Instance = loader.ASUtil & T; + +type Parser = {parse: (any)=> any, newParser: (any)=>any}; /** Cached compiled parser. */ var compiled: WebAssembly.Module | null = null; -declare var WASM_DATA: string; // injected by webpack +var WASM_DATA: string; // injected by webpack if (typeof WASM_DATA !== "string") WASM_DATA = require("fs").readFileSync(__dirname + "/../build/index.wasm", "base64"); /** Options specified to the parser. The `onSection` callback determines the sections being evaluated in detail. */ @@ -48,6 +54,7 @@ export interface ParseOptions { /** Called with each local name if present and the 'name' section is evaluated. */ onLocalName?(funcIndex: number, index: number, offset: number, length: number): void; } +let memory: WebAssembly.Memory; /** Parses the contents of a WebAssembly binary according to the specified options. */ export function parse(binary: Uint8Array, options?: ParseOptions): void { @@ -59,19 +66,51 @@ export function parse(binary: Uint8Array, options?: ParseOptions): void { // use the binary as the parser's memory var nBytes = binary.length; var nPages = ((nBytes + 0xffff) & ~0xffff) >> 16; - var memory = new WebAssembly.Memory({ initial: nPages }); - var buffer = new Uint8Array(memory.buffer); - buffer.set(binary); + memory = new WebAssembly.Memory({ initial: nPages }); + var buffer = new Uint32Array(memory.buffer); + // buffer.set(binary); // provide a way to read strings from memory parse.readString = (offset: number, length: number): string => utf8_read(buffer, offset, offset + length); + parse.readUint32 = (index: number): number => { + return buffer[index]; + } + var instance: Instance; + // instantiate the parser and return its exports var imports = { env: { + abort: console.error, memory }, - options: {} + index: { + debug: () => {debugger; }, + _log: (start, sizeof) => { + let begin = start >> 2; + let size = sizeof >> 2; + if (size == 1 ){ + console.log(start); + } else { + let str = [] + let len = 0; + for (let i = begin; i < begin+size; i++){ + let line = `| ${i} | ${instance.I32[i]>>2}`; + len = Math.max(len, line.length); + str.push(line); + } + let output = str.map((v,i,a)=> v + " ".repeat(len - v.length + 1) + "|"); + let dash = "-"; + let line = (dash as any).repeat(len+2); + console.log([line,output.join('\n'+line+'\n'),line].join("\n")); + } + }, + _log_str:(x) => console.log(instance.getString(x)), + _logi: console.log, + _logf: console.log + }, + options: {}, + }; [ "onSection", "onType", @@ -93,13 +132,33 @@ export function parse(binary: Uint8Array, options?: ParseOptions): void { "onFunctionName", "onLocalName" ].forEach((name: string): void => imports.options[name] = options[name] || function() {}); - var instance = new WebAssembly.Instance(compiled, imports); - instance.exports.parse(0, nBytes); + instance = loader.instantiate(compiled, imports); + let array = instance.newArray(new Uint8Array(binary)) + let parserPtr = instance.newParser(array); + debugger; + let Mod = instance.parse(parserPtr); + console.log(instance.getString((instance as any).getType(Mod))); + // let sections = buffer.slice(instance.I32[Mod], 2); + // console.log(sections[1]) + // let arrayBuf = sections[0]>>2; + // for (let i =0; i> 2; + // console.log("id: " + instance.I32[section + 1]); + // // console.log(instance.getString(instance.I32[section + 4])); + // } + // let typeSection = (instance as any).getType() >> 2; + // console.log(instance.getString(typeSection)); + // debugger; + // for (let i in Mod) { + // console.log(Mod[i]); + // } + // debugger; } export declare namespace parse { /** Utility function for reading an UTF8 encoded string from memory while parsing. */ function readString(offset: number, length: number): string; + function readUint32(index: number): number; } // see: https://github.com/dcodeIO/protobuf.js/tree/master/lib/utf8 diff --git a/lib/parse/tests/index.ts b/lib/parse/tests/index.ts index 3ca12d4c62..28b1590bcc 100644 --- a/lib/parse/tests/index.ts +++ b/lib/parse/tests/index.ts @@ -4,7 +4,7 @@ import { SectionId, ExternalKind, parse -} from ".."; +} from "../src"; function onSection(id: SectionId, offset: number, length: number, nameOffset: number, nameLength: number): boolean { var name = id == 0 ? "'" + parse.readString(nameOffset, nameLength) + "'" : SectionId[id]; diff --git a/lib/threading/.gitignore b/lib/threading/.gitignore new file mode 100644 index 0000000000..fd79263b69 --- /dev/null +++ b/lib/threading/.gitignore @@ -0,0 +1,2 @@ +build/ +tests/build/ diff --git a/lib/threading/README.md b/lib/threading/README.md new file mode 100644 index 0000000000..2739da8821 --- /dev/null +++ b/lib/threading/README.md @@ -0,0 +1,48 @@ +# ![AS](https://avatars1.githubusercontent.com/u/28916798?s=48) threading + +WebAssembly now has atomic instructions which allow for WebAssembly instances to atomically access a shared memory. There are also two new instructions `wait` and `notify`, which allow threads to wait on a memory address and notify threads that are waiting (which currently aren't implemented by can be handled by the host for now). + +While these instructions are a big step forward for multithreaded WebAssembly applications the loader must still create WebWorkers and pass the required information such as the shared memory. Furthermore, these instructions are still very low level and can be tricky to implement correctly. Thus this module aims to provide a collection of useful classes to aid to fill this gap including a special loader to handle the creation of threads. + +## API +------------ + +### Lock +This is the base class which wraps around a pointer used by `wait` and `notify`. + + +`new Lock(ptr: i32 = 1)` - 0 is locked, 1 is unlocked. + +`acquire()` - Attempts to acquire the lock and will wait until it is notified. + +`release(numAgents: i32 = -1)` - Will atomically store 1 and will notify `numAgents` threads waiting on the lock. `-1` is all waiters. + +## Mailbox +An array can act as a mailbox for a thread. Both pushes and pops to the array are guarded by locks. + +`new Mailbox()` + +`push(item: T)` - pushes item onto array once the thread has acquired the lock. + +`pop(): T` - Attempts to pop an item from the array, however, the thread will wait until there are items in the array. + +## WebWorker +This matches the WC3's WebWorker API. + +`new WebWorker()` + +`postMessage(item: T)` - pushes an item onto the workers stack. + +`onmessage(item: T)` - which which is called when an item is popped from the array. + + +## Testing it out +First build the test binary. + +`npm run asbuild:test` + +Then start the server. + +`npm run server` + +In the console you should see that the message 424242 was received by the forked Web Worker. diff --git a/lib/threading/assembly/index.ts b/lib/threading/assembly/index.ts new file mode 100644 index 0000000000..2563cc2903 --- /dev/null +++ b/lib/threading/assembly/index.ts @@ -0,0 +1,171 @@ +/** A WebAssembly module that provides threading features. */ +import "allocator/atomic" +import { itoa } from "internal/number"; + +type int = i32 + +declare function wait(i: i32, v: int, t:i32): void; +declare function notify(i: i32, v: int): void; +declare function print(i: i32): void; +declare function fork(worker: Worker): void +declare function log_str(s: string): void +declare function log(i:T): void +declare function loc(i:Lock):i32; +declare function debug(): void; +declare function printMemory(t: T): void; + + +// function loc (x: Lock):i32 { +// return changetype(x); +// } + +type handler = (message: T) => void; + +/* + Uses atomic instructions to implement a lock that waits until the lock is acquired. +*/ +export class Lock { + constructor(public ptr: i32 = 1){} + static store(ptr: usize, x: i32): void { + // log_str("Storing " + itoa(x) + " to " + itoa(ptr)); + Atomic.store(ptr, x); + } + + static load(ptr: usize): i32 { + print(ptr); + let x = ptr; + print(x); + return Atomic.load(ptr); + } + acquire(): void { + log_str("aquiring Lock"); + Lock.acquire(changetype(this)); + log_str("lock is acquired"); + } + release(): void { + Lock.release(changetype(this)); + log_str("Lock is Released"); + } + /** Wait until lock is acquired, e.i. the ptr is set to 0. */ + static acquire(ptr: usize): void { + let count = 0; + printMemory(ptr); + // log_str(itoa(Atomic.load(ptr))+ " oo "+ itoa(Atomic.load(ptr))); + // log_str("aquiring Lock ---" + itoa(ptr) + " has VALUE "+ itoa(Atomic.load(ptr))); + print(Atomic.load(ptr)); + printMemory(ptr); + while (!Atomic.cmpxchg(ptr, 1, 0)){ + wait(ptr, 0, -1); + if (count++ > 5){ + break; + } + } + } + + static release(ptr: i32): void { + Lock.store(ptr, 1); + notify(ptr, 1); + } + + +} + +export class Mailbox { + array: Array = []; + lock: Lock; + + constructor(){ + this.lock = new Lock(); + } + + push(item: T): void { + log_str("Pushing----"); + this.lock.acquire(); + log_str("Read lock acquired for writer"); + this.array.push(item); + log_str("Pushed item"); + this.lock.release(); + } + + pop(): T { + log_str("Popping----"); + let ptr = changetype(this.lock); + let count = 0; + while (this.array.length == 0) { + this.lock.acquire(); + count++; + if (count > 100){ + break; + } + this.lock.release(); + log_str("going to sleep"); + wait(ptr, 1 , -1); + this.lock.acquire(); + } + // this.lock.acquire(this.lock.ptr); + let i: T = this.array.pop(); + this.lock.release(); + return i; + } + + // clone(): Mailbox { + // let m = changetype>(__memory_allocate(sizeof>())); + // m.array= this.array; + // m.lock = this.lock.clone(); + // m.write = this.write.clone(); + // return m; + // } +} + + + +export class Worker { + array: Mailbox; + alive: boolean = true; + id: i32; + + constructor() { + this.array = new Mailbox(); + this.init(); + } + + static start(worker: Worker): void{ + worker.run(); + } + + run(): void { + log_str("starting Worker"); + let array = this.array; + let count = 0; + while(this.alive) { + log_str("about to call pop"); + let i: i32 = array.pop(); + this.onmessage(i); + if (count>100){ + break; + } + } + } + + init(): void { + this.id = changetype(this); + fork(this); + } + + onmessage(message: i32): void { + // log_str("printing message: "); + print(message); + } + + postMessage(message: i32): void { + // this.lock.acquire(); + this.array.push(message); + // this.lock.release(); + } + +} + + +export function startWorker(worker: Worker): void{ + worker.run(); +} diff --git a/lib/threading/assembly/tsconfig.json b/lib/threading/assembly/tsconfig.json new file mode 100644 index 0000000000..6e52b21c48 --- /dev/null +++ b/lib/threading/assembly/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../../../std/assembly.json", + "include": [ + "./**/*.ts" + ] +} diff --git a/lib/threading/index.d.ts b/lib/threading/index.d.ts new file mode 100644 index 0000000000..3bd16e178a --- /dev/null +++ b/lib/threading/index.d.ts @@ -0,0 +1 @@ +export * from "./src"; diff --git a/lib/threading/index.js b/lib/threading/index.js new file mode 100644 index 0000000000..7f4ef8ed27 --- /dev/null +++ b/lib/threading/index.js @@ -0,0 +1,571 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["thread"] = factory(); + else + root["thread"] = factory(); +})(typeof self !== 'undefined' ? self : this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "../loader/index.js": +/*!**************************!*\ + !*** ../loader/index.js ***! + \**************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +const hasBigInt64 = typeof BigUint64Array !== "undefined"; + +/** Gets a string from an U32 and an U16 view on a memory. */ +function getStringImpl(U32, U16, ptr) { + var dataLength = U32[ptr >>> 2]; + var dataOffset = (ptr + 4) >>> 1; + var dataRemain = dataLength; + var parts = []; + const chunkSize = 1024; + while (dataRemain > chunkSize) { + let last = U16[dataOffset + chunkSize - 1]; + let size = last >= 0xD800 && last < 0xDC00 ? chunkSize - 1 : chunkSize; + let part = U16.subarray(dataOffset, dataOffset += size); + parts.push(String.fromCharCode.apply(String, part)); + dataRemain -= size; + } + return parts.join("") + String.fromCharCode.apply(String, U16.subarray(dataOffset, dataOffset + dataRemain)); +} + +/** Prepares the base module prior to instantiation. */ +function preInstantiate(imports) { + var baseModule = {}; + + function getString(memory, ptr) { + if (!memory) return ""; + var buffer = memory.buffer; + return getStringImpl(new Uint32Array(buffer), new Uint16Array(buffer), ptr); + } + + // add common imports used by stdlib for convenience + var env = (imports.env = imports.env || {}); + env.abort = env.abort || function abort(mesg, file, line, colm) { + var memory = baseModule.memory || env.memory; // prefer exported, otherwise try imported + throw Error("abort: " + getString(memory, mesg) + " at " + getString(memory, file) + ":" + line + ":" + colm); + } + env.trace = env.trace || function trace(mesg, n) { + var memory = baseModule.memory || env.memory; + console.log("trace: " + getString(memory, mesg) + (n ? " " : "") + Array.prototype.slice.call(arguments, 2, 2 + n).join(", ")); + } + imports.Math = imports.Math || Math; + imports.Date = imports.Date || Date; + + return baseModule; +} + +/** Prepares the final module once instantiation is complete. */ +function postInstantiate(baseModule, instance) { + var rawExports = instance.exports; + var memory = rawExports.memory; + var memory_allocate = rawExports["memory.allocate"]; + var memory_fill = rawExports["memory.fill"]; + var memory_free = rawExports["memory.free"]; + var table = rawExports.table; + var setargc = rawExports._setargc || function() {}; + + // Provide views for all sorts of basic values + var buffer, I8, U8, I16, U16, I32, U32, F32, F64, I64, U64; + + /** Updates memory views if memory has grown meanwhile. */ + function checkMem() { + // see: https://github.com/WebAssembly/design/issues/1210 + if (buffer !== memory.buffer) { + buffer = memory.buffer; + I8 = new Int8Array(buffer); + U8 = new Uint8Array(buffer); + I16 = new Int16Array(buffer); + U16 = new Uint16Array(buffer); + I32 = new Int32Array(buffer); + U32 = new Uint32Array(buffer); + if (hasBigInt64) { + I64 = new BigInt64Array(buffer); + U64 = new BigUint64Array(buffer); + } + F32 = new Float32Array(buffer); + F64 = new Float64Array(buffer); + } + } + checkMem(); + + /** Allocates a new string in the module's memory and returns its pointer. */ + function newString(str) { + var dataLength = str.length; + var ptr = memory_allocate(4 + (dataLength << 1)); + var dataOffset = (4 + ptr) >>> 1; + checkMem(); + U32[ptr >>> 2] = dataLength; + for (let i = 0; i < dataLength; ++i) U16[dataOffset + i] = str.charCodeAt(i); + return ptr; + } + + baseModule.newString = newString; + + /** Gets a string from the module's memory by its pointer. */ + function getString(ptr) { + checkMem(); + return getStringImpl(U32, U16, ptr); + } + + baseModule.getString = getString; + + function computeBufferSize(byteLength) { + const HEADER_SIZE = 8; + return 1 << (32 - Math.clz32(byteLength + HEADER_SIZE - 1)); + } + + /** Creates a new typed array in the module's memory and returns its pointer. */ + function newArray(view, length, unsafe) { + var ctor = view.constructor; + if (ctor === Function) { // TypedArray constructor created in memory + ctor = view; + view = null; + } else { // TypedArray instance copied into memory + if (length === undefined) length = view.length; + } + var elementSize = ctor.BYTES_PER_ELEMENT; + if (!elementSize) throw Error("not a typed array"); + var byteLength = elementSize * length; + var ptr = memory_allocate(12); // TypedArray header + var buf = memory_allocate(computeBufferSize(byteLength)); // ArrayBuffer + checkMem(); + U32[ ptr >>> 2] = buf; // .buffer + U32[(ptr + 4) >>> 2] = 0; // .byteOffset + U32[(ptr + 8) >>> 2] = byteLength; // .byteLength + U32[ buf >>> 2] = byteLength; // .byteLength + U32[(buf + 4) >>> 2] = 0; // 0 + if (view) { + new ctor(buffer, buf + 8, length).set(view); + if (view.length < length && !unsafe) { + let setLength = elementSize * view.length; + memory_fill(buf + 8 + setLength, 0, byteLength - setLength); + } + } else if (!unsafe) { + memory_fill(buf + 8, 0, byteLength); + } + return ptr; + } + + baseModule.newArray = newArray; + + /** Gets a view on a typed array in the module's memory by its pointer. */ + function getArray(ctor, ptr) { + var elementSize = ctor.BYTES_PER_ELEMENT; + if (!elementSize) throw Error("not a typed array"); + checkMem(); + var buf = U32[ ptr >>> 2]; + var byteOffset = U32[(ptr + 4) >>> 2]; + var byteLength = U32[(ptr + 8) >>> 2]; + return new ctor(buffer, buf + 8 + byteOffset, (byteLength - byteOffset) / elementSize); + } + + baseModule.getArray = getArray; + + /** Frees a typed array in the module's memory. Must not be accessed anymore afterwards. */ + function freeArray(ptr) { + checkMem(); + var buf = U32[ptr >>> 2]; + memory_free(buf); + memory_free(ptr); + } + + baseModule.freeArray = freeArray; + + /** + * Creates a new function in the module's table and returns its pointer. Note that only actual + * WebAssembly functions, i.e. as exported by the module, are supported. + */ + function newFunction(fn) { + if (typeof fn.original === "function") fn = fn.original; + var index = table.length; + table.grow(1); + table.set(index, fn); + return index; + } + + baseModule.newFunction = newFunction; + + /** Gets a function by its pointer. */ + function getFunction(ptr) { + return wrapFunction(table.get(ptr), setargc); + } + + baseModule.getFunction = getFunction; + + // Pull basic exports to baseModule so code in preInstantiate can use them + baseModule.memory = baseModule.memory || memory; + baseModule.table = baseModule.table || table; + + // Demangle exports and provide the usual utility on the prototype + return demangle(rawExports, Object.defineProperties(baseModule, { + I8: { get: function() { checkMem(); return I8; } }, + U8: { get: function() { checkMem(); return U8; } }, + I16: { get: function() { checkMem(); return I16; } }, + U16: { get: function() { checkMem(); return U16; } }, + I32: { get: function() { checkMem(); return I32; } }, + U32: { get: function() { checkMem(); return U32; } }, + I64: { get: function() { checkMem(); return I64; } }, + U64: { get: function() { checkMem(); return U64; } }, + F32: { get: function() { checkMem(); return F32; } }, + F64: { get: function() { checkMem(); return F64; } } + })); +} + +/** Wraps a WebAssembly function while also taking care of variable arguments. */ +function wrapFunction(fn, setargc) { + var wrap = (...args) => { + setargc(args.length); + return fn(...args); + } + // adding a function to the table with `newFunction` is limited to actual WebAssembly functions, + // hence we can't use the wrapper and instead need to provide a reference to the original + wrap.original = fn; + return wrap; +} + +/** Instantiates an AssemblyScript module using the specified imports. */ +function instantiate(module, imports) { + return postInstantiate( + preInstantiate(imports || (imports = {})), + new WebAssembly.Instance(module, imports) + ); +} + +exports.instantiate = instantiate; + +/** Instantiates an AssemblyScript module from a buffer using the specified imports. */ +function instantiateBuffer(buffer, imports) { + return instantiate(new WebAssembly.Module(buffer), imports); +} + +exports.instantiateBuffer = instantiateBuffer; + +/** Instantiates an AssemblyScript module from a response using the specified imports. */ +async function instantiateStreaming(response, imports) { + return postInstantiate( + preInstantiate(imports || (imports = {})), + (await WebAssembly.instantiateStreaming(response, imports)).instance + ); +} + +exports.instantiateStreaming = instantiateStreaming; + +/** Demangles an AssemblyScript module's exports to a friendly object structure. */ +function demangle(exports, baseModule) { + var module = baseModule ? Object.create(baseModule) : {}; + var setargc = exports._setargc || function() {}; + function hasOwnProperty(elem, prop) { + return Object.prototype.hasOwnProperty.call(elem, prop); + } + for (let internalName in exports) { + if (!hasOwnProperty(exports, internalName)) continue; + let elem = exports[internalName]; + let parts = internalName.split("."); + let curr = module; + while (parts.length > 1) { + let part = parts.shift(); + if (!hasOwnProperty(curr, part)) curr[part] = {}; + curr = curr[part]; + } + let name = parts[0]; + let hash = name.indexOf("#"); + if (hash >= 0) { + let className = name.substring(0, hash); + let classElem = curr[className]; + if (typeof classElem === "undefined" || !classElem.prototype) { + let ctor = function(...args) { + return ctor.wrap(ctor.prototype.constructor(...args)); + }; + ctor.prototype = {}; + ctor.wrap = function(thisValue) { + return Object.create(ctor.prototype, { "this": { value: thisValue, writable: false } }); + }; + if (classElem) Object.getOwnPropertyNames(classElem).forEach(name => + Object.defineProperty(ctor, name, Object.getOwnPropertyDescriptor(classElem, name)) + ); + curr[className] = ctor; + } + name = name.substring(hash + 1); + curr = curr[className].prototype; + if (/^(get|set):/.test(name)) { + if (!hasOwnProperty(curr, name = name.substring(4))) { + let getter = exports[internalName.replace("set:", "get:")]; + let setter = exports[internalName.replace("get:", "set:")]; + Object.defineProperty(curr, name, { + get: function() { return getter(this.this); }, + set: function(value) { setter(this.this, value); }, + enumerable: true + }); + } + } else { + curr[name] = wrapFunction(elem, setargc); + } + } else { + if (/^(get|set):/.test(name)) { + if (!hasOwnProperty(curr, name = name.substring(4))) { + Object.defineProperty(curr, name, { + get: exports[internalName.replace("set:", "get:")], + set: exports[internalName.replace("get:", "set:")], + enumerable: true + }); + } + } else if (typeof elem === "function") { + curr[name] = wrapFunction(elem, setargc); + } else { + curr[name] = elem; + } + } + } + + return module; +} + +exports.demangle = demangle; + + +/***/ }), + +/***/ "./src/index.ts": +/*!**********************!*\ + !*** ./src/index.ts ***! + \**********************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const loader = __webpack_require__(/*! ../../loader */ "../loader/index.js"); +/** Cached compiled parser. */ +var compiled = null; +async function fork(parent, worker) { + let newWorker = new Worker("./webworker.js"); + newWorker.postMessage({ command: "fork", memory: parent.memory, worker }); + return newWorker; +} +let notify = Atomics.wake; +class Thread { + constructor(address, wasm) { + this.address = address; + this.wasm = wasm; + Thread.thread = this; + } + static async create(address, memory = Thread.defaultMemory) { + let buf = await fetch(address); + let wasm = await WebAssembly.compile(await buf.arrayBuffer()); + let thread = new Thread(address, wasm); + thread.instance = await thread.load(memory, wasm); + return thread; + } + static defaultMemory() { + return new WebAssembly.Memory({ + initial: 256, + shared: true, + maximum: 256 + }); + } + fork(worker) { + let newWorker = new Worker("./webworker.js"); + let address = this.address; + let lastdot = address.lastIndexOf("."); + address = address.slice(0, lastdot) + ".wasm"; + newWorker.postMessage({ command: "fork", address: address, memory: this.memory, worker }); + return newWorker; + } + async load(memory, mod) { + var wasm; + let instance; + if (typeof mod === "string") { + let buf = await fetch(mod); + wasm = await WebAssembly.compile(await buf.arrayBuffer()); + } + else { + wasm = mod; + } + // var w = new Worker('worker.js'); // Standard API + var imports = { + env: { memory }, + index: { + log_str: (x) => { return console.log(instance.getString(x)); }, + fork: (worker) => { + console.log(`Worker is located at ${worker >> 2}`); + return this.fork(worker); + }, + log: (type, x) => console.log(x), + wait: (ptr, value, timeout) => { + if (timeout === -1) { + timeout = Infinity; + } + console.log(`About to wait on location: ${ptr >> 2}`); + let res = Atomics.wait(instance.I32, ptr >> 2, value, timeout); + console.log(`Woken waiting on ${ptr / 4} with result: ${res}`); + }, + notify: (ptr, numAgents) => { return notify(instance.I32, ptr >> 2, numAgents); }, + print: console.log, + printMemory: (start = 0) => console.log(instance.I32.slice(start)), + debug: () => { let x = 1; debugger; }, + loc: (x) => { + console.log("getting location: " + x); + return x; + } + } + }; + instance = await loader.instantiate(wasm, imports); + return instance; + } + start() { + this.instance.myStart(); + } + startChild(id) { + this.id = id; + this.instance.startChild(id); + } + static onMessageReceived(e) { + try { + const data = e.data; + debugger; + switch (data.command) { + case "start": { + (async (address) => { + let thread = await Thread.create(address); + thread.start(); + debugger; + })(data.address); + break; + } + case "fork": { + (async function (address, memory, worker) { + debugger; + let thread = await Thread.create(address, memory); + thread.startChild(worker); + })(data.address, data.memory, data.worker); + break; + } + } + } + catch (e) { + console.log(e); + } + } + get memory() { + return this.instance.memory; + } +} +exports.default = Thread; +addEventListener("message", Thread.onMessageReceived, false); + + +/***/ }), + +/***/ 0: +/*!****************************!*\ + !*** multi ./src/index.ts ***! + \****************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(/*! ./src/index.ts */"./src/index.ts"); + + +/***/ }) + +/******/ }); +}); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/threading/index.js.map b/lib/threading/index.js.map new file mode 100644 index 0000000000..0b989b4b7d --- /dev/null +++ b/lib/threading/index.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack://thread/webpack/universalModuleDefinition","webpack://thread/webpack/bootstrap","webpack://thread/../loader/index.js","webpack://thread/./src/index.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;;;;;;AClFa;;AAEb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,4CAA4C;AAC5C;AACA,iDAAiD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,gBAAgB;AACnC;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA,KAAK,OAAO;AACZ;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC,6DAA6D;AAC7D;AACA,+BAA+B;AAC/B,6BAA6B;AAC7B,sCAAsC;AACtC,sCAAsC;AACtC,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,SAAS,kBAAkB,YAAY,WAAW,EAAE,EAAE;AACtD,SAAS,kBAAkB,YAAY,WAAW,EAAE,EAAE;AACtD,UAAU,kBAAkB,YAAY,YAAY,EAAE,EAAE;AACxD,UAAU,kBAAkB,YAAY,YAAY,EAAE,EAAE;AACxD,UAAU,kBAAkB,YAAY,YAAY,EAAE,EAAE;AACxD,UAAU,kBAAkB,YAAY,YAAY,EAAE,EAAE;AACxD,UAAU,kBAAkB,YAAY,YAAY,EAAE,EAAE;AACxD,UAAU,kBAAkB,YAAY,YAAY,EAAE,EAAE;AACxD,UAAU,kBAAkB,YAAY,YAAY,EAAE,EAAE;AACxD,UAAU,kBAAkB,YAAY,YAAY,EAAE;AACtD,GAAG;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,UAAU,oCAAoC,EAAE;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,0BAA0B,EAAE;AACzD,kCAAkC,0BAA0B,EAAE;AAC9D;AACA,WAAW;AACX;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,WAAW;AACX;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;;;;;;;;;;;;ACzTa;AACb,8CAA8C,cAAc;AAC5D,eAAe,mBAAO,CAAC,wCAAc;AACrC;AACA;AACA;AACA;AACA,2BAA2B,iDAAiD;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,iEAAiE;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA,kBAAkB,SAAS;AAC3B;AACA,iCAAiC,2CAA2C,EAAE;AAC9E;AACA,wDAAwD,YAAY;AACpE;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,8DAA8D,SAAS;AACvE;AACA,oDAAoD,QAAQ,gBAAgB,IAAI;AAChF,iBAAiB;AACjB,6CAA6C,kDAAkD,EAAE;AACjG;AACA;AACA,8BAA8B,WAAW,UAAU,EAAE;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","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[\"thread\"] = factory();\n\telse\n\t\troot[\"thread\"] = 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\";\n\nconst hasBigInt64 = typeof BigUint64Array !== \"undefined\";\n\n/** Gets a string from an U32 and an U16 view on a memory. */\nfunction getStringImpl(U32, U16, ptr) {\n var dataLength = U32[ptr >>> 2];\n var dataOffset = (ptr + 4) >>> 1;\n var dataRemain = dataLength;\n var parts = [];\n const chunkSize = 1024;\n while (dataRemain > chunkSize) {\n let last = U16[dataOffset + chunkSize - 1];\n let size = last >= 0xD800 && last < 0xDC00 ? chunkSize - 1 : chunkSize;\n let part = U16.subarray(dataOffset, dataOffset += size);\n parts.push(String.fromCharCode.apply(String, part));\n dataRemain -= size;\n }\n return parts.join(\"\") + String.fromCharCode.apply(String, U16.subarray(dataOffset, dataOffset + dataRemain));\n}\n\n/** Prepares the base module prior to instantiation. */\nfunction preInstantiate(imports) {\n var baseModule = {};\n\n function getString(memory, ptr) {\n if (!memory) return \"\";\n var buffer = memory.buffer;\n return getStringImpl(new Uint32Array(buffer), new Uint16Array(buffer), ptr);\n }\n\n // add common imports used by stdlib for convenience\n var env = (imports.env = imports.env || {});\n env.abort = env.abort || function abort(mesg, file, line, colm) {\n var memory = baseModule.memory || env.memory; // prefer exported, otherwise try imported\n throw Error(\"abort: \" + getString(memory, mesg) + \" at \" + getString(memory, file) + \":\" + line + \":\" + colm);\n }\n env.trace = env.trace || function trace(mesg, n) {\n var memory = baseModule.memory || env.memory;\n console.log(\"trace: \" + getString(memory, mesg) + (n ? \" \" : \"\") + Array.prototype.slice.call(arguments, 2, 2 + n).join(\", \"));\n }\n imports.Math = imports.Math || Math;\n imports.Date = imports.Date || Date;\n\n return baseModule;\n}\n\n/** Prepares the final module once instantiation is complete. */\nfunction postInstantiate(baseModule, instance) {\n var rawExports = instance.exports;\n var memory = rawExports.memory;\n var memory_allocate = rawExports[\"memory.allocate\"];\n var memory_fill = rawExports[\"memory.fill\"];\n var memory_free = rawExports[\"memory.free\"];\n var table = rawExports.table;\n var setargc = rawExports._setargc || function() {};\n\n // Provide views for all sorts of basic values\n var buffer, I8, U8, I16, U16, I32, U32, F32, F64, I64, U64;\n\n /** Updates memory views if memory has grown meanwhile. */\n function checkMem() {\n // see: https://github.com/WebAssembly/design/issues/1210\n if (buffer !== memory.buffer) {\n buffer = memory.buffer;\n I8 = new Int8Array(buffer);\n U8 = new Uint8Array(buffer);\n I16 = new Int16Array(buffer);\n U16 = new Uint16Array(buffer);\n I32 = new Int32Array(buffer);\n U32 = new Uint32Array(buffer);\n if (hasBigInt64) {\n I64 = new BigInt64Array(buffer);\n U64 = new BigUint64Array(buffer);\n }\n F32 = new Float32Array(buffer);\n F64 = new Float64Array(buffer);\n }\n }\n checkMem();\n\n /** Allocates a new string in the module's memory and returns its pointer. */\n function newString(str) {\n var dataLength = str.length;\n var ptr = memory_allocate(4 + (dataLength << 1));\n var dataOffset = (4 + ptr) >>> 1;\n checkMem();\n U32[ptr >>> 2] = dataLength;\n for (let i = 0; i < dataLength; ++i) U16[dataOffset + i] = str.charCodeAt(i);\n return ptr;\n }\n\n baseModule.newString = newString;\n\n /** Gets a string from the module's memory by its pointer. */\n function getString(ptr) {\n checkMem();\n return getStringImpl(U32, U16, ptr);\n }\n\n baseModule.getString = getString;\n\n function computeBufferSize(byteLength) {\n const HEADER_SIZE = 8;\n return 1 << (32 - Math.clz32(byteLength + HEADER_SIZE - 1));\n }\n\n /** Creates a new typed array in the module's memory and returns its pointer. */\n function newArray(view, length, unsafe) {\n var ctor = view.constructor;\n if (ctor === Function) { // TypedArray constructor created in memory\n ctor = view;\n view = null;\n } else { // TypedArray instance copied into memory\n if (length === undefined) length = view.length;\n }\n var elementSize = ctor.BYTES_PER_ELEMENT;\n if (!elementSize) throw Error(\"not a typed array\");\n var byteLength = elementSize * length;\n var ptr = memory_allocate(12); // TypedArray header\n var buf = memory_allocate(computeBufferSize(byteLength)); // ArrayBuffer\n checkMem();\n U32[ ptr >>> 2] = buf; // .buffer\n U32[(ptr + 4) >>> 2] = 0; // .byteOffset\n U32[(ptr + 8) >>> 2] = byteLength; // .byteLength\n U32[ buf >>> 2] = byteLength; // .byteLength\n U32[(buf + 4) >>> 2] = 0; // 0\n if (view) {\n new ctor(buffer, buf + 8, length).set(view);\n if (view.length < length && !unsafe) {\n let setLength = elementSize * view.length;\n memory_fill(buf + 8 + setLength, 0, byteLength - setLength);\n }\n } else if (!unsafe) {\n memory_fill(buf + 8, 0, byteLength);\n }\n return ptr;\n }\n\n baseModule.newArray = newArray;\n\n /** Gets a view on a typed array in the module's memory by its pointer. */\n function getArray(ctor, ptr) {\n var elementSize = ctor.BYTES_PER_ELEMENT;\n if (!elementSize) throw Error(\"not a typed array\");\n checkMem();\n var buf = U32[ ptr >>> 2];\n var byteOffset = U32[(ptr + 4) >>> 2];\n var byteLength = U32[(ptr + 8) >>> 2];\n return new ctor(buffer, buf + 8 + byteOffset, (byteLength - byteOffset) / elementSize);\n }\n\n baseModule.getArray = getArray;\n\n /** Frees a typed array in the module's memory. Must not be accessed anymore afterwards. */\n function freeArray(ptr) {\n checkMem();\n var buf = U32[ptr >>> 2];\n memory_free(buf);\n memory_free(ptr);\n }\n\n baseModule.freeArray = freeArray;\n\n /**\n * Creates a new function in the module's table and returns its pointer. Note that only actual\n * WebAssembly functions, i.e. as exported by the module, are supported.\n */\n function newFunction(fn) {\n if (typeof fn.original === \"function\") fn = fn.original;\n var index = table.length;\n table.grow(1);\n table.set(index, fn);\n return index;\n }\n\n baseModule.newFunction = newFunction;\n\n /** Gets a function by its pointer. */\n function getFunction(ptr) {\n return wrapFunction(table.get(ptr), setargc);\n }\n\n baseModule.getFunction = getFunction;\n\n // Pull basic exports to baseModule so code in preInstantiate can use them\n baseModule.memory = baseModule.memory || memory;\n baseModule.table = baseModule.table || table;\n\n // Demangle exports and provide the usual utility on the prototype\n return demangle(rawExports, Object.defineProperties(baseModule, {\n I8: { get: function() { checkMem(); return I8; } },\n U8: { get: function() { checkMem(); return U8; } },\n I16: { get: function() { checkMem(); return I16; } },\n U16: { get: function() { checkMem(); return U16; } },\n I32: { get: function() { checkMem(); return I32; } },\n U32: { get: function() { checkMem(); return U32; } },\n I64: { get: function() { checkMem(); return I64; } },\n U64: { get: function() { checkMem(); return U64; } },\n F32: { get: function() { checkMem(); return F32; } },\n F64: { get: function() { checkMem(); return F64; } }\n }));\n}\n\n/** Wraps a WebAssembly function while also taking care of variable arguments. */\nfunction wrapFunction(fn, setargc) {\n var wrap = (...args) => {\n setargc(args.length);\n return fn(...args);\n }\n // adding a function to the table with `newFunction` is limited to actual WebAssembly functions,\n // hence we can't use the wrapper and instead need to provide a reference to the original\n wrap.original = fn;\n return wrap;\n}\n\n/** Instantiates an AssemblyScript module using the specified imports. */\nfunction instantiate(module, imports) {\n return postInstantiate(\n preInstantiate(imports || (imports = {})),\n new WebAssembly.Instance(module, imports)\n );\n}\n\nexports.instantiate = instantiate;\n\n/** Instantiates an AssemblyScript module from a buffer using the specified imports. */\nfunction instantiateBuffer(buffer, imports) {\n return instantiate(new WebAssembly.Module(buffer), imports);\n}\n\nexports.instantiateBuffer = instantiateBuffer;\n\n/** Instantiates an AssemblyScript module from a response using the specified imports. */\nasync function instantiateStreaming(response, imports) {\n return postInstantiate(\n preInstantiate(imports || (imports = {})),\n (await WebAssembly.instantiateStreaming(response, imports)).instance\n );\n}\n\nexports.instantiateStreaming = instantiateStreaming;\n\n/** Demangles an AssemblyScript module's exports to a friendly object structure. */\nfunction demangle(exports, baseModule) {\n var module = baseModule ? Object.create(baseModule) : {};\n var setargc = exports._setargc || function() {};\n function hasOwnProperty(elem, prop) {\n return Object.prototype.hasOwnProperty.call(elem, prop);\n }\n for (let internalName in exports) {\n if (!hasOwnProperty(exports, internalName)) continue;\n let elem = exports[internalName];\n let parts = internalName.split(\".\");\n let curr = module;\n while (parts.length > 1) {\n let part = parts.shift();\n if (!hasOwnProperty(curr, part)) curr[part] = {};\n curr = curr[part];\n }\n let name = parts[0];\n let hash = name.indexOf(\"#\");\n if (hash >= 0) {\n let className = name.substring(0, hash);\n let classElem = curr[className];\n if (typeof classElem === \"undefined\" || !classElem.prototype) {\n let ctor = function(...args) {\n return ctor.wrap(ctor.prototype.constructor(...args));\n };\n ctor.prototype = {};\n ctor.wrap = function(thisValue) {\n return Object.create(ctor.prototype, { \"this\": { value: thisValue, writable: false } });\n };\n if (classElem) Object.getOwnPropertyNames(classElem).forEach(name =>\n Object.defineProperty(ctor, name, Object.getOwnPropertyDescriptor(classElem, name))\n );\n curr[className] = ctor;\n }\n name = name.substring(hash + 1);\n curr = curr[className].prototype;\n if (/^(get|set):/.test(name)) {\n if (!hasOwnProperty(curr, name = name.substring(4))) {\n let getter = exports[internalName.replace(\"set:\", \"get:\")];\n let setter = exports[internalName.replace(\"get:\", \"set:\")];\n Object.defineProperty(curr, name, {\n get: function() { return getter(this.this); },\n set: function(value) { setter(this.this, value); },\n enumerable: true\n });\n }\n } else {\n curr[name] = wrapFunction(elem, setargc);\n }\n } else {\n if (/^(get|set):/.test(name)) {\n if (!hasOwnProperty(curr, name = name.substring(4))) {\n Object.defineProperty(curr, name, {\n get: exports[internalName.replace(\"set:\", \"get:\")],\n set: exports[internalName.replace(\"get:\", \"set:\")],\n enumerable: true\n });\n }\n } else if (typeof elem === \"function\") {\n curr[name] = wrapFunction(elem, setargc);\n } else {\n curr[name] = elem;\n }\n }\n }\n\n return module;\n}\n\nexports.demangle = demangle;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst loader = require(\"../../loader\");\n/** Cached compiled parser. */\nvar compiled = null;\nasync function fork(parent, worker) {\n let newWorker = new Worker(\"./webworker.js\");\n newWorker.postMessage({ command: \"fork\", memory: parent.memory, worker });\n return newWorker;\n}\nlet notify = Atomics.wake;\nclass Thread {\n constructor(address, wasm) {\n this.address = address;\n this.wasm = wasm;\n Thread.thread = this;\n }\n static async create(address, memory = Thread.defaultMemory) {\n let buf = await fetch(address);\n let wasm = await WebAssembly.compile(await buf.arrayBuffer());\n let thread = new Thread(address, wasm);\n thread.instance = await thread.load(memory, wasm);\n return thread;\n }\n static defaultMemory() {\n return new WebAssembly.Memory({\n initial: 256,\n shared: true,\n maximum: 256\n });\n }\n fork(worker) {\n let newWorker = new Worker(\"./webworker.js\");\n let address = this.address;\n let lastdot = address.lastIndexOf(\".\");\n address = address.slice(0, lastdot) + \".wasm\";\n newWorker.postMessage({ command: \"fork\", address: address, memory: this.memory, worker });\n return newWorker;\n }\n async load(memory, mod) {\n var wasm;\n let instance;\n if (typeof mod === \"string\") {\n let buf = await fetch(mod);\n wasm = await WebAssembly.compile(await buf.arrayBuffer());\n }\n else {\n wasm = mod;\n }\n // var w = new Worker('worker.js'); // Standard API\n var imports = {\n env: { memory },\n index: {\n log_str: (x) => { return console.log(instance.getString(x)); },\n fork: (worker) => {\n console.log(`Worker is located at ${worker >> 2}`);\n return this.fork(worker);\n },\n log: (type, x) => console.log(x),\n wait: (ptr, value, timeout) => {\n if (timeout === -1) {\n timeout = Infinity;\n }\n console.log(`About to wait on location: ${ptr >> 2}`);\n let res = Atomics.wait(instance.I32, ptr >> 2, value, timeout);\n console.log(`Woken waiting on ${ptr / 4} with result: ${res}`);\n },\n notify: (ptr, numAgents) => { return notify(instance.I32, ptr >> 2, numAgents); },\n print: console.log,\n printMemory: (start = 0) => console.log(instance.I32.slice(start)),\n debug: () => { let x = 1; debugger; },\n loc: (x) => {\n console.log(\"getting location: \" + x);\n return x;\n }\n }\n };\n instance = await loader.instantiate(wasm, imports);\n return instance;\n }\n start() {\n this.instance.myStart();\n }\n startChild(id) {\n this.id = id;\n this.instance.startChild(id);\n }\n static onMessageReceived(e) {\n try {\n const data = e.data;\n debugger;\n switch (data.command) {\n case \"start\": {\n (async (address) => {\n let thread = await Thread.create(address);\n thread.start();\n debugger;\n })(data.address);\n break;\n }\n case \"fork\": {\n (async function (address, memory, worker) {\n debugger;\n let thread = await Thread.create(address, memory);\n thread.startChild(worker);\n })(data.address, data.memory, data.worker);\n break;\n }\n }\n }\n catch (e) {\n console.log(e);\n }\n }\n get memory() {\n return this.instance.memory;\n }\n}\nexports.default = Thread;\naddEventListener(\"message\", Thread.onMessageReceived, false);\n"],"sourceRoot":""} \ No newline at end of file diff --git a/lib/threading/package-lock.json b/lib/threading/package-lock.json new file mode 100644 index 0000000000..0f3ba8c629 --- /dev/null +++ b/lib/threading/package-lock.json @@ -0,0 +1,4267 @@ +{ + "name": "@assemblyscript/threading", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/node": { + "version": "10.12.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.18.tgz", + "integrity": "sha512-fh+pAqt4xRzPfqA6eh3Z2y6fyZavRIumvjhaCL753+TVkGKGhpPeyrJG2JftD0T9q4GF00KjefsQ+PQNDdWQaQ==" + }, + "@types/webassembly-js-api": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@types/webassembly-js-api/-/webassembly-js-api-0.0.1.tgz", + "integrity": "sha1-YtULIBB319TMEJuxytoi/f1FI/s=", + "dev": true + }, + "@webassemblyjs/ast": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.7.8.tgz", + "integrity": "sha512-dOrtdtEyB8sInpl75yLPNksY4sRl0j/+t6aHyB/YA+ab9hV3Fo7FmG12FHzP+2MvWVAJtDb+6eXR5EZbZJ+uVg==", + "dev": true, + "requires": { + "@webassemblyjs/helper-module-context": "1.7.8", + "@webassemblyjs/helper-wasm-bytecode": "1.7.8", + "@webassemblyjs/wast-parser": "1.7.8" + } + }, + "@webassemblyjs/floating-point-hex-parser": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.7.8.tgz", + "integrity": "sha512-kn2zNKGsbql5i56VAgRYkpG+VazqHhQQZQycT2uXAazrAEDs23gy+Odkh5VblybjnwX2/BITkDtNmSO76hdIvQ==", + "dev": true + }, + "@webassemblyjs/helper-api-error": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.7.8.tgz", + "integrity": "sha512-xUwxDXsd1dUKArJEP5wWM5zxgCSwZApSOJyP1XO7M8rNUChUDblcLQ4FpzTpWG2YeylMwMl1MlP5Ztryiz1x4g==", + "dev": true + }, + "@webassemblyjs/helper-buffer": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.7.8.tgz", + "integrity": "sha512-WXiIMnuvuwlhWvVOm8xEXU9DnHaa3AgAU0ZPfvY8vO1cSsmYb2WbGbHnMLgs43vXnA7XAob9b56zuZaMkxpCBg==", + "dev": true + }, + "@webassemblyjs/helper-code-frame": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.7.8.tgz", + "integrity": "sha512-TLQxyD9qGOIdX5LPQOPo0Ernd88U5rHkFb8WAjeMIeA0sPjCHeVPaGqUGGIXjUcblUkjuDAc07bruCcNHUrHDA==", + "dev": true, + "requires": { + "@webassemblyjs/wast-printer": "1.7.8" + } + }, + "@webassemblyjs/helper-fsm": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.7.8.tgz", + "integrity": "sha512-TjK0CnD8hAPkV5mbSp5aWl6SO1+H3WFcjWtixWoy8EMA99YnNzYhpc/WSYWhf7yrhpzkq5tZB0tvLK3Svr3IXA==", + "dev": true + }, + "@webassemblyjs/helper-module-context": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.7.8.tgz", + "integrity": "sha512-uCutAKR7Nm0VsFixcvnB4HhAyHouNbj0Dx1p7eRjFjXGGZ+N7ftTaG1ZbWCasAEbtwGj54LP8+lkBZdTCPmLGg==", + "dev": true + }, + "@webassemblyjs/helper-wasm-bytecode": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.7.8.tgz", + "integrity": "sha512-AdCCE3BMW6V34WYaKUmPgVHa88t2Z14P4/0LjLwuGkI0X6pf7nzp0CehzVVk51cKm2ymVXjl9dCG+gR1yhITIQ==", + "dev": true + }, + "@webassemblyjs/helper-wasm-section": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.7.8.tgz", + "integrity": "sha512-BkBhYQuzyl4hgTGOKo87Vdw6f9nj8HhI7WYpI0MCC5qFa5ahrAPOGgyETVdnRbv+Rjukl9MxxfDmVcVC435lDg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/helper-buffer": "1.7.8", + "@webassemblyjs/helper-wasm-bytecode": "1.7.8", + "@webassemblyjs/wasm-gen": "1.7.8" + } + }, + "@webassemblyjs/ieee754": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.7.8.tgz", + "integrity": "sha512-tOarWChdG1a3y1yqCX0JMDKzrat5tQe4pV6K/TX19BcXsBLYxFQOL1DEDa5KG9syeyvCrvZ+i1+Mv1ExngvktQ==", + "dev": true, + "requires": { + "@xtuc/ieee754": "1.2.0" + } + }, + "@webassemblyjs/leb128": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.7.8.tgz", + "integrity": "sha512-GCYeGPgUFWJiZuP4NICbcyUQNxNLJIf476Ei+K+jVuuebtLpfvwkvYT6iTUE7oZYehhkor4Zz2g7SJ/iZaPudQ==", + "dev": true, + "requires": { + "@xtuc/long": "4.2.1" + } + }, + "@webassemblyjs/utf8": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.7.8.tgz", + "integrity": "sha512-9X+f0VV+xNXW2ujfIRSXBJENGE6Qh7bNVKqu3yDjTFB3ar3nsThsGBBKdTG58aXOm2iUH6v28VIf88ymPXODHA==", + "dev": true + }, + "@webassemblyjs/wasm-edit": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.7.8.tgz", + "integrity": "sha512-6D3Hm2gFixrfyx9XjSON4ml1FZTugqpkIz5Awvrou8fnpyprVzcm4X8pyGRtA2Piixjl3DqmX/HB1xdWyE097A==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/helper-buffer": "1.7.8", + "@webassemblyjs/helper-wasm-bytecode": "1.7.8", + "@webassemblyjs/helper-wasm-section": "1.7.8", + "@webassemblyjs/wasm-gen": "1.7.8", + "@webassemblyjs/wasm-opt": "1.7.8", + "@webassemblyjs/wasm-parser": "1.7.8", + "@webassemblyjs/wast-printer": "1.7.8" + } + }, + "@webassemblyjs/wasm-gen": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.7.8.tgz", + "integrity": "sha512-a7O/wE6eBeVKKUYgpMK7NOHmMADD85rSXLe3CqrWRDwWff5y3cSVbzpN6Qv3z6C4hdkpq9qyij1Ga1kemOZGvQ==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/helper-wasm-bytecode": "1.7.8", + "@webassemblyjs/ieee754": "1.7.8", + "@webassemblyjs/leb128": "1.7.8", + "@webassemblyjs/utf8": "1.7.8" + } + }, + "@webassemblyjs/wasm-opt": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.7.8.tgz", + "integrity": "sha512-3lbQ0PT81NHCdi1sR/7+SNpZadM4qYcTSr62nFFAA7e5lFwJr14M1Gi+A/Y3PgcDWOHYjsaNGPpPU0H03N6Blg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/helper-buffer": "1.7.8", + "@webassemblyjs/wasm-gen": "1.7.8", + "@webassemblyjs/wasm-parser": "1.7.8" + } + }, + "@webassemblyjs/wasm-parser": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.7.8.tgz", + "integrity": "sha512-rZ/zlhp9DHR/05zh1MbAjT2t624sjrPP/OkJCjXqzm7ynH+nIdNcn9Ixc+qzPMFXhIrk0rBoQ3to6sEIvHh9jQ==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/helper-api-error": "1.7.8", + "@webassemblyjs/helper-wasm-bytecode": "1.7.8", + "@webassemblyjs/ieee754": "1.7.8", + "@webassemblyjs/leb128": "1.7.8", + "@webassemblyjs/utf8": "1.7.8" + } + }, + "@webassemblyjs/wast-parser": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.7.8.tgz", + "integrity": "sha512-Q/zrvtUvzWuSiJMcSp90fi6gp2nraiHXjTV2VgAluVdVapM4gy1MQn7akja2p6eSBDQpKJPJ6P4TxRkghRS5dg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/floating-point-hex-parser": "1.7.8", + "@webassemblyjs/helper-api-error": "1.7.8", + "@webassemblyjs/helper-code-frame": "1.7.8", + "@webassemblyjs/helper-fsm": "1.7.8", + "@xtuc/long": "4.2.1" + } + }, + "@webassemblyjs/wast-printer": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.7.8.tgz", + "integrity": "sha512-GllIthRtwTxRDAURRNXscu7Napzmdf1jt1gpiZiK/QN4fH0lSGs3OTmvdfsMNP7tqI4B3ZtfaaWRlNIQug6Xyg==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/wast-parser": "1.7.8", + "@xtuc/long": "4.2.1" + } + }, + "@xtuc/ieee754": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", + "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", + "dev": true + }, + "@xtuc/long": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.1.tgz", + "integrity": "sha512-FZdkNBDqBRHKQ2MEbSC17xnPFOhZxeJ2YGSfr2BKf3sujG49Qe3bB+rGCwQfIaA7WHnGeGkSijX4FuBCdrzW/g==", + "dev": true + }, + "acorn": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", + "dev": true + }, + "acorn-dynamic-import": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-3.0.0.tgz", + "integrity": "sha512-zVWV8Z8lislJoOKKqdNMOB+s6+XV5WERty8MnKBeFgwA+19XJjJHs2RP5dzM57FftIs+jQnRToLiWazKr6sSWg==", + "dev": true, + "requires": { + "acorn": "5.7.3" + } + }, + "ajv": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", + "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", + "dev": true, + "requires": { + "fast-deep-equal": "2.0.1", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.4.1", + "uri-js": "4.2.2" + } + }, + "ajv-keywords": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", + "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "1.9.3" + } + }, + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "3.1.10", + "normalize-path": "2.1.1" + } + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asn1.js": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1" + } + }, + "assert": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", + "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", + "dev": true, + "requires": { + "util": "0.10.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true + }, + "util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "dev": true, + "requires": { + "inherits": "2.0.1" + } + } + } + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "async": { + "version": "1.5.2", + "resolved": "http://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=" + }, + "async-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", + "dev": true + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "1.0.1", + "class-utils": "0.3.6", + "component-emitter": "1.2.1", + "define-property": "1.0.0", + "isobject": "3.0.1", + "mixin-deep": "1.3.1", + "pascalcase": "0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + } + } + }, + "base64-js": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", + "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", + "dev": true + }, + "big.js": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", + "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", + "dev": true + }, + "binary-extensions": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.12.0.tgz", + "integrity": "sha512-DYWGk01lDcxeS/K9IHPGWfT8PsJmbXRtRd2Sx72Tnb8pcYZQFF1oSDb8hJtS1vhp212q1Rzi5dUf9+nq0o9UIg==", + "dev": true + }, + "bindings": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.1.tgz", + "integrity": "sha512-i47mqjF9UbjxJhxGf+pZ6kSxrnI3wBLlnGI2ArWJ4r0VrvDS7ZYXkprq/pLaBWYq4GM0r4zdHY+NNRqEMU7uew==" + }, + "bluebird": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.2.tgz", + "integrity": "sha512-dhHTWMI7kMx5whMQntl7Vr9C6BvV10lFXDAasnqnrMYhXVCzzk6IO9Fo2L75jXHT07WrOngL1WDXOp+yYS91Yg==", + "dev": true + }, + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "1.1.0", + "array-unique": "0.3.2", + "extend-shallow": "2.0.1", + "fill-range": "4.0.0", + "isobject": "3.0.1", + "repeat-element": "1.1.3", + "snapdragon": "0.8.2", + "snapdragon-node": "2.1.1", + "split-string": "3.1.0", + "to-regex": "3.0.2" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", + "dev": true + }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dev": true, + "requires": { + "buffer-xor": "1.0.3", + "cipher-base": "1.0.4", + "create-hash": "1.2.0", + "evp_bytestokey": "1.0.3", + "inherits": "2.0.3", + "safe-buffer": "5.1.2" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "dev": true, + "requires": { + "browserify-aes": "1.2.0", + "browserify-des": "1.0.2", + "evp_bytestokey": "1.0.3" + } + }, + "browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "dev": true, + "requires": { + "cipher-base": "1.0.4", + "des.js": "1.0.0", + "inherits": "2.0.3", + "safe-buffer": "5.1.2" + } + }, + "browserify-rsa": { + "version": "4.0.1", + "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "randombytes": "2.0.6" + } + }, + "browserify-sign": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", + "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "browserify-rsa": "4.0.1", + "create-hash": "1.2.0", + "create-hmac": "1.1.7", + "elliptic": "6.4.1", + "inherits": "2.0.3", + "parse-asn1": "5.1.1" + } + }, + "browserify-zlib": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", + "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", + "dev": true, + "requires": { + "pako": "1.0.6" + } + }, + "buffer": { + "version": "4.9.1", + "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", + "dev": true, + "requires": { + "base64-js": "1.3.0", + "ieee754": "1.1.12", + "isarray": "1.0.0" + } + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", + "dev": true + }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", + "dev": true + }, + "cacache": { + "version": "10.0.4", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz", + "integrity": "sha512-Dph0MzuH+rTQzGPNT9fAnrPmMmjKfST6trxJeK7NQuHRaVw24VzPRWTmg9MpcwOVQZO0E1FBICUlFeNaKPIfHA==", + "dev": true, + "requires": { + "bluebird": "3.5.2", + "chownr": "1.1.1", + "glob": "7.1.3", + "graceful-fs": "4.1.11", + "lru-cache": "4.1.3", + "mississippi": "2.0.0", + "mkdirp": "0.5.1", + "move-concurrently": "1.0.1", + "promise-inflight": "1.0.1", + "rimraf": "2.6.2", + "ssri": "5.3.0", + "unique-filename": "1.1.1", + "y18n": "4.0.0" + } + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "1.0.0", + "component-emitter": "1.2.1", + "get-value": "2.0.6", + "has-value": "1.0.0", + "isobject": "3.0.1", + "set-value": "2.0.0", + "to-object-path": "0.3.0", + "union-value": "1.0.0", + "unset-value": "1.0.0" + } + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.5.0" + } + }, + "chokidar": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.4.tgz", + "integrity": "sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ==", + "dev": true, + "requires": { + "anymatch": "2.0.0", + "async-each": "1.0.1", + "braces": "2.3.2", + "fsevents": "1.2.4", + "glob-parent": "3.1.0", + "inherits": "2.0.3", + "is-binary-path": "1.0.1", + "is-glob": "4.0.0", + "lodash.debounce": "4.0.8", + "normalize-path": "2.1.1", + "path-is-absolute": "1.0.1", + "readdirp": "2.2.1", + "upath": "1.1.0" + } + }, + "chownr": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", + "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", + "dev": true + }, + "chrome-trace-event": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.0.tgz", + "integrity": "sha512-xDbVgyfDTT2piup/h8dK/y4QZfJRSa73bw1WZ8b4XM1o7fsFubUVGYcE+1ANtOzJJELGpYoG2961z0Z6OAld9A==", + "dev": true, + "requires": { + "tslib": "1.9.3" + } + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dev": true, + "requires": { + "inherits": "2.0.3", + "safe-buffer": "5.1.2" + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "3.1.0", + "define-property": "0.2.5", + "isobject": "3.0.1", + "static-extend": "0.1.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + } + } + }, + "cliui": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", + "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", + "dev": true, + "requires": { + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "wrap-ansi": "2.1.0" + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "1.0.0", + "object-visit": "1.0.1" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "colors": { + "version": "1.0.3", + "resolved": "http://registry.npmjs.org/colors/-/colors-1.0.3.tgz", + "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=" + }, + "commander": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", + "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", + "dev": true + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "1.1.1", + "inherits": "2.0.3", + "readable-stream": "2.3.6", + "typedarray": "0.0.6" + } + }, + "console-browserify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", + "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", + "dev": true, + "requires": { + "date-now": "0.1.4" + } + }, + "constants-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", + "dev": true + }, + "copy-concurrently": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", + "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", + "dev": true, + "requires": { + "aproba": "1.2.0", + "fs-write-stream-atomic": "1.0.10", + "iferr": "0.1.5", + "mkdirp": "0.5.1", + "rimraf": "2.6.2", + "run-queue": "1.0.3" + } + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "corser": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz", + "integrity": "sha1-jtolLsqrWEDc2XXOuQ2TcMgZ/4c=" + }, + "create-ecdh": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", + "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "elliptic": "6.4.1" + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dev": true, + "requires": { + "cipher-base": "1.0.4", + "inherits": "2.0.3", + "md5.js": "1.3.5", + "ripemd160": "2.0.2", + "sha.js": "2.4.11" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dev": true, + "requires": { + "cipher-base": "1.0.4", + "create-hash": "1.2.0", + "inherits": "2.0.3", + "ripemd160": "2.0.2", + "safe-buffer": "5.1.2", + "sha.js": "2.4.11" + } + }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "1.0.5", + "path-key": "2.0.1", + "semver": "5.6.0", + "shebang-command": "1.2.0", + "which": "1.3.1" + } + }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "dev": true, + "requires": { + "browserify-cipher": "1.0.1", + "browserify-sign": "4.0.4", + "create-ecdh": "4.0.3", + "create-hash": "1.2.0", + "create-hmac": "1.1.7", + "diffie-hellman": "5.0.3", + "inherits": "2.0.3", + "pbkdf2": "3.0.17", + "public-encrypt": "4.0.3", + "randombytes": "2.0.6", + "randomfill": "1.0.4" + } + }, + "cyclist": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-0.2.2.tgz", + "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=", + "dev": true + }, + "date-now": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", + "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-2.0.0.tgz", + "integrity": "sha512-Ikpp5scV3MSYxY39ymh45ZLEecsTdv/Xj2CaQfI8RLMuwi7XvjX9H/fhraiSuU+C5w5NTDu4ZU72xNiZnurBPg==", + "dev": true, + "requires": { + "xregexp": "4.0.0" + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "1.0.2", + "isobject": "3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + } + } + }, + "des.js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", + "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1" + } + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "miller-rabin": "4.0.1", + "randombytes": "2.0.6" + } + }, + "domain-browser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", + "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", + "dev": true + }, + "duplexify": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.1.tgz", + "integrity": "sha512-vM58DwdnKmty+FSPzT14K9JXb90H+j5emaR4KYbr2KTIz00WHGbWOe5ghQTx233ZCLZtrGDALzKwcjEtSt35mA==", + "dev": true, + "requires": { + "end-of-stream": "1.4.1", + "inherits": "2.0.3", + "readable-stream": "2.3.6", + "stream-shift": "1.0.0" + } + }, + "ecstatic": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/ecstatic/-/ecstatic-3.3.0.tgz", + "integrity": "sha512-EblWYTd+wPIAMQ0U4oYJZ7QBypT9ZUIwpqli0bKDjeIIQnXDBK2dXtZ9yzRCOlkW1HkO8gn7/FxLK1yPIW17pw==", + "requires": { + "he": "1.2.0", + "mime": "1.6.0", + "minimist": "1.2.0", + "url-join": "2.0.5" + } + }, + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "brorand": "1.1.0", + "hash.js": "1.1.5", + "hmac-drbg": "1.0.1", + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1", + "minimalistic-crypto-utils": "1.0.1" + } + }, + "emojis-list": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", + "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", + "dev": true + }, + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "dev": true, + "requires": { + "once": "1.4.0" + } + }, + "enhanced-resolve": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz", + "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "memory-fs": "0.4.1", + "tapable": "1.1.0" + } + }, + "errno": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", + "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "dev": true, + "requires": { + "prr": "1.0.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "eslint-scope": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", + "dev": true, + "requires": { + "esrecurse": "4.2.1", + "estraverse": "4.2.0" + } + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "4.2.0" + } + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + }, + "eventemitter3": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" + }, + "events": { + "version": "1.1.1", + "resolved": "http://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", + "dev": true + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dev": true, + "requires": { + "md5.js": "1.3.5", + "safe-buffer": "5.1.2" + } + }, + "execa": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.10.0.tgz", + "integrity": "sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw==", + "dev": true, + "requires": { + "cross-spawn": "6.0.5", + "get-stream": "3.0.0", + "is-stream": "1.1.0", + "npm-run-path": "2.0.2", + "p-finally": "1.0.0", + "signal-exit": "3.0.2", + "strip-eof": "1.0.0" + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "posix-character-classes": "0.1.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "1.0.0", + "is-extendable": "1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "2.0.4" + } + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "0.3.2", + "define-property": "1.0.0", + "expand-brackets": "2.1.4", + "extend-shallow": "2.0.1", + "fragment-cache": "0.2.1", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + } + } + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-number": "3.0.0", + "repeat-string": "1.6.1", + "to-regex-range": "2.1.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "find-cache-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-1.0.0.tgz", + "integrity": "sha1-kojj6ePMN0hxfTnq3hfPcfww7m8=", + "dev": true, + "requires": { + "commondir": "1.0.1", + "make-dir": "1.3.0", + "pkg-dir": "2.0.0" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "2.0.0" + } + }, + "flush-write-stream": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz", + "integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.6" + } + }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "requires": { + "debug": "3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + } + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "0.2.2" + } + }, + "from2": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", + "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.6" + } + }, + "fs-write-stream-atomic": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", + "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "iferr": "0.1.5", + "imurmurhash": "0.1.4", + "readable-stream": "2.3.6" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", + "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", + "dev": true, + "optional": true, + "requires": { + "nan": "2.11.1", + "node-pre-gyp": "0.10.0" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "delegates": "1.0.0", + "readable-stream": "2.3.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "2.2.4" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aproba": "1.2.0", + "console-control-strings": "1.1.0", + "has-unicode": "2.0.1", + "object-assign": "4.1.1", + "signal-exit": "3.0.2", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wide-align": "1.1.2" + } + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.21", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safer-buffer": "2.1.2" + } + }, + "ignore-walk": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minimatch": "3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "1.1.11" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + }, + "minipass": { + "version": "2.2.4", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "5.1.1", + "yallist": "3.0.2" + } + }, + "minizlib": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "2.2.4" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "needle": { + "version": "2.2.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "2.6.9", + "iconv-lite": "0.4.21", + "sax": "1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.10.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "detect-libc": "1.0.3", + "mkdirp": "0.5.1", + "needle": "2.2.0", + "nopt": "4.0.1", + "npm-packlist": "1.1.10", + "npmlog": "4.1.2", + "rc": "1.2.7", + "rimraf": "2.6.2", + "semver": "5.5.0", + "tar": "4.4.1" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "abbrev": "1.1.1", + "osenv": "0.1.5" + } + }, + "npm-bundled": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.1.10", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ignore-walk": "3.0.1", + "npm-bundled": "1.0.3" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "1.1.4", + "console-control-strings": "1.1.0", + "gauge": "2.7.4", + "set-blocking": "2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.7", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "deep-extend": "0.5.1", + "ini": "1.3.5", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.1", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "rimraf": { + "version": "2.6.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "glob": "7.1.2" + } + }, + "safe-buffer": { + "version": "5.1.1", + "bundled": true, + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "dev": true, + "optional": true + }, + "semver": { + "version": "5.5.0", + "bundled": true, + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "5.1.1" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "4.4.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "chownr": "1.0.1", + "fs-minipass": "1.2.5", + "minipass": "2.2.4", + "minizlib": "1.1.0", + "mkdirp": "0.5.1", + "safe-buffer": "5.1.1", + "yallist": "3.0.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "wide-align": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "string-width": "1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "yallist": { + "version": "3.0.2", + "bundled": true, + "dev": true + } + } + }, + "get-caller-file": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "3.1.0", + "path-dirname": "1.0.2" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "2.1.1" + } + } + } + }, + "global-modules-path": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/global-modules-path/-/global-modules-path-2.3.0.tgz", + "integrity": "sha512-HchvMJNYh9dGSCy8pOQ2O8u/hoXaL+0XhnrwH0RyLiSXMMTl9W3N6KUU73+JFOg5PGjtzl6VZzUQsnrpm7Szag==", + "dev": true + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "2.0.6", + "has-values": "1.0.0", + "isobject": "3.0.1" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "3.0.0", + "kind-of": "4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "hash-base": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", + "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "safe-buffer": "5.1.2" + } + }, + "hash.js": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "dev": true, + "requires": { + "inherits": "2.0.3", + "minimalistic-assert": "1.0.1" + } + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==" + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, + "requires": { + "hash.js": "1.1.5", + "minimalistic-assert": "1.0.1", + "minimalistic-crypto-utils": "1.0.1" + } + }, + "http-proxy": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz", + "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==", + "requires": { + "eventemitter3": "3.1.0", + "follow-redirects": "1.5.10", + "requires-port": "1.0.0" + } + }, + "http-server": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/http-server/-/http-server-0.11.1.tgz", + "integrity": "sha512-6JeGDGoujJLmhjiRGlt8yK8Z9Kl0vnl/dQoQZlc4oeqaUoAKQg94NILLfrY3oWzSyFaQCVNTcKE5PZ3cH8VP9w==", + "requires": { + "colors": "1.0.3", + "corser": "2.0.1", + "ecstatic": "3.3.0", + "http-proxy": "1.17.0", + "opener": "1.4.3", + "optimist": "0.6.1", + "portfinder": "1.0.20", + "union": "0.4.6" + } + }, + "https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", + "dev": true + }, + "ieee754": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", + "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==", + "dev": true + }, + "iferr": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", + "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", + "dev": true + }, + "import-local": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", + "integrity": "sha512-b6s04m3O+s3CGSbqDIyP4R6aAwAeYlVq9+WUWep6iHa8ETRf9yei1U48C5MmfJmV9AiLYYBKPMq/W+/WRpQmCQ==", + "dev": true, + "requires": { + "pkg-dir": "3.0.0", + "resolve-cwd": "2.0.0" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "3.0.0", + "path-exists": "3.0.0" + } + }, + "p-limit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "dev": true, + "requires": { + "p-try": "2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", + "dev": true + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "3.0.0" + } + } + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "interpret": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", + "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", + "dev": true + }, + "invert-kv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", + "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "requires": { + "binary-extensions": "1.12.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "0.1.6", + "is-data-descriptor": "0.1.4", + "kind-of": "5.1.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", + "dev": true, + "requires": { + "is-extglob": "2.1.1" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "3.0.1" + } + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json5": { + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "lcid": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", + "integrity": "sha512-avPEb8P8EGnwXKClwsNUgryVjllcRqtMYa49NTsbQagYuT1DcXnl1915oxWjoyGrXR6zH/Y0Zc96xWsPcoDKeA==", + "dev": true, + "requires": { + "invert-kv": "2.0.0" + } + }, + "loader-runner": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.3.1.tgz", + "integrity": "sha512-By6ZFY7ETWOc9RFaAIb23IjJVcM4dvJC/N57nmdz9RSkMXvAXGI7SyVlAw3v8vjtDRlqThgVDVmTnr9fqMlxkw==", + "dev": true + }, + "loader-utils": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz", + "integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=", + "dev": true, + "requires": { + "big.js": "3.2.0", + "emojis-list": "2.1.0", + "json5": "0.5.1" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "2.0.0", + "path-exists": "3.0.0" + } + }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", + "dev": true + }, + "lru-cache": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", + "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + }, + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "requires": { + "pify": "3.0.0" + } + }, + "make-error": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", + "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==", + "dev": true + }, + "map-age-cleaner": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.2.tgz", + "integrity": "sha512-UN1dNocxQq44IhJyMI4TU8phc2m9BddacHRPRjKGLYaF0jqd3xLz0jS0skpAU9WgYyoR4gHtUpzytNBS385FWQ==", + "dev": true, + "requires": { + "p-defer": "1.0.0" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "1.0.1" + } + }, + "md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dev": true, + "requires": { + "hash-base": "3.0.4", + "inherits": "2.0.3", + "safe-buffer": "5.1.2" + } + }, + "mem": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-4.0.0.tgz", + "integrity": "sha512-WQxG/5xYc3tMbYLXoXPm81ET2WDULiU5FxbuIoNbJqLOOI8zehXFdZuiUEgfdrU2mVB1pxBZUGlYORSrpuJreA==", + "dev": true, + "requires": { + "map-age-cleaner": "0.1.2", + "mimic-fn": "1.2.0", + "p-is-promise": "1.1.0" + } + }, + "memory-fs": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", + "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", + "dev": true, + "requires": { + "errno": "0.1.7", + "readable-stream": "2.3.6" + } + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "braces": "2.3.2", + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "extglob": "2.0.4", + "fragment-cache": "0.2.1", + "kind-of": "6.0.2", + "nanomatch": "1.2.13", + "object.pick": "1.3.0", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + } + }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "brorand": "1.1.0" + } + }, + "mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "1.1.11" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "mississippi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-2.0.0.tgz", + "integrity": "sha512-zHo8v+otD1J10j/tC+VNoGK9keCuByhKovAvdn74dmxJl9+mWHnx6EMsDN4lgRoMI/eYo2nchAxniIbUPb5onw==", + "dev": true, + "requires": { + "concat-stream": "1.6.2", + "duplexify": "3.6.1", + "end-of-stream": "1.4.1", + "flush-write-stream": "1.0.3", + "from2": "2.3.0", + "parallel-transform": "1.1.0", + "pump": "2.0.1", + "pumpify": "1.5.1", + "stream-each": "1.2.3", + "through2": "2.0.3" + } + }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "dev": true, + "requires": { + "for-in": "1.0.2", + "is-extendable": "1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + } + } + }, + "move-concurrently": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", + "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", + "dev": true, + "requires": { + "aproba": "1.2.0", + "copy-concurrently": "1.0.5", + "fs-write-stream-atomic": "1.0.10", + "mkdirp": "0.5.1", + "rimraf": "2.6.2", + "run-queue": "1.0.3" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.1.tgz", + "integrity": "sha512-iji6k87OSXa0CcrLl9z+ZiYSuR2o+c0bGuNmXdrhTQTakxytAFsC56SArGYoiHlJlFoHSnvmhpceZJaXkVuOtA==" + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "4.0.0", + "array-unique": "0.3.2", + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "fragment-cache": "0.2.1", + "is-windows": "1.0.2", + "kind-of": "6.0.2", + "object.pick": "1.3.0", + "regex-not": "1.0.2", + "snapdragon": "0.8.2", + "to-regex": "3.0.2" + } + }, + "neo-async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.0.tgz", + "integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==", + "dev": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "node-libs-browser": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.1.0.tgz", + "integrity": "sha512-5AzFzdoIMb89hBGMZglEegffzgRg+ZFoUmisQ8HI4j1KDdpx13J0taNp2y9xPbur6W61gepGDDotGBVQ7mfUCg==", + "dev": true, + "requires": { + "assert": "1.4.1", + "browserify-zlib": "0.2.0", + "buffer": "4.9.1", + "console-browserify": "1.1.0", + "constants-browserify": "1.0.0", + "crypto-browserify": "3.12.0", + "domain-browser": "1.2.0", + "events": "1.1.1", + "https-browserify": "1.0.0", + "os-browserify": "0.3.0", + "path-browserify": "0.0.0", + "process": "0.11.10", + "punycode": "1.4.1", + "querystring-es3": "0.2.1", + "readable-stream": "2.3.6", + "stream-browserify": "2.0.1", + "stream-http": "2.8.3", + "string_decoder": "1.1.1", + "timers-browserify": "2.0.10", + "tty-browserify": "0.0.0", + "url": "0.11.0", + "util": "0.10.4", + "vm-browserify": "0.0.4" + }, + "dependencies": { + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + } + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "1.1.0" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "2.0.1" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "0.1.1", + "define-property": "0.2.5", + "kind-of": "3.2.2" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "3.0.1" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "3.0.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "opener": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/opener/-/opener-1.4.3.tgz", + "integrity": "sha1-XG2ixdflgx6P+jlklQ+NZnSskLg=" + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "requires": { + "minimist": "0.0.10", + "wordwrap": "0.0.3" + }, + "dependencies": { + "minimist": { + "version": "0.0.10", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=" + } + } + }, + "os-browserify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", + "dev": true + }, + "os-locale": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.0.1.tgz", + "integrity": "sha512-7g5e7dmXPtzcP4bgsZ8ixDVqA7oWYuEz4lOSujeWyliPai4gfVDiFIcwBg3aGCPnmSGfzOKTK3ccPn0CKv3DBw==", + "dev": true, + "requires": { + "execa": "0.10.0", + "lcid": "2.0.0", + "mem": "4.0.0" + } + }, + "p-defer": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", + "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-is-promise": { + "version": "1.1.0", + "resolved": "http://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", + "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "1.3.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "pako": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz", + "integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==", + "dev": true + }, + "parallel-transform": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.1.0.tgz", + "integrity": "sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY=", + "dev": true, + "requires": { + "cyclist": "0.2.2", + "inherits": "2.0.3", + "readable-stream": "2.3.6" + } + }, + "parse-asn1": { + "version": "5.1.1", + "resolved": "http://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", + "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", + "dev": true, + "requires": { + "asn1.js": "4.10.1", + "browserify-aes": "1.2.0", + "create-hash": "1.2.0", + "evp_bytestokey": "1.0.3", + "pbkdf2": "3.0.17" + } + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", + "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "pbkdf2": { + "version": "3.0.17", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", + "integrity": "sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA==", + "dev": true, + "requires": { + "create-hash": "1.2.0", + "create-hmac": "1.1.7", + "ripemd160": "2.0.2", + "safe-buffer": "5.1.2", + "sha.js": "2.4.11" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "dev": true, + "requires": { + "find-up": "2.1.0" + } + }, + "portfinder": { + "version": "1.0.20", + "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.20.tgz", + "integrity": "sha512-Yxe4mTyDzTd59PZJY4ojZR8F+E5e97iq2ZOHPz3HDgSvYC5siNad2tLooQ5y5QHyQhc3xVqvyk/eNA3wuoa7Sw==", + "requires": { + "async": "1.5.2", + "debug": "2.6.9", + "mkdirp": "0.5.1" + } + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "promise-inflight": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", + "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", + "dev": true + }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "dev": true, + "requires": { + "bn.js": "4.11.8", + "browserify-rsa": "4.0.1", + "create-hash": "1.2.0", + "parse-asn1": "5.1.1", + "randombytes": "2.0.6", + "safe-buffer": "5.1.2" + } + }, + "pump": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", + "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", + "dev": true, + "requires": { + "end-of-stream": "1.4.1", + "once": "1.4.0" + } + }, + "pumpify": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", + "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", + "dev": true, + "requires": { + "duplexify": "3.6.1", + "inherits": "2.0.3", + "pump": "2.0.1" + } + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "qs": { + "version": "2.3.3", + "resolved": "http://registry.npmjs.org/qs/-/qs-2.3.3.tgz", + "integrity": "sha1-6eha2+ddoLvkyOBHaghikPhjtAQ=" + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "dev": true + }, + "querystring-es3": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", + "dev": true + }, + "randombytes": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", + "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dev": true, + "requires": { + "randombytes": "2.0.6", + "safe-buffer": "5.1.2" + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "readdirp": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", + "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "micromatch": "3.1.10", + "readable-stream": "2.3.6" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "3.0.2", + "safe-regex": "1.1.0" + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" + }, + "resolve-cwd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", + "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", + "dev": true, + "requires": { + "resolve-from": "3.0.0" + } + }, + "resolve-from": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", + "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", + "dev": true + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "7.1.3" + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dev": true, + "requires": { + "hash-base": "3.0.4", + "inherits": "2.0.3" + } + }, + "run-queue": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", + "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", + "dev": true, + "requires": { + "aproba": "1.2.0" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "0.1.15" + } + }, + "schema-utils": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.7.tgz", + "integrity": "sha512-v/iwU6wvwGK8HbU9yi3/nhGzP0yGSuhQMzL6ySiec1FSrZZDkhm4noOSWzrNFo/jEc+SJY6jRTwuwbSXJPDUnQ==", + "dev": true, + "requires": { + "ajv": "6.5.4", + "ajv-keywords": "3.2.0" + } + }, + "semver": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", + "dev": true + }, + "serialize-javascript": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.5.0.tgz", + "integrity": "sha512-Ga8c8NjAAp46Br4+0oZ2WxJCwIzwP60Gq1YPgU+39PiTVxyed/iKE/zyZI6+UlVYH5Q4PaQdHhcegIFPZTUfoQ==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "split-string": "3.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true + }, + "sha.js": { + "version": "2.4.11", + "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dev": true, + "requires": { + "inherits": "2.0.3", + "safe-buffer": "5.1.2" + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "0.11.2", + "debug": "2.6.9", + "define-property": "0.2.5", + "extend-shallow": "2.0.1", + "map-cache": "0.2.2", + "source-map": "0.5.7", + "source-map-resolve": "0.5.2", + "use": "3.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "1.0.0", + "isobject": "3.0.1", + "snapdragon-util": "3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "1.0.2" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "6.0.2" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "1.0.0", + "is-data-descriptor": "1.0.0", + "kind-of": "6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "source-list-map": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.1.tgz", + "integrity": "sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, + "requires": { + "atob": "2.1.2", + "decode-uri-component": "0.2.0", + "resolve-url": "0.2.1", + "source-map-url": "0.4.0", + "urix": "0.1.0" + } + }, + "source-map-support": { + "version": "0.5.9", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.9.tgz", + "integrity": "sha512-gR6Rw4MvUlYy83vP0vxoVNzM6t8MUXqNuRsuBmBHQDu1Fh6X015FrLdgoDKcNdkwGubozq0P4N0Q37UyFVr1EA==", + "dev": true, + "requires": { + "buffer-from": "1.1.1", + "source-map": "0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "3.0.2" + } + }, + "ssri": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz", + "integrity": "sha512-XRSIPqLij52MtgoQavH/x/dU1qVKtWUAAZeOHsR9c2Ddi4XerFy3mc1alf+dLJKl9EUIm/Ht+EowFkTUOA6GAQ==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "0.2.5", + "object-copy": "0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "0.1.6" + } + } + } + }, + "stream-browserify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", + "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", + "dev": true, + "requires": { + "inherits": "2.0.3", + "readable-stream": "2.3.6" + } + }, + "stream-each": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz", + "integrity": "sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw==", + "dev": true, + "requires": { + "end-of-stream": "1.4.1", + "stream-shift": "1.0.0" + } + }, + "stream-http": { + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", + "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", + "dev": true, + "requires": { + "builtin-status-codes": "3.0.0", + "inherits": "2.0.3", + "readable-stream": "2.3.6", + "to-arraybuffer": "1.0.1", + "xtend": "4.0.1" + } + }, + "stream-shift": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", + "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "3.0.0" + } + }, + "tapable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.0.tgz", + "integrity": "sha512-IlqtmLVaZA2qab8epUXbVWRn3aB1imbDMJtjB3nu4X0NqPkcY/JH9ZtCBWKHWPxs8Svi9tyo8w2dBoi07qZbBA==", + "dev": true + }, + "through2": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "dev": true, + "requires": { + "readable-stream": "2.3.6", + "xtend": "4.0.1" + } + }, + "timers-browserify": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.10.tgz", + "integrity": "sha512-YvC1SV1XdOUaL6gx5CoGroT3Gu49pK9+TZ38ErPldOWW4j49GI1HKs9DV+KGq/w6y+LZ72W1c8cKz2vzY+qpzg==", + "dev": true, + "requires": { + "setimmediate": "1.0.5" + } + }, + "to-arraybuffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", + "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "3.2.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "1.1.6" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "2.0.2", + "extend-shallow": "3.0.2", + "regex-not": "1.0.2", + "safe-regex": "1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "3.0.0", + "repeat-string": "1.6.1" + } + }, + "ts-loader": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-5.2.2.tgz", + "integrity": "sha512-vM/TrEKXBqRYq5yLatsXyKFnYSpv53klmGtrILGlNqcMsxPVi8+e4yr1Agbu9oMZepx/4szDVn5QpFo83IQdQg==", + "dev": true, + "requires": { + "chalk": "2.4.1", + "enhanced-resolve": "4.1.0", + "loader-utils": "1.1.0", + "micromatch": "3.1.10", + "semver": "5.6.0" + } + }, + "ts-node": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-6.2.0.tgz", + "integrity": "sha512-ZNT+OEGfUNVMGkpIaDJJ44Zq3Yr0bkU/ugN1PHbU+/01Z7UV1fsELRiTx1KuQNvQ1A3pGh3y25iYF6jXgxV21A==", + "dev": true, + "requires": { + "arrify": "1.0.1", + "buffer-from": "1.1.1", + "diff": "3.5.0", + "make-error": "1.3.5", + "minimist": "1.2.0", + "mkdirp": "0.5.1", + "source-map-support": "0.5.9", + "yn": "2.0.0" + } + }, + "tsc": { + "version": "1.20150623.0", + "resolved": "https://registry.npmjs.org/tsc/-/tsc-1.20150623.0.tgz", + "integrity": "sha1-Trw8d04WkUjLx2inNCUz8ILHpuU=" + }, + "tslib": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", + "dev": true + }, + "tty-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", + "dev": true + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "typescript": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.2.tgz", + "integrity": "sha512-VCj5UiSyHBjwfYacmDuc/NOk4QQixbE+Wn7MFJuS0nRuPQbof132Pw4u53dm264O8LPc2MVsc7RJNml5szurkg==", + "dev": true + }, + "uglify-es": { + "version": "3.3.9", + "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", + "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", + "dev": true, + "requires": { + "commander": "2.13.0", + "source-map": "0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "uglifyjs-webpack-plugin": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.3.0.tgz", + "integrity": "sha512-ovHIch0AMlxjD/97j9AYovZxG5wnHOPkL7T1GKochBADp/Zwc44pEWNqpKl1Loupp1WhFg7SlYmHZRUfdAacgw==", + "dev": true, + "requires": { + "cacache": "10.0.4", + "find-cache-dir": "1.0.0", + "schema-utils": "0.4.7", + "serialize-javascript": "1.5.0", + "source-map": "0.6.1", + "uglify-es": "3.3.9", + "webpack-sources": "1.3.0", + "worker-farm": "1.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "union": { + "version": "0.4.6", + "resolved": "http://registry.npmjs.org/union/-/union-0.4.6.tgz", + "integrity": "sha1-GY+9rrolTniLDvy2MLwR8kopWeA=", + "requires": { + "qs": "2.3.3" + } + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "3.1.0", + "get-value": "2.0.6", + "is-extendable": "0.1.1", + "set-value": "0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "0.1.1" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "2.0.1", + "is-extendable": "0.1.1", + "is-plain-object": "2.0.4", + "to-object-path": "0.3.0" + } + } + } + }, + "unique-filename": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.1.tgz", + "integrity": "sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ==", + "dev": true, + "requires": { + "unique-slug": "2.0.1" + } + }, + "unique-slug": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.1.tgz", + "integrity": "sha512-n9cU6+gITaVu7VGj1Z8feKMmfAjEAQGhwD9fE3zvpRRa0wEIx8ODYkVGfSc94M2OX00tUFV8wH3zYbm1I8mxFg==", + "dev": true, + "requires": { + "imurmurhash": "0.1.4" + } + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "0.3.1", + "isobject": "3.0.1" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "2.0.6", + "has-values": "0.1.4", + "isobject": "2.1.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + } + } + }, + "upath": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz", + "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==", + "dev": true + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "2.1.1" + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", + "dev": true + } + } + }, + "url-join": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-2.0.5.tgz", + "integrity": "sha1-WvIvGMBSoACkjXuCxenC4v7tpyg=" + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "v8-compile-cache": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.2.tgz", + "integrity": "sha512-1wFuMUIM16MDJRCrpbpuEPTUGmM5QMUg0cr3KFwra2XgOgFcPGDQHDh3CszSCD2Zewc/dh/pamNEW8CbfDebUw==", + "dev": true + }, + "vm-browserify": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", + "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", + "dev": true, + "requires": { + "indexof": "0.0.1" + } + }, + "watchpack": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", + "integrity": "sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==", + "dev": true, + "requires": { + "chokidar": "2.0.4", + "graceful-fs": "4.1.11", + "neo-async": "2.6.0" + } + }, + "webpack": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.21.0.tgz", + "integrity": "sha512-CGBeop4AYR0dcmk9Afl33qQULwTHQCXQPAIBTHMJoy9DpY8FPUDna/NUlAGTr5o5y9QC901Ww3wCY4wNo1X9Lw==", + "dev": true, + "requires": { + "@webassemblyjs/ast": "1.7.8", + "@webassemblyjs/helper-module-context": "1.7.8", + "@webassemblyjs/wasm-edit": "1.7.8", + "@webassemblyjs/wasm-parser": "1.7.8", + "acorn": "5.7.3", + "acorn-dynamic-import": "3.0.0", + "ajv": "6.5.4", + "ajv-keywords": "3.2.0", + "chrome-trace-event": "1.0.0", + "enhanced-resolve": "4.1.0", + "eslint-scope": "4.0.0", + "json-parse-better-errors": "1.0.2", + "loader-runner": "2.3.1", + "loader-utils": "1.1.0", + "memory-fs": "0.4.1", + "micromatch": "3.1.10", + "mkdirp": "0.5.1", + "neo-async": "2.6.0", + "node-libs-browser": "2.1.0", + "schema-utils": "0.4.7", + "tapable": "1.1.0", + "uglifyjs-webpack-plugin": "1.3.0", + "watchpack": "1.6.0", + "webpack-sources": "1.3.0" + } + }, + "webpack-cli": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.1.2.tgz", + "integrity": "sha512-Cnqo7CeqeSvC6PTdts+dywNi5CRlIPbLx1AoUPK2T6vC1YAugMG3IOoO9DmEscd+Dghw7uRlnzV1KwOe5IrtgQ==", + "dev": true, + "requires": { + "chalk": "2.4.1", + "cross-spawn": "6.0.5", + "enhanced-resolve": "4.1.0", + "global-modules-path": "2.3.0", + "import-local": "2.0.0", + "interpret": "1.1.0", + "loader-utils": "1.1.0", + "supports-color": "5.5.0", + "v8-compile-cache": "2.0.2", + "yargs": "12.0.2" + } + }, + "webpack-sources": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.3.0.tgz", + "integrity": "sha512-OiVgSrbGu7NEnEvQJJgdSFPl2qWKkWq5lHMhgiToIiN9w34EBnjYzSYs+VbL5KoYiLNtFFa7BZIKxRED3I32pA==", + "dev": true, + "requires": { + "source-list-map": "2.0.1", + "source-map": "0.6.1" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "webworker-threads": { + "version": "0.7.17", + "resolved": "https://registry.npmjs.org/webworker-threads/-/webworker-threads-0.7.17.tgz", + "integrity": "sha512-Y2w2aXBbDLk9IzTEb9u+MsODC3s4YlGI7g4h0t+1OAwIO8yBI9rQL35ZYlyayiCuWu1dZMH/P7kGU8OwW7YsyA==", + "requires": { + "bindings": "1.3.1", + "nan": "2.11.1" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" + }, + "worker-farm": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.6.0.tgz", + "integrity": "sha512-6w+3tHbM87WnSWnENBUvA2pxJPLhQUg5LKwUQHq3r+XPhIM+Gh2R5ycbwPCyuGbNg+lPgdcnQUhuC02kJCvffQ==", + "dev": true, + "requires": { + "errno": "0.1.7" + } + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "1.0.2", + "strip-ansi": "3.0.1" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "2.1.1" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "xregexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.0.0.tgz", + "integrity": "sha512-PHyM+sQouu7xspQQwELlGwwd05mXUFqwFYfqPO0cC7x4fxyHnnuetmQr6CjJiafIDoH4MogHb9dOoJzR/Y4rFg==", + "dev": true + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, + "y18n": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", + "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs": { + "version": "12.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.2.tgz", + "integrity": "sha512-e7SkEx6N6SIZ5c5H22RTZae61qtn3PYUE8JYbBFlK9sYmh3DMQ6E5ygtaG/2BW0JZi4WGgTR2IV5ChqlqrDGVQ==", + "dev": true, + "requires": { + "cliui": "4.1.0", + "decamelize": "2.0.0", + "find-up": "3.0.0", + "get-caller-file": "1.0.3", + "os-locale": "3.0.1", + "require-directory": "2.1.1", + "require-main-filename": "1.0.1", + "set-blocking": "2.0.0", + "string-width": "2.1.1", + "which-module": "2.0.0", + "y18n": "4.0.0", + "yargs-parser": "10.1.0" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "3.0.0", + "path-exists": "3.0.0" + } + }, + "p-limit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "dev": true, + "requires": { + "p-try": "2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", + "dev": true + } + } + }, + "yargs-parser": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "dev": true, + "requires": { + "camelcase": "4.1.0" + } + }, + "yn": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", + "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=", + "dev": true + } + } +} diff --git a/lib/threading/package.json b/lib/threading/package.json new file mode 100644 index 0000000000..ff18ef958d --- /dev/null +++ b/lib/threading/package.json @@ -0,0 +1,38 @@ +{ + "name": "@assemblyscript/threading", + "version": "1.0.0", + "license": "Apache-2.0", + "main": "index.js", + "types": "index.d.ts", + "scripts": { + "asbuild": "asc assembly/index.ts -O3 -b build/index.wasm -t build/index.wat --importMemory --sourceMap --importMemory --sharedMemory=256 --validate", + "asbuild:memory": "../../bin/asc test/assembly/index.ts -b test/build/index.memory -t test/build/memory.wat --sourceMap --sharedMemory=256 --validate", + "asbuild:test": "npm run asbuild:memory && ../../bin/asc test/assembly/index.ts --ignoreDataSegments -b test/build/index.wasm -t test/build/index.wat --importMemory --sourceMap --debug --sharedMemory=256 --validate", + "build": "npm run asbuild && webpack --mode production --display-modules", + "server": "http-server ./test -o -c-1", + "test": "webpack --mode development --display-modules && npm run asbuild:test" + }, + "files": [ + "package.json", + "index.d.ts", + "index.js", + "index.js.map", + "src/", + "README.md" + ], + "dependencies": { + "@types/node": "^10.12.18", + "http-server": "^0.11.1", + "tsc": "^1.20150623.0", + "webworker-threads": "^0.7.17" + }, + "devDependencies": { + "@types/webassembly-js-api": "0.0.1", + "assemblyscript": "AssemblyScript/assemblyscript", + "ts-loader": "^5.2.1", + "ts-node": "^6.2.0", + "typescript": "^3.2.2", + "webpack": "^4.20.2", + "webpack-cli": "^3.1.2" + } +} diff --git a/lib/threading/src/common.ts b/lib/threading/src/common.ts new file mode 100644 index 0000000000..0ac762e1e6 --- /dev/null +++ b/lib/threading/src/common.ts @@ -0,0 +1,24 @@ +type i32 = number; + +declare class Mailbox { + push(t: T): void; + pop(): T; + +} +export declare class Worker { + array: Mailbox; + alive: boolean; + id: i32; + + + static start(worker: Worker): void; + + run(): void; + + init(): void ; + + onmessage(message: i32): void; + + postMessage(message: i32): void ; + +} diff --git a/lib/threading/src/index.ts b/lib/threading/src/index.ts new file mode 100644 index 0000000000..d78a83a807 --- /dev/null +++ b/lib/threading/src/index.ts @@ -0,0 +1,149 @@ + +// import { Worker } from 'webworker-threads'; +import {Worker as WebWorker} from "./common"; +import * as loader from "../../loader"; +/** Cached compiled parser. */ +var compiled: WebAssembly.Module | null = null; +// type fetch = (string)=> Buffer; + +type WorkerInstance = WebWorker & + {memory: WebAssembly.Memory, myStart:()=>void, + startChild:(Worker)=>void, + Worker:WebWorker} & + loader.ASUtil; + +async function fork(parent: (WorkerInstance), worker: number) { + let newWorker = new Worker("./webworker.js"); + newWorker.postMessage({command: "fork", memory: parent.memory, worker}) + return newWorker; +} + +let notify = Atomics.wake; + +type i32 = number; +type int = number; + +type usize = number; + + + + +export default class Thread { + instance: WorkerInstance; + id: number; + static thread: Thread; + + + constructor(public address: string, public wasm: WebAssembly.Module) { + Thread.thread = this; + } + + + static async create(address: string, memory = Thread.defaultMemory): Promise { + let buf = await fetch(address); + let wasm = await WebAssembly.compile(await buf.arrayBuffer()); + let thread = new Thread(address, wasm); + thread.instance = await thread.load(memory, wasm); + return thread; + } + + static defaultMemory(): WebAssembly.Memory { + return new WebAssembly.Memory({ + initial: 256, + shared: true, + maximum: 256 + }); + } + + fork(worker: number): Worker { + let newWorker = new Worker("./webworker.js"); + let address = this.address; + let lastdot = address.lastIndexOf("."); + address = address.slice(0,lastdot) + ".wasm"; + newWorker.postMessage({command: "fork", address: address, memory: this.memory, worker}) + return newWorker; + } + + async load(memory, mod: WebAssembly.Module) { + var wasm: WebAssembly.Module; + let instance; + if (typeof mod === "string") { + let buf = await fetch(mod); + wasm = await WebAssembly.compile(await buf.arrayBuffer()); + } else { + wasm = mod; + } + // var w = new Worker('worker.js'); // Standard API + var imports = { + env: { memory }, + index: { + log_str: (x:number) => { return console.log(instance.getString(x)); }, + fork: (worker: number) => { + console.log(`Worker is located at ${worker>>2}`); + return this.fork(worker); }, + log: (type, x) => console.log(x), + wait: (ptr: usize, value: number, timeout: number) => { + if (timeout === -1) { timeout = Infinity; } + console.log(`About to wait on location: ${ptr>>2}`); + let res = Atomics.wait(instance.I32, ptr >> 2, value, timeout); + console.log(`Woken waiting on ${ptr/4} with result: ${res}`); + }, + notify: (ptr, numAgents) => { return notify(instance.I32, ptr >> 2, numAgents); }, + print: console.log, + printMemory: (start:number = 0)=> console.log(instance.I32.slice(start)), + debug:()=>{let x =1; debugger;}, + loc: (x)=>{ + console.log("getting location: " + x); + return x;} + } + }; + instance = await loader.instantiate(wasm, imports); + return instance + } + + start(): void{ + this.instance.myStart(); + } + + startChild(id: number): void { + this.id = id + this.instance.startChild(id); + } + + + + static onMessageReceived(e) { + try { + const data = e.data; + debugger; + switch (data.command) { + case "start": { + (async (address: string) =>{ + let thread = await Thread.create(address); + thread.start(); + debugger; + })(data.address); + break; + } + case "fork": { + (async function (address, memory, worker) { + debugger; + let thread = await Thread.create(address, memory); + thread.startChild(worker) + })(data.address, data.memory, data.worker) + break; + } + + } + }catch(e){ + console.log(e); + } + } + + get memory(): WebAssembly.Memory { + return this.instance.memory; + } +} + + +addEventListener("message", Thread.onMessageReceived, false); diff --git a/lib/threading/src/tsconfig.json b/lib/threading/src/tsconfig.json new file mode 100644 index 0000000000..4743842090 --- /dev/null +++ b/lib/threading/src/tsconfig.json @@ -0,0 +1,12 @@ +{ + /* "extends": "../../../tsconfig-base.json", */ + "compilerOptions": { + "outDir": "../out", + "module": "commonjs", + "lib":["es2015", "es2016", "es2017","es2017.sharedmemory", "webworker"], + "target":"es2017" + }, + "include": [ + "./**/*.ts" + ] +} diff --git a/lib/threading/test/assembly/index.ts b/lib/threading/test/assembly/index.ts new file mode 100644 index 0000000000..d86ed7dfd9 --- /dev/null +++ b/lib/threading/test/assembly/index.ts @@ -0,0 +1,37 @@ +// import "allocator/atomic"; +import { itoa } from "internal/number"; +export { memory }; +declare function log_str(v: string): void; +declare function log(t:T):void; +// declare function fetch(v: string, cb: int): void; + +import {Worker, startWorker, Lock, Mailbox } from "../../assembly"; + + +export function myStart(): void{ + let worker1 = new Worker(); + log(worker1); + worker1.postMessage(424242); +} + +export function startChild(worker: Worker): void{ + worker.run(); +} + +export {Worker, Mailbox, Lock} + + +export function postMessage(worker: Worker, x: i32): void { + worker.postMessage(x); +} + +export {startWorker}; + + +export function getLock(l: usize): void { + Lock.acquire(l); +} + +export function releaseLock(l: usize): void { + Lock.release(l); +} diff --git a/lib/threading/test/assembly/tsconfig.json b/lib/threading/test/assembly/tsconfig.json new file mode 100644 index 0000000000..449ca07c76 --- /dev/null +++ b/lib/threading/test/assembly/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../../../std/assembly.json", + "include": [ + "./**/*.ts" + ] +} \ No newline at end of file diff --git a/lib/threading/test/index.html b/lib/threading/test/index.html new file mode 100644 index 0000000000..06576f72af --- /dev/null +++ b/lib/threading/test/index.html @@ -0,0 +1,60 @@ + + + + + Shared Memory - AssemblyScript + + + + + + +

+ Shared Memory in + AssemblyScript + ( + source ) +

+ + + + diff --git a/lib/threading/test/index.js b/lib/threading/test/index.js new file mode 100644 index 0000000000..49cee68bb6 --- /dev/null +++ b/lib/threading/test/index.js @@ -0,0 +1,24 @@ +// var fs = require("fs"); +// import {WebWorker} from ".."; +// var loader = require("../../loader"); +// var Worker = require('webworker-threads').Worker; + +var memory = new WebAssembly.Memory({ + initial: 256, + shared: true, + maximum: 256 +}); +var memoryView = new DataView(memory.buffer); +let worker; +// let instance; + +async function start(){ + worker = new Worker("./webworker.js"); + let address = "./build/index.memory"; + // let wasm = await fetch("./build/memory.wasm"); + // wasm = await WebAssembly.compile(await wasm.arrayBuffer()); + // instance = await WebAssembly.instantiate(wasm, {env: memory}); + worker.postMessage({command:"start", address}) + +} +start(); diff --git a/lib/threading/test/index.ts b/lib/threading/test/index.ts new file mode 100644 index 0000000000..9dea7379d8 --- /dev/null +++ b/lib/threading/test/index.ts @@ -0,0 +1,63 @@ +import * as fs from "fs"; +// import {WebWorker} from ".."; +import * as loader from "../../loader"; +var Worker = require('webworker-threads').Worker; + +type ThreadLoader = loader.ASUtil & {memory:WebAssembly.Memory}; + +const memory = new WebAssembly.Memory({ + initial: 256, + shared: true, + maximum: 256, +}); + +const memoryView = new DataView(memory.buffer); + +var workers: number[] = []; +let wasm = fs.readFileSync('./build/index.wasm'); + +function fork(parentInstance: ThreadLoader, worker: number){ + let instance: (ThreadLoader & {startChild:(number)=>void}); + workers.push(new Worker(() => { + instance = loader.instantiateBuffer(wasm, + { + env: {memory:parentInstance.memory}, + index: { + log_str:(x) => console.log(instance.getString(x)), + fork: (worker) => fork(instance, worker), + log:console.log, + wait: (ptr, value, timeout = -1) => { + Atomics.wait(ptr,value, timeout); + }, + notify: (ptr, numAgents) => Atomics.notify(ptr,numAgents), + print:console.log + } + } + ); + instance.startChild(worker); + })) + +} +async function main(){ + let instance: ThreadLoader & {start:()=>void}; + + // var w = new Worker('worker.js'); // Standard API + let imports: loader.ImportsObject = { + env: {memory}, + index: { + log_str:(x) => console.log(instance.getString(x)), + fork: (worker) => fork(instance, worker), + log:console.log, + wait: (ptr, value, timeout = -1) => { + Atomics.wait(ptr,value, timeout); + }, + notify: (ptr, numAgents) => Atomics.notify(ptr, numAgents), + print:console.log + } + } + + instance = loader.instantiateBuffer(wasm, imports); + instance.start(); +} + +main(); diff --git a/lib/threading/test/loader.js b/lib/threading/test/loader.js new file mode 120000 index 0000000000..2db896a635 --- /dev/null +++ b/lib/threading/test/loader.js @@ -0,0 +1 @@ +../../loader/index.js \ No newline at end of file diff --git a/lib/threading/test/webworker.js b/lib/threading/test/webworker.js new file mode 120000 index 0000000000..e234193f2d --- /dev/null +++ b/lib/threading/test/webworker.js @@ -0,0 +1 @@ +../index.js \ No newline at end of file diff --git a/lib/threading/test/worker.js b/lib/threading/test/worker.js new file mode 100644 index 0000000000..90bfa07eca --- /dev/null +++ b/lib/threading/test/worker.js @@ -0,0 +1,81 @@ +var workers = []; +let exports = {}; +importScripts("./loader.js") +let loader = exports; +function fork(wasm, parentInstance, worker) { + // var wasm = await fetch('./build/index.wasm'); + // wasm = await wasm.arrayBuffer(); + let instance; + workers.push(new Worker("./worker.js")); + workers[workers.length-1].postMessage({command: "fork", wasm, memory: parentInstance.memory, worker}) +} +var instance; + +async function load(memory, mod) { + var wasm; + if (!mod){ + wasm = await fetch('./build/index.wasm'); + wasm = await WebAssembly.compile(await wasm.arrayBuffer()); + }else{ + wasm = mod; + } + // var w = new Worker('worker.js'); // Standard API + var imports = { + env: { memory }, + index: { + log_str: function (x) { return console.log(instance.getString(x)); }, + fork: function (worker) { + console.log(`Worker is located at ${worker/4}`); + return fork(wasm, instance, worker); }, + log: (x) => console.log(x), + wait: function (ptr, value, timeout) { + if (timeout === -1) { timeout = Infinity; } + console.log(`About to wait on location: ${ptr/4}`); + let res = Atomics.wait(instance.I32, ptr/4, value, timeout); + console.log(`Woken waiting on ${ptr/4} with result: ${res}`); + }, + notify: function (ptr, numAgents) { return Atomics.notify(instance.I32, ptr/4, numAgents); }, + print: console.log, + debug:()=>{let x =1; debugger;}, + loc: (x)=>{ + console.log("getting location: " + x); + return x;}, + printMemory: () => { + console.log(instance.I32); + } + } + }; + instance = await instantiate(wasm, imports); + return instance +} + +addEventListener("message", onMessageReceived, false); + +function onMessageReceived(e){ + try { + const data = e.data; + switch (data.command) { + case "start": { + (async () =>{ + wasm = await fetch('./build/index.memory'); + wasm = await WebAssembly.compile(await wasm.arrayBuffer()); + instance = await load(data.memory, wasm); + instance.myStart(); + debugger; + + })() + break; + } + case "fork": { + (async function (wasm, memory, worker) { + instance = await load(memory); + instance.startChild(worker); + })(data.wasm, data.memory, data.worker) + break; + } + + } + }catch(e){ + console.log(e); + } +} diff --git a/lib/threading/webpack.config.js b/lib/threading/webpack.config.js new file mode 100644 index 0000000000..40f981710c --- /dev/null +++ b/lib/threading/webpack.config.js @@ -0,0 +1,37 @@ +const fs = require("fs"); +const path = require("path"); +const webpack = require("webpack"); + +const wasmData = fs.readFileSync(__dirname + "/build/index.wasm"); + +module.exports = { + entry: [ "./src/index.ts" ], + module: { + rules: [ + { + test: /\.ts$/, + use: "ts-loader", + exclude: /node_modules/ + } + ] + }, + resolve: { + extensions: [ ".ts", ".js" ] + }, + node: { + fs: false + }, + output: { + filename: "index.js", + path: __dirname, + library: "thread", + libraryTarget: "umd", + globalObject: "typeof self !== 'undefined' ? self : this" + }, + plugins: [ + // new webpack.DefinePlugin({ + // WASM_DATA: JSON.stringify(wasmData.toString("base64")) + // }) + ], + devtool: "source-map" +}; diff --git a/package.json b/package.json index c6ebff9e25..64ea1b6522 100644 --- a/package.json +++ b/package.json @@ -45,9 +45,10 @@ "check:config": "tsc --noEmit -p src --diagnostics --listFiles", "check:compiler": "tslint -c tslint.json --project src --formatters-dir lib/lint/formatters --format as", "check:library": "tslint -c tslint.json --project std/assembly --formatters-dir lib/lint/formatters --format as", - "test": "npm run test:parser && npm run test:compiler", + "test": "npm run test:parser && npm run test:compiler && npm run test:compiler.shared-memory", "test:parser": "node tests/parser", "test:compiler": "node tests/compiler", + "test:compiler.shared-memory": "node --experimental-wasm-threads tests/compiler.shared-memory", "make": "npm run clean && npm test && npm run build && npm test", "all": "npm run check && npm run make", "docs": "typedoc --tsconfig tsconfig-docs.json --mode modules --name \"AssemblyScript Compiler API\" --out ./docs/api --ignoreCompilerErrors --excludeNotExported --excludePrivate --excludeExternals --exclude **/std/** --includeDeclarations --readme src/README.md" diff --git a/src/builtins.ts b/src/builtins.ts index df55586014..3052bbd732 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -39,7 +39,8 @@ import { getExpressionType, getConstValueI64High, getConstValueI64Low, - getConstValueI32 + getConstValueI32, + AtomicRMWOp } from "./module"; import { @@ -50,7 +51,8 @@ import { OperatorKind, FlowFlags, Global, - DecoratorFlags + DecoratorFlags, + Element } from "./program"; import { @@ -1638,6 +1640,416 @@ export function compileCall( compiler.currentType = Type.void; return module.createStore(typeArguments[0].byteSize, arg0, arg1, type.toNativeType(), offset); } + case "Atomic.load": { // Atomic.load(offset: usize, constantOffset?: usize) -> * + if (operands.length < 1 || operands.length > 2) { + if (!(typeArguments && typeArguments.length == 1)) { + compiler.error( + DiagnosticCode.Expected_0_type_arguments_but_got_1, + reportNode.range, "1", typeArguments ? typeArguments.length.toString(10) : "0" + ); + } + if (operands.length < 1) { + compiler.error( + DiagnosticCode.Expected_at_least_0_arguments_but_got_1, + reportNode.range, "1", operands.length.toString(10) + ); + } else { + compiler.error( + DiagnosticCode.Expected_0_arguments_but_got_1, + reportNode.range, "2", operands.length.toString(10) + ); + } + return module.createUnreachable(); + } + if (!(typeArguments && typeArguments.length == 1)) { + if (typeArguments && typeArguments.length) compiler.currentType = typeArguments[0]; + compiler.error( + DiagnosticCode.Expected_0_type_arguments_but_got_1, + reportNode.range, "1", typeArguments ? typeArguments.length.toString(10) : "0" + ); + return module.createUnreachable(); + } + arg0 = compiler.compileExpression( + operands[0], + compiler.options.usizeType, + ConversionKind.IMPLICIT, + WrapMode.NONE + ); + let offset = operands.length == 2 ? evaluateConstantOffset(compiler, operands[1]) : 0; // reports + if (offset < 0) { // reported in evaluateConstantOffset + return module.createUnreachable(); + } + compiler.currentType = typeArguments[0]; + return module.createAtomicLoad( + typeArguments[0].byteSize, + arg0, + typeArguments[0].is(TypeFlags.INTEGER) && + contextualType.is(TypeFlags.INTEGER) && + contextualType.size > typeArguments[0].size + ? (compiler.currentType = contextualType).toNativeType() + : (compiler.currentType = typeArguments[0]).toNativeType(), + offset + ); + } + case "Atomic.store": { // Atomic.store(offset: usize, value: *, constantOffset?: usize) -> void + compiler.currentType = Type.void; + if (operands.length < 2 || operands.length > 3) { + if (!(typeArguments && typeArguments.length == 1)) { + compiler.error( + DiagnosticCode.Expected_0_type_arguments_but_got_1, + reportNode.range, "1", typeArguments ? typeArguments.length.toString(10) : "0" + ); + } + if (operands.length < 2) { + compiler.error( + DiagnosticCode.Expected_at_least_0_arguments_but_got_1, + reportNode.range, "2", operands.length.toString(10) + ); + } else { + compiler.error( + DiagnosticCode.Expected_0_arguments_but_got_1, + reportNode.range, "3", operands.length.toString(10) + ); + } + return module.createUnreachable(); + } + if (!(typeArguments && typeArguments.length == 1)) { + compiler.error( + DiagnosticCode.Expected_0_type_arguments_but_got_1, + reportNode.range, "1", typeArguments ? typeArguments.length.toString(10) : "0" + ); + return module.createUnreachable(); + } + arg0 = compiler.compileExpression( + operands[0], + compiler.options.usizeType, + ConversionKind.IMPLICIT, + WrapMode.NONE + ); + arg1 = compiler.compileExpression( + operands[1], + typeArguments[0], + typeArguments[0].is(TypeFlags.INTEGER) + ? ConversionKind.NONE // no need to convert to small int (but now might result in a float) + : ConversionKind.IMPLICIT, + WrapMode.NONE + ); + let type: Type; + if ( + typeArguments[0].is(TypeFlags.INTEGER) && + ( + !compiler.currentType.is(TypeFlags.INTEGER) || // float to int + compiler.currentType.size < typeArguments[0].size // int to larger int (clear garbage bits) + ) + ) { + arg1 = compiler.convertExpression( + arg1, + compiler.currentType, typeArguments[0], + ConversionKind.IMPLICIT, + WrapMode.NONE, // still clears garbage bits + operands[1] + ); + type = typeArguments[0]; + } else { + type = compiler.currentType; + } + let offset = operands.length == 3 ? evaluateConstantOffset(compiler, operands[2]) : 0; // reports + if (offset < 0) { // reported in evaluateConstantOffset + return module.createUnreachable(); + } + compiler.currentType = Type.void; + return module.createAtomicStore(typeArguments[0].byteSize, arg0, arg1, type.toNativeType(), offset); + } + case "Atomic.add": // add(ptr: usize, value: T, constantOffset?: usize): T; + case "Atomic.sub": // sub(ptr: usize, value: T, constantOffset?: usize): T; + case "Atomic.and": // and(ptr: usize, value: T, constantOffset?: usize): T; + case "Atomic.or": // or(ptr: usize, value: T, constantOffset?: usize): T; + case "Atomic.xor": // xor(ptr: usize, value: T, constantOffset?: usize): T; + case "Atomic.xchg": // xchg(ptr: usize, value: T, constantOffset?: usize): T; + { + if (operands.length < 2 || operands.length > 3) { + if (!(typeArguments && typeArguments.length == 1)) { + compiler.error( + DiagnosticCode.Expected_0_type_arguments_but_got_1, + reportNode.range, "1", typeArguments ? typeArguments.length.toString(10) : "0" + ); + } + if (operands.length < 2) { + compiler.error( + DiagnosticCode.Expected_at_least_0_arguments_but_got_1, + reportNode.range, "2", operands.length.toString(10) + ); + } else { + compiler.error( + DiagnosticCode.Expected_0_arguments_but_got_1, + reportNode.range, "3", operands.length.toString(10) + ); + } + return module.createUnreachable(); + } + if (!(typeArguments && typeArguments.length == 1)) { + compiler.error( + DiagnosticCode.Expected_0_type_arguments_but_got_1, + reportNode.range, "1", typeArguments ? typeArguments.length.toString(10) : "0" + ); + return module.createUnreachable(); + } + arg0 = compiler.compileExpression( + operands[0], + compiler.options.usizeType, + ConversionKind.IMPLICIT, + WrapMode.NONE + ); + arg1 = compiler.compileExpression( + operands[1], + typeArguments[0], + typeArguments[0].is(TypeFlags.INTEGER) + ? ConversionKind.NONE // no need to convert to small int (but now might result in a float) + : ConversionKind.IMPLICIT, + WrapMode.NONE + ); + + let type: Type; + if ( + typeArguments[0].is(TypeFlags.INTEGER) && + ( + !compiler.currentType.is(TypeFlags.INTEGER) || // float to int + compiler.currentType.size < typeArguments[0].size // int to larger int (clear garbage bits) + ) + ) { + arg1 = compiler.convertExpression( + arg1, + compiler.currentType, typeArguments[0], + ConversionKind.IMPLICIT, + WrapMode.NONE, // still clears garbage bits + operands[1] + ); + type = typeArguments[0]; + } else { + type = compiler.currentType; + } + + let offset = operands.length == 3 ? evaluateConstantOffset(compiler, operands[2]) : 0; // reports + if (offset < 0) { // reported in evaluateConstantOffset + return module.createUnreachable(); + } + let RMWOp: AtomicRMWOp | null = null; + switch (prototype.internalName) { + case "Atomic.add": { RMWOp = AtomicRMWOp.Add; break; } + case "Atomic.sub": { RMWOp = AtomicRMWOp.Sub; break; } + case "Atomic.and": { RMWOp = AtomicRMWOp.And; break; } + case "Atomic.or": { RMWOp = AtomicRMWOp.Or; break; } + case "Atomic.xor": { RMWOp = AtomicRMWOp.Xor; break; } + case "Atomic.xchg": { RMWOp = AtomicRMWOp.Xchg; break; } + } + compiler.currentType = typeArguments[0]; + if (RMWOp !== null) { + return module.createAtomicRMW( + RMWOp, typeArguments[0].byteSize, offset, arg0, arg1, type.toNativeType() + ); + } else { + compiler.error( + DiagnosticCode.Operation_not_supported, + reportNode.range, "1", typeArguments ? typeArguments.length.toString(10) : "0" + ); + return module.createUnreachable(); + } + } + case "Atomic.cmpxchg": { // cmpxchg(ptr: usize, expected:T, replacement: T, constantOffset?: usize): T; + if (operands.length < 3 || operands.length > 4) { + if (!(typeArguments && typeArguments.length == 1)) { + compiler.error( + DiagnosticCode.Expected_0_type_arguments_but_got_1, + reportNode.range, "1", typeArguments ? typeArguments.length.toString(10) : "0" + ); + } + if (operands.length < 3) { + compiler.error( + DiagnosticCode.Expected_at_least_0_arguments_but_got_1, + reportNode.range, "2", operands.length.toString(10) + ); + } else { + compiler.error( + DiagnosticCode.Expected_0_arguments_but_got_1, + reportNode.range, "3", operands.length.toString(10) + ); + } + return module.createUnreachable(); + } + if (!(typeArguments && typeArguments.length == 1)) { + compiler.error( + DiagnosticCode.Expected_0_type_arguments_but_got_1, + reportNode.range, "1", typeArguments ? typeArguments.length.toString(10) : "0" + ); + return module.createUnreachable(); + } + arg0 = compiler.compileExpression( + operands[0], + compiler.options.usizeType, + ConversionKind.IMPLICIT, + WrapMode.NONE + ); + arg1 = compiler.compileExpression( + operands[1], + typeArguments[0], + typeArguments[0].is(TypeFlags.INTEGER) + ? ConversionKind.NONE // no need to convert to small int (but now might result in a float) + : ConversionKind.IMPLICIT, + WrapMode.NONE + ); + arg2 = compiler.compileExpression( + operands[2], + typeArguments[0], + typeArguments[0].is(TypeFlags.INTEGER) + ? ConversionKind.NONE // no need to convert to small int (but now might result in a float) + : ConversionKind.IMPLICIT, + WrapMode.NONE + ); + + let type: Type; + if ( + typeArguments[0].is(TypeFlags.INTEGER) && + ( + !compiler.currentType.is(TypeFlags.INTEGER) || // float to int + compiler.currentType.size < typeArguments[0].size // int to larger int (clear garbage bits) + ) + ) { + arg1 = compiler.convertExpression( + arg1, + compiler.currentType, typeArguments[0], + ConversionKind.IMPLICIT, + WrapMode.NONE, // still clears garbage bits + operands[1] + ); + arg2 = compiler.convertExpression( + arg2, + compiler.currentType, typeArguments[0], + ConversionKind.IMPLICIT, + WrapMode.NONE, // still clears garbage bits + operands[2] + ); + type = typeArguments[0]; + } else { + type = compiler.currentType; + } + + let offset = operands.length == 4 ? evaluateConstantOffset(compiler, operands[3]) : 0; // reports + if (offset < 0) { // reported in evaluateConstantOffset + return module.createUnreachable(); + } + compiler.currentType = typeArguments[0]; + return module.createAtomicCmpxchg( + typeArguments[0].byteSize, offset, arg0, arg1, arg2, type.toNativeType() + ); + } + case "Atomic.wait": { // wait(ptr: usize, expected:T, timeout: i64): i32; + let hasError = typeArguments == null; + if (operands.length != 3) { + compiler.error( + DiagnosticCode.Expected_0_arguments_but_got_1, + reportNode.range, "3", operands.length.toString(10) + ); + hasError = true; + } + if (!(typeArguments && typeArguments.length == 1)) { + compiler.error( + DiagnosticCode.Expected_0_type_arguments_but_got_1, + reportNode.range, "1", typeArguments ? typeArguments.length.toString(10) : "0" + ); + hasError = true; + } + + if (!typeArguments || hasError) { + return module.createUnreachable(); + } + + arg0 = compiler.compileExpression( + operands[0], + compiler.options.usizeType, + ConversionKind.IMPLICIT, + WrapMode.NONE + ); + arg1 = compiler.compileExpression( + operands[1], + typeArguments[0], + typeArguments[0].is(TypeFlags.INTEGER) + ? ConversionKind.NONE // no need to convert to small int (but now might result in a float) + : ConversionKind.IMPLICIT, + WrapMode.NONE + ); + arg2 = compiler.compileExpression( + operands[2], + Type.i64, + ConversionKind.IMPLICIT, + WrapMode.NONE + ); + + let type: Type = typeArguments[0]; + if ( + typeArguments[0].is(TypeFlags.INTEGER) && + ( + !compiler.currentType.is(TypeFlags.INTEGER) || // float to int + compiler.currentType.size < typeArguments[0].size // int to larger int (clear garbage bits) + ) + ) { + arg1 = compiler.convertExpression( + arg1, + compiler.currentType, typeArguments[0], + ConversionKind.IMPLICIT, + WrapMode.NONE, // still clears garbage bits + operands[1] + ); + arg2 = compiler.convertExpression( + arg2, + compiler.currentType, typeArguments[0], + ConversionKind.IMPLICIT, + WrapMode.NONE, // still clears garbage bits + operands[2] + ); + } + + return module.createAtomicWait( + arg0, arg1, arg2, type.toNativeType() + ); + } + case "Atomic.notify": { // notify(ptr: usize, count: u32): u32; + let hasError = typeArguments == null; + if (operands.length != 2) { + compiler.error( + DiagnosticCode.Expected_0_arguments_but_got_1, + reportNode.range, "2", operands.length.toString(10) + ); + hasError = true; + } + if (!(typeArguments && typeArguments.length == 1)) { + compiler.error( + DiagnosticCode.Expected_0_type_arguments_but_got_1, + reportNode.range, "1", typeArguments ? typeArguments.length.toString(10) : "0" + ); + hasError = true; + } + + if (!typeArguments || hasError) { + return module.createUnreachable(); + } + + arg0 = compiler.compileExpression( + operands[0], + compiler.options.usizeType, + ConversionKind.IMPLICIT, + WrapMode.NONE + ); + arg1 = compiler.compileExpression( + operands[1], + Type.i32, + ConversionKind.IMPLICIT, + WrapMode.NONE + ); + + return module.createAtomicWake( + arg0, arg1 + ); + } case "sizeof": { // sizeof() -> usize compiler.currentType = compiler.options.usizeType; if (operands.length != 0) { @@ -2801,6 +3213,83 @@ function deferASMCall( case "i64.store": return deferASM("store", compiler, Type.i64, operands, Type.i64, reportNode); case "f32.store": return deferASM("store", compiler, Type.f32, operands, Type.f32, reportNode); case "f64.store": return deferASM("store", compiler, Type.f64, operands, Type.f64, reportNode); + + case "i32.atomic.load8_u": return deferASM("Atomic.load", compiler, Type.u8, operands, Type.u32, reportNode); + case "i32.atomic.load16_u": return deferASM("Atomic.load", compiler, Type.u16, operands, Type.u32, reportNode); + case "i32.atomic.load": return deferASM("Atomic.load", compiler, Type.i32, operands, Type.i32, reportNode); + case "i64.atomic.load8_u": return deferASM("Atomic.load", compiler, Type.u8, operands, Type.u64, reportNode); + case "i64.atomic.load16_u": return deferASM("Atomic.load", compiler, Type.u16, operands, Type.u64, reportNode); + case "i64.atomic.load32_u": return deferASM("Atomic.load", compiler, Type.u32, operands, Type.u64, reportNode); + case "i64.atomic.load": return deferASM("Atomic.load", compiler, Type.i64, operands, Type.i64, reportNode); + + case "i32.atomic.store8": return deferASM("Atomic.store", compiler, Type.i8, operands, Type.i32, reportNode); + case "i32.atomic.store16": return deferASM("Atomic.store", compiler, Type.i16, operands, Type.i32, reportNode); + case "i32.atomic.store": return deferASM("Atomic.store", compiler, Type.i32, operands, Type.i32, reportNode); + case "i64.atomic.store8": return deferASM("Atomic.store", compiler, Type.i8, operands, Type.i64, reportNode); + case "i64.atomic.store16": return deferASM("Atomic.store", compiler, Type.i16, operands, Type.i64, reportNode); + case "i64.atomic.store32": return deferASM("Atomic.store", compiler, Type.i32, operands, Type.i64, reportNode); + case "i64.atomic.store": return deferASM("Atomic.store", compiler, Type.i64, operands, Type.i64, reportNode); + + case "i32.atomic.rmw8_u.add": return deferASM("Atomic.add", compiler, Type.u8, operands, Type.u32, reportNode); + case "i32.atomic.rmw16_u.add": return deferASM("Atomic.add", compiler, Type.u16, operands, Type.u32, reportNode); + case "i32.atomic.rmw.add": return deferASM("Atomic.add", compiler, Type.u32, operands, Type.u32, reportNode); + case "i64.atomic.rmw8_u.add": return deferASM("Atomic.add", compiler, Type.u8, operands, Type.u64, reportNode); + case "i64.atomic.rmw16_u.add": return deferASM("Atomic.add", compiler, Type.u16, operands, Type.u64, reportNode); + case "i64.atomic.rmw32_u.add": return deferASM("Atomic.add", compiler, Type.u32, operands, Type.u64, reportNode); + case "i64.atomic.rmw.add": return deferASM("Atomic.add", compiler, Type.u64, operands, Type.u64, reportNode); + + case "i32.atomic.rmw8_u.sub": return deferASM("Atomic.sub", compiler, Type.u8, operands, Type.u32, reportNode); + case "i32.atomic.rmw16_u.sub": return deferASM("Atomic.sub", compiler, Type.u16, operands, Type.u32, reportNode); + case "i32.atomic.rmw.sub": return deferASM("Atomic.sub", compiler, Type.u32, operands, Type.u32, reportNode); + case "i64.atomic.rmw8_u.sub": return deferASM("Atomic.sub", compiler, Type.u8, operands, Type.u64, reportNode); + case "i64.atomic.rmw16_u.sub": return deferASM("Atomic.sub", compiler, Type.u16, operands, Type.u64, reportNode); + case "i64.atomic.rmw32_u.sub": return deferASM("Atomic.sub", compiler, Type.u32, operands, Type.u64, reportNode); + case "i64.atomic.rmw.sub": return deferASM("Atomic.sub", compiler, Type.u64, operands, Type.u64, reportNode); + + case "i32.atomic.rmw8_u.and": return deferASM("Atomic.and", compiler, Type.u8, operands, Type.u32, reportNode); + case "i32.atomic.rmw16_u.and": return deferASM("Atomic.and", compiler, Type.u16, operands, Type.u32, reportNode); + case "i32.atomic.rmw.and": return deferASM("Atomic.and", compiler, Type.u32, operands, Type.u32, reportNode); + case "i64.atomic.rmw8_u.and": return deferASM("Atomic.and", compiler, Type.u8, operands, Type.u64, reportNode); + case "i64.atomic.rmw16_u.and": return deferASM("Atomic.and", compiler, Type.u16, operands, Type.u64, reportNode); + case "i64.atomic.rmw32_u.and": return deferASM("Atomic.and", compiler, Type.u32, operands, Type.u64, reportNode); + case "i64.atomic.rmw.and": return deferASM("Atomic.and", compiler, Type.u64, operands, Type.u64, reportNode); + + case "i32.atomic.rmw8_u.or": return deferASM("Atomic.or", compiler, Type.u8, operands, Type.u32, reportNode); + case "i32.atomic.rmw16_u.or": return deferASM("Atomic.or", compiler, Type.u16, operands, Type.u32, reportNode); + case "i32.atomic.rmw.or": return deferASM("Atomic.or", compiler, Type.u32, operands, Type.u32, reportNode); + case "i64.atomic.rmw8_u.or": return deferASM("Atomic.or", compiler, Type.u8, operands, Type.u64, reportNode); + case "i64.atomic.rmw16_u.or": return deferASM("Atomic.or", compiler, Type.u16, operands, Type.u64, reportNode); + case "i64.atomic.rmw32_u.or": return deferASM("Atomic.or", compiler, Type.u32, operands, Type.u64, reportNode); + case "i64.atomic.rmw.or": return deferASM("Atomic.or", compiler, Type.u64, operands, Type.u64, reportNode); + + case "i32.atomic.rmw8_u.xor": return deferASM("Atomic.xor", compiler, Type.u8, operands, Type.u32, reportNode); + case "i32.atomic.rmw16_u.xor": return deferASM("Atomic.xor", compiler, Type.u8, operands, Type.u32, reportNode); + case "i32.atomic.rmw.xor": return deferASM("Atomic.xor", compiler, Type.u8, operands, Type.u32, reportNode); + case "i64.atomic.rmw8_u.xor": return deferASM("Atomic.xor", compiler, Type.u8, operands, Type.u64, reportNode); + case "i64.atomic.rmw16_u.xor": return deferASM("Atomic.xor", compiler, Type.u16, operands, Type.u64, reportNode); + case "i64.atomic.rmw32_u.xor": return deferASM("Atomic.xor", compiler, Type.u32, operands, Type.u64, reportNode); + case "i64.atomic.rmw.xor": return deferASM("Atomic.xor", compiler, Type.u64, operands, Type.u64, reportNode); + + case "i32.atomic.rmw8_u.xchg": return deferASM("Atomic.xchg", compiler, Type.u8, operands, Type.u32, reportNode); + case "i32.atomic.rmw16_u.xchg": return deferASM("Atomic.xchg", compiler, Type.u8, operands, Type.u32, reportNode); + case "i32.atomic.rmw.xchg": return deferASM("Atomic.xchg", compiler, Type.u8, operands, Type.u32, reportNode); + case "i64.atomic.rmw8_u.xchg": return deferASM("Atomic.xchg", compiler, Type.u8, operands, Type.u64, reportNode); + case "i64.atomic.rmw16_u.xchg": return deferASM("Atomic.xchg", compiler, Type.u16, operands, Type.u64, reportNode); + case "i64.atomic.rmw32_u.xchg": return deferASM("Atomic.xchg", compiler, Type.u32, operands, Type.u64, reportNode); + case "i64.atomic.rmw.xchg": return deferASM("Atomic.xchg", compiler, Type.u64, operands, Type.u64, reportNode); + + case "i32.atomic.rmw8_u.cmpxchg": return deferASM("Atomic.cmpxchg", compiler, Type.u8, operands, Type.u32, reportNode); + case "i32.atomic.rmw16_u.cmpxchg": return deferASM("Atomic.cmpxchg", compiler, Type.u8, operands, Type.u32, reportNode); + case "i32.atomic.rmw.cmpxchg": return deferASM("Atomic.cmpxchg", compiler, Type.u8, operands, Type.u32, reportNode); + case "i64.atomic.rmw8_u.cmpxchg": return deferASM("Atomic.cmpxchg", compiler, Type.u8, operands, Type.u64, reportNode); + case "i64.atomic.rmw16_u.cmpxchg": return deferASM("Atomic.cmpxchg", compiler, Type.u16, operands, Type.u64, reportNode); + case "i64.atomic.rmw32_u.cmpxchg": return deferASM("Atomic.cmpxchg", compiler, Type.u32, operands, Type.u64, reportNode); + case "i64.atomic.rmw.cmpxchg": return deferASM("Atomic.cmpxchg", compiler, Type.u64, operands, Type.u64, reportNode); + + case "i32.wait": return deferASM("Atomic.wait", compiler, Type.i32, operands, Type.u32, reportNode); + case "i64.wait": return deferASM("Atomic.wait", compiler, Type.i64, operands, Type.i64, reportNode); + case "i32.notify": return deferASM("Atomic.notify", compiler, Type.i32, operands, Type.u32, reportNode); + case "i64.notify": return deferASM("Atomic.notify", compiler, Type.i64, operands, Type.i64, reportNode); } return 0; } @@ -2814,7 +3303,16 @@ function deferASM( valueType: Type, reportNode: Node ): ExpressionRef { - var prototype = assert(compiler.program.elementsLookup.get(name)); + var names = name.split("."); + var prototype: Element = assert(compiler.program.elementsLookup.get(names[0])); + if (names.length > 1) { + for (let i = 1; i < names.length; i++) { + const subName = names[i]; + if (prototype && prototype.members) { + prototype = assert(prototype.members.get(subName)); + } + } + } assert(prototype.kind == ElementKind.FUNCTION_PROTOTYPE); return compileCall(compiler, prototype, [ typeArgument ], operands, valueType, reportNode); } diff --git a/src/compiler.ts b/src/compiler.ts index 21337e602b..d1e1cd7823 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -185,6 +185,10 @@ export class Options { noAssert: bool = false; /** If true, imports the memory provided by the embedder. */ importMemory: bool = false; + /** If greater than zero, declare memory as shared by setting max memory to sharedMemory. */ + sharedMemory: i32 = 0; + /** Don't include datasegments in compiled module. Use with sharedMemory to ensure module intialized only once.*/ + ignoreDataSegments: bool = false; /** If true, imports the function table provided by the embedder. */ importTable: bool = false; /** If true, generates information necessary for source maps. */ @@ -234,7 +238,8 @@ export const enum Feature { /** Sign extension operations. */ SIGN_EXTENSION = 1 << 0, // see: https://github.com/WebAssembly/sign-extension-ops /** Mutable global imports and exports. */ - MUTABLE_GLOBAL = 1 << 1 // see: https://github.com/WebAssembly/mutable-global + MUTABLE_GLOBAL = 1 << 1, // see: https://github.com/WebAssembly/mutable-global + ATOMIC = 1 << 2 } /** Indicates the desired kind of a conversion. */ @@ -394,18 +399,22 @@ export class Compiler extends DiagnosticEmitter { // determine initial page size var numPages = this.memorySegments.length - ? i64_low(i64_shr_u(i64_align(memoryOffset, 0x10000), i64_new(16, 0))) - : 0; + ? i64_low(i64_shr_u(i64_align(memoryOffset, 0x10000), i64_new(16, 0))) + : 0; + var isSharedMemory = options.sharedMemory > 0; + var addSegments = !options.ignoreDataSegments; + module.setMemory( numPages, - Module.UNLIMITED_MEMORY, - this.memorySegments, + isSharedMemory ? options.sharedMemory : Module.UNLIMITED_MEMORY, + addSegments? this.memorySegments: [], options.target, - "memory" + "memory", + isSharedMemory ); // import memory if requested (default memory is named '0' by Binaryen) - if (options.importMemory) module.addMemoryImport("0", "env", "memory"); + if (options.importMemory) module.addMemoryImport("0", "env", "memory", isSharedMemory); // set up function table var functionTable = this.functionTable; diff --git a/src/decompiler.ts b/src/decompiler.ts index 8339909169..614f37f292 100644 --- a/src/decompiler.ts +++ b/src/decompiler.ts @@ -20,13 +20,13 @@ import { getFunctionResultType, getExpressionId, getExpressionType, - getBlockName, + // getBlockName, getBlockChildCount, getBlockChild, getIfCondition, getIfTrue, getIfFalse, - getLoopName, + // getLoopName, getLoopBody, getBreakName, getBreakCondition, @@ -54,7 +54,11 @@ import { getDropValue, getReturnValue, getHostOp, - getHostOperand + getHostOperand, + getCallTarget, + getSetGlobalValue, + readString, + getGlobalGetName, } from "./module"; // TODO :-) @@ -67,13 +71,19 @@ export class Decompiler { return decompiler.finish(); } + static fromBuffer(buffer: Uint8Array): Module { + return Module.createFrom(buffer); + } + text: string[] = []; functionId: i32 = 0; + depth: i32 = 0; + currentfunction: string = ""; constructor() { } /** Decompiles a module to an AST that can then be serialized. */ - decompile(module: Module): void { + decompile(_module: Module): void { throw new Error("not implemented"); } @@ -82,6 +92,7 @@ export class Decompiler { var body = getFunctionBody(func); this.push("function "); this.push(name); + this.currentfunction = name; this.push("("); for (let i: Index = 0, k: Index = getFunctionParamCount(func); i < k; ++i) { if (i > 0) this.push(", "); @@ -92,48 +103,63 @@ export class Decompiler { } this.push("): "); this.push(nativeTypeToType(getFunctionResultType(func))); - this.push(" "); - if (getExpressionId(body) != ExpressionId.Block) { - this.push("{\n"); - } - this.decompileExpression(body); - if (getExpressionId(body) != ExpressionId.Block) { - this.push("\n}\n"); - } + this.push(" {"); + this.depth = 1; + this.startLine(); + this.addReturn(body); + log(`${this.currentfunction}--${getExpressionId(body)}`); + this.decompileExpression(body, true); + // this.addSemicolon(body); + this.push("\n}\n"); ++this.functionId; } - decompileExpression(expr: ExpressionRef): void { + decompileExpression(expr: ExpressionRef, first: boolean = false): void { + if (!expr) { return; } //The function is an import, etc. var id = getExpressionId(expr); var type = getExpressionType(expr); - var nested: ExpressionRef; var string: string | null; var i: Index, k: Index; - switch (id) { case ExpressionId.Block: { // TODO: magic - if ((string = getBlockName(expr)) != null) { - this.push(string); - this.push(": "); - } - this.push("{\n"); + log(`${this.currentfunction} Block`); + // if ((string = getBlockName(expr)) != null) { + // this.push(string); + // this.push(": "); + // } k = getBlockChildCount(expr); + if (k == 0) { + if (first) { + this.push("return; "); + } + return; + } for (i = 0; i < k; ++i) { - this.decompileExpression(getBlockChild(expr, i)); + let childExpr = getBlockChild(expr, i); + if (i != 0) { + this.startLine(); + } + if (this.depth == 1 && i == k - 1) { + this.push("return "); + } + this.decompileExpression(childExpr); + if (i < k - 1) { + this.addSemicolon(childExpr); + } } - this.push("}\n"); - return; + break; } case ExpressionId.If: { + log(`${this.currentfunction} If`); if (type == NativeType.None) { this.push("if ("); this.decompileExpression(getIfCondition(expr)); this.push(") "); - this.decompileExpression(getIfTrue(expr)); + this.decompileNestedExpression(getIfTrue(expr)); if (nested = getIfFalse(expr)) { this.push(" else "); - this.decompileExpression(nested); + this.decompileNestedExpression(nested); } } else { this.decompileExpression(getIfCondition(expr)); @@ -145,51 +171,82 @@ export class Decompiler { return; } case ExpressionId.Loop: { - if ((string = getLoopName(expr)) != null) { - this.push(string); - this.push(": "); - } + log(`${this.currentfunction} Loop`); this.push("do "); - this.decompileExpression(getLoopBody(expr)); - this.push("while (0);\n"); + this.decompileNestedExpression(getLoopBody(expr)); + this.push(" while (1)"); + break; } case ExpressionId.Break: { + log(`${this.currentfunction} Break`); + if (nested = getBreakCondition(expr)) { this.push("if ("); this.decompileExpression(nested); this.push(") "); } if ((string = getBreakName(expr)) != null) { - this.push("break "); - this.push(string); - this.push(";\n"); + this.push("break;"); + // this.push(string); + // this.push(";\n"); } else { - this.push("break;\n"); + this.push("break;"); } return; } - case ExpressionId.Switch: - case ExpressionId.Call: + case ExpressionId.Switch: { + throw new Error("not implemented switch"); + } + case ExpressionId.Call: { + log(`${this.currentfunction} Call`); + + let funcName = (getCallTarget(expr) || ""); + funcName = funcName.endsWith(";") ? funcName.substring(0,funcName.length - 1 ) : funcName; + this.push(funcName); + this.push("("); + let argc = _BinaryenCallGetNumOperands(expr); + for (let i: isize = 0; i < argc; i++) { + this.decompileExpression(_BinaryenCallGetOperand(expr,i)); + if (i < argc - 1) { + this.push(", "); + } + } + this.push(")"); + break; + } case ExpressionId.CallIndirect: { - throw new Error("not implemented"); + throw new Error("CallIndirect Not implmented."); } case ExpressionId.GetLocal: { + log(`${this.currentfunction} getLocal`); this.push("$"); this.push(getGetLocalIndex(expr).toString(10)); - return; + break; } case ExpressionId.SetLocal: { + log(`${this.currentfunction} setLocall`); this.push("$"); this.push(getSetLocalIndex(expr).toString(10)); this.push(" = "); this.decompileExpression(getSetLocalValue(expr)); - return; + break; + } + case ExpressionId.GetGlobal: { + log(`${this.currentfunction} getGlobal`); + this.push(getGlobalGetName(expr) || "_global_undefined"); + break; + } - case ExpressionId.GetGlobal: case ExpressionId.SetGlobal: { - throw new Error("not implemented"); + log(`${this.currentfunction} setGlobal`); + this.push(readString(_BinaryenSetGlobalGetName(expr)) || ""); + this.push(" = "); + let RHS = getSetGlobalValue(expr); + this.decompileExpression(RHS); + break; } case ExpressionId.Load: { + log(`${this.currentfunction} load`); this.push("load<"); this.push(nativeTypeToType(type)); this.push(">("); @@ -197,7 +254,7 @@ export class Decompiler { this.push(" + "); this.decompileExpression(getLoadPtr(expr)); this.push(")"); - return; + break; } case ExpressionId.Store: { this.push("store<"); @@ -209,13 +266,13 @@ export class Decompiler { this.push(", "); this.decompileExpression(getStoreValue(expr)); this.push(")"); - return; + break; } case ExpressionId.Const: { switch (type) { case NativeType.I32: { this.push(getConstValueI32(expr).toString(10)); - return; + break; } case NativeType.I64: { this.push( @@ -226,15 +283,15 @@ export class Decompiler { ) ) ); - return; + break; } case NativeType.F32: { this.push(getConstValueF32(expr).toString(10)); - return; + break; } case NativeType.F64: { this.push(getConstValueF64(expr).toString(10)); - return; + break; } } break; @@ -245,250 +302,250 @@ export class Decompiler { this.push("clz("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.CtzI32: { this.push("ctz("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.PopcntI32: { this.push("popcnt("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.NegF32: case UnaryOp.NegF64: { this.push("-"); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.AbsF32: { this.push("abs("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.CeilF32: { this.push("ceil("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.FloorF32: { this.push("floor("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.TruncF32: { this.push("trunc("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.NearestF32: { this.push("nearest("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.SqrtF32: { this.push("sqrt("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.EqzI32: case UnaryOp.EqzI64: { this.push("!"); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.ClzI64: { this.push("clz("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.CtzI64: { this.push("ctz("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.PopcntI64: { this.push("popcnt("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.AbsF64: { this.push("abs("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.CeilF64: { this.push("ceil("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.FloorF64: { this.push("floor("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.TruncF64: { this.push("trunc("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.NearestF64: { this.push("nearest("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.SqrtF64: { this.push("sqrt("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.ExtendI32: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.ExtendU32: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.WrapI64: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.TruncF32ToI32: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.TruncF32ToI64: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.TruncF32ToU32: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.TruncF32ToU64: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.TruncF64ToI32: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.TruncF64ToI64: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.TruncF64ToU32: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.TruncF64ToU64: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.ReinterpretF32: { this.push("reinterpret("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.ReinterpretF64: { this.push("reinterpret("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.ConvertI32ToF32: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.ConvertI32ToF64: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.ConvertU32ToF32: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.ConvertU32ToF64: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.ConvertI64ToF32: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.ConvertI64ToF64: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.ConvertU64ToF32: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.ConvertU64ToF64: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.PromoteF32: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.DemoteF64: { this.push(""); this.decompileExpression(getUnaryValue(expr)); - return; + break; } case UnaryOp.ReinterpretI32: { this.push("reinterpret("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } case UnaryOp.ReinterpretI64: { this.push("reinterpret("); this.decompileExpression(getUnaryValue(expr)); this.push(")"); - return; + break; } } break; @@ -502,7 +559,7 @@ export class Decompiler { this.decompileExpression(getBinaryLeft(expr)); this.push(" + "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.SubI32: case BinaryOp.SubI64: @@ -511,7 +568,7 @@ export class Decompiler { this.decompileExpression(getBinaryLeft(expr)); this.push(" - "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.MulI32: case BinaryOp.MulI64: @@ -520,7 +577,7 @@ export class Decompiler { this.decompileExpression(getBinaryLeft(expr)); this.push(" * "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.DivI32: case BinaryOp.DivI64: @@ -529,7 +586,7 @@ export class Decompiler { this.decompileExpression(getBinaryLeft(expr)); this.push(" / "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.DivU32: { this.push("("); @@ -537,14 +594,14 @@ export class Decompiler { this.push(" / "); this.decompileExpression(getBinaryRight(expr)); this.push(")"); - return; + break; } case BinaryOp.RemI32: case BinaryOp.RemI64: { this.decompileExpression(getBinaryLeft(expr)); this.push(" % "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.RemU32: { this.push("("); @@ -552,49 +609,49 @@ export class Decompiler { this.push(" / "); this.decompileExpression(getBinaryRight(expr)); this.push(")"); - return; + break; } case BinaryOp.AndI32: case BinaryOp.AndI64: { this.decompileExpression(getBinaryLeft(expr)); this.push(" & "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.OrI32: case BinaryOp.OrI64: { this.decompileExpression(getBinaryLeft(expr)); this.push(" | "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.XorI32: case BinaryOp.XorI64: { this.decompileExpression(getBinaryLeft(expr)); this.push(" ^ "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.ShlI32: case BinaryOp.ShlI64: { this.decompileExpression(getBinaryLeft(expr)); this.push(" << "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.ShrU32: case BinaryOp.ShrU64: { this.decompileExpression(getBinaryLeft(expr)); this.push(" >>> "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.ShrI32: case BinaryOp.ShrI64: { this.decompileExpression(getBinaryLeft(expr)); this.push(" >> "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.RotlI32: { this.push("rotl("); @@ -602,7 +659,7 @@ export class Decompiler { this.push(", "); this.decompileExpression(getBinaryRight(expr)); this.push(")"); - return; + break; } case BinaryOp.RotrI32: { this.push("rotr("); @@ -610,7 +667,7 @@ export class Decompiler { this.push(", "); this.decompileExpression(getBinaryRight(expr)); this.push(")"); - return; + break; } case BinaryOp.EqI32: case BinaryOp.EqI64: @@ -619,7 +676,7 @@ export class Decompiler { this.decompileExpression(getBinaryLeft(expr)); this.push(" == "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.NeI32: case BinaryOp.NeI64: @@ -628,7 +685,7 @@ export class Decompiler { this.decompileExpression(getBinaryLeft(expr)); this.push(" != "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.LtI32: case BinaryOp.LtI64: @@ -637,14 +694,14 @@ export class Decompiler { this.decompileExpression(getBinaryLeft(expr)); this.push(" < "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.LtU32: { this.push(""); this.decompileExpression(getBinaryLeft(expr)); this.push(" < "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.LeI32: case BinaryOp.LeI64: @@ -653,14 +710,14 @@ export class Decompiler { this.decompileExpression(getBinaryLeft(expr)); this.push(" <= "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.LeU32: { this.push(""); this.decompileExpression(getBinaryLeft(expr)); this.push(" <= "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.GtI32: case BinaryOp.GtI64: @@ -669,14 +726,14 @@ export class Decompiler { this.decompileExpression(getBinaryLeft(expr)); this.push(" > "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.GtU32: { this.push(""); this.decompileExpression(getBinaryLeft(expr)); this.push(" > "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.GeI32: case BinaryOp.GeI64: @@ -685,28 +742,28 @@ export class Decompiler { this.decompileExpression(getBinaryLeft(expr)); this.push(" >= "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.GeU32: { this.push(""); this.decompileExpression(getBinaryLeft(expr)); this.push(" >= "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.DivU64: { this.push(""); this.decompileExpression(getBinaryLeft(expr)); this.push(" / "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.RemU64: { this.push(""); this.decompileExpression(getBinaryLeft(expr)); this.push(" % "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.RotlI64: { this.push("rotl("); @@ -714,7 +771,7 @@ export class Decompiler { this.push(", "); this.decompileExpression(getBinaryRight(expr)); this.push(")"); - return; + break; } case BinaryOp.RotrI64: { this.push("rotr("); @@ -722,35 +779,35 @@ export class Decompiler { this.push(", "); this.decompileExpression(getBinaryRight(expr)); this.push(")"); - return; + break; } case BinaryOp.LtU64: { this.push(""); this.decompileExpression(getBinaryLeft(expr)); this.push(" < "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.LeU64: { this.push(""); this.decompileExpression(getBinaryLeft(expr)); this.push(" <= "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.GtU64: { this.push(""); this.decompileExpression(getBinaryLeft(expr)); this.push(" > "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.GeU64: { this.push(""); this.decompileExpression(getBinaryLeft(expr)); this.push(" >= "); this.decompileExpression(getBinaryRight(expr)); - return; + break; } case BinaryOp.CopysignF32: { this.push("copysign("); @@ -758,7 +815,7 @@ export class Decompiler { this.push(", "); this.decompileExpression(getBinaryRight(expr)); this.push(")"); - return; + break; } case BinaryOp.MinF32: { this.push("min("); @@ -766,7 +823,7 @@ export class Decompiler { this.push(", "); this.decompileExpression(getBinaryRight(expr)); this.push(")"); - return; + break; } case BinaryOp.MaxF32: { this.push("max("); @@ -774,7 +831,7 @@ export class Decompiler { this.push(", "); this.decompileExpression(getBinaryRight(expr)); this.push(")"); - return; + break; } case BinaryOp.CopysignF64: { this.push("copysign("); @@ -782,7 +839,7 @@ export class Decompiler { this.push(", "); this.decompileExpression(getBinaryRight(expr)); this.push(")"); - return; + break; } case BinaryOp.MinF64: { this.push("min("); @@ -790,7 +847,7 @@ export class Decompiler { this.push(", "); this.decompileExpression(getBinaryRight(expr)); this.push(")"); - return; + break; } case BinaryOp.MaxF64: { this.push("max("); @@ -798,10 +855,10 @@ export class Decompiler { this.push(", "); this.decompileExpression(getBinaryRight(expr)); this.push(")"); - return; + break; } } - return; + break; } case ExpressionId.Select: { this.push("select<"); @@ -813,58 +870,112 @@ export class Decompiler { this.push(", "); this.decompileExpression(getSelectCondition(expr)); this.push(")"); - return; + break; } case ExpressionId.Drop: { + log(`${this.currentfunction} drop`); this.decompileExpression(getDropValue(expr)); - this.push(";\n"); - return; + break; } case ExpressionId.Return: { if (nested = getReturnValue(expr)) { this.push("return "); this.decompileExpression(nested); - this.push(";\n"); + // this.push(";\n"); } else { - this.push("return;\n"); + this.push("break"); } - return; + break; } case ExpressionId.Host: { switch (getHostOp(expr)) { case HostOp.CurrentMemory: { this.push("memory.size()"); - return; + break; } case HostOp.GrowMemory: { this.push("memory.grow("); this.decompileExpression(getHostOperand(expr, 0)); this.push(")"); - return; + break; } } break; } case ExpressionId.Nop: { + log(`${this.currentfunction} nop`); this.push(";\n"); - return; + break; } case ExpressionId.Unreachable: { this.push("unreachable()"); - return; + break; } case ExpressionId.AtomicCmpxchg: case ExpressionId.AtomicRMW: case ExpressionId.AtomicWait: case ExpressionId.AtomicWake: + default: { + throw new Error("not implemented"); + } } - throw new Error("not implemented"); + if (first) { + this.push(";"); + } + } + + /** + * A common pattern is a nestedExpression that requires braces. e.g. + if (b) { + Expr + } + This provides a way to increase the depth of indentation of new lines. + */ + private decompileNestedExpression(expr: ExpressionId): void { + this.push("{"); + this.depth++; + this.startLine(); + this.decompileExpression(expr); + this.addSemicolon(expr); + this.depth--; + this.startLine(); + this.push("}"); + } + + private addReturn(expr: ExpressionRef): void { + switch (getExpressionId(expr)){ + case ExpressionId.If: + case ExpressionId.Break: + case ExpressionId.SetLocal: + case ExpressionId.SetGlobal: + case ExpressionId.Loop: + case ExpressionId.Block: { + return; + } + default: + } + this.push("return "); + } + + private addSemicolon(expr: ExpressionRef): void { + switch (getExpressionId(expr)){ + case ExpressionId.If: + case ExpressionId.Break: + case ExpressionId.Block: { + return ; + } + default: + } + this.push(";"); } private push(text: string): void { // mostly here so we can add debugging if necessary this.text.push(text); } + private startLine(): void { + this.text.push("\n" + " ".repeat(this.depth)); + } finish(): string { var ret = this.text.join(""); @@ -873,6 +984,10 @@ export class Decompiler { } } +function log(s: string): void { + // console.log(s); +} + function nativeTypeToType(type: NativeType): string { switch (type) { case NativeType.None: return "void"; diff --git a/src/glue/binaryen.d.ts b/src/glue/binaryen.d.ts index 8a5cf1a183..4924bce473 100644 --- a/src/glue/binaryen.d.ts +++ b/src/glue/binaryen.d.ts @@ -552,7 +552,7 @@ declare type BinaryenImportRef = usize; declare function _BinaryenAddFunctionImport(module: BinaryenModuleRef, internalName: usize, externalModuleName: usize, externalBaseName: usize, functionType: BinaryenFunctionTypeRef): BinaryenImportRef; declare function _BinaryenAddTableImport(module: BinaryenModuleRef, internalName: usize, externalModuleName: usize, externalBaseName: usize): BinaryenImportRef; -declare function _BinaryenAddMemoryImport(module: BinaryenModuleRef, internalName: usize, externalModuleName: usize, externalBaseName: usize): BinaryenImportRef; +declare function _BinaryenAddMemoryImport(module: BinaryenModuleRef, internalName: usize, externalModuleName: usize, externalBaseName: usize, shared:bool): BinaryenImportRef; declare function _BinaryenAddGlobalImport(module: BinaryenModuleRef, internalName: usize, externalModuleName: usize, externalBaseName: usize, globalType: BinaryenType): BinaryenImportRef; declare type BinaryenExportRef = usize; @@ -570,7 +570,7 @@ declare function _BinaryenRemoveGlobal(module: BinaryenModuleRef, name: usize): declare function _BinaryenSetFunctionTable(module: BinaryenModuleRef, initial: BinaryenIndex, maximum: BinaryenIndex, funcs: usize, numFuncs: BinaryenIndex): void; -declare function _BinaryenSetMemory(module: BinaryenModuleRef, initial: BinaryenIndex, maximum: BinaryenIndex, exportName: usize, segments: usize, segmentOffsets: usize, segmentSizes: usize, numSegments: BinaryenIndex): void; +declare function _BinaryenSetMemory(module: BinaryenModuleRef, initial: BinaryenIndex, maximum: BinaryenIndex, exportName: usize, segments: usize, segmentOffsets: usize, segmentSizes: usize, numSegments: BinaryenIndex, shared: bool): void; declare function _BinaryenSetStart(module: BinaryenModuleRef, start: BinaryenFunctionRef): void; diff --git a/src/index.ts b/src/index.ts index d2da2bcf5d..263af6ff13 100644 --- a/src/index.ts +++ b/src/index.ts @@ -102,6 +102,16 @@ export function setImportMemory(options: Options, importMemory: bool): void { options.importMemory = importMemory; } +/** Sets the `sharedMemory` option. */ +export function setSharedMemory(options: Options, sharedMemory: i32): void { + options.sharedMemory = sharedMemory; +} + +/** Sets the `ignoreDataSegments` option. */ +export function ignoreDataSegments(options: Options, ignoreDataSegments: bool): void { + options.ignoreDataSegments = ignoreDataSegments; +} + /** Sets the `importTable` option. */ export function setImportTable(options: Options, importTable: bool): void { options.importTable = importTable; diff --git a/src/module.ts b/src/module.ts index bdff2d24e3..058dfc9942 100644 --- a/src/module.ts +++ b/src/module.ts @@ -905,13 +905,14 @@ export class Module { addMemoryImport( internalName: string, externalModuleName: string, - externalBaseName: string + externalBaseName: string, + shared: bool = false, ): ImportRef { var cStr1 = allocString(internalName); var cStr2 = allocString(externalModuleName); var cStr3 = allocString(externalBaseName); try { - return _BinaryenAddMemoryImport(this.ref, cStr1, cStr2, cStr3); + return _BinaryenAddMemoryImport(this.ref, cStr1, cStr2, cStr3, shared); } finally { memory.free(cStr3); memory.free(cStr2); @@ -945,7 +946,8 @@ export class Module { maximum: Index, segments: MemorySegment[], target: Target, - exportName: string | null = null + exportName: string | null = null, + shared: bool = false ): void { var cStr = allocString(exportName); var k = segments.length; @@ -965,7 +967,7 @@ export class Module { var cArr2 = allocI32Array(offs); var cArr3 = allocI32Array(sizs); try { - _BinaryenSetMemory(this.ref, initial, maximum, cStr, cArr1, cArr2, cArr3, k); + _BinaryenSetMemory(this.ref, initial, maximum, cStr, cArr1, cArr2, cArr3, k, shared); } finally { memory.free(cArr3); memory.free(cArr2); @@ -1421,7 +1423,14 @@ export function getHostOperand(expr: ExpressionRef, index: Index): ExpressionRef export function getHostName(expr: ExpressionRef): string | null { return readString(_BinaryenHostGetNameOperand(expr)); } +// globals +export function getSetGlobalValue(expr: ExpressionRef): ExpressionRef { + return _BinaryenSetGlobalGetValue(expr); +} +export function getGlobalGetName(expr: ExpressionRef): string | null { + return readString(_BinaryenGetGlobalGetName(expr)); +} // functions export function getFunctionBody(func: FunctionRef): ExpressionRef { diff --git a/src/program.ts b/src/program.ts index d8d54d2a64..ebb47964ad 100644 --- a/src/program.ts +++ b/src/program.ts @@ -16,7 +16,8 @@ import { import { Options, - Feature + Feature, + Compiler } from "./compiler"; import { diff --git a/std/assembly/allocator/atomic.ts b/std/assembly/allocator/atomic.ts new file mode 100644 index 0000000000..2b272a2feb --- /dev/null +++ b/std/assembly/allocator/atomic.ts @@ -0,0 +1,51 @@ +import { AL_MASK, MAX_SIZE_32 } from "../internal/allocator"; + +var startOffset: usize = (HEAP_BASE + AL_MASK) & ~AL_MASK; +var offset_ptr: usize = startOffset; +var TOP = (HEAP_BASE + 8 + AL_MASK) & ~AL_MASK; +store(offset_ptr, TOP); + +@global export function allocator_get_offset(): usize { + return Atomic.load(offset_ptr); +} + +@global export function allocator_set_offset(old_offset: usize, new_offset: usize): usize { + return Atomic.cmpxchg(offset_ptr, old_offset, new_offset); +} + +@global export function __memory_allocate(size: usize): usize { + if (size) { + if (size > MAX_SIZE_32) unreachable(); + let currentOffset: usize; + let top: usize; + do { + currentOffset = allocator_get_offset(); + top = (currentOffset + size + AL_MASK) & ~AL_MASK; + let pagesBefore = memory.size(); + if (top > (pagesBefore) << 16) { + let pagesNeeded = ((top - currentOffset + 0xffff) & ~0xffff) >>> 16; + let pagesWanted = max(pagesBefore, pagesNeeded); // double memory + if (memory.grow(pagesWanted) < 0) { + if (memory.grow(pagesNeeded) < 0) { + unreachable(); // out of memory + } + } + } + } while ( + Atomic.cmpxchg(offset_ptr, currentOffset, top) != currentOffset + ); + + return currentOffset; + } + return 0; +} + +@global export function __memory_free(ptr: usize): void { + // Drop it on the floor, for now + // In the future: figure out the size from the header or other info, + // add to free list, etc etc. +} + +@global export function __memory_reset(): void { + Atomic.store(offset_ptr, startOffset); +} diff --git a/std/assembly/builtins.ts b/std/assembly/builtins.ts index 47236c9057..340043cf67 100644 --- a/std/assembly/builtins.ts +++ b/std/assembly/builtins.ts @@ -43,6 +43,20 @@ @builtin export declare function call_indirect(target: void, ...args: void[]): T; @builtin export declare function instantiate(...args: void[]): T; +export namespace Atomic { + @builtin export declare function load(offset: usize, constantOffset?: usize): T; + @builtin export declare function store(offset: usize, value: void, constantOffset?: usize): void; + @builtin export declare function add(ptr: usize, value: T, constantOffset?: usize): T; + @builtin export declare function sub(ptr: usize, value: T, constantOffset?: usize): T; + @builtin export declare function and(ptr: usize, value: T, constantOffset?: usize): T; + @builtin export declare function or(ptr: usize, value: T, constantOffset?: usize): T; + @builtin export declare function xor(ptr: usize, value: T, constantOffset?: usize): T; + @builtin export declare function xchg(ptr: usize, value: T, constantOffset?: usize): T; + @builtin export declare function cmpxchg(ptr: usize, expected:T, replacement: T, constantOffset?: usize): T; + @builtin export declare function wait(ptr: usize, expected:T, timeout:i64): i32; + @builtin export declare function notify(ptr: usize, count: u32): u32; +} + @builtin export declare function i8(value: void): i8; export namespace i8 { export const MIN_VALUE: i8 = -128; @@ -79,6 +93,49 @@ export namespace i32 { @builtin export declare function store(offset: usize, value: i32, constantOffset?: usize): void; @inline export function parseInt(value: string, radix: i32 = 0): i32 { return parseI32(value, radix) } @inline export function parseFloat(value: string): i32 { return parseFloat(value) } + + namespace atomic { + @builtin export declare function load8_s(offset: usize, constantOffset?: usize): i32; + @builtin export declare function load8_u(offset: usize, constantOffset?: usize): i32; + @builtin export declare function load16_s(offset: usize, constantOffset?: usize): i32; + @builtin export declare function load16_u(offset: usize, constantOffset?: usize): i32; + @builtin export declare function load(offset: usize, constantOffset?: usize): i32; + @builtin export declare function store8(offset: usize, value: i32, constantOffset?: usize): void; + @builtin export declare function store16(offset: usize, value: i32, constantOffset?: usize): void; + @builtin export declare function store(offset: usize, value: i32, constantOffset?: usize): void; + @builtin export declare function wait(ptr: usize, expected:i32, timeout:i64): i32; + @builtin export declare function notify(ptr: usize, count:u32): u32; + + namespace rmw8_u { + @builtin export declare function add(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function sub(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function and(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function or(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function xor(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function xchg(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function cmpxchg(offset: usize, expected:i32, replacement: i32, constantOffset?: usize): i32; + } + + namespace rmw16_u { + @builtin export declare function add(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function sub(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function and(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function or(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function xor(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function xchg(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function cmpxchg(offset: usize, expected:i32, replacement: i32, constantOffset?: usize): i32; + } + + namespace rmw { + @builtin export declare function add(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function sub(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function and(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function or(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function xor(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function xchg(offset: usize, value: i32, constantOffset?: usize): i32 + @builtin export declare function cmpxchg(offset: usize, expected:i32, replacement: i32, constantOffset?: usize): i32; + } + } } @builtin export declare function i64(value: void): i64; @@ -104,6 +161,59 @@ export namespace i64 { @builtin export declare function store(offset: usize, value: i64, constantOffset?: usize): void; @inline export function parseInt(value: string, radix: i32 = 0): i64 { return parseI64(value, radix) } @inline export function parseFloat(value: string): i64 { return parseFloat(value) } + + namespace atomic { + @builtin export declare function load8_s(offset: usize, constantOffset?: usize): i64; + @builtin export declare function load8_u(offset: usize, constantOffset?: usize): i64; + @builtin export declare function load16_s(offset: usize, constantOffset?: usize): i64; + @builtin export declare function load16_u(offset: usize, constantOffset?: usize): i64; + @builtin export declare function load(offset: usize, constantOffset?: usize): i64; + @builtin export declare function store8(offset: usize, value: i64, constantOffset?: usize): void; + @builtin export declare function store16(offset: usize, value: i64, constantOffset?: usize): void; + @builtin export declare function store(offset: usize, value: i64, constantOffset?: usize): void; + @builtin export declare function wait(ptr: usize, expected:i64, timeout:i64): i32; + @builtin export declare function notify(ptr: usize, count:u32): u32; + + namespace rmw8_u { + @builtin export declare function add(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function sub(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function and(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function or(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function xor(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function xchg(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function cmpxchg(offset: usize, expected:i64, replacement: i64, constantOffset?: usize): i64; + } + + namespace rmw16_u { + @builtin export declare function add(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function sub(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function and(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function or(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function xor(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function xchg(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function cmpxchg(offset: usize, expected:i64, replacement: i64, constantOffset?: usize): i64; + } + + namespace rmw32_u { + @builtin export declare function add(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function sub(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function and(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function or(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function xor(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function xchg(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function cmpxchg(offset: usize, expected:i64, replacement: i64, constantOffset?: usize): i64; + } + + namespace rmw { + @builtin export declare function add(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function sub(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function and(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function or(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function xor(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function xchg(offset: usize, value: i64, constantOffset?: usize): i64 + @builtin export declare function cmpxchg(offset: usize, expected:i64, replacement: i64, constantOffset?: usize): i64; + } + } } @builtin export declare function isize(value: void): isize; diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index a2e3a9fba2..fb207e16e1 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -151,6 +151,32 @@ declare function fmod(x: f64, y: f64): f64; /** Returns the 32-bit floating-point remainder of `x/y`. */ declare function fmodf(x: f32, y: f32): f32; +declare namespace Atomic { + /** Atomically loads a value of the specified type from memory. Equivalent to dereferncing a pointer in other languages. */ + export function load(ptr: usize, constantOffset?: usize): T; + /** Atomically stores a value of the specified type to memory. Equivalent to dereferencing a pointer in other languages when assigning a value. */ + export function store(ptr: usize, value: any, constantOffset?: usize): void; + /** Atomically add a value of the specified type to memory.*/ + export function add(ptr: usize, value: T, constantOffset?: usize): T; + /** Atomically subtract a value of the specified type from memory.*/ + export function sub(ptr: usize, value: T, constantOffset?: usize): T; + /** Atomically and a value of the specified type to memory.*/ + export function and(ptr: usize, value: T, constantOffset?: usize): T; + /** Atomically or a value of the specified type to memory.*/ + export function or(ptr: usize, value: T, constantOffset?: usize): T; + /** Atomically xor a value of the specified type to memory.*/ + export function xor(ptr: usize, value: T, constantOffset?: usize): T; + /** Atomically exchange a value of the specified type to memory.*/ + export function xchg(ptr: usize, value: T, constantOffset?: usize): T; + /** Atomically compare exchange a value of the specified type to memory. If the loaded value is equal to the expected value, the replacement value is stored to the same memory address. If the values are not equal, no value is stored. In either case, the loaded value is returned. + */ + export function cmpxchg(ptr: usize, expected:T, replacement: T, constantOffset?: usize): T; + + export function wait(offset: usize, expected: T, timeout: i64): i32; + + export function notify(offset: usize, count: u32): u32; +} + /** Converts any other numeric value to an 8-bit signed integer. */ declare function i8(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): i8; declare namespace i8 { @@ -202,6 +228,58 @@ declare namespace i32 { export function parseFloat(string: string): i32; /** Converts A string to an integer. */ export function parseInt(string: string, radix?: i32): i32; + + namespace atomic { + /** Atomically loads an 8-bit signed integer from memory and returns it as a 32-bit integer. */ + export function load8_s(offset: usize, constantOffset?: usize): i32; + /** Atomically loads an 8-bit unsigned integer from memory and returns it as a 32-bit integer. */ + export function load8_u(offset: usize, constantOffset?: usize): i32; + /** Atomically loads a 16-bit signed integer from memory and returns it as a 32-bit integer. */ + export function load16_s(offset: usize, constantOffset?: usize): i32; + /** Atomically loads a 16-bit unsigned integer from memory and returns it as a 32-bit integer. */ + export function load16_u(offset: usize, constantOffset?: usize): i32; + /** Atomically loads a 32-bit integer from memory. */ + export function load(offset: usize, constantOffset?: usize): i32; + /** Atomically stores a 32-bit integer to memory as an 8-bit integer. */ + export function store8(offset: usize, value: i32, constantOffset?: usize): void; + /** Atomically stores a 32-bit integer to memory as a 16-bit integer. */ + export function store16(offset: usize, value: i32, constantOffset?: usize): void; + /** Atomically stores a 32-bit integer to memory. */ + export function store(offset: usize, value: i32, constantOffset?: usize): void; + + export function wait(offset: usize, expected: i32, timeout: i64): i32; + export function notify(offset: usize, count: u32): u32; + + namespace rmw8_u { + export function add(offset: usize, value: i32, constantOffset?: usize): i32 + export function sub(offset: usize, value: i32, constantOffset?: usize): i32 + export function and(offset: usize, value: i32, constantOffset?: usize): i32 + export function or(offset: usize, value: i32, constantOffset?: usize): i32 + export function xor(offset: usize, value: i32, constantOffset?: usize): i32 + export function xchg(offset: usize, value: i32, constantOffset?: usize): i32 + export function cmpxchg(offset: usize, expected:i32, replacement: i32, constantOffset?: usize): i32; + } + + namespace rmw16_u { + export function add(offset: usize, value: i32, constantOffset?: usize): i32 + export function sub(offset: usize, value: i32, constantOffset?: usize): i32 + export function and(offset: usize, value: i32, constantOffset?: usize): i32 + export function or(offset: usize, value: i32, constantOffset?: usize): i32 + export function xor(offset: usize, value: i32, constantOffset?: usize): i32 + export function xchg(offset: usize, value: i32, constantOffset?: usize): i32 + export function cmpxchg(offset: usize, expected:i32, replacement: i32, constantOffset?: usize): i32; + } + + namespace rmw { + export function add(offset: usize, value: i32, constantOffset?: usize): i32 + export function sub(offset: usize, value: i32, constantOffset?: usize): i32 + export function and(offset: usize, value: i32, constantOffset?: usize): i32 + export function or(offset: usize, value: i32, constantOffset?: usize): i32 + export function xor(offset: usize, value: i32, constantOffset?: usize): i32 + export function xchg(offset: usize, value: i32, constantOffset?: usize): i32 + export function cmpxchg(offset: usize, expected:i32, replacement: i32, constantOffset?: usize): i32; + } + } } /** Converts any other numeric value to a 64-bit signed integer. */ declare function i64(value: i8 | i16 | i32 | i64 | isize | u8 | u16 | u32 | u64 | usize | bool | f32 | f64): i64; @@ -236,6 +314,74 @@ declare namespace i64 { export function parseFloat(string: string): i64; /** Converts A string to an integer. */ export function parseInt(string: string, radix?: i32): i64; + + namespace atomic { + /** Atomically loads an 8-bit signed integer from memory and returns it as a 64-bit signed integer. */ + export function load8_s(offset: usize, constantOffset?: usize): i64; + /** Atomically loads an 8-bit unsigned integer from memory and returns it as a 64-bit unsigned integer. */ + export function load8_u(offset: usize, constantOffset?: usize): u64; + /** Atomically loads a 16-bit signed integer from memory and returns it as a 64-bit signed integer. */ + export function load16_s(offset: usize, constantOffset?: usize): i64; + /** Atomically loads a 16-bit unsigned integer from memory and returns it as a 64-bit unsigned integer. */ + export function load16_u(offset: usize, constantOffset?: usize): u64; + /** Atomically loads a 32-bit signed integer from memory and returns it as a 64-bit signed integer. */ + export function load32_s(offset: usize, constantOffset?: usize): i64; + /** Atomically loads a 32-bit unsigned integer from memory and returns it as a 64-bit unsigned integer. */ + export function load32_u(offset: usize, constantOffset?: usize): u64; + /** Atomically loads a 64-bit unsigned integer from memory. */ + export function load(offset: usize, constantOffset?: usize): i64; + /** Atomically stores a 64-bit integer to memory as an 8-bit integer. */ + export function store8(offset: usize, value: i64, constantOffset?: usize): void; + /** Atomically stores a 64-bit integer to memory as a 16-bit integer. */ + export function store16(offset: usize, value: i64, constantOffset?: usize): void; + /** Atomically stores a 64-bit integer to memory as a 32-bit integer. */ + export function store32(offset: usize, value: i64, constantOffset?: usize): void; + /** Atomically stores a 64-bit integer to memory. */ + export function store(offset: usize, value: i64, constantOffset?: usize): void; + + export function wait(offset: usize, expected: i64, timeout: i64): i32; + export function notify(offset: usize, count: u32): u32; + + namespace rmw8_u { + export function add(offset: usize, value: i64, constantOffset?: usize): i64 + export function sub(offset: usize, value: i64, constantOffset?: usize): i64 + export function and(offset: usize, value: i64, constantOffset?: usize): i64 + export function or(offset: usize, value: i64, constantOffset?: usize): i64 + export function xor(offset: usize, value: i64, constantOffset?: usize): i64 + export function xchg(offset: usize, value: i64, constantOffset?: usize): i64 + export function cmpxchg(offset: usize, expected:i64, replacement: i64, constantOffset?: usize): i64; + } + + namespace rmw16_u { + export function add(offset: usize, value: i64, constantOffset?: usize): i64 + export function sub(offset: usize, value: i64, constantOffset?: usize): i64 + export function and(offset: usize, value: i64, constantOffset?: usize): i64 + export function or(offset: usize, value: i64, constantOffset?: usize): i64 + export function xor(offset: usize, value: i64, constantOffset?: usize): i64 + export function xchg(offset: usize, value: i64, constantOffset?: usize): i64 + export function cmpxchg(offset: usize, expected:i64, replacement: i64, constantOffset?: usize): i64; + } + + namespace rmw32_u { + export function add(offset: usize, value: i64, constantOffset?: usize): i64 + export function sub(offset: usize, value: i64, constantOffset?: usize): i64 + export function and(offset: usize, value: i64, constantOffset?: usize): i64 + export function or(offset: usize, value: i64, constantOffset?: usize): i64 + export function xor(offset: usize, value: i64, constantOffset?: usize): i64 + export function xchg(offset: usize, value: i64, constantOffset?: usize): i64 + export function cmpxchg(offset: usize, expected:i64, replacement: i64, constantOffset?: usize): i64; + } + + namespace rmw { + export function add(offset: usize, value: i64, constantOffset?: usize): i64 + export function sub(offset: usize, value: i64, constantOffset?: usize): i64 + export function and(offset: usize, value: i64, constantOffset?: usize): i64 + export function or(offset: usize, value: i64, constantOffset?: usize): i64 + export function xor(offset: usize, value: i64, constantOffset?: usize): i64 + export function xchg(offset: usize, value: i64, constantOffset?: usize): i64 + export function cmpxchg(offset: usize, expected:i64, replacement: i64, constantOffset?: usize): i64; + } + } } /** Converts any other numeric value to a 32-bit (in WASM32) respectivel 64-bit (in WASM64) signed integer. */ declare var isize: i32 | i64; @@ -627,6 +773,7 @@ declare class String { toString(): string; static fromUTF8(ptr: usize, len: usize): string; toUTF8(): usize; + // split(separator?: string, limit?:i32): string[]; } /** Class for representing a runtime error. Base class of all errors. */ @@ -865,3 +1012,4 @@ declare function inline(target: any, propertyKey: any, descriptor: any): any; /** Annotates an explicit external name of a function or global. */ declare function external(target: any, propertyKey: any, descriptor: any): any; + diff --git a/std/assembly/internal/typedarray.ts b/std/assembly/internal/typedarray.ts index c62f009717..c2e845d0b1 100644 --- a/std/assembly/internal/typedarray.ts +++ b/std/assembly/internal/typedarray.ts @@ -10,6 +10,9 @@ import { SORT as SORT_IMPL } from "./sort"; +// The internal TypedArray class uses two type parameters for the same reason as `loadUnsafe` and +// `storeUnsafe` in 'internal/arraybuffer.ts'. See the documentation there for details. + /** Typed array base class. Not a global object. */ export abstract class TypedArray { [key: number]: T; // compatibility only diff --git a/std/portable/index.d.ts b/std/portable/index.d.ts index 7929beccfa..5641bd8b40 100644 --- a/std/portable/index.d.ts +++ b/std/portable/index.d.ts @@ -423,6 +423,7 @@ declare class String { repeat(count?: i32): string; split(separator?: string, limit?: i32): string[]; toString(): string; + split(separator?: string, limit?:i32): string[]; } interface Boolean {} @@ -594,4 +595,33 @@ declare class Date { declare namespace console { /** @deprecated */ function log(message: string): void; + function info(...any:any[]): void; +} + +declare class Object { + static keys(obj:any):string[]; +} + +declare namespace Atomic { + /** Atomically loads a value of the specified type from memory. Equivalent to dereferncing a pointer in other languages. */ + export function load(ptr: usize, constantOffset?: usize): T; + /** Atomically stores a value of the specified type to memory. Equivalent to dereferencing a pointer in other languages when assigning a value. */ + export function store(ptr: usize, value: any, constantOffset?: usize): void; + /** Atomically add a value of the specified type to memory.*/ + export function add(ptr: usize, value: T): void; + /** Atomically and a value of the specified type to memory.*/ + export function and(ptr: usize, value: T): void; + /** Atomically or a value of the specified type to memory.*/ + export function or(ptr: usize, value: T): void; + /** Atomically xor a value of the specified type to memory.*/ + export function xor(ptr: usize, value: T): void; + /** Atomically exchange a value of the specified type to memory.*/ + export function xchg(ptr: usize, value: T): void; + export function exchange(ptr: usize, value: T): void; + /** Atomically compare exchange a value of the specified type to memory.*/ + export function cmpxchg(ptr: usize, expected:T, replacement: T): T; + export function compareExchange(ptr: usize, expected:T, replacement: T): T; + + export function wait(offset: usize, expected: i32, timeout: i32): i32; + export function notify(offset: usize, count: u32): u32; } diff --git a/tests/compiler.shared-memory.js b/tests/compiler.shared-memory.js new file mode 100644 index 0000000000..9af070e4d6 --- /dev/null +++ b/tests/compiler.shared-memory.js @@ -0,0 +1,244 @@ +const fs = require("fs"); +const path = require("path"); +const os = require("os"); +const glob = require("glob"); +const colorsUtil = require("../cli/util/colors"); +const optionsUtil = require("../cli/util/options"); +const diff = require("./util/diff"); +const asc = require("../cli/asc.js"); + +const config = { + "create": { + "description": [ + "Recreates the fixture for the specified test(s)", + "or all the fixtures if no specific test is given." + ], + "type": "b" + }, + "help": { + "description": "Prints this message and exits.", + "type": "b", + "alias": "h" + } +}; +const opts = optionsUtil.parse(process.argv.slice(2),config); +const args = opts.options; +const argv = opts.arguments; + +if (args.help) { + console.log([ + colorsUtil.white("SYNTAX"), + " " + colorsUtil.cyan("npm run test:compiler.shared-memory --") + " [test1, test2 ...] [options]", + "", + colorsUtil.white("OPTIONS"), + optionsUtil.help(config) + ].join(os.EOL) + os.EOL); + process.exit(0); +} + +var successes = 0; +var failedTests = []; + +const basedir = path.join(__dirname, "compiler.shared-memory"); + +// Get a list of all tests +var tests = glob.sync("**/!(_*).ts", { cwd: basedir }); + +// Run specific tests only if arguments are provided +if (argv.length) { + tests = tests.filter(filename => argv.indexOf(filename.replace(/\.ts$/, "")) >= 0); + if (!tests.length) { + console.error("No matching tests: " + argv.join(" ")); + process.exit(1); + } +} + +const EXPECT_ERROR_PREFIX = '// Expect error:'; + +// Returns an array of error strings to expect, or null if compilation should succeed. +function getExpectedErrors(filePath) { + const lines = fs.readFileSync(filePath).toString().split('\n'); + const expectErrorLines = lines.filter(line => line.startsWith(EXPECT_ERROR_PREFIX)); + if (expectErrorLines.length === 0) { + return null; + } + return expectErrorLines.map(line => line.slice(EXPECT_ERROR_PREFIX.length).trim()); +} + +// TODO: asc's callback is synchronous here. This might change. +tests.forEach(filename => { + console.log(colorsUtil.white("Testing compiler.shared-memory/" + filename) + "\n"); + + const expectedErrors = getExpectedErrors(path.join(basedir, filename)); + const basename = filename.replace(/\.ts$/, ""); + + const stdout = asc.createMemoryStream(); + const stderr = asc.createMemoryStream(chunk => process.stderr.write(chunk.toString().replace(/^(?!$)/mg, " "))); + stderr.isTTY = true; + + var failed = false; + + // TODO: also save stdout/stderr and diff it (-> expected failures) + + // Build unoptimized + asc.main( [ + filename, + "--baseDir", basedir, + "--importMemory", + "--sharedMemory=256", + "--validate", + "--measure", + "--textFile" // -> stdout + ], { + stdout: stdout, + stderr: stderr + }, err => { + console.log(); + + if (expectedErrors) { + const stderrString = stderr.toString(); + for (const expectedError of expectedErrors) { + if (!stderrString.includes(expectedError)) { + console.log(`Expected error "${expectedError}" was not in the error output.`); + console.log("- " + colorsUtil.red("error check ERROR")); + failedTests.push(basename); + console.log(); + return; + } + } + console.log("- " + colorsUtil.green("error check OK")); + ++successes; + console.log(); + return; + } + + if (err) + stderr.write(err + os.EOL); + var actual = stdout.toString().replace(/\r\n/g, "\n"); + if (args.create) { + fs.writeFileSync(path.join(basedir, basename + ".untouched.wat"), actual, { encoding: "utf8" }); + console.log("- " + colorsUtil.yellow("Created fixture")); + } else { + let expected = fs.readFileSync(path.join(basedir, basename + ".untouched.wat"), { encoding: "utf8" }).replace(/\r\n/g, "\n"); + let diffs = diff(basename + ".untouched.wat", expected, actual); + if (diffs !== null) { + console.log(diffs); + console.log("- " + colorsUtil.red("diff ERROR")); + failed = true; + } else + console.log("- " + colorsUtil.green("diff OK")); + } + console.log(); + + stdout.length = 0; + stderr.length = 0; + + // Build optimized + var cmd = [ + filename, + "--baseDir", basedir, + "--importMemory", + "--sharedMemory=256", + "--validate", + "-O3", + "--measure", + "--binaryFile" // -> stdout + ]; + if (args.create) cmd.push( + "--textFile", basename + ".optimized.wat" + ); + asc.main(cmd, { + stdout: stdout, + stderr: stderr + }, err => { + console.log(); + if (err) + stderr.write(err.stack + os.EOL); + + // Instantiate + try { + let memory = new WebAssembly.Memory({ initial: 256, maximum: 256, shared: true }); + let exports = {}; + + function getString(ptr) { + if (!ptr) return "null"; + var U32 = new Uint32Array(exports.memory ? exports.memory.buffer : memory.buffer); + var U16 = new Uint16Array(exports.memory ? exports.memory.buffer : memory.buffer); + var dataLength = U32[ptr >>> 2]; + var dataOffset = (ptr + 4) >>> 1; + var dataRemain = dataLength; + var parts = []; + const chunkSize = 1024; + while (dataRemain > chunkSize) { + let last = U16[dataOffset + chunkSize - 1]; + let size = last >= 0xD800 && last < 0xDC00 ? chunkSize - 1 : chunkSize; + let part = U16.subarray(dataOffset, dataOffset += size); + parts.push(String.fromCharCode.apply(String, part)); + dataRemain -= size; + } + return parts.join("") + String.fromCharCode.apply(String, U16.subarray(dataOffset, dataOffset + dataRemain)); + } + let runTime = asc.measure(() => { + exports = new WebAssembly.Instance(new WebAssembly.Module(stdout.toBuffer()), { + env: { + memory, + abort: function(msg, file, line, column) { + console.log(colorsUtil.red(" abort: " + getString(msg) + " at " + getString(file) + ":" + line + ":" + column)); + }, + trace: function(msg, n) { + console.log(" " + getString(msg) + (n ? " " : "") + Array.prototype.slice.call(arguments, 2, 2 + n).join(", ")); + }, + externalFunction: function() { }, + externalConstant: 1 + }, + JSOp: { + mod: function(a, b) { return a % b; } + }, + JSMath: Math, + + // tests/declare + declare: { + externalFunction: function() { }, + externalConstant: 1 + }, + my: { + externalFunction: function() { }, + externalConstant: 2 + }, + + // tests/external + external: { + foo: function() {}, + bar: function() {} + }, + foo: { + bar: function() {}, + baz: function() {}, + "var": 3 + } + }).exports; + if (exports.main) { + console.log(colorsUtil.white(" [main]")); + var code = exports.main(); + console.log(colorsUtil.white(" [exit " + code + "]\n")); + } + }); + console.log("- " + colorsUtil.green("instantiate OK") + " (" + asc.formatTime(runTime) + ")"); + console.log("\n " + Object.keys(exports).map(key => "[" + (typeof exports[key]).substring(0, 3) + "] " + key).join("\n ")); + } catch (e) { + console.log("- " + colorsUtil.red("instantiate ERROR: ") + e.stack); + failed = true; + } + + if (failed) failedTests.push(basename); + else ++successes; + console.log(); + }); + }); +}); + +if (failedTests.length) { + process.exitCode = 1; + console.log(colorsUtil.red("ERROR: ") + failedTests.length + " compiler tests failed: " + failedTests.join(", ")); +} else + console.log("[ " + colorsUtil.white("SUCCESS") + " ]"); diff --git a/tests/compiler.shared-memory/builtins.optimized.wat b/tests/compiler.shared-memory/builtins.optimized.wat new file mode 100644 index 0000000000..216e7854ae --- /dev/null +++ b/tests/compiler.shared-memory/builtins.optimized.wat @@ -0,0 +1,284 @@ +(module + (type $v (func)) + (import "env" "memory" (memory $0 (shared 0 256))) + (table $0 1 anyfunc) + (elem (i32.const 0) $null) + (global $builtins/i (mut i32) (i32.const 0)) + (global $builtins/I (mut i64) (i64.const 0)) + (global $builtins/u (mut i32) (i32.const 0)) + (global $builtins/U (mut i64) (i64.const 0)) + (export "memory" (memory $0)) + (export "table" (table $0)) + (start $start) + (func $start (; 0 ;) (type $v) + i32.const 0 + i32.const 8 + i32.atomic.store8 + i32.const 2 + i32.const 16 + i32.atomic.store16 + i32.const 4 + i32.const 32 + i32.atomic.store + i32.const 0 + i64.const 8 + i64.atomic.store8 + i32.const 2 + i64.const 16 + i64.atomic.store16 + i32.const 4 + i64.const 32 + i64.atomic.store32 + i32.const 8 + i64.const 64 + i64.atomic.store + i32.const 0 + i32.atomic.load8_u + set_global $builtins/i + i32.const 2 + i32.atomic.load16_u + set_global $builtins/i + i32.const 4 + i32.atomic.load + set_global $builtins/i + i32.const 0 + i32.atomic.load8_u + set_global $builtins/u + i32.const 2 + i32.atomic.load16_u + set_global $builtins/u + i32.const 4 + i32.atomic.load + set_global $builtins/u + i32.const 0 + i64.atomic.load8_u + set_global $builtins/I + i32.const 2 + i64.atomic.load16_u + set_global $builtins/I + i32.const 4 + i64.atomic.load32_u + set_global $builtins/I + i32.const 8 + i64.atomic.load + set_global $builtins/I + i32.const 0 + i64.atomic.load8_u + set_global $builtins/U + i32.const 2 + i64.atomic.load16_u + set_global $builtins/U + i32.const 4 + i64.atomic.load32_u + set_global $builtins/U + i32.const 8 + i64.atomic.load + set_global $builtins/U + i32.const 0 + i32.const 1 + i32.atomic.rmw8_u.add + drop + i32.const 2 + i32.const 1 + i32.atomic.rmw16_u.add + drop + i32.const 4 + i32.const 1 + i32.atomic.rmw.add + drop + i32.const 0 + i64.const 1 + i64.atomic.rmw8_u.add + drop + i32.const 2 + i64.const 1 + i64.atomic.rmw16_u.add + drop + i32.const 4 + i64.const 1 + i64.atomic.rmw32_u.add + drop + i32.const 8 + i64.const 1 + i64.atomic.rmw.add + drop + i32.const 0 + i32.const 1 + i32.atomic.rmw8_u.sub + drop + i32.const 2 + i32.const 1 + i32.atomic.rmw16_u.sub + drop + i32.const 4 + i32.const 1 + i32.atomic.rmw.sub + drop + i32.const 0 + i64.const 1 + i64.atomic.rmw8_u.sub + drop + i32.const 2 + i64.const 1 + i64.atomic.rmw16_u.sub + drop + i32.const 4 + i64.const 1 + i64.atomic.rmw32_u.sub + drop + i32.const 8 + i64.const 1 + i64.atomic.rmw.sub + drop + i32.const 0 + i32.const 1 + i32.atomic.rmw8_u.and + drop + i32.const 2 + i32.const 1 + i32.atomic.rmw16_u.and + drop + i32.const 4 + i32.const 1 + i32.atomic.rmw.and + drop + i32.const 0 + i64.const 1 + i64.atomic.rmw8_u.and + drop + i32.const 2 + i64.const 1 + i64.atomic.rmw16_u.and + drop + i32.const 4 + i64.const 1 + i64.atomic.rmw32_u.and + drop + i32.const 8 + i64.const 1 + i64.atomic.rmw.and + drop + i32.const 0 + i32.const 1 + i32.atomic.rmw8_u.or + drop + i32.const 2 + i32.const 1 + i32.atomic.rmw16_u.or + drop + i32.const 4 + i32.const 1 + i32.atomic.rmw.or + drop + i32.const 0 + i64.const 1 + i64.atomic.rmw8_u.or + drop + i32.const 2 + i64.const 1 + i64.atomic.rmw16_u.or + drop + i32.const 4 + i64.const 1 + i64.atomic.rmw32_u.or + drop + i32.const 8 + i64.const 1 + i64.atomic.rmw.or + drop + i32.const 0 + i32.const 1 + i32.atomic.rmw8_u.xor + drop + i32.const 2 + i32.const 1 + i32.atomic.rmw16_u.xor + drop + i32.const 4 + i32.const 1 + i32.atomic.rmw.xor + drop + i32.const 0 + i64.const 1 + i64.atomic.rmw8_u.xor + drop + i32.const 2 + i64.const 1 + i64.atomic.rmw16_u.xor + drop + i32.const 4 + i64.const 1 + i64.atomic.rmw32_u.xor + drop + i32.const 8 + i64.const 1 + i64.atomic.rmw.xor + drop + i32.const 0 + i32.const 1 + i32.atomic.rmw8_u.xchg + drop + i32.const 2 + i32.const 1 + i32.atomic.rmw16_u.xchg + drop + i32.const 4 + i32.const 1 + i32.atomic.rmw.xchg + drop + i32.const 0 + i64.const 1 + i64.atomic.rmw8_u.xchg + drop + i32.const 2 + i64.const 1 + i64.atomic.rmw16_u.xchg + drop + i32.const 4 + i64.const 1 + i64.atomic.rmw32_u.xchg + drop + i32.const 8 + i64.const 1 + i64.atomic.rmw.xchg + drop + i32.const 0 + i32.const 1 + i32.const 2 + i32.atomic.rmw8_u.cmpxchg + drop + i32.const 2 + i32.const 1 + i32.const 2 + i32.atomic.rmw16_u.cmpxchg + drop + i32.const 4 + i32.const 1 + i32.const 2 + i32.atomic.rmw.cmpxchg + drop + i32.const 0 + i64.const 1 + i64.const 2 + i64.atomic.rmw8_u.cmpxchg + drop + i32.const 2 + i64.const 1 + i64.const 2 + i64.atomic.rmw16_u.cmpxchg + drop + i32.const 4 + i64.const 1 + i64.const 2 + i64.atomic.rmw32_u.cmpxchg + drop + i32.const 8 + i64.const 1 + i64.const 2 + i64.atomic.rmw.cmpxchg + drop + ) + (func $null (; 1 ;) (type $v) + nop + ) +) diff --git a/tests/compiler.shared-memory/builtins.ts b/tests/compiler.shared-memory/builtins.ts new file mode 100644 index 0000000000..36e6804611 --- /dev/null +++ b/tests/compiler.shared-memory/builtins.ts @@ -0,0 +1,100 @@ +var i: i32 = 0; +var I: i64 = 0; +var u: u32 = 0; +var U: u64 = 0; + +// Atomic store +Atomic.store(0, 8); +Atomic.store(2, 16); +Atomic.store(4, 32); +Atomic.store(0, 8); +Atomic.store(2, 16); +Atomic.store(4, 32); +Atomic.store(8, 64); + +// Atomic load +i = Atomic.load(0); +i = Atomic.load(2); +i = Atomic.load(4); +u = Atomic.load(0); +u = Atomic.load(2); +u = Atomic.load(4); + +I = Atomic.load(0); +I = Atomic.load(2); +I = Atomic.load(4); +I = Atomic.load(8); +U = Atomic.load(0); +U = Atomic.load(2); +U = Atomic.load(4); +U = Atomic.load(8); + +// Atomic add +Atomic.add(0, 1); +Atomic.add(2, 1); +Atomic.add(4, 1); + +Atomic.add(0, 1); +Atomic.add(2, 1); +Atomic.add(4, 1); +Atomic.add(8, 1); + +// Atomic subtract +Atomic.sub(0, 1); +Atomic.sub(2, 1); +Atomic.sub(4, 1); + +Atomic.sub(0, 1); +Atomic.sub(2, 1); +Atomic.sub(4, 1); +Atomic.sub(8, 1); + +// Atomic AND +Atomic.and(0, 1); +Atomic.and(2, 1); +Atomic.and(4, 1); + +Atomic.and(0, 1); +Atomic.and(2, 1); +Atomic.and(4, 1); +Atomic.and(8, 1); + +// Atomic OR +Atomic.or(0, 1); +Atomic.or(2, 1); +Atomic.or(4, 1); + +Atomic.or(0, 1); +Atomic.or(2, 1); +Atomic.or(4, 1); +Atomic.or(8, 1); + +// Atomic XOR +Atomic.xor(0, 1); +Atomic.xor(2, 1); +Atomic.xor(4, 1); + +Atomic.xor(0, 1); +Atomic.xor(2, 1); +Atomic.xor(4, 1); +Atomic.xor(8, 1); + +// Atomic xchg +Atomic.xchg(0, 1); +Atomic.xchg(2, 1); +Atomic.xchg(4, 1); + +Atomic.xchg(0, 1); +Atomic.xchg(2, 1); +Atomic.xchg(4, 1); +Atomic.xchg(8, 1); + +// Atomic cmpxchg +Atomic.cmpxchg(0, 1, 2); +Atomic.cmpxchg(2, 1, 2); +Atomic.cmpxchg(4, 1, 2); + +Atomic.cmpxchg(0, 1, 2); +Atomic.cmpxchg(2, 1, 2); +Atomic.cmpxchg(4, 1, 2); +Atomic.cmpxchg(8, 1, 2); diff --git a/tests/compiler.shared-memory/builtins.untouched.wat b/tests/compiler.shared-memory/builtins.untouched.wat new file mode 100644 index 0000000000..49fa64cdbb --- /dev/null +++ b/tests/compiler.shared-memory/builtins.untouched.wat @@ -0,0 +1,284 @@ +(module + (type $v (func)) + (import "env" "memory" (memory $0 (shared 0 256))) + (table $0 1 anyfunc) + (elem (i32.const 0) $null) + (global $builtins/i (mut i32) (i32.const 0)) + (global $builtins/I (mut i64) (i64.const 0)) + (global $builtins/u (mut i32) (i32.const 0)) + (global $builtins/U (mut i64) (i64.const 0)) + (global $HEAP_BASE i32 (i32.const 8)) + (export "memory" (memory $0)) + (export "table" (table $0)) + (start $start) + (func $start (; 0 ;) (type $v) + i32.const 0 + i32.const 8 + i32.atomic.store8 + i32.const 2 + i32.const 16 + i32.atomic.store16 + i32.const 4 + i32.const 32 + i32.atomic.store + i32.const 0 + i64.const 8 + i64.atomic.store8 + i32.const 2 + i64.const 16 + i64.atomic.store16 + i32.const 4 + i64.const 32 + i64.atomic.store32 + i32.const 8 + i64.const 64 + i64.atomic.store + i32.const 0 + i32.atomic.load8_u + set_global $builtins/i + i32.const 2 + i32.atomic.load16_u + set_global $builtins/i + i32.const 4 + i32.atomic.load + set_global $builtins/i + i32.const 0 + i32.atomic.load8_u + set_global $builtins/u + i32.const 2 + i32.atomic.load16_u + set_global $builtins/u + i32.const 4 + i32.atomic.load + set_global $builtins/u + i32.const 0 + i64.atomic.load8_u + set_global $builtins/I + i32.const 2 + i64.atomic.load16_u + set_global $builtins/I + i32.const 4 + i64.atomic.load32_u + set_global $builtins/I + i32.const 8 + i64.atomic.load + set_global $builtins/I + i32.const 0 + i64.atomic.load8_u + set_global $builtins/U + i32.const 2 + i64.atomic.load16_u + set_global $builtins/U + i32.const 4 + i64.atomic.load32_u + set_global $builtins/U + i32.const 8 + i64.atomic.load + set_global $builtins/U + i32.const 0 + i32.const 1 + i32.atomic.rmw8_u.add + drop + i32.const 2 + i32.const 1 + i32.atomic.rmw16_u.add + drop + i32.const 4 + i32.const 1 + i32.atomic.rmw.add + drop + i32.const 0 + i64.const 1 + i64.atomic.rmw8_u.add + drop + i32.const 2 + i64.const 1 + i64.atomic.rmw16_u.add + drop + i32.const 4 + i64.const 1 + i64.atomic.rmw32_u.add + drop + i32.const 8 + i64.const 1 + i64.atomic.rmw.add + drop + i32.const 0 + i32.const 1 + i32.atomic.rmw8_u.sub + drop + i32.const 2 + i32.const 1 + i32.atomic.rmw16_u.sub + drop + i32.const 4 + i32.const 1 + i32.atomic.rmw.sub + drop + i32.const 0 + i64.const 1 + i64.atomic.rmw8_u.sub + drop + i32.const 2 + i64.const 1 + i64.atomic.rmw16_u.sub + drop + i32.const 4 + i64.const 1 + i64.atomic.rmw32_u.sub + drop + i32.const 8 + i64.const 1 + i64.atomic.rmw.sub + drop + i32.const 0 + i32.const 1 + i32.atomic.rmw8_u.and + drop + i32.const 2 + i32.const 1 + i32.atomic.rmw16_u.and + drop + i32.const 4 + i32.const 1 + i32.atomic.rmw.and + drop + i32.const 0 + i64.const 1 + i64.atomic.rmw8_u.and + drop + i32.const 2 + i64.const 1 + i64.atomic.rmw16_u.and + drop + i32.const 4 + i64.const 1 + i64.atomic.rmw32_u.and + drop + i32.const 8 + i64.const 1 + i64.atomic.rmw.and + drop + i32.const 0 + i32.const 1 + i32.atomic.rmw8_u.or + drop + i32.const 2 + i32.const 1 + i32.atomic.rmw16_u.or + drop + i32.const 4 + i32.const 1 + i32.atomic.rmw.or + drop + i32.const 0 + i64.const 1 + i64.atomic.rmw8_u.or + drop + i32.const 2 + i64.const 1 + i64.atomic.rmw16_u.or + drop + i32.const 4 + i64.const 1 + i64.atomic.rmw32_u.or + drop + i32.const 8 + i64.const 1 + i64.atomic.rmw.or + drop + i32.const 0 + i32.const 1 + i32.atomic.rmw8_u.xor + drop + i32.const 2 + i32.const 1 + i32.atomic.rmw16_u.xor + drop + i32.const 4 + i32.const 1 + i32.atomic.rmw.xor + drop + i32.const 0 + i64.const 1 + i64.atomic.rmw8_u.xor + drop + i32.const 2 + i64.const 1 + i64.atomic.rmw16_u.xor + drop + i32.const 4 + i64.const 1 + i64.atomic.rmw32_u.xor + drop + i32.const 8 + i64.const 1 + i64.atomic.rmw.xor + drop + i32.const 0 + i32.const 1 + i32.atomic.rmw8_u.xchg + drop + i32.const 2 + i32.const 1 + i32.atomic.rmw16_u.xchg + drop + i32.const 4 + i32.const 1 + i32.atomic.rmw.xchg + drop + i32.const 0 + i64.const 1 + i64.atomic.rmw8_u.xchg + drop + i32.const 2 + i64.const 1 + i64.atomic.rmw16_u.xchg + drop + i32.const 4 + i64.const 1 + i64.atomic.rmw32_u.xchg + drop + i32.const 8 + i64.const 1 + i64.atomic.rmw.xchg + drop + i32.const 0 + i32.const 1 + i32.const 2 + i32.atomic.rmw8_u.cmpxchg + drop + i32.const 2 + i32.const 1 + i32.const 2 + i32.atomic.rmw16_u.cmpxchg + drop + i32.const 4 + i32.const 1 + i32.const 2 + i32.atomic.rmw.cmpxchg + drop + i32.const 0 + i64.const 1 + i64.const 2 + i64.atomic.rmw8_u.cmpxchg + drop + i32.const 2 + i64.const 1 + i64.const 2 + i64.atomic.rmw16_u.cmpxchg + drop + i32.const 4 + i64.const 1 + i64.const 2 + i64.atomic.rmw32_u.cmpxchg + drop + i32.const 8 + i64.const 1 + i64.const 2 + i64.atomic.rmw.cmpxchg + drop + ) + (func $null (; 1 ;) (type $v) + ) +) diff --git a/tests/compiler.shared-memory/tsconfig.json b/tests/compiler.shared-memory/tsconfig.json new file mode 100644 index 0000000000..0368ea5fc6 --- /dev/null +++ b/tests/compiler.shared-memory/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../../std/assembly.json", + "include": [ + "./**/*.ts" + ] +} diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index ec2cbd2d21..d99eee4235 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -997,10 +997,14 @@ i32.ge_s i32.eqz if +<<<<<<< HEAD get_local $6 +======= +>>>>>>> threading get_local $2 i32.const 2 i32.shl + get_local $6 i32.add get_local $1 i32.store offset=8 @@ -2351,10 +2355,10 @@ get_local $0 get_local $3 i32.store offset=4 - get_local $4 get_local $2 i32.const 2 i32.shl + get_local $4 i32.add get_local $1 i32.store offset=8 @@ -2572,15 +2576,15 @@ loop $continue|0 get_local $3 if - get_local $6 get_local $1 i32.const 2 i32.shl - i32.add get_local $6 + i32.add get_local $2 i32.const 2 i32.shl + get_local $6 i32.add i32.load offset=8 i32.store offset=8 @@ -2774,29 +2778,29 @@ get_local $2 i32.ge_s br_if $break|0 - get_local $3 get_local $1 i32.const 2 i32.shl + get_local $3 i32.add i32.load offset=8 set_local $4 - get_local $3 get_local $1 i32.const 2 i32.shl - i32.add get_local $3 + i32.add get_local $2 i32.const 2 i32.shl + get_local $3 i32.add i32.load offset=8 i32.store offset=8 - get_local $3 get_local $2 i32.const 2 i32.shl + get_local $3 i32.add get_local $4 i32.store offset=8 @@ -2856,10 +2860,10 @@ get_local $4 i32.lt_s if - get_local $0 get_local $2 i32.const 2 i32.shl + get_local $0 i32.add i32.load offset=8 get_local $1 @@ -3029,10 +3033,10 @@ get_local $4 i32.store offset=4 end - get_local $3 get_local $1 i32.const 2 i32.shl + get_local $3 i32.add get_local $2 i32.store offset=8 @@ -3067,10 +3071,10 @@ br_if $break|0 i32.const 3 set_global $~argc - get_local $4 get_local $2 i32.const 2 i32.shl + get_local $4 i32.add i32.load offset=8 get_local $2 @@ -3150,10 +3154,10 @@ br_if $break|0 i32.const 3 set_global $~argc - get_local $4 get_local $2 i32.const 2 i32.shl + get_local $4 i32.add i32.load offset=8 get_local $2 @@ -3233,10 +3237,10 @@ br_if $break|0 i32.const 3 set_global $~argc - get_local $4 get_local $2 i32.const 2 i32.shl + get_local $4 i32.add i32.load offset=8 get_local $2 @@ -3320,10 +3324,10 @@ br_if $break|0 i32.const 3 set_global $~argc - get_local $4 get_local $2 i32.const 2 i32.shl + get_local $4 i32.add i32.load offset=8 get_local $2 @@ -3463,11 +3467,12 @@ get_local $2 i32.const 2 i32.shl + get_local $7 i32.add - get_local $4 get_local $2 i32.const 2 i32.shl + get_local $4 i32.add i32.load offset=8 get_local $2 @@ -3538,6 +3543,7 @@ get_local $2 i32.const 2 i32.shl + get_local $5 i32.add i32.load offset=8 set_local $3 @@ -3629,10 +3635,10 @@ i32.const 4 set_global $~argc get_local $2 - get_local $5 get_local $3 i32.const 2 i32.shl + get_local $5 i32.add i32.load offset=8 get_local $3 @@ -3706,10 +3712,10 @@ i32.const 4 set_global $~argc get_local $2 - get_local $4 get_local $3 i32.const 2 i32.shl + get_local $4 i32.add i32.load offset=8 get_local $3 @@ -4046,10 +4052,11 @@ i32.shl get_local $0 i32.add - tee_local $1 f32.load offset=8 f32.store offset=8 + get_local $0 get_local $1 + i32.add get_local $6 f32.store offset=8 i32.const 1 @@ -4617,10 +4624,11 @@ i32.shl get_local $0 i32.add - tee_local $1 f64.load offset=8 f64.store offset=8 + get_local $0 get_local $1 + i32.add get_local $6 f64.store offset=8 i32.const 1 @@ -5190,10 +5198,11 @@ i32.shl get_local $0 i32.add - tee_local $1 i32.load offset=8 i32.store offset=8 + get_local $0 get_local $1 + i32.add get_local $6 i32.store offset=8 i32.const 1 @@ -6600,20 +6609,20 @@ i32.shl get_local $0 i32.add - get_local $3 get_local $4 i32.const 100 i32.div_u i32.const 2 i32.shl + get_local $3 i32.add i64.load32_u offset=8 - get_local $3 get_local $4 i32.const 100 i32.rem_u i32.const 2 i32.shl + get_local $3 i32.add i64.load32_u offset=8 i64.const 32 @@ -6643,10 +6652,10 @@ i32.shl get_local $0 i32.add - get_local $3 get_local $4 i32.const 2 i32.shl + get_local $3 i32.add i32.load offset=8 i32.store offset=4 @@ -6662,10 +6671,10 @@ i32.shl get_local $0 i32.add - get_local $3 get_local $1 i32.const 2 i32.shl + get_local $3 i32.add i32.load offset=8 i32.store offset=4 @@ -7244,10 +7253,10 @@ get_local $9 i32.add set_global $~lib/internal/number/_K - get_local $12 get_local $9 i32.const 2 i32.shl + get_local $12 i32.add i64.load32_u offset=8 get_local $11 @@ -7379,6 +7388,7 @@ i32.sub i32.const 2 i32.shl + get_local $12 i32.add i64.load32_u offset=8 get_local $8 @@ -7849,10 +7859,10 @@ i32.add i64.load offset=8 set_global $~lib/internal/number/_frc_pow - get_local $4 get_local $5 i32.const 1 i32.shl + get_local $4 i32.add i32.load16_s offset=8 set_global $~lib/internal/number/_exp_pow @@ -8136,6 +8146,8 @@ i32.const 3 return else +<<<<<<< HEAD +======= get_local $0 i32.const 4 i32.add @@ -8152,6 +8164,8 @@ get_local $0 i32.const 8 i32.add +======= +>>>>>>> threading tee_local $0 i32.const 1 i32.shl @@ -8333,6 +8347,7 @@ get_local $0 i32.const 2 i32.shl + get_local $6 i32.add i32.load offset=8 i32.load @@ -8363,10 +8378,10 @@ get_local $5 i32.ge_s br_if $break|1 - get_local $6 get_local $3 i32.const 2 i32.shl + get_local $6 i32.add i32.load offset=8 tee_local $4 @@ -8404,10 +8419,10 @@ br $repeat|1 end end - get_local $6 get_local $5 i32.const 2 i32.shl + get_local $6 i32.add i32.load offset=8 tee_local $4 @@ -8962,7 +8977,6 @@ i32.shl get_local $0 i32.add - get_local $3 get_local $4 i32.const 10000 i32.rem_u @@ -8971,14 +8985,15 @@ i32.div_u i32.const 2 i32.shl + get_local $3 i32.add i64.load32_u offset=8 - get_local $3 get_local $4 i32.const 100 i32.rem_u i32.const 2 i32.shl + get_local $3 i32.add i64.load32_u offset=8 i64.const 32 @@ -8993,16 +9008,16 @@ i32.shl get_local $0 i32.add - get_local $3 get_local $6 i32.const 2 i32.shl + get_local $3 i32.add i64.load32_u offset=8 - get_local $3 get_local $5 i32.const 2 i32.shl + get_local $3 i32.add i64.load32_u offset=8 i64.const 32 @@ -9832,10 +9847,10 @@ get_local $4 i32.ge_s br_if $break|0 - get_local $5 get_local $0 i32.const 2 i32.shl + get_local $5 i32.add i32.load offset=8 tee_local $3 @@ -9861,10 +9876,10 @@ br $repeat|0 end end - get_local $5 get_local $4 i32.const 2 i32.shl + get_local $5 i32.add i32.load offset=8 tee_local $3 @@ -12072,6 +12087,8 @@ i32.ge_s i32.const 0 i32.ne +<<<<<<< HEAD +======= set_global $std/array/includes get_global $std/array/includes i32.const 1 @@ -12248,6 +12265,7 @@ i32.ge_s i32.const 0 i32.ne +>>>>>>> threading set_global $std/array/includes get_global $std/array/includes i32.const 1 @@ -12666,6 +12684,314 @@ i32.const 0 call $std/array/isArraysEqual i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 376 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $std/array/sarr + i32.const 2616 + i32.const 0 + call $std/array/isArraysEqual + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 377 + i32.const 0 + call $~lib/env/abort + unreachable + end + i32.const 2656 + set_global $std/array/sarr + get_global $std/array/sarr + i32.const 7 + i32.const 0 + call $~lib/array/Array#splice + i32.const 2672 + i32.const 0 + call $std/array/isArraysEqual + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 380 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $std/array/sarr + i32.const 2712 + i32.const 0 + call $std/array/isArraysEqual + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 381 + i32.const 0 + call $~lib/env/abort + unreachable + end + i32.const 2752 + set_global $std/array/sarr + get_global $std/array/sarr + i32.const 7 + i32.const 5 + call $~lib/array/Array#splice + i32.const 2768 + i32.const 0 + call $std/array/isArraysEqual + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 384 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $std/array/sarr + i32.const 2808 + i32.const 0 + call $std/array/isArraysEqual + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 385 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $std/array/arr + i32.const 42 + i32.const 0 + call $~lib/array/Array#indexOf + i32.const 0 + i32.ge_s + i32.const 0 + i32.ne + set_global $std/array/includes + get_global $std/array/includes +======= + i32.const 2160 + set_global $std/array/sarr + get_global $std/array/sarr + i32.const -2 +>>>>>>> threading + i32.const 1 + call $~lib/array/Array#splice + i32.const 2184 + i32.const 0 + call $std/array/isArraysEqual + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 360 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $std/array/sarr + i32.const 2224 + i32.const 0 +<<<<<<< HEAD + i32.ge_s + i32.const 0 + i32.ne + set_global $std/array/includes + get_global $std/array/includes +======= + call $std/array/isArraysEqual + i32.eqz +>>>>>>> threading + if + i32.const 0 + i32.const 104 + i32.const 361 + i32.const 0 + call $~lib/env/abort + unreachable + end + i32.const 2264 + set_global $std/array/sarr + get_global $std/array/sarr + i32.const -7 + i32.const 1 + call $~lib/array/Array#splice + i32.const 2288 + i32.const 0 +<<<<<<< HEAD + i32.ge_s + i32.const 0 + i32.ne + set_global $std/array/includes + get_global $std/array/includes +======= + call $std/array/isArraysEqual + i32.eqz +>>>>>>> threading + if + i32.const 0 + i32.const 104 + i32.const 364 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $std/array/sarr + i32.const 2328 + i32.const 0 +<<<<<<< HEAD + i32.ge_s + i32.const 0 + i32.ne + set_global $std/array/includes + get_global $std/array/includes + i32.const 1 + i32.ne +======= + call $std/array/isArraysEqual + i32.eqz +>>>>>>> threading + if + i32.const 0 + i32.const 104 + i32.const 365 + i32.const 0 + call $~lib/env/abort + unreachable + end + i32.const 2368 + set_global $std/array/sarr + get_global $std/array/sarr + i32.const -2 + i32.const -1 + call $~lib/array/Array#splice + i32.const 2384 + i32.const 0 +<<<<<<< HEAD + i32.ge_s + i32.const 0 + i32.ne + set_global $std/array/includes + get_global $std/array/includes + i32.const 1 + i32.ne +======= + call $std/array/isArraysEqual + i32.eqz +>>>>>>> threading + if + i32.const 0 + i32.const 104 + i32.const 368 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $std/array/sarr + i32.const 2424 + i32.const 0 +<<<<<<< HEAD + i32.ge_s + i32.const 0 + i32.ne + set_global $std/array/includes + get_global $std/array/includes + i32.const 1 + i32.ne +======= + call $std/array/isArraysEqual + i32.eqz +>>>>>>> threading + if + i32.const 0 + i32.const 104 + i32.const 369 + i32.const 0 + call $~lib/env/abort + unreachable + end +<<<<<<< HEAD + get_global $std/array/arr + i32.const 43 + i32.const 0 + call $~lib/array/Array#indexOf + i32.const 0 + i32.ge_s + i32.const 0 + i32.ne + set_global $std/array/includes + get_global $std/array/includes +======= + i32.const 2464 + set_global $std/array/sarr + get_global $std/array/sarr +>>>>>>> threading + i32.const 1 + i32.const -2 + call $~lib/array/Array#splice + i32.const 2480 + i32.const 0 + call $std/array/isArraysEqual + i32.eqz + if + i32.const 0 + i32.const 104 + i32.const 372 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $std/array/sarr + i32.const 2520 + i32.const 0 +<<<<<<< HEAD + i32.ge_s + i32.const 0 + i32.ne + set_global $std/array/includes + get_global $std/array/includes + i32.const 1 + i32.ne +======= + call $std/array/isArraysEqual + i32.eqz +>>>>>>> threading + if + i32.const 0 + i32.const 104 + i32.const 373 + i32.const 0 + call $~lib/env/abort + unreachable + end + i32.const 2560 + set_global $std/array/sarr + get_global $std/array/sarr + i32.const 4 + i32.const 0 +<<<<<<< HEAD + i32.ge_s + i32.const 0 + i32.ne + set_global $std/array/includes + get_global $std/array/includes + i32.const 1 + i32.ne +======= + call $~lib/array/Array#splice + i32.const 2576 + i32.const 0 + call $std/array/isArraysEqual + i32.eqz +>>>>>>> threading if i32.const 0 i32.const 104 diff --git a/tests/compiler/std/dataview.optimized.wat b/tests/compiler/std/dataview.optimized.wat index 4ed2ab2aaf..5469fd0449 100644 --- a/tests/compiler/std/dataview.optimized.wat +++ b/tests/compiler/std/dataview.optimized.wat @@ -384,6 +384,7 @@ call $~lib/env/abort unreachable end + get_local $1 get_local $0 i32.load offset=4 get_local $1 diff --git a/tests/compiler/std/gc-array.optimized.wat b/tests/compiler/std/gc-array.optimized.wat index 0b9e07451d..e55c464172 100644 --- a/tests/compiler/std/gc-array.optimized.wat +++ b/tests/compiler/std/gc-array.optimized.wat @@ -1911,10 +1911,10 @@ get_local $4 i32.store offset=4 end - get_local $3 get_local $1 i32.const 2 i32.shl + get_local $3 i32.add get_local $2 i32.store offset=8 diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index cf05327408..001d231b02 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -3460,10 +3460,10 @@ get_local $0 get_local $3 i32.store offset=4 - get_local $4 get_local $2 i32.const 2 i32.shl + get_local $4 i32.add get_local $1 i32.store offset=8 @@ -3778,20 +3778,20 @@ i32.shl get_local $0 i32.add - get_local $3 get_local $4 i32.const 100 i32.div_u i32.const 2 i32.shl + get_local $3 i32.add i64.load32_u offset=8 - get_local $3 get_local $4 i32.const 100 i32.rem_u i32.const 2 i32.shl + get_local $3 i32.add i64.load32_u offset=8 i64.const 32 @@ -3821,10 +3821,10 @@ i32.shl get_local $0 i32.add - get_local $3 get_local $4 i32.const 2 i32.shl + get_local $3 i32.add i32.load offset=8 i32.store offset=4 @@ -3840,10 +3840,10 @@ i32.shl get_local $0 i32.add - get_local $3 get_local $1 i32.const 2 i32.shl + get_local $3 i32.add i32.load offset=8 i32.store offset=4 @@ -4013,7 +4013,6 @@ i32.shl get_local $0 i32.add - get_local $3 get_local $4 i32.const 10000 i32.rem_u @@ -4022,14 +4021,15 @@ i32.div_u i32.const 2 i32.shl + get_local $3 i32.add i64.load32_u offset=8 - get_local $3 get_local $4 i32.const 100 i32.rem_u i32.const 2 i32.shl + get_local $3 i32.add i64.load32_u offset=8 i64.const 32 @@ -4044,16 +4044,16 @@ i32.shl get_local $0 i32.add - get_local $3 get_local $6 i32.const 2 i32.shl + get_local $3 i32.add i64.load32_u offset=8 - get_local $3 get_local $5 i32.const 2 i32.shl + get_local $3 i32.add i64.load32_u offset=8 i64.const 32 @@ -4365,10 +4365,10 @@ get_local $9 i32.add set_global $~lib/internal/number/_K - get_local $12 get_local $9 i32.const 2 i32.shl + get_local $12 i32.add i64.load32_u offset=8 get_local $11 @@ -4500,6 +4500,7 @@ i32.sub i32.const 2 i32.shl + get_local $12 i32.add i64.load32_u offset=8 get_local $8 @@ -4970,10 +4971,10 @@ i32.add i64.load offset=8 set_global $~lib/internal/number/_frc_pow - get_local $4 get_local $5 i32.const 1 i32.shl + get_local $4 i32.add i32.load16_s offset=8 set_global $~lib/internal/number/_exp_pow @@ -6263,6 +6264,7 @@ i32.const 664 i32.const 664 call $~lib/string/String.__eq +<<<<<<< HEAD i32.eqz if i32.const 0 @@ -6371,6 +6373,134 @@ i32.const 864 i32.const 656 call $~lib/string/String.__gt +======= +>>>>>>> threading + i32.eqz + if + i32.const 0 + i32.const 48 + i32.const 113 + i32.const 0 + call $~lib/env/abort + unreachable + end +<<<<<<< HEAD + i32.const 864 + i32.const 656 + call $~lib/string/String.__lt +======= + i32.const 696 + i32.const 712 + call $~lib/string/String.__ne + i32.eqz +>>>>>>> threading + if + i32.const 0 + i32.const 48 + i32.const 114 + i32.const 0 + call $~lib/env/abort + unreachable + end + i32.const 728 + i32.const 744 + call $~lib/string/String.__ne + i32.eqz + if + i32.const 0 + i32.const 48 +<<<<<<< HEAD + i32.const 116 +======= + i32.const 105 +>>>>>>> threading + i32.const 0 + call $~lib/env/abort + unreachable + end + i32.const 760 + i32.const 760 + call $~lib/string/String.__eq + i32.eqz + if + i32.const 0 + i32.const 48 +<<<<<<< HEAD + i32.const 117 +======= + i32.const 106 +>>>>>>> threading + i32.const 0 + call $~lib/env/abort + unreachable + end + i32.const 760 + i32.const 784 + call $~lib/string/String.__ne + i32.eqz + if + i32.const 0 + i32.const 48 +<<<<<<< HEAD + i32.const 119 +======= + i32.const 107 +>>>>>>> threading + i32.const 0 + call $~lib/env/abort + unreachable + end + i32.const 808 + i32.const 840 + call $~lib/string/String.__ne + i32.eqz + if + i32.const 0 + i32.const 48 + i32.const 108 + i32.const 0 + call $~lib/env/abort + unreachable + end + i32.const 648 + i32.const 280 + call $~lib/string/String.__gt + i32.eqz + if + i32.const 0 + i32.const 48 + i32.const 120 + i32.const 0 + call $~lib/env/abort + unreachable + end + i32.const 864 + i32.const 280 + call $~lib/string/String.__gt + i32.eqz + if + i32.const 0 + i32.const 48 + i32.const 111 + i32.const 0 + call $~lib/env/abort + unreachable + end + i32.const 864 + i32.const 872 + call $~lib/string/String.__gte + i32.eqz + if + i32.const 0 + i32.const 48 + i32.const 112 + i32.const 0 + call $~lib/env/abort + unreachable + end + i32.const 864 + i32.const 656 + call $~lib/string/String.__gt i32.eqz if i32.const 0 diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index b001da32af..5c7ff2af8d 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -1197,6 +1197,7 @@ i32.add call $~lib/allocator/arena/__memory_allocate tee_local $1 +<<<<<<< HEAD get_local $0 i32.store get_local $1 @@ -1722,6 +1723,533 @@ i32.const 16 i32.and if +======= + get_local $0 + i32.store + get_local $1 + ) + (func $~lib/internal/memory/memcpy (; 22 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + loop $continue|0 + get_local $2 + if (result i32) + get_local $1 + i32.const 3 + i32.and + else + get_local $2 + end + tee_local $3 + if + get_local $0 + tee_local $4 + i32.const 1 + i32.add + set_local $0 + get_local $1 + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $4 + get_local $3 + i32.load8_u + i32.store8 + get_local $2 + i32.const 1 + i32.sub + set_local $2 + br $continue|0 + end + end + get_local $0 + i32.const 3 + i32.and + i32.eqz + if + loop $continue|1 + get_local $2 + i32.const 16 + i32.ge_u + if + get_local $0 + get_local $1 + i32.load + i32.store + get_local $0 + i32.const 4 + i32.add + get_local $1 + i32.const 4 + i32.add + i32.load + i32.store + get_local $0 + i32.const 8 + i32.add + get_local $1 + i32.const 8 + i32.add + i32.load + i32.store + get_local $0 + i32.const 12 + i32.add + get_local $1 + i32.const 12 + i32.add + i32.load + i32.store + get_local $1 + i32.const 16 + i32.add + set_local $1 + get_local $0 + i32.const 16 + i32.add + set_local $0 + get_local $2 + i32.const 16 + i32.sub + set_local $2 + br $continue|1 + end + end + get_local $2 + i32.const 8 + i32.and + if + get_local $0 + get_local $1 + i32.load + i32.store + get_local $0 + i32.const 4 + i32.add + get_local $1 + i32.const 4 + i32.add + i32.load + i32.store + get_local $0 + i32.const 8 + i32.add + set_local $0 + get_local $1 + i32.const 8 + i32.add + set_local $1 + end + get_local $2 + i32.const 4 + i32.and + if + get_local $0 + get_local $1 + i32.load + i32.store + get_local $0 + i32.const 4 + i32.add + set_local $0 + get_local $1 + i32.const 4 + i32.add + set_local $1 + end + get_local $2 + i32.const 2 + i32.and + if + get_local $0 + get_local $1 + i32.load16_u + i32.store16 + get_local $0 + i32.const 2 + i32.add + set_local $0 + get_local $1 + i32.const 2 + i32.add + set_local $1 + end + get_local $2 + i32.const 1 + i32.and + if + get_local $1 + set_local $3 + get_local $0 + get_local $1 + i32.load8_u + i32.store8 + end + return + end + get_local $2 + i32.const 32 + i32.ge_u + if + block $break|2 + block $case2|2 + block $case1|2 + get_local $0 + i32.const 3 + i32.and + tee_local $3 + i32.const 1 + i32.ne + if + get_local $3 + i32.const 2 + i32.eq + br_if $case1|2 + get_local $3 + i32.const 3 + i32.eq + br_if $case2|2 + br $break|2 + end + get_local $1 + i32.load + set_local $5 + get_local $0 + get_local $1 + tee_local $3 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $1 + set_local $0 + get_local $1 + get_local $3 + i32.const 1 + i32.add + tee_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $4 + i32.const 1 + i32.add + set_local $0 + get_local $1 + i32.const 1 + i32.add + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $4 + get_local $3 + i32.load8_u + i32.store8 + get_local $2 + i32.const 3 + i32.sub + set_local $2 + loop $continue|3 + get_local $2 + i32.const 17 + i32.ge_u + if + get_local $0 + get_local $1 + i32.const 1 + i32.add + i32.load + tee_local $3 + i32.const 8 + i32.shl + get_local $5 + i32.const 24 + i32.shr_u + i32.or + i32.store + get_local $0 + i32.const 4 + i32.add + get_local $1 + i32.const 5 + i32.add + i32.load + tee_local $5 + i32.const 8 + i32.shl + get_local $3 + i32.const 24 + i32.shr_u + i32.or + i32.store + get_local $0 + i32.const 8 + i32.add + get_local $1 + i32.const 9 + i32.add + i32.load + tee_local $3 + i32.const 8 + i32.shl + get_local $5 + i32.const 24 + i32.shr_u + i32.or + i32.store + get_local $0 + i32.const 12 + i32.add + get_local $1 + i32.const 13 + i32.add + i32.load + tee_local $5 + i32.const 8 + i32.shl + get_local $3 + i32.const 24 + i32.shr_u + i32.or + i32.store + get_local $1 + i32.const 16 + i32.add + set_local $1 + get_local $0 + i32.const 16 + i32.add + set_local $0 + get_local $2 + i32.const 16 + i32.sub + set_local $2 + br $continue|3 + end + end + br $break|2 + end + get_local $1 + i32.load + set_local $5 + get_local $0 + get_local $1 + i32.load8_u + i32.store8 + get_local $0 + i32.const 1 + i32.add + tee_local $4 + i32.const 1 + i32.add + set_local $0 + get_local $1 + i32.const 1 + i32.add + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $4 + get_local $3 + i32.load8_u + i32.store8 + get_local $2 + i32.const 2 + i32.sub + set_local $2 + loop $continue|4 + get_local $2 + i32.const 18 + i32.ge_u + if + get_local $0 + get_local $1 + i32.const 2 + i32.add + i32.load + tee_local $3 + i32.const 16 + i32.shl + get_local $5 + i32.const 16 + i32.shr_u + i32.or + i32.store + get_local $0 + i32.const 4 + i32.add + get_local $1 + i32.const 6 + i32.add + i32.load + tee_local $5 + i32.const 16 + i32.shl + get_local $3 + i32.const 16 + i32.shr_u + i32.or + i32.store + get_local $0 + i32.const 8 + i32.add + get_local $1 + i32.const 10 + i32.add + i32.load + tee_local $3 + i32.const 16 + i32.shl + get_local $5 + i32.const 16 + i32.shr_u + i32.or + i32.store + get_local $0 + i32.const 12 + i32.add + get_local $1 + i32.const 14 + i32.add + i32.load + tee_local $5 + i32.const 16 + i32.shl + get_local $3 + i32.const 16 + i32.shr_u + i32.or + i32.store + get_local $1 + i32.const 16 + i32.add + set_local $1 + get_local $0 + i32.const 16 + i32.add + set_local $0 + get_local $2 + i32.const 16 + i32.sub + set_local $2 + br $continue|4 + end + end + br $break|2 + end + get_local $1 + i32.load + set_local $5 + get_local $0 + tee_local $4 + i32.const 1 + i32.add + set_local $0 + get_local $1 + tee_local $3 + i32.const 1 + i32.add + set_local $1 + get_local $4 + get_local $3 + i32.load8_u + i32.store8 + get_local $2 + i32.const 1 + i32.sub + set_local $2 + loop $continue|5 + get_local $2 + i32.const 19 + i32.ge_u + if + get_local $0 + get_local $1 + i32.const 3 + i32.add + i32.load + tee_local $3 + i32.const 24 + i32.shl + get_local $5 + i32.const 8 + i32.shr_u + i32.or + i32.store + get_local $0 + i32.const 4 + i32.add + get_local $1 + i32.const 7 + i32.add + i32.load + tee_local $5 + i32.const 24 + i32.shl + get_local $3 + i32.const 8 + i32.shr_u + i32.or + i32.store + get_local $0 + i32.const 8 + i32.add + get_local $1 + i32.const 11 + i32.add + i32.load + tee_local $3 + i32.const 24 + i32.shl + get_local $5 + i32.const 8 + i32.shr_u + i32.or + i32.store + get_local $0 + i32.const 12 + i32.add + get_local $1 + i32.const 15 + i32.add + i32.load + tee_local $5 + i32.const 24 + i32.shl + get_local $3 + i32.const 8 + i32.shr_u + i32.or + i32.store + get_local $1 + i32.const 16 + i32.add + set_local $1 + get_local $0 + i32.const 16 + i32.add + set_local $0 + get_local $2 + i32.const 16 + i32.sub + set_local $2 + br $continue|5 + end + end + end + end + get_local $2 + i32.const 16 + i32.and + if +>>>>>>> threading get_local $0 get_local $1 tee_local $3 diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index df25dbd762..4b05fca608 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -1465,6 +1465,8 @@ f64.load offset=8 f64.store offset=8 get_local $2 + get_local $4 + i32.add get_local $7 f64.store offset=8 i32.const 1 @@ -1619,6 +1621,7 @@ i32.const 8 i32.add get_local $2 + get_local $3 i32.add f64.load offset=8 set_local $5 @@ -1738,6 +1741,7 @@ call $~lib/env/abort unreachable end + get_local $1 get_local $0 i32.load offset=4 get_local $1 @@ -1779,6 +1783,7 @@ call $~lib/env/abort unreachable end + get_local $1 get_local $0 i32.load offset=4 get_local $1 @@ -1878,6 +1883,7 @@ call $~lib/env/abort unreachable end + get_local $1 get_local $0 i32.load offset=4 get_local $1 diff --git a/tests/decompiler.js b/tests/decompiler.js index 47e78ba5eb..db37d64f6d 100644 --- a/tests/decompiler.js +++ b/tests/decompiler.js @@ -1,25 +1,105 @@ -var binaryen = global.Binaryen = require("../lib/binaryen"); +var binaryen = global.Binaryen = require("binaryen"); +let asc = require("../cli/asc"); +var loader = require("../lib/loader"); require("ts-node").register({ project: require("path").join(__dirname, "..", "src", "tsconfig.json") }); require("../src/glue/js"); +var MODULE = require('../src/module'); +var Compiler = require('../src/compiler'); +let Parser = require("../lib/parse"); +var Decompiler = require("../src/decompiler").Decompiler; +let fs = require("fs"); -var mod = new binaryen.Module(); -var ftype = mod.addFunctionType("i", binaryen.i32, [ ]); -var fn = mod.addFunction("main", ftype, [], - mod.block(null, [ - mod.return( - mod.i32.add( - mod.i32.const(1), - mod.i32.const(2) - ) - ) - ]) -); +//Compile Test file +asc.main([ + "index.ts", + "--baseDir",`${__dirname}/decompiler`, + "-b", "build/untouched.wasm", + "-t", "build/untouched.wat", + "--tsdFile", "index.d.ts", + // "--noTreeShaking", + "--sourceMap", + "--validate", + // "--importMemory", + "--debug", + "-O0", + "--shrinkLevel", "0", + "--optimizeLevel", "0", + ], async () => { -mod.validate(); -mod.emitText(); + //When finished compiling need to get function names, which the parser can do. + let funcTypes = []; + let funcsIndexes = []; + function onFunction(funIndex, typeIndex) { + funcTypes.push(typeIndex); + funcsIndexes.push(`${funIndex}`); //This is incase there is not a name section. + // console.log("- Function[" + funIndex + "] -> FunctionType[" + typeIndex + "]"); + } + //Need to include onSection because otherwise nothing else gets parsed. + var startFuncIndex = 0; + function onSection(id, offset, length, nameOffset, nameLength) { + var name = id == 0 ? "'" + Parser.parse.readString(nameOffset, nameLength) + "'" : Parser.SectionId[id]; + console.log(name + " section at " + offset + ".." + (offset + length)); + if (name.toLowerCase() === "start"){ + startFuncIndex = Parser.parse.readUint32(offset); + } + return true; + } -var Decompiler = require("../src/decompiler").Decompiler; -var decompiler = new Decompiler(); -decompiler.decompileFunction(fn); -console.log(decompiler.finish()); + let funcs = []; + function onFunctionName(index, offset, length) { + var name = Parser.parse.readString(offset, length); + funcs.push(name) + // console.log(" - Function[" + index + "] name: " + name); + } + + let binary = fs.readFileSync(`${__dirname}/decompiler/build/untouched.wasm`); + Parser.parse(binary, { + onSection, + // onType, + // onTypeParam, + // onTypeReturn, + // onImport, + // onFunctionImport, + // onTableImport, + // onMemoryImport, + // onGlobalImport, + // onMemory, + onFunction, + // onTable, + // onGlobal, + // onStart, + // onExport, + // onSourceMappingURL, + // onModuleName, + onFunctionName, + }); + + var decompiler = new Decompiler(); + var mod = binaryen.readBinary(binary); + //Uncomment the boolean below to also decompile internal functions. + funcs.filter((x)=> /* true || */!x.startsWith('~')).forEach((name) => { + try { + // console.log("decompiling "+name) + let func = mod.getFunction(name); + decompiler.decompileFunction(func); + decompiler.push("\n"); + } catch (e){ + console.log(e); + } + }); + console.log(decompiler.finish()); + let Mod; + mod.setStart(mod.getFunction("null")); //Set start function to null function. + mod.addFunctionExport("start", "start"); + debugger; + Mod = loader.instantiateBuffer(mod.emitBinary(), {index: + {println:console.log, + asyncfn: (self, cb) => { + Mod.getFunction(cb)(self, 42) + } + //self is an object & cb is an anonymous function in the module's table. + }}); + + Mod.start(); +}); diff --git a/tests/decompiler/build/untouched.wat b/tests/decompiler/build/untouched.wat new file mode 100644 index 0000000000..e7fb4fc15f --- /dev/null +++ b/tests/decompiler/build/untouched.wat @@ -0,0 +1,282 @@ +(module + (type $iii (func (param i32 i32) (result i32))) + (type $ii (func (param i32) (result i32))) + (type $iiv (func (param i32 i32))) + (type $iv (func (param i32))) + (type $v (func)) + (import "index" "println" (func $index/println (param i32))) + (import "index" "asyncfn" (func $index/asyncfn (param i32 i32))) + (memory $0 0) + (table $0 3 anyfunc) + (elem (i32.const 0) $null $index/Test#constructor~anonymous|1 $index/Test#callAsync~anonymous|2) + (global $~lib/internal/allocator/AL_BITS i32 (i32.const 3)) + (global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8)) + (global $~lib/internal/allocator/AL_MASK i32 (i32.const 7)) + (global $~lib/internal/allocator/MAX_SIZE_32 i32 (i32.const 1073741824)) + (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) + (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) + (global $index/t (mut i32) (i32.const 0)) + (global $index/t2 (mut i32) (i32.const 0)) + (global $HEAP_BASE i32 (i32.const 8)) + (export "memory" (memory $0)) + (export "table" (table $0)) + (export "Test#constructor" (func $index/Test#constructor)) + (export "Test#get:a" (func $Test#get:a)) + (export "Test#set:a" (func $Test#set:a)) + (export "Test#get:i" (func $Test#get:i)) + (export "Test#set:i" (func $Test#set:i)) + (export "Test#_if" (func $index/Test#_if)) + (export "Test#_else" (func $index/Test#_else)) + (export "Test#_while" (func $index/Test#_while)) + (export "Test#_doWhile" (func $index/Test#_doWhile)) + (export "Test#print" (func $index/Test#print)) + (export "Test#callAsync" (func $index/Test#callAsync)) + (start $start) + (func $index/Test#constructor~anonymous|1 (; 2 ;) (type $ii) (param $0 i32) (result i32) + get_local $0 + get_local $0 + i32.mul + ) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + get_local $0 + get_global $~lib/internal/allocator/MAX_SIZE_32 + i32.gt_u + if + unreachable + end + get_global $~lib/allocator/arena/offset + set_local $1 + get_local $1 + get_local $0 + tee_local $2 + i32.const 1 + tee_local $3 + get_local $2 + get_local $3 + i32.gt_u + select + i32.add + get_global $~lib/internal/allocator/AL_MASK + i32.add + get_global $~lib/internal/allocator/AL_MASK + i32.const -1 + i32.xor + i32.and + set_local $4 + current_memory + set_local $5 + get_local $4 + get_local $5 + i32.const 16 + i32.shl + i32.gt_u + if + get_local $4 + get_local $1 + i32.sub + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + set_local $2 + get_local $5 + tee_local $3 + get_local $2 + tee_local $6 + get_local $3 + get_local $6 + i32.gt_s + select + set_local $3 + get_local $3 + grow_memory + i32.const 0 + i32.lt_s + if + get_local $2 + grow_memory + i32.const 0 + i32.lt_s + if + unreachable + end + end + end + get_local $4 + set_global $~lib/allocator/arena/offset + get_local $1 + ) + (func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + get_local $0 + call $~lib/allocator/arena/__memory_allocate + return + ) + (func $index/Test#constructor (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + get_local $0 + if (result i32) + get_local $0 + else + block (result i32) + i32.const 8 + call $~lib/memory/memory.allocate + set_local $2 + get_local $2 + i32.const 0 + i32.store + get_local $2 + get_local $1 + i32.store offset=4 + get_local $2 + end + tee_local $0 + end + tee_local $0 + i32.const 1 + i32.store + get_local $0 + ) + (func $index/Test#_if (; 6 ;) (type $iiv) (param $0 i32) (param $1 i32) + get_local $0 + i32.load offset=4 + get_local $1 + i32.lt_s + if + get_local $0 + get_local $1 + i32.store offset=4 + end + ) + (func $index/Test#_else (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32) + get_local $0 + i32.load offset=4 + get_local $1 + i32.lt_s + if + get_local $0 + get_local $1 + i32.store offset=4 + else + get_local $0 + get_local $0 + i32.load offset=4 + i32.const 1 + i32.add + i32.store offset=4 + end + ) + (func $index/Test#_while (; 8 ;) (type $iiv) (param $0 i32) (param $1 i32) + loop $continue|0 + get_local $0 + i32.load offset=4 + get_local $1 + i32.gt_s + if + get_local $0 + get_local $0 + i32.load offset=4 + i32.const 1 + i32.sub + i32.store offset=4 + br $continue|0 + end + end + ) + (func $index/Test#_doWhile (; 9 ;) (type $iiv) (param $0 i32) (param $1 i32) + loop $continue|0 + get_local $0 + get_local $0 + i32.load offset=4 + i32.const 1 + i32.add + i32.store offset=4 + get_local $0 + i32.load offset=4 + get_local $1 + i32.lt_s + br_if $continue|0 + end + ) + (func $index/Test#print (; 10 ;) (type $iiv) (param $0 i32) (param $1 i32) + get_local $1 + call $index/println + ) + (func $index/Test#callAsync~anonymous|2 (; 11 ;) (type $iiv) (param $0 i32) (param $1 i32) + get_local $0 + get_local $1 + call $index/Test#print + ) + (func $index/Test#callAsync (; 12 ;) (type $iv) (param $0 i32) + get_local $0 + i32.const 2 + call $index/asyncfn + ) + (func $start (; 13 ;) (type $v) + get_global $HEAP_BASE + get_global $~lib/internal/allocator/AL_MASK + i32.add + get_global $~lib/internal/allocator/AL_MASK + i32.const -1 + i32.xor + i32.and + set_global $~lib/allocator/arena/startOffset + get_global $~lib/allocator/arena/startOffset + set_global $~lib/allocator/arena/offset + nop + i32.const 0 + i32.const 0 + call $index/Test#constructor + set_global $index/t + i32.const 0 + i32.const 0 + call $index/Test#constructor + set_global $index/t2 + get_global $index/t + i32.const 1 + call $index/Test#_if + get_global $index/t + i32.const 3 + call $index/Test#_else + get_global $index/t + call $index/Test#callAsync + get_global $index/t + i32.load offset=4 + call $index/println + get_global $index/t + i32.const 1 + call $index/Test#_while + get_global $index/t + i32.load offset=4 + call $index/println + ) + (func $null (; 14 ;) (type $v) + ) + (func $Test#get:a (; 15 ;) (type $ii) (param $0 i32) (result i32) + get_local $0 + i32.load + ) + (func $Test#set:a (; 16 ;) (type $iiv) (param $0 i32) (param $1 i32) + get_local $0 + get_local $1 + i32.store + ) + (func $Test#get:i (; 17 ;) (type $ii) (param $0 i32) (result i32) + get_local $0 + i32.load offset=4 + ) + (func $Test#set:i (; 18 ;) (type $iiv) (param $0 i32) (param $1 i32) + get_local $0 + get_local $1 + i32.store offset=4 + ) +) diff --git a/tests/decompiler/index.d.ts b/tests/decompiler/index.d.ts new file mode 100644 index 0000000000..7ca12156af --- /dev/null +++ b/tests/decompiler/index.d.ts @@ -0,0 +1,23 @@ +declare module ASModule { + type i8 = number; + type i16 = number; + type i32 = number; + type u8 = number; + type u16 = number; + type u32 = number; + type f32 = number; + type f64 = number; + type bool = any; + class Test { + constructor(i: i32); + a: u32; + i: i32; + _if(i: i32): void; + _else(i: i32): void; + _while(i: i32): void; + _doWhile(i: i32): void; + print(i: i32): void; + callAsync(): void; + } +} +export default ASModule; diff --git a/tests/decompiler/index.ts b/tests/decompiler/index.ts new file mode 100644 index 0000000000..bb77d5e4c5 --- /dev/null +++ b/tests/decompiler/index.ts @@ -0,0 +1,63 @@ +import "allocator/arena"; + +declare function println(s: i32):void; + +type callback = (self: T, x: i32) => void; + +declare function asyncfn(obj: T, cb: callback): void; + + +export class Test { + a :(x:i32) => i32 ; + constructor(public i: i32){ + this.a = (x: i32):i32 => x*x; + } + + _if(i: i32): void { + if (this.i < i) { + this.i = i; + } + } + + _else(i: i32): void { + if (this.i < i) { + this.i = i; + } else { + this.i = this.i + 1; + } + } + + _while(i:i32): void { + while(this.i > i) { + this.i = this.i - 1; + } + } + + _doWhile(i:i32): void { + do { + this.i = this.i + 1; + } while(this.i < i) + } + + print(i: i32): void{ + println(i); + } + + callAsync(): void { + asyncfn(this, (self:Test, x: i32): void => { + self.print(x); + }) + } +} + +class Test2 extends Test{} + +let t:Test; +t = new Test(0); +let t2: Test2 = new Test2(0); +t._if(1); +t._else(3); +t.callAsync(); +println(t.i); +t._while(1); +println(t.i); diff --git a/tests/decompiler/tsconfig.json b/tests/decompiler/tsconfig.json new file mode 100644 index 0000000000..5413811732 --- /dev/null +++ b/tests/decompiler/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../../std/assembly.json", + "include": [ + "./*.ts" + ] +}