From 67d80132277873c7046040a8eaa7dd583a88f24c Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Wed, 17 Jun 2020 11:49:32 -0400 Subject: [PATCH 01/58] implement naive asconfig --- cli/asc.js | 31 ++++++++++++++++++++++++++++++- cli/asc.json | 12 ++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/cli/asc.js b/cli/asc.js index 9d718d8bd0..9987d68aa5 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -194,7 +194,8 @@ exports.main = function main(argv, options, callback) { if (!stderr) throw Error("'options.stderr' must be specified"); const opts = optionsUtil.parse(argv, exports.options); - const args = opts.options; + let args = opts.options; + argv = opts.arguments; if (args.noColors) { colorsUtil.stdout.supported = @@ -270,6 +271,24 @@ exports.main = function main(argv, options, callback) { // Set up base directory const baseDir = args.baseDir ? path.resolve(args.baseDir) : "."; + const target = args.target; + + // Once the basedir is calculated, we can resolve the config, and it's extensions + let asconfig = getAsconfig(opts.config, baseDir, readFile); + while (asconfig) { + if (asconfig.targets && asconfig.targets[target]) { + optionsUtil.merge(exports.options, args, asconfig.targets[target]) + } + if (asconfig.options) { + optionsUtil.merge(exports.options, args, asconfig.options); + } + if (asconfig.extends) { + const dirname = path.dirname(path.join(baseDir, options.config)); + asconfig = getAsconfig(asconfig.extends, dirname, readFile); + } else { + asconfig = null; // finished resolving the configuration + } + } // Set up options const compilerOptions = assemblyscript.newOptions(); @@ -924,6 +943,16 @@ exports.main = function main(argv, options, callback) { } }; +function getAsconfig(file, baseDir, readFile) { + const contents = readFile(file, baseDir); + if (!contents) return null; + const config = JSON.parse(contents); + // TODO: validate configuration shape + // TODO: wrap JSON.parse() in try catch to obtain a more descriptive error + return config; +} +exports.getAsconfig = getAsconfig; + /** Checks diagnostics emitted so far for errors. */ function checkDiagnostics(program, stderr) { var diagnostic; diff --git a/cli/asc.json b/cli/asc.json index fbbe218b70..3eade231c1 100644 --- a/cli/asc.json +++ b/cli/asc.json @@ -17,6 +17,18 @@ "type": "b", "default": false }, + "config": { + "category": "General", + "description": "Provides a configuration for assemblyscript to compile your project.", + "type": "s", + "default": "asconfig.js" + }, + "target": { + "category": "General", + "description": "Provides a compile target for use with an assemblyscript configuration.", + "type": "s", + "default": "release" + }, "optimize": { "category": "Optimization", From 6a70013b119dc326d3aa9d69fb2ac9b5c3bdcd46 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Wed, 17 Jun 2020 12:10:50 -0400 Subject: [PATCH 02/58] switch to args, whoops --- cli/asc.js | 3 ++- cli/asc.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index 9987d68aa5..aa82c4677c 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -274,8 +274,9 @@ exports.main = function main(argv, options, callback) { const target = args.target; // Once the basedir is calculated, we can resolve the config, and it's extensions - let asconfig = getAsconfig(opts.config, baseDir, readFile); + let asconfig = getAsconfig(args.config, baseDir, readFile); while (asconfig) { + // merge target first, then base options, then extended asconfigs if (asconfig.targets && asconfig.targets[target]) { optionsUtil.merge(exports.options, args, asconfig.targets[target]) } diff --git a/cli/asc.json b/cli/asc.json index 3eade231c1..1ac4f0236e 100644 --- a/cli/asc.json +++ b/cli/asc.json @@ -21,7 +21,7 @@ "category": "General", "description": "Provides a configuration for assemblyscript to compile your project.", "type": "s", - "default": "asconfig.js" + "default": "asconfig.json" }, "target": { "category": "General", From 4cf1b2b8dcdbedd60f3b4445473ebb822062683c Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Wed, 17 Jun 2020 12:25:49 -0400 Subject: [PATCH 03/58] semicolon for lint --- cli/asc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.js b/cli/asc.js index aa82c4677c..a4ee2834b1 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -278,7 +278,7 @@ exports.main = function main(argv, options, callback) { while (asconfig) { // merge target first, then base options, then extended asconfigs if (asconfig.targets && asconfig.targets[target]) { - optionsUtil.merge(exports.options, args, asconfig.targets[target]) + optionsUtil.merge(exports.options, args, asconfig.targets[target]); } if (asconfig.options) { optionsUtil.merge(exports.options, args, asconfig.options); From 01153418081bbc2259f0d72ac2873d6b19d0f523 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Wed, 17 Jun 2020 12:42:30 -0400 Subject: [PATCH 04/58] each merge returns an options object --- cli/asc.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index a4ee2834b1..c799661e03 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -278,10 +278,10 @@ exports.main = function main(argv, options, callback) { while (asconfig) { // merge target first, then base options, then extended asconfigs if (asconfig.targets && asconfig.targets[target]) { - optionsUtil.merge(exports.options, args, asconfig.targets[target]); + args = optionsUtil.merge(exports.options, args, asconfig.targets[target]); } if (asconfig.options) { - optionsUtil.merge(exports.options, args, asconfig.options); + args = optionsUtil.merge(exports.options, args, asconfig.options); } if (asconfig.extends) { const dirname = path.dirname(path.join(baseDir, options.config)); From cb6e9acbc586ede0db73a1a45fcb6c4ac8e3efb7 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Wed, 17 Jun 2020 13:58:14 -0400 Subject: [PATCH 05/58] try to follow coding style, maybe use for of loop? --- cli/asc.js | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index c799661e03..88c305c09f 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -944,14 +944,45 @@ exports.main = function main(argv, options, callback) { } }; +const toString = Object.prototype.toString; +const typeOf = val => toString.call(val).slice(7, -1); + function getAsconfig(file, baseDir, readFile) { const contents = readFile(file, baseDir); + const location = path.join(baseDir, file); if (!contents) return null; - const config = JSON.parse(contents); - // TODO: validate configuration shape - // TODO: wrap JSON.parse() in try catch to obtain a more descriptive error + + // obtain the configuration + let config; + try { + config = JSON.parse(contents); + } catch(ex) { + throw new Error("Asconfig is not valid json: " + location); + } + + // validate asconfig shape + if (config.options && typeOf(config.options) !== "Object") { + throw new Error("Asconfig.options is not an object: " + location); + } + if (config.include && typeOf(config.include) !== "Array") { + throw new Error("Asconfig.include is not an object: " + location); + } + if (config.targets) { + if (typeOf(config.targets) !== "Object") { + throw new Error("Asconfig.targets is not an object: " + location); + } + const targets = Object.keys(config.targets); + for (let i = 0; i < targets.length; i++) { + const target = targets[i]; + if (typeOf(config.targets[target]) !== "Object") { + throw new Error("Asconfig.targets." + target + " is not an object: " + location); + } + } + } + return config; } + exports.getAsconfig = getAsconfig; /** Checks diagnostics emitted so far for errors. */ From f071ae8c378de3976b36de805e625ec5e8dffaa5 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Wed, 17 Jun 2020 14:14:35 -0400 Subject: [PATCH 06/58] Actually, ' Object' is not 'Object' --- cli/asc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.js b/cli/asc.js index 88c305c09f..68326c7079 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -945,7 +945,7 @@ exports.main = function main(argv, options, callback) { }; const toString = Object.prototype.toString; -const typeOf = val => toString.call(val).slice(7, -1); +const typeOf = val => toString.call(val).slice(8, -1); function getAsconfig(file, baseDir, readFile) { const contents = readFile(file, baseDir); From dd12c9a9029455282a42684f1fa86fbd79d7de19 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Sat, 20 Jun 2020 02:12:21 -0400 Subject: [PATCH 07/58] add asconfig.entries to compilation, keep track of asconfigDir for later use, dedupe argv, transform, and lib --- cli/asc.js | 46 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index 68326c7079..83fe6392f9 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -275,22 +275,58 @@ exports.main = function main(argv, options, callback) { // Once the basedir is calculated, we can resolve the config, and it's extensions let asconfig = getAsconfig(args.config, baseDir, readFile); + let asconfigDir = baseDir; + while (asconfig) { - // merge target first, then base options, then extended asconfigs + // merge target first, then merge options, then merge extended asconfigs if (asconfig.targets && asconfig.targets[target]) { args = optionsUtil.merge(exports.options, args, asconfig.targets[target]); } if (asconfig.options) { args = optionsUtil.merge(exports.options, args, asconfig.options); } + + // entries are added to the compilation + if (asconfig.entries) { + for (const entry of entries) { + argv.push( + path.isAbsolute(entry) + ? entry + // the entry is relative to the asconfig directory + : path.join(asconfigDir, entry) + ); + } + } + + // asconfig "extends" another config, merging options of it's parent if (asconfig.extends) { - const dirname = path.dirname(path.join(baseDir, options.config)); - asconfig = getAsconfig(asconfig.extends, dirname, readFile); + asconfigDir = path.isAbsolute(asconfig.extends) + // absolute extension path means we know the exact directory and location + ? path.dirname(asconfig.extends) + // relative means we need to calculate a relative asconfigDir + : path.join(asconfigDir, path.dirname(asconfig.extends)); + asconfig = getAsconfig(asconfigDir, path.basename(asconfig.extends), readFile); } else { - asconfig = null; // finished resolving the configuration + asconfig = null; // finished resolving the configuration chain } } + // Just some helper functions + const resolve = arg => path.isAbsolute(arg) ? arg : path.resolve(arg); + const unique = () => { + const set = new Set(); + return arg => { + if (set.has(arg)) return false; + set.add(arg); + return true; + }; + }; + + // postprocess we need to get absolute file locations for lib, argv, and transform + argv = argv.map(resolve).filter(unique()); + args.transform = args.transform.map(resolve).filter(unique()); + args.lib = args.lib.map(resolve).filter(unique()); + // Set up options const compilerOptions = assemblyscript.newOptions(); assemblyscript.setTarget(compilerOptions, 0); @@ -594,7 +630,7 @@ exports.main = function main(argv, options, callback) { const filename = argv[i]; let sourcePath = String(filename).replace(/\\/g, "/").replace(extension.re, "").replace(/[\\/]$/, ""); - + // Setting the path to relative path sourcePath = path.isAbsolute(sourcePath) ? path.relative(baseDir, sourcePath) : sourcePath; From 6f981215c3dcd321f17ccafeccb392f1c07f1521 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Sat, 20 Jun 2020 02:40:11 -0400 Subject: [PATCH 08/58] take into account relative baseDirs --- cli/asc.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index 83fe6392f9..aaefcd6453 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -312,7 +312,10 @@ exports.main = function main(argv, options, callback) { } // Just some helper functions - const resolve = arg => path.isAbsolute(arg) ? arg : path.resolve(arg); + const resolve = arg => path.isAbsolute(arg) + ? arg + // this transform is relative to process.cwd() + : path.resolve(path.join(baseDir, arg)); const unique = () => { const set = new Set(); return arg => { @@ -322,10 +325,10 @@ exports.main = function main(argv, options, callback) { }; }; - // postprocess we need to get absolute file locations for lib, argv, and transform - argv = argv.map(resolve).filter(unique()); - args.transform = args.transform.map(resolve).filter(unique()); - args.lib = args.lib.map(resolve).filter(unique()); + const makeRelative = arg => path.relative(baseDir, arg); + + // postprocess we need to get absolute file locations argv + argv = argv.map(resolve).filter(unique()).map(makeRelative); // Set up options const compilerOptions = assemblyscript.newOptions(); @@ -403,7 +406,7 @@ exports.main = function main(argv, options, callback) { const transforms = []; if (args.transform) { let tsNodeRegistered = false; - let transformArgs = args.transform; + let transformArgs = args.transform.map(resolve).filter(unique()); for (let i = 0, k = transformArgs.length; i < k; ++i) { let filename = transformArgs[i].trim(); if (!tsNodeRegistered && filename.endsWith(".ts")) { // ts-node requires .ts specifically @@ -460,6 +463,7 @@ exports.main = function main(argv, options, callback) { if (args.lib) { let lib = args.lib; if (typeof lib === "string") lib = lib.split(","); + lib = lib.map(resolve).filter(unique()); Array.prototype.push.apply(customLibDirs, lib.map(lib => lib.trim())); for (let i = 0, k = customLibDirs.length; i < k; ++i) { // custom let libDir = customLibDirs[i]; From d637a1fb5fea9ef98f5840290a92e42d520c6d54 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Sat, 20 Jun 2020 02:47:45 -0400 Subject: [PATCH 09/58] fix small linted error --- cli/asc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.js b/cli/asc.js index aaefcd6453..38e0e9e26f 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -288,7 +288,7 @@ exports.main = function main(argv, options, callback) { // entries are added to the compilation if (asconfig.entries) { - for (const entry of entries) { + for (const entry of asconfig.entries) { argv.push( path.isAbsolute(entry) ? entry From 483cc9d220796699f0e0b5e3983be1a69b168a21 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Wed, 1 Jul 2020 13:46:55 -0400 Subject: [PATCH 10/58] Setup tests for asconfig --- .gitignore | 1 + package.json | 3 ++- tests/asconfig/package.json | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/asconfig/package.json diff --git a/.gitignore b/.gitignore index cb7d0b9ef8..57082f26a3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ out/ raw/ .history *.backup +.vscode \ No newline at end of file diff --git a/package.json b/package.json index fbc5f3b32e..1f287a3138 100644 --- a/package.json +++ b/package.json @@ -59,11 +59,12 @@ "check:config": "tsc --noEmit -p src --diagnostics --listFiles", "check:require": "tsc --noEmit --target ESNEXT --module commonjs --experimentalDecorators tests/require/index", "check:lint": "eslint --max-warnings 0 --ext js . && eslint --max-warnings 0 --ext ts .", - "test": "npm run test:parser && npm run test:compiler && npm run test:packages && npm run test:extension", + "test": "npm run test:parser && npm run test:compiler && npm run test:packages && npm run test:extension && npm run test:asconfig", "test:parser": "node tests/parser", "test:compiler": "node tests/compiler", "test:packages": "cd tests/packages && npm run test", "test:extension": "cd tests/extension && npm run test", + "test:asconfig": "cd tests/asconfig && npm run test", "make": "npm run clean && npm test && npm run build && npm test", "all": "npm run check && npm run make", "docs": "typedoc --tsconfig tsconfig-docs.json --mode modules --name \"AssemblyScript Compiler API\" --out ./docs/api --ignoreCompilerErrors --excludeNotExported --excludePrivate --excludeExternals --exclude **/std/** --includeDeclarations --readme src/README.md", diff --git a/tests/asconfig/package.json b/tests/asconfig/package.json new file mode 100644 index 0000000000..8c8016d93b --- /dev/null +++ b/tests/asconfig/package.json @@ -0,0 +1,10 @@ +{ + "private": true, + "scripts": { + "test": "npm run test:use-consts && npm run test:entry-points && npm run test:flags && npm run test:complicated", + "test:use-consts": "cd use-consts && npm run test", + "test:entry-points": "cd entry-points && npm run test", + "test:flags": "cd flags && npm run test", + "test:complicated": "cd complicated && npm run test" + } +} From ca954306d9e7068831271cbaf66fc618a072cf27 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Wed, 1 Jul 2020 16:13:05 -0400 Subject: [PATCH 11/58] add const test --- tests/asconfig/index.js | 26 +++++++++++++++++++++ tests/asconfig/use-consts/asconfig.json | 9 +++++++ tests/asconfig/use-consts/assembly/index.ts | 3 +++ tests/asconfig/use-consts/package.json | 6 +++++ 4 files changed, 44 insertions(+) create mode 100644 tests/asconfig/index.js create mode 100644 tests/asconfig/use-consts/asconfig.json create mode 100644 tests/asconfig/use-consts/assembly/index.ts create mode 100644 tests/asconfig/use-consts/package.json diff --git a/tests/asconfig/index.js b/tests/asconfig/index.js new file mode 100644 index 0000000000..a1f84b8ed4 --- /dev/null +++ b/tests/asconfig/index.js @@ -0,0 +1,26 @@ +const asc = require("../../cli/asc"); +const loader = require("../../lib/loader"); +/** @type {Uint8Array} */ +let binary; +asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--explicitStart"], { + writeFile(name, contents) { + if (name === "output.wasm") { + binary = contents; + } + } +}, (err) => { + if (err) { + console.error(err); + process.exit(1); + } + + if (!binary) { + console.error("No binary was generated for the asconfig test in " + process.cwd()); + process.exit(1); + } + + const theResult = loader.instantiateSync(binary); + + theResult.exports._start(); + return 0; +}); diff --git a/tests/asconfig/use-consts/asconfig.json b/tests/asconfig/use-consts/asconfig.json new file mode 100644 index 0000000000..c4cc519a05 --- /dev/null +++ b/tests/asconfig/use-consts/asconfig.json @@ -0,0 +1,9 @@ +{ + "options": { + "use": [ + "A=1", + "B=2", + "C=3" + ] + } +} \ No newline at end of file diff --git a/tests/asconfig/use-consts/assembly/index.ts b/tests/asconfig/use-consts/assembly/index.ts new file mode 100644 index 0000000000..827accff2d --- /dev/null +++ b/tests/asconfig/use-consts/assembly/index.ts @@ -0,0 +1,3 @@ +assert(A == 1); +assert(B == 2); +assert(C == 3); diff --git a/tests/asconfig/use-consts/package.json b/tests/asconfig/use-consts/package.json new file mode 100644 index 0000000000..f98424bae9 --- /dev/null +++ b/tests/asconfig/use-consts/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "scripts": { + "test": "node ../index.js" + } +} From 3257573366250c04a48dfe18fd1fb0de1c6a0ab7 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Wed, 1 Jul 2020 16:46:41 -0400 Subject: [PATCH 12/58] test single level inheritence with targets --- tests/asconfig/index.js | 4 +++- tests/asconfig/package.json | 4 +++- tests/asconfig/respect-inheritence/asconfig.json | 12 ++++++++++++ tests/asconfig/respect-inheritence/assembly/index.ts | 5 +++++ tests/asconfig/respect-inheritence/package.json | 6 ++++++ tests/asconfig/target/asconfig.json | 10 ++++++++++ tests/asconfig/target/assembly/index.ts | 3 +++ tests/asconfig/target/package.json | 6 ++++++ 8 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 tests/asconfig/respect-inheritence/asconfig.json create mode 100644 tests/asconfig/respect-inheritence/assembly/index.ts create mode 100644 tests/asconfig/respect-inheritence/package.json create mode 100644 tests/asconfig/target/asconfig.json create mode 100644 tests/asconfig/target/assembly/index.ts create mode 100644 tests/asconfig/target/package.json diff --git a/tests/asconfig/index.js b/tests/asconfig/index.js index a1f84b8ed4..2a7e3cc0fb 100644 --- a/tests/asconfig/index.js +++ b/tests/asconfig/index.js @@ -1,8 +1,10 @@ const asc = require("../../cli/asc"); const loader = require("../../lib/loader"); +const args = process.argv.slice(2); + /** @type {Uint8Array} */ let binary; -asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--explicitStart"], { +asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--explicitStart", ...args], { writeFile(name, contents) { if (name === "output.wasm") { binary = contents; diff --git a/tests/asconfig/package.json b/tests/asconfig/package.json index 8c8016d93b..948756eea6 100644 --- a/tests/asconfig/package.json +++ b/tests/asconfig/package.json @@ -1,10 +1,12 @@ { "private": true, "scripts": { - "test": "npm run test:use-consts && npm run test:entry-points && npm run test:flags && npm run test:complicated", + "test": "npm run test:use-consts && npm run test:target && npm run test:entry-points && npm run test:flags && npm run test:complicated", "test:use-consts": "cd use-consts && npm run test", "test:entry-points": "cd entry-points && npm run test", "test:flags": "cd flags && npm run test", + "test:respect-inheritence": "cd respect-inheritence && npm run test", + "test:target": "cd target && npm run test", "test:complicated": "cd complicated && npm run test" } } diff --git a/tests/asconfig/respect-inheritence/asconfig.json b/tests/asconfig/respect-inheritence/asconfig.json new file mode 100644 index 0000000000..cba3c26512 --- /dev/null +++ b/tests/asconfig/respect-inheritence/asconfig.json @@ -0,0 +1,12 @@ +{ + "targets": { + "release": { + "optimizeLevel": 2, + "enable": ["simd"] + } + }, + "options": { + "optimizeLevel": 1, + "disable": ["simd"] + } +} \ No newline at end of file diff --git a/tests/asconfig/respect-inheritence/assembly/index.ts b/tests/asconfig/respect-inheritence/assembly/index.ts new file mode 100644 index 0000000000..1c0b3966b2 --- /dev/null +++ b/tests/asconfig/respect-inheritence/assembly/index.ts @@ -0,0 +1,5 @@ +// --optimizeLevel 3 +assert(ASC_OPTIMIZE_LEVEL == 3); +// enabled in target release which is default +assert(ASC_FEATURE_SIMD); +// disable: ["simd"] is set in asconfig under general options, it should be ignored diff --git a/tests/asconfig/respect-inheritence/package.json b/tests/asconfig/respect-inheritence/package.json new file mode 100644 index 0000000000..6d14e2db7a --- /dev/null +++ b/tests/asconfig/respect-inheritence/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "scripts": { + "test": "node ../index.js --optimizeLevel 3" + } +} diff --git a/tests/asconfig/target/asconfig.json b/tests/asconfig/target/asconfig.json new file mode 100644 index 0000000000..343dcc1bbe --- /dev/null +++ b/tests/asconfig/target/asconfig.json @@ -0,0 +1,10 @@ +{ + "targets": { + "release": { + "optimizeLevel": 3, + "shrinkLevel": 1, + "enable": ["simd"] + } + }, + "options": {} +} \ No newline at end of file diff --git a/tests/asconfig/target/assembly/index.ts b/tests/asconfig/target/assembly/index.ts new file mode 100644 index 0000000000..5c03e37224 --- /dev/null +++ b/tests/asconfig/target/assembly/index.ts @@ -0,0 +1,3 @@ +assert(ASC_OPTIMIZE_LEVEL == 3); +assert(ASC_SHRINK_LEVEL == 1); +assert(ASC_FEATURE_SIMD); diff --git a/tests/asconfig/target/package.json b/tests/asconfig/target/package.json new file mode 100644 index 0000000000..f98424bae9 --- /dev/null +++ b/tests/asconfig/target/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "scripts": { + "test": "node ../index.js" + } +} From e05a71f99d671243c6e0601f1d512efb50dbb4b9 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Wed, 1 Jul 2020 20:44:13 -0400 Subject: [PATCH 13/58] config extension test, switch getAsconfig params --- cli/asc.js | 2 +- tests/asconfig/extends/asconfig.json | 11 +++++++++++ tests/asconfig/extends/assembly/index.ts | 3 +++ tests/asconfig/extends/extends.json | 11 +++++++++++ tests/asconfig/extends/package.json | 6 ++++++ 5 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 tests/asconfig/extends/asconfig.json create mode 100644 tests/asconfig/extends/assembly/index.ts create mode 100644 tests/asconfig/extends/extends.json create mode 100644 tests/asconfig/extends/package.json diff --git a/cli/asc.js b/cli/asc.js index 38e0e9e26f..58f1ef8b18 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -305,7 +305,7 @@ exports.main = function main(argv, options, callback) { ? path.dirname(asconfig.extends) // relative means we need to calculate a relative asconfigDir : path.join(asconfigDir, path.dirname(asconfig.extends)); - asconfig = getAsconfig(asconfigDir, path.basename(asconfig.extends), readFile); + asconfig = getAsconfig(path.basename(asconfig.extends), asconfigDir, readFile); } else { asconfig = null; // finished resolving the configuration chain } diff --git a/tests/asconfig/extends/asconfig.json b/tests/asconfig/extends/asconfig.json new file mode 100644 index 0000000000..fb167de066 --- /dev/null +++ b/tests/asconfig/extends/asconfig.json @@ -0,0 +1,11 @@ +{ + "targets": { + "release": { + "shrinkLevel": 2 + } + }, + "options": { + "enable": ["simd"] + }, + "extends": "./extends.json" +} \ No newline at end of file diff --git a/tests/asconfig/extends/assembly/index.ts b/tests/asconfig/extends/assembly/index.ts new file mode 100644 index 0000000000..afd4eb590d --- /dev/null +++ b/tests/asconfig/extends/assembly/index.ts @@ -0,0 +1,3 @@ +assert(ASC_OPTIMIZE_LEVEL == 1); +assert(ASC_SHRINK_LEVEL == 2); +assert(ASC_FEATURE_SIMD); diff --git a/tests/asconfig/extends/extends.json b/tests/asconfig/extends/extends.json new file mode 100644 index 0000000000..0090664cd4 --- /dev/null +++ b/tests/asconfig/extends/extends.json @@ -0,0 +1,11 @@ +{ + "targets": { + "release": { + "shrinkLevel": 1, + "optimizeLevel": 1 + } + }, + "options": { + "disable": ["simd"] + } +} \ No newline at end of file diff --git a/tests/asconfig/extends/package.json b/tests/asconfig/extends/package.json new file mode 100644 index 0000000000..f98424bae9 --- /dev/null +++ b/tests/asconfig/extends/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "scripts": { + "test": "node ../index.js" + } +} From a0700c659a418d39cd50e6198f6d65a8e7aa2d7d Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Fri, 3 Jul 2020 12:51:04 -0400 Subject: [PATCH 14/58] Modify asinit --- bin/asinit | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/bin/asinit b/bin/asinit index 7752a8d531..d55e4fd5d9 100755 --- a/bin/asinit +++ b/bin/asinit @@ -42,6 +42,7 @@ const compilerDir = path.join(__dirname, ".."); const compilerVersion = require(path.join(compilerDir, "package.json")).version; const assemblyDir = path.join(projectDir, "assembly"); const tsconfigFile = path.join(assemblyDir, "tsconfig.json"); +const asconfigFile = path.join(projectDir, "asconfig.json"); let tsconfigBase = path.relative(assemblyDir, path.join(compilerDir, "std", "assembly.json")); if (/^(\.\.[/\\])*node_modules[/\\]assemblyscript[/\\]/.test(tsconfigBase)) { // Use node resolution if the compiler is a normal dependency @@ -84,6 +85,9 @@ console.log([ colors.cyan(" ./tests/index.js"), " Example test to check that your module is indeed working.", "", + colors.cyan(" ./asconfig.json"), + " Main configuration file that defines a debug and release target for your project.", + "", colors.cyan(" ./package.json"), " Package info containing the necessary commands to compile to WebAssembly.", "", @@ -108,6 +112,7 @@ function createProject(answer) { ensureIndexJs(); ensureTestsDirectory(); ensureTestsIndexJs(); + ensureAsconfigJson(); console.log([ colors.green("Done!"), "", @@ -207,6 +212,37 @@ function ensureTsconfigJson() { console.log(); } +function ensureAsconfigJson() { + console.log("- Making sure that 'asconfig.json' is set up..."); + if (!fs.existsSync(asconfigFile)) { + fs.writeFileSync(asconfigFile, JSON.stringify({ + targets: { + debug: { + // -b build/untouched.wasm -t build/untouched.wat --sourceMap --debug + binaryFile: "build/untouched.wasm", + textFile: "build/untouched.wat", + sourceMap: true, + debug: true + }, + release: { + // -b build/optimized.wasm -t build/optimized.wat --sourceMap --optimize + binaryFile: "build/optimized.wasm", + textFile: "build/optimized.wat", + sourceMap: true, + optimizeLevel: 3 + } + }, + options: {} + }, null, 2)); + console.log(colors.green(" Created: ") + tsconfigFile); + } else { + // TODO: What to do here? + // const asconfig = JSON.parse(fs.readFileSync(asconfigFile, "utf-8")); + console.log(colors.green(" Ignored: ") + asconfigFile); + } + console.log(); +} + function ensureEntryFile() { console.log("- Making sure that 'assembly/index.ts' exists..."); if (!fs.existsSync(entryFile)) { @@ -253,8 +289,8 @@ function ensureGitignore() { function ensurePackageJson() { console.log("- Making sure that 'package.json' contains the build commands..."); const entryPath = path.relative(projectDir, entryFile).replace(/\\/g, "/"); - const buildUntouched = "asc " + entryPath + " -b build/untouched.wasm -t build/untouched.wat --sourceMap --debug"; - const buildOptimized = "asc " + entryPath + " -b build/optimized.wasm -t build/optimized.wat --sourceMap --optimize"; + const buildUntouched = "asc " + entryPath + " --target debug"; + const buildOptimized = "asc " + entryPath + " --target release"; const buildAll = "npm run asbuild:untouched && npm run asbuild:optimized"; if (!fs.existsSync(packageFile)) { fs.writeFileSync(packageFile, JSON.stringify({ From 4dd142efa8d76edfd2df8304e904d7f28ccf4332 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Fri, 3 Jul 2020 13:28:53 -0400 Subject: [PATCH 15/58] typos --- cli/asc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.js b/cli/asc.js index 58f1ef8b18..79e8c4baac 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -273,7 +273,7 @@ exports.main = function main(argv, options, callback) { const baseDir = args.baseDir ? path.resolve(args.baseDir) : "."; const target = args.target; - // Once the basedir is calculated, we can resolve the config, and it's extensions + // Once the baseDir is calculated, we can resolve the config, and its extensions let asconfig = getAsconfig(args.config, baseDir, readFile); let asconfigDir = baseDir; From 3b5a8ce039a8f5ee92fd8d3313b193c85cd14d90 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Fri, 3 Jul 2020 13:34:25 -0400 Subject: [PATCH 16/58] switch code style to regular functions --- cli/asc.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index 79e8c4baac..3c5d2c3817 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -311,22 +311,26 @@ exports.main = function main(argv, options, callback) { } } - // Just some helper functions - const resolve = arg => path.isAbsolute(arg) - ? arg - // this transform is relative to process.cwd() - : path.resolve(path.join(baseDir, arg)); - const unique = () => { + // This method resolves a path relative to the baseDir instead of process.cwd() + function resolve(arg) { + if (path.isAbsolute(arg)) return arg; + else return path.resolve(path.join(baseDir, arg)); + } + + // Use this with array.filter(unique()) to obtain a unique array of values + function unique() { const set = new Set(); - return arg => { + return function (arg) { if (set.has(arg)) return false; set.add(arg); return true; }; - }; - - const makeRelative = arg => path.relative(baseDir, arg); + } + // returns a relative path from baseDir + function makeRelative(arg) { + return path.relative(baseDir, arg); + } // postprocess we need to get absolute file locations argv argv = argv.map(resolve).filter(unique()).map(makeRelative); @@ -435,6 +439,7 @@ exports.main = function main(argv, options, callback) { } } } + function applyTransform(name, ...args) { for (let i = 0, k = transforms.length; i < k; ++i) { let transform = transforms[i]; From 2a4e351cba24435ff4695bf827ff676cc2847029 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Fri, 3 Jul 2020 13:36:52 -0400 Subject: [PATCH 17/58] leading newline in json --- tests/asconfig/extends/asconfig.json | 2 +- tests/asconfig/extends/extends.json | 2 +- tests/asconfig/respect-inheritence/asconfig.json | 2 +- tests/asconfig/target/asconfig.json | 2 +- tests/asconfig/use-consts/asconfig.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/asconfig/extends/asconfig.json b/tests/asconfig/extends/asconfig.json index fb167de066..d052236111 100644 --- a/tests/asconfig/extends/asconfig.json +++ b/tests/asconfig/extends/asconfig.json @@ -8,4 +8,4 @@ "enable": ["simd"] }, "extends": "./extends.json" -} \ No newline at end of file +} diff --git a/tests/asconfig/extends/extends.json b/tests/asconfig/extends/extends.json index 0090664cd4..44d1411849 100644 --- a/tests/asconfig/extends/extends.json +++ b/tests/asconfig/extends/extends.json @@ -8,4 +8,4 @@ "options": { "disable": ["simd"] } -} \ No newline at end of file +} diff --git a/tests/asconfig/respect-inheritence/asconfig.json b/tests/asconfig/respect-inheritence/asconfig.json index cba3c26512..a171baf9dd 100644 --- a/tests/asconfig/respect-inheritence/asconfig.json +++ b/tests/asconfig/respect-inheritence/asconfig.json @@ -9,4 +9,4 @@ "optimizeLevel": 1, "disable": ["simd"] } -} \ No newline at end of file +} diff --git a/tests/asconfig/target/asconfig.json b/tests/asconfig/target/asconfig.json index 343dcc1bbe..5e9a441e1e 100644 --- a/tests/asconfig/target/asconfig.json +++ b/tests/asconfig/target/asconfig.json @@ -7,4 +7,4 @@ } }, "options": {} -} \ No newline at end of file +} diff --git a/tests/asconfig/use-consts/asconfig.json b/tests/asconfig/use-consts/asconfig.json index c4cc519a05..7fe2318a0b 100644 --- a/tests/asconfig/use-consts/asconfig.json +++ b/tests/asconfig/use-consts/asconfig.json @@ -6,4 +6,4 @@ "C=3" ] } -} \ No newline at end of file +} From 9e0d217f4590ed9cf16adfe54a1c530551b3129f Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Fri, 3 Jul 2020 14:30:03 -0400 Subject: [PATCH 18/58] config changes --- cli/asc.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/asc.json b/cli/asc.json index 1ac4f0236e..bf89988da8 100644 --- a/cli/asc.json +++ b/cli/asc.json @@ -19,13 +19,13 @@ }, "config": { "category": "General", - "description": "Provides a configuration for assemblyscript to compile your project.", + "description": "Configuration file to apply. CLI arguments take precedence.", "type": "s", "default": "asconfig.json" }, "target": { "category": "General", - "description": "Provides a compile target for use with an assemblyscript configuration.", + "description": "Configuration compile target profile to apply.", "type": "s", "default": "release" }, From 7155d501c9254798f49434ac9cc664bbf60b17b7 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Fri, 3 Jul 2020 14:35:58 -0400 Subject: [PATCH 19/58] switch to isObject helper, and use typeof for string validation --- cli/asc.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index 3c5d2c3817..62f5fcf5b0 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -990,7 +990,10 @@ exports.main = function main(argv, options, callback) { }; const toString = Object.prototype.toString; -const typeOf = val => toString.call(val).slice(8, -1); + +function isObject(arg) { + return toString.call(arg).slice(8, -1) === "Object"; +} function getAsconfig(file, baseDir, readFile) { const contents = readFile(file, baseDir); @@ -1006,25 +1009,31 @@ function getAsconfig(file, baseDir, readFile) { } // validate asconfig shape - if (config.options && typeOf(config.options) !== "Object") { + if (config.options && !isObject(config.options)) { throw new Error("Asconfig.options is not an object: " + location); } - if (config.include && typeOf(config.include) !== "Array") { - throw new Error("Asconfig.include is not an object: " + location); + + if (config.include && !Array.isArray(config.include)) { + throw new Error("Asconfig.include is not an array: " + location); } + if (config.targets) { - if (typeOf(config.targets) !== "Object") { + if (!isObject(config.targets)) { throw new Error("Asconfig.targets is not an object: " + location); } const targets = Object.keys(config.targets); for (let i = 0; i < targets.length; i++) { const target = targets[i]; - if (typeOf(config.targets[target]) !== "Object") { + if (!isObject(config.targets[target])) { throw new Error("Asconfig.targets." + target + " is not an object: " + location); } } } + if (config.extends && typeof config.extends !== "string") { + throw new Error("Asconfig.extends is not a string: " + location) + } + return config; } From a7a39990bcfdd53ac6deb00e715dd5ddcbdc68f5 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Fri, 3 Jul 2020 14:49:21 -0400 Subject: [PATCH 20/58] semicolon --- cli/asc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.js b/cli/asc.js index 62f5fcf5b0..040468a173 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -1031,7 +1031,7 @@ function getAsconfig(file, baseDir, readFile) { } if (config.extends && typeof config.extends !== "string") { - throw new Error("Asconfig.extends is not a string: " + location) + throw new Error("Asconfig.extends is not a string: " + location); } return config; From 4e3de7d84e56479c0e8f63fa464ea3d0a74a1042 Mon Sep 17 00:00:00 2001 From: jtenner Date: Fri, 3 Jul 2020 14:50:34 -0400 Subject: [PATCH 21/58] Update bin/asinit Co-authored-by: Max Graey --- bin/asinit | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/asinit b/bin/asinit index d55e4fd5d9..f974831b2d 100755 --- a/bin/asinit +++ b/bin/asinit @@ -229,7 +229,8 @@ function ensureAsconfigJson() { binaryFile: "build/optimized.wasm", textFile: "build/optimized.wat", sourceMap: true, - optimizeLevel: 3 + optimizeLevel: 3, + shrinkLevel: 1, } }, options: {} From 932961db652fc6a636a0fe89973681c5d3f2c7e0 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Fri, 3 Jul 2020 14:53:58 -0400 Subject: [PATCH 22/58] switch to more general unique function --- cli/asc.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index fe0ba91212..99d4928fc9 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -318,13 +318,8 @@ exports.main = function main(argv, options, callback) { } // Use this with array.filter(unique()) to obtain a unique array of values - function unique() { - const set = new Set(); - return function (arg) { - if (set.has(arg)) return false; - set.add(arg); - return true; - }; + function unique(values) { + return [...new Set(value)]; } // returns a relative path from baseDir @@ -332,7 +327,7 @@ exports.main = function main(argv, options, callback) { return path.relative(baseDir, arg); } // postprocess we need to get absolute file locations argv - argv = argv.map(resolve).filter(unique()).map(makeRelative); + argv = unique(argv.map(resolve)).map(makeRelative); // Set up options const compilerOptions = assemblyscript.newOptions(); From a29f617414823d5f9c5d65332d1a50859b32b27e Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Fri, 3 Jul 2020 14:57:25 -0400 Subject: [PATCH 23/58] unique cleanups --- cli/asc.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index 99d4928fc9..38513fe95a 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -317,9 +317,9 @@ exports.main = function main(argv, options, callback) { else return path.resolve(path.join(baseDir, arg)); } - // Use this with array.filter(unique()) to obtain a unique array of values + // create a unique set of values function unique(values) { - return [...new Set(value)]; + return [...new Set(values)]; } // returns a relative path from baseDir @@ -405,7 +405,7 @@ exports.main = function main(argv, options, callback) { const transforms = []; if (args.transform) { let tsNodeRegistered = false; - let transformArgs = args.transform.map(resolve).filter(unique()); + let transformArgs = unique(args.transform.map(resolve)); for (let i = 0, k = transformArgs.length; i < k; ++i) { let filename = transformArgs[i].trim(); if (!tsNodeRegistered && filename.endsWith(".ts")) { // ts-node requires .ts specifically @@ -463,7 +463,7 @@ exports.main = function main(argv, options, callback) { if (args.lib) { let lib = args.lib; if (typeof lib === "string") lib = lib.split(","); - lib = lib.map(resolve).filter(unique()); + lib = unique(lib.map(resolve)); Array.prototype.push.apply(customLibDirs, lib.map(lib => lib.trim())); for (let i = 0, k = customLibDirs.length; i < k; ++i) { // custom let libDir = customLibDirs[i]; From 2ead5aeb6fb9d7e1fdab4d7d365903e7361b44ec Mon Sep 17 00:00:00 2001 From: jtenner Date: Fri, 3 Jul 2020 16:28:26 -0400 Subject: [PATCH 24/58] Update cli/asc.js Remove slice Co-authored-by: Max Graey --- cli/asc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.js b/cli/asc.js index 38513fe95a..dd5b40d259 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -986,7 +986,7 @@ exports.main = function main(argv, options, callback) { const toString = Object.prototype.toString; function isObject(arg) { - return toString.call(arg).slice(8, -1) === "Object"; + return toString.call(arg) === "[object Object]"; } function getAsconfig(file, baseDir, readFile) { From c6af0dd23ed1704799b81d3f85c4aaab6d3869d9 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Sun, 5 Jul 2020 15:40:19 -0400 Subject: [PATCH 25/58] ignore cyclical dependencies --- cli/asc.js | 12 +++++++++++- tests/asconfig/cyclical/asconfig.json | 3 +++ tests/asconfig/cyclical/assembly/index.ts | 1 + tests/asconfig/cyclical/extends.json | 3 +++ tests/asconfig/cyclical/package.json | 6 ++++++ tests/asconfig/package.json | 3 ++- 6 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 tests/asconfig/cyclical/asconfig.json create mode 100644 tests/asconfig/cyclical/assembly/index.ts create mode 100644 tests/asconfig/cyclical/extends.json create mode 100644 tests/asconfig/cyclical/package.json diff --git a/cli/asc.js b/cli/asc.js index dd5b40d259..726510b320 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -277,6 +277,9 @@ exports.main = function main(argv, options, callback) { let asconfig = getAsconfig(args.config, baseDir, readFile); let asconfigDir = baseDir; + const seenAsconfig = new Set(); + seenAsconfig.add(path.join(baseDir, args.config)); + while (asconfig) { // merge target first, then merge options, then merge extended asconfigs if (asconfig.targets && asconfig.targets[target]) { @@ -305,7 +308,14 @@ exports.main = function main(argv, options, callback) { ? path.dirname(asconfig.extends) // relative means we need to calculate a relative asconfigDir : path.join(asconfigDir, path.dirname(asconfig.extends)); - asconfig = getAsconfig(path.basename(asconfig.extends), asconfigDir, readFile); + const fileName = path.basename(asconfig.extends); + const filePath = path.join(asconfigDir, fileName); + if (seenAsconfig.has(filePath)) { + asconfig = null; + } else { + seenAsconfig.add(filePath); + asconfig = getAsconfig(fileName, asconfigDir, readFile); + } } else { asconfig = null; // finished resolving the configuration chain } diff --git a/tests/asconfig/cyclical/asconfig.json b/tests/asconfig/cyclical/asconfig.json new file mode 100644 index 0000000000..98aae677ca --- /dev/null +++ b/tests/asconfig/cyclical/asconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "./extends.json" +} diff --git a/tests/asconfig/cyclical/assembly/index.ts b/tests/asconfig/cyclical/assembly/index.ts new file mode 100644 index 0000000000..4d1656bdf6 --- /dev/null +++ b/tests/asconfig/cyclical/assembly/index.ts @@ -0,0 +1 @@ +assert(true); diff --git a/tests/asconfig/cyclical/extends.json b/tests/asconfig/cyclical/extends.json new file mode 100644 index 0000000000..3420bc71bc --- /dev/null +++ b/tests/asconfig/cyclical/extends.json @@ -0,0 +1,3 @@ +{ + "extends": "./asconfig.json" +} diff --git a/tests/asconfig/cyclical/package.json b/tests/asconfig/cyclical/package.json new file mode 100644 index 0000000000..f98424bae9 --- /dev/null +++ b/tests/asconfig/cyclical/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "scripts": { + "test": "node ../index.js" + } +} diff --git a/tests/asconfig/package.json b/tests/asconfig/package.json index 948756eea6..dc501bc6a2 100644 --- a/tests/asconfig/package.json +++ b/tests/asconfig/package.json @@ -7,6 +7,7 @@ "test:flags": "cd flags && npm run test", "test:respect-inheritence": "cd respect-inheritence && npm run test", "test:target": "cd target && npm run test", - "test:complicated": "cd complicated && npm run test" + "test:complicated": "cd complicated && npm run test", + "test:cyclical": "cd cyclical && npm run test" } } From ec7d44c209006ec3712e98fec688095bbb4f9ed2 Mon Sep 17 00:00:00 2001 From: jtenner Date: Sun, 5 Jul 2020 15:41:17 -0400 Subject: [PATCH 26/58] Update cli/asc.js Co-authored-by: Max Graey --- cli/asc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.js b/cli/asc.js index dd5b40d259..45c709f605 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -314,7 +314,7 @@ exports.main = function main(argv, options, callback) { // This method resolves a path relative to the baseDir instead of process.cwd() function resolve(arg) { if (path.isAbsolute(arg)) return arg; - else return path.resolve(path.join(baseDir, arg)); + return path.resolve(path.join(baseDir, arg)); } // create a unique set of values From acd8725db6eb96baba480ccb1f40ff4111526378 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Sun, 5 Jul 2020 15:45:46 -0400 Subject: [PATCH 27/58] suggested changes --- cli/asc.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index 69655d805b..204f9c308d 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -469,12 +469,12 @@ exports.main = function main(argv, options, callback) { assemblyscript.parse(program, exports.libraryFiles[libPath], exports.libraryPrefix + libPath + extension.ext, false); }); }); - const customLibDirs = []; + let customLibDirs = []; if (args.lib) { let lib = args.lib; - if (typeof lib === "string") lib = lib.split(","); - lib = unique(lib.map(resolve)); - Array.prototype.push.apply(customLibDirs, lib.map(lib => lib.trim())); + if (typeof lib === "string") lib = lib.trim().split(/\s*,\s*/); + customLibDirs.push(...lib.map(resolve)); + customLibDirs = unique(customLibDirs); // because `lib` and `customLibDirs` could potentially has duplicates for (let i = 0, k = customLibDirs.length; i < k; ++i) { // custom let libDir = customLibDirs[i]; let libFiles; From 8195764142344164d1d3c22b21b9e01846f1d6e3 Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Wed, 8 Jul 2020 18:11:13 -0400 Subject: [PATCH 28/58] Swap merge args, rename config.entries --> config.include Also make transforms relative or use require --- cli/asc.js | 20 ++++++++++++++++---- tests/asconfig/target/asconfig.json | 3 +++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index 204f9c308d..c0cf4bf50f 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -283,15 +283,27 @@ exports.main = function main(argv, options, callback) { while (asconfig) { // merge target first, then merge options, then merge extended asconfigs if (asconfig.targets && asconfig.targets[target]) { - args = optionsUtil.merge(exports.options, args, asconfig.targets[target]); + args = optionsUtil.merge(exports.options, asconfig.targets[target], args); } if (asconfig.options) { - args = optionsUtil.merge(exports.options, args, asconfig.options); + if (asconfig.options.transform) { + // ensure that a transform's path is relative to the current config + asconfig.options.transform = asconfig.options.transform.map(p => { + if (!path.isAbsolute(p)) { + if (p.startsWith(".")) { + return path.join(asconfigDir, p); + } + return require.resolve(p) + } + return p; + }) + } + args = optionsUtil.merge(exports.options, asconfig.options, args); } // entries are added to the compilation - if (asconfig.entries) { - for (const entry of asconfig.entries) { + if (asconfig.include) { + for (const entry of asconfig.include) { argv.push( path.isAbsolute(entry) ? entry diff --git a/tests/asconfig/target/asconfig.json b/tests/asconfig/target/asconfig.json index 5e9a441e1e..aaadbf8119 100644 --- a/tests/asconfig/target/asconfig.json +++ b/tests/asconfig/target/asconfig.json @@ -4,6 +4,9 @@ "optimizeLevel": 3, "shrinkLevel": 1, "enable": ["simd"] + }, + "dev": { + "debug": true } }, "options": {} From f30d456316e1291d3e65b05422392241fd8b6699 Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Wed, 8 Jul 2020 22:32:08 -0400 Subject: [PATCH 29/58] Rename include back to entries Also fixed missing ;'s --- cli/asc.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index c0cf4bf50f..aca2e61bc7 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -290,20 +290,17 @@ exports.main = function main(argv, options, callback) { // ensure that a transform's path is relative to the current config asconfig.options.transform = asconfig.options.transform.map(p => { if (!path.isAbsolute(p)) { - if (p.startsWith(".")) { - return path.join(asconfigDir, p); - } - return require.resolve(p) + return require.resolve(p); } return p; - }) + }); } args = optionsUtil.merge(exports.options, asconfig.options, args); } // entries are added to the compilation - if (asconfig.include) { - for (const entry of asconfig.include) { + if (asconfig.entries) { + for (const entry of asconfig.entries) { argv.push( path.isAbsolute(entry) ? entry From 7e268384bd18bf357e314dfb741dc85a4f2ce84e Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Fri, 10 Jul 2020 14:17:13 -0400 Subject: [PATCH 30/58] Added entry-points test --- tests/asconfig/entry-points/asconfig.json | 3 +++ tests/asconfig/entry-points/assembly/globals.ts | 4 ++++ tests/asconfig/entry-points/assembly/index.ts | 2 ++ tests/asconfig/entry-points/nested/asconfig.json | 3 +++ tests/asconfig/entry-points/nested/assembly/index.ts | 2 ++ tests/asconfig/entry-points/nested/package.json | 6 ++++++ tests/asconfig/entry-points/package.json | 6 ++++++ 7 files changed, 26 insertions(+) create mode 100644 tests/asconfig/entry-points/asconfig.json create mode 100644 tests/asconfig/entry-points/assembly/globals.ts create mode 100644 tests/asconfig/entry-points/assembly/index.ts create mode 100644 tests/asconfig/entry-points/nested/asconfig.json create mode 100644 tests/asconfig/entry-points/nested/assembly/index.ts create mode 100644 tests/asconfig/entry-points/nested/package.json create mode 100644 tests/asconfig/entry-points/package.json diff --git a/tests/asconfig/entry-points/asconfig.json b/tests/asconfig/entry-points/asconfig.json new file mode 100644 index 0000000000..52f569718c --- /dev/null +++ b/tests/asconfig/entry-points/asconfig.json @@ -0,0 +1,3 @@ +{ + "entries": ["assembly/globals.ts"] +} diff --git a/tests/asconfig/entry-points/assembly/globals.ts b/tests/asconfig/entry-points/assembly/globals.ts new file mode 100644 index 0000000000..15cd47228a --- /dev/null +++ b/tests/asconfig/entry-points/assembly/globals.ts @@ -0,0 +1,4 @@ + + +@global +const answerToLife = 42; \ No newline at end of file diff --git a/tests/asconfig/entry-points/assembly/index.ts b/tests/asconfig/entry-points/assembly/index.ts new file mode 100644 index 0000000000..8d57706af7 --- /dev/null +++ b/tests/asconfig/entry-points/assembly/index.ts @@ -0,0 +1,2 @@ + +assert(answerToLife == 42); diff --git a/tests/asconfig/entry-points/nested/asconfig.json b/tests/asconfig/entry-points/nested/asconfig.json new file mode 100644 index 0000000000..92d84fcc96 --- /dev/null +++ b/tests/asconfig/entry-points/nested/asconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../asconfig.json" +} diff --git a/tests/asconfig/entry-points/nested/assembly/index.ts b/tests/asconfig/entry-points/nested/assembly/index.ts new file mode 100644 index 0000000000..8d57706af7 --- /dev/null +++ b/tests/asconfig/entry-points/nested/assembly/index.ts @@ -0,0 +1,2 @@ + +assert(answerToLife == 42); diff --git a/tests/asconfig/entry-points/nested/package.json b/tests/asconfig/entry-points/nested/package.json new file mode 100644 index 0000000000..7603e9ad4d --- /dev/null +++ b/tests/asconfig/entry-points/nested/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "scripts": { + "test": "node ../../index.js" + } +} diff --git a/tests/asconfig/entry-points/package.json b/tests/asconfig/entry-points/package.json new file mode 100644 index 0000000000..e835996ed6 --- /dev/null +++ b/tests/asconfig/entry-points/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "scripts": { + "test": "node ../index.js && cd nested && npm run test" + } +} From d8bd07b2c57a0cdd3033a7c336b119996f5a70b3 Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Fri, 10 Jul 2020 14:42:05 -0400 Subject: [PATCH 31/58] Swap back and fix transform --- cli/asc.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index aca2e61bc7..adf11595f6 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -283,19 +283,22 @@ exports.main = function main(argv, options, callback) { while (asconfig) { // merge target first, then merge options, then merge extended asconfigs if (asconfig.targets && asconfig.targets[target]) { - args = optionsUtil.merge(exports.options, asconfig.targets[target], args); + args = optionsUtil.merge(exports.options, args, asconfig.targets[target]); } if (asconfig.options) { if (asconfig.options.transform) { // ensure that a transform's path is relative to the current config asconfig.options.transform = asconfig.options.transform.map(p => { if (!path.isAbsolute(p)) { + if (p.startsWith(".")) { + return path.join(asconfigDir, p); + } return require.resolve(p); } return p; }); } - args = optionsUtil.merge(exports.options, asconfig.options, args); + args = optionsUtil.merge(exports.options, args, asconfig.options); } // entries are added to the compilation From 7827a9340b600a9a81b3654958e8d9a53782a56a Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Fri, 10 Jul 2020 16:58:50 -0400 Subject: [PATCH 32/58] Added more tests Also exported args and argv from asc And swapped back order of args to merge --- cli/asc.js | 7 +++++-- tests/asconfig/flags/asconfig.json | 8 ++++++++ tests/asconfig/flags/assembly/index.ts | 1 + tests/asconfig/flags/nested/asconfig.json | 3 +++ tests/asconfig/flags/nested/assembly/index.ts | 1 + tests/asconfig/flags/nested/options.json | 3 +++ tests/asconfig/flags/nested/package.json | 6 ++++++ tests/asconfig/flags/options.json | 3 +++ tests/asconfig/flags/package.json | 6 ++++++ tests/asconfig/index.js | 11 +++++++++++ 10 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 tests/asconfig/flags/asconfig.json create mode 100644 tests/asconfig/flags/assembly/index.ts create mode 100644 tests/asconfig/flags/nested/asconfig.json create mode 100644 tests/asconfig/flags/nested/assembly/index.ts create mode 100644 tests/asconfig/flags/nested/options.json create mode 100644 tests/asconfig/flags/nested/package.json create mode 100644 tests/asconfig/flags/options.json create mode 100644 tests/asconfig/flags/package.json diff --git a/cli/asc.js b/cli/asc.js index adf11595f6..54a5ac7046 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -283,7 +283,7 @@ exports.main = function main(argv, options, callback) { while (asconfig) { // merge target first, then merge options, then merge extended asconfigs if (asconfig.targets && asconfig.targets[target]) { - args = optionsUtil.merge(exports.options, args, asconfig.targets[target]); + args = optionsUtil.merge(exports.options, asconfig.targets[target], args); } if (asconfig.options) { if (asconfig.options.transform) { @@ -298,7 +298,7 @@ exports.main = function main(argv, options, callback) { return p; }); } - args = optionsUtil.merge(exports.options, args, asconfig.options); + args = optionsUtil.merge(exports.options, asconfig.options, args); } // entries are added to the compilation @@ -333,6 +333,9 @@ exports.main = function main(argv, options, callback) { } } + exports.args = args; + exports.argv = argv; + // This method resolves a path relative to the baseDir instead of process.cwd() function resolve(arg) { if (path.isAbsolute(arg)) return arg; diff --git a/tests/asconfig/flags/asconfig.json b/tests/asconfig/flags/asconfig.json new file mode 100644 index 0000000000..c83915e042 --- /dev/null +++ b/tests/asconfig/flags/asconfig.json @@ -0,0 +1,8 @@ +{ + "target": { + "release": {}, + "debug": { + "debug": true + } + } +} diff --git a/tests/asconfig/flags/assembly/index.ts b/tests/asconfig/flags/assembly/index.ts new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/tests/asconfig/flags/assembly/index.ts @@ -0,0 +1 @@ + diff --git a/tests/asconfig/flags/nested/asconfig.json b/tests/asconfig/flags/nested/asconfig.json new file mode 100644 index 0000000000..92d84fcc96 --- /dev/null +++ b/tests/asconfig/flags/nested/asconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../asconfig.json" +} diff --git a/tests/asconfig/flags/nested/assembly/index.ts b/tests/asconfig/flags/nested/assembly/index.ts new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/tests/asconfig/flags/nested/assembly/index.ts @@ -0,0 +1 @@ + diff --git a/tests/asconfig/flags/nested/options.json b/tests/asconfig/flags/nested/options.json new file mode 100644 index 0000000000..32c639edd1 --- /dev/null +++ b/tests/asconfig/flags/nested/options.json @@ -0,0 +1,3 @@ +{ + "debug": true +} \ No newline at end of file diff --git a/tests/asconfig/flags/nested/package.json b/tests/asconfig/flags/nested/package.json new file mode 100644 index 0000000000..7603e9ad4d --- /dev/null +++ b/tests/asconfig/flags/nested/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "scripts": { + "test": "node ../../index.js" + } +} diff --git a/tests/asconfig/flags/options.json b/tests/asconfig/flags/options.json new file mode 100644 index 0000000000..32c639edd1 --- /dev/null +++ b/tests/asconfig/flags/options.json @@ -0,0 +1,3 @@ +{ + "debug": true +} \ No newline at end of file diff --git a/tests/asconfig/flags/package.json b/tests/asconfig/flags/package.json new file mode 100644 index 0000000000..e835996ed6 --- /dev/null +++ b/tests/asconfig/flags/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "scripts": { + "test": "node ../index.js && cd nested && npm run test" + } +} diff --git a/tests/asconfig/index.js b/tests/asconfig/index.js index 2a7e3cc0fb..ae3b110041 100644 --- a/tests/asconfig/index.js +++ b/tests/asconfig/index.js @@ -1,6 +1,8 @@ const asc = require("../../cli/asc"); const loader = require("../../lib/loader"); const args = process.argv.slice(2); +const fs = require("fs"); +const path = require("path"); /** @type {Uint8Array} */ let binary; @@ -20,6 +22,15 @@ asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--explicitStart", .. console.error("No binary was generated for the asconfig test in " + process.cwd()); process.exit(1); } + const optionsPath = path.join(process.cwd(), "options.json") + if (fs.existsSync(optionsPath)) { + const options = require(optionsPath); + for (let option of Object.getOwnPropertyNames(options) ){ + if (options[option] != asc.args[option]) { + throw new Error(`Test ${path.basename(process.cwd())}: ${options[option]} != ${asc.args[option]}`); + } + } + } const theResult = loader.instantiateSync(binary); From f44491c4dabead9bf965519d786744e81f6818a2 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Sat, 11 Jul 2020 14:04:13 -0400 Subject: [PATCH 33/58] cleanup --- tests/asconfig/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/asconfig/index.js b/tests/asconfig/index.js index ae3b110041..5050381a61 100644 --- a/tests/asconfig/index.js +++ b/tests/asconfig/index.js @@ -22,10 +22,10 @@ asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--explicitStart", .. console.error("No binary was generated for the asconfig test in " + process.cwd()); process.exit(1); } - const optionsPath = path.join(process.cwd(), "options.json") + const optionsPath = path.join(process.cwd(), "options.json"); if (fs.existsSync(optionsPath)) { const options = require(optionsPath); - for (let option of Object.getOwnPropertyNames(options) ){ + for (const option of Object.getOwnPropertyNames(options) ){ if (options[option] != asc.args[option]) { throw new Error(`Test ${path.basename(process.cwd())}: ${options[option]} != ${asc.args[option]}`); } From ac37a14318102fcb563f1bd0351dec2f4efaced1 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Sat, 11 Jul 2020 14:23:16 -0400 Subject: [PATCH 34/58] add watfile output --- tests/asconfig/entry-points/asconfig.json | 2 +- tests/asconfig/entry-points/nested/output.wat | 1716 ++++++++++++++++ tests/asconfig/entry-points/output.wat | 1716 ++++++++++++++++ tests/asconfig/flags/asconfig.json | 4 +- tests/asconfig/flags/nested/output.wat | 1701 ++++++++++++++++ tests/asconfig/flags/nested/package.json | 2 +- tests/asconfig/flags/output.wat | 1701 ++++++++++++++++ tests/asconfig/flags/package.json | 2 +- tests/asconfig/index.js | 19 +- tests/asconfig/target/output.wat | 1207 ++++++++++++ tests/asconfig/use-consts/output.wat | 1726 +++++++++++++++++ 11 files changed, 9790 insertions(+), 6 deletions(-) create mode 100644 tests/asconfig/entry-points/nested/output.wat create mode 100644 tests/asconfig/entry-points/output.wat create mode 100644 tests/asconfig/flags/nested/output.wat create mode 100644 tests/asconfig/flags/output.wat create mode 100644 tests/asconfig/target/output.wat create mode 100644 tests/asconfig/use-consts/output.wat diff --git a/tests/asconfig/entry-points/asconfig.json b/tests/asconfig/entry-points/asconfig.json index 52f569718c..f83851ac73 100644 --- a/tests/asconfig/entry-points/asconfig.json +++ b/tests/asconfig/entry-points/asconfig.json @@ -1,3 +1,3 @@ { - "entries": ["assembly/globals.ts"] + "entries": ["assembly/globals.ts"] } diff --git a/tests/asconfig/entry-points/nested/output.wat b/tests/asconfig/entry-points/nested/output.wat new file mode 100644 index 0000000000..0e4e245e13 --- /dev/null +++ b/tests/asconfig/entry-points/nested/output.wat @@ -0,0 +1,1716 @@ +(module + (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) + (type $none_=>_none (func)) + (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $none_=>_i32 (func (result i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (memory $0 1) + (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") + (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") + (data (i32.const 128) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") + (data (i32.const 176) "\03\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00") + (table $0 1 funcref) + (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) + (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) + (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) + (global $../assembly/globals/answerToLife i32 (i32.const 42)) + (global $~started (mut i32) (i32.const 0)) + (global $~lib/rt/__rtti_base i32 (i32.const 176)) + (global $~lib/heap/__heap_base i32 (i32.const 204)) + (export "_start" (func $~start)) + (export "memory" (memory $0)) + (export "__alloc" (func $~lib/rt/tlsf/__alloc)) + (export "__retain" (func $~lib/rt/pure/__retain)) + (export "__release" (func $~lib/rt/pure/__release)) + (export "__collect" (func $~lib/rt/pure/__collect)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) + (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + local.get $1 + i32.load + local.set $2 + i32.const 1 + drop + local.get $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 277 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $3 + i32.const 1 + drop + local.get $3 + i32.const 16 + i32.ge_u + if (result i32) + local.get $3 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 279 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $4 + local.get $3 + i32.const 4 + i32.shr_u + local.set $5 + else + i32.const 31 + local.get $3 + i32.clz + i32.sub + local.set $4 + local.get $3 + local.get $4 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $5 + local.get $4 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $4 + end + i32.const 1 + drop + local.get $4 + i32.const 23 + i32.lt_u + if (result i32) + local.get $5 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 292 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load offset=16 + local.set $6 + local.get $1 + i32.load offset=20 + local.set $7 + local.get $6 + if + local.get $6 + local.get $7 + i32.store offset=20 + end + local.get $7 + if + local.get $7 + local.get $6 + i32.store offset=16 + end + local.get $1 + local.get $0 + local.set $10 + local.get $4 + local.set $9 + local.get $5 + local.set $8 + local.get $10 + local.get $9 + i32.const 4 + i32.shl + local.get $8 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + i32.eq + if + local.get $0 + local.set $11 + local.get $4 + local.set $10 + local.get $5 + local.set $9 + local.get $7 + local.set $8 + local.get $11 + local.get $10 + i32.const 4 + i32.shl + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $8 + i32.store offset=96 + local.get $7 + i32.eqz + if + local.get $0 + local.set $9 + local.get $4 + local.set $8 + local.get $9 + local.get $8 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $9 + local.get $0 + local.set $8 + local.get $4 + local.set $11 + local.get $9 + i32.const 1 + local.get $5 + i32.shl + i32.const -1 + i32.xor + i32.and + local.tee $9 + local.set $10 + local.get $8 + local.get $11 + i32.const 2 + i32.shl + i32.add + local.get $10 + i32.store offset=4 + local.get $9 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $4 + i32.shl + i32.const -1 + i32.xor + i32.and + i32.store + end + end + end + ) + (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + i32.const 1 + drop + local.get $1 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 205 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load + local.set $2 + i32.const 1 + drop + local.get $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 207 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + local.set $3 + local.get $3 + i32.const 16 + i32.add + local.get $3 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + local.get $5 + i32.const 1 + i32.and + if + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $5 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $3 + local.get $3 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $2 + i32.const 3 + i32.and + local.get $3 + i32.or + local.tee $2 + i32.store + local.get $1 + local.set $6 + local.get $6 + i32.const 16 + i32.add + local.get $6 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + end + end + local.get $2 + i32.const 2 + i32.and + if + local.get $1 + local.set $6 + local.get $6 + i32.const 4 + i32.sub + i32.load + local.set $6 + local.get $6 + i32.load + local.set $3 + i32.const 1 + drop + local.get $3 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 228 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $7 + local.get $7 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $6 + call $~lib/rt/tlsf/removeBlock + local.get $6 + local.get $3 + i32.const 3 + i32.and + local.get $7 + i32.or + local.tee $2 + i32.store + local.get $6 + local.set $1 + end + end + local.get $4 + local.get $5 + i32.const 2 + i32.or + i32.store + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $8 + i32.const 1 + drop + local.get $8 + i32.const 16 + i32.ge_u + if (result i32) + local.get $8 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 243 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + local.get $1 + i32.const 16 + i32.add + local.get $8 + i32.add + local.get $4 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 244 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $8 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $9 + local.get $8 + i32.const 4 + i32.shr_u + local.set $10 + else + i32.const 31 + local.get $8 + i32.clz + i32.sub + local.set $9 + local.get $8 + local.get $9 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $10 + local.get $9 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $9 + end + i32.const 1 + drop + local.get $9 + i32.const 23 + i32.lt_u + if (result i32) + local.get $10 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 260 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $7 + local.get $9 + local.set $3 + local.get $10 + local.set $6 + local.get $7 + local.get $3 + i32.const 4 + i32.shl + local.get $6 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $11 + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + local.get $11 + i32.store offset=20 + local.get $11 + if + local.get $11 + local.get $1 + i32.store offset=16 + end + local.get $0 + local.set $12 + local.get $9 + local.set $7 + local.get $10 + local.set $3 + local.get $1 + local.set $6 + local.get $12 + local.get $7 + i32.const 4 + i32.shl + local.get $3 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=96 + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $9 + i32.shl + i32.or + i32.store + local.get $0 + local.set $13 + local.get $9 + local.set $12 + local.get $0 + local.set $3 + local.get $9 + local.set $6 + local.get $3 + local.get $6 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 1 + local.get $10 + i32.shl + i32.or + local.set $7 + local.get $13 + local.get $12 + i32.const 2 + i32.shl + i32.add + local.get $7 + i32.store offset=4 + ) + (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + i32.const 1 + drop + local.get $1 + local.get $2 + i32.le_u + if (result i32) + local.get $1 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + if (result i32) + local.get $2 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 386 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + local.set $4 + i32.const 0 + local.set $5 + local.get $4 + if + i32.const 1 + drop + local.get $1 + local.get $4 + i32.const 16 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 396 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.sub + local.get $4 + i32.eq + if + local.get $1 + i32.const 16 + i32.sub + local.set $1 + local.get $4 + i32.load + local.set $5 + else + nop + end + else + i32.const 1 + drop + local.get $1 + local.get $0 + i32.const 1572 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 408 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + local.get $2 + local.get $1 + i32.sub + local.set $6 + local.get $6 + i32.const 16 + i32.const 16 + i32.add + i32.const 16 + i32.add + i32.lt_u + if + i32.const 0 + return + end + local.get $6 + i32.const 16 + i32.const 1 + i32.shl + i32.sub + local.set $7 + local.get $1 + local.set $8 + local.get $8 + local.get $7 + i32.const 1 + i32.or + local.get $5 + i32.const 2 + i32.and + i32.or + i32.store + local.get $8 + i32.const 0 + i32.store offset=16 + local.get $8 + i32.const 0 + i32.store offset=20 + local.get $1 + local.get $6 + i32.add + i32.const 16 + i32.sub + local.set $4 + local.get $4 + i32.const 0 + i32.const 2 + i32.or + i32.store + local.get $0 + local.set $9 + local.get $4 + local.set $3 + local.get $9 + local.get $3 + i32.store offset=1568 + local.get $0 + local.get $8 + call $~lib/rt/tlsf/insertBlock + i32.const 1 + ) + (func $~lib/rt/tlsf/maybeInitialize (result i32) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + global.get $~lib/rt/tlsf/ROOT + local.set $0 + local.get $0 + i32.eqz + if + global.get $~lib/heap/__heap_base + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $1 + memory.size + local.set $2 + local.get $1 + i32.const 1572 + i32.add + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $3 + local.get $3 + local.get $2 + i32.gt_s + if (result i32) + local.get $3 + local.get $2 + i32.sub + memory.grow + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable + end + local.get $1 + local.set $0 + local.get $0 + i32.const 0 + i32.store + local.get $0 + local.set $5 + i32.const 0 + local.set $4 + local.get $5 + local.get $4 + i32.store offset=1568 + i32.const 0 + local.set $5 + loop $for-loop|0 + local.get $5 + i32.const 23 + i32.lt_u + local.set $4 + local.get $4 + if + local.get $0 + local.set $8 + local.get $5 + local.set $7 + i32.const 0 + local.set $6 + local.get $8 + local.get $7 + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=4 + i32.const 0 + local.set $8 + loop $for-loop|1 + local.get $8 + i32.const 16 + i32.lt_u + local.set $7 + local.get $7 + if + local.get $0 + local.set $11 + local.get $5 + local.set $10 + local.get $8 + local.set $9 + i32.const 0 + local.set $6 + local.get $11 + local.get $10 + i32.const 4 + i32.shl + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=96 + local.get $8 + i32.const 1 + i32.add + local.set $8 + br $for-loop|1 + end + end + local.get $5 + i32.const 1 + i32.add + local.set $5 + br $for-loop|0 + end + end + local.get $1 + i32.const 1572 + i32.add + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $5 + i32.const 0 + drop + local.get $0 + local.get $5 + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop + local.get $0 + global.set $~lib/rt/tlsf/ROOT + end + local.get $0 + ) + (func $~lib/rt/tlsf/prepareSize (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.const 1073741808 + i32.ge_u + if + i32.const 80 + i32.const 32 + i32.const 461 + i32.const 30 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.tee $1 + i32.const 16 + local.tee $2 + local.get $1 + local.get $2 + i32.gt_u + select + ) + (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + local.get $1 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $2 + local.get $1 + i32.const 4 + i32.shr_u + local.set $3 + else + local.get $1 + i32.const 536870904 + i32.lt_u + if (result i32) + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $1 + end + local.set $4 + i32.const 31 + local.get $4 + i32.clz + i32.sub + local.set $2 + local.get $4 + local.get $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $3 + local.get $2 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $2 + end + i32.const 1 + drop + local.get $2 + i32.const 23 + i32.lt_u + if (result i32) + local.get $3 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 338 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $5 + local.get $2 + local.set $4 + local.get $5 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 0 + i32.const -1 + i32.xor + local.get $3 + i32.shl + i32.and + local.set $6 + i32.const 0 + local.set $7 + local.get $6 + i32.eqz + if + local.get $0 + i32.load + i32.const 0 + i32.const -1 + i32.xor + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.set $5 + local.get $5 + i32.eqz + if + i32.const 0 + local.set $7 + else + local.get $5 + i32.ctz + local.set $2 + local.get $0 + local.set $8 + local.get $2 + local.set $4 + local.get $8 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $6 + i32.const 1 + drop + local.get $6 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 351 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + else + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + local.get $7 + ) + (func $~lib/rt/tlsf/growMemory (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + drop + local.get $1 + i32.const 536870904 + i32.lt_u + if + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $1 + end + memory.size + local.set $2 + local.get $1 + i32.const 16 + local.get $2 + i32.const 16 + i32.shl + i32.const 16 + i32.sub + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + i32.ne + i32.shl + i32.add + local.set $1 + local.get $1 + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $4 + local.get $2 + local.tee $3 + local.get $4 + local.tee $5 + local.get $3 + local.get $5 + i32.gt_s + select + local.set $6 + local.get $6 + memory.grow + i32.const 0 + i32.lt_s + if + local.get $4 + memory.grow + i32.const 0 + i32.lt_s + if + unreachable + end + end + memory.size + local.set $7 + local.get $0 + local.get $2 + i32.const 16 + i32.shl + local.get $7 + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop + ) + (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + local.set $3 + i32.const 1 + drop + local.get $2 + i32.const 15 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 365 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.sub + local.set $4 + local.get $4 + i32.const 16 + i32.const 16 + i32.add + i32.ge_u + if + local.get $1 + local.get $2 + local.get $3 + i32.const 2 + i32.and + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.get $2 + i32.add + local.set $5 + local.get $5 + local.get $4 + i32.const 16 + i32.sub + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $5 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + local.get $3 + i32.const 1 + i32.const -1 + i32.xor + i32.and + i32.store + local.get $1 + local.set $5 + local.get $5 + i32.const 16 + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.get $1 + local.set $5 + local.get $5 + i32.const 16 + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + i32.load + i32.const 2 + i32.const -1 + i32.xor + i32.and + i32.store + end + ) + (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + i32.const 1 + drop + global.get $~lib/rt/tlsf/collectLock + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 500 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + call $~lib/rt/tlsf/prepareSize + local.set $3 + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + global.get $~lib/gc/gc.auto + if + i32.const 1 + drop + i32.const 1 + global.set $~lib/rt/tlsf/collectLock + call $~lib/rt/pure/__collect + i32.const 1 + drop + i32.const 0 + global.set $~lib/rt/tlsf/collectLock + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + local.get $0 + local.get $3 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + i32.const 1 + drop + local.get $4 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 512 + i32.const 20 + call $~lib/builtins/abort + unreachable + end + end + else + local.get $0 + local.get $3 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + i32.const 1 + drop + local.get $4 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 517 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + end + end + i32.const 1 + drop + local.get $4 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $3 + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 520 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 0 + i32.store offset=4 + local.get $4 + local.get $2 + i32.store offset=8 + local.get $4 + local.get $1 + i32.store offset=12 + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $0 + local.get $4 + local.get $3 + call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop + local.get $4 + ) + (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) + call $~lib/rt/tlsf/maybeInitialize + local.get $0 + local.get $1 + call $~lib/rt/tlsf/allocateBlock + i32.const 16 + i32.add + ) + (func $~lib/rt/pure/increment (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $1 + i32.const 1 + i32.add + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + i32.eq + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 109 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 1 + i32.add + i32.store offset=4 + i32.const 0 + drop + i32.const 1 + drop + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 112 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/pure/__retain (param $0 i32) (result i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/increment + end + local.get $0 + ) + (func $~lib/rt/pure/__release (param $0 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + end + ) + (func $start:assembly/index + global.get $../assembly/globals/answerToLife + i32.const 42 + i32.eq + drop + ) + (func $~start + global.get $~started + if + return + else + i32.const 1 + global.set $~started + end + call $start:assembly/index + ) + (func $~lib/rt/pure/__collect + i32.const 1 + drop + return + ) + (func $~lib/rt/tlsf/freeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $1 + i32.load + local.set $2 + local.get $1 + local.get $2 + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + i32.const 0 + drop + ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) + (func $~lib/rt/pure/decrement (param $0 i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 268435455 + i32.and + local.set $2 + i32.const 0 + drop + i32.const 1 + drop + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 122 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 1 + i32.eq + if + local.get $0 + i32.const 16 + i32.add + i32.const 1 + call $~lib/rt/__visit_members + i32.const 1 + drop + i32.const 1 + drop + local.get $1 + i32.const -2147483648 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 126 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + call $~lib/rt/pure/finalize + else + i32.const 1 + drop + local.get $2 + i32.const 0 + i32.gt_u + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 136 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + local.get $0 + local.get $1 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.const 1 + i32.sub + i32.or + i32.store offset=4 + end + ) + (func $~lib/rt/pure/__visit (param $0 i32) (param $1 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.lt_u + if + return + end + i32.const 1 + drop + i32.const 1 + drop + local.get $1 + i32.const 1 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 69 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + ) + (func $~lib/rt/__visit_members (param $0 i32) (param $1 i32) + (local $2 i32) + block $switch$1$default + block $switch$1$case$4 + block $switch$1$case$2 + local.get $0 + i32.const 8 + i32.sub + i32.load + br_table $switch$1$case$2 $switch$1$case$2 $switch$1$case$4 $switch$1$default + end + return + end + local.get $0 + i32.load + local.tee $2 + if + local.get $2 + local.get $1 + call $~lib/rt/pure/__visit + end + return + end + unreachable + ) +) diff --git a/tests/asconfig/entry-points/output.wat b/tests/asconfig/entry-points/output.wat new file mode 100644 index 0000000000..5ed78dc975 --- /dev/null +++ b/tests/asconfig/entry-points/output.wat @@ -0,0 +1,1716 @@ +(module + (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) + (type $none_=>_none (func)) + (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $none_=>_i32 (func (result i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (memory $0 1) + (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") + (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") + (data (i32.const 128) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") + (data (i32.const 176) "\03\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00") + (table $0 1 funcref) + (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) + (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) + (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) + (global $assembly/globals/answerToLife i32 (i32.const 42)) + (global $~started (mut i32) (i32.const 0)) + (global $~lib/rt/__rtti_base i32 (i32.const 176)) + (global $~lib/heap/__heap_base i32 (i32.const 204)) + (export "_start" (func $~start)) + (export "memory" (memory $0)) + (export "__alloc" (func $~lib/rt/tlsf/__alloc)) + (export "__retain" (func $~lib/rt/pure/__retain)) + (export "__release" (func $~lib/rt/pure/__release)) + (export "__collect" (func $~lib/rt/pure/__collect)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) + (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + local.get $1 + i32.load + local.set $2 + i32.const 1 + drop + local.get $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 277 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $3 + i32.const 1 + drop + local.get $3 + i32.const 16 + i32.ge_u + if (result i32) + local.get $3 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 279 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $4 + local.get $3 + i32.const 4 + i32.shr_u + local.set $5 + else + i32.const 31 + local.get $3 + i32.clz + i32.sub + local.set $4 + local.get $3 + local.get $4 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $5 + local.get $4 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $4 + end + i32.const 1 + drop + local.get $4 + i32.const 23 + i32.lt_u + if (result i32) + local.get $5 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 292 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load offset=16 + local.set $6 + local.get $1 + i32.load offset=20 + local.set $7 + local.get $6 + if + local.get $6 + local.get $7 + i32.store offset=20 + end + local.get $7 + if + local.get $7 + local.get $6 + i32.store offset=16 + end + local.get $1 + local.get $0 + local.set $10 + local.get $4 + local.set $9 + local.get $5 + local.set $8 + local.get $10 + local.get $9 + i32.const 4 + i32.shl + local.get $8 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + i32.eq + if + local.get $0 + local.set $11 + local.get $4 + local.set $10 + local.get $5 + local.set $9 + local.get $7 + local.set $8 + local.get $11 + local.get $10 + i32.const 4 + i32.shl + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $8 + i32.store offset=96 + local.get $7 + i32.eqz + if + local.get $0 + local.set $9 + local.get $4 + local.set $8 + local.get $9 + local.get $8 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $9 + local.get $0 + local.set $8 + local.get $4 + local.set $11 + local.get $9 + i32.const 1 + local.get $5 + i32.shl + i32.const -1 + i32.xor + i32.and + local.tee $9 + local.set $10 + local.get $8 + local.get $11 + i32.const 2 + i32.shl + i32.add + local.get $10 + i32.store offset=4 + local.get $9 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $4 + i32.shl + i32.const -1 + i32.xor + i32.and + i32.store + end + end + end + ) + (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + i32.const 1 + drop + local.get $1 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 205 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load + local.set $2 + i32.const 1 + drop + local.get $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 207 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + local.set $3 + local.get $3 + i32.const 16 + i32.add + local.get $3 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + local.get $5 + i32.const 1 + i32.and + if + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $5 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $3 + local.get $3 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $2 + i32.const 3 + i32.and + local.get $3 + i32.or + local.tee $2 + i32.store + local.get $1 + local.set $6 + local.get $6 + i32.const 16 + i32.add + local.get $6 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + end + end + local.get $2 + i32.const 2 + i32.and + if + local.get $1 + local.set $6 + local.get $6 + i32.const 4 + i32.sub + i32.load + local.set $6 + local.get $6 + i32.load + local.set $3 + i32.const 1 + drop + local.get $3 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 228 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $7 + local.get $7 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $6 + call $~lib/rt/tlsf/removeBlock + local.get $6 + local.get $3 + i32.const 3 + i32.and + local.get $7 + i32.or + local.tee $2 + i32.store + local.get $6 + local.set $1 + end + end + local.get $4 + local.get $5 + i32.const 2 + i32.or + i32.store + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $8 + i32.const 1 + drop + local.get $8 + i32.const 16 + i32.ge_u + if (result i32) + local.get $8 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 243 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + local.get $1 + i32.const 16 + i32.add + local.get $8 + i32.add + local.get $4 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 244 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $8 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $9 + local.get $8 + i32.const 4 + i32.shr_u + local.set $10 + else + i32.const 31 + local.get $8 + i32.clz + i32.sub + local.set $9 + local.get $8 + local.get $9 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $10 + local.get $9 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $9 + end + i32.const 1 + drop + local.get $9 + i32.const 23 + i32.lt_u + if (result i32) + local.get $10 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 260 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $7 + local.get $9 + local.set $3 + local.get $10 + local.set $6 + local.get $7 + local.get $3 + i32.const 4 + i32.shl + local.get $6 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $11 + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + local.get $11 + i32.store offset=20 + local.get $11 + if + local.get $11 + local.get $1 + i32.store offset=16 + end + local.get $0 + local.set $12 + local.get $9 + local.set $7 + local.get $10 + local.set $3 + local.get $1 + local.set $6 + local.get $12 + local.get $7 + i32.const 4 + i32.shl + local.get $3 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=96 + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $9 + i32.shl + i32.or + i32.store + local.get $0 + local.set $13 + local.get $9 + local.set $12 + local.get $0 + local.set $3 + local.get $9 + local.set $6 + local.get $3 + local.get $6 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 1 + local.get $10 + i32.shl + i32.or + local.set $7 + local.get $13 + local.get $12 + i32.const 2 + i32.shl + i32.add + local.get $7 + i32.store offset=4 + ) + (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + i32.const 1 + drop + local.get $1 + local.get $2 + i32.le_u + if (result i32) + local.get $1 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + if (result i32) + local.get $2 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 386 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + local.set $4 + i32.const 0 + local.set $5 + local.get $4 + if + i32.const 1 + drop + local.get $1 + local.get $4 + i32.const 16 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 396 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.sub + local.get $4 + i32.eq + if + local.get $1 + i32.const 16 + i32.sub + local.set $1 + local.get $4 + i32.load + local.set $5 + else + nop + end + else + i32.const 1 + drop + local.get $1 + local.get $0 + i32.const 1572 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 408 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + local.get $2 + local.get $1 + i32.sub + local.set $6 + local.get $6 + i32.const 16 + i32.const 16 + i32.add + i32.const 16 + i32.add + i32.lt_u + if + i32.const 0 + return + end + local.get $6 + i32.const 16 + i32.const 1 + i32.shl + i32.sub + local.set $7 + local.get $1 + local.set $8 + local.get $8 + local.get $7 + i32.const 1 + i32.or + local.get $5 + i32.const 2 + i32.and + i32.or + i32.store + local.get $8 + i32.const 0 + i32.store offset=16 + local.get $8 + i32.const 0 + i32.store offset=20 + local.get $1 + local.get $6 + i32.add + i32.const 16 + i32.sub + local.set $4 + local.get $4 + i32.const 0 + i32.const 2 + i32.or + i32.store + local.get $0 + local.set $9 + local.get $4 + local.set $3 + local.get $9 + local.get $3 + i32.store offset=1568 + local.get $0 + local.get $8 + call $~lib/rt/tlsf/insertBlock + i32.const 1 + ) + (func $~lib/rt/tlsf/maybeInitialize (result i32) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + global.get $~lib/rt/tlsf/ROOT + local.set $0 + local.get $0 + i32.eqz + if + global.get $~lib/heap/__heap_base + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $1 + memory.size + local.set $2 + local.get $1 + i32.const 1572 + i32.add + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $3 + local.get $3 + local.get $2 + i32.gt_s + if (result i32) + local.get $3 + local.get $2 + i32.sub + memory.grow + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable + end + local.get $1 + local.set $0 + local.get $0 + i32.const 0 + i32.store + local.get $0 + local.set $5 + i32.const 0 + local.set $4 + local.get $5 + local.get $4 + i32.store offset=1568 + i32.const 0 + local.set $5 + loop $for-loop|0 + local.get $5 + i32.const 23 + i32.lt_u + local.set $4 + local.get $4 + if + local.get $0 + local.set $8 + local.get $5 + local.set $7 + i32.const 0 + local.set $6 + local.get $8 + local.get $7 + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=4 + i32.const 0 + local.set $8 + loop $for-loop|1 + local.get $8 + i32.const 16 + i32.lt_u + local.set $7 + local.get $7 + if + local.get $0 + local.set $11 + local.get $5 + local.set $10 + local.get $8 + local.set $9 + i32.const 0 + local.set $6 + local.get $11 + local.get $10 + i32.const 4 + i32.shl + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=96 + local.get $8 + i32.const 1 + i32.add + local.set $8 + br $for-loop|1 + end + end + local.get $5 + i32.const 1 + i32.add + local.set $5 + br $for-loop|0 + end + end + local.get $1 + i32.const 1572 + i32.add + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $5 + i32.const 0 + drop + local.get $0 + local.get $5 + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop + local.get $0 + global.set $~lib/rt/tlsf/ROOT + end + local.get $0 + ) + (func $~lib/rt/tlsf/prepareSize (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.const 1073741808 + i32.ge_u + if + i32.const 80 + i32.const 32 + i32.const 461 + i32.const 30 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.tee $1 + i32.const 16 + local.tee $2 + local.get $1 + local.get $2 + i32.gt_u + select + ) + (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + local.get $1 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $2 + local.get $1 + i32.const 4 + i32.shr_u + local.set $3 + else + local.get $1 + i32.const 536870904 + i32.lt_u + if (result i32) + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $1 + end + local.set $4 + i32.const 31 + local.get $4 + i32.clz + i32.sub + local.set $2 + local.get $4 + local.get $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $3 + local.get $2 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $2 + end + i32.const 1 + drop + local.get $2 + i32.const 23 + i32.lt_u + if (result i32) + local.get $3 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 338 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $5 + local.get $2 + local.set $4 + local.get $5 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 0 + i32.const -1 + i32.xor + local.get $3 + i32.shl + i32.and + local.set $6 + i32.const 0 + local.set $7 + local.get $6 + i32.eqz + if + local.get $0 + i32.load + i32.const 0 + i32.const -1 + i32.xor + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.set $5 + local.get $5 + i32.eqz + if + i32.const 0 + local.set $7 + else + local.get $5 + i32.ctz + local.set $2 + local.get $0 + local.set $8 + local.get $2 + local.set $4 + local.get $8 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $6 + i32.const 1 + drop + local.get $6 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 351 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + else + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + local.get $7 + ) + (func $~lib/rt/tlsf/growMemory (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + drop + local.get $1 + i32.const 536870904 + i32.lt_u + if + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $1 + end + memory.size + local.set $2 + local.get $1 + i32.const 16 + local.get $2 + i32.const 16 + i32.shl + i32.const 16 + i32.sub + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + i32.ne + i32.shl + i32.add + local.set $1 + local.get $1 + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $4 + local.get $2 + local.tee $3 + local.get $4 + local.tee $5 + local.get $3 + local.get $5 + i32.gt_s + select + local.set $6 + local.get $6 + memory.grow + i32.const 0 + i32.lt_s + if + local.get $4 + memory.grow + i32.const 0 + i32.lt_s + if + unreachable + end + end + memory.size + local.set $7 + local.get $0 + local.get $2 + i32.const 16 + i32.shl + local.get $7 + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop + ) + (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + local.set $3 + i32.const 1 + drop + local.get $2 + i32.const 15 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 365 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.sub + local.set $4 + local.get $4 + i32.const 16 + i32.const 16 + i32.add + i32.ge_u + if + local.get $1 + local.get $2 + local.get $3 + i32.const 2 + i32.and + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.get $2 + i32.add + local.set $5 + local.get $5 + local.get $4 + i32.const 16 + i32.sub + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $5 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + local.get $3 + i32.const 1 + i32.const -1 + i32.xor + i32.and + i32.store + local.get $1 + local.set $5 + local.get $5 + i32.const 16 + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.get $1 + local.set $5 + local.get $5 + i32.const 16 + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + i32.load + i32.const 2 + i32.const -1 + i32.xor + i32.and + i32.store + end + ) + (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + i32.const 1 + drop + global.get $~lib/rt/tlsf/collectLock + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 500 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + call $~lib/rt/tlsf/prepareSize + local.set $3 + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + global.get $~lib/gc/gc.auto + if + i32.const 1 + drop + i32.const 1 + global.set $~lib/rt/tlsf/collectLock + call $~lib/rt/pure/__collect + i32.const 1 + drop + i32.const 0 + global.set $~lib/rt/tlsf/collectLock + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + local.get $0 + local.get $3 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + i32.const 1 + drop + local.get $4 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 512 + i32.const 20 + call $~lib/builtins/abort + unreachable + end + end + else + local.get $0 + local.get $3 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + i32.const 1 + drop + local.get $4 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 517 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + end + end + i32.const 1 + drop + local.get $4 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $3 + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 520 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 0 + i32.store offset=4 + local.get $4 + local.get $2 + i32.store offset=8 + local.get $4 + local.get $1 + i32.store offset=12 + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $0 + local.get $4 + local.get $3 + call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop + local.get $4 + ) + (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) + call $~lib/rt/tlsf/maybeInitialize + local.get $0 + local.get $1 + call $~lib/rt/tlsf/allocateBlock + i32.const 16 + i32.add + ) + (func $~lib/rt/pure/increment (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $1 + i32.const 1 + i32.add + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + i32.eq + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 109 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 1 + i32.add + i32.store offset=4 + i32.const 0 + drop + i32.const 1 + drop + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 112 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/pure/__retain (param $0 i32) (result i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/increment + end + local.get $0 + ) + (func $~lib/rt/pure/__release (param $0 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + end + ) + (func $start:assembly/index + global.get $assembly/globals/answerToLife + i32.const 42 + i32.eq + drop + ) + (func $~start + global.get $~started + if + return + else + i32.const 1 + global.set $~started + end + call $start:assembly/index + ) + (func $~lib/rt/pure/__collect + i32.const 1 + drop + return + ) + (func $~lib/rt/tlsf/freeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $1 + i32.load + local.set $2 + local.get $1 + local.get $2 + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + i32.const 0 + drop + ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) + (func $~lib/rt/pure/decrement (param $0 i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 268435455 + i32.and + local.set $2 + i32.const 0 + drop + i32.const 1 + drop + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 122 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 1 + i32.eq + if + local.get $0 + i32.const 16 + i32.add + i32.const 1 + call $~lib/rt/__visit_members + i32.const 1 + drop + i32.const 1 + drop + local.get $1 + i32.const -2147483648 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 126 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + call $~lib/rt/pure/finalize + else + i32.const 1 + drop + local.get $2 + i32.const 0 + i32.gt_u + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 136 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + local.get $0 + local.get $1 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.const 1 + i32.sub + i32.or + i32.store offset=4 + end + ) + (func $~lib/rt/pure/__visit (param $0 i32) (param $1 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.lt_u + if + return + end + i32.const 1 + drop + i32.const 1 + drop + local.get $1 + i32.const 1 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 69 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + ) + (func $~lib/rt/__visit_members (param $0 i32) (param $1 i32) + (local $2 i32) + block $switch$1$default + block $switch$1$case$4 + block $switch$1$case$2 + local.get $0 + i32.const 8 + i32.sub + i32.load + br_table $switch$1$case$2 $switch$1$case$2 $switch$1$case$4 $switch$1$default + end + return + end + local.get $0 + i32.load + local.tee $2 + if + local.get $2 + local.get $1 + call $~lib/rt/pure/__visit + end + return + end + unreachable + ) +) diff --git a/tests/asconfig/flags/asconfig.json b/tests/asconfig/flags/asconfig.json index c83915e042..3b8e6b3955 100644 --- a/tests/asconfig/flags/asconfig.json +++ b/tests/asconfig/flags/asconfig.json @@ -1,8 +1,8 @@ { - "target": { + "targets": { "release": {}, "debug": { "debug": true } - } + } } diff --git a/tests/asconfig/flags/nested/output.wat b/tests/asconfig/flags/nested/output.wat new file mode 100644 index 0000000000..e7be0c0e3f --- /dev/null +++ b/tests/asconfig/flags/nested/output.wat @@ -0,0 +1,1701 @@ +(module + (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) + (type $none_=>_none (func)) + (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $none_=>_i32 (func (result i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (memory $0 1) + (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") + (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") + (data (i32.const 128) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") + (data (i32.const 176) "\03\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00") + (table $0 1 funcref) + (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) + (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) + (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) + (global $~lib/rt/__rtti_base i32 (i32.const 176)) + (global $~lib/heap/__heap_base i32 (i32.const 204)) + (export "_start" (func $~start)) + (export "memory" (memory $0)) + (export "__alloc" (func $~lib/rt/tlsf/__alloc)) + (export "__retain" (func $~lib/rt/pure/__retain)) + (export "__release" (func $~lib/rt/pure/__release)) + (export "__collect" (func $~lib/rt/pure/__collect)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) + (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + local.get $1 + i32.load + local.set $2 + i32.const 1 + drop + local.get $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 277 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $3 + i32.const 1 + drop + local.get $3 + i32.const 16 + i32.ge_u + if (result i32) + local.get $3 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 279 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $4 + local.get $3 + i32.const 4 + i32.shr_u + local.set $5 + else + i32.const 31 + local.get $3 + i32.clz + i32.sub + local.set $4 + local.get $3 + local.get $4 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $5 + local.get $4 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $4 + end + i32.const 1 + drop + local.get $4 + i32.const 23 + i32.lt_u + if (result i32) + local.get $5 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 292 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load offset=16 + local.set $6 + local.get $1 + i32.load offset=20 + local.set $7 + local.get $6 + if + local.get $6 + local.get $7 + i32.store offset=20 + end + local.get $7 + if + local.get $7 + local.get $6 + i32.store offset=16 + end + local.get $1 + local.get $0 + local.set $10 + local.get $4 + local.set $9 + local.get $5 + local.set $8 + local.get $10 + local.get $9 + i32.const 4 + i32.shl + local.get $8 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + i32.eq + if + local.get $0 + local.set $11 + local.get $4 + local.set $10 + local.get $5 + local.set $9 + local.get $7 + local.set $8 + local.get $11 + local.get $10 + i32.const 4 + i32.shl + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $8 + i32.store offset=96 + local.get $7 + i32.eqz + if + local.get $0 + local.set $9 + local.get $4 + local.set $8 + local.get $9 + local.get $8 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $9 + local.get $0 + local.set $8 + local.get $4 + local.set $11 + local.get $9 + i32.const 1 + local.get $5 + i32.shl + i32.const -1 + i32.xor + i32.and + local.tee $9 + local.set $10 + local.get $8 + local.get $11 + i32.const 2 + i32.shl + i32.add + local.get $10 + i32.store offset=4 + local.get $9 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $4 + i32.shl + i32.const -1 + i32.xor + i32.and + i32.store + end + end + end + ) + (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + i32.const 1 + drop + local.get $1 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 205 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load + local.set $2 + i32.const 1 + drop + local.get $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 207 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + local.set $3 + local.get $3 + i32.const 16 + i32.add + local.get $3 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + local.get $5 + i32.const 1 + i32.and + if + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $5 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $3 + local.get $3 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $2 + i32.const 3 + i32.and + local.get $3 + i32.or + local.tee $2 + i32.store + local.get $1 + local.set $6 + local.get $6 + i32.const 16 + i32.add + local.get $6 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + end + end + local.get $2 + i32.const 2 + i32.and + if + local.get $1 + local.set $6 + local.get $6 + i32.const 4 + i32.sub + i32.load + local.set $6 + local.get $6 + i32.load + local.set $3 + i32.const 1 + drop + local.get $3 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 228 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $7 + local.get $7 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $6 + call $~lib/rt/tlsf/removeBlock + local.get $6 + local.get $3 + i32.const 3 + i32.and + local.get $7 + i32.or + local.tee $2 + i32.store + local.get $6 + local.set $1 + end + end + local.get $4 + local.get $5 + i32.const 2 + i32.or + i32.store + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $8 + i32.const 1 + drop + local.get $8 + i32.const 16 + i32.ge_u + if (result i32) + local.get $8 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 243 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + local.get $1 + i32.const 16 + i32.add + local.get $8 + i32.add + local.get $4 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 244 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $8 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $9 + local.get $8 + i32.const 4 + i32.shr_u + local.set $10 + else + i32.const 31 + local.get $8 + i32.clz + i32.sub + local.set $9 + local.get $8 + local.get $9 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $10 + local.get $9 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $9 + end + i32.const 1 + drop + local.get $9 + i32.const 23 + i32.lt_u + if (result i32) + local.get $10 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 260 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $7 + local.get $9 + local.set $3 + local.get $10 + local.set $6 + local.get $7 + local.get $3 + i32.const 4 + i32.shl + local.get $6 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $11 + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + local.get $11 + i32.store offset=20 + local.get $11 + if + local.get $11 + local.get $1 + i32.store offset=16 + end + local.get $0 + local.set $12 + local.get $9 + local.set $7 + local.get $10 + local.set $3 + local.get $1 + local.set $6 + local.get $12 + local.get $7 + i32.const 4 + i32.shl + local.get $3 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=96 + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $9 + i32.shl + i32.or + i32.store + local.get $0 + local.set $13 + local.get $9 + local.set $12 + local.get $0 + local.set $3 + local.get $9 + local.set $6 + local.get $3 + local.get $6 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 1 + local.get $10 + i32.shl + i32.or + local.set $7 + local.get $13 + local.get $12 + i32.const 2 + i32.shl + i32.add + local.get $7 + i32.store offset=4 + ) + (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + i32.const 1 + drop + local.get $1 + local.get $2 + i32.le_u + if (result i32) + local.get $1 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + if (result i32) + local.get $2 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 386 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + local.set $4 + i32.const 0 + local.set $5 + local.get $4 + if + i32.const 1 + drop + local.get $1 + local.get $4 + i32.const 16 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 396 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.sub + local.get $4 + i32.eq + if + local.get $1 + i32.const 16 + i32.sub + local.set $1 + local.get $4 + i32.load + local.set $5 + else + nop + end + else + i32.const 1 + drop + local.get $1 + local.get $0 + i32.const 1572 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 408 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + local.get $2 + local.get $1 + i32.sub + local.set $6 + local.get $6 + i32.const 16 + i32.const 16 + i32.add + i32.const 16 + i32.add + i32.lt_u + if + i32.const 0 + return + end + local.get $6 + i32.const 16 + i32.const 1 + i32.shl + i32.sub + local.set $7 + local.get $1 + local.set $8 + local.get $8 + local.get $7 + i32.const 1 + i32.or + local.get $5 + i32.const 2 + i32.and + i32.or + i32.store + local.get $8 + i32.const 0 + i32.store offset=16 + local.get $8 + i32.const 0 + i32.store offset=20 + local.get $1 + local.get $6 + i32.add + i32.const 16 + i32.sub + local.set $4 + local.get $4 + i32.const 0 + i32.const 2 + i32.or + i32.store + local.get $0 + local.set $9 + local.get $4 + local.set $3 + local.get $9 + local.get $3 + i32.store offset=1568 + local.get $0 + local.get $8 + call $~lib/rt/tlsf/insertBlock + i32.const 1 + ) + (func $~lib/rt/tlsf/maybeInitialize (result i32) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + global.get $~lib/rt/tlsf/ROOT + local.set $0 + local.get $0 + i32.eqz + if + global.get $~lib/heap/__heap_base + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $1 + memory.size + local.set $2 + local.get $1 + i32.const 1572 + i32.add + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $3 + local.get $3 + local.get $2 + i32.gt_s + if (result i32) + local.get $3 + local.get $2 + i32.sub + memory.grow + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable + end + local.get $1 + local.set $0 + local.get $0 + i32.const 0 + i32.store + local.get $0 + local.set $5 + i32.const 0 + local.set $4 + local.get $5 + local.get $4 + i32.store offset=1568 + i32.const 0 + local.set $5 + loop $for-loop|0 + local.get $5 + i32.const 23 + i32.lt_u + local.set $4 + local.get $4 + if + local.get $0 + local.set $8 + local.get $5 + local.set $7 + i32.const 0 + local.set $6 + local.get $8 + local.get $7 + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=4 + i32.const 0 + local.set $8 + loop $for-loop|1 + local.get $8 + i32.const 16 + i32.lt_u + local.set $7 + local.get $7 + if + local.get $0 + local.set $11 + local.get $5 + local.set $10 + local.get $8 + local.set $9 + i32.const 0 + local.set $6 + local.get $11 + local.get $10 + i32.const 4 + i32.shl + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=96 + local.get $8 + i32.const 1 + i32.add + local.set $8 + br $for-loop|1 + end + end + local.get $5 + i32.const 1 + i32.add + local.set $5 + br $for-loop|0 + end + end + local.get $1 + i32.const 1572 + i32.add + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $5 + i32.const 0 + drop + local.get $0 + local.get $5 + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop + local.get $0 + global.set $~lib/rt/tlsf/ROOT + end + local.get $0 + ) + (func $~lib/rt/tlsf/prepareSize (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.const 1073741808 + i32.ge_u + if + i32.const 80 + i32.const 32 + i32.const 461 + i32.const 30 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.tee $1 + i32.const 16 + local.tee $2 + local.get $1 + local.get $2 + i32.gt_u + select + ) + (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + local.get $1 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $2 + local.get $1 + i32.const 4 + i32.shr_u + local.set $3 + else + local.get $1 + i32.const 536870904 + i32.lt_u + if (result i32) + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $1 + end + local.set $4 + i32.const 31 + local.get $4 + i32.clz + i32.sub + local.set $2 + local.get $4 + local.get $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $3 + local.get $2 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $2 + end + i32.const 1 + drop + local.get $2 + i32.const 23 + i32.lt_u + if (result i32) + local.get $3 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 338 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $5 + local.get $2 + local.set $4 + local.get $5 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 0 + i32.const -1 + i32.xor + local.get $3 + i32.shl + i32.and + local.set $6 + i32.const 0 + local.set $7 + local.get $6 + i32.eqz + if + local.get $0 + i32.load + i32.const 0 + i32.const -1 + i32.xor + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.set $5 + local.get $5 + i32.eqz + if + i32.const 0 + local.set $7 + else + local.get $5 + i32.ctz + local.set $2 + local.get $0 + local.set $8 + local.get $2 + local.set $4 + local.get $8 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $6 + i32.const 1 + drop + local.get $6 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 351 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + else + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + local.get $7 + ) + (func $~lib/rt/tlsf/growMemory (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + drop + local.get $1 + i32.const 536870904 + i32.lt_u + if + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $1 + end + memory.size + local.set $2 + local.get $1 + i32.const 16 + local.get $2 + i32.const 16 + i32.shl + i32.const 16 + i32.sub + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + i32.ne + i32.shl + i32.add + local.set $1 + local.get $1 + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $4 + local.get $2 + local.tee $3 + local.get $4 + local.tee $5 + local.get $3 + local.get $5 + i32.gt_s + select + local.set $6 + local.get $6 + memory.grow + i32.const 0 + i32.lt_s + if + local.get $4 + memory.grow + i32.const 0 + i32.lt_s + if + unreachable + end + end + memory.size + local.set $7 + local.get $0 + local.get $2 + i32.const 16 + i32.shl + local.get $7 + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop + ) + (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + local.set $3 + i32.const 1 + drop + local.get $2 + i32.const 15 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 365 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.sub + local.set $4 + local.get $4 + i32.const 16 + i32.const 16 + i32.add + i32.ge_u + if + local.get $1 + local.get $2 + local.get $3 + i32.const 2 + i32.and + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.get $2 + i32.add + local.set $5 + local.get $5 + local.get $4 + i32.const 16 + i32.sub + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $5 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + local.get $3 + i32.const 1 + i32.const -1 + i32.xor + i32.and + i32.store + local.get $1 + local.set $5 + local.get $5 + i32.const 16 + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.get $1 + local.set $5 + local.get $5 + i32.const 16 + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + i32.load + i32.const 2 + i32.const -1 + i32.xor + i32.and + i32.store + end + ) + (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + i32.const 1 + drop + global.get $~lib/rt/tlsf/collectLock + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 500 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + call $~lib/rt/tlsf/prepareSize + local.set $3 + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + global.get $~lib/gc/gc.auto + if + i32.const 1 + drop + i32.const 1 + global.set $~lib/rt/tlsf/collectLock + call $~lib/rt/pure/__collect + i32.const 1 + drop + i32.const 0 + global.set $~lib/rt/tlsf/collectLock + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + local.get $0 + local.get $3 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + i32.const 1 + drop + local.get $4 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 512 + i32.const 20 + call $~lib/builtins/abort + unreachable + end + end + else + local.get $0 + local.get $3 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + i32.const 1 + drop + local.get $4 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 517 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + end + end + i32.const 1 + drop + local.get $4 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $3 + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 520 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 0 + i32.store offset=4 + local.get $4 + local.get $2 + i32.store offset=8 + local.get $4 + local.get $1 + i32.store offset=12 + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $0 + local.get $4 + local.get $3 + call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop + local.get $4 + ) + (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) + call $~lib/rt/tlsf/maybeInitialize + local.get $0 + local.get $1 + call $~lib/rt/tlsf/allocateBlock + i32.const 16 + i32.add + ) + (func $~lib/rt/pure/increment (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $1 + i32.const 1 + i32.add + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + i32.eq + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 109 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 1 + i32.add + i32.store offset=4 + i32.const 0 + drop + i32.const 1 + drop + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 112 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/pure/__retain (param $0 i32) (result i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/increment + end + local.get $0 + ) + (func $~lib/rt/pure/__release (param $0 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + end + ) + (func $~start + nop + ) + (func $~lib/rt/pure/__collect + i32.const 1 + drop + return + ) + (func $~lib/rt/tlsf/freeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $1 + i32.load + local.set $2 + local.get $1 + local.get $2 + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + i32.const 0 + drop + ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) + (func $~lib/rt/pure/decrement (param $0 i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 268435455 + i32.and + local.set $2 + i32.const 0 + drop + i32.const 1 + drop + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 122 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 1 + i32.eq + if + local.get $0 + i32.const 16 + i32.add + i32.const 1 + call $~lib/rt/__visit_members + i32.const 1 + drop + i32.const 1 + drop + local.get $1 + i32.const -2147483648 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 126 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + call $~lib/rt/pure/finalize + else + i32.const 1 + drop + local.get $2 + i32.const 0 + i32.gt_u + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 136 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + local.get $0 + local.get $1 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.const 1 + i32.sub + i32.or + i32.store offset=4 + end + ) + (func $~lib/rt/pure/__visit (param $0 i32) (param $1 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.lt_u + if + return + end + i32.const 1 + drop + i32.const 1 + drop + local.get $1 + i32.const 1 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 69 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + ) + (func $~lib/rt/__visit_members (param $0 i32) (param $1 i32) + (local $2 i32) + block $switch$1$default + block $switch$1$case$4 + block $switch$1$case$2 + local.get $0 + i32.const 8 + i32.sub + i32.load + br_table $switch$1$case$2 $switch$1$case$2 $switch$1$case$4 $switch$1$default + end + return + end + local.get $0 + i32.load + local.tee $2 + if + local.get $2 + local.get $1 + call $~lib/rt/pure/__visit + end + return + end + unreachable + ) +) diff --git a/tests/asconfig/flags/nested/package.json b/tests/asconfig/flags/nested/package.json index 7603e9ad4d..55c26da628 100644 --- a/tests/asconfig/flags/nested/package.json +++ b/tests/asconfig/flags/nested/package.json @@ -1,6 +1,6 @@ { "private": true, "scripts": { - "test": "node ../../index.js" + "test": "node ../../index.js --target debug" } } diff --git a/tests/asconfig/flags/output.wat b/tests/asconfig/flags/output.wat new file mode 100644 index 0000000000..e7be0c0e3f --- /dev/null +++ b/tests/asconfig/flags/output.wat @@ -0,0 +1,1701 @@ +(module + (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) + (type $none_=>_none (func)) + (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $none_=>_i32 (func (result i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (memory $0 1) + (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") + (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") + (data (i32.const 128) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") + (data (i32.const 176) "\03\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00") + (table $0 1 funcref) + (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) + (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) + (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) + (global $~lib/rt/__rtti_base i32 (i32.const 176)) + (global $~lib/heap/__heap_base i32 (i32.const 204)) + (export "_start" (func $~start)) + (export "memory" (memory $0)) + (export "__alloc" (func $~lib/rt/tlsf/__alloc)) + (export "__retain" (func $~lib/rt/pure/__retain)) + (export "__release" (func $~lib/rt/pure/__release)) + (export "__collect" (func $~lib/rt/pure/__collect)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) + (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + local.get $1 + i32.load + local.set $2 + i32.const 1 + drop + local.get $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 277 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $3 + i32.const 1 + drop + local.get $3 + i32.const 16 + i32.ge_u + if (result i32) + local.get $3 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 279 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $4 + local.get $3 + i32.const 4 + i32.shr_u + local.set $5 + else + i32.const 31 + local.get $3 + i32.clz + i32.sub + local.set $4 + local.get $3 + local.get $4 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $5 + local.get $4 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $4 + end + i32.const 1 + drop + local.get $4 + i32.const 23 + i32.lt_u + if (result i32) + local.get $5 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 292 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load offset=16 + local.set $6 + local.get $1 + i32.load offset=20 + local.set $7 + local.get $6 + if + local.get $6 + local.get $7 + i32.store offset=20 + end + local.get $7 + if + local.get $7 + local.get $6 + i32.store offset=16 + end + local.get $1 + local.get $0 + local.set $10 + local.get $4 + local.set $9 + local.get $5 + local.set $8 + local.get $10 + local.get $9 + i32.const 4 + i32.shl + local.get $8 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + i32.eq + if + local.get $0 + local.set $11 + local.get $4 + local.set $10 + local.get $5 + local.set $9 + local.get $7 + local.set $8 + local.get $11 + local.get $10 + i32.const 4 + i32.shl + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $8 + i32.store offset=96 + local.get $7 + i32.eqz + if + local.get $0 + local.set $9 + local.get $4 + local.set $8 + local.get $9 + local.get $8 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $9 + local.get $0 + local.set $8 + local.get $4 + local.set $11 + local.get $9 + i32.const 1 + local.get $5 + i32.shl + i32.const -1 + i32.xor + i32.and + local.tee $9 + local.set $10 + local.get $8 + local.get $11 + i32.const 2 + i32.shl + i32.add + local.get $10 + i32.store offset=4 + local.get $9 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $4 + i32.shl + i32.const -1 + i32.xor + i32.and + i32.store + end + end + end + ) + (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + i32.const 1 + drop + local.get $1 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 205 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load + local.set $2 + i32.const 1 + drop + local.get $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 207 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + local.set $3 + local.get $3 + i32.const 16 + i32.add + local.get $3 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + local.get $5 + i32.const 1 + i32.and + if + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $5 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $3 + local.get $3 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $2 + i32.const 3 + i32.and + local.get $3 + i32.or + local.tee $2 + i32.store + local.get $1 + local.set $6 + local.get $6 + i32.const 16 + i32.add + local.get $6 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + end + end + local.get $2 + i32.const 2 + i32.and + if + local.get $1 + local.set $6 + local.get $6 + i32.const 4 + i32.sub + i32.load + local.set $6 + local.get $6 + i32.load + local.set $3 + i32.const 1 + drop + local.get $3 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 228 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $7 + local.get $7 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $6 + call $~lib/rt/tlsf/removeBlock + local.get $6 + local.get $3 + i32.const 3 + i32.and + local.get $7 + i32.or + local.tee $2 + i32.store + local.get $6 + local.set $1 + end + end + local.get $4 + local.get $5 + i32.const 2 + i32.or + i32.store + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $8 + i32.const 1 + drop + local.get $8 + i32.const 16 + i32.ge_u + if (result i32) + local.get $8 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 243 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + local.get $1 + i32.const 16 + i32.add + local.get $8 + i32.add + local.get $4 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 244 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $8 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $9 + local.get $8 + i32.const 4 + i32.shr_u + local.set $10 + else + i32.const 31 + local.get $8 + i32.clz + i32.sub + local.set $9 + local.get $8 + local.get $9 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $10 + local.get $9 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $9 + end + i32.const 1 + drop + local.get $9 + i32.const 23 + i32.lt_u + if (result i32) + local.get $10 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 260 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $7 + local.get $9 + local.set $3 + local.get $10 + local.set $6 + local.get $7 + local.get $3 + i32.const 4 + i32.shl + local.get $6 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $11 + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + local.get $11 + i32.store offset=20 + local.get $11 + if + local.get $11 + local.get $1 + i32.store offset=16 + end + local.get $0 + local.set $12 + local.get $9 + local.set $7 + local.get $10 + local.set $3 + local.get $1 + local.set $6 + local.get $12 + local.get $7 + i32.const 4 + i32.shl + local.get $3 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=96 + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $9 + i32.shl + i32.or + i32.store + local.get $0 + local.set $13 + local.get $9 + local.set $12 + local.get $0 + local.set $3 + local.get $9 + local.set $6 + local.get $3 + local.get $6 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 1 + local.get $10 + i32.shl + i32.or + local.set $7 + local.get $13 + local.get $12 + i32.const 2 + i32.shl + i32.add + local.get $7 + i32.store offset=4 + ) + (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + i32.const 1 + drop + local.get $1 + local.get $2 + i32.le_u + if (result i32) + local.get $1 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + if (result i32) + local.get $2 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 386 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + local.set $4 + i32.const 0 + local.set $5 + local.get $4 + if + i32.const 1 + drop + local.get $1 + local.get $4 + i32.const 16 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 396 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.sub + local.get $4 + i32.eq + if + local.get $1 + i32.const 16 + i32.sub + local.set $1 + local.get $4 + i32.load + local.set $5 + else + nop + end + else + i32.const 1 + drop + local.get $1 + local.get $0 + i32.const 1572 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 408 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + local.get $2 + local.get $1 + i32.sub + local.set $6 + local.get $6 + i32.const 16 + i32.const 16 + i32.add + i32.const 16 + i32.add + i32.lt_u + if + i32.const 0 + return + end + local.get $6 + i32.const 16 + i32.const 1 + i32.shl + i32.sub + local.set $7 + local.get $1 + local.set $8 + local.get $8 + local.get $7 + i32.const 1 + i32.or + local.get $5 + i32.const 2 + i32.and + i32.or + i32.store + local.get $8 + i32.const 0 + i32.store offset=16 + local.get $8 + i32.const 0 + i32.store offset=20 + local.get $1 + local.get $6 + i32.add + i32.const 16 + i32.sub + local.set $4 + local.get $4 + i32.const 0 + i32.const 2 + i32.or + i32.store + local.get $0 + local.set $9 + local.get $4 + local.set $3 + local.get $9 + local.get $3 + i32.store offset=1568 + local.get $0 + local.get $8 + call $~lib/rt/tlsf/insertBlock + i32.const 1 + ) + (func $~lib/rt/tlsf/maybeInitialize (result i32) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + global.get $~lib/rt/tlsf/ROOT + local.set $0 + local.get $0 + i32.eqz + if + global.get $~lib/heap/__heap_base + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $1 + memory.size + local.set $2 + local.get $1 + i32.const 1572 + i32.add + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $3 + local.get $3 + local.get $2 + i32.gt_s + if (result i32) + local.get $3 + local.get $2 + i32.sub + memory.grow + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable + end + local.get $1 + local.set $0 + local.get $0 + i32.const 0 + i32.store + local.get $0 + local.set $5 + i32.const 0 + local.set $4 + local.get $5 + local.get $4 + i32.store offset=1568 + i32.const 0 + local.set $5 + loop $for-loop|0 + local.get $5 + i32.const 23 + i32.lt_u + local.set $4 + local.get $4 + if + local.get $0 + local.set $8 + local.get $5 + local.set $7 + i32.const 0 + local.set $6 + local.get $8 + local.get $7 + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=4 + i32.const 0 + local.set $8 + loop $for-loop|1 + local.get $8 + i32.const 16 + i32.lt_u + local.set $7 + local.get $7 + if + local.get $0 + local.set $11 + local.get $5 + local.set $10 + local.get $8 + local.set $9 + i32.const 0 + local.set $6 + local.get $11 + local.get $10 + i32.const 4 + i32.shl + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=96 + local.get $8 + i32.const 1 + i32.add + local.set $8 + br $for-loop|1 + end + end + local.get $5 + i32.const 1 + i32.add + local.set $5 + br $for-loop|0 + end + end + local.get $1 + i32.const 1572 + i32.add + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $5 + i32.const 0 + drop + local.get $0 + local.get $5 + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop + local.get $0 + global.set $~lib/rt/tlsf/ROOT + end + local.get $0 + ) + (func $~lib/rt/tlsf/prepareSize (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.const 1073741808 + i32.ge_u + if + i32.const 80 + i32.const 32 + i32.const 461 + i32.const 30 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.tee $1 + i32.const 16 + local.tee $2 + local.get $1 + local.get $2 + i32.gt_u + select + ) + (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + local.get $1 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $2 + local.get $1 + i32.const 4 + i32.shr_u + local.set $3 + else + local.get $1 + i32.const 536870904 + i32.lt_u + if (result i32) + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $1 + end + local.set $4 + i32.const 31 + local.get $4 + i32.clz + i32.sub + local.set $2 + local.get $4 + local.get $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $3 + local.get $2 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $2 + end + i32.const 1 + drop + local.get $2 + i32.const 23 + i32.lt_u + if (result i32) + local.get $3 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 338 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $5 + local.get $2 + local.set $4 + local.get $5 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 0 + i32.const -1 + i32.xor + local.get $3 + i32.shl + i32.and + local.set $6 + i32.const 0 + local.set $7 + local.get $6 + i32.eqz + if + local.get $0 + i32.load + i32.const 0 + i32.const -1 + i32.xor + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.set $5 + local.get $5 + i32.eqz + if + i32.const 0 + local.set $7 + else + local.get $5 + i32.ctz + local.set $2 + local.get $0 + local.set $8 + local.get $2 + local.set $4 + local.get $8 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $6 + i32.const 1 + drop + local.get $6 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 351 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + else + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + local.get $7 + ) + (func $~lib/rt/tlsf/growMemory (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + drop + local.get $1 + i32.const 536870904 + i32.lt_u + if + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $1 + end + memory.size + local.set $2 + local.get $1 + i32.const 16 + local.get $2 + i32.const 16 + i32.shl + i32.const 16 + i32.sub + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + i32.ne + i32.shl + i32.add + local.set $1 + local.get $1 + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $4 + local.get $2 + local.tee $3 + local.get $4 + local.tee $5 + local.get $3 + local.get $5 + i32.gt_s + select + local.set $6 + local.get $6 + memory.grow + i32.const 0 + i32.lt_s + if + local.get $4 + memory.grow + i32.const 0 + i32.lt_s + if + unreachable + end + end + memory.size + local.set $7 + local.get $0 + local.get $2 + i32.const 16 + i32.shl + local.get $7 + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop + ) + (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + local.set $3 + i32.const 1 + drop + local.get $2 + i32.const 15 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 365 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.sub + local.set $4 + local.get $4 + i32.const 16 + i32.const 16 + i32.add + i32.ge_u + if + local.get $1 + local.get $2 + local.get $3 + i32.const 2 + i32.and + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.get $2 + i32.add + local.set $5 + local.get $5 + local.get $4 + i32.const 16 + i32.sub + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $5 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + local.get $3 + i32.const 1 + i32.const -1 + i32.xor + i32.and + i32.store + local.get $1 + local.set $5 + local.get $5 + i32.const 16 + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.get $1 + local.set $5 + local.get $5 + i32.const 16 + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + i32.load + i32.const 2 + i32.const -1 + i32.xor + i32.and + i32.store + end + ) + (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + i32.const 1 + drop + global.get $~lib/rt/tlsf/collectLock + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 500 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + call $~lib/rt/tlsf/prepareSize + local.set $3 + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + global.get $~lib/gc/gc.auto + if + i32.const 1 + drop + i32.const 1 + global.set $~lib/rt/tlsf/collectLock + call $~lib/rt/pure/__collect + i32.const 1 + drop + i32.const 0 + global.set $~lib/rt/tlsf/collectLock + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + local.get $0 + local.get $3 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + i32.const 1 + drop + local.get $4 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 512 + i32.const 20 + call $~lib/builtins/abort + unreachable + end + end + else + local.get $0 + local.get $3 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + i32.const 1 + drop + local.get $4 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 517 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + end + end + i32.const 1 + drop + local.get $4 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $3 + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 520 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 0 + i32.store offset=4 + local.get $4 + local.get $2 + i32.store offset=8 + local.get $4 + local.get $1 + i32.store offset=12 + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $0 + local.get $4 + local.get $3 + call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop + local.get $4 + ) + (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) + call $~lib/rt/tlsf/maybeInitialize + local.get $0 + local.get $1 + call $~lib/rt/tlsf/allocateBlock + i32.const 16 + i32.add + ) + (func $~lib/rt/pure/increment (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $1 + i32.const 1 + i32.add + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + i32.eq + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 109 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 1 + i32.add + i32.store offset=4 + i32.const 0 + drop + i32.const 1 + drop + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 112 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/pure/__retain (param $0 i32) (result i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/increment + end + local.get $0 + ) + (func $~lib/rt/pure/__release (param $0 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + end + ) + (func $~start + nop + ) + (func $~lib/rt/pure/__collect + i32.const 1 + drop + return + ) + (func $~lib/rt/tlsf/freeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $1 + i32.load + local.set $2 + local.get $1 + local.get $2 + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + i32.const 0 + drop + ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) + (func $~lib/rt/pure/decrement (param $0 i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 268435455 + i32.and + local.set $2 + i32.const 0 + drop + i32.const 1 + drop + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 122 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 1 + i32.eq + if + local.get $0 + i32.const 16 + i32.add + i32.const 1 + call $~lib/rt/__visit_members + i32.const 1 + drop + i32.const 1 + drop + local.get $1 + i32.const -2147483648 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 126 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + call $~lib/rt/pure/finalize + else + i32.const 1 + drop + local.get $2 + i32.const 0 + i32.gt_u + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 136 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + local.get $0 + local.get $1 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.const 1 + i32.sub + i32.or + i32.store offset=4 + end + ) + (func $~lib/rt/pure/__visit (param $0 i32) (param $1 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.lt_u + if + return + end + i32.const 1 + drop + i32.const 1 + drop + local.get $1 + i32.const 1 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 69 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + ) + (func $~lib/rt/__visit_members (param $0 i32) (param $1 i32) + (local $2 i32) + block $switch$1$default + block $switch$1$case$4 + block $switch$1$case$2 + local.get $0 + i32.const 8 + i32.sub + i32.load + br_table $switch$1$case$2 $switch$1$case$2 $switch$1$case$4 $switch$1$default + end + return + end + local.get $0 + i32.load + local.tee $2 + if + local.get $2 + local.get $1 + call $~lib/rt/pure/__visit + end + return + end + unreachable + ) +) diff --git a/tests/asconfig/flags/package.json b/tests/asconfig/flags/package.json index e835996ed6..117b4a2066 100644 --- a/tests/asconfig/flags/package.json +++ b/tests/asconfig/flags/package.json @@ -1,6 +1,6 @@ { "private": true, "scripts": { - "test": "node ../index.js && cd nested && npm run test" + "test": "node ../index.js --target debug && cd nested && npm run test" } } diff --git a/tests/asconfig/index.js b/tests/asconfig/index.js index 5050381a61..872b023526 100644 --- a/tests/asconfig/index.js +++ b/tests/asconfig/index.js @@ -6,11 +6,16 @@ const path = require("path"); /** @type {Uint8Array} */ let binary; -asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--explicitStart", ...args], { +/** @type {Uint8Array} */ +let wat; +asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--textFile", "output.wat", "--explicitStart", ...args], { writeFile(name, contents) { if (name === "output.wasm") { binary = contents; } + if (name === "output.wat") { + wat = contents; + } } }, (err) => { if (err) { @@ -22,6 +27,12 @@ asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--explicitStart", .. console.error("No binary was generated for the asconfig test in " + process.cwd()); process.exit(1); } + + if (!wat) { + console.error("No watFile was generated for the asconfig test in " + process.cwd()); + process.exit(1); + } + const optionsPath = path.join(process.cwd(), "options.json"); if (fs.existsSync(optionsPath)) { const options = require(optionsPath); @@ -32,6 +43,12 @@ asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--explicitStart", .. } } + const watPath = path.join(process.cwd(), "output.wat"); + if (fs.existsSync(watPath)) { + + } else { + fs.writeFileSync(watPath, wat); + } const theResult = loader.instantiateSync(binary); theResult.exports._start(); diff --git a/tests/asconfig/target/output.wat b/tests/asconfig/target/output.wat new file mode 100644 index 0000000000..66d5e7d515 --- /dev/null +++ b/tests/asconfig/target/output.wat @@ -0,0 +1,1207 @@ +(module + (type $none_=>_none (func)) + (type $i32_=>_none (func (param i32))) + (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $none_=>_i32 (func (result i32))) + (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (memory $0 1) + (data (i32.const 1024) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") + (data (i32.const 1072) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") + (data (i32.const 1136) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s") + (data (i32.const 1184) "\03\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 ") + (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) + (global $~started (mut i32) (i32.const 0)) + (global $~lib/rt/__rtti_base i32 (i32.const 1184)) + (export "_start" (func $~start)) + (export "memory" (memory $0)) + (export "__alloc" (func $~lib/rt/tlsf/__alloc)) + (export "__retain" (func $~lib/rt/pure/__retain)) + (export "__release" (func $~lib/rt/pure/__release)) + (export "__collect" (func $~lib/rt/pure/__collect)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) + (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + local.tee $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 277 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const -4 + i32.and + local.tee $2 + i32.const 16 + i32.ge_u + if (result i32) + local.get $2 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 279 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 256 + i32.lt_u + if + local.get $2 + i32.const 4 + i32.shr_u + local.set $2 + else + local.get $2 + i32.const 31 + local.get $2 + i32.clz + i32.sub + local.tee $4 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + local.set $2 + local.get $4 + i32.const 7 + i32.sub + local.set $4 + end + local.get $2 + i32.const 16 + i32.lt_u + i32.const 0 + local.get $4 + i32.const 23 + i32.lt_u + select + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 292 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load offset=20 + local.set $3 + local.get $1 + i32.load offset=16 + local.tee $5 + if + local.get $5 + local.get $3 + i32.store offset=20 + end + local.get $3 + if + local.get $3 + local.get $5 + i32.store offset=16 + end + local.get $1 + local.get $0 + local.get $2 + local.get $4 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + i32.eq + if + local.get $0 + local.get $2 + local.get $4 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + local.get $3 + i32.store offset=96 + local.get $3 + i32.eqz + if + local.get $0 + local.get $4 + i32.const 2 + i32.shl + i32.add + local.tee $3 + i32.load offset=4 + i32.const 1 + local.get $2 + i32.shl + i32.const -1 + i32.xor + i32.and + local.set $1 + local.get $3 + local.get $1 + i32.store offset=4 + local.get $1 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $4 + i32.shl + i32.const -1 + i32.xor + i32.and + i32.store + end + end + end + ) + (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + local.get $1 + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 205 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load + local.tee $4 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 207 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $5 + i32.load + local.tee $2 + i32.const 1 + i32.and + if + local.get $4 + i32.const -4 + i32.and + i32.const 16 + i32.add + local.get $2 + i32.const -4 + i32.and + i32.add + local.tee $3 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $5 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $3 + local.get $4 + i32.const 3 + i32.and + i32.or + local.tee $4 + i32.store + local.get $1 + i32.const 16 + i32.add + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.tee $5 + i32.load + local.set $2 + end + end + local.get $4 + i32.const 2 + i32.and + if + local.get $1 + i32.const 4 + i32.sub + i32.load + local.tee $3 + i32.load + local.tee $7 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 228 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $7 + i32.const -4 + i32.and + i32.const 16 + i32.add + local.get $4 + i32.const -4 + i32.and + i32.add + local.tee $8 + i32.const 1073741808 + i32.lt_u + if (result i32) + local.get $0 + local.get $3 + call $~lib/rt/tlsf/removeBlock + local.get $3 + local.get $8 + local.get $7 + i32.const 3 + i32.and + i32.or + local.tee $4 + i32.store + local.get $3 + else + local.get $1 + end + local.set $1 + end + local.get $5 + local.get $2 + i32.const 2 + i32.or + i32.store + local.get $4 + i32.const -4 + i32.and + local.tee $3 + i32.const 16 + i32.ge_u + if (result i32) + local.get $3 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 243 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + local.get $1 + i32.const 16 + i32.add + i32.add + local.get $5 + i32.ne + if + i32.const 0 + i32.const 1040 + i32.const 244 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $5 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $3 + i32.const 256 + i32.lt_u + if + local.get $3 + i32.const 4 + i32.shr_u + local.set $3 + else + local.get $3 + i32.const 31 + local.get $3 + i32.clz + i32.sub + local.tee $4 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + local.set $3 + local.get $4 + i32.const 7 + i32.sub + local.set $6 + end + local.get $3 + i32.const 16 + i32.lt_u + i32.const 0 + local.get $6 + i32.const 23 + i32.lt_u + select + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 260 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $3 + local.get $6 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $4 + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + local.get $4 + i32.store offset=20 + local.get $4 + if + local.get $4 + local.get $1 + i32.store offset=16 + end + local.get $0 + local.get $3 + local.get $6 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + local.get $1 + i32.store offset=96 + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $6 + i32.shl + i32.or + i32.store + local.get $0 + local.get $6 + i32.const 2 + i32.shl + i32.add + local.tee $0 + local.get $0 + i32.load offset=4 + i32.const 1 + local.get $3 + i32.shl + i32.or + i32.store offset=4 + ) + (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + local.get $2 + i32.const 15 + i32.and + i32.eqz + i32.const 0 + local.get $1 + i32.const 15 + i32.and + i32.eqz + i32.const 0 + local.get $1 + local.get $2 + i32.le_u + select + select + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 386 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.load offset=1568 + local.tee $3 + if + local.get $1 + local.get $3 + i32.const 16 + i32.add + i32.lt_u + if + i32.const 0 + i32.const 1040 + i32.const 396 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $3 + local.get $1 + i32.const 16 + i32.sub + i32.eq + if + local.get $3 + i32.load + local.set $4 + local.get $1 + i32.const 16 + i32.sub + local.set $1 + end + else + local.get $1 + local.get $0 + i32.const 1572 + i32.add + i32.lt_u + if + i32.const 0 + i32.const 1040 + i32.const 408 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + local.get $2 + local.get $1 + i32.sub + local.tee $2 + i32.const 48 + i32.lt_u + if + return + end + local.get $1 + local.get $4 + i32.const 2 + i32.and + local.get $2 + i32.const 32 + i32.sub + i32.const 1 + i32.or + i32.or + i32.store + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + i32.const 0 + i32.store offset=20 + local.get $1 + local.get $2 + i32.add + i32.const 16 + i32.sub + local.tee $2 + i32.const 2 + i32.store + local.get $0 + local.get $2 + i32.store offset=1568 + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + ) + (func $~lib/rt/tlsf/maybeInitialize (result i32) + (local $0 i32) + (local $1 i32) + (local $2 i32) + global.get $~lib/rt/tlsf/ROOT + local.tee $0 + i32.eqz + if + i32.const 1 + memory.size + local.tee $0 + i32.gt_s + if (result i32) + i32.const 1 + local.get $0 + i32.sub + memory.grow + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable + end + i32.const 1216 + local.tee $0 + i32.const 0 + i32.store + i32.const 2784 + i32.const 0 + i32.store + loop $for-loop|0 + local.get $1 + i32.const 23 + i32.lt_u + if + local.get $1 + i32.const 2 + i32.shl + i32.const 1216 + i32.add + i32.const 0 + i32.store offset=4 + i32.const 0 + local.set $2 + loop $for-loop|1 + local.get $2 + i32.const 16 + i32.lt_u + if + local.get $1 + i32.const 4 + i32.shl + local.get $2 + i32.add + i32.const 2 + i32.shl + i32.const 1216 + i32.add + i32.const 0 + i32.store offset=96 + local.get $2 + i32.const 1 + i32.add + local.set $2 + br $for-loop|1 + end + end + local.get $1 + i32.const 1 + i32.add + local.set $1 + br $for-loop|0 + end + end + i32.const 1216 + i32.const 2800 + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + i32.const 1216 + global.set $~lib/rt/tlsf/ROOT + end + local.get $0 + ) + (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + local.get $1 + i32.const 256 + i32.lt_u + if + local.get $1 + i32.const 4 + i32.shr_u + local.set $1 + else + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + local.get $1 + local.get $1 + i32.const 536870904 + i32.lt_u + select + local.tee $1 + i32.const 31 + local.get $1 + i32.clz + i32.sub + local.tee $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 16 + i32.xor + local.set $1 + local.get $2 + i32.const 7 + i32.sub + local.set $2 + end + local.get $1 + i32.const 16 + i32.lt_u + i32.const 0 + local.get $2 + i32.const 23 + i32.lt_u + select + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 338 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $2 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const -1 + local.get $1 + i32.shl + i32.and + local.tee $1 + if (result i32) + local.get $0 + local.get $1 + i32.ctz + local.get $2 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + else + local.get $0 + i32.load + i32.const -1 + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.tee $1 + if (result i32) + local.get $0 + local.get $1 + i32.ctz + local.tee $1 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.tee $2 + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 351 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $2 + i32.ctz + local.get $1 + i32.const 4 + i32.shl + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + else + i32.const 0 + end + end + ) + (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + local.get $1 + i32.load + local.set $3 + local.get $2 + i32.const 15 + i32.and + if + i32.const 0 + i32.const 1040 + i32.const 365 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const -4 + i32.and + local.get $2 + i32.sub + local.tee $4 + i32.const 32 + i32.ge_u + if + local.get $1 + local.get $2 + local.get $3 + i32.const 2 + i32.and + i32.or + i32.store + local.get $2 + local.get $1 + i32.const 16 + i32.add + i32.add + local.tee $1 + local.get $4 + i32.const 16 + i32.sub + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + local.get $3 + i32.const -2 + i32.and + i32.store + local.get $1 + i32.const 16 + i32.add + local.tee $0 + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + local.get $0 + local.get $1 + i32.load + i32.const -4 + i32.and + i32.add + i32.load + i32.const -3 + i32.and + i32.store + end + ) + (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + global.get $~lib/rt/tlsf/collectLock + if + i32.const 0 + i32.const 1040 + i32.const 500 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 1073741808 + i32.ge_u + if + i32.const 1088 + i32.const 1040 + i32.const 461 + i32.const 30 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 15 + i32.add + i32.const -16 + i32.and + local.tee $3 + i32.const 16 + local.get $3 + i32.const 16 + i32.gt_u + select + local.tee $4 + call $~lib/rt/tlsf/searchBlock + local.tee $3 + i32.eqz + if + i32.const 1 + global.set $~lib/rt/tlsf/collectLock + i32.const 0 + global.set $~lib/rt/tlsf/collectLock + local.get $0 + local.get $4 + call $~lib/rt/tlsf/searchBlock + local.tee $3 + i32.eqz + if + i32.const 16 + memory.size + local.tee $3 + i32.const 16 + i32.shl + i32.const 16 + i32.sub + local.get $0 + i32.load offset=1568 + i32.ne + i32.shl + local.get $4 + i32.const 1 + i32.const 27 + local.get $4 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.get $4 + local.get $4 + i32.const 536870904 + i32.lt_u + select + i32.add + i32.const 65535 + i32.add + i32.const -65536 + i32.and + i32.const 16 + i32.shr_u + local.set $5 + local.get $3 + local.get $5 + local.get $3 + local.get $5 + i32.gt_s + select + memory.grow + i32.const 0 + i32.lt_s + if + local.get $5 + memory.grow + i32.const 0 + i32.lt_s + if + unreachable + end + end + local.get $0 + local.get $3 + i32.const 16 + i32.shl + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + local.get $0 + local.get $4 + call $~lib/rt/tlsf/searchBlock + local.tee $3 + i32.eqz + if + i32.const 0 + i32.const 1040 + i32.const 512 + i32.const 20 + call $~lib/builtins/abort + unreachable + end + end + end + local.get $3 + i32.load + i32.const -4 + i32.and + local.get $4 + i32.lt_u + if + i32.const 0 + i32.const 1040 + i32.const 520 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 0 + i32.store offset=4 + local.get $3 + local.get $2 + i32.store offset=8 + local.get $3 + local.get $1 + i32.store offset=12 + local.get $0 + local.get $3 + call $~lib/rt/tlsf/removeBlock + local.get $0 + local.get $3 + local.get $4 + call $~lib/rt/tlsf/prepareBlock + local.get $3 + ) + (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) + call $~lib/rt/tlsf/maybeInitialize + local.get $0 + local.get $1 + call $~lib/rt/tlsf/allocateBlock + i32.const 16 + i32.add + ) + (func $~lib/rt/pure/__retain (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.const 1212 + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + local.tee $1 + i32.load offset=4 + local.tee $2 + i32.const -268435456 + i32.and + local.get $2 + i32.const 1 + i32.add + i32.const -268435456 + i32.and + i32.ne + if + i32.const 0 + i32.const 1152 + i32.const 109 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $1 + local.get $2 + i32.const 1 + i32.add + i32.store offset=4 + local.get $1 + i32.load + i32.const 1 + i32.and + if + i32.const 0 + i32.const 1152 + i32.const 112 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + end + local.get $0 + ) + (func $~lib/rt/pure/__release (param $0 i32) + local.get $0 + i32.const 1212 + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + end + ) + (func $~start + global.get $~started + i32.eqz + if + i32.const 1 + global.set $~started + end + ) + (func $~lib/rt/pure/__collect + nop + ) + (func $~lib/rt/pure/decrement (param $0 i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=4 + local.tee $2 + i32.const 268435455 + i32.and + local.set $1 + local.get $0 + i32.load + i32.const 1 + i32.and + if + i32.const 0 + i32.const 1152 + i32.const 122 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 1 + i32.eq + if + block $__inlined_func$~lib/rt/__visit_members + block $switch$1$default + block $switch$1$case$4 + local.get $0 + i32.const 8 + i32.add + i32.load + br_table $__inlined_func$~lib/rt/__visit_members $__inlined_func$~lib/rt/__visit_members $switch$1$case$4 $switch$1$default + end + local.get $0 + i32.load offset=16 + local.tee $1 + if + local.get $1 + i32.const 1212 + i32.ge_u + if + local.get $1 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + end + end + br $__inlined_func$~lib/rt/__visit_members + end + unreachable + end + local.get $2 + i32.const -2147483648 + i32.and + if + i32.const 0 + i32.const 1152 + i32.const 126 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $0 + i32.load + i32.const 1 + i32.or + i32.store + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + i32.const 0 + i32.le_u + if + i32.const 0 + i32.const 1152 + i32.const 136 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 1 + i32.sub + local.get $2 + i32.const -268435456 + i32.and + i32.or + i32.store offset=4 + end + ) +) diff --git a/tests/asconfig/use-consts/output.wat b/tests/asconfig/use-consts/output.wat new file mode 100644 index 0000000000..ed983701b6 --- /dev/null +++ b/tests/asconfig/use-consts/output.wat @@ -0,0 +1,1726 @@ +(module + (type $i32_i32_=>_none (func (param i32 i32))) + (type $i32_=>_none (func (param i32))) + (type $none_=>_none (func)) + (type $i32_=>_i32 (func (param i32) (result i32))) + (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) + (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) + (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) + (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) + (type $none_=>_i32 (func (result i32))) + (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) + (memory $0 1) + (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") + (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") + (data (i32.const 128) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") + (data (i32.const 176) "\03\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00") + (table $0 1 funcref) + (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) + (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) + (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) + (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) + (global $~lib/A i32 (i32.const 1)) + (global $~lib/B i32 (i32.const 2)) + (global $~lib/C i32 (i32.const 3)) + (global $~started (mut i32) (i32.const 0)) + (global $~lib/rt/__rtti_base i32 (i32.const 176)) + (global $~lib/heap/__heap_base i32 (i32.const 204)) + (export "_start" (func $~start)) + (export "memory" (memory $0)) + (export "__alloc" (func $~lib/rt/tlsf/__alloc)) + (export "__retain" (func $~lib/rt/pure/__retain)) + (export "__release" (func $~lib/rt/pure/__release)) + (export "__collect" (func $~lib/rt/pure/__collect)) + (export "__rtti_base" (global $~lib/rt/__rtti_base)) + (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + local.get $1 + i32.load + local.set $2 + i32.const 1 + drop + local.get $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 277 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $3 + i32.const 1 + drop + local.get $3 + i32.const 16 + i32.ge_u + if (result i32) + local.get $3 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 279 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $4 + local.get $3 + i32.const 4 + i32.shr_u + local.set $5 + else + i32.const 31 + local.get $3 + i32.clz + i32.sub + local.set $4 + local.get $3 + local.get $4 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $5 + local.get $4 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $4 + end + i32.const 1 + drop + local.get $4 + i32.const 23 + i32.lt_u + if (result i32) + local.get $5 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 292 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load offset=16 + local.set $6 + local.get $1 + i32.load offset=20 + local.set $7 + local.get $6 + if + local.get $6 + local.get $7 + i32.store offset=20 + end + local.get $7 + if + local.get $7 + local.get $6 + i32.store offset=16 + end + local.get $1 + local.get $0 + local.set $10 + local.get $4 + local.set $9 + local.get $5 + local.set $8 + local.get $10 + local.get $9 + i32.const 4 + i32.shl + local.get $8 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + i32.eq + if + local.get $0 + local.set $11 + local.get $4 + local.set $10 + local.get $5 + local.set $9 + local.get $7 + local.set $8 + local.get $11 + local.get $10 + i32.const 4 + i32.shl + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $8 + i32.store offset=96 + local.get $7 + i32.eqz + if + local.get $0 + local.set $9 + local.get $4 + local.set $8 + local.get $9 + local.get $8 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $9 + local.get $0 + local.set $8 + local.get $4 + local.set $11 + local.get $9 + i32.const 1 + local.get $5 + i32.shl + i32.const -1 + i32.xor + i32.and + local.tee $9 + local.set $10 + local.get $8 + local.get $11 + i32.const 2 + i32.shl + i32.add + local.get $10 + i32.store offset=4 + local.get $9 + i32.eqz + if + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $4 + i32.shl + i32.const -1 + i32.xor + i32.and + i32.store + end + end + end + ) + (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + (local $12 i32) + (local $13 i32) + i32.const 1 + drop + local.get $1 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 205 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.load + local.set $2 + i32.const 1 + drop + local.get $2 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 207 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + local.set $3 + local.get $3 + i32.const 16 + i32.add + local.get $3 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + local.get $5 + i32.const 1 + i32.and + if + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $5 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $3 + local.get $3 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $1 + local.get $2 + i32.const 3 + i32.and + local.get $3 + i32.or + local.tee $2 + i32.store + local.get $1 + local.set $6 + local.get $6 + i32.const 16 + i32.add + local.get $6 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $4 + local.get $4 + i32.load + local.set $5 + end + end + local.get $2 + i32.const 2 + i32.and + if + local.get $1 + local.set $6 + local.get $6 + i32.const 4 + i32.sub + i32.load + local.set $6 + local.get $6 + i32.load + local.set $3 + i32.const 1 + drop + local.get $3 + i32.const 1 + i32.and + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 228 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.add + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.set $7 + local.get $7 + i32.const 1073741808 + i32.lt_u + if + local.get $0 + local.get $6 + call $~lib/rt/tlsf/removeBlock + local.get $6 + local.get $3 + i32.const 3 + i32.and + local.get $7 + i32.or + local.tee $2 + i32.store + local.get $6 + local.set $1 + end + end + local.get $4 + local.get $5 + i32.const 2 + i32.or + i32.store + local.get $2 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.set $8 + i32.const 1 + drop + local.get $8 + i32.const 16 + i32.ge_u + if (result i32) + local.get $8 + i32.const 1073741808 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 243 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + local.get $1 + i32.const 16 + i32.add + local.get $8 + i32.add + local.get $4 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 244 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 4 + i32.sub + local.get $1 + i32.store + local.get $8 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $9 + local.get $8 + i32.const 4 + i32.shr_u + local.set $10 + else + i32.const 31 + local.get $8 + i32.clz + i32.sub + local.set $9 + local.get $8 + local.get $9 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $10 + local.get $9 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $9 + end + i32.const 1 + drop + local.get $9 + i32.const 23 + i32.lt_u + if (result i32) + local.get $10 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 260 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $7 + local.get $9 + local.set $3 + local.get $10 + local.set $6 + local.get $7 + local.get $3 + i32.const 4 + i32.shl + local.get $6 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $11 + local.get $1 + i32.const 0 + i32.store offset=16 + local.get $1 + local.get $11 + i32.store offset=20 + local.get $11 + if + local.get $11 + local.get $1 + i32.store offset=16 + end + local.get $0 + local.set $12 + local.get $9 + local.set $7 + local.get $10 + local.set $3 + local.get $1 + local.set $6 + local.get $12 + local.get $7 + i32.const 4 + i32.shl + local.get $3 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=96 + local.get $0 + local.get $0 + i32.load + i32.const 1 + local.get $9 + i32.shl + i32.or + i32.store + local.get $0 + local.set $13 + local.get $9 + local.set $12 + local.get $0 + local.set $3 + local.get $9 + local.set $6 + local.get $3 + local.get $6 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 1 + local.get $10 + i32.shl + i32.or + local.set $7 + local.get $13 + local.get $12 + i32.const 2 + i32.shl + i32.add + local.get $7 + i32.store offset=4 + ) + (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + i32.const 1 + drop + local.get $1 + local.get $2 + i32.le_u + if (result i32) + local.get $1 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + if (result i32) + local.get $2 + i32.const 15 + i32.and + i32.eqz + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 386 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + local.set $4 + i32.const 0 + local.set $5 + local.get $4 + if + i32.const 1 + drop + local.get $1 + local.get $4 + i32.const 16 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 396 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $1 + i32.const 16 + i32.sub + local.get $4 + i32.eq + if + local.get $1 + i32.const 16 + i32.sub + local.set $1 + local.get $4 + i32.load + local.set $5 + else + nop + end + else + i32.const 1 + drop + local.get $1 + local.get $0 + i32.const 1572 + i32.add + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 408 + i32.const 5 + call $~lib/builtins/abort + unreachable + end + end + local.get $2 + local.get $1 + i32.sub + local.set $6 + local.get $6 + i32.const 16 + i32.const 16 + i32.add + i32.const 16 + i32.add + i32.lt_u + if + i32.const 0 + return + end + local.get $6 + i32.const 16 + i32.const 1 + i32.shl + i32.sub + local.set $7 + local.get $1 + local.set $8 + local.get $8 + local.get $7 + i32.const 1 + i32.or + local.get $5 + i32.const 2 + i32.and + i32.or + i32.store + local.get $8 + i32.const 0 + i32.store offset=16 + local.get $8 + i32.const 0 + i32.store offset=20 + local.get $1 + local.get $6 + i32.add + i32.const 16 + i32.sub + local.set $4 + local.get $4 + i32.const 0 + i32.const 2 + i32.or + i32.store + local.get $0 + local.set $9 + local.get $4 + local.set $3 + local.get $9 + local.get $3 + i32.store offset=1568 + local.get $0 + local.get $8 + call $~lib/rt/tlsf/insertBlock + i32.const 1 + ) + (func $~lib/rt/tlsf/maybeInitialize (result i32) + (local $0 i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + (local $10 i32) + (local $11 i32) + global.get $~lib/rt/tlsf/ROOT + local.set $0 + local.get $0 + i32.eqz + if + global.get $~lib/heap/__heap_base + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $1 + memory.size + local.set $2 + local.get $1 + i32.const 1572 + i32.add + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $3 + local.get $3 + local.get $2 + i32.gt_s + if (result i32) + local.get $3 + local.get $2 + i32.sub + memory.grow + i32.const 0 + i32.lt_s + else + i32.const 0 + end + if + unreachable + end + local.get $1 + local.set $0 + local.get $0 + i32.const 0 + i32.store + local.get $0 + local.set $5 + i32.const 0 + local.set $4 + local.get $5 + local.get $4 + i32.store offset=1568 + i32.const 0 + local.set $5 + loop $for-loop|0 + local.get $5 + i32.const 23 + i32.lt_u + local.set $4 + local.get $4 + if + local.get $0 + local.set $8 + local.get $5 + local.set $7 + i32.const 0 + local.set $6 + local.get $8 + local.get $7 + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=4 + i32.const 0 + local.set $8 + loop $for-loop|1 + local.get $8 + i32.const 16 + i32.lt_u + local.set $7 + local.get $7 + if + local.get $0 + local.set $11 + local.get $5 + local.set $10 + local.get $8 + local.set $9 + i32.const 0 + local.set $6 + local.get $11 + local.get $10 + i32.const 4 + i32.shl + local.get $9 + i32.add + i32.const 2 + i32.shl + i32.add + local.get $6 + i32.store offset=96 + local.get $8 + i32.const 1 + i32.add + local.set $8 + br $for-loop|1 + end + end + local.get $5 + i32.const 1 + i32.add + local.set $5 + br $for-loop|0 + end + end + local.get $1 + i32.const 1572 + i32.add + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.set $5 + i32.const 0 + drop + local.get $0 + local.get $5 + memory.size + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop + local.get $0 + global.set $~lib/rt/tlsf/ROOT + end + local.get $0 + ) + (func $~lib/rt/tlsf/prepareSize (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.const 1073741808 + i32.ge_u + if + i32.const 80 + i32.const 32 + i32.const 461 + i32.const 30 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 15 + i32.add + i32.const 15 + i32.const -1 + i32.xor + i32.and + local.tee $1 + i32.const 16 + local.tee $2 + local.get $1 + local.get $2 + i32.gt_u + select + ) + (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (local $8 i32) + (local $9 i32) + local.get $1 + i32.const 256 + i32.lt_u + if + i32.const 0 + local.set $2 + local.get $1 + i32.const 4 + i32.shr_u + local.set $3 + else + local.get $1 + i32.const 536870904 + i32.lt_u + if (result i32) + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.add + i32.const 1 + i32.sub + else + local.get $1 + end + local.set $4 + i32.const 31 + local.get $4 + i32.clz + i32.sub + local.set $2 + local.get $4 + local.get $2 + i32.const 4 + i32.sub + i32.shr_u + i32.const 1 + i32.const 4 + i32.shl + i32.xor + local.set $3 + local.get $2 + i32.const 8 + i32.const 1 + i32.sub + i32.sub + local.set $2 + end + i32.const 1 + drop + local.get $2 + i32.const 23 + i32.lt_u + if (result i32) + local.get $3 + i32.const 16 + i32.lt_u + else + i32.const 0 + end + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 338 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $5 + local.get $2 + local.set $4 + local.get $5 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + i32.const 0 + i32.const -1 + i32.xor + local.get $3 + i32.shl + i32.and + local.set $6 + i32.const 0 + local.set $7 + local.get $6 + i32.eqz + if + local.get $0 + i32.load + i32.const 0 + i32.const -1 + i32.xor + local.get $2 + i32.const 1 + i32.add + i32.shl + i32.and + local.set $5 + local.get $5 + i32.eqz + if + i32.const 0 + local.set $7 + else + local.get $5 + i32.ctz + local.set $2 + local.get $0 + local.set $8 + local.get $2 + local.set $4 + local.get $8 + local.get $4 + i32.const 2 + i32.shl + i32.add + i32.load offset=4 + local.set $6 + i32.const 1 + drop + local.get $6 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 351 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + else + local.get $0 + local.set $9 + local.get $2 + local.set $8 + local.get $6 + i32.ctz + local.set $4 + local.get $9 + local.get $8 + i32.const 4 + i32.shl + local.get $4 + i32.add + i32.const 2 + i32.shl + i32.add + i32.load offset=96 + local.set $7 + end + local.get $7 + ) + (func $~lib/rt/tlsf/growMemory (param $0 i32) (param $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + i32.const 0 + drop + local.get $1 + i32.const 536870904 + i32.lt_u + if + local.get $1 + i32.const 1 + i32.const 27 + local.get $1 + i32.clz + i32.sub + i32.shl + i32.const 1 + i32.sub + i32.add + local.set $1 + end + memory.size + local.set $2 + local.get $1 + i32.const 16 + local.get $2 + i32.const 16 + i32.shl + i32.const 16 + i32.sub + local.get $0 + local.set $3 + local.get $3 + i32.load offset=1568 + i32.ne + i32.shl + i32.add + local.set $1 + local.get $1 + i32.const 65535 + i32.add + i32.const 65535 + i32.const -1 + i32.xor + i32.and + i32.const 16 + i32.shr_u + local.set $4 + local.get $2 + local.tee $3 + local.get $4 + local.tee $5 + local.get $3 + local.get $5 + i32.gt_s + select + local.set $6 + local.get $6 + memory.grow + i32.const 0 + i32.lt_s + if + local.get $4 + memory.grow + i32.const 0 + i32.lt_s + if + unreachable + end + end + memory.size + local.set $7 + local.get $0 + local.get $2 + i32.const 16 + i32.shl + local.get $7 + i32.const 16 + i32.shl + call $~lib/rt/tlsf/addMemory + drop + ) + (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + local.get $1 + i32.load + local.set $3 + i32.const 1 + drop + local.get $2 + i32.const 15 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 365 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $3 + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.sub + local.set $4 + local.get $4 + i32.const 16 + i32.const 16 + i32.add + i32.ge_u + if + local.get $1 + local.get $2 + local.get $3 + i32.const 2 + i32.and + i32.or + i32.store + local.get $1 + i32.const 16 + i32.add + local.get $2 + i32.add + local.set $5 + local.get $5 + local.get $4 + i32.const 16 + i32.sub + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $5 + call $~lib/rt/tlsf/insertBlock + else + local.get $1 + local.get $3 + i32.const 1 + i32.const -1 + i32.xor + i32.and + i32.store + local.get $1 + local.set $5 + local.get $5 + i32.const 16 + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + local.get $1 + local.set $5 + local.get $5 + i32.const 16 + i32.add + local.get $5 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + i32.add + i32.load + i32.const 2 + i32.const -1 + i32.xor + i32.and + i32.store + end + ) + (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (local $3 i32) + (local $4 i32) + i32.const 1 + drop + global.get $~lib/rt/tlsf/collectLock + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 500 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $1 + call $~lib/rt/tlsf/prepareSize + local.set $3 + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + global.get $~lib/gc/gc.auto + if + i32.const 1 + drop + i32.const 1 + global.set $~lib/rt/tlsf/collectLock + call $~lib/rt/pure/__collect + i32.const 1 + drop + i32.const 0 + global.set $~lib/rt/tlsf/collectLock + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + local.get $4 + i32.eqz + if + local.get $0 + local.get $3 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + i32.const 1 + drop + local.get $4 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 512 + i32.const 20 + call $~lib/builtins/abort + unreachable + end + end + else + local.get $0 + local.get $3 + call $~lib/rt/tlsf/growMemory + local.get $0 + local.get $3 + call $~lib/rt/tlsf/searchBlock + local.set $4 + i32.const 1 + drop + local.get $4 + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 517 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + end + end + i32.const 1 + drop + local.get $4 + i32.load + i32.const 3 + i32.const -1 + i32.xor + i32.and + local.get $3 + i32.ge_u + i32.eqz + if + i32.const 0 + i32.const 32 + i32.const 520 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $4 + i32.const 0 + i32.store offset=4 + local.get $4 + local.get $2 + i32.store offset=8 + local.get $4 + local.get $1 + i32.store offset=12 + local.get $0 + local.get $4 + call $~lib/rt/tlsf/removeBlock + local.get $0 + local.get $4 + local.get $3 + call $~lib/rt/tlsf/prepareBlock + i32.const 0 + drop + local.get $4 + ) + (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) + call $~lib/rt/tlsf/maybeInitialize + local.get $0 + local.get $1 + call $~lib/rt/tlsf/allocateBlock + i32.const 16 + i32.add + ) + (func $~lib/rt/pure/increment (param $0 i32) + (local $1 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $1 + i32.const 1 + i32.add + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + i32.eq + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 109 + i32.const 3 + call $~lib/builtins/abort + unreachable + end + local.get $0 + local.get $1 + i32.const 1 + i32.add + i32.store offset=4 + i32.const 0 + drop + i32.const 1 + drop + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 112 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + ) + (func $~lib/rt/pure/__retain (param $0 i32) (result i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/increment + end + local.get $0 + ) + (func $~lib/rt/pure/__release (param $0 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.gt_u + if + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + end + ) + (func $start:assembly/index + i32.const 1 + i32.const 1 + i32.eq + drop + i32.const 2 + i32.const 2 + i32.eq + drop + i32.const 3 + i32.const 3 + i32.eq + drop + ) + (func $~start + global.get $~started + if + return + else + i32.const 1 + global.set $~started + end + call $start:assembly/index + ) + (func $~lib/rt/pure/__collect + i32.const 1 + drop + return + ) + (func $~lib/rt/tlsf/freeBlock (param $0 i32) (param $1 i32) + (local $2 i32) + local.get $1 + i32.load + local.set $2 + local.get $1 + local.get $2 + i32.const 1 + i32.or + i32.store + local.get $0 + local.get $1 + call $~lib/rt/tlsf/insertBlock + i32.const 0 + drop + ) + (func $~lib/rt/pure/finalize (param $0 i32) + i32.const 0 + drop + global.get $~lib/rt/tlsf/ROOT + local.get $0 + call $~lib/rt/tlsf/freeBlock + ) + (func $~lib/rt/pure/decrement (param $0 i32) + (local $1 i32) + (local $2 i32) + local.get $0 + i32.load offset=4 + local.set $1 + local.get $1 + i32.const 268435455 + i32.and + local.set $2 + i32.const 0 + drop + i32.const 1 + drop + local.get $0 + i32.load + i32.const 1 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 122 + i32.const 14 + call $~lib/builtins/abort + unreachable + end + local.get $2 + i32.const 1 + i32.eq + if + local.get $0 + i32.const 16 + i32.add + i32.const 1 + call $~lib/rt/__visit_members + i32.const 1 + drop + i32.const 1 + drop + local.get $1 + i32.const -2147483648 + i32.and + i32.eqz + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 126 + i32.const 18 + call $~lib/builtins/abort + unreachable + end + local.get $0 + call $~lib/rt/pure/finalize + else + i32.const 1 + drop + local.get $2 + i32.const 0 + i32.gt_u + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 136 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + i32.const 1 + drop + local.get $0 + local.get $1 + i32.const 268435455 + i32.const -1 + i32.xor + i32.and + local.get $2 + i32.const 1 + i32.sub + i32.or + i32.store offset=4 + end + ) + (func $~lib/rt/pure/__visit (param $0 i32) (param $1 i32) + local.get $0 + global.get $~lib/heap/__heap_base + i32.lt_u + if + return + end + i32.const 1 + drop + i32.const 1 + drop + local.get $1 + i32.const 1 + i32.eq + i32.eqz + if + i32.const 0 + i32.const 144 + i32.const 69 + i32.const 16 + call $~lib/builtins/abort + unreachable + end + local.get $0 + i32.const 16 + i32.sub + call $~lib/rt/pure/decrement + ) + (func $~lib/rt/__visit_members (param $0 i32) (param $1 i32) + (local $2 i32) + block $switch$1$default + block $switch$1$case$4 + block $switch$1$case$2 + local.get $0 + i32.const 8 + i32.sub + i32.load + br_table $switch$1$case$2 $switch$1$case$2 $switch$1$case$4 $switch$1$default + end + return + end + local.get $0 + i32.load + local.tee $2 + if + local.get $2 + local.get $1 + call $~lib/rt/pure/__visit + end + return + end + unreachable + ) +) From a77826c8f4922d7f55cad9e8b7f914cda8d0f02b Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Mon, 13 Jul 2020 14:12:33 -0400 Subject: [PATCH 35/58] remove complicated test --- cli/asc.js | 3 --- tests/asconfig/index.js | 30 +++++++----------------------- tests/asconfig/package.json | 5 ++--- 3 files changed, 9 insertions(+), 29 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index 57445c819f..2d75e0da1f 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -333,9 +333,6 @@ exports.main = function main(argv, options, callback) { } } - exports.args = args; - exports.argv = argv; - // This method resolves a path relative to the baseDir instead of process.cwd() function resolve(arg) { if (path.isAbsolute(arg)) return arg; diff --git a/tests/asconfig/index.js b/tests/asconfig/index.js index 872b023526..a6549cb5ca 100644 --- a/tests/asconfig/index.js +++ b/tests/asconfig/index.js @@ -8,7 +8,7 @@ const path = require("path"); let binary; /** @type {Uint8Array} */ let wat; -asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--textFile", "output.wat", "--explicitStart", ...args], { +asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--explicitStart", ...args], { writeFile(name, contents) { if (name === "output.wasm") { binary = contents; @@ -28,29 +28,13 @@ asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--textFile", "output process.exit(1); } - if (!wat) { - console.error("No watFile was generated for the asconfig test in " + process.cwd()); - process.exit(1); - } - - const optionsPath = path.join(process.cwd(), "options.json"); - if (fs.existsSync(optionsPath)) { - const options = require(optionsPath); - for (const option of Object.getOwnPropertyNames(options) ){ - if (options[option] != asc.args[option]) { - throw new Error(`Test ${path.basename(process.cwd())}: ${options[option]} != ${asc.args[option]}`); - } - } - } - - const watPath = path.join(process.cwd(), "output.wat"); - if (fs.existsSync(watPath)) { + const theModule = loader.instantiateSync(binary); - } else { - fs.writeFileSync(watPath, wat); + try { + theModule.exports._start(); + } catch (err) { + console.error("The wasm module _start() function failed in " + process.cwd()); + process.exit(1); } - const theResult = loader.instantiateSync(binary); - - theResult.exports._start(); return 0; }); diff --git a/tests/asconfig/package.json b/tests/asconfig/package.json index dc501bc6a2..4a366aeed2 100644 --- a/tests/asconfig/package.json +++ b/tests/asconfig/package.json @@ -1,13 +1,12 @@ { "private": true, "scripts": { - "test": "npm run test:use-consts && npm run test:target && npm run test:entry-points && npm run test:flags && npm run test:complicated", + "test": "npm run test:use-consts && npm run test:target && npm run test:entry-points && npm run test:flags", "test:use-consts": "cd use-consts && npm run test", "test:entry-points": "cd entry-points && npm run test", - "test:flags": "cd flags && npm run test", + "test:flags": "cd flags && nWpm run test", "test:respect-inheritence": "cd respect-inheritence && npm run test", "test:target": "cd target && npm run test", - "test:complicated": "cd complicated && npm run test", "test:cyclical": "cd cyclical && npm run test" } } From 7c4e5cf81b7b2feeb8aec62a0f3f0707b7530e9c Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Mon, 13 Jul 2020 14:14:11 -0400 Subject: [PATCH 36/58] remove options test matching, why export argv/args --- tests/asconfig/entry-points/nested/output.wat | 1716 ---------------- tests/asconfig/entry-points/output.wat | 1716 ---------------- tests/asconfig/flags/nested/options.json | 3 - tests/asconfig/flags/nested/output.wat | 1701 ---------------- tests/asconfig/flags/options.json | 3 - tests/asconfig/flags/output.wat | 1701 ---------------- tests/asconfig/target/output.wat | 1207 ------------ tests/asconfig/use-consts/output.wat | 1726 ----------------- 8 files changed, 9773 deletions(-) delete mode 100644 tests/asconfig/entry-points/nested/output.wat delete mode 100644 tests/asconfig/entry-points/output.wat delete mode 100644 tests/asconfig/flags/nested/options.json delete mode 100644 tests/asconfig/flags/nested/output.wat delete mode 100644 tests/asconfig/flags/options.json delete mode 100644 tests/asconfig/flags/output.wat delete mode 100644 tests/asconfig/target/output.wat delete mode 100644 tests/asconfig/use-consts/output.wat diff --git a/tests/asconfig/entry-points/nested/output.wat b/tests/asconfig/entry-points/nested/output.wat deleted file mode 100644 index 0e4e245e13..0000000000 --- a/tests/asconfig/entry-points/nested/output.wat +++ /dev/null @@ -1,1716 +0,0 @@ -(module - (type $i32_i32_=>_none (func (param i32 i32))) - (type $i32_=>_none (func (param i32))) - (type $none_=>_none (func)) - (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) - (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) - (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) - (type $none_=>_i32 (func (result i32))) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (memory $0 1) - (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") - (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") - (data (i32.const 128) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") - (data (i32.const 176) "\03\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00") - (table $0 1 funcref) - (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) - (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) - (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) - (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) - (global $../assembly/globals/answerToLife i32 (i32.const 42)) - (global $~started (mut i32) (i32.const 0)) - (global $~lib/rt/__rtti_base i32 (i32.const 176)) - (global $~lib/heap/__heap_base i32 (i32.const 204)) - (export "_start" (func $~start)) - (export "memory" (memory $0)) - (export "__alloc" (func $~lib/rt/tlsf/__alloc)) - (export "__retain" (func $~lib/rt/pure/__retain)) - (export "__release" (func $~lib/rt/pure/__release)) - (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__rtti_base" (global $~lib/rt/__rtti_base)) - (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - local.get $1 - i32.load - local.set $2 - i32.const 1 - drop - local.get $2 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 277 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.set $3 - i32.const 1 - drop - local.get $3 - i32.const 16 - i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741808 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 279 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 256 - i32.lt_u - if - i32.const 0 - local.set $4 - local.get $3 - i32.const 4 - i32.shr_u - local.set $5 - else - i32.const 31 - local.get $3 - i32.clz - i32.sub - local.set $4 - local.get $3 - local.get $4 - i32.const 4 - i32.sub - i32.shr_u - i32.const 1 - i32.const 4 - i32.shl - i32.xor - local.set $5 - local.get $4 - i32.const 8 - i32.const 1 - i32.sub - i32.sub - local.set $4 - end - i32.const 1 - drop - local.get $4 - i32.const 23 - i32.lt_u - if (result i32) - local.get $5 - i32.const 16 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 292 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.load offset=16 - local.set $6 - local.get $1 - i32.load offset=20 - local.set $7 - local.get $6 - if - local.get $6 - local.get $7 - i32.store offset=20 - end - local.get $7 - if - local.get $7 - local.get $6 - i32.store offset=16 - end - local.get $1 - local.get $0 - local.set $10 - local.get $4 - local.set $9 - local.get $5 - local.set $8 - local.get $10 - local.get $9 - i32.const 4 - i32.shl - local.get $8 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - i32.eq - if - local.get $0 - local.set $11 - local.get $4 - local.set $10 - local.get $5 - local.set $9 - local.get $7 - local.set $8 - local.get $11 - local.get $10 - i32.const 4 - i32.shl - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.add - local.get $8 - i32.store offset=96 - local.get $7 - i32.eqz - if - local.get $0 - local.set $9 - local.get $4 - local.set $8 - local.get $9 - local.get $8 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - local.set $9 - local.get $0 - local.set $8 - local.get $4 - local.set $11 - local.get $9 - i32.const 1 - local.get $5 - i32.shl - i32.const -1 - i32.xor - i32.and - local.tee $9 - local.set $10 - local.get $8 - local.get $11 - i32.const 2 - i32.shl - i32.add - local.get $10 - i32.store offset=4 - local.get $9 - i32.eqz - if - local.get $0 - local.get $0 - i32.load - i32.const 1 - local.get $4 - i32.shl - i32.const -1 - i32.xor - i32.and - i32.store - end - end - end - ) - (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - (local $12 i32) - (local $13 i32) - i32.const 1 - drop - local.get $1 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 205 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.load - local.set $2 - i32.const 1 - drop - local.get $2 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 207 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - local.set $3 - local.get $3 - i32.const 16 - i32.add - local.get $3 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - local.get $5 - i32.const 1 - i32.and - if - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.add - local.get $5 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $3 - local.get $3 - i32.const 1073741808 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - i32.store - local.get $1 - local.set $6 - local.get $6 - i32.const 16 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end - end - local.get $2 - i32.const 2 - i32.and - if - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.sub - i32.load - local.set $6 - local.get $6 - i32.load - local.set $3 - i32.const 1 - drop - local.get $3 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 228 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.add - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $7 - local.get $7 - i32.const 1073741808 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - i32.store - local.get $6 - local.set $1 - end - end - local.get $4 - local.get $5 - i32.const 2 - i32.or - i32.store - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.set $8 - i32.const 1 - drop - local.get $8 - i32.const 16 - i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741808 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 243 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - drop - local.get $1 - i32.const 16 - i32.add - local.get $8 - i32.add - local.get $4 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 244 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $4 - i32.const 4 - i32.sub - local.get $1 - i32.store - local.get $8 - i32.const 256 - i32.lt_u - if - i32.const 0 - local.set $9 - local.get $8 - i32.const 4 - i32.shr_u - local.set $10 - else - i32.const 31 - local.get $8 - i32.clz - i32.sub - local.set $9 - local.get $8 - local.get $9 - i32.const 4 - i32.sub - i32.shr_u - i32.const 1 - i32.const 4 - i32.shl - i32.xor - local.set $10 - local.get $9 - i32.const 8 - i32.const 1 - i32.sub - i32.sub - local.set $9 - end - i32.const 1 - drop - local.get $9 - i32.const 23 - i32.lt_u - if (result i32) - local.get $10 - i32.const 16 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 260 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $7 - local.get $9 - local.set $3 - local.get $10 - local.set $6 - local.get $7 - local.get $3 - i32.const 4 - i32.shl - local.get $6 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $11 - local.get $1 - i32.const 0 - i32.store offset=16 - local.get $1 - local.get $11 - i32.store offset=20 - local.get $11 - if - local.get $11 - local.get $1 - i32.store offset=16 - end - local.get $0 - local.set $12 - local.get $9 - local.set $7 - local.get $10 - local.set $3 - local.get $1 - local.set $6 - local.get $12 - local.get $7 - i32.const 4 - i32.shl - local.get $3 - i32.add - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store offset=96 - local.get $0 - local.get $0 - i32.load - i32.const 1 - local.get $9 - i32.shl - i32.or - i32.store - local.get $0 - local.set $13 - local.get $9 - local.set $12 - local.get $0 - local.set $3 - local.get $9 - local.set $6 - local.get $3 - local.get $6 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - i32.const 1 - local.get $10 - i32.shl - i32.or - local.set $7 - local.get $13 - local.get $12 - i32.const 2 - i32.shl - i32.add - local.get $7 - i32.store offset=4 - ) - (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - i32.const 1 - drop - local.get $1 - local.get $2 - i32.le_u - if (result i32) - local.get $1 - i32.const 15 - i32.and - i32.eqz - else - i32.const 0 - end - if (result i32) - local.get $2 - i32.const 15 - i32.and - i32.eqz - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 386 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $3 - local.get $3 - i32.load offset=1568 - local.set $4 - i32.const 0 - local.set $5 - local.get $4 - if - i32.const 1 - drop - local.get $1 - local.get $4 - i32.const 16 - i32.add - i32.ge_u - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 396 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.const 16 - i32.sub - local.get $4 - i32.eq - if - local.get $1 - i32.const 16 - i32.sub - local.set $1 - local.get $4 - i32.load - local.set $5 - else - nop - end - else - i32.const 1 - drop - local.get $1 - local.get $0 - i32.const 1572 - i32.add - i32.ge_u - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 408 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - end - local.get $2 - local.get $1 - i32.sub - local.set $6 - local.get $6 - i32.const 16 - i32.const 16 - i32.add - i32.const 16 - i32.add - i32.lt_u - if - i32.const 0 - return - end - local.get $6 - i32.const 16 - i32.const 1 - i32.shl - i32.sub - local.set $7 - local.get $1 - local.set $8 - local.get $8 - local.get $7 - i32.const 1 - i32.or - local.get $5 - i32.const 2 - i32.and - i32.or - i32.store - local.get $8 - i32.const 0 - i32.store offset=16 - local.get $8 - i32.const 0 - i32.store offset=20 - local.get $1 - local.get $6 - i32.add - i32.const 16 - i32.sub - local.set $4 - local.get $4 - i32.const 0 - i32.const 2 - i32.or - i32.store - local.get $0 - local.set $9 - local.get $4 - local.set $3 - local.get $9 - local.get $3 - i32.store offset=1568 - local.get $0 - local.get $8 - call $~lib/rt/tlsf/insertBlock - i32.const 1 - ) - (func $~lib/rt/tlsf/maybeInitialize (result i32) - (local $0 i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - global.get $~lib/rt/tlsf/ROOT - local.set $0 - local.get $0 - i32.eqz - if - global.get $~lib/heap/__heap_base - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.set $1 - memory.size - local.set $2 - local.get $1 - i32.const 1572 - i32.add - i32.const 65535 - i32.add - i32.const 65535 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.shr_u - local.set $3 - local.get $3 - local.get $2 - i32.gt_s - if (result i32) - local.get $3 - local.get $2 - i32.sub - memory.grow - i32.const 0 - i32.lt_s - else - i32.const 0 - end - if - unreachable - end - local.get $1 - local.set $0 - local.get $0 - i32.const 0 - i32.store - local.get $0 - local.set $5 - i32.const 0 - local.set $4 - local.get $5 - local.get $4 - i32.store offset=1568 - i32.const 0 - local.set $5 - loop $for-loop|0 - local.get $5 - i32.const 23 - i32.lt_u - local.set $4 - local.get $4 - if - local.get $0 - local.set $8 - local.get $5 - local.set $7 - i32.const 0 - local.set $6 - local.get $8 - local.get $7 - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store offset=4 - i32.const 0 - local.set $8 - loop $for-loop|1 - local.get $8 - i32.const 16 - i32.lt_u - local.set $7 - local.get $7 - if - local.get $0 - local.set $11 - local.get $5 - local.set $10 - local.get $8 - local.set $9 - i32.const 0 - local.set $6 - local.get $11 - local.get $10 - i32.const 4 - i32.shl - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store offset=96 - local.get $8 - i32.const 1 - i32.add - local.set $8 - br $for-loop|1 - end - end - local.get $5 - i32.const 1 - i32.add - local.set $5 - br $for-loop|0 - end - end - local.get $1 - i32.const 1572 - i32.add - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.set $5 - i32.const 0 - drop - local.get $0 - local.get $5 - memory.size - i32.const 16 - i32.shl - call $~lib/rt/tlsf/addMemory - drop - local.get $0 - global.set $~lib/rt/tlsf/ROOT - end - local.get $0 - ) - (func $~lib/rt/tlsf/prepareSize (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - local.get $0 - i32.const 1073741808 - i32.ge_u - if - i32.const 80 - i32.const 32 - i32.const 461 - i32.const 30 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.tee $1 - i32.const 16 - local.tee $2 - local.get $1 - local.get $2 - i32.gt_u - select - ) - (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - local.get $1 - i32.const 256 - i32.lt_u - if - i32.const 0 - local.set $2 - local.get $1 - i32.const 4 - i32.shr_u - local.set $3 - else - local.get $1 - i32.const 536870904 - i32.lt_u - if (result i32) - local.get $1 - i32.const 1 - i32.const 27 - local.get $1 - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $1 - end - local.set $4 - i32.const 31 - local.get $4 - i32.clz - i32.sub - local.set $2 - local.get $4 - local.get $2 - i32.const 4 - i32.sub - i32.shr_u - i32.const 1 - i32.const 4 - i32.shl - i32.xor - local.set $3 - local.get $2 - i32.const 8 - i32.const 1 - i32.sub - i32.sub - local.set $2 - end - i32.const 1 - drop - local.get $2 - i32.const 23 - i32.lt_u - if (result i32) - local.get $3 - i32.const 16 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 338 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $5 - local.get $2 - local.set $4 - local.get $5 - local.get $4 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - i32.const 0 - i32.const -1 - i32.xor - local.get $3 - i32.shl - i32.and - local.set $6 - i32.const 0 - local.set $7 - local.get $6 - i32.eqz - if - local.get $0 - i32.load - i32.const 0 - i32.const -1 - i32.xor - local.get $2 - i32.const 1 - i32.add - i32.shl - i32.and - local.set $5 - local.get $5 - i32.eqz - if - i32.const 0 - local.set $7 - else - local.get $5 - i32.ctz - local.set $2 - local.get $0 - local.set $8 - local.get $2 - local.set $4 - local.get $8 - local.get $4 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - local.set $6 - i32.const 1 - drop - local.get $6 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 351 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $9 - local.get $2 - local.set $8 - local.get $6 - i32.ctz - local.set $4 - local.get $9 - local.get $8 - i32.const 4 - i32.shl - local.get $4 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $7 - end - else - local.get $0 - local.set $9 - local.get $2 - local.set $8 - local.get $6 - i32.ctz - local.set $4 - local.get $9 - local.get $8 - i32.const 4 - i32.shl - local.get $4 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $7 - end - local.get $7 - ) - (func $~lib/rt/tlsf/growMemory (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - i32.const 0 - drop - local.get $1 - i32.const 536870904 - i32.lt_u - if - local.get $1 - i32.const 1 - i32.const 27 - local.get $1 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $1 - end - memory.size - local.set $2 - local.get $1 - i32.const 16 - local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.sub - local.get $0 - local.set $3 - local.get $3 - i32.load offset=1568 - i32.ne - i32.shl - i32.add - local.set $1 - local.get $1 - i32.const 65535 - i32.add - i32.const 65535 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.shr_u - local.set $4 - local.get $2 - local.tee $3 - local.get $4 - local.tee $5 - local.get $3 - local.get $5 - i32.gt_s - select - local.set $6 - local.get $6 - memory.grow - i32.const 0 - i32.lt_s - if - local.get $4 - memory.grow - i32.const 0 - i32.lt_s - if - unreachable - end - end - memory.size - local.set $7 - local.get $0 - local.get $2 - i32.const 16 - i32.shl - local.get $7 - i32.const 16 - i32.shl - call $~lib/rt/tlsf/addMemory - drop - ) - (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - local.get $1 - i32.load - local.set $3 - i32.const 1 - drop - local.get $2 - i32.const 15 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 365 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.get $2 - i32.sub - local.set $4 - local.get $4 - i32.const 16 - i32.const 16 - i32.add - i32.ge_u - if - local.get $1 - local.get $2 - local.get $3 - i32.const 2 - i32.and - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.get $2 - i32.add - local.set $5 - local.get $5 - local.get $4 - i32.const 16 - i32.sub - i32.const 1 - i32.or - i32.store - local.get $0 - local.get $5 - call $~lib/rt/tlsf/insertBlock - else - local.get $1 - local.get $3 - i32.const 1 - i32.const -1 - i32.xor - i32.and - i32.store - local.get $1 - local.set $5 - local.get $5 - i32.const 16 - i32.add - local.get $5 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.get $1 - local.set $5 - local.get $5 - i32.const 16 - i32.add - local.get $5 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - i32.load - i32.const 2 - i32.const -1 - i32.xor - i32.and - i32.store - end - ) - (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - (local $4 i32) - i32.const 1 - drop - global.get $~lib/rt/tlsf/collectLock - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 500 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - call $~lib/rt/tlsf/prepareSize - local.set $3 - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - local.get $4 - i32.eqz - if - global.get $~lib/gc/gc.auto - if - i32.const 1 - drop - i32.const 1 - global.set $~lib/rt/tlsf/collectLock - call $~lib/rt/pure/__collect - i32.const 1 - drop - i32.const 0 - global.set $~lib/rt/tlsf/collectLock - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - local.get $4 - i32.eqz - if - local.get $0 - local.get $3 - call $~lib/rt/tlsf/growMemory - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - i32.const 1 - drop - local.get $4 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 512 - i32.const 20 - call $~lib/builtins/abort - unreachable - end - end - else - local.get $0 - local.get $3 - call $~lib/rt/tlsf/growMemory - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - i32.const 1 - drop - local.get $4 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 517 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - end - end - i32.const 1 - drop - local.get $4 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.get $3 - i32.ge_u - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 520 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $4 - i32.const 0 - i32.store offset=4 - local.get $4 - local.get $2 - i32.store offset=8 - local.get $4 - local.get $1 - i32.store offset=12 - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $0 - local.get $4 - local.get $3 - call $~lib/rt/tlsf/prepareBlock - i32.const 0 - drop - local.get $4 - ) - (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) - call $~lib/rt/tlsf/maybeInitialize - local.get $0 - local.get $1 - call $~lib/rt/tlsf/allocateBlock - i32.const 16 - i32.add - ) - (func $~lib/rt/pure/increment (param $0 i32) - (local $1 i32) - local.get $0 - i32.load offset=4 - local.set $1 - local.get $1 - i32.const 268435455 - i32.const -1 - i32.xor - i32.and - local.get $1 - i32.const 1 - i32.add - i32.const 268435455 - i32.const -1 - i32.xor - i32.and - i32.eq - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 109 - i32.const 3 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=4 - i32.const 0 - drop - i32.const 1 - drop - local.get $0 - i32.load - i32.const 1 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 112 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - ) - (func $~lib/rt/pure/__retain (param $0 i32) (result i32) - local.get $0 - global.get $~lib/heap/__heap_base - i32.gt_u - if - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/increment - end - local.get $0 - ) - (func $~lib/rt/pure/__release (param $0 i32) - local.get $0 - global.get $~lib/heap/__heap_base - i32.gt_u - if - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/decrement - end - ) - (func $start:assembly/index - global.get $../assembly/globals/answerToLife - i32.const 42 - i32.eq - drop - ) - (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end - call $start:assembly/index - ) - (func $~lib/rt/pure/__collect - i32.const 1 - drop - return - ) - (func $~lib/rt/tlsf/freeBlock (param $0 i32) (param $1 i32) - (local $2 i32) - local.get $1 - i32.load - local.set $2 - local.get $1 - local.get $2 - i32.const 1 - i32.or - i32.store - local.get $0 - local.get $1 - call $~lib/rt/tlsf/insertBlock - i32.const 0 - drop - ) - (func $~lib/rt/pure/finalize (param $0 i32) - i32.const 0 - drop - global.get $~lib/rt/tlsf/ROOT - local.get $0 - call $~lib/rt/tlsf/freeBlock - ) - (func $~lib/rt/pure/decrement (param $0 i32) - (local $1 i32) - (local $2 i32) - local.get $0 - i32.load offset=4 - local.set $1 - local.get $1 - i32.const 268435455 - i32.and - local.set $2 - i32.const 0 - drop - i32.const 1 - drop - local.get $0 - i32.load - i32.const 1 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 122 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $2 - i32.const 1 - i32.eq - if - local.get $0 - i32.const 16 - i32.add - i32.const 1 - call $~lib/rt/__visit_members - i32.const 1 - drop - i32.const 1 - drop - local.get $1 - i32.const -2147483648 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 126 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - local.get $0 - call $~lib/rt/pure/finalize - else - i32.const 1 - drop - local.get $2 - i32.const 0 - i32.gt_u - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 136 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - drop - local.get $0 - local.get $1 - i32.const 268435455 - i32.const -1 - i32.xor - i32.and - local.get $2 - i32.const 1 - i32.sub - i32.or - i32.store offset=4 - end - ) - (func $~lib/rt/pure/__visit (param $0 i32) (param $1 i32) - local.get $0 - global.get $~lib/heap/__heap_base - i32.lt_u - if - return - end - i32.const 1 - drop - i32.const 1 - drop - local.get $1 - i32.const 1 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 69 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/decrement - ) - (func $~lib/rt/__visit_members (param $0 i32) (param $1 i32) - (local $2 i32) - block $switch$1$default - block $switch$1$case$4 - block $switch$1$case$2 - local.get $0 - i32.const 8 - i32.sub - i32.load - br_table $switch$1$case$2 $switch$1$case$2 $switch$1$case$4 $switch$1$default - end - return - end - local.get $0 - i32.load - local.tee $2 - if - local.get $2 - local.get $1 - call $~lib/rt/pure/__visit - end - return - end - unreachable - ) -) diff --git a/tests/asconfig/entry-points/output.wat b/tests/asconfig/entry-points/output.wat deleted file mode 100644 index 5ed78dc975..0000000000 --- a/tests/asconfig/entry-points/output.wat +++ /dev/null @@ -1,1716 +0,0 @@ -(module - (type $i32_i32_=>_none (func (param i32 i32))) - (type $i32_=>_none (func (param i32))) - (type $none_=>_none (func)) - (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) - (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) - (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) - (type $none_=>_i32 (func (result i32))) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (memory $0 1) - (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") - (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") - (data (i32.const 128) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") - (data (i32.const 176) "\03\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00") - (table $0 1 funcref) - (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) - (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) - (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) - (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) - (global $assembly/globals/answerToLife i32 (i32.const 42)) - (global $~started (mut i32) (i32.const 0)) - (global $~lib/rt/__rtti_base i32 (i32.const 176)) - (global $~lib/heap/__heap_base i32 (i32.const 204)) - (export "_start" (func $~start)) - (export "memory" (memory $0)) - (export "__alloc" (func $~lib/rt/tlsf/__alloc)) - (export "__retain" (func $~lib/rt/pure/__retain)) - (export "__release" (func $~lib/rt/pure/__release)) - (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__rtti_base" (global $~lib/rt/__rtti_base)) - (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - local.get $1 - i32.load - local.set $2 - i32.const 1 - drop - local.get $2 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 277 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.set $3 - i32.const 1 - drop - local.get $3 - i32.const 16 - i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741808 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 279 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 256 - i32.lt_u - if - i32.const 0 - local.set $4 - local.get $3 - i32.const 4 - i32.shr_u - local.set $5 - else - i32.const 31 - local.get $3 - i32.clz - i32.sub - local.set $4 - local.get $3 - local.get $4 - i32.const 4 - i32.sub - i32.shr_u - i32.const 1 - i32.const 4 - i32.shl - i32.xor - local.set $5 - local.get $4 - i32.const 8 - i32.const 1 - i32.sub - i32.sub - local.set $4 - end - i32.const 1 - drop - local.get $4 - i32.const 23 - i32.lt_u - if (result i32) - local.get $5 - i32.const 16 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 292 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.load offset=16 - local.set $6 - local.get $1 - i32.load offset=20 - local.set $7 - local.get $6 - if - local.get $6 - local.get $7 - i32.store offset=20 - end - local.get $7 - if - local.get $7 - local.get $6 - i32.store offset=16 - end - local.get $1 - local.get $0 - local.set $10 - local.get $4 - local.set $9 - local.get $5 - local.set $8 - local.get $10 - local.get $9 - i32.const 4 - i32.shl - local.get $8 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - i32.eq - if - local.get $0 - local.set $11 - local.get $4 - local.set $10 - local.get $5 - local.set $9 - local.get $7 - local.set $8 - local.get $11 - local.get $10 - i32.const 4 - i32.shl - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.add - local.get $8 - i32.store offset=96 - local.get $7 - i32.eqz - if - local.get $0 - local.set $9 - local.get $4 - local.set $8 - local.get $9 - local.get $8 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - local.set $9 - local.get $0 - local.set $8 - local.get $4 - local.set $11 - local.get $9 - i32.const 1 - local.get $5 - i32.shl - i32.const -1 - i32.xor - i32.and - local.tee $9 - local.set $10 - local.get $8 - local.get $11 - i32.const 2 - i32.shl - i32.add - local.get $10 - i32.store offset=4 - local.get $9 - i32.eqz - if - local.get $0 - local.get $0 - i32.load - i32.const 1 - local.get $4 - i32.shl - i32.const -1 - i32.xor - i32.and - i32.store - end - end - end - ) - (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - (local $12 i32) - (local $13 i32) - i32.const 1 - drop - local.get $1 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 205 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.load - local.set $2 - i32.const 1 - drop - local.get $2 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 207 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - local.set $3 - local.get $3 - i32.const 16 - i32.add - local.get $3 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - local.get $5 - i32.const 1 - i32.and - if - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.add - local.get $5 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $3 - local.get $3 - i32.const 1073741808 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - i32.store - local.get $1 - local.set $6 - local.get $6 - i32.const 16 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end - end - local.get $2 - i32.const 2 - i32.and - if - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.sub - i32.load - local.set $6 - local.get $6 - i32.load - local.set $3 - i32.const 1 - drop - local.get $3 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 228 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.add - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $7 - local.get $7 - i32.const 1073741808 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - i32.store - local.get $6 - local.set $1 - end - end - local.get $4 - local.get $5 - i32.const 2 - i32.or - i32.store - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.set $8 - i32.const 1 - drop - local.get $8 - i32.const 16 - i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741808 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 243 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - drop - local.get $1 - i32.const 16 - i32.add - local.get $8 - i32.add - local.get $4 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 244 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $4 - i32.const 4 - i32.sub - local.get $1 - i32.store - local.get $8 - i32.const 256 - i32.lt_u - if - i32.const 0 - local.set $9 - local.get $8 - i32.const 4 - i32.shr_u - local.set $10 - else - i32.const 31 - local.get $8 - i32.clz - i32.sub - local.set $9 - local.get $8 - local.get $9 - i32.const 4 - i32.sub - i32.shr_u - i32.const 1 - i32.const 4 - i32.shl - i32.xor - local.set $10 - local.get $9 - i32.const 8 - i32.const 1 - i32.sub - i32.sub - local.set $9 - end - i32.const 1 - drop - local.get $9 - i32.const 23 - i32.lt_u - if (result i32) - local.get $10 - i32.const 16 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 260 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $7 - local.get $9 - local.set $3 - local.get $10 - local.set $6 - local.get $7 - local.get $3 - i32.const 4 - i32.shl - local.get $6 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $11 - local.get $1 - i32.const 0 - i32.store offset=16 - local.get $1 - local.get $11 - i32.store offset=20 - local.get $11 - if - local.get $11 - local.get $1 - i32.store offset=16 - end - local.get $0 - local.set $12 - local.get $9 - local.set $7 - local.get $10 - local.set $3 - local.get $1 - local.set $6 - local.get $12 - local.get $7 - i32.const 4 - i32.shl - local.get $3 - i32.add - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store offset=96 - local.get $0 - local.get $0 - i32.load - i32.const 1 - local.get $9 - i32.shl - i32.or - i32.store - local.get $0 - local.set $13 - local.get $9 - local.set $12 - local.get $0 - local.set $3 - local.get $9 - local.set $6 - local.get $3 - local.get $6 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - i32.const 1 - local.get $10 - i32.shl - i32.or - local.set $7 - local.get $13 - local.get $12 - i32.const 2 - i32.shl - i32.add - local.get $7 - i32.store offset=4 - ) - (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - i32.const 1 - drop - local.get $1 - local.get $2 - i32.le_u - if (result i32) - local.get $1 - i32.const 15 - i32.and - i32.eqz - else - i32.const 0 - end - if (result i32) - local.get $2 - i32.const 15 - i32.and - i32.eqz - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 386 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $3 - local.get $3 - i32.load offset=1568 - local.set $4 - i32.const 0 - local.set $5 - local.get $4 - if - i32.const 1 - drop - local.get $1 - local.get $4 - i32.const 16 - i32.add - i32.ge_u - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 396 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.const 16 - i32.sub - local.get $4 - i32.eq - if - local.get $1 - i32.const 16 - i32.sub - local.set $1 - local.get $4 - i32.load - local.set $5 - else - nop - end - else - i32.const 1 - drop - local.get $1 - local.get $0 - i32.const 1572 - i32.add - i32.ge_u - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 408 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - end - local.get $2 - local.get $1 - i32.sub - local.set $6 - local.get $6 - i32.const 16 - i32.const 16 - i32.add - i32.const 16 - i32.add - i32.lt_u - if - i32.const 0 - return - end - local.get $6 - i32.const 16 - i32.const 1 - i32.shl - i32.sub - local.set $7 - local.get $1 - local.set $8 - local.get $8 - local.get $7 - i32.const 1 - i32.or - local.get $5 - i32.const 2 - i32.and - i32.or - i32.store - local.get $8 - i32.const 0 - i32.store offset=16 - local.get $8 - i32.const 0 - i32.store offset=20 - local.get $1 - local.get $6 - i32.add - i32.const 16 - i32.sub - local.set $4 - local.get $4 - i32.const 0 - i32.const 2 - i32.or - i32.store - local.get $0 - local.set $9 - local.get $4 - local.set $3 - local.get $9 - local.get $3 - i32.store offset=1568 - local.get $0 - local.get $8 - call $~lib/rt/tlsf/insertBlock - i32.const 1 - ) - (func $~lib/rt/tlsf/maybeInitialize (result i32) - (local $0 i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - global.get $~lib/rt/tlsf/ROOT - local.set $0 - local.get $0 - i32.eqz - if - global.get $~lib/heap/__heap_base - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.set $1 - memory.size - local.set $2 - local.get $1 - i32.const 1572 - i32.add - i32.const 65535 - i32.add - i32.const 65535 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.shr_u - local.set $3 - local.get $3 - local.get $2 - i32.gt_s - if (result i32) - local.get $3 - local.get $2 - i32.sub - memory.grow - i32.const 0 - i32.lt_s - else - i32.const 0 - end - if - unreachable - end - local.get $1 - local.set $0 - local.get $0 - i32.const 0 - i32.store - local.get $0 - local.set $5 - i32.const 0 - local.set $4 - local.get $5 - local.get $4 - i32.store offset=1568 - i32.const 0 - local.set $5 - loop $for-loop|0 - local.get $5 - i32.const 23 - i32.lt_u - local.set $4 - local.get $4 - if - local.get $0 - local.set $8 - local.get $5 - local.set $7 - i32.const 0 - local.set $6 - local.get $8 - local.get $7 - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store offset=4 - i32.const 0 - local.set $8 - loop $for-loop|1 - local.get $8 - i32.const 16 - i32.lt_u - local.set $7 - local.get $7 - if - local.get $0 - local.set $11 - local.get $5 - local.set $10 - local.get $8 - local.set $9 - i32.const 0 - local.set $6 - local.get $11 - local.get $10 - i32.const 4 - i32.shl - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store offset=96 - local.get $8 - i32.const 1 - i32.add - local.set $8 - br $for-loop|1 - end - end - local.get $5 - i32.const 1 - i32.add - local.set $5 - br $for-loop|0 - end - end - local.get $1 - i32.const 1572 - i32.add - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.set $5 - i32.const 0 - drop - local.get $0 - local.get $5 - memory.size - i32.const 16 - i32.shl - call $~lib/rt/tlsf/addMemory - drop - local.get $0 - global.set $~lib/rt/tlsf/ROOT - end - local.get $0 - ) - (func $~lib/rt/tlsf/prepareSize (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - local.get $0 - i32.const 1073741808 - i32.ge_u - if - i32.const 80 - i32.const 32 - i32.const 461 - i32.const 30 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.tee $1 - i32.const 16 - local.tee $2 - local.get $1 - local.get $2 - i32.gt_u - select - ) - (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - local.get $1 - i32.const 256 - i32.lt_u - if - i32.const 0 - local.set $2 - local.get $1 - i32.const 4 - i32.shr_u - local.set $3 - else - local.get $1 - i32.const 536870904 - i32.lt_u - if (result i32) - local.get $1 - i32.const 1 - i32.const 27 - local.get $1 - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $1 - end - local.set $4 - i32.const 31 - local.get $4 - i32.clz - i32.sub - local.set $2 - local.get $4 - local.get $2 - i32.const 4 - i32.sub - i32.shr_u - i32.const 1 - i32.const 4 - i32.shl - i32.xor - local.set $3 - local.get $2 - i32.const 8 - i32.const 1 - i32.sub - i32.sub - local.set $2 - end - i32.const 1 - drop - local.get $2 - i32.const 23 - i32.lt_u - if (result i32) - local.get $3 - i32.const 16 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 338 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $5 - local.get $2 - local.set $4 - local.get $5 - local.get $4 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - i32.const 0 - i32.const -1 - i32.xor - local.get $3 - i32.shl - i32.and - local.set $6 - i32.const 0 - local.set $7 - local.get $6 - i32.eqz - if - local.get $0 - i32.load - i32.const 0 - i32.const -1 - i32.xor - local.get $2 - i32.const 1 - i32.add - i32.shl - i32.and - local.set $5 - local.get $5 - i32.eqz - if - i32.const 0 - local.set $7 - else - local.get $5 - i32.ctz - local.set $2 - local.get $0 - local.set $8 - local.get $2 - local.set $4 - local.get $8 - local.get $4 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - local.set $6 - i32.const 1 - drop - local.get $6 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 351 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $9 - local.get $2 - local.set $8 - local.get $6 - i32.ctz - local.set $4 - local.get $9 - local.get $8 - i32.const 4 - i32.shl - local.get $4 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $7 - end - else - local.get $0 - local.set $9 - local.get $2 - local.set $8 - local.get $6 - i32.ctz - local.set $4 - local.get $9 - local.get $8 - i32.const 4 - i32.shl - local.get $4 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $7 - end - local.get $7 - ) - (func $~lib/rt/tlsf/growMemory (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - i32.const 0 - drop - local.get $1 - i32.const 536870904 - i32.lt_u - if - local.get $1 - i32.const 1 - i32.const 27 - local.get $1 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $1 - end - memory.size - local.set $2 - local.get $1 - i32.const 16 - local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.sub - local.get $0 - local.set $3 - local.get $3 - i32.load offset=1568 - i32.ne - i32.shl - i32.add - local.set $1 - local.get $1 - i32.const 65535 - i32.add - i32.const 65535 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.shr_u - local.set $4 - local.get $2 - local.tee $3 - local.get $4 - local.tee $5 - local.get $3 - local.get $5 - i32.gt_s - select - local.set $6 - local.get $6 - memory.grow - i32.const 0 - i32.lt_s - if - local.get $4 - memory.grow - i32.const 0 - i32.lt_s - if - unreachable - end - end - memory.size - local.set $7 - local.get $0 - local.get $2 - i32.const 16 - i32.shl - local.get $7 - i32.const 16 - i32.shl - call $~lib/rt/tlsf/addMemory - drop - ) - (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - local.get $1 - i32.load - local.set $3 - i32.const 1 - drop - local.get $2 - i32.const 15 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 365 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.get $2 - i32.sub - local.set $4 - local.get $4 - i32.const 16 - i32.const 16 - i32.add - i32.ge_u - if - local.get $1 - local.get $2 - local.get $3 - i32.const 2 - i32.and - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.get $2 - i32.add - local.set $5 - local.get $5 - local.get $4 - i32.const 16 - i32.sub - i32.const 1 - i32.or - i32.store - local.get $0 - local.get $5 - call $~lib/rt/tlsf/insertBlock - else - local.get $1 - local.get $3 - i32.const 1 - i32.const -1 - i32.xor - i32.and - i32.store - local.get $1 - local.set $5 - local.get $5 - i32.const 16 - i32.add - local.get $5 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.get $1 - local.set $5 - local.get $5 - i32.const 16 - i32.add - local.get $5 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - i32.load - i32.const 2 - i32.const -1 - i32.xor - i32.and - i32.store - end - ) - (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - (local $4 i32) - i32.const 1 - drop - global.get $~lib/rt/tlsf/collectLock - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 500 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - call $~lib/rt/tlsf/prepareSize - local.set $3 - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - local.get $4 - i32.eqz - if - global.get $~lib/gc/gc.auto - if - i32.const 1 - drop - i32.const 1 - global.set $~lib/rt/tlsf/collectLock - call $~lib/rt/pure/__collect - i32.const 1 - drop - i32.const 0 - global.set $~lib/rt/tlsf/collectLock - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - local.get $4 - i32.eqz - if - local.get $0 - local.get $3 - call $~lib/rt/tlsf/growMemory - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - i32.const 1 - drop - local.get $4 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 512 - i32.const 20 - call $~lib/builtins/abort - unreachable - end - end - else - local.get $0 - local.get $3 - call $~lib/rt/tlsf/growMemory - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - i32.const 1 - drop - local.get $4 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 517 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - end - end - i32.const 1 - drop - local.get $4 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.get $3 - i32.ge_u - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 520 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $4 - i32.const 0 - i32.store offset=4 - local.get $4 - local.get $2 - i32.store offset=8 - local.get $4 - local.get $1 - i32.store offset=12 - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $0 - local.get $4 - local.get $3 - call $~lib/rt/tlsf/prepareBlock - i32.const 0 - drop - local.get $4 - ) - (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) - call $~lib/rt/tlsf/maybeInitialize - local.get $0 - local.get $1 - call $~lib/rt/tlsf/allocateBlock - i32.const 16 - i32.add - ) - (func $~lib/rt/pure/increment (param $0 i32) - (local $1 i32) - local.get $0 - i32.load offset=4 - local.set $1 - local.get $1 - i32.const 268435455 - i32.const -1 - i32.xor - i32.and - local.get $1 - i32.const 1 - i32.add - i32.const 268435455 - i32.const -1 - i32.xor - i32.and - i32.eq - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 109 - i32.const 3 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=4 - i32.const 0 - drop - i32.const 1 - drop - local.get $0 - i32.load - i32.const 1 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 112 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - ) - (func $~lib/rt/pure/__retain (param $0 i32) (result i32) - local.get $0 - global.get $~lib/heap/__heap_base - i32.gt_u - if - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/increment - end - local.get $0 - ) - (func $~lib/rt/pure/__release (param $0 i32) - local.get $0 - global.get $~lib/heap/__heap_base - i32.gt_u - if - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/decrement - end - ) - (func $start:assembly/index - global.get $assembly/globals/answerToLife - i32.const 42 - i32.eq - drop - ) - (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end - call $start:assembly/index - ) - (func $~lib/rt/pure/__collect - i32.const 1 - drop - return - ) - (func $~lib/rt/tlsf/freeBlock (param $0 i32) (param $1 i32) - (local $2 i32) - local.get $1 - i32.load - local.set $2 - local.get $1 - local.get $2 - i32.const 1 - i32.or - i32.store - local.get $0 - local.get $1 - call $~lib/rt/tlsf/insertBlock - i32.const 0 - drop - ) - (func $~lib/rt/pure/finalize (param $0 i32) - i32.const 0 - drop - global.get $~lib/rt/tlsf/ROOT - local.get $0 - call $~lib/rt/tlsf/freeBlock - ) - (func $~lib/rt/pure/decrement (param $0 i32) - (local $1 i32) - (local $2 i32) - local.get $0 - i32.load offset=4 - local.set $1 - local.get $1 - i32.const 268435455 - i32.and - local.set $2 - i32.const 0 - drop - i32.const 1 - drop - local.get $0 - i32.load - i32.const 1 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 122 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $2 - i32.const 1 - i32.eq - if - local.get $0 - i32.const 16 - i32.add - i32.const 1 - call $~lib/rt/__visit_members - i32.const 1 - drop - i32.const 1 - drop - local.get $1 - i32.const -2147483648 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 126 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - local.get $0 - call $~lib/rt/pure/finalize - else - i32.const 1 - drop - local.get $2 - i32.const 0 - i32.gt_u - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 136 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - drop - local.get $0 - local.get $1 - i32.const 268435455 - i32.const -1 - i32.xor - i32.and - local.get $2 - i32.const 1 - i32.sub - i32.or - i32.store offset=4 - end - ) - (func $~lib/rt/pure/__visit (param $0 i32) (param $1 i32) - local.get $0 - global.get $~lib/heap/__heap_base - i32.lt_u - if - return - end - i32.const 1 - drop - i32.const 1 - drop - local.get $1 - i32.const 1 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 69 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/decrement - ) - (func $~lib/rt/__visit_members (param $0 i32) (param $1 i32) - (local $2 i32) - block $switch$1$default - block $switch$1$case$4 - block $switch$1$case$2 - local.get $0 - i32.const 8 - i32.sub - i32.load - br_table $switch$1$case$2 $switch$1$case$2 $switch$1$case$4 $switch$1$default - end - return - end - local.get $0 - i32.load - local.tee $2 - if - local.get $2 - local.get $1 - call $~lib/rt/pure/__visit - end - return - end - unreachable - ) -) diff --git a/tests/asconfig/flags/nested/options.json b/tests/asconfig/flags/nested/options.json deleted file mode 100644 index 32c639edd1..0000000000 --- a/tests/asconfig/flags/nested/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "debug": true -} \ No newline at end of file diff --git a/tests/asconfig/flags/nested/output.wat b/tests/asconfig/flags/nested/output.wat deleted file mode 100644 index e7be0c0e3f..0000000000 --- a/tests/asconfig/flags/nested/output.wat +++ /dev/null @@ -1,1701 +0,0 @@ -(module - (type $i32_i32_=>_none (func (param i32 i32))) - (type $i32_=>_none (func (param i32))) - (type $none_=>_none (func)) - (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) - (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) - (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) - (type $none_=>_i32 (func (result i32))) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (memory $0 1) - (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") - (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") - (data (i32.const 128) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") - (data (i32.const 176) "\03\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00") - (table $0 1 funcref) - (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) - (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) - (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) - (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) - (global $~lib/rt/__rtti_base i32 (i32.const 176)) - (global $~lib/heap/__heap_base i32 (i32.const 204)) - (export "_start" (func $~start)) - (export "memory" (memory $0)) - (export "__alloc" (func $~lib/rt/tlsf/__alloc)) - (export "__retain" (func $~lib/rt/pure/__retain)) - (export "__release" (func $~lib/rt/pure/__release)) - (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__rtti_base" (global $~lib/rt/__rtti_base)) - (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - local.get $1 - i32.load - local.set $2 - i32.const 1 - drop - local.get $2 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 277 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.set $3 - i32.const 1 - drop - local.get $3 - i32.const 16 - i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741808 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 279 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 256 - i32.lt_u - if - i32.const 0 - local.set $4 - local.get $3 - i32.const 4 - i32.shr_u - local.set $5 - else - i32.const 31 - local.get $3 - i32.clz - i32.sub - local.set $4 - local.get $3 - local.get $4 - i32.const 4 - i32.sub - i32.shr_u - i32.const 1 - i32.const 4 - i32.shl - i32.xor - local.set $5 - local.get $4 - i32.const 8 - i32.const 1 - i32.sub - i32.sub - local.set $4 - end - i32.const 1 - drop - local.get $4 - i32.const 23 - i32.lt_u - if (result i32) - local.get $5 - i32.const 16 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 292 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.load offset=16 - local.set $6 - local.get $1 - i32.load offset=20 - local.set $7 - local.get $6 - if - local.get $6 - local.get $7 - i32.store offset=20 - end - local.get $7 - if - local.get $7 - local.get $6 - i32.store offset=16 - end - local.get $1 - local.get $0 - local.set $10 - local.get $4 - local.set $9 - local.get $5 - local.set $8 - local.get $10 - local.get $9 - i32.const 4 - i32.shl - local.get $8 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - i32.eq - if - local.get $0 - local.set $11 - local.get $4 - local.set $10 - local.get $5 - local.set $9 - local.get $7 - local.set $8 - local.get $11 - local.get $10 - i32.const 4 - i32.shl - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.add - local.get $8 - i32.store offset=96 - local.get $7 - i32.eqz - if - local.get $0 - local.set $9 - local.get $4 - local.set $8 - local.get $9 - local.get $8 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - local.set $9 - local.get $0 - local.set $8 - local.get $4 - local.set $11 - local.get $9 - i32.const 1 - local.get $5 - i32.shl - i32.const -1 - i32.xor - i32.and - local.tee $9 - local.set $10 - local.get $8 - local.get $11 - i32.const 2 - i32.shl - i32.add - local.get $10 - i32.store offset=4 - local.get $9 - i32.eqz - if - local.get $0 - local.get $0 - i32.load - i32.const 1 - local.get $4 - i32.shl - i32.const -1 - i32.xor - i32.and - i32.store - end - end - end - ) - (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - (local $12 i32) - (local $13 i32) - i32.const 1 - drop - local.get $1 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 205 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.load - local.set $2 - i32.const 1 - drop - local.get $2 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 207 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - local.set $3 - local.get $3 - i32.const 16 - i32.add - local.get $3 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - local.get $5 - i32.const 1 - i32.and - if - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.add - local.get $5 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $3 - local.get $3 - i32.const 1073741808 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - i32.store - local.get $1 - local.set $6 - local.get $6 - i32.const 16 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end - end - local.get $2 - i32.const 2 - i32.and - if - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.sub - i32.load - local.set $6 - local.get $6 - i32.load - local.set $3 - i32.const 1 - drop - local.get $3 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 228 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.add - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $7 - local.get $7 - i32.const 1073741808 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - i32.store - local.get $6 - local.set $1 - end - end - local.get $4 - local.get $5 - i32.const 2 - i32.or - i32.store - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.set $8 - i32.const 1 - drop - local.get $8 - i32.const 16 - i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741808 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 243 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - drop - local.get $1 - i32.const 16 - i32.add - local.get $8 - i32.add - local.get $4 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 244 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $4 - i32.const 4 - i32.sub - local.get $1 - i32.store - local.get $8 - i32.const 256 - i32.lt_u - if - i32.const 0 - local.set $9 - local.get $8 - i32.const 4 - i32.shr_u - local.set $10 - else - i32.const 31 - local.get $8 - i32.clz - i32.sub - local.set $9 - local.get $8 - local.get $9 - i32.const 4 - i32.sub - i32.shr_u - i32.const 1 - i32.const 4 - i32.shl - i32.xor - local.set $10 - local.get $9 - i32.const 8 - i32.const 1 - i32.sub - i32.sub - local.set $9 - end - i32.const 1 - drop - local.get $9 - i32.const 23 - i32.lt_u - if (result i32) - local.get $10 - i32.const 16 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 260 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $7 - local.get $9 - local.set $3 - local.get $10 - local.set $6 - local.get $7 - local.get $3 - i32.const 4 - i32.shl - local.get $6 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $11 - local.get $1 - i32.const 0 - i32.store offset=16 - local.get $1 - local.get $11 - i32.store offset=20 - local.get $11 - if - local.get $11 - local.get $1 - i32.store offset=16 - end - local.get $0 - local.set $12 - local.get $9 - local.set $7 - local.get $10 - local.set $3 - local.get $1 - local.set $6 - local.get $12 - local.get $7 - i32.const 4 - i32.shl - local.get $3 - i32.add - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store offset=96 - local.get $0 - local.get $0 - i32.load - i32.const 1 - local.get $9 - i32.shl - i32.or - i32.store - local.get $0 - local.set $13 - local.get $9 - local.set $12 - local.get $0 - local.set $3 - local.get $9 - local.set $6 - local.get $3 - local.get $6 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - i32.const 1 - local.get $10 - i32.shl - i32.or - local.set $7 - local.get $13 - local.get $12 - i32.const 2 - i32.shl - i32.add - local.get $7 - i32.store offset=4 - ) - (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - i32.const 1 - drop - local.get $1 - local.get $2 - i32.le_u - if (result i32) - local.get $1 - i32.const 15 - i32.and - i32.eqz - else - i32.const 0 - end - if (result i32) - local.get $2 - i32.const 15 - i32.and - i32.eqz - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 386 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $3 - local.get $3 - i32.load offset=1568 - local.set $4 - i32.const 0 - local.set $5 - local.get $4 - if - i32.const 1 - drop - local.get $1 - local.get $4 - i32.const 16 - i32.add - i32.ge_u - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 396 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.const 16 - i32.sub - local.get $4 - i32.eq - if - local.get $1 - i32.const 16 - i32.sub - local.set $1 - local.get $4 - i32.load - local.set $5 - else - nop - end - else - i32.const 1 - drop - local.get $1 - local.get $0 - i32.const 1572 - i32.add - i32.ge_u - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 408 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - end - local.get $2 - local.get $1 - i32.sub - local.set $6 - local.get $6 - i32.const 16 - i32.const 16 - i32.add - i32.const 16 - i32.add - i32.lt_u - if - i32.const 0 - return - end - local.get $6 - i32.const 16 - i32.const 1 - i32.shl - i32.sub - local.set $7 - local.get $1 - local.set $8 - local.get $8 - local.get $7 - i32.const 1 - i32.or - local.get $5 - i32.const 2 - i32.and - i32.or - i32.store - local.get $8 - i32.const 0 - i32.store offset=16 - local.get $8 - i32.const 0 - i32.store offset=20 - local.get $1 - local.get $6 - i32.add - i32.const 16 - i32.sub - local.set $4 - local.get $4 - i32.const 0 - i32.const 2 - i32.or - i32.store - local.get $0 - local.set $9 - local.get $4 - local.set $3 - local.get $9 - local.get $3 - i32.store offset=1568 - local.get $0 - local.get $8 - call $~lib/rt/tlsf/insertBlock - i32.const 1 - ) - (func $~lib/rt/tlsf/maybeInitialize (result i32) - (local $0 i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - global.get $~lib/rt/tlsf/ROOT - local.set $0 - local.get $0 - i32.eqz - if - global.get $~lib/heap/__heap_base - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.set $1 - memory.size - local.set $2 - local.get $1 - i32.const 1572 - i32.add - i32.const 65535 - i32.add - i32.const 65535 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.shr_u - local.set $3 - local.get $3 - local.get $2 - i32.gt_s - if (result i32) - local.get $3 - local.get $2 - i32.sub - memory.grow - i32.const 0 - i32.lt_s - else - i32.const 0 - end - if - unreachable - end - local.get $1 - local.set $0 - local.get $0 - i32.const 0 - i32.store - local.get $0 - local.set $5 - i32.const 0 - local.set $4 - local.get $5 - local.get $4 - i32.store offset=1568 - i32.const 0 - local.set $5 - loop $for-loop|0 - local.get $5 - i32.const 23 - i32.lt_u - local.set $4 - local.get $4 - if - local.get $0 - local.set $8 - local.get $5 - local.set $7 - i32.const 0 - local.set $6 - local.get $8 - local.get $7 - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store offset=4 - i32.const 0 - local.set $8 - loop $for-loop|1 - local.get $8 - i32.const 16 - i32.lt_u - local.set $7 - local.get $7 - if - local.get $0 - local.set $11 - local.get $5 - local.set $10 - local.get $8 - local.set $9 - i32.const 0 - local.set $6 - local.get $11 - local.get $10 - i32.const 4 - i32.shl - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store offset=96 - local.get $8 - i32.const 1 - i32.add - local.set $8 - br $for-loop|1 - end - end - local.get $5 - i32.const 1 - i32.add - local.set $5 - br $for-loop|0 - end - end - local.get $1 - i32.const 1572 - i32.add - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.set $5 - i32.const 0 - drop - local.get $0 - local.get $5 - memory.size - i32.const 16 - i32.shl - call $~lib/rt/tlsf/addMemory - drop - local.get $0 - global.set $~lib/rt/tlsf/ROOT - end - local.get $0 - ) - (func $~lib/rt/tlsf/prepareSize (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - local.get $0 - i32.const 1073741808 - i32.ge_u - if - i32.const 80 - i32.const 32 - i32.const 461 - i32.const 30 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.tee $1 - i32.const 16 - local.tee $2 - local.get $1 - local.get $2 - i32.gt_u - select - ) - (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - local.get $1 - i32.const 256 - i32.lt_u - if - i32.const 0 - local.set $2 - local.get $1 - i32.const 4 - i32.shr_u - local.set $3 - else - local.get $1 - i32.const 536870904 - i32.lt_u - if (result i32) - local.get $1 - i32.const 1 - i32.const 27 - local.get $1 - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $1 - end - local.set $4 - i32.const 31 - local.get $4 - i32.clz - i32.sub - local.set $2 - local.get $4 - local.get $2 - i32.const 4 - i32.sub - i32.shr_u - i32.const 1 - i32.const 4 - i32.shl - i32.xor - local.set $3 - local.get $2 - i32.const 8 - i32.const 1 - i32.sub - i32.sub - local.set $2 - end - i32.const 1 - drop - local.get $2 - i32.const 23 - i32.lt_u - if (result i32) - local.get $3 - i32.const 16 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 338 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $5 - local.get $2 - local.set $4 - local.get $5 - local.get $4 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - i32.const 0 - i32.const -1 - i32.xor - local.get $3 - i32.shl - i32.and - local.set $6 - i32.const 0 - local.set $7 - local.get $6 - i32.eqz - if - local.get $0 - i32.load - i32.const 0 - i32.const -1 - i32.xor - local.get $2 - i32.const 1 - i32.add - i32.shl - i32.and - local.set $5 - local.get $5 - i32.eqz - if - i32.const 0 - local.set $7 - else - local.get $5 - i32.ctz - local.set $2 - local.get $0 - local.set $8 - local.get $2 - local.set $4 - local.get $8 - local.get $4 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - local.set $6 - i32.const 1 - drop - local.get $6 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 351 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $9 - local.get $2 - local.set $8 - local.get $6 - i32.ctz - local.set $4 - local.get $9 - local.get $8 - i32.const 4 - i32.shl - local.get $4 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $7 - end - else - local.get $0 - local.set $9 - local.get $2 - local.set $8 - local.get $6 - i32.ctz - local.set $4 - local.get $9 - local.get $8 - i32.const 4 - i32.shl - local.get $4 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $7 - end - local.get $7 - ) - (func $~lib/rt/tlsf/growMemory (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - i32.const 0 - drop - local.get $1 - i32.const 536870904 - i32.lt_u - if - local.get $1 - i32.const 1 - i32.const 27 - local.get $1 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $1 - end - memory.size - local.set $2 - local.get $1 - i32.const 16 - local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.sub - local.get $0 - local.set $3 - local.get $3 - i32.load offset=1568 - i32.ne - i32.shl - i32.add - local.set $1 - local.get $1 - i32.const 65535 - i32.add - i32.const 65535 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.shr_u - local.set $4 - local.get $2 - local.tee $3 - local.get $4 - local.tee $5 - local.get $3 - local.get $5 - i32.gt_s - select - local.set $6 - local.get $6 - memory.grow - i32.const 0 - i32.lt_s - if - local.get $4 - memory.grow - i32.const 0 - i32.lt_s - if - unreachable - end - end - memory.size - local.set $7 - local.get $0 - local.get $2 - i32.const 16 - i32.shl - local.get $7 - i32.const 16 - i32.shl - call $~lib/rt/tlsf/addMemory - drop - ) - (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - local.get $1 - i32.load - local.set $3 - i32.const 1 - drop - local.get $2 - i32.const 15 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 365 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.get $2 - i32.sub - local.set $4 - local.get $4 - i32.const 16 - i32.const 16 - i32.add - i32.ge_u - if - local.get $1 - local.get $2 - local.get $3 - i32.const 2 - i32.and - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.get $2 - i32.add - local.set $5 - local.get $5 - local.get $4 - i32.const 16 - i32.sub - i32.const 1 - i32.or - i32.store - local.get $0 - local.get $5 - call $~lib/rt/tlsf/insertBlock - else - local.get $1 - local.get $3 - i32.const 1 - i32.const -1 - i32.xor - i32.and - i32.store - local.get $1 - local.set $5 - local.get $5 - i32.const 16 - i32.add - local.get $5 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.get $1 - local.set $5 - local.get $5 - i32.const 16 - i32.add - local.get $5 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - i32.load - i32.const 2 - i32.const -1 - i32.xor - i32.and - i32.store - end - ) - (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - (local $4 i32) - i32.const 1 - drop - global.get $~lib/rt/tlsf/collectLock - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 500 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - call $~lib/rt/tlsf/prepareSize - local.set $3 - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - local.get $4 - i32.eqz - if - global.get $~lib/gc/gc.auto - if - i32.const 1 - drop - i32.const 1 - global.set $~lib/rt/tlsf/collectLock - call $~lib/rt/pure/__collect - i32.const 1 - drop - i32.const 0 - global.set $~lib/rt/tlsf/collectLock - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - local.get $4 - i32.eqz - if - local.get $0 - local.get $3 - call $~lib/rt/tlsf/growMemory - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - i32.const 1 - drop - local.get $4 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 512 - i32.const 20 - call $~lib/builtins/abort - unreachable - end - end - else - local.get $0 - local.get $3 - call $~lib/rt/tlsf/growMemory - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - i32.const 1 - drop - local.get $4 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 517 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - end - end - i32.const 1 - drop - local.get $4 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.get $3 - i32.ge_u - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 520 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $4 - i32.const 0 - i32.store offset=4 - local.get $4 - local.get $2 - i32.store offset=8 - local.get $4 - local.get $1 - i32.store offset=12 - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $0 - local.get $4 - local.get $3 - call $~lib/rt/tlsf/prepareBlock - i32.const 0 - drop - local.get $4 - ) - (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) - call $~lib/rt/tlsf/maybeInitialize - local.get $0 - local.get $1 - call $~lib/rt/tlsf/allocateBlock - i32.const 16 - i32.add - ) - (func $~lib/rt/pure/increment (param $0 i32) - (local $1 i32) - local.get $0 - i32.load offset=4 - local.set $1 - local.get $1 - i32.const 268435455 - i32.const -1 - i32.xor - i32.and - local.get $1 - i32.const 1 - i32.add - i32.const 268435455 - i32.const -1 - i32.xor - i32.and - i32.eq - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 109 - i32.const 3 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=4 - i32.const 0 - drop - i32.const 1 - drop - local.get $0 - i32.load - i32.const 1 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 112 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - ) - (func $~lib/rt/pure/__retain (param $0 i32) (result i32) - local.get $0 - global.get $~lib/heap/__heap_base - i32.gt_u - if - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/increment - end - local.get $0 - ) - (func $~lib/rt/pure/__release (param $0 i32) - local.get $0 - global.get $~lib/heap/__heap_base - i32.gt_u - if - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/decrement - end - ) - (func $~start - nop - ) - (func $~lib/rt/pure/__collect - i32.const 1 - drop - return - ) - (func $~lib/rt/tlsf/freeBlock (param $0 i32) (param $1 i32) - (local $2 i32) - local.get $1 - i32.load - local.set $2 - local.get $1 - local.get $2 - i32.const 1 - i32.or - i32.store - local.get $0 - local.get $1 - call $~lib/rt/tlsf/insertBlock - i32.const 0 - drop - ) - (func $~lib/rt/pure/finalize (param $0 i32) - i32.const 0 - drop - global.get $~lib/rt/tlsf/ROOT - local.get $0 - call $~lib/rt/tlsf/freeBlock - ) - (func $~lib/rt/pure/decrement (param $0 i32) - (local $1 i32) - (local $2 i32) - local.get $0 - i32.load offset=4 - local.set $1 - local.get $1 - i32.const 268435455 - i32.and - local.set $2 - i32.const 0 - drop - i32.const 1 - drop - local.get $0 - i32.load - i32.const 1 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 122 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $2 - i32.const 1 - i32.eq - if - local.get $0 - i32.const 16 - i32.add - i32.const 1 - call $~lib/rt/__visit_members - i32.const 1 - drop - i32.const 1 - drop - local.get $1 - i32.const -2147483648 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 126 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - local.get $0 - call $~lib/rt/pure/finalize - else - i32.const 1 - drop - local.get $2 - i32.const 0 - i32.gt_u - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 136 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - drop - local.get $0 - local.get $1 - i32.const 268435455 - i32.const -1 - i32.xor - i32.and - local.get $2 - i32.const 1 - i32.sub - i32.or - i32.store offset=4 - end - ) - (func $~lib/rt/pure/__visit (param $0 i32) (param $1 i32) - local.get $0 - global.get $~lib/heap/__heap_base - i32.lt_u - if - return - end - i32.const 1 - drop - i32.const 1 - drop - local.get $1 - i32.const 1 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 69 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/decrement - ) - (func $~lib/rt/__visit_members (param $0 i32) (param $1 i32) - (local $2 i32) - block $switch$1$default - block $switch$1$case$4 - block $switch$1$case$2 - local.get $0 - i32.const 8 - i32.sub - i32.load - br_table $switch$1$case$2 $switch$1$case$2 $switch$1$case$4 $switch$1$default - end - return - end - local.get $0 - i32.load - local.tee $2 - if - local.get $2 - local.get $1 - call $~lib/rt/pure/__visit - end - return - end - unreachable - ) -) diff --git a/tests/asconfig/flags/options.json b/tests/asconfig/flags/options.json deleted file mode 100644 index 32c639edd1..0000000000 --- a/tests/asconfig/flags/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "debug": true -} \ No newline at end of file diff --git a/tests/asconfig/flags/output.wat b/tests/asconfig/flags/output.wat deleted file mode 100644 index e7be0c0e3f..0000000000 --- a/tests/asconfig/flags/output.wat +++ /dev/null @@ -1,1701 +0,0 @@ -(module - (type $i32_i32_=>_none (func (param i32 i32))) - (type $i32_=>_none (func (param i32))) - (type $none_=>_none (func)) - (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) - (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) - (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) - (type $none_=>_i32 (func (result i32))) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (memory $0 1) - (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") - (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") - (data (i32.const 128) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") - (data (i32.const 176) "\03\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00") - (table $0 1 funcref) - (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) - (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) - (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) - (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) - (global $~lib/rt/__rtti_base i32 (i32.const 176)) - (global $~lib/heap/__heap_base i32 (i32.const 204)) - (export "_start" (func $~start)) - (export "memory" (memory $0)) - (export "__alloc" (func $~lib/rt/tlsf/__alloc)) - (export "__retain" (func $~lib/rt/pure/__retain)) - (export "__release" (func $~lib/rt/pure/__release)) - (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__rtti_base" (global $~lib/rt/__rtti_base)) - (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - local.get $1 - i32.load - local.set $2 - i32.const 1 - drop - local.get $2 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 277 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.set $3 - i32.const 1 - drop - local.get $3 - i32.const 16 - i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741808 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 279 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 256 - i32.lt_u - if - i32.const 0 - local.set $4 - local.get $3 - i32.const 4 - i32.shr_u - local.set $5 - else - i32.const 31 - local.get $3 - i32.clz - i32.sub - local.set $4 - local.get $3 - local.get $4 - i32.const 4 - i32.sub - i32.shr_u - i32.const 1 - i32.const 4 - i32.shl - i32.xor - local.set $5 - local.get $4 - i32.const 8 - i32.const 1 - i32.sub - i32.sub - local.set $4 - end - i32.const 1 - drop - local.get $4 - i32.const 23 - i32.lt_u - if (result i32) - local.get $5 - i32.const 16 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 292 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.load offset=16 - local.set $6 - local.get $1 - i32.load offset=20 - local.set $7 - local.get $6 - if - local.get $6 - local.get $7 - i32.store offset=20 - end - local.get $7 - if - local.get $7 - local.get $6 - i32.store offset=16 - end - local.get $1 - local.get $0 - local.set $10 - local.get $4 - local.set $9 - local.get $5 - local.set $8 - local.get $10 - local.get $9 - i32.const 4 - i32.shl - local.get $8 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - i32.eq - if - local.get $0 - local.set $11 - local.get $4 - local.set $10 - local.get $5 - local.set $9 - local.get $7 - local.set $8 - local.get $11 - local.get $10 - i32.const 4 - i32.shl - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.add - local.get $8 - i32.store offset=96 - local.get $7 - i32.eqz - if - local.get $0 - local.set $9 - local.get $4 - local.set $8 - local.get $9 - local.get $8 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - local.set $9 - local.get $0 - local.set $8 - local.get $4 - local.set $11 - local.get $9 - i32.const 1 - local.get $5 - i32.shl - i32.const -1 - i32.xor - i32.and - local.tee $9 - local.set $10 - local.get $8 - local.get $11 - i32.const 2 - i32.shl - i32.add - local.get $10 - i32.store offset=4 - local.get $9 - i32.eqz - if - local.get $0 - local.get $0 - i32.load - i32.const 1 - local.get $4 - i32.shl - i32.const -1 - i32.xor - i32.and - i32.store - end - end - end - ) - (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - (local $12 i32) - (local $13 i32) - i32.const 1 - drop - local.get $1 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 205 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.load - local.set $2 - i32.const 1 - drop - local.get $2 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 207 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - local.set $3 - local.get $3 - i32.const 16 - i32.add - local.get $3 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - local.get $5 - i32.const 1 - i32.and - if - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.add - local.get $5 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $3 - local.get $3 - i32.const 1073741808 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - i32.store - local.get $1 - local.set $6 - local.get $6 - i32.const 16 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end - end - local.get $2 - i32.const 2 - i32.and - if - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.sub - i32.load - local.set $6 - local.get $6 - i32.load - local.set $3 - i32.const 1 - drop - local.get $3 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 228 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.add - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $7 - local.get $7 - i32.const 1073741808 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - i32.store - local.get $6 - local.set $1 - end - end - local.get $4 - local.get $5 - i32.const 2 - i32.or - i32.store - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.set $8 - i32.const 1 - drop - local.get $8 - i32.const 16 - i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741808 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 243 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - drop - local.get $1 - i32.const 16 - i32.add - local.get $8 - i32.add - local.get $4 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 244 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $4 - i32.const 4 - i32.sub - local.get $1 - i32.store - local.get $8 - i32.const 256 - i32.lt_u - if - i32.const 0 - local.set $9 - local.get $8 - i32.const 4 - i32.shr_u - local.set $10 - else - i32.const 31 - local.get $8 - i32.clz - i32.sub - local.set $9 - local.get $8 - local.get $9 - i32.const 4 - i32.sub - i32.shr_u - i32.const 1 - i32.const 4 - i32.shl - i32.xor - local.set $10 - local.get $9 - i32.const 8 - i32.const 1 - i32.sub - i32.sub - local.set $9 - end - i32.const 1 - drop - local.get $9 - i32.const 23 - i32.lt_u - if (result i32) - local.get $10 - i32.const 16 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 260 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $7 - local.get $9 - local.set $3 - local.get $10 - local.set $6 - local.get $7 - local.get $3 - i32.const 4 - i32.shl - local.get $6 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $11 - local.get $1 - i32.const 0 - i32.store offset=16 - local.get $1 - local.get $11 - i32.store offset=20 - local.get $11 - if - local.get $11 - local.get $1 - i32.store offset=16 - end - local.get $0 - local.set $12 - local.get $9 - local.set $7 - local.get $10 - local.set $3 - local.get $1 - local.set $6 - local.get $12 - local.get $7 - i32.const 4 - i32.shl - local.get $3 - i32.add - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store offset=96 - local.get $0 - local.get $0 - i32.load - i32.const 1 - local.get $9 - i32.shl - i32.or - i32.store - local.get $0 - local.set $13 - local.get $9 - local.set $12 - local.get $0 - local.set $3 - local.get $9 - local.set $6 - local.get $3 - local.get $6 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - i32.const 1 - local.get $10 - i32.shl - i32.or - local.set $7 - local.get $13 - local.get $12 - i32.const 2 - i32.shl - i32.add - local.get $7 - i32.store offset=4 - ) - (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - i32.const 1 - drop - local.get $1 - local.get $2 - i32.le_u - if (result i32) - local.get $1 - i32.const 15 - i32.and - i32.eqz - else - i32.const 0 - end - if (result i32) - local.get $2 - i32.const 15 - i32.and - i32.eqz - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 386 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $3 - local.get $3 - i32.load offset=1568 - local.set $4 - i32.const 0 - local.set $5 - local.get $4 - if - i32.const 1 - drop - local.get $1 - local.get $4 - i32.const 16 - i32.add - i32.ge_u - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 396 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.const 16 - i32.sub - local.get $4 - i32.eq - if - local.get $1 - i32.const 16 - i32.sub - local.set $1 - local.get $4 - i32.load - local.set $5 - else - nop - end - else - i32.const 1 - drop - local.get $1 - local.get $0 - i32.const 1572 - i32.add - i32.ge_u - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 408 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - end - local.get $2 - local.get $1 - i32.sub - local.set $6 - local.get $6 - i32.const 16 - i32.const 16 - i32.add - i32.const 16 - i32.add - i32.lt_u - if - i32.const 0 - return - end - local.get $6 - i32.const 16 - i32.const 1 - i32.shl - i32.sub - local.set $7 - local.get $1 - local.set $8 - local.get $8 - local.get $7 - i32.const 1 - i32.or - local.get $5 - i32.const 2 - i32.and - i32.or - i32.store - local.get $8 - i32.const 0 - i32.store offset=16 - local.get $8 - i32.const 0 - i32.store offset=20 - local.get $1 - local.get $6 - i32.add - i32.const 16 - i32.sub - local.set $4 - local.get $4 - i32.const 0 - i32.const 2 - i32.or - i32.store - local.get $0 - local.set $9 - local.get $4 - local.set $3 - local.get $9 - local.get $3 - i32.store offset=1568 - local.get $0 - local.get $8 - call $~lib/rt/tlsf/insertBlock - i32.const 1 - ) - (func $~lib/rt/tlsf/maybeInitialize (result i32) - (local $0 i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - global.get $~lib/rt/tlsf/ROOT - local.set $0 - local.get $0 - i32.eqz - if - global.get $~lib/heap/__heap_base - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.set $1 - memory.size - local.set $2 - local.get $1 - i32.const 1572 - i32.add - i32.const 65535 - i32.add - i32.const 65535 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.shr_u - local.set $3 - local.get $3 - local.get $2 - i32.gt_s - if (result i32) - local.get $3 - local.get $2 - i32.sub - memory.grow - i32.const 0 - i32.lt_s - else - i32.const 0 - end - if - unreachable - end - local.get $1 - local.set $0 - local.get $0 - i32.const 0 - i32.store - local.get $0 - local.set $5 - i32.const 0 - local.set $4 - local.get $5 - local.get $4 - i32.store offset=1568 - i32.const 0 - local.set $5 - loop $for-loop|0 - local.get $5 - i32.const 23 - i32.lt_u - local.set $4 - local.get $4 - if - local.get $0 - local.set $8 - local.get $5 - local.set $7 - i32.const 0 - local.set $6 - local.get $8 - local.get $7 - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store offset=4 - i32.const 0 - local.set $8 - loop $for-loop|1 - local.get $8 - i32.const 16 - i32.lt_u - local.set $7 - local.get $7 - if - local.get $0 - local.set $11 - local.get $5 - local.set $10 - local.get $8 - local.set $9 - i32.const 0 - local.set $6 - local.get $11 - local.get $10 - i32.const 4 - i32.shl - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store offset=96 - local.get $8 - i32.const 1 - i32.add - local.set $8 - br $for-loop|1 - end - end - local.get $5 - i32.const 1 - i32.add - local.set $5 - br $for-loop|0 - end - end - local.get $1 - i32.const 1572 - i32.add - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.set $5 - i32.const 0 - drop - local.get $0 - local.get $5 - memory.size - i32.const 16 - i32.shl - call $~lib/rt/tlsf/addMemory - drop - local.get $0 - global.set $~lib/rt/tlsf/ROOT - end - local.get $0 - ) - (func $~lib/rt/tlsf/prepareSize (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - local.get $0 - i32.const 1073741808 - i32.ge_u - if - i32.const 80 - i32.const 32 - i32.const 461 - i32.const 30 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.tee $1 - i32.const 16 - local.tee $2 - local.get $1 - local.get $2 - i32.gt_u - select - ) - (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - local.get $1 - i32.const 256 - i32.lt_u - if - i32.const 0 - local.set $2 - local.get $1 - i32.const 4 - i32.shr_u - local.set $3 - else - local.get $1 - i32.const 536870904 - i32.lt_u - if (result i32) - local.get $1 - i32.const 1 - i32.const 27 - local.get $1 - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $1 - end - local.set $4 - i32.const 31 - local.get $4 - i32.clz - i32.sub - local.set $2 - local.get $4 - local.get $2 - i32.const 4 - i32.sub - i32.shr_u - i32.const 1 - i32.const 4 - i32.shl - i32.xor - local.set $3 - local.get $2 - i32.const 8 - i32.const 1 - i32.sub - i32.sub - local.set $2 - end - i32.const 1 - drop - local.get $2 - i32.const 23 - i32.lt_u - if (result i32) - local.get $3 - i32.const 16 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 338 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $5 - local.get $2 - local.set $4 - local.get $5 - local.get $4 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - i32.const 0 - i32.const -1 - i32.xor - local.get $3 - i32.shl - i32.and - local.set $6 - i32.const 0 - local.set $7 - local.get $6 - i32.eqz - if - local.get $0 - i32.load - i32.const 0 - i32.const -1 - i32.xor - local.get $2 - i32.const 1 - i32.add - i32.shl - i32.and - local.set $5 - local.get $5 - i32.eqz - if - i32.const 0 - local.set $7 - else - local.get $5 - i32.ctz - local.set $2 - local.get $0 - local.set $8 - local.get $2 - local.set $4 - local.get $8 - local.get $4 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - local.set $6 - i32.const 1 - drop - local.get $6 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 351 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $9 - local.get $2 - local.set $8 - local.get $6 - i32.ctz - local.set $4 - local.get $9 - local.get $8 - i32.const 4 - i32.shl - local.get $4 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $7 - end - else - local.get $0 - local.set $9 - local.get $2 - local.set $8 - local.get $6 - i32.ctz - local.set $4 - local.get $9 - local.get $8 - i32.const 4 - i32.shl - local.get $4 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $7 - end - local.get $7 - ) - (func $~lib/rt/tlsf/growMemory (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - i32.const 0 - drop - local.get $1 - i32.const 536870904 - i32.lt_u - if - local.get $1 - i32.const 1 - i32.const 27 - local.get $1 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $1 - end - memory.size - local.set $2 - local.get $1 - i32.const 16 - local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.sub - local.get $0 - local.set $3 - local.get $3 - i32.load offset=1568 - i32.ne - i32.shl - i32.add - local.set $1 - local.get $1 - i32.const 65535 - i32.add - i32.const 65535 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.shr_u - local.set $4 - local.get $2 - local.tee $3 - local.get $4 - local.tee $5 - local.get $3 - local.get $5 - i32.gt_s - select - local.set $6 - local.get $6 - memory.grow - i32.const 0 - i32.lt_s - if - local.get $4 - memory.grow - i32.const 0 - i32.lt_s - if - unreachable - end - end - memory.size - local.set $7 - local.get $0 - local.get $2 - i32.const 16 - i32.shl - local.get $7 - i32.const 16 - i32.shl - call $~lib/rt/tlsf/addMemory - drop - ) - (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - local.get $1 - i32.load - local.set $3 - i32.const 1 - drop - local.get $2 - i32.const 15 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 365 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.get $2 - i32.sub - local.set $4 - local.get $4 - i32.const 16 - i32.const 16 - i32.add - i32.ge_u - if - local.get $1 - local.get $2 - local.get $3 - i32.const 2 - i32.and - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.get $2 - i32.add - local.set $5 - local.get $5 - local.get $4 - i32.const 16 - i32.sub - i32.const 1 - i32.or - i32.store - local.get $0 - local.get $5 - call $~lib/rt/tlsf/insertBlock - else - local.get $1 - local.get $3 - i32.const 1 - i32.const -1 - i32.xor - i32.and - i32.store - local.get $1 - local.set $5 - local.get $5 - i32.const 16 - i32.add - local.get $5 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.get $1 - local.set $5 - local.get $5 - i32.const 16 - i32.add - local.get $5 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - i32.load - i32.const 2 - i32.const -1 - i32.xor - i32.and - i32.store - end - ) - (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - (local $4 i32) - i32.const 1 - drop - global.get $~lib/rt/tlsf/collectLock - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 500 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - call $~lib/rt/tlsf/prepareSize - local.set $3 - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - local.get $4 - i32.eqz - if - global.get $~lib/gc/gc.auto - if - i32.const 1 - drop - i32.const 1 - global.set $~lib/rt/tlsf/collectLock - call $~lib/rt/pure/__collect - i32.const 1 - drop - i32.const 0 - global.set $~lib/rt/tlsf/collectLock - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - local.get $4 - i32.eqz - if - local.get $0 - local.get $3 - call $~lib/rt/tlsf/growMemory - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - i32.const 1 - drop - local.get $4 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 512 - i32.const 20 - call $~lib/builtins/abort - unreachable - end - end - else - local.get $0 - local.get $3 - call $~lib/rt/tlsf/growMemory - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - i32.const 1 - drop - local.get $4 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 517 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - end - end - i32.const 1 - drop - local.get $4 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.get $3 - i32.ge_u - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 520 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $4 - i32.const 0 - i32.store offset=4 - local.get $4 - local.get $2 - i32.store offset=8 - local.get $4 - local.get $1 - i32.store offset=12 - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $0 - local.get $4 - local.get $3 - call $~lib/rt/tlsf/prepareBlock - i32.const 0 - drop - local.get $4 - ) - (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) - call $~lib/rt/tlsf/maybeInitialize - local.get $0 - local.get $1 - call $~lib/rt/tlsf/allocateBlock - i32.const 16 - i32.add - ) - (func $~lib/rt/pure/increment (param $0 i32) - (local $1 i32) - local.get $0 - i32.load offset=4 - local.set $1 - local.get $1 - i32.const 268435455 - i32.const -1 - i32.xor - i32.and - local.get $1 - i32.const 1 - i32.add - i32.const 268435455 - i32.const -1 - i32.xor - i32.and - i32.eq - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 109 - i32.const 3 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=4 - i32.const 0 - drop - i32.const 1 - drop - local.get $0 - i32.load - i32.const 1 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 112 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - ) - (func $~lib/rt/pure/__retain (param $0 i32) (result i32) - local.get $0 - global.get $~lib/heap/__heap_base - i32.gt_u - if - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/increment - end - local.get $0 - ) - (func $~lib/rt/pure/__release (param $0 i32) - local.get $0 - global.get $~lib/heap/__heap_base - i32.gt_u - if - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/decrement - end - ) - (func $~start - nop - ) - (func $~lib/rt/pure/__collect - i32.const 1 - drop - return - ) - (func $~lib/rt/tlsf/freeBlock (param $0 i32) (param $1 i32) - (local $2 i32) - local.get $1 - i32.load - local.set $2 - local.get $1 - local.get $2 - i32.const 1 - i32.or - i32.store - local.get $0 - local.get $1 - call $~lib/rt/tlsf/insertBlock - i32.const 0 - drop - ) - (func $~lib/rt/pure/finalize (param $0 i32) - i32.const 0 - drop - global.get $~lib/rt/tlsf/ROOT - local.get $0 - call $~lib/rt/tlsf/freeBlock - ) - (func $~lib/rt/pure/decrement (param $0 i32) - (local $1 i32) - (local $2 i32) - local.get $0 - i32.load offset=4 - local.set $1 - local.get $1 - i32.const 268435455 - i32.and - local.set $2 - i32.const 0 - drop - i32.const 1 - drop - local.get $0 - i32.load - i32.const 1 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 122 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $2 - i32.const 1 - i32.eq - if - local.get $0 - i32.const 16 - i32.add - i32.const 1 - call $~lib/rt/__visit_members - i32.const 1 - drop - i32.const 1 - drop - local.get $1 - i32.const -2147483648 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 126 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - local.get $0 - call $~lib/rt/pure/finalize - else - i32.const 1 - drop - local.get $2 - i32.const 0 - i32.gt_u - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 136 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - drop - local.get $0 - local.get $1 - i32.const 268435455 - i32.const -1 - i32.xor - i32.and - local.get $2 - i32.const 1 - i32.sub - i32.or - i32.store offset=4 - end - ) - (func $~lib/rt/pure/__visit (param $0 i32) (param $1 i32) - local.get $0 - global.get $~lib/heap/__heap_base - i32.lt_u - if - return - end - i32.const 1 - drop - i32.const 1 - drop - local.get $1 - i32.const 1 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 69 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/decrement - ) - (func $~lib/rt/__visit_members (param $0 i32) (param $1 i32) - (local $2 i32) - block $switch$1$default - block $switch$1$case$4 - block $switch$1$case$2 - local.get $0 - i32.const 8 - i32.sub - i32.load - br_table $switch$1$case$2 $switch$1$case$2 $switch$1$case$4 $switch$1$default - end - return - end - local.get $0 - i32.load - local.tee $2 - if - local.get $2 - local.get $1 - call $~lib/rt/pure/__visit - end - return - end - unreachable - ) -) diff --git a/tests/asconfig/target/output.wat b/tests/asconfig/target/output.wat deleted file mode 100644 index 66d5e7d515..0000000000 --- a/tests/asconfig/target/output.wat +++ /dev/null @@ -1,1207 +0,0 @@ -(module - (type $none_=>_none (func)) - (type $i32_=>_none (func (param i32))) - (type $i32_i32_=>_none (func (param i32 i32))) - (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) - (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) - (type $none_=>_i32 (func (result i32))) - (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (memory $0 1) - (data (i32.const 1024) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s") - (data (i32.const 1072) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e") - (data (i32.const 1136) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s") - (data (i32.const 1184) "\03\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 ") - (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) - (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) - (global $~started (mut i32) (i32.const 0)) - (global $~lib/rt/__rtti_base i32 (i32.const 1184)) - (export "_start" (func $~start)) - (export "memory" (memory $0)) - (export "__alloc" (func $~lib/rt/tlsf/__alloc)) - (export "__retain" (func $~lib/rt/pure/__retain)) - (export "__release" (func $~lib/rt/pure/__release)) - (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__rtti_base" (global $~lib/rt/__rtti_base)) - (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - local.get $1 - i32.load - local.tee $2 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 1040 - i32.const 277 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $2 - i32.const -4 - i32.and - local.tee $2 - i32.const 16 - i32.ge_u - if (result i32) - local.get $2 - i32.const 1073741808 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 1040 - i32.const 279 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $2 - i32.const 256 - i32.lt_u - if - local.get $2 - i32.const 4 - i32.shr_u - local.set $2 - else - local.get $2 - i32.const 31 - local.get $2 - i32.clz - i32.sub - local.tee $4 - i32.const 4 - i32.sub - i32.shr_u - i32.const 16 - i32.xor - local.set $2 - local.get $4 - i32.const 7 - i32.sub - local.set $4 - end - local.get $2 - i32.const 16 - i32.lt_u - i32.const 0 - local.get $4 - i32.const 23 - i32.lt_u - select - i32.eqz - if - i32.const 0 - i32.const 1040 - i32.const 292 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.load offset=20 - local.set $3 - local.get $1 - i32.load offset=16 - local.tee $5 - if - local.get $5 - local.get $3 - i32.store offset=20 - end - local.get $3 - if - local.get $3 - local.get $5 - i32.store offset=16 - end - local.get $1 - local.get $0 - local.get $2 - local.get $4 - i32.const 4 - i32.shl - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - i32.eq - if - local.get $0 - local.get $2 - local.get $4 - i32.const 4 - i32.shl - i32.add - i32.const 2 - i32.shl - i32.add - local.get $3 - i32.store offset=96 - local.get $3 - i32.eqz - if - local.get $0 - local.get $4 - i32.const 2 - i32.shl - i32.add - local.tee $3 - i32.load offset=4 - i32.const 1 - local.get $2 - i32.shl - i32.const -1 - i32.xor - i32.and - local.set $1 - local.get $3 - local.get $1 - i32.store offset=4 - local.get $1 - i32.eqz - if - local.get $0 - local.get $0 - i32.load - i32.const 1 - local.get $4 - i32.shl - i32.const -1 - i32.xor - i32.and - i32.store - end - end - end - ) - (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - local.get $1 - i32.eqz - if - i32.const 0 - i32.const 1040 - i32.const 205 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.load - local.tee $4 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 1040 - i32.const 207 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.const 16 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.tee $2 - i32.const 1 - i32.and - if - local.get $4 - i32.const -4 - i32.and - i32.const 16 - i32.add - local.get $2 - i32.const -4 - i32.and - i32.add - local.tee $3 - i32.const 1073741808 - i32.lt_u - if - local.get $0 - local.get $5 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $3 - local.get $4 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $1 - i32.const 16 - i32.add - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.tee $5 - i32.load - local.set $2 - end - end - local.get $4 - i32.const 2 - i32.and - if - local.get $1 - i32.const 4 - i32.sub - i32.load - local.tee $3 - i32.load - local.tee $7 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 1040 - i32.const 228 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $7 - i32.const -4 - i32.and - i32.const 16 - i32.add - local.get $4 - i32.const -4 - i32.and - i32.add - local.tee $8 - i32.const 1073741808 - i32.lt_u - if (result i32) - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $3 - local.get $8 - local.get $7 - i32.const 3 - i32.and - i32.or - local.tee $4 - i32.store - local.get $3 - else - local.get $1 - end - local.set $1 - end - local.get $5 - local.get $2 - i32.const 2 - i32.or - i32.store - local.get $4 - i32.const -4 - i32.and - local.tee $3 - i32.const 16 - i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741808 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 1040 - i32.const 243 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $3 - local.get $1 - i32.const 16 - i32.add - i32.add - local.get $5 - i32.ne - if - i32.const 0 - i32.const 1040 - i32.const 244 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $5 - i32.const 4 - i32.sub - local.get $1 - i32.store - local.get $3 - i32.const 256 - i32.lt_u - if - local.get $3 - i32.const 4 - i32.shr_u - local.set $3 - else - local.get $3 - i32.const 31 - local.get $3 - i32.clz - i32.sub - local.tee $4 - i32.const 4 - i32.sub - i32.shr_u - i32.const 16 - i32.xor - local.set $3 - local.get $4 - i32.const 7 - i32.sub - local.set $6 - end - local.get $3 - i32.const 16 - i32.lt_u - i32.const 0 - local.get $6 - i32.const 23 - i32.lt_u - select - i32.eqz - if - i32.const 0 - i32.const 1040 - i32.const 260 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $3 - local.get $6 - i32.const 4 - i32.shl - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $4 - local.get $1 - i32.const 0 - i32.store offset=16 - local.get $1 - local.get $4 - i32.store offset=20 - local.get $4 - if - local.get $4 - local.get $1 - i32.store offset=16 - end - local.get $0 - local.get $3 - local.get $6 - i32.const 4 - i32.shl - i32.add - i32.const 2 - i32.shl - i32.add - local.get $1 - i32.store offset=96 - local.get $0 - local.get $0 - i32.load - i32.const 1 - local.get $6 - i32.shl - i32.or - i32.store - local.get $0 - local.get $6 - i32.const 2 - i32.shl - i32.add - local.tee $0 - local.get $0 - i32.load offset=4 - i32.const 1 - local.get $3 - i32.shl - i32.or - i32.store offset=4 - ) - (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - local.get $2 - i32.const 15 - i32.and - i32.eqz - i32.const 0 - local.get $1 - i32.const 15 - i32.and - i32.eqz - i32.const 0 - local.get $1 - local.get $2 - i32.le_u - select - select - i32.eqz - if - i32.const 0 - i32.const 1040 - i32.const 386 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.load offset=1568 - local.tee $3 - if - local.get $1 - local.get $3 - i32.const 16 - i32.add - i32.lt_u - if - i32.const 0 - i32.const 1040 - i32.const 396 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $3 - local.get $1 - i32.const 16 - i32.sub - i32.eq - if - local.get $3 - i32.load - local.set $4 - local.get $1 - i32.const 16 - i32.sub - local.set $1 - end - else - local.get $1 - local.get $0 - i32.const 1572 - i32.add - i32.lt_u - if - i32.const 0 - i32.const 1040 - i32.const 408 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - end - local.get $2 - local.get $1 - i32.sub - local.tee $2 - i32.const 48 - i32.lt_u - if - return - end - local.get $1 - local.get $4 - i32.const 2 - i32.and - local.get $2 - i32.const 32 - i32.sub - i32.const 1 - i32.or - i32.or - i32.store - local.get $1 - i32.const 0 - i32.store offset=16 - local.get $1 - i32.const 0 - i32.store offset=20 - local.get $1 - local.get $2 - i32.add - i32.const 16 - i32.sub - local.tee $2 - i32.const 2 - i32.store - local.get $0 - local.get $2 - i32.store offset=1568 - local.get $0 - local.get $1 - call $~lib/rt/tlsf/insertBlock - ) - (func $~lib/rt/tlsf/maybeInitialize (result i32) - (local $0 i32) - (local $1 i32) - (local $2 i32) - global.get $~lib/rt/tlsf/ROOT - local.tee $0 - i32.eqz - if - i32.const 1 - memory.size - local.tee $0 - i32.gt_s - if (result i32) - i32.const 1 - local.get $0 - i32.sub - memory.grow - i32.const 0 - i32.lt_s - else - i32.const 0 - end - if - unreachable - end - i32.const 1216 - local.tee $0 - i32.const 0 - i32.store - i32.const 2784 - i32.const 0 - i32.store - loop $for-loop|0 - local.get $1 - i32.const 23 - i32.lt_u - if - local.get $1 - i32.const 2 - i32.shl - i32.const 1216 - i32.add - i32.const 0 - i32.store offset=4 - i32.const 0 - local.set $2 - loop $for-loop|1 - local.get $2 - i32.const 16 - i32.lt_u - if - local.get $1 - i32.const 4 - i32.shl - local.get $2 - i32.add - i32.const 2 - i32.shl - i32.const 1216 - i32.add - i32.const 0 - i32.store offset=96 - local.get $2 - i32.const 1 - i32.add - local.set $2 - br $for-loop|1 - end - end - local.get $1 - i32.const 1 - i32.add - local.set $1 - br $for-loop|0 - end - end - i32.const 1216 - i32.const 2800 - memory.size - i32.const 16 - i32.shl - call $~lib/rt/tlsf/addMemory - i32.const 1216 - global.set $~lib/rt/tlsf/ROOT - end - local.get $0 - ) - (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - local.get $1 - i32.const 256 - i32.lt_u - if - local.get $1 - i32.const 4 - i32.shr_u - local.set $1 - else - local.get $1 - i32.const 1 - i32.const 27 - local.get $1 - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - local.get $1 - local.get $1 - i32.const 536870904 - i32.lt_u - select - local.tee $1 - i32.const 31 - local.get $1 - i32.clz - i32.sub - local.tee $2 - i32.const 4 - i32.sub - i32.shr_u - i32.const 16 - i32.xor - local.set $1 - local.get $2 - i32.const 7 - i32.sub - local.set $2 - end - local.get $1 - i32.const 16 - i32.lt_u - i32.const 0 - local.get $2 - i32.const 23 - i32.lt_u - select - i32.eqz - if - i32.const 0 - i32.const 1040 - i32.const 338 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $2 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - i32.const -1 - local.get $1 - i32.shl - i32.and - local.tee $1 - if (result i32) - local.get $0 - local.get $1 - i32.ctz - local.get $2 - i32.const 4 - i32.shl - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - else - local.get $0 - i32.load - i32.const -1 - local.get $2 - i32.const 1 - i32.add - i32.shl - i32.and - local.tee $1 - if (result i32) - local.get $0 - local.get $1 - i32.ctz - local.tee $1 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - local.tee $2 - i32.eqz - if - i32.const 0 - i32.const 1040 - i32.const 351 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $2 - i32.ctz - local.get $1 - i32.const 4 - i32.shl - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - else - i32.const 0 - end - end - ) - (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - local.get $1 - i32.load - local.set $3 - local.get $2 - i32.const 15 - i32.and - if - i32.const 0 - i32.const 1040 - i32.const 365 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const -4 - i32.and - local.get $2 - i32.sub - local.tee $4 - i32.const 32 - i32.ge_u - if - local.get $1 - local.get $2 - local.get $3 - i32.const 2 - i32.and - i32.or - i32.store - local.get $2 - local.get $1 - i32.const 16 - i32.add - i32.add - local.tee $1 - local.get $4 - i32.const 16 - i32.sub - i32.const 1 - i32.or - i32.store - local.get $0 - local.get $1 - call $~lib/rt/tlsf/insertBlock - else - local.get $1 - local.get $3 - i32.const -2 - i32.and - i32.store - local.get $1 - i32.const 16 - i32.add - local.tee $0 - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - local.get $0 - local.get $1 - i32.load - i32.const -4 - i32.and - i32.add - i32.load - i32.const -3 - i32.and - i32.store - end - ) - (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - global.get $~lib/rt/tlsf/collectLock - if - i32.const 0 - i32.const 1040 - i32.const 500 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.const 1073741808 - i32.ge_u - if - i32.const 1088 - i32.const 1040 - i32.const 461 - i32.const 30 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.const 15 - i32.add - i32.const -16 - i32.and - local.tee $3 - i32.const 16 - local.get $3 - i32.const 16 - i32.gt_u - select - local.tee $4 - call $~lib/rt/tlsf/searchBlock - local.tee $3 - i32.eqz - if - i32.const 1 - global.set $~lib/rt/tlsf/collectLock - i32.const 0 - global.set $~lib/rt/tlsf/collectLock - local.get $0 - local.get $4 - call $~lib/rt/tlsf/searchBlock - local.tee $3 - i32.eqz - if - i32.const 16 - memory.size - local.tee $3 - i32.const 16 - i32.shl - i32.const 16 - i32.sub - local.get $0 - i32.load offset=1568 - i32.ne - i32.shl - local.get $4 - i32.const 1 - i32.const 27 - local.get $4 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.get $4 - local.get $4 - i32.const 536870904 - i32.lt_u - select - i32.add - i32.const 65535 - i32.add - i32.const -65536 - i32.and - i32.const 16 - i32.shr_u - local.set $5 - local.get $3 - local.get $5 - local.get $3 - local.get $5 - i32.gt_s - select - memory.grow - i32.const 0 - i32.lt_s - if - local.get $5 - memory.grow - i32.const 0 - i32.lt_s - if - unreachable - end - end - local.get $0 - local.get $3 - i32.const 16 - i32.shl - memory.size - i32.const 16 - i32.shl - call $~lib/rt/tlsf/addMemory - local.get $0 - local.get $4 - call $~lib/rt/tlsf/searchBlock - local.tee $3 - i32.eqz - if - i32.const 0 - i32.const 1040 - i32.const 512 - i32.const 20 - call $~lib/builtins/abort - unreachable - end - end - end - local.get $3 - i32.load - i32.const -4 - i32.and - local.get $4 - i32.lt_u - if - i32.const 0 - i32.const 1040 - i32.const 520 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 0 - i32.store offset=4 - local.get $3 - local.get $2 - i32.store offset=8 - local.get $3 - local.get $1 - i32.store offset=12 - local.get $0 - local.get $3 - call $~lib/rt/tlsf/removeBlock - local.get $0 - local.get $3 - local.get $4 - call $~lib/rt/tlsf/prepareBlock - local.get $3 - ) - (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) - call $~lib/rt/tlsf/maybeInitialize - local.get $0 - local.get $1 - call $~lib/rt/tlsf/allocateBlock - i32.const 16 - i32.add - ) - (func $~lib/rt/pure/__retain (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - local.get $0 - i32.const 1212 - i32.gt_u - if - local.get $0 - i32.const 16 - i32.sub - local.tee $1 - i32.load offset=4 - local.tee $2 - i32.const -268435456 - i32.and - local.get $2 - i32.const 1 - i32.add - i32.const -268435456 - i32.and - i32.ne - if - i32.const 0 - i32.const 1152 - i32.const 109 - i32.const 3 - call $~lib/builtins/abort - unreachable - end - local.get $1 - local.get $2 - i32.const 1 - i32.add - i32.store offset=4 - local.get $1 - i32.load - i32.const 1 - i32.and - if - i32.const 0 - i32.const 1152 - i32.const 112 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - end - local.get $0 - ) - (func $~lib/rt/pure/__release (param $0 i32) - local.get $0 - i32.const 1212 - i32.gt_u - if - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/decrement - end - ) - (func $~start - global.get $~started - i32.eqz - if - i32.const 1 - global.set $~started - end - ) - (func $~lib/rt/pure/__collect - nop - ) - (func $~lib/rt/pure/decrement (param $0 i32) - (local $1 i32) - (local $2 i32) - local.get $0 - i32.load offset=4 - local.tee $2 - i32.const 268435455 - i32.and - local.set $1 - local.get $0 - i32.load - i32.const 1 - i32.and - if - i32.const 0 - i32.const 1152 - i32.const 122 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.const 1 - i32.eq - if - block $__inlined_func$~lib/rt/__visit_members - block $switch$1$default - block $switch$1$case$4 - local.get $0 - i32.const 8 - i32.add - i32.load - br_table $__inlined_func$~lib/rt/__visit_members $__inlined_func$~lib/rt/__visit_members $switch$1$case$4 $switch$1$default - end - local.get $0 - i32.load offset=16 - local.tee $1 - if - local.get $1 - i32.const 1212 - i32.ge_u - if - local.get $1 - i32.const 16 - i32.sub - call $~lib/rt/pure/decrement - end - end - br $__inlined_func$~lib/rt/__visit_members - end - unreachable - end - local.get $2 - i32.const -2147483648 - i32.and - if - i32.const 0 - i32.const 1152 - i32.const 126 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $0 - i32.load - i32.const 1 - i32.or - i32.store - global.get $~lib/rt/tlsf/ROOT - local.get $0 - call $~lib/rt/tlsf/insertBlock - else - local.get $1 - i32.const 0 - i32.le_u - if - i32.const 0 - i32.const 1152 - i32.const 136 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.const 1 - i32.sub - local.get $2 - i32.const -268435456 - i32.and - i32.or - i32.store offset=4 - end - ) -) diff --git a/tests/asconfig/use-consts/output.wat b/tests/asconfig/use-consts/output.wat deleted file mode 100644 index ed983701b6..0000000000 --- a/tests/asconfig/use-consts/output.wat +++ /dev/null @@ -1,1726 +0,0 @@ -(module - (type $i32_i32_=>_none (func (param i32 i32))) - (type $i32_=>_none (func (param i32))) - (type $none_=>_none (func)) - (type $i32_=>_i32 (func (param i32) (result i32))) - (type $i32_i32_=>_i32 (func (param i32 i32) (result i32))) - (type $i32_i32_i32_=>_i32 (func (param i32 i32 i32) (result i32))) - (type $i32_i32_i32_=>_none (func (param i32 i32 i32))) - (type $i32_i32_i32_i32_=>_none (func (param i32 i32 i32 i32))) - (type $none_=>_i32 (func (result i32))) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) - (memory $0 1) - (data (i32.const 16) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00t\00l\00s\00f\00.\00t\00s\00") - (data (i32.const 64) "(\00\00\00\01\00\00\00\01\00\00\00(\00\00\00a\00l\00l\00o\00c\00a\00t\00i\00o\00n\00 \00t\00o\00o\00 \00l\00a\00r\00g\00e\00") - (data (i32.const 128) "\1e\00\00\00\01\00\00\00\01\00\00\00\1e\00\00\00~\00l\00i\00b\00/\00r\00t\00/\00p\00u\00r\00e\00.\00t\00s\00") - (data (i32.const 176) "\03\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00 \00\00\00\00\00\00\00") - (table $0 1 funcref) - (global $~lib/rt/tlsf/ROOT (mut i32) (i32.const 0)) - (global $~lib/ASC_LOW_MEMORY_LIMIT i32 (i32.const 0)) - (global $~lib/rt/tlsf/collectLock (mut i32) (i32.const 0)) - (global $~lib/gc/gc.auto (mut i32) (i32.const 1)) - (global $~lib/A i32 (i32.const 1)) - (global $~lib/B i32 (i32.const 2)) - (global $~lib/C i32 (i32.const 3)) - (global $~started (mut i32) (i32.const 0)) - (global $~lib/rt/__rtti_base i32 (i32.const 176)) - (global $~lib/heap/__heap_base i32 (i32.const 204)) - (export "_start" (func $~start)) - (export "memory" (memory $0)) - (export "__alloc" (func $~lib/rt/tlsf/__alloc)) - (export "__retain" (func $~lib/rt/pure/__retain)) - (export "__release" (func $~lib/rt/pure/__release)) - (export "__collect" (func $~lib/rt/pure/__collect)) - (export "__rtti_base" (global $~lib/rt/__rtti_base)) - (func $~lib/rt/tlsf/removeBlock (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - local.get $1 - i32.load - local.set $2 - i32.const 1 - drop - local.get $2 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 277 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.set $3 - i32.const 1 - drop - local.get $3 - i32.const 16 - i32.ge_u - if (result i32) - local.get $3 - i32.const 1073741808 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 279 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 256 - i32.lt_u - if - i32.const 0 - local.set $4 - local.get $3 - i32.const 4 - i32.shr_u - local.set $5 - else - i32.const 31 - local.get $3 - i32.clz - i32.sub - local.set $4 - local.get $3 - local.get $4 - i32.const 4 - i32.sub - i32.shr_u - i32.const 1 - i32.const 4 - i32.shl - i32.xor - local.set $5 - local.get $4 - i32.const 8 - i32.const 1 - i32.sub - i32.sub - local.set $4 - end - i32.const 1 - drop - local.get $4 - i32.const 23 - i32.lt_u - if (result i32) - local.get $5 - i32.const 16 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 292 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.load offset=16 - local.set $6 - local.get $1 - i32.load offset=20 - local.set $7 - local.get $6 - if - local.get $6 - local.get $7 - i32.store offset=20 - end - local.get $7 - if - local.get $7 - local.get $6 - i32.store offset=16 - end - local.get $1 - local.get $0 - local.set $10 - local.get $4 - local.set $9 - local.get $5 - local.set $8 - local.get $10 - local.get $9 - i32.const 4 - i32.shl - local.get $8 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - i32.eq - if - local.get $0 - local.set $11 - local.get $4 - local.set $10 - local.get $5 - local.set $9 - local.get $7 - local.set $8 - local.get $11 - local.get $10 - i32.const 4 - i32.shl - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.add - local.get $8 - i32.store offset=96 - local.get $7 - i32.eqz - if - local.get $0 - local.set $9 - local.get $4 - local.set $8 - local.get $9 - local.get $8 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - local.set $9 - local.get $0 - local.set $8 - local.get $4 - local.set $11 - local.get $9 - i32.const 1 - local.get $5 - i32.shl - i32.const -1 - i32.xor - i32.and - local.tee $9 - local.set $10 - local.get $8 - local.get $11 - i32.const 2 - i32.shl - i32.add - local.get $10 - i32.store offset=4 - local.get $9 - i32.eqz - if - local.get $0 - local.get $0 - i32.load - i32.const 1 - local.get $4 - i32.shl - i32.const -1 - i32.xor - i32.and - i32.store - end - end - end - ) - (func $~lib/rt/tlsf/insertBlock (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - (local $12 i32) - (local $13 i32) - i32.const 1 - drop - local.get $1 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 205 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.load - local.set $2 - i32.const 1 - drop - local.get $2 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 207 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - local.set $3 - local.get $3 - i32.const 16 - i32.add - local.get $3 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - local.get $5 - i32.const 1 - i32.and - if - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.add - local.get $5 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $3 - local.get $3 - i32.const 1073741808 - i32.lt_u - if - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $1 - local.get $2 - i32.const 3 - i32.and - local.get $3 - i32.or - local.tee $2 - i32.store - local.get $1 - local.set $6 - local.get $6 - i32.const 16 - i32.add - local.get $6 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $4 - local.get $4 - i32.load - local.set $5 - end - end - local.get $2 - i32.const 2 - i32.and - if - local.get $1 - local.set $6 - local.get $6 - i32.const 4 - i32.sub - i32.load - local.set $6 - local.get $6 - i32.load - local.set $3 - i32.const 1 - drop - local.get $3 - i32.const 1 - i32.and - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 228 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.add - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.set $7 - local.get $7 - i32.const 1073741808 - i32.lt_u - if - local.get $0 - local.get $6 - call $~lib/rt/tlsf/removeBlock - local.get $6 - local.get $3 - i32.const 3 - i32.and - local.get $7 - i32.or - local.tee $2 - i32.store - local.get $6 - local.set $1 - end - end - local.get $4 - local.get $5 - i32.const 2 - i32.or - i32.store - local.get $2 - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.set $8 - i32.const 1 - drop - local.get $8 - i32.const 16 - i32.ge_u - if (result i32) - local.get $8 - i32.const 1073741808 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 243 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - drop - local.get $1 - i32.const 16 - i32.add - local.get $8 - i32.add - local.get $4 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 244 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $4 - i32.const 4 - i32.sub - local.get $1 - i32.store - local.get $8 - i32.const 256 - i32.lt_u - if - i32.const 0 - local.set $9 - local.get $8 - i32.const 4 - i32.shr_u - local.set $10 - else - i32.const 31 - local.get $8 - i32.clz - i32.sub - local.set $9 - local.get $8 - local.get $9 - i32.const 4 - i32.sub - i32.shr_u - i32.const 1 - i32.const 4 - i32.shl - i32.xor - local.set $10 - local.get $9 - i32.const 8 - i32.const 1 - i32.sub - i32.sub - local.set $9 - end - i32.const 1 - drop - local.get $9 - i32.const 23 - i32.lt_u - if (result i32) - local.get $10 - i32.const 16 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 260 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $7 - local.get $9 - local.set $3 - local.get $10 - local.set $6 - local.get $7 - local.get $3 - i32.const 4 - i32.shl - local.get $6 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $11 - local.get $1 - i32.const 0 - i32.store offset=16 - local.get $1 - local.get $11 - i32.store offset=20 - local.get $11 - if - local.get $11 - local.get $1 - i32.store offset=16 - end - local.get $0 - local.set $12 - local.get $9 - local.set $7 - local.get $10 - local.set $3 - local.get $1 - local.set $6 - local.get $12 - local.get $7 - i32.const 4 - i32.shl - local.get $3 - i32.add - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store offset=96 - local.get $0 - local.get $0 - i32.load - i32.const 1 - local.get $9 - i32.shl - i32.or - i32.store - local.get $0 - local.set $13 - local.get $9 - local.set $12 - local.get $0 - local.set $3 - local.get $9 - local.set $6 - local.get $3 - local.get $6 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - i32.const 1 - local.get $10 - i32.shl - i32.or - local.set $7 - local.get $13 - local.get $12 - i32.const 2 - i32.shl - i32.add - local.get $7 - i32.store offset=4 - ) - (func $~lib/rt/tlsf/addMemory (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - i32.const 1 - drop - local.get $1 - local.get $2 - i32.le_u - if (result i32) - local.get $1 - i32.const 15 - i32.and - i32.eqz - else - i32.const 0 - end - if (result i32) - local.get $2 - i32.const 15 - i32.and - i32.eqz - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 386 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $3 - local.get $3 - i32.load offset=1568 - local.set $4 - i32.const 0 - local.set $5 - local.get $4 - if - i32.const 1 - drop - local.get $1 - local.get $4 - i32.const 16 - i32.add - i32.ge_u - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 396 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $1 - i32.const 16 - i32.sub - local.get $4 - i32.eq - if - local.get $1 - i32.const 16 - i32.sub - local.set $1 - local.get $4 - i32.load - local.set $5 - else - nop - end - else - i32.const 1 - drop - local.get $1 - local.get $0 - i32.const 1572 - i32.add - i32.ge_u - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 408 - i32.const 5 - call $~lib/builtins/abort - unreachable - end - end - local.get $2 - local.get $1 - i32.sub - local.set $6 - local.get $6 - i32.const 16 - i32.const 16 - i32.add - i32.const 16 - i32.add - i32.lt_u - if - i32.const 0 - return - end - local.get $6 - i32.const 16 - i32.const 1 - i32.shl - i32.sub - local.set $7 - local.get $1 - local.set $8 - local.get $8 - local.get $7 - i32.const 1 - i32.or - local.get $5 - i32.const 2 - i32.and - i32.or - i32.store - local.get $8 - i32.const 0 - i32.store offset=16 - local.get $8 - i32.const 0 - i32.store offset=20 - local.get $1 - local.get $6 - i32.add - i32.const 16 - i32.sub - local.set $4 - local.get $4 - i32.const 0 - i32.const 2 - i32.or - i32.store - local.get $0 - local.set $9 - local.get $4 - local.set $3 - local.get $9 - local.get $3 - i32.store offset=1568 - local.get $0 - local.get $8 - call $~lib/rt/tlsf/insertBlock - i32.const 1 - ) - (func $~lib/rt/tlsf/maybeInitialize (result i32) - (local $0 i32) - (local $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - (local $10 i32) - (local $11 i32) - global.get $~lib/rt/tlsf/ROOT - local.set $0 - local.get $0 - i32.eqz - if - global.get $~lib/heap/__heap_base - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.set $1 - memory.size - local.set $2 - local.get $1 - i32.const 1572 - i32.add - i32.const 65535 - i32.add - i32.const 65535 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.shr_u - local.set $3 - local.get $3 - local.get $2 - i32.gt_s - if (result i32) - local.get $3 - local.get $2 - i32.sub - memory.grow - i32.const 0 - i32.lt_s - else - i32.const 0 - end - if - unreachable - end - local.get $1 - local.set $0 - local.get $0 - i32.const 0 - i32.store - local.get $0 - local.set $5 - i32.const 0 - local.set $4 - local.get $5 - local.get $4 - i32.store offset=1568 - i32.const 0 - local.set $5 - loop $for-loop|0 - local.get $5 - i32.const 23 - i32.lt_u - local.set $4 - local.get $4 - if - local.get $0 - local.set $8 - local.get $5 - local.set $7 - i32.const 0 - local.set $6 - local.get $8 - local.get $7 - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store offset=4 - i32.const 0 - local.set $8 - loop $for-loop|1 - local.get $8 - i32.const 16 - i32.lt_u - local.set $7 - local.get $7 - if - local.get $0 - local.set $11 - local.get $5 - local.set $10 - local.get $8 - local.set $9 - i32.const 0 - local.set $6 - local.get $11 - local.get $10 - i32.const 4 - i32.shl - local.get $9 - i32.add - i32.const 2 - i32.shl - i32.add - local.get $6 - i32.store offset=96 - local.get $8 - i32.const 1 - i32.add - local.set $8 - br $for-loop|1 - end - end - local.get $5 - i32.const 1 - i32.add - local.set $5 - br $for-loop|0 - end - end - local.get $1 - i32.const 1572 - i32.add - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.set $5 - i32.const 0 - drop - local.get $0 - local.get $5 - memory.size - i32.const 16 - i32.shl - call $~lib/rt/tlsf/addMemory - drop - local.get $0 - global.set $~lib/rt/tlsf/ROOT - end - local.get $0 - ) - (func $~lib/rt/tlsf/prepareSize (param $0 i32) (result i32) - (local $1 i32) - (local $2 i32) - local.get $0 - i32.const 1073741808 - i32.ge_u - if - i32.const 80 - i32.const 32 - i32.const 461 - i32.const 30 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 15 - i32.add - i32.const 15 - i32.const -1 - i32.xor - i32.and - local.tee $1 - i32.const 16 - local.tee $2 - local.get $1 - local.get $2 - i32.gt_u - select - ) - (func $~lib/rt/tlsf/searchBlock (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - (local $8 i32) - (local $9 i32) - local.get $1 - i32.const 256 - i32.lt_u - if - i32.const 0 - local.set $2 - local.get $1 - i32.const 4 - i32.shr_u - local.set $3 - else - local.get $1 - i32.const 536870904 - i32.lt_u - if (result i32) - local.get $1 - i32.const 1 - i32.const 27 - local.get $1 - i32.clz - i32.sub - i32.shl - i32.add - i32.const 1 - i32.sub - else - local.get $1 - end - local.set $4 - i32.const 31 - local.get $4 - i32.clz - i32.sub - local.set $2 - local.get $4 - local.get $2 - i32.const 4 - i32.sub - i32.shr_u - i32.const 1 - i32.const 4 - i32.shl - i32.xor - local.set $3 - local.get $2 - i32.const 8 - i32.const 1 - i32.sub - i32.sub - local.set $2 - end - i32.const 1 - drop - local.get $2 - i32.const 23 - i32.lt_u - if (result i32) - local.get $3 - i32.const 16 - i32.lt_u - else - i32.const 0 - end - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 338 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $5 - local.get $2 - local.set $4 - local.get $5 - local.get $4 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - i32.const 0 - i32.const -1 - i32.xor - local.get $3 - i32.shl - i32.and - local.set $6 - i32.const 0 - local.set $7 - local.get $6 - i32.eqz - if - local.get $0 - i32.load - i32.const 0 - i32.const -1 - i32.xor - local.get $2 - i32.const 1 - i32.add - i32.shl - i32.and - local.set $5 - local.get $5 - i32.eqz - if - i32.const 0 - local.set $7 - else - local.get $5 - i32.ctz - local.set $2 - local.get $0 - local.set $8 - local.get $2 - local.set $4 - local.get $8 - local.get $4 - i32.const 2 - i32.shl - i32.add - i32.load offset=4 - local.set $6 - i32.const 1 - drop - local.get $6 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 351 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.set $9 - local.get $2 - local.set $8 - local.get $6 - i32.ctz - local.set $4 - local.get $9 - local.get $8 - i32.const 4 - i32.shl - local.get $4 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $7 - end - else - local.get $0 - local.set $9 - local.get $2 - local.set $8 - local.get $6 - i32.ctz - local.set $4 - local.get $9 - local.get $8 - i32.const 4 - i32.shl - local.get $4 - i32.add - i32.const 2 - i32.shl - i32.add - i32.load offset=96 - local.set $7 - end - local.get $7 - ) - (func $~lib/rt/tlsf/growMemory (param $0 i32) (param $1 i32) - (local $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - (local $6 i32) - (local $7 i32) - i32.const 0 - drop - local.get $1 - i32.const 536870904 - i32.lt_u - if - local.get $1 - i32.const 1 - i32.const 27 - local.get $1 - i32.clz - i32.sub - i32.shl - i32.const 1 - i32.sub - i32.add - local.set $1 - end - memory.size - local.set $2 - local.get $1 - i32.const 16 - local.get $2 - i32.const 16 - i32.shl - i32.const 16 - i32.sub - local.get $0 - local.set $3 - local.get $3 - i32.load offset=1568 - i32.ne - i32.shl - i32.add - local.set $1 - local.get $1 - i32.const 65535 - i32.add - i32.const 65535 - i32.const -1 - i32.xor - i32.and - i32.const 16 - i32.shr_u - local.set $4 - local.get $2 - local.tee $3 - local.get $4 - local.tee $5 - local.get $3 - local.get $5 - i32.gt_s - select - local.set $6 - local.get $6 - memory.grow - i32.const 0 - i32.lt_s - if - local.get $4 - memory.grow - i32.const 0 - i32.lt_s - if - unreachable - end - end - memory.size - local.set $7 - local.get $0 - local.get $2 - i32.const 16 - i32.shl - local.get $7 - i32.const 16 - i32.shl - call $~lib/rt/tlsf/addMemory - drop - ) - (func $~lib/rt/tlsf/prepareBlock (param $0 i32) (param $1 i32) (param $2 i32) - (local $3 i32) - (local $4 i32) - (local $5 i32) - local.get $1 - i32.load - local.set $3 - i32.const 1 - drop - local.get $2 - i32.const 15 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 365 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $3 - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.get $2 - i32.sub - local.set $4 - local.get $4 - i32.const 16 - i32.const 16 - i32.add - i32.ge_u - if - local.get $1 - local.get $2 - local.get $3 - i32.const 2 - i32.and - i32.or - i32.store - local.get $1 - i32.const 16 - i32.add - local.get $2 - i32.add - local.set $5 - local.get $5 - local.get $4 - i32.const 16 - i32.sub - i32.const 1 - i32.or - i32.store - local.get $0 - local.get $5 - call $~lib/rt/tlsf/insertBlock - else - local.get $1 - local.get $3 - i32.const 1 - i32.const -1 - i32.xor - i32.and - i32.store - local.get $1 - local.set $5 - local.get $5 - i32.const 16 - i32.add - local.get $5 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - local.get $1 - local.set $5 - local.get $5 - i32.const 16 - i32.add - local.get $5 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - i32.add - i32.load - i32.const 2 - i32.const -1 - i32.xor - i32.and - i32.store - end - ) - (func $~lib/rt/tlsf/allocateBlock (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (local $3 i32) - (local $4 i32) - i32.const 1 - drop - global.get $~lib/rt/tlsf/collectLock - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 500 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $1 - call $~lib/rt/tlsf/prepareSize - local.set $3 - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - local.get $4 - i32.eqz - if - global.get $~lib/gc/gc.auto - if - i32.const 1 - drop - i32.const 1 - global.set $~lib/rt/tlsf/collectLock - call $~lib/rt/pure/__collect - i32.const 1 - drop - i32.const 0 - global.set $~lib/rt/tlsf/collectLock - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - local.get $4 - i32.eqz - if - local.get $0 - local.get $3 - call $~lib/rt/tlsf/growMemory - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - i32.const 1 - drop - local.get $4 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 512 - i32.const 20 - call $~lib/builtins/abort - unreachable - end - end - else - local.get $0 - local.get $3 - call $~lib/rt/tlsf/growMemory - local.get $0 - local.get $3 - call $~lib/rt/tlsf/searchBlock - local.set $4 - i32.const 1 - drop - local.get $4 - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 517 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - end - end - i32.const 1 - drop - local.get $4 - i32.load - i32.const 3 - i32.const -1 - i32.xor - i32.and - local.get $3 - i32.ge_u - i32.eqz - if - i32.const 0 - i32.const 32 - i32.const 520 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $4 - i32.const 0 - i32.store offset=4 - local.get $4 - local.get $2 - i32.store offset=8 - local.get $4 - local.get $1 - i32.store offset=12 - local.get $0 - local.get $4 - call $~lib/rt/tlsf/removeBlock - local.get $0 - local.get $4 - local.get $3 - call $~lib/rt/tlsf/prepareBlock - i32.const 0 - drop - local.get $4 - ) - (func $~lib/rt/tlsf/__alloc (param $0 i32) (param $1 i32) (result i32) - call $~lib/rt/tlsf/maybeInitialize - local.get $0 - local.get $1 - call $~lib/rt/tlsf/allocateBlock - i32.const 16 - i32.add - ) - (func $~lib/rt/pure/increment (param $0 i32) - (local $1 i32) - local.get $0 - i32.load offset=4 - local.set $1 - local.get $1 - i32.const 268435455 - i32.const -1 - i32.xor - i32.and - local.get $1 - i32.const 1 - i32.add - i32.const 268435455 - i32.const -1 - i32.xor - i32.and - i32.eq - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 109 - i32.const 3 - call $~lib/builtins/abort - unreachable - end - local.get $0 - local.get $1 - i32.const 1 - i32.add - i32.store offset=4 - i32.const 0 - drop - i32.const 1 - drop - local.get $0 - i32.load - i32.const 1 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 112 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - ) - (func $~lib/rt/pure/__retain (param $0 i32) (result i32) - local.get $0 - global.get $~lib/heap/__heap_base - i32.gt_u - if - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/increment - end - local.get $0 - ) - (func $~lib/rt/pure/__release (param $0 i32) - local.get $0 - global.get $~lib/heap/__heap_base - i32.gt_u - if - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/decrement - end - ) - (func $start:assembly/index - i32.const 1 - i32.const 1 - i32.eq - drop - i32.const 2 - i32.const 2 - i32.eq - drop - i32.const 3 - i32.const 3 - i32.eq - drop - ) - (func $~start - global.get $~started - if - return - else - i32.const 1 - global.set $~started - end - call $start:assembly/index - ) - (func $~lib/rt/pure/__collect - i32.const 1 - drop - return - ) - (func $~lib/rt/tlsf/freeBlock (param $0 i32) (param $1 i32) - (local $2 i32) - local.get $1 - i32.load - local.set $2 - local.get $1 - local.get $2 - i32.const 1 - i32.or - i32.store - local.get $0 - local.get $1 - call $~lib/rt/tlsf/insertBlock - i32.const 0 - drop - ) - (func $~lib/rt/pure/finalize (param $0 i32) - i32.const 0 - drop - global.get $~lib/rt/tlsf/ROOT - local.get $0 - call $~lib/rt/tlsf/freeBlock - ) - (func $~lib/rt/pure/decrement (param $0 i32) - (local $1 i32) - (local $2 i32) - local.get $0 - i32.load offset=4 - local.set $1 - local.get $1 - i32.const 268435455 - i32.and - local.set $2 - i32.const 0 - drop - i32.const 1 - drop - local.get $0 - i32.load - i32.const 1 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 122 - i32.const 14 - call $~lib/builtins/abort - unreachable - end - local.get $2 - i32.const 1 - i32.eq - if - local.get $0 - i32.const 16 - i32.add - i32.const 1 - call $~lib/rt/__visit_members - i32.const 1 - drop - i32.const 1 - drop - local.get $1 - i32.const -2147483648 - i32.and - i32.eqz - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 126 - i32.const 18 - call $~lib/builtins/abort - unreachable - end - local.get $0 - call $~lib/rt/pure/finalize - else - i32.const 1 - drop - local.get $2 - i32.const 0 - i32.gt_u - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 136 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - drop - local.get $0 - local.get $1 - i32.const 268435455 - i32.const -1 - i32.xor - i32.and - local.get $2 - i32.const 1 - i32.sub - i32.or - i32.store offset=4 - end - ) - (func $~lib/rt/pure/__visit (param $0 i32) (param $1 i32) - local.get $0 - global.get $~lib/heap/__heap_base - i32.lt_u - if - return - end - i32.const 1 - drop - i32.const 1 - drop - local.get $1 - i32.const 1 - i32.eq - i32.eqz - if - i32.const 0 - i32.const 144 - i32.const 69 - i32.const 16 - call $~lib/builtins/abort - unreachable - end - local.get $0 - i32.const 16 - i32.sub - call $~lib/rt/pure/decrement - ) - (func $~lib/rt/__visit_members (param $0 i32) (param $1 i32) - (local $2 i32) - block $switch$1$default - block $switch$1$case$4 - block $switch$1$case$2 - local.get $0 - i32.const 8 - i32.sub - i32.load - br_table $switch$1$case$2 $switch$1$case$2 $switch$1$case$4 $switch$1$default - end - return - end - local.get $0 - i32.load - local.tee $2 - if - local.get $2 - local.get $1 - call $~lib/rt/pure/__visit - end - return - end - unreachable - ) -) From 3ad6d88445892004a2332f813dec8a1b55c7c0db Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Mon, 13 Jul 2020 14:18:25 -0400 Subject: [PATCH 37/58] Whoops --- tests/asconfig/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/asconfig/package.json b/tests/asconfig/package.json index 4a366aeed2..197a54f61f 100644 --- a/tests/asconfig/package.json +++ b/tests/asconfig/package.json @@ -4,7 +4,7 @@ "test": "npm run test:use-consts && npm run test:target && npm run test:entry-points && npm run test:flags", "test:use-consts": "cd use-consts && npm run test", "test:entry-points": "cd entry-points && npm run test", - "test:flags": "cd flags && nWpm run test", + "test:flags": "cd flags && npm run test", "test:respect-inheritence": "cd respect-inheritence && npm run test", "test:target": "cd target && npm run test", "test:cyclical": "cd cyclical && npm run test" From ca18d6265a3867808484773f36e54a19fc217779 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Mon, 13 Jul 2020 14:20:05 -0400 Subject: [PATCH 38/58] make tests pass. What's next? --- tests/asconfig/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/asconfig/index.js b/tests/asconfig/index.js index a6549cb5ca..c3564e79c0 100644 --- a/tests/asconfig/index.js +++ b/tests/asconfig/index.js @@ -6,9 +6,8 @@ const path = require("path"); /** @type {Uint8Array} */ let binary; -/** @type {Uint8Array} */ -let wat; -asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--explicitStart", ...args], { +// Output watfile to reduce stdout output +asc.main(["assembly/index.ts", "--textFile", "output.wat", "--outFile", "output.wasm", "--explicitStart", ...args], { writeFile(name, contents) { if (name === "output.wasm") { binary = contents; From 7f25365e3cc534240d7c00e7af87f296a563ce80 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Mon, 13 Jul 2020 14:24:05 -0400 Subject: [PATCH 39/58] linting issues --- tests/asconfig/index.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/asconfig/index.js b/tests/asconfig/index.js index c3564e79c0..94fa5cb0bd 100644 --- a/tests/asconfig/index.js +++ b/tests/asconfig/index.js @@ -1,8 +1,6 @@ const asc = require("../../cli/asc"); const loader = require("../../lib/loader"); const args = process.argv.slice(2); -const fs = require("fs"); -const path = require("path"); /** @type {Uint8Array} */ let binary; From dc555186e5860fb82071e7101693d5a1476d267a Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Mon, 13 Jul 2020 14:24:36 -0400 Subject: [PATCH 40/58] linting issues --- tests/asconfig/index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/asconfig/index.js b/tests/asconfig/index.js index 94fa5cb0bd..4eb2630678 100644 --- a/tests/asconfig/index.js +++ b/tests/asconfig/index.js @@ -10,9 +10,6 @@ asc.main(["assembly/index.ts", "--textFile", "output.wat", "--outFile", "output. if (name === "output.wasm") { binary = contents; } - if (name === "output.wat") { - wat = contents; - } } }, (err) => { if (err) { From cbcb88e7f84d7d7a0dbb165d47fcc29a395dd024 Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Mon, 13 Jul 2020 17:42:36 -0400 Subject: [PATCH 41/58] Add showConfig to print out config and exit --- cli/asc.js | 7 +++++++ cli/asc.json | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/cli/asc.js b/cli/asc.js index 2d75e0da1f..0b0b8a20fb 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -333,6 +333,13 @@ exports.main = function main(argv, options, callback) { } } + // If showConfig print args and exit + if (args.showConfig) { + // FIXME: not a proper C-like API + stderr.write(JSON.stringify(args, null, 2)); + return callback(null); + } + // This method resolves a path relative to the baseDir instead of process.cwd() function resolve(arg) { if (path.isAbsolute(arg)) return arg; diff --git a/cli/asc.json b/cli/asc.json index bf89988da8..6e7021d53e 100644 --- a/cli/asc.json +++ b/cli/asc.json @@ -300,6 +300,11 @@ "type": "b", "default": false }, + "showConfig": { + "description": "Print out compiler configuration and not emit code.", + "type": "b", + "default": false + }, "measure": { "description": "Prints measuring information on I/O and compile times.", "type": "b", From 9e358920c6e13294f8fbf523dcc7e910f138223b Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Mon, 13 Jul 2020 23:48:54 -0400 Subject: [PATCH 42/58] fix linting issue with indentation? really? --- tests/asconfig/entry-points/assembly/globals.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/asconfig/entry-points/assembly/globals.ts b/tests/asconfig/entry-points/assembly/globals.ts index 15cd47228a..c6ad6d6e43 100644 --- a/tests/asconfig/entry-points/assembly/globals.ts +++ b/tests/asconfig/entry-points/assembly/globals.ts @@ -1,4 +1,3 @@ - - @global -const answerToLife = 42; \ No newline at end of file + const answerToLife = 42; +assert(answerToLife); From 42703a1c95f90388439de4eebbe2fd875942ba3c Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Tue, 14 Jul 2020 18:30:18 -0400 Subject: [PATCH 43/58] remove watfile output, it's a bug, add complicated test --- tests/asconfig/complicated/asconfig.json | 16 ++ tests/asconfig/complicated/assembly/index.ts | 178 +++++++++++++++++++ tests/asconfig/complicated/package.json | 6 + tests/asconfig/index.js | 2 +- 4 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 tests/asconfig/complicated/asconfig.json create mode 100644 tests/asconfig/complicated/assembly/index.ts create mode 100644 tests/asconfig/complicated/package.json diff --git a/tests/asconfig/complicated/asconfig.json b/tests/asconfig/complicated/asconfig.json new file mode 100644 index 0000000000..cf6ca01952 --- /dev/null +++ b/tests/asconfig/complicated/asconfig.json @@ -0,0 +1,16 @@ +{ + "targets": { + "release": { + "shrinkLevel": 1, + "optimizeLevel": 3, + "runtime": "stub", + "initialMemory": 30, + "explicitStart": true, + "measure": true, + "pedantic": true + } + }, + "options": { + "enable": ["simd"] + } +} \ No newline at end of file diff --git a/tests/asconfig/complicated/assembly/index.ts b/tests/asconfig/complicated/assembly/index.ts new file mode 100644 index 0000000000..c5383a2555 --- /dev/null +++ b/tests/asconfig/complicated/assembly/index.ts @@ -0,0 +1,178 @@ +const siphashptr = memory.data(sizeof()); + +export namespace SipHash { + export function hash(key: ArrayBuffer, m: usize, offset: usize): u64 { + let keyPtr = changetype(key); + let k0 = load(keyPtr); + let k1 = load(keyPtr + 8); + let v0 = k0; + let v2 = k0; + let v1 = k1; + let v3 = k1; + let ml = offset; + let m17: isize = ml - 7; + let buf = siphashptr; + + v0 ^= 0x736f6d6570736575; + v1 ^= 0x646f72616e646f6d; + v2 ^= 0x6c7967656e657261; + v3 ^= 0x7465646279746573; + + let mp: isize = 0; + while (mp < m17) { + let mi = load(m + mp); + v3 ^= mi; + + // compression algorithm + v0 += v1; + v2 += v3; + v1 = rotl(v1, 13); + v3 = rotl(v3, 16); + v1 ^= v0; + v3 ^= v2; + v0 = rotl(v0, 32); + v2 += v1; + v0 += v3; + v1 = rotl(v1, 17); + v3 = rotl(v3, 21); + v1 ^= v2; + v3 ^= v0; + v2 = rotl(v2, 32); + + // compression algorithm + v0 += v1; + v2 += v3; + v1 = rotl(v1, 13); + v3 = rotl(v3, 16); + v1 ^= v0; + v3 ^= v2; + v0 = rotl(v0, 32); + v2 += v1; + v0 += v3; + v1 = rotl(v1, 17); + v3 = rotl(v3, 21); + v1 ^= v2; + v3 ^= v0; + v2 = rotl(v2, 32); + + v0 ^= mi; + + mp += 8; + } + + store(buf, ml, 7); + + let ic: usize = 0; + while (mp < ml) { + store(buf + (ic++), load(m + (mp++))); + } + + while (ic < 7) { + store(buf + (ic++), 0); + } + let mil = load(buf); + + v3 ^= mil; + + // compression algorithm + v0 += v1; + v2 += v3; + v1 = rotl(v1, 13); + v3 = rotl(v3, 16); + v1 ^= v0; + v3 ^= v2; + v0 = rotl(v0, 32); + v2 += v1; + v0 += v3; + v1 = rotl(v1, 17); + v3 = rotl(v3, 21); + v1 ^= v2; + v3 ^= v0; + v2 = rotl(v2, 32); + + // compression algorithm + v0 += v1; + v2 += v3; + v1 = rotl(v1, 13); + v3 = rotl(v3, 16); + v1 ^= v0; + v3 ^= v2; + v0 = rotl(v0, 32); + v2 += v1; + v0 += v3; + v1 = rotl(v1, 17); + v3 = rotl(v3, 21); + v1 ^= v2; + v3 ^= v0; + v2 = rotl(v2, 32); + + v0 ^= mil; + v2 ^= 0xff; + + // compression algorithm + v0 += v1; + v2 += v3; + v1 = rotl(v1, 13); + v3 = rotl(v3, 16); + v1 ^= v0; + v3 ^= v2; + v0 = rotl(v0, 32); + v2 += v1; + v0 += v3; + v1 = rotl(v1, 17); + v3 = rotl(v3, 21); + v1 ^= v2; + v3 ^= v0; + v2 = rotl(v2, 32); + + // compression algorithm + v0 += v1; + v2 += v3; + v1 = rotl(v1, 13); + v3 = rotl(v3, 16); + v1 ^= v0; + v3 ^= v2; + v0 = rotl(v0, 32); + v2 += v1; + v0 += v3; + v1 = rotl(v1, 17); + v3 = rotl(v3, 21); + v1 ^= v2; + v3 ^= v0; + v2 = rotl(v2, 32); + + // compression algorithm + v0 += v1; + v2 += v3; + v1 = rotl(v1, 13); + v3 = rotl(v3, 16); + v1 ^= v0; + v3 ^= v2; + v0 = rotl(v0, 32); + v2 += v1; + v0 += v3; + v1 = rotl(v1, 17); + v3 = rotl(v3, 21); + v1 ^= v2; + v3 ^= v0; + v2 = rotl(v2, 32); + + // compression algorithm + v0 += v1; + v2 += v3; + v1 = rotl(v1, 13); + v3 = rotl(v3, 16); + v1 ^= v0; + v3 ^= v2; + v0 = rotl(v0, 32); + v2 += v1; + v0 += v3; + v1 = rotl(v1, 17); + v3 = rotl(v3, 21); + v1 ^= v2; + v3 ^= v0; + v2 = rotl(v2, 32); + + return v0 ^ v1 ^ v2 ^ v3; + } +} \ No newline at end of file diff --git a/tests/asconfig/complicated/package.json b/tests/asconfig/complicated/package.json new file mode 100644 index 0000000000..f98424bae9 --- /dev/null +++ b/tests/asconfig/complicated/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "scripts": { + "test": "node ../index.js" + } +} diff --git a/tests/asconfig/index.js b/tests/asconfig/index.js index 4eb2630678..2633af19fc 100644 --- a/tests/asconfig/index.js +++ b/tests/asconfig/index.js @@ -5,7 +5,7 @@ const args = process.argv.slice(2); /** @type {Uint8Array} */ let binary; // Output watfile to reduce stdout output -asc.main(["assembly/index.ts", "--textFile", "output.wat", "--outFile", "output.wasm", "--explicitStart", ...args], { +asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--explicitStart", ...args], { writeFile(name, contents) { if (name === "output.wasm") { binary = contents; From 0f1803d80dd8fd8ada5be533c6f5a11f3b691a13 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Tue, 14 Jul 2020 18:34:49 -0400 Subject: [PATCH 44/58] add complicated test --- tests/asconfig/index.js | 1 - tests/asconfig/package.json | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/asconfig/index.js b/tests/asconfig/index.js index 2633af19fc..6519ef1300 100644 --- a/tests/asconfig/index.js +++ b/tests/asconfig/index.js @@ -4,7 +4,6 @@ const args = process.argv.slice(2); /** @type {Uint8Array} */ let binary; -// Output watfile to reduce stdout output asc.main(["assembly/index.ts", "--outFile", "output.wasm", "--explicitStart", ...args], { writeFile(name, contents) { if (name === "output.wasm") { diff --git a/tests/asconfig/package.json b/tests/asconfig/package.json index 197a54f61f..d7ac30f4f3 100644 --- a/tests/asconfig/package.json +++ b/tests/asconfig/package.json @@ -1,12 +1,13 @@ { "private": true, "scripts": { - "test": "npm run test:use-consts && npm run test:target && npm run test:entry-points && npm run test:flags", + "test": "npm run test:use-consts && npm run test:target && npm run test:entry-points && npm run test:flags && npm run test:complicated", "test:use-consts": "cd use-consts && npm run test", "test:entry-points": "cd entry-points && npm run test", "test:flags": "cd flags && npm run test", "test:respect-inheritence": "cd respect-inheritence && npm run test", "test:target": "cd target && npm run test", - "test:cyclical": "cd cyclical && npm run test" + "test:cyclical": "cd cyclical && npm run test", + "test:complicated": "cd complicated && npm run test" } } From b177e9488326223db70a0b0c4bd63f51ca2d9d49 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Tue, 14 Jul 2020 18:52:41 -0400 Subject: [PATCH 45/58] check memory size here, switch args merge order --- cli/asc.js | 2 +- tests/asconfig/complicated/asconfig.json | 1 + tests/asconfig/complicated/assembly/index.ts | 184 +------------------ 3 files changed, 8 insertions(+), 179 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index 2d75e0da1f..ec12e66a11 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -298,7 +298,7 @@ exports.main = function main(argv, options, callback) { return p; }); } - args = optionsUtil.merge(exports.options, asconfig.options, args); + args = optionsUtil.merge(exports.options, args, asconfig.options); } // entries are added to the compilation diff --git a/tests/asconfig/complicated/asconfig.json b/tests/asconfig/complicated/asconfig.json index cf6ca01952..6b6e4c0eac 100644 --- a/tests/asconfig/complicated/asconfig.json +++ b/tests/asconfig/complicated/asconfig.json @@ -11,6 +11,7 @@ } }, "options": { + "initialMemory": 100, "enable": ["simd"] } } \ No newline at end of file diff --git a/tests/asconfig/complicated/assembly/index.ts b/tests/asconfig/complicated/assembly/index.ts index c5383a2555..ae67e9d6f5 100644 --- a/tests/asconfig/complicated/assembly/index.ts +++ b/tests/asconfig/complicated/assembly/index.ts @@ -1,178 +1,6 @@ -const siphashptr = memory.data(sizeof()); - -export namespace SipHash { - export function hash(key: ArrayBuffer, m: usize, offset: usize): u64 { - let keyPtr = changetype(key); - let k0 = load(keyPtr); - let k1 = load(keyPtr + 8); - let v0 = k0; - let v2 = k0; - let v1 = k1; - let v3 = k1; - let ml = offset; - let m17: isize = ml - 7; - let buf = siphashptr; - - v0 ^= 0x736f6d6570736575; - v1 ^= 0x646f72616e646f6d; - v2 ^= 0x6c7967656e657261; - v3 ^= 0x7465646279746573; - - let mp: isize = 0; - while (mp < m17) { - let mi = load(m + mp); - v3 ^= mi; - - // compression algorithm - v0 += v1; - v2 += v3; - v1 = rotl(v1, 13); - v3 = rotl(v3, 16); - v1 ^= v0; - v3 ^= v2; - v0 = rotl(v0, 32); - v2 += v1; - v0 += v3; - v1 = rotl(v1, 17); - v3 = rotl(v3, 21); - v1 ^= v2; - v3 ^= v0; - v2 = rotl(v2, 32); - - // compression algorithm - v0 += v1; - v2 += v3; - v1 = rotl(v1, 13); - v3 = rotl(v3, 16); - v1 ^= v0; - v3 ^= v2; - v0 = rotl(v0, 32); - v2 += v1; - v0 += v3; - v1 = rotl(v1, 17); - v3 = rotl(v3, 21); - v1 ^= v2; - v3 ^= v0; - v2 = rotl(v2, 32); - - v0 ^= mi; - - mp += 8; - } - - store(buf, ml, 7); - - let ic: usize = 0; - while (mp < ml) { - store(buf + (ic++), load(m + (mp++))); - } - - while (ic < 7) { - store(buf + (ic++), 0); - } - let mil = load(buf); - - v3 ^= mil; - - // compression algorithm - v0 += v1; - v2 += v3; - v1 = rotl(v1, 13); - v3 = rotl(v3, 16); - v1 ^= v0; - v3 ^= v2; - v0 = rotl(v0, 32); - v2 += v1; - v0 += v3; - v1 = rotl(v1, 17); - v3 = rotl(v3, 21); - v1 ^= v2; - v3 ^= v0; - v2 = rotl(v2, 32); - - // compression algorithm - v0 += v1; - v2 += v3; - v1 = rotl(v1, 13); - v3 = rotl(v3, 16); - v1 ^= v0; - v3 ^= v2; - v0 = rotl(v0, 32); - v2 += v1; - v0 += v3; - v1 = rotl(v1, 17); - v3 = rotl(v3, 21); - v1 ^= v2; - v3 ^= v0; - v2 = rotl(v2, 32); - - v0 ^= mil; - v2 ^= 0xff; - - // compression algorithm - v0 += v1; - v2 += v3; - v1 = rotl(v1, 13); - v3 = rotl(v3, 16); - v1 ^= v0; - v3 ^= v2; - v0 = rotl(v0, 32); - v2 += v1; - v0 += v3; - v1 = rotl(v1, 17); - v3 = rotl(v3, 21); - v1 ^= v2; - v3 ^= v0; - v2 = rotl(v2, 32); - - // compression algorithm - v0 += v1; - v2 += v3; - v1 = rotl(v1, 13); - v3 = rotl(v3, 16); - v1 ^= v0; - v3 ^= v2; - v0 = rotl(v0, 32); - v2 += v1; - v0 += v3; - v1 = rotl(v1, 17); - v3 = rotl(v3, 21); - v1 ^= v2; - v3 ^= v0; - v2 = rotl(v2, 32); - - // compression algorithm - v0 += v1; - v2 += v3; - v1 = rotl(v1, 13); - v3 = rotl(v3, 16); - v1 ^= v0; - v3 ^= v2; - v0 = rotl(v0, 32); - v2 += v1; - v0 += v3; - v1 = rotl(v1, 17); - v3 = rotl(v3, 21); - v1 ^= v2; - v3 ^= v0; - v2 = rotl(v2, 32); - - // compression algorithm - v0 += v1; - v2 += v3; - v1 = rotl(v1, 13); - v3 = rotl(v3, 16); - v1 ^= v0; - v3 ^= v2; - v0 = rotl(v0, 32); - v2 += v1; - v0 += v3; - v1 = rotl(v1, 17); - v3 = rotl(v3, 21); - v1 ^= v2; - v3 ^= v0; - v2 = rotl(v2, 32); - - return v0 ^ v1 ^ v2 ^ v3; - } -} \ No newline at end of file +assert(ASC_OPTIMIZE_LEVEL == 3); +assert(ASC_SHRINK_LEVEL == 1); +assert(ASC_FEATURE_SIMD); +let size = memory.size(); +trace("size", 1, size); +assert(size == 30); From 249557833c836cf3159d48a99d465ecde4c28d05 Mon Sep 17 00:00:00 2001 From: jtenner Date: Wed, 15 Jul 2020 14:42:46 -0400 Subject: [PATCH 46/58] Update cli/asc.js Co-authored-by: Willem Wyndham --- cli/asc.js | 1 - 1 file changed, 1 deletion(-) diff --git a/cli/asc.js b/cli/asc.js index 89a1a61f05..6cf402a965 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -335,7 +335,6 @@ exports.main = function main(argv, options, callback) { // If showConfig print args and exit if (args.showConfig) { - // FIXME: not a proper C-like API stderr.write(JSON.stringify(args, null, 2)); return callback(null); } From ad7d24ae4afc5693b36278f831ef700b33f09913 Mon Sep 17 00:00:00 2001 From: jtenner Date: Wed, 15 Jul 2020 15:09:37 -0400 Subject: [PATCH 47/58] Update cli/asc.json Co-authored-by: Daniel Wirtz --- cli/asc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.json b/cli/asc.json index 6e7021d53e..9299b86bdf 100644 --- a/cli/asc.json +++ b/cli/asc.json @@ -19,7 +19,7 @@ }, "config": { "category": "General", - "description": "Configuration file to apply. CLI arguments take precedence.", + "description": "Configuration file to apply. CLI arguments take precedence.", "type": "s", "default": "asconfig.json" }, From 9e4aebf17b1d824ebd215ed3508331eb2726c044 Mon Sep 17 00:00:00 2001 From: jtenner Date: Wed, 15 Jul 2020 15:10:01 -0400 Subject: [PATCH 48/58] Update bin/asinit Co-authored-by: Daniel Wirtz --- bin/asinit | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bin/asinit b/bin/asinit index f974831b2d..a7ec65259a 100755 --- a/bin/asinit +++ b/bin/asinit @@ -237,9 +237,7 @@ function ensureAsconfigJson() { }, null, 2)); console.log(colors.green(" Created: ") + tsconfigFile); } else { - // TODO: What to do here? - // const asconfig = JSON.parse(fs.readFileSync(asconfigFile, "utf-8")); - console.log(colors.green(" Ignored: ") + asconfigFile); + console.log(colors.yellow(" Exists: ") + asconfigFile); } console.log(); } From debc2fcadd7e1a2815356989a089b928103c4802 Mon Sep 17 00:00:00 2001 From: jtenner Date: Wed, 15 Jul 2020 15:10:16 -0400 Subject: [PATCH 49/58] Update bin/asinit Co-authored-by: Daniel Wirtz --- bin/asinit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/asinit b/bin/asinit index a7ec65259a..d2124e52d2 100755 --- a/bin/asinit +++ b/bin/asinit @@ -235,7 +235,7 @@ function ensureAsconfigJson() { }, options: {} }, null, 2)); - console.log(colors.green(" Created: ") + tsconfigFile); + console.log(colors.green(" Created: ") + asconfigFile); } else { console.log(colors.yellow(" Exists: ") + asconfigFile); } From 00e9b27a971195583bf50083c6537d21a58fd8bb Mon Sep 17 00:00:00 2001 From: jtenner Date: Wed, 15 Jul 2020 15:10:32 -0400 Subject: [PATCH 50/58] Update cli/asc.json Co-authored-by: Daniel Wirtz --- cli/asc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.json b/cli/asc.json index 9299b86bdf..53974fd3b3 100644 --- a/cli/asc.json +++ b/cli/asc.json @@ -301,7 +301,7 @@ "default": false }, "showConfig": { - "description": "Print out compiler configuration and not emit code.", + "description": "Print computed compiler options and exit.", "type": "b", "default": false }, From d304b36b650d59ca9fc51b12f28ce67e60b1b605 Mon Sep 17 00:00:00 2001 From: jtenner Date: Wed, 15 Jul 2020 15:10:42 -0400 Subject: [PATCH 51/58] Update tests/asconfig/entry-points/nested/assembly/index.ts Co-authored-by: Daniel Wirtz --- tests/asconfig/entry-points/nested/assembly/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/asconfig/entry-points/nested/assembly/index.ts b/tests/asconfig/entry-points/nested/assembly/index.ts index 8d57706af7..48b64eeb05 100644 --- a/tests/asconfig/entry-points/nested/assembly/index.ts +++ b/tests/asconfig/entry-points/nested/assembly/index.ts @@ -1,2 +1 @@ - assert(answerToLife == 42); From 16bfe42f3887a9e7291bd5458c8c9a1ba73e4557 Mon Sep 17 00:00:00 2001 From: jtenner Date: Wed, 15 Jul 2020 15:13:52 -0400 Subject: [PATCH 52/58] Update bin/asinit Co-authored-by: Daniel Wirtz --- bin/asinit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/asinit b/bin/asinit index d2124e52d2..dd7df60031 100755 --- a/bin/asinit +++ b/bin/asinit @@ -86,7 +86,7 @@ console.log([ " Example test to check that your module is indeed working.", "", colors.cyan(" ./asconfig.json"), - " Main configuration file that defines a debug and release target for your project.", + " Configuration file defining both a 'debug' and a 'release' target.", "", colors.cyan(" ./package.json"), " Package info containing the necessary commands to compile to WebAssembly.", From bc243912ba025a3d94a710bedf18aaf2af1f94f9 Mon Sep 17 00:00:00 2001 From: jtenner Date: Wed, 15 Jul 2020 15:14:58 -0400 Subject: [PATCH 53/58] Update cli/asc.js Co-authored-by: Daniel Wirtz --- cli/asc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.js b/cli/asc.js index 6cf402a965..67b3d41f5c 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -492,7 +492,7 @@ exports.main = function main(argv, options, callback) { let lib = args.lib; if (typeof lib === "string") lib = lib.trim().split(/\s*,\s*/); customLibDirs.push(...lib.map(resolve)); - customLibDirs = unique(customLibDirs); // because `lib` and `customLibDirs` could potentially has duplicates + customLibDirs = unique(customLibDirs); // `lib` and `customLibDirs` may include duplicates for (let i = 0, k = customLibDirs.length; i < k; ++i) { // custom let libDir = customLibDirs[i]; let libFiles; From 27656af9cf282e52780380451c23a5ae2fef5a80 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Wed, 15 Jul 2020 15:18:01 -0400 Subject: [PATCH 54/58] remove flags --- tests/asconfig/entry-points/assembly/globals.ts | 4 ++-- tests/asconfig/flags/asconfig.json | 8 -------- tests/asconfig/flags/assembly/index.ts | 1 - tests/asconfig/flags/nested/asconfig.json | 3 --- tests/asconfig/flags/nested/assembly/index.ts | 1 - tests/asconfig/flags/nested/package.json | 6 ------ tests/asconfig/flags/package.json | 6 ------ tests/asconfig/package.json | 3 +-- 8 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 tests/asconfig/flags/asconfig.json delete mode 100644 tests/asconfig/flags/assembly/index.ts delete mode 100644 tests/asconfig/flags/nested/asconfig.json delete mode 100644 tests/asconfig/flags/nested/assembly/index.ts delete mode 100644 tests/asconfig/flags/nested/package.json delete mode 100644 tests/asconfig/flags/package.json diff --git a/tests/asconfig/entry-points/assembly/globals.ts b/tests/asconfig/entry-points/assembly/globals.ts index c6ad6d6e43..ef2ca6b2f9 100644 --- a/tests/asconfig/entry-points/assembly/globals.ts +++ b/tests/asconfig/entry-points/assembly/globals.ts @@ -1,3 +1,3 @@ -@global - const answerToLife = 42; +// @ts-ignore: decorator +@global const answerToLife = 42; assert(answerToLife); diff --git a/tests/asconfig/flags/asconfig.json b/tests/asconfig/flags/asconfig.json deleted file mode 100644 index 3b8e6b3955..0000000000 --- a/tests/asconfig/flags/asconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "targets": { - "release": {}, - "debug": { - "debug": true - } - } -} diff --git a/tests/asconfig/flags/assembly/index.ts b/tests/asconfig/flags/assembly/index.ts deleted file mode 100644 index 8b13789179..0000000000 --- a/tests/asconfig/flags/assembly/index.ts +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/asconfig/flags/nested/asconfig.json b/tests/asconfig/flags/nested/asconfig.json deleted file mode 100644 index 92d84fcc96..0000000000 --- a/tests/asconfig/flags/nested/asconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "../asconfig.json" -} diff --git a/tests/asconfig/flags/nested/assembly/index.ts b/tests/asconfig/flags/nested/assembly/index.ts deleted file mode 100644 index 8b13789179..0000000000 --- a/tests/asconfig/flags/nested/assembly/index.ts +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/asconfig/flags/nested/package.json b/tests/asconfig/flags/nested/package.json deleted file mode 100644 index 55c26da628..0000000000 --- a/tests/asconfig/flags/nested/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "scripts": { - "test": "node ../../index.js --target debug" - } -} diff --git a/tests/asconfig/flags/package.json b/tests/asconfig/flags/package.json deleted file mode 100644 index 117b4a2066..0000000000 --- a/tests/asconfig/flags/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "scripts": { - "test": "node ../index.js --target debug && cd nested && npm run test" - } -} diff --git a/tests/asconfig/package.json b/tests/asconfig/package.json index d7ac30f4f3..58789240bc 100644 --- a/tests/asconfig/package.json +++ b/tests/asconfig/package.json @@ -1,10 +1,9 @@ { "private": true, "scripts": { - "test": "npm run test:use-consts && npm run test:target && npm run test:entry-points && npm run test:flags && npm run test:complicated", + "test": "npm run test:use-consts && npm run test:target && npm run test:entry-points && npm run test:complicated", "test:use-consts": "cd use-consts && npm run test", "test:entry-points": "cd entry-points && npm run test", - "test:flags": "cd flags && npm run test", "test:respect-inheritence": "cd respect-inheritence && npm run test", "test:target": "cd target && npm run test", "test:cyclical": "cd cyclical && npm run test", From 8f5e8fb967a4859ea15d77dac2cb32cc659cd0a5 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Wed, 15 Jul 2020 15:19:54 -0400 Subject: [PATCH 55/58] add suggested target description --- cli/asc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.json b/cli/asc.json index 53974fd3b3..9b194d7861 100644 --- a/cli/asc.json +++ b/cli/asc.json @@ -25,7 +25,7 @@ }, "target": { "category": "General", - "description": "Configuration compile target profile to apply.", + "description": "Target configuration to use. Defaults to 'release'.", "type": "s", "default": "release" }, From 55135bc3a3f6cc47f2ed67db08bd87d9f12dcf99 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Wed, 15 Jul 2020 15:31:11 -0400 Subject: [PATCH 56/58] remove path.join because resolve performs concatenation already --- cli/asc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/asc.js b/cli/asc.js index 67b3d41f5c..d4c1f288a6 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -342,7 +342,7 @@ exports.main = function main(argv, options, callback) { // This method resolves a path relative to the baseDir instead of process.cwd() function resolve(arg) { if (path.isAbsolute(arg)) return arg; - return path.resolve(path.join(baseDir, arg)); + return path.resolve(baseDir, arg); } // create a unique set of values From 1b1fc19bfbaedf7905c6cdbef572192a59d88597 Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Wed, 15 Jul 2020 15:33:49 -0400 Subject: [PATCH 57/58] updated test to include 'optimize' flag --- bin/asinit | 3 +-- tests/asconfig/complicated/asconfig.json | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/bin/asinit b/bin/asinit index dd7df60031..557fc9c492 100755 --- a/bin/asinit +++ b/bin/asinit @@ -229,8 +229,7 @@ function ensureAsconfigJson() { binaryFile: "build/optimized.wasm", textFile: "build/optimized.wat", sourceMap: true, - optimizeLevel: 3, - shrinkLevel: 1, + optimize: true } }, options: {} diff --git a/tests/asconfig/complicated/asconfig.json b/tests/asconfig/complicated/asconfig.json index 6b6e4c0eac..8f622493dc 100644 --- a/tests/asconfig/complicated/asconfig.json +++ b/tests/asconfig/complicated/asconfig.json @@ -1,8 +1,7 @@ { "targets": { "release": { - "shrinkLevel": 1, - "optimizeLevel": 3, + "optimize": true, "runtime": "stub", "initialMemory": 30, "explicitStart": true, From 62caba38cabb5ced05eaf9da81bbe519bebca4ee Mon Sep 17 00:00:00 2001 From: Joshua Tenner Date: Wed, 15 Jul 2020 15:50:34 -0400 Subject: [PATCH 58/58] rename to resolveBasedir --- cli/asc.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cli/asc.js b/cli/asc.js index d4c1f288a6..c159a120cf 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -340,8 +340,7 @@ exports.main = function main(argv, options, callback) { } // This method resolves a path relative to the baseDir instead of process.cwd() - function resolve(arg) { - if (path.isAbsolute(arg)) return arg; + function resolveBasedir(arg) { return path.resolve(baseDir, arg); } @@ -355,7 +354,7 @@ exports.main = function main(argv, options, callback) { return path.relative(baseDir, arg); } // postprocess we need to get absolute file locations argv - argv = unique(argv.map(resolve)).map(makeRelative); + argv = unique(argv.map(resolveBasedir)).map(makeRelative); // Set up options const compilerOptions = assemblyscript.newOptions(); @@ -433,7 +432,7 @@ exports.main = function main(argv, options, callback) { const transforms = []; if (args.transform) { let tsNodeRegistered = false; - let transformArgs = unique(args.transform.map(resolve)); + let transformArgs = unique(args.transform.map(resolveBasedir)); for (let i = 0, k = transformArgs.length; i < k; ++i) { let filename = transformArgs[i].trim(); if (!tsNodeRegistered && filename.endsWith(".ts")) { // ts-node requires .ts specifically @@ -491,7 +490,7 @@ exports.main = function main(argv, options, callback) { if (args.lib) { let lib = args.lib; if (typeof lib === "string") lib = lib.trim().split(/\s*,\s*/); - customLibDirs.push(...lib.map(resolve)); + customLibDirs.push(...lib.map(resolveBasedir)); customLibDirs = unique(customLibDirs); // `lib` and `customLibDirs` may include duplicates for (let i = 0, k = customLibDirs.length; i < k; ++i) { // custom let libDir = customLibDirs[i];