diff --git a/lib/lint/base.json b/lib/lint/base.json index 86373db3..5fd658b4 100644 --- a/lib/lint/base.json +++ b/lib/lint/base.json @@ -90,11 +90,6 @@ "no-unsafe-any": { "severity": "error" }, - "no-unused-variable": { - "options": [{ - "ignore-pattern": "^_" - }] - }, "no-void-expression": { "severity": "error" }, diff --git a/lib/loader/README.md b/lib/loader/README.md index 46ddf180..cc4ebf6c 100644 --- a/lib/loader/README.md +++ b/lib/loader/README.md @@ -65,7 +65,7 @@ Instances are automatically populated with useful utility: ```js import "allocator/tlsf"; - export { allocate_memory, free_memory }; + export { memory }; ``` * **getString**(ptr: `number`): `string`
@@ -126,7 +126,7 @@ var str = "Hello world!"; var ptr = module.newString(str); // Disposing a string that is no longer needed (requires free_memory to be exported) -module.free_memory(ptr); +module.memory.free(ptr); // Obtaining a string, i.e. as returned by an export var ptrToString = ...; diff --git a/lib/loader/index.d.ts b/lib/loader/index.d.ts index 3bc09009..66076832 100644 --- a/lib/loader/index.d.ts +++ b/lib/loader/index.d.ts @@ -44,8 +44,8 @@ export declare function instantiate(module: WebAssembly.Module, im /** Instantiates an AssemblyScript module from a buffer using the specified imports. */ export declare function instantiateBuffer(buffer: Uint8Array, imports?: ImportsObject): ASUtil & T; -/** Instantiates an AssemblyScript module from a response using the sspecified imports. */ -export declare function instantiateStreaming(response: Response, imports?: ImportsObject): Promise; +/** Instantiates an AssemblyScript module from a response using the specified imports. */ +export declare function instantiateStreaming(result: Promise, imports?: ImportsObject): Promise; /** Demangles an AssemblyScript module's exports to a friendly object structure. */ export declare function demangle(exports: {}): T; diff --git a/lib/loader/index.js b/lib/loader/index.js index 74d37211..2f152393 100644 --- a/lib/loader/index.js +++ b/lib/loader/index.js @@ -45,7 +45,7 @@ function instantiate(module, imports) { /** Allocates a new string in the module's memory and returns its pointer. */ function newString(str) { var dataLength = str.length; - var ptr = exports.allocate_memory(4 + (dataLength << 1)); + var ptr = exports["memory.allocate"](4 + (dataLength << 1)); var dataOffset = (4 + ptr) >>> 1; checkMem(); U32[ptr >>> 2] = dataLength; diff --git a/lib/loader/package.json b/lib/loader/package.json index 7ff06ee8..0edaf3fa 100644 --- a/lib/loader/package.json +++ b/lib/loader/package.json @@ -4,6 +4,7 @@ "main": "index.js", "types": "index.d.ts", "scripts": { + "test:build": "asc tests/assembly/index.ts -b tests/build/untouched.wasm", "test": "node tests" }, "files": [ diff --git a/lib/loader/tests/assembly/index.ts b/lib/loader/tests/assembly/index.ts index e448e44c..71ed4548 100644 --- a/lib/loader/tests/assembly/index.ts +++ b/lib/loader/tests/assembly/index.ts @@ -1,5 +1,7 @@ import "allocator/arena"; +export { memory }; + export const COLOR: string = "red"; export function strlen(str: string): i32 { @@ -14,7 +16,7 @@ export namespace math { export class Car { static readonly MAX_DOORS: i32 = 5; - static usualDoors: i32 = 3; + static readonly usualDoors: i32 = 3; numDoors: i32; private doorsOpen: bool = false; @@ -42,5 +44,3 @@ export class Car { memory.free(changetype(this)); } } - -export { memory }; diff --git a/lib/loader/tests/build/untouched.wasm b/lib/loader/tests/build/untouched.wasm index f1ba66e0..0c010359 100644 Binary files a/lib/loader/tests/build/untouched.wasm and b/lib/loader/tests/build/untouched.wasm differ diff --git a/lib/loader/tests/index.js b/lib/loader/tests/index.js index 625b420f..7aa05572 100644 --- a/lib/loader/tests/index.js +++ b/lib/loader/tests/index.js @@ -23,6 +23,7 @@ assert(typeof proto.getString === "function"); // should export memory assert(module.memory instanceof WebAssembly.Memory); +assert(typeof module.memory.free === "function"); // should be able to get an exported string assert.strictEqual(module.getString(module.COLOR), "red"); diff --git a/package-lock.json b/package-lock.json index 71225f67..41ded16c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -66,9 +66,9 @@ "dev": true }, "@types/node": { - "version": "10.5.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.2.tgz", - "integrity": "sha512-m9zXmifkZsMHZBOyxZWilMwmTlpC8x5Ty360JKTiXvlXZfBWYpsg9ZZvP/Ye+iZUh+Q+MxDLjItVTWIsfwz+8Q==", + "version": "10.5.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.4.tgz", + "integrity": "sha512-8TqvB0ReZWwtcd3LXq3YSrBoLyXFgBX/sBZfGye9+YS8zH7/g+i6QRIuiDmwBoTzcQ/pk89nZYTYU4c5akKkzw==", "dev": true }, "@types/shelljs": { @@ -664,9 +664,9 @@ "dev": true }, "binaryen": { - "version": "49.0.0-nightly.20180718", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-49.0.0-nightly.20180718.tgz", - "integrity": "sha512-r7gYKbwYYF5DBTN2fSomv1BNUNYSPros20eTng5MV/Bsv7V6DfJtrvietJ35p+jqI797P83vnJ0PEB1vTZ9qoQ==" + "version": "49.0.0-nightly.20180731", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-49.0.0-nightly.20180731.tgz", + "integrity": "sha512-uZ7bizGTMbEOzIwZmGbXIcGFy8IkZjDoNOy+nPnIv7Dy1MiURItE0PRMnpXO2GPOOq6ZALW8pb5xb9MShD0zQQ==" }, "bluebird": { "version": "3.5.1", @@ -1053,9 +1053,9 @@ "dev": true }, "commander": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", - "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.16.0.tgz", + "integrity": "sha512-sVXqklSaotK9at437sFlFpyOcJonxe0yST/AG9DkQKUdIE6IqGIMv4SfAQSKaJbSdVEJYItASCrBiVQHq1HQew==", "dev": true }, "commondir": { @@ -1231,7 +1231,8 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true + "dev": true, + "optional": true }, "decode-uri-component": { "version": "0.2.0", @@ -1382,9 +1383,9 @@ "dev": true }, "eslint-scope": { - "version": "3.7.3", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.3.tgz", - "integrity": "sha512-W+B0SvF4gamyCTmUc+uITPY0989iXVfKvhwtmJocTaYoc/3khEHmEmvfY/Gn9HA9VV75jrQECsHizkNw1b68FA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", "dev": true, "requires": { "esrecurse": "^4.1.0", @@ -1392,9 +1393,9 @@ } }, "esprima": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, "esrecurse": { @@ -2252,9 +2253,9 @@ } }, "get-caller-file": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", - "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", "dev": true }, "get-stream": { @@ -2305,9 +2306,9 @@ } }, "global-modules-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/global-modules-path/-/global-modules-path-2.1.0.tgz", - "integrity": "sha512-3DrmGj2TP+96cABk9TfMp6f3knH/Y46dqvWznTU3Tf6/bDGLDAn15tFluQ7BcloykOcdY16U0WGq0BQblYOxJQ==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/global-modules-path/-/global-modules-path-2.3.0.tgz", + "integrity": "sha512-HchvMJNYh9dGSCy8pOQ2O8u/hoXaL+0XhnrwH0RyLiSXMMTl9W3N6KUU73+JFOg5PGjtzl6VZzUQsnrpm7Szag==", "dev": true }, "graceful-fs": { @@ -2771,9 +2772,9 @@ "dev": true }, "js-yaml": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.11.0.tgz", - "integrity": "sha512-saJstZWv7oNeOyBh3+Dx1qWzhW0+e6/8eDzo7p5rDFqxntSztloLtuKu+Ejhtq82jsilwOIZYsCz+lIjthg1Hw==", + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", "dev": true, "requires": { "argparse": "^1.0.7", @@ -3728,9 +3729,9 @@ } }, "rxjs": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.1.tgz", - "integrity": "sha512-OwMxHxmnmHTUpgO+V7dZChf3Tixf4ih95cmXjzzadULziVl/FKhHScGLj4goEw9weePVOH2Q0+GcCBUhKCZc/g==", + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.2.tgz", + "integrity": "sha512-0MI8+mkKAXZUF9vMrEoPnaoHkfzBPP4IGwUYRJhIRJF6/w3uByO1e91bEHn8zd43RdkTMKiooYKmwz7RH6zfOQ==", "dev": true, "requires": { "tslib": "^1.9.0" @@ -4074,9 +4075,9 @@ } }, "stream-each": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.2.tgz", - "integrity": "sha512-mc1dbFhGBxvTM3bIWmAAINbqiuAk9TATcfIQC8P+/+HJefgaiTlMn2dHvkX8qlI12KeYKSQ1Ua9RrIqrn1VPoA==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.3.tgz", + "integrity": "sha512-vlMC2f8I2u/bZGqkdfLQW/13Zihpej/7PmSiMQsbYddxuTsJp8vRe2x2FvVExZg7FaOds43ROAuFJwPR4MTZLw==", "dev": true, "requires": { "end-of-stream": "^1.1.0", @@ -4280,15 +4281,15 @@ } }, "tslib": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz", - "integrity": "sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ==", + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", "dev": true }, "tslint": { - "version": "5.10.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.10.0.tgz", - "integrity": "sha1-EeJrzLiK+gLdDZlWyuPUVAtfVMM=", + "version": "5.11.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.11.0.tgz", + "integrity": "sha1-mPMMAurjzecAYgHkwzywi0hYHu0=", "dev": true, "requires": { "babel-code-frame": "^6.22.0", @@ -4302,13 +4303,13 @@ "resolve": "^1.3.2", "semver": "^5.3.0", "tslib": "^1.8.0", - "tsutils": "^2.12.1" + "tsutils": "^2.27.2" } }, "tsutils": { - "version": "2.26.2", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.26.2.tgz", - "integrity": "sha512-uzwnhmrSbyinPCiwfzGsOY3IulBTwoky7r83HmZdz9QNCjhSCzavkh47KLWuU0zF2F2WbpmmzoJUIEiYyd+jEQ==", + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", "dev": true, "requires": { "tslib": "^1.8.1" @@ -4366,15 +4367,15 @@ "dev": true }, "typedoc-plugin-external-module-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/typedoc-plugin-external-module-name/-/typedoc-plugin-external-module-name-1.1.1.tgz", - "integrity": "sha512-Erc0MyKDGYIN7kSlIjgifVieZEogg8YwOH8bjW6RXb0y44hVeTER0UoW6Rh+n8leg6rvlPdnH092aFfcd8kRlA==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/typedoc-plugin-external-module-name/-/typedoc-plugin-external-module-name-1.1.3.tgz", + "integrity": "sha512-/VMawTW4NnUUsgq0o8O37y9MmXFaOCDrH1dvDg7SZUS5ZSpUPSILVWwGJP+7g4I8vKZ5bBKZKHfPIEA4xUC+PQ==", "dev": true }, "typescript": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", - "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.1.tgz", + "integrity": "sha512-zQIMOmC+372pC/CCVLqnQ0zSBiY7HHodU7mpQdjiZddek4GMj31I3dUJ7gAs9o65X7mnRma6OokOkc6f9jjfBg==", "dev": true }, "uglify-es": { @@ -4387,6 +4388,12 @@ "source-map": "~0.6.1" }, "dependencies": { + "commander": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", + "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", + "dev": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -4615,9 +4622,9 @@ } }, "webpack": { - "version": "4.16.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.16.0.tgz", - "integrity": "sha512-oNx9djAd6uAcccyfqN3hyXLNMjZHiRySZmBQ4c8FNmf1SNJGhx7n9TSvHNyXxgToRdH65g/Q97s94Ip9N6F7xg==", + "version": "4.16.3", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.16.3.tgz", + "integrity": "sha512-3VcrVoFgzSz1IYgga71YpU3HO89Al5bSnDOj9RJQPsy+FNyI1sFsUyJITn3pktNuaRBlQT0usvKZE3GgkPGAIw==", "dev": true, "requires": { "@webassemblyjs/ast": "1.5.13", @@ -4631,7 +4638,7 @@ "ajv-keywords": "^3.1.0", "chrome-trace-event": "^1.0.0", "enhanced-resolve": "^4.1.0", - "eslint-scope": "^3.7.1", + "eslint-scope": "^4.0.0", "json-parse-better-errors": "^1.0.2", "loader-runner": "^2.3.0", "loader-utils": "^1.1.0", @@ -4661,9 +4668,9 @@ } }, "webpack-cli": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.0.8.tgz", - "integrity": "sha512-KnRLJ0BUaYRqrhAMb9dv3gzdmhmgIMKo0FmdsnmfqbPGtLnnZ6tORZAvmmKfr+A0VgiVpqC60Gv7Ofg0R2CHtQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.1.0.tgz", + "integrity": "sha512-p5NeKDtYwjZozUWq6kGNs9w+Gtw/CPvyuXjXn2HMdz8Tie+krjEg8oAtonvIyITZdvpF7XG9xDHwscLr2c+ugQ==", "dev": true, "requires": { "chalk": "^2.4.1", @@ -4676,7 +4683,7 @@ "loader-utils": "^1.1.0", "supports-color": "^5.4.0", "v8-compile-cache": "^2.0.0", - "yargs": "^11.1.0" + "yargs": "^12.0.1" } }, "webpack-sources": { @@ -4772,6 +4779,12 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "xregexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-4.0.0.tgz", + "integrity": "sha512-PHyM+sQouu7xspQQwELlGwwd05mXUFqwFYfqPO0cC7x4fxyHnnuetmQr6CjJiafIDoH4MogHb9dOoJzR/Y4rFg==", + "dev": true + }, "xtend": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", @@ -4791,14 +4804,14 @@ "dev": true }, "yargs": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz", - "integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==", + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-12.0.1.tgz", + "integrity": "sha512-B0vRAp1hRX4jgIOWFtjfNjd9OA9RWYZ6tqGA9/I/IrTMsxmKvtWy+ersM+jzpQqbC3YfLzeABPdeTgcJ9eu1qQ==", "dev": true, "requires": { "cliui": "^4.0.0", - "decamelize": "^1.1.1", - "find-up": "^2.1.0", + "decamelize": "^2.0.0", + "find-up": "^3.0.0", "get-caller-file": "^1.0.1", "os-locale": "^2.0.0", "require-directory": "^2.1.1", @@ -4806,22 +4819,68 @@ "set-blocking": "^2.0.0", "string-width": "^2.0.0", "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^9.0.2" + "y18n": "^3.2.1 || ^4.0.0", + "yargs-parser": "^10.1.0" }, "dependencies": { - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "decamelize": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-2.0.0.tgz", + "integrity": "sha512-Ikpp5scV3MSYxY39ymh45ZLEecsTdv/Xj2CaQfI8RLMuwi7XvjX9H/fhraiSuU+C5w5NTDu4ZU72xNiZnurBPg==", + "dev": true, + "requires": { + "xregexp": "4.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.0.0.tgz", + "integrity": "sha512-fl5s52lI5ahKCernzzIyAP0QAZbGIovtVHGwpcu1Jr/EpzLVDI2myISHwGqK7m8uQFugVWSrbxH7XnhGtvEc+A==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz", + "integrity": "sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ==", "dev": true } } }, "yargs-parser": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz", - "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", "dev": true, "requires": { "camelcase": "^4.1.0" diff --git a/package.json b/package.json index b8e03dc6..26878f52 100644 --- a/package.json +++ b/package.json @@ -12,22 +12,22 @@ }, "dependencies": { "@protobufjs/utf8": "^1.1.0", - "binaryen": "49.0.0-nightly.20180718", + "binaryen": "49.0.0-nightly.20180731", "long": "^4.0.0" }, "devDependencies": { - "@types/node": "^10.5.2", + "@types/node": "^10.5.4", "browser-process-hrtime": "^0.1.2", "diff": "^3.5.0", "glob": "^7.1.2", "ts-loader": "^4.4.2", "ts-node": "^6.2.0", - "tslint": "^5.10.0", + "tslint": "^5.11.0", "typedoc": "^0.11.1", - "typedoc-plugin-external-module-name": "^1.1.1", - "typescript": "^2.9.2", - "webpack": "^4.16.0", - "webpack-cli": "^3.0.8" + "typedoc-plugin-external-module-name": "^1.1.3", + "typescript": "^3.0.1", + "webpack": "^4.16.3", + "webpack-cli": "^3.1.0" }, "main": "index.js", "types": "index.d.ts", diff --git a/src/builtins.ts b/src/builtins.ts index 2c246026..f8ea4ddb 100644 --- a/src/builtins.ts +++ b/src/builtins.ts @@ -134,7 +134,7 @@ export function compileCall( compiler.currentType = Type.bool; if (!type) return module.createUnreachable(); let classType = type.classReference; - return classType != null && classType.lookupOverload(OperatorKind.INDEXED_GET) != null + return classType !== null && classType.lookupOverload(OperatorKind.INDEXED_GET) !== null ? module.createI32(1) : module.createI32(0); } @@ -175,6 +175,19 @@ export function compileCall( compiler.currentType = Type.bool; return module.createI32(getExpressionId(expr) == ExpressionId.Const ? 1 : 0); } + case "isManaged": { // isManaged() -> bool + if (!compiler.program.hasGC) { + compiler.currentType = Type.bool; + return module.createI32(0); + } + let type = evaluateConstantType(compiler, typeArguments, operands, reportNode); + compiler.currentType = Type.bool; + if (!type) return module.createUnreachable(); + let classType = type.classReference; + return classType !== null && !classType.hasDecorator(DecoratorFlags.UNMANAGED) + ? module.createI32(1) + : module.createI32(0); + } // math @@ -2881,25 +2894,46 @@ export function compileAllocate( assert(classInstance.program == program); var module = compiler.module; var options = compiler.options; - var allocateInstance = program.memoryAllocateInstance; - if (!allocateInstance) { - program.error( - DiagnosticCode.Cannot_find_name_0, - reportNode.range, "memory.allocate" - ); - return module.createUnreachable(); - } - if (!compiler.compileFunction(allocateInstance)) return module.createUnreachable(); - compiler.currentType = classInstance.type; - return module.createCall( - allocateInstance.internalName, [ - options.isWasm64 - ? module.createI64(classInstance.currentMemoryOffset) - : module.createI32(classInstance.currentMemoryOffset) - ], - options.nativeSizeType - ); + // __gc_allocate(size, markFn) + if (program.hasGC && classInstance.type.isManaged(program)) { + let allocateInstance = assert(program.gcAllocateInstance); + if (!compiler.compileFunction(allocateInstance)) return module.createUnreachable(); + compiler.currentType = classInstance.type; + return module.createCall( + allocateInstance.internalName, [ + options.isWasm64 + ? module.createI64(classInstance.currentMemoryOffset) + : module.createI32(classInstance.currentMemoryOffset), + module.createI32( + ensureGCHook(compiler, classInstance) + ) + ], + options.nativeSizeType + ); + + // memory.allocate(size) + } else { + let allocateInstance = program.memoryAllocateInstance; + if (!allocateInstance) { + program.error( + DiagnosticCode.Cannot_find_name_0, + reportNode.range, "memory.allocate" + ); + return module.createUnreachable(); + } + if (!compiler.compileFunction(allocateInstance)) return module.createUnreachable(); + + compiler.currentType = classInstance.type; + return module.createCall( + allocateInstance.internalName, [ + options.isWasm64 + ? module.createI64(classInstance.currentMemoryOffset) + : module.createI32(classInstance.currentMemoryOffset) + ], + options.nativeSizeType + ); + } } /** Compiles an abort wired to the conditionally imported 'abort' function. */ @@ -2921,7 +2955,7 @@ export function compileAbort( ? compiler.compileExpression(message, stringType, ConversionKind.IMPLICIT, WrapMode.NONE) : stringType.toNativeZero(module); - var filenameArg = compiler.compileStaticString(reportNode.range.source.normalizedPath); + var filenameArg = compiler.ensureStaticString(reportNode.range.source.normalizedPath); compiler.currentType = Type.void; return module.createBlock(null, [ @@ -2988,3 +3022,122 @@ export function compileIterateRoots(compiler: Compiler): void { : module.createNop() ); } + +/** Ensures that the specified class's GC hook exists and returns its function table index. */ +export function ensureGCHook( + compiler: Compiler, + classInstance: Class +): u32 { + var program = compiler.program; + assert(classInstance.type.isManaged(program)); + + // check if the GC hook has already been created + { + let existingIndex = classInstance.gcHookIndex; + if (existingIndex != -1) return existingIndex; + } + + // check if the class implements a custom GC function (only valid for internals) + var members = classInstance.members; + if (classInstance.prototype.declaration.range.source.isLibrary) { + if (members !== null && members.has("__gc")) { + let gcPrototype = assert(members.get("__gc")); + assert(gcPrototype.kind == ElementKind.FUNCTION_PROTOTYPE); + let gcInstance = assert(program.resolver.resolveFunction(gcPrototype, null)); + assert(gcInstance.is(CommonFlags.PRIVATE | CommonFlags.INSTANCE)); + assert(!gcInstance.isAny(CommonFlags.AMBIENT | CommonFlags.VIRTUAL)); + assert(gcInstance.signature.parameterTypes.length == 0); + assert(gcInstance.signature.returnType == Type.void); + gcInstance.internalName = classInstance.internalName + "~gc"; + assert(compiler.compileFunction(gcInstance)); + let index = compiler.ensureFunctionTableEntry(gcInstance); + classInstance.gcHookIndex = index; + return index; + } + } + + var module = compiler.module; + var options = compiler.options; + var nativeSizeType = options.nativeSizeType; + var nativeSizeSize = options.usizeType.byteSize; + var body = new Array(); + + // nothing to mark if 'this' is null + body.push( + module.createIf( + module.createUnary( + options.isWasm64 + ? UnaryOp.EqzI64 + : UnaryOp.EqzI32, + module.createGetLocal(0, nativeSizeType) + ), + module.createReturn() + ) + ); + + // remember the function index so we don't recurse infinitely + var functionTable = compiler.functionTable; + var gcHookIndex = functionTable.length; + functionTable.push(0); + classInstance.gcHookIndex = gcHookIndex; + + // if the class extends a base class, call its hook first (calls mark) + var baseInstance = classInstance.base; + if (baseInstance) { + assert(baseInstance.type.isManaged(program)); + body.push( + module.createCallIndirect( + module.createI32( + ensureGCHook(compiler, baseInstance.type.classReference) + ), + [ + module.createGetLocal(0, nativeSizeType) + ], + nativeSizeType == NativeType.I64 ? "Iv" : "iv" + ) + ); + + // if this class is the top-most base class, mark the instance + } else { + body.push( + module.createCall(assert(program.gcMarkInstance).internalName, [ + module.createGetLocal(0, nativeSizeType) + ], NativeType.None) + ); + } + + // mark instances assigned to own fields that are again references + if (members) { + for (let member of members.values()) { + if (member.kind == ElementKind.FIELD) { + if ((member).parent === classInstance) { + let type = (member).type; + if (type.isManaged(program)) { + let offset = (member).memoryOffset; + assert(offset >= 0); + body.push( + module.createCall(assert(program.gcMarkInstance).internalName, [ + module.createLoad( + nativeSizeSize, + false, + module.createGetLocal(0, nativeSizeType), + nativeSizeType, + offset + ) + ], NativeType.None) + ); + } + } + } + } + } + + // add the function to the module and return its table index + functionTable[gcHookIndex] = module.addFunction( + classInstance.internalName + "~gc", + compiler.ensureFunctionType(null, Type.void, options.usizeType), + null, + module.createBlock(null, body) + ); + return gcHookIndex; +} diff --git a/src/compiler.ts b/src/compiler.ts index 1156a734..5872754c 100644 --- a/src/compiler.ts +++ b/src/compiler.ts @@ -36,7 +36,8 @@ import { getGetLocalIndex, getBlockChildCount, getBlockChild, - getBlockName + getBlockName, + needsExplicitUnreachable } from "./module"; import { @@ -74,7 +75,7 @@ import { } from "./program"; import { - Resolver + Resolver, ReportMode } from "./resolver"; import { @@ -155,6 +156,8 @@ import { } from "./types"; import { + writeI8, + writeI16, writeI32, writeI64, writeF32, @@ -282,7 +285,7 @@ export class Compiler extends DiagnosticEmitter { /** Map of already compiled static string segments. */ stringSegments: Map = new Map(); /** Function table being compiled. */ - functionTable: Function[] = []; + functionTable: FunctionRef[] = []; /** Argument count helper global. */ argcVar: GlobalRef = 0; /** Argument count helper setter. */ @@ -391,11 +394,7 @@ export class Compiler extends DiagnosticEmitter { var functionTableSize = functionTable.length; var functionTableExported = false; if (functionTableSize) { - let entries = new Array(functionTableSize); - for (let i = 0; i < functionTableSize; ++i) { - entries[i] = functionTable[i].ref; - } - module.setFunctionTable(entries); + module.setFunctionTable(functionTable); module.addTableExport("0", "table"); functionTableExported = true; } @@ -1474,7 +1473,7 @@ export class Compiler extends DiagnosticEmitter { // insert the trampoline if the function has optional parameters func = this.ensureTrampoline(func); } - functionTable.push(func); + functionTable.push(func.ref); func.functionTableIndex = index; return index; } @@ -1581,7 +1580,10 @@ export class Compiler extends DiagnosticEmitter { default: stmts.push(stmt); case ExpressionId.Nop: } - if (flow.isAny(FlowFlags.ANY_TERMINATING)) break; + if (flow.isAny(FlowFlags.ANY_TERMINATING)) { + if (needsExplicitUnreachable(stmt)) stmts.push(this.module.createUnreachable()); + break; + } } return stmts; } @@ -1682,7 +1684,7 @@ export class Compiler extends DiagnosticEmitter { ); parentFlow.inherit(flow); - return module.createBlock(breakLabel, [ + var block: ExpressionRef[] = [ module.createLoop(continueLabel, terminated ? body // skip trailing continue if unnecessary @@ -1691,7 +1693,9 @@ export class Compiler extends DiagnosticEmitter { module.createBreak(continueLabel, condExpr) ], NativeType.None) ) - ], terminated ? NativeType.Unreachable : NativeType.None); + ]; + if (terminated) block.push(module.createUnreachable()); + return module.createBlock(breakLabel, block); } compileEmptyStatement(statement: EmptyStatement): ExpressionRef { @@ -1754,7 +1758,10 @@ export class Compiler extends DiagnosticEmitter { var incrExpr = statement.incrementor ? this.compileExpression(statement.incrementor, Type.void, ConversionKind.IMPLICIT, WrapMode.NONE) : 0; - var bodyExpr = this.compileStatement(statement.statement); + var bodyStatement = statement.statement; + var bodyExpr = bodyStatement.kind == NodeKind.BLOCK && (bodyStatement).statements.length == 1 + ? this.compileStatement((bodyStatement).statements[0]) + : this.compileStatement(bodyStatement); // Switch back to the parent flow currentFunction.flow = flow.free(); @@ -1766,7 +1773,6 @@ export class Compiler extends DiagnosticEmitter { FlowFlags.CONTINUES | FlowFlags.CONDITIONALLY_CONTINUES ); - var terminated = alwaysTrue && flow.isAny(FlowFlags.ANY_TERMINATING); if (alwaysTrue) parentFlow.inherit(flow); else parentFlow.inheritConditional(flow); @@ -1793,18 +1799,10 @@ export class Compiler extends DiagnosticEmitter { ); breakBlock.push( - module.createLoop(repeatLabel, - module.createBlock(null, repeatBlock, NativeType.None) - ) + module.createLoop(repeatLabel, module.createBlock(null, repeatBlock, NativeType.None)) ); - return module.createBlock( - breakLabel, - breakBlock, - terminated - ? NativeType.Unreachable - : NativeType.None - ); + return module.createBlock(breakLabel, breakBlock); } compileIfStatement(statement: IfStatement): ExpressionRef { @@ -2249,7 +2247,6 @@ export class Compiler extends DiagnosticEmitter { var body = this.compileStatement(statement.statement); var alwaysTrue = false; // TODO - var alwaysReturns = alwaysTrue && flow.is(FlowFlags.RETURNS); var terminated = flow.isAny(FlowFlags.ANY_TERMINATING); // Switch back to the parent flow @@ -2264,7 +2261,7 @@ export class Compiler extends DiagnosticEmitter { if (alwaysTrue) parentFlow.inherit(flow); else parentFlow.inheritConditional(flow); - var expr = module.createBlock(breakLabel, [ + return module.createBlock(breakLabel, [ module.createLoop(continueLabel, module.createIf(condExpr, terminated @@ -2275,8 +2272,7 @@ export class Compiler extends DiagnosticEmitter { ], NativeType.None) ) ) - ], alwaysReturns ? NativeType.Unreachable : NativeType.None); - return expr; + ]); } // expressions @@ -4808,6 +4804,7 @@ export class Compiler extends DiagnosticEmitter { ); let tempLocalIndex = tempLocal.index; // TODO: simplify if valueWithCorrectType has no side effects + // TODO: call __gc_link here if a GC is present return module.createBlock(null, [ module.createSetLocal(tempLocalIndex, valueWithCorrectType), module.createStore( @@ -4820,6 +4817,7 @@ export class Compiler extends DiagnosticEmitter { module.createGetLocal(tempLocalIndex, nativeType) ], nativeType); } else { + // TODO: call __gc_link here if a GC is present return module.createStore( type.byteSize, thisExpr, @@ -5107,7 +5105,11 @@ export class Compiler extends DiagnosticEmitter { // indirect call: index argument with signature (non-generic, can't be inlined) case ElementKind.LOCAL: { if (signature = (target).type.signatureReference) { - indexArg = module.createGetLocal((target).index, NativeType.I32); + if ((target).is(CommonFlags.INLINED)) { + indexArg = module.createI32(i64_low((target).constantIntegerValue)); + } else { + indexArg = module.createGetLocal((target).index, NativeType.I32); + } break; } else { this.error( @@ -6094,6 +6096,7 @@ export class Compiler extends DiagnosticEmitter { return this.compileArrayLiteral( assert(classType.typeArguments)[0], (expression).elementExpressions, + false, // TODO: isConst? expression ); } @@ -6204,7 +6207,7 @@ export class Compiler extends DiagnosticEmitter { } case LiteralKind.STRING: { assert(!implicitNegate); - return this.compileStaticString((expression).value); + return this.compileStringLiteral(expression); } case LiteralKind.OBJECT: { assert(!implicitNegate); @@ -6220,241 +6223,282 @@ export class Compiler extends DiagnosticEmitter { return module.createUnreachable(); } - compileStaticString(stringValue: string): ExpressionRef { + /** Ensures that the specified string exists in static memory and returns a pointer to it. */ + ensureStaticString(stringValue: string): ExpressionRef { + var program = this.program; var module = this.module; var options = this.options; var stringSegments = this.stringSegments; + var needsGCHeader = program.hasGC; - var stringSegment: MemorySegment | null = stringSegments.get(stringValue); - if (!stringSegment) { + var stringSegment: MemorySegment; + var stringOffset: I64; + if (!stringSegments.has(stringValue)) { let stringLength = stringValue.length; - let stringBuffer = new Uint8Array(4 + stringLength * 2); - stringBuffer[0] = stringLength & 0xff; - stringBuffer[1] = (stringLength >>> 8) & 0xff; - stringBuffer[2] = (stringLength >>> 16) & 0xff; - stringBuffer[3] = (stringLength >>> 24) & 0xff; + let stringSize = 4 + stringLength * 2; + let offset = 0; + let gcHeaderSize = program.gcHeaderSize; + if (needsGCHeader) { + stringSize += gcHeaderSize; + offset += gcHeaderSize; + } + let stringBuffer = new Uint8Array(stringSize); + stringBuffer[offset ] = stringLength & 0xff; + stringBuffer[offset + 1] = (stringLength >>> 8) & 0xff; + stringBuffer[offset + 2] = (stringLength >>> 16) & 0xff; + stringBuffer[offset + 3] = (stringLength >>> 24) & 0xff; for (let i = 0; i < stringLength; ++i) { - stringBuffer[4 + i * 2] = stringValue.charCodeAt(i) & 0xff; - stringBuffer[5 + i * 2] = (stringValue.charCodeAt(i) >>> 8) & 0xff; + stringBuffer[offset + 4 + i * 2] = stringValue.charCodeAt(i) & 0xff; + stringBuffer[offset + 5 + i * 2] = (stringValue.charCodeAt(i) >>> 8) & 0xff; } stringSegment = this.addMemorySegment(stringBuffer, options.usizeType.byteSize); stringSegments.set(stringValue, stringSegment); + if (needsGCHeader) { + stringOffset = i64_add(stringSegment.offset, i64_new(gcHeaderSize, 0)); + } else { + stringOffset = stringSegment.offset; + } + } else { + stringSegment = stringSegments.get(stringValue); + stringOffset = stringSegment.offset; + } + if (program.typesLookup.has("string")) { + let stringType = program.typesLookup.get("string"); + this.currentType = stringType; + } else { + this.currentType = options.usizeType; } - var stringOffset = stringSegment.offset; - var stringType = this.program.typesLookup.get("string"); - this.currentType = stringType ? stringType : options.usizeType; if (options.isWasm64) { return module.createI64(i64_low(stringOffset), i64_high(stringOffset)); + } else { + assert(i64_is_i32(stringOffset)); + return module.createI32(i64_low(stringOffset)); } - assert(i64_is_i32(stringOffset)); - return module.createI32(i64_low(stringOffset)); } - compileArrayLiteral(elementType: Type, expressions: (Expression | null)[], reportNode: Node): ExpressionRef { - var isStatic = true; + compileStringLiteral(expression: StringLiteralExpression): ExpressionRef { + return this.ensureStaticString(expression.value); + } + + /** Ensures that the specified array exists in static memory and returns a pointer to it. */ + ensureStaticArray(elementType: Type, values: ExpressionRef[]): ExpressionRef { + var length = values.length; + var byteSize = elementType.byteSize; + var byteLength = length * byteSize; + var usizeTypeSize = this.options.usizeType.byteSize; + + // determine the size of the Array header + var arrayHeaderSize = (usizeTypeSize + 4 + 7) & ~7; // .buffer_ + .length_ + alignment + var arrayTotalSize = arrayHeaderSize; + + // determine the size of the ArrayBuffer + var bufferHeaderSize = (4 + 7) & ~7; // .byteLength + alignment + var bufferTotalSize = 1 << (32 - clz(byteLength + bufferHeaderSize - 1)); // see internals + + var program = this.program; + var needsGC = program.hasGC; + var gcHeaderSize = program.gcHeaderSize; + + var offset = 0; + if (needsGC) { + offset += gcHeaderSize; // start writing after GC header + arrayTotalSize += gcHeaderSize; + bufferTotalSize += gcHeaderSize; + } + + // create a compound segment holding both the the Array header and the ArrayBuffer + var buffer = new Uint8Array(arrayHeaderSize + bufferTotalSize); + var segment = this.addMemorySegment(buffer); + + // write the Array header first + if (usizeTypeSize == 8) { + writeI64(i64_add(segment.offset, i64_new(arrayHeaderSize)), buffer, offset); // .buffer_ + offset += 8; + } else { + assert(i64_is_u32(segment.offset)); + writeI32(i64_low(segment.offset) + arrayHeaderSize, buffer, offset); // .buffer_ + offset += 4; + } + writeI32(length, buffer, offset); // .length_ + offset += 4; + assert(((offset + 7) & ~7) == arrayTotalSize); // incl. GC header if applicable + + // append the ArrayBuffer + offset = arrayTotalSize; + if (needsGC) offset += gcHeaderSize; + writeI32(byteLength, buffer, offset); // .byteLength + offset += bufferHeaderSize; // align + var nativeType = elementType.toNativeType(); + switch (nativeType) { + case NativeType.I32: { + switch (byteSize) { + case 1: { + for (let i = 0; i < length; ++i) { + let value = values[i]; + assert(getExpressionType(value) == nativeType); + assert(getExpressionId(value) == ExpressionId.Const); + writeI8(getConstValueI32(value), buffer, offset); + offset += 1; + } + break; + } + case 2: { + for (let i = 0; i < length; ++i) { + let value = values[i]; + assert(getExpressionType(value) == nativeType); + assert(getExpressionId(value) == ExpressionId.Const); + writeI16(getConstValueI32(value), buffer, offset); + offset += 2; + } + break; + } + case 4: { + for (let i = 0; i < length; ++i) { + let value = values[i]; + assert(getExpressionType(value) == nativeType); + assert(getExpressionId(value) == ExpressionId.Const); + writeI32(getConstValueI32(value), buffer, offset); + offset += 4; + } + break; + } + default: assert(false); + } + break; + } + case NativeType.I64: { + for (let i = 0; i < length; ++i) { + let value = values[i]; + assert(getExpressionType(value) == nativeType); + assert(getExpressionId(value) == ExpressionId.Const); + writeI64(i64_new(getConstValueI64Low(value), getConstValueI64High(value)), buffer, offset); + offset += 8; + } + break; + } + case NativeType.F32: { + for (let i = 0; i < length; ++i) { + let value = values[i]; + assert(getExpressionType(value) == nativeType); + assert(getExpressionId(value) == ExpressionId.Const); + writeF32(getConstValueF32(value), buffer, offset); + offset += 4; + } + break; + } + case NativeType.F64: { + for (let i = 0; i < length; ++i) { + let value = values[i]; + assert(getExpressionType(value) == nativeType); + assert(getExpressionId(value) == ExpressionId.Const); + writeF64(getConstValueF64(value), buffer, offset); + offset += 8; + } + break; + } + default: assert(false); + } + assert(offset <= arrayTotalSize + bufferTotalSize); // might have empty trailing space + + var arrayPrototype = this.program.arrayPrototype; + if (arrayPrototype) { + let arrayInstance = this.resolver.resolveClass(arrayPrototype, [ elementType ], null, ReportMode.REPORT); + if (!arrayInstance) { + this.currentType = this.options.usizeType; + return this.module.createUnreachable(); + } + this.currentType = arrayInstance.type; + } else { + this.currentType = this.options.usizeType; + } + + // return a pointer at the array header (skip GC header if present) + var address = segment.offset; + if (needsGC) address = i64_add(address, i64_new(gcHeaderSize, 0)); + if (usizeTypeSize == 8) { + return this.module.createI64(i64_low(address), i64_high(address)); + } else { + assert(i64_is_u32(address)); + return this.module.createI32(i64_low(address)); + } + } + + compileArrayLiteral( + elementType: Type, + expressions: (Expression | null)[], + isConst: bool, + reportNode: Node + ): ExpressionRef { var module = this.module; - // obtain the array type + // find out whether all elements are constant (array is static) + var length = expressions.length; + var values = new Array(length); + var nativeElementType = elementType.toNativeType(); + var isStatic = true; + for (let i = 0; i < length; ++i) { + values[i] = expressions[i] + ? this.compileExpression(expressions[i], elementType, ConversionKind.IMPLICIT, WrapMode.NONE) + : elementType.toNativeZero(module); + if (isStatic) { + let expr = module.precomputeExpression(values[i]); + if (getExpressionId(expr) == ExpressionId.Const) { + assert(getExpressionType(expr) == nativeElementType); + } else { + if (isConst) { + this.warning( + DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable, + reportNode.range + ); + } + isStatic = false; + } + } + } + + // make a static array if possible + if (isStatic) return this.ensureStaticArray(elementType, values); + + // otherwise obtain the array type var arrayPrototype = assert(this.program.arrayPrototype); if (!arrayPrototype || arrayPrototype.kind != ElementKind.CLASS_PROTOTYPE) return module.createUnreachable(); var arrayInstance = this.resolver.resolveClass(arrayPrototype, [ elementType ]); if (!arrayInstance) return module.createUnreachable(); var arrayType = arrayInstance.type; - var elementCount = expressions.length; - if (elementCount) { // non-empty static or dynamic - let nativeElementType = elementType.toNativeType(); - let values: usize; - let byteLength: usize; - switch (nativeElementType) { - case NativeType.I32: { - values = changetype(new Int32Array(elementCount)); - byteLength = elementCount * 4; - break; - } - case NativeType.I64: { - values = changetype(new Array(elementCount)); - byteLength = elementCount * 8; - break; - } - case NativeType.F32: { - values = changetype(new Float32Array(elementCount)); - byteLength = elementCount * 4; - break; - } - case NativeType.F64: { - values = changetype(new Float64Array(elementCount)); - byteLength = elementCount * 8; - break; - } - default: { - assert(false); - return module.createUnreachable(); - } - } - - // precompute value expressions - let exprs = new Array(elementCount); - let expr: BinaryenExpressionRef; - for (let i = 0; i < elementCount; ++i) { - exprs[i] = expressions[i] - ? this.compileExpression(expressions[i], elementType, ConversionKind.IMPLICIT, WrapMode.NONE) - : elementType.toNativeZero(module); - if (isStatic) { - expr = module.precomputeExpression(exprs[i]); - if (getExpressionId(expr) == ExpressionId.Const) { - assert(getExpressionType(expr) == nativeElementType); - switch (nativeElementType) { - case NativeType.I32: { - changetype(values)[i] = getConstValueI32(expr); - break; - } - case NativeType.I64: { - changetype(values)[i] = i64_new( - getConstValueI64Low(expr), - getConstValueI64High(expr) - ); - break; - } - case NativeType.F32: { - changetype(values)[i] = getConstValueF32(expr); - break; - } - case NativeType.F64: { - changetype(values)[i] = getConstValueF64(expr); - break; - } - default: assert(false); // checked above - } - } else { - // TODO: emit a warning if declared 'const' - // if (isConst) { - // this.warn( - // DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable, - // reportNode.range - // ); - // } - isStatic = false; - } - } - } - - let usizeTypeSize = this.options.usizeType.byteSize; - if (isStatic) { // non-empty, all elements can be precomputed - - // Create a combined static memory segment composed of: - // Array struct + ArrayBuffer struct + aligned ArrayBuffer data - - let arraySize = usizeTypeSize + 4; // buffer_ & length_ - let bufferHeaderSize = (4 + 7) & ~7; // aligned byteLength (8) - let bufferTotalSize = 1 << (32 - clz(byteLength + bufferHeaderSize - 1)); // see internals - let data = new Uint8Array(arraySize + bufferTotalSize); - let segment = this.addMemorySegment(data); - let offset = 0; - - // write Array struct - if (usizeTypeSize == 8) { - writeI64(i64_add(segment.offset, i64_new(arraySize)), data, offset); // buffer_ @ segment[arSize] - offset += 8; - } else { - assert(i64_high(segment.offset) == 0); - writeI32(i64_low(segment.offset) + arraySize, data, offset); // buffer_ @ segment[arSize] - offset += 4; - } - writeI32(elementCount, data, offset); // length_ - offset += 4; - assert(offset == arraySize); - - // write ArrayBuffer struct - writeI32(byteLength, data, offset); - offset += bufferHeaderSize; // incl. alignment - - // write ArrayBuffer data - switch (nativeElementType) { - case NativeType.I32: { - for (let i = 0; i < elementCount; ++i) { - writeI32(changetype(values)[i], data, offset); offset += 4; - } - break; - } - case NativeType.I64: { - for (let i = 0; i < elementCount; ++i) { - writeI64(changetype(values)[i], data, offset); offset += 8; - } - break; - } - case NativeType.F32: { - for (let i = 0; i < elementCount; ++i) { - writeF32(changetype(values)[i], data, offset); offset += 4; - } - break; - } - case NativeType.F64: { - for (let i = 0; i < elementCount; ++i) { - writeF64(changetype(values)[i], data, offset); offset += 8; - } - break; - } - default: { - assert(false); - return module.createUnreachable(); - } - } - assert(offset <= arraySize + bufferTotalSize); - - this.currentType = arrayType; - return usizeTypeSize == 8 - ? module.createI64( - i64_low(segment.offset), - i64_high(segment.offset) - ) - : module.createI32( - i64_low(segment.offset) - ); - - } else { // non-empty, some elements can't be precomputed - - this.currentType = arrayType; - let setter = arrayInstance.lookupOverload(OperatorKind.INDEXED_SET, true); - if (!setter) { - this.error( - DiagnosticCode.Index_signature_in_type_0_only_permits_reading, - reportNode.range, arrayInstance.internalName - ); - return module.createUnreachable(); - } - let nativeArrayType = arrayType.toNativeType(); - let currentFunction = this.currentFunction; - let tempLocal = currentFunction.getTempLocal(arrayType, false); - let stmts = new Array(2 + elementCount); - let index = 0; - stmts[index++] = module.createSetLocal(tempLocal.index, - this.makeCallDirect(assert(arrayInstance.constructorInstance), [ - module.createI32(0), // this - module.createI32(elementCount) - ]) - ); - for (let i = 0; i < elementCount; ++i) { - stmts[index++] = this.makeCallDirect(setter, [ - module.createGetLocal(tempLocal.index, nativeArrayType), // this - module.createI32(i), - exprs[i] - ]); - } - assert(index + 1 == stmts.length); - stmts[index] = module.createGetLocal(tempLocal.index, nativeArrayType); - currentFunction.freeTempLocal(tempLocal); - this.currentType = arrayType; - return module.createBlock(null, stmts, nativeArrayType); - } - - } else { // empty, TBD: cache this somehow? - this.currentType = arrayType; - return this.makeCallDirect(assert(arrayInstance.constructorInstance), [ + // and compile an explicit instantiation + this.currentType = arrayType; + var setter = arrayInstance.lookupOverload(OperatorKind.INDEXED_SET, true); + if (!setter) { + this.error( + DiagnosticCode.Index_signature_in_type_0_only_permits_reading, + reportNode.range, arrayInstance.internalName + ); + return module.createUnreachable(); + } + var nativeArrayType = arrayType.toNativeType(); + var currentFunction = this.currentFunction; + var tempLocal = currentFunction.getTempLocal(arrayType, false); + var stmts = new Array(2 + length); + var index = 0; + stmts[index++] = module.createSetLocal(tempLocal.index, + this.makeCallDirect(assert(arrayInstance.constructorInstance), [ module.createI32(0), // this - module.createI32(0) + module.createI32(length) + ]) + ); + for (let i = 0; i < length; ++i) { + stmts[index++] = this.makeCallDirect(setter, [ + module.createGetLocal(tempLocal.index, nativeArrayType), // this + module.createI32(i), + values[i] ]); } + assert(index + 1 == stmts.length); + stmts[index] = module.createGetLocal(tempLocal.index, nativeArrayType); + currentFunction.freeTempLocal(tempLocal); + this.currentType = arrayType; + return module.createBlock(null, stmts, nativeArrayType); } compileObjectLiteral(expression: ObjectLiteralExpression, contextualType: Type): ExpressionRef { diff --git a/src/module.ts b/src/module.ts index ec8a4521..306a2504 100644 --- a/src/module.ts +++ b/src/module.ts @@ -16,14 +16,14 @@ export type ImportRef = usize; export type ExportRef = usize; export type Index = u32; -export enum NativeType { - None = _BinaryenTypeNone(), - I32 = _BinaryenTypeInt32(), - I64 = _BinaryenTypeInt64(), - F32 = _BinaryenTypeFloat32(), - F64 = _BinaryenTypeFloat64(), - Unreachable = _BinaryenTypeUnreachable(), - Auto = _BinaryenTypeAuto() +export const enum NativeType { + None = 0, // _BinaryenTypeNone(), + I32 = 1, // _BinaryenTypeInt32(), + I64 = 2, // _BinaryenTypeInt64(), + F32 = 3, // _BinaryenTypeFloat32(), + F64 = 4, // _BinaryenTypeFloat64(), + Unreachable = 5, // _BinaryenTypeUnreachable(), + Auto = -1 // _BinaryenTypeAuto() } export enum ExpressionId { @@ -1580,3 +1580,26 @@ export class BinaryModule { /** Source map, if generated. */ sourceMap: string | null; } + +/** Tests if an expression needs an explicit 'unreachable' when it is the terminating statement. */ +export function needsExplicitUnreachable(expr: ExpressionRef): bool { + // not applicable if pushing a value to the stack + switch (_BinaryenExpressionGetType(expr)) { + case NativeType.I32: + case NativeType.I64: + case NativeType.F32: + case NativeType.F64: return false; + } + switch (_BinaryenExpressionGetId(expr)) { + case ExpressionId.Unreachable: + case ExpressionId.Return: return false; + case ExpressionId.Break: return _BinaryenBreakGetCondition(expr) != 0; + case ExpressionId.Block: { + if (!_BinaryenBlockGetName(expr)) { // can't break out of it + let numChildren = _BinaryenBlockGetNumChildren(expr); // last child needs unreachable + return numChildren > 0 && needsExplicitUnreachable(_BinaryenBlockGetChild(expr, numChildren - 1)); + } + } + } + return true; +} diff --git a/src/program.ts b/src/program.ts index 4b53dacd..35f6b172 100644 --- a/src/program.ts +++ b/src/program.ts @@ -341,6 +341,17 @@ export class Program extends DiagnosticEmitter { /** Memory allocation function. */ memoryAllocateInstance: Function | null = null; + /** Whether a garbage collector is present or not. */ + hasGC: bool = false; + /** Garbage collector allocation function. */ + gcAllocateInstance: Function | null = null; + /** Garbage collector link function called when a managed object is referenced from a parent. */ + gcLinkInstance: Function | null = null; + /** Garbage collector mark function called to on reachable managed objects. */ + gcMarkInstance: Function | null = null; + /** Size of a managed object header. */ + gcHeaderSize: u32 = 0; + /** Currently processing filespace. */ currentFilespace: Filespace; @@ -658,6 +669,48 @@ export class Program extends DiagnosticEmitter { } } } + + // register GC hooks if present + if ( + this.elementsLookup.has("__gc_allocate") && + this.elementsLookup.has("__gc_link") && + this.elementsLookup.has("__gc_mark") + ) { + // __gc_allocate(usize, (ref: usize) => void): usize + let element = this.elementsLookup.get("__gc_allocate"); + assert(element.kind == ElementKind.FUNCTION_PROTOTYPE); + let gcAllocateInstance = assert(this.resolver.resolveFunction(element, null)); + let signature = gcAllocateInstance.signature; + assert(signature.parameterTypes.length == 2); + assert(signature.parameterTypes[0] == this.options.usizeType); + assert(signature.parameterTypes[1].signatureReference); + assert(signature.returnType == this.options.usizeType); + + // __gc_link(usize, usize): void + element = this.elementsLookup.get("__gc_link"); + assert(element.kind == ElementKind.FUNCTION_PROTOTYPE); + let gcLinkInstance = assert(this.resolver.resolveFunction(element, null)); + signature = gcLinkInstance.signature; + assert(signature.parameterTypes.length == 2); + assert(signature.parameterTypes[0] == this.options.usizeType); + assert(signature.parameterTypes[1] == this.options.usizeType); + assert(signature.returnType == Type.void); + + // __gc_mark(usize): void + element = this.elementsLookup.get("__gc_mark"); + assert(element.kind == ElementKind.FUNCTION_PROTOTYPE); + let gcMarkInstance = assert(this.resolver.resolveFunction(element, null)); + signature = gcMarkInstance.signature; + assert(signature.parameterTypes.length == 1); + assert(signature.parameterTypes[0] == this.options.usizeType); + assert(signature.returnType == Type.void); + + this.gcAllocateInstance = gcAllocateInstance; + this.gcLinkInstance = gcLinkInstance; + this.gcMarkInstance = gcMarkInstance; + this.gcHeaderSize = (2 * options.usizeType.byteSize + 4 + 7) & ~7; // TODO: hardcoded atm + this.hasGC = true; + } } /** Sets a constant integer value. */ @@ -2771,6 +2824,8 @@ export class Class extends Element { constructorInstance: Function | null = null; /** Operator overloads. */ overloads: Map | null = null; + /** Function index of the GC hook. */ + gcHookIndex: u32 = -1; /** Constructs a new class. */ constructor( diff --git a/src/resolver.ts b/src/resolver.ts index b37a96b4..7d23410e 100644 --- a/src/resolver.ts +++ b/src/resolver.ts @@ -377,7 +377,9 @@ export class Resolver extends DiagnosticEmitter { case ElementKind.GLOBAL: case ElementKind.LOCAL: case ElementKind.FIELD: { - let classReference = (target).type.classReference; + let type = (target).type; + assert(type != Type.void); + let classReference = type.classReference; if (!classReference) { this.error( DiagnosticCode.Property_0_does_not_exist_on_type_1, diff --git a/src/types.ts b/src/types.ts index 9e287097..a73310c8 100644 --- a/src/types.ts +++ b/src/types.ts @@ -5,7 +5,9 @@ import { Class, - FunctionTarget + FunctionTarget, + Program, + DecoratorFlags } from "./program"; import { @@ -134,6 +136,15 @@ export class Type { } } + /** Tests if this is a managed type that needs GC hooks. */ + isManaged(program: Program): bool { + if (program.hasGC) { + let classReference = this.classReference; + return classReference !== null && !classReference.hasDecorator(DecoratorFlags.UNMANAGED); + } + return false; + } + /** Computes the sign-extending shift in the target type. */ computeSmallIntegerShift(targetType: Type): u32 { return targetType.size - this.size; diff --git a/src/util/binary.ts b/src/util/binary.ts index ffff64f0..83e0aff0 100644 --- a/src/util/binary.ts +++ b/src/util/binary.ts @@ -1,5 +1,27 @@ /** @module util *//***/ +/** Reads an 8-bit integer from the specified buffer. */ +export function readI8(buffer: Uint8Array, offset: i32): i32 { + return buffer[offset]; +} + +/** Writes an 8-bit integer to the specified buffer. */ +export function writeI8(value: i32, buffer: Uint8Array, offset: i32): void { + buffer[offset] = value; +} + +/** Reads a 16-bit integer from the specified buffer. */ +export function readI16(buffer: Uint8Array, offset: i32): i32 { + return buffer[offset ] + | buffer[offset + 1] << 8; +} + +/** Writes a 16-bit integer to the specified buffer. */ +export function writeI16(value: i32, buffer: Uint8Array, offset: i32): void { + buffer[offset ] = value; + buffer[offset + 1] = value >>> 8; +} + /** Reads a 32-bit integer from the specified buffer. */ export function readI32(buffer: Uint8Array, offset: i32): i32 { return buffer[offset ] diff --git a/std/assembly/array.ts b/std/assembly/array.ts index 45a6c375..6ee16b40 100644 --- a/std/assembly/array.ts +++ b/std/assembly/array.ts @@ -1,8 +1,8 @@ import { MAX_BLENGTH, - HEADER_SIZE as HEADER_SIZE_AB, - allocUnsafe, - reallocUnsafe, + HEADER_SIZE, + allocateUnsafe, + reallocateUnsafe, loadUnsafe, storeUnsafe } from "./internal/arraybuffer"; @@ -22,11 +22,11 @@ export class Array { const MAX_LENGTH = MAX_BLENGTH >>> alignof(); if (length > MAX_LENGTH) throw new RangeError("Invalid array length"); var byteLength = length << alignof(); - var buffer = allocUnsafe(byteLength); + var buffer = allocateUnsafe(byteLength); this.buffer_ = buffer; this.length_ = length; memory.fill( - changetype(buffer) + HEADER_SIZE_AB, + changetype(buffer) + HEADER_SIZE, 0, byteLength ); @@ -42,7 +42,7 @@ export class Array { if (length > capacity) { const MAX_LENGTH = MAX_BLENGTH >>> alignof(); if (length > MAX_LENGTH) throw new RangeError("Invalid array length"); - buffer = reallocUnsafe(buffer, length << alignof()); + buffer = reallocateUnsafe(buffer, length << alignof()); this.buffer_ = buffer; } this.length_ = length; @@ -84,16 +84,18 @@ export class Array { if (index >= capacity) { const MAX_LENGTH = MAX_BLENGTH >>> alignof(); if (index >= MAX_LENGTH) throw new Error("Invalid array length"); - buffer = reallocUnsafe(buffer, (index + 1) << alignof()); + buffer = reallocateUnsafe(buffer, (index + 1) << alignof()); this.buffer_ = buffer; this.length_ = index + 1; } storeUnsafe(buffer, index, value); + if (isManaged()) __gc_link(changetype(this), changetype(value)); // tslint:disable-line } @operator("{}=") private __unchecked_set(index: i32, value: T): void { storeUnsafe(this.buffer_, index, value); + if (isManaged()) __gc_link(changetype(this), changetype(value)); // tslint:disable-line } includes(searchElement: T, fromIndex: i32 = 0): bool { @@ -141,11 +143,12 @@ export class Array { if (length >= capacity) { const MAX_LENGTH = MAX_BLENGTH >>> alignof(); if (length >= MAX_LENGTH) throw new Error("Invalid array length"); - buffer = reallocUnsafe(buffer, newLength << alignof()); + buffer = reallocateUnsafe(buffer, newLength << alignof()); this.buffer_ = buffer; } this.length_ = newLength; storeUnsafe(buffer, length, element); + if (isManaged()) __gc_link(changetype(this), changetype(element)); // tslint:disable-line return newLength; } @@ -217,8 +220,8 @@ export class Array { var element = loadUnsafe(buffer, 0); var lastIndex = length - 1; memory.copy( - changetype(buffer) + HEADER_SIZE_AB, - changetype(buffer) + HEADER_SIZE_AB + sizeof(), + changetype(buffer) + HEADER_SIZE, + changetype(buffer) + HEADER_SIZE + sizeof(), lastIndex << alignof() ); storeUnsafe(buffer, lastIndex, null); @@ -242,17 +245,18 @@ export class Array { if (length >= capacity) { const MAX_LENGTH = MAX_BLENGTH >>> alignof(); if (length >= MAX_LENGTH) throw new Error("Invalid array length"); - buffer = reallocUnsafe(buffer, newLength << alignof()); + buffer = reallocateUnsafe(buffer, newLength << alignof()); capacity = buffer.byteLength >>> alignof(); this.buffer_ = buffer; } memory.copy( - changetype(buffer) + HEADER_SIZE_AB + sizeof(), - changetype(buffer) + HEADER_SIZE_AB, + changetype(buffer) + HEADER_SIZE + sizeof(), + changetype(buffer) + HEADER_SIZE, (capacity - 1) << alignof() ); storeUnsafe(buffer, 0, element); this.length_ = newLength; + if (isManaged()) __gc_link(changetype(this), changetype(element)); // tslint:disable-line return newLength; } @@ -268,8 +272,8 @@ export class Array { var sliced = new Array(newLength); if (newLength) { memory.copy( - changetype(sliced.buffer_) + HEADER_SIZE_AB, - changetype(this.buffer_) + HEADER_SIZE_AB + (begin << alignof()), + changetype(sliced.buffer_) + HEADER_SIZE, + changetype(this.buffer_) + HEADER_SIZE + (begin << alignof()), newLength << alignof() ); } @@ -284,8 +288,8 @@ export class Array { deleteCount = min(deleteCount, length - start); var buffer = this.buffer_; memory.copy( - changetype(buffer) + HEADER_SIZE_AB + (start << alignof()), - changetype(buffer) + HEADER_SIZE_AB + ((start + deleteCount) << alignof()), + changetype(buffer) + HEADER_SIZE + (start << alignof()), + changetype(buffer) + HEADER_SIZE + ((start + deleteCount) << alignof()), deleteCount << alignof() ); this.length_ = length - deleteCount; @@ -328,4 +332,16 @@ export class Array { ); } } + + private __gc(): void { + if (isManaged()) { + let buffer = this.buffer_; + let offset: usize = 0; + let end = this.length_ << alignof(); + while (offset < end) { + __gc_mark(load(changetype(buffer) + offset, HEADER_SIZE)); // tslint:disable-line + offset += sizeof(); + } + } + } } diff --git a/std/assembly/arraybuffer.ts b/std/assembly/arraybuffer.ts index d165960f..1c741556 100644 --- a/std/assembly/arraybuffer.ts +++ b/std/assembly/arraybuffer.ts @@ -1,7 +1,7 @@ import { HEADER_SIZE, MAX_BLENGTH, - allocUnsafe + allocateUnsafe } from "./internal/arraybuffer"; @sealed @@ -11,7 +11,7 @@ export class ArrayBuffer { constructor(length: i32, unsafe: bool = false) { if (length > MAX_BLENGTH) throw new RangeError("Invalid array buffer length"); - var buffer = allocUnsafe(length); + var buffer = allocateUnsafe(length); if (!unsafe) memory.fill(changetype(buffer) + HEADER_SIZE, 0, length); return buffer; } @@ -23,7 +23,7 @@ export class ArrayBuffer { if (end < 0) end = max(len + end, 0); else end = min(end, len); var newLen = max(end - begin, 0); - var buffer = allocUnsafe(newLen); + var buffer = allocateUnsafe(newLen); memory.copy(changetype(buffer) + HEADER_SIZE, changetype(this) + HEADER_SIZE + begin, newLen); return buffer; } diff --git a/std/assembly/builtins.ts b/std/assembly/builtins.ts index a8fbe294..94e8b19c 100644 --- a/std/assembly/builtins.ts +++ b/std/assembly/builtins.ts @@ -2,7 +2,6 @@ @builtin @inline export const NaN: f64 = 0 / 0; @builtin @inline export const Infinity: f64 = 1 / 0; -@builtin export declare const HEAP_BASE: usize; @builtin export declare function isInteger(value?: T): bool; @builtin export declare function isFloat(value?: T): bool; @@ -12,6 +11,7 @@ @builtin export declare function isArray(value?: T): bool; @builtin export declare function isDefined(expression: void): bool; @builtin export declare function isConstant(expression: void): bool; +@builtin export declare function isManaged(value?: T): bool; @inline export function isNaN(value: T): bool { return value != value; } @inline export function isFinite(value: T): bool { return value - value == 0; } @@ -190,9 +190,3 @@ export namespace f64 { } @builtin export declare function start(): void; - -@builtin export declare function ERROR(message?: void): void; -@builtin export declare function WARNING(message?: void): void; -@builtin export declare function INFO(message?: void): void; - -@builtin export declare function __gc_iterate_roots(fn: (ref: usize) => void): void; diff --git a/std/assembly/collector/itcm.ts b/std/assembly/collector/itcm.ts index 921465cb..3b35ac97 100644 --- a/std/assembly/collector/itcm.ts +++ b/std/assembly/collector/itcm.ts @@ -4,18 +4,15 @@ * @module std/assembly/collector/itcm *//***/ -// Largely based on the Bach Le's μgc, see: https://github.com/bullno1/ugc +// Largely based on Bach Le's μgc, see: https://github.com/bullno1/ugc const TRACE = false; -import { - AL_MASK, - MAX_SIZE_32 -} from "../internal/allocator"; +/** Size of a managed object header. */ +export const HEADER_SIZE: usize = (offsetof() + AL_MASK) & ~AL_MASK; -import { - iterateRoots -} from "../gc"; +import { AL_MASK, MAX_SIZE_32 } from "../internal/allocator"; +import { iterateRoots } from "../gc"; /** Collector states. */ const enum State { @@ -35,8 +32,8 @@ var state = State.INIT; var white = 0; // From and to spaces -var from: ManagedObjectList; -var to: ManagedObjectList; +var fromSpace: ManagedObjectList; +var toSpace: ManagedObjectList; var iter: ManagedObject; // ╒═══════════════ Managed object layout (32-bit) ════════════════╕ @@ -47,15 +44,14 @@ var iter: ManagedObject; // ├─────────────────────────────────────────────────────────┴─┴───┤ │ usize // │ prev │ ◄─┘ // ├───────────────────────────────────────────────────────────────┤ -// │ visitFn │ +// │ hookFn │ // ╞═══════════════════════════════════════════════════════════════╡ SIZE ┘ ◄─ user-space reference // │ ... data ... │ // └───────────────────────────────────────────────────────────────┘ // C: color /** Represents a managed object in memory, consisting of a header followed by the object's data. */ -@unmanaged -class ManagedObject { +@unmanaged class ManagedObject { /** Pointer to the next object with color flags stored in the alignment bits. */ nextWithColor: usize; @@ -63,11 +59,8 @@ class ManagedObject { /** Pointer to the previous object. */ prev: ManagedObject; - /** Visitor function called with the user-space reference. */ - visitFn: (ref: usize) => void; - - /** Size of a managed object after alignment. */ - static readonly SIZE: usize = (offsetof() + AL_MASK) & ~AL_MASK; + /** Class-specific hook function called with the user-space reference. */ + hookFn: (ref: usize) => void; /** Gets the pointer to the next object. */ get next(): ManagedObject { @@ -104,14 +97,13 @@ class ManagedObject { const gray = 2; if (this == iter) iter = this.prev; this.unlink(); - to.push(this); + toSpace.push(this); this.nextWithColor = (this.nextWithColor & ~3) | gray; } } /** A list of managed objects. Used for the from and to spaces. */ -@unmanaged -class ManagedObjectList extends ManagedObject { +@unmanaged class ManagedObjectList extends ManagedObject { /** Inserts an object. */ push(obj: ManagedObject): void { @@ -137,13 +129,13 @@ function step(): void { switch (state) { case State.INIT: { if (TRACE) trace("gc~step/INIT"); - from = changetype(memory.allocate(ManagedObject.SIZE)); - from.visitFn = changetype<(ref: usize) => void>(-1); // would error - from.clear(); - to = changetype(memory.allocate(ManagedObject.SIZE)); - to.visitFn = changetype<(ref: usize) => void>(-1); // would error - to.clear(); - iter = to; + fromSpace = changetype(memory.allocate(HEADER_SIZE)); + fromSpace.hookFn = changetype<(ref: usize) => void>(-1); // would error + fromSpace.clear(); + toSpace = changetype(memory.allocate(HEADER_SIZE)); + toSpace.hookFn = changetype<(ref: usize) => void>(-1); // would error + toSpace.clear(); + iter = toSpace; state = State.IDLE; if (TRACE) trace("gc~state = IDLE"); // fall-through @@ -157,21 +149,21 @@ function step(): void { } case State.MARK: { obj = iter.next; - if (obj !== to) { + if (obj !== toSpace) { if (TRACE) trace("gc~step/MARK iterate", 1, objToRef(obj)); iter = obj; obj.color = !white; - obj.visitFn(objToRef(obj)); + obj.hookFn(objToRef(obj)); } else { if (TRACE) trace("gc~step/MARK finish"); iterateRoots(__gc_mark); obj = iter.next; - if (obj === to) { - let prevFrom = from; - from = to; - to = prevFrom; + if (obj === toSpace) { + let from = fromSpace; + fromSpace = toSpace; + toSpace = from; white = !white; - iter = prevFrom.next; + iter = from.next; state = State.SWEEP; if (TRACE) trace("gc~state = SWEEP"); } @@ -180,13 +172,13 @@ function step(): void { } case State.SWEEP: { obj = iter; - if (obj !== to) { + if (obj !== toSpace) { if (TRACE) trace("gc~step/SWEEP free", 1, objToRef(obj)); iter = obj.next; - memory.free(changetype(obj)); + if (changetype(obj) >= HEAP_BASE) memory.free(changetype(obj)); } else { if (TRACE) trace("gc~step/SWEEP finish"); - to.clear(); + toSpace.clear(); state = State.IDLE; if (TRACE) trace("gc~state = IDLE"); } @@ -196,26 +188,26 @@ function step(): void { } @inline function refToObj(ref: usize): ManagedObject { - return changetype(ref - ManagedObject.SIZE); + return changetype(ref - HEADER_SIZE); } @inline function objToRef(obj: ManagedObject): usize { - return changetype(obj) + ManagedObject.SIZE; + return changetype(obj) + HEADER_SIZE; } // Garbage collector interface @global export function __gc_allocate( size: usize, - visitFn: (ref: usize) => void + markFn: (ref: usize) => void ): usize { if (TRACE) trace("gc.allocate", 1, size); - if (size > MAX_SIZE_32 - ManagedObject.SIZE) unreachable(); + if (size > MAX_SIZE_32 - HEADER_SIZE) unreachable(); step(); // also makes sure it's initialized - var obj = changetype(memory.allocate(ManagedObject.SIZE + size)); - obj.visitFn = visitFn; + var obj = changetype(memory.allocate(HEADER_SIZE + size)); + obj.hookFn = markFn; obj.color = white; - from.push(obj); + fromSpace.push(obj); return objToRef(obj); } diff --git a/std/assembly/diagnostics.ts b/std/assembly/diagnostics.ts new file mode 100644 index 00000000..9e797ad1 --- /dev/null +++ b/std/assembly/diagnostics.ts @@ -0,0 +1,5 @@ +/* tslint:disable */ + +@builtin export declare function ERROR(message?: void): void; +@builtin export declare function WARNING(message?: void): void; +@builtin export declare function INFO(message?: void): void; diff --git a/std/assembly/gc.ts b/std/assembly/gc.ts index fa1f827b..ceaf6d98 100644 --- a/std/assembly/gc.ts +++ b/std/assembly/gc.ts @@ -1,28 +1,12 @@ -@builtin export declare function iterateRoots(fn: (ref: usize) => void): void; // tslint:disable-line +/* tslint:disable */ + +@builtin export declare function iterateRoots(fn: (ref: usize) => void): void; export namespace gc { - export function allocate(size: usize, visitFn: (ref: usize) => void): usize { - if (isDefined(__gc_allocate)) return __gc_allocate(size, visitFn); // tslint:disable-line - WARNING("Calling 'gc.allocate' requires a garbage collector to be present."); - return unreachable(); - } - export function collect(): void { - if (isDefined(__gc_collect)) { __gc_collect(); return; } // tslint:disable-line + if (isDefined(__gc_collect)) { __gc_collect(); return; } WARNING("Calling 'gc.collect' requires a garbage collector to be present."); unreachable(); } - - export function link(parentRef: usize, childRef: usize): void { - if (isDefined(__gc_link)) { __gc_link(parentRef, childRef); return; } // tslint:disable-line - WARNING("Calling 'gc.link' requires a garbage collector to be present."); - unreachable(); - } - - export function mark(ref: usize): void { - if (isDefined(__gc_mark)) { __gc_mark(ref); return; } // tslint:disable-line - WARNING("Calling 'gc.mark' requires a garbage collector to be present."); - unreachable(); - } } diff --git a/std/assembly/index.d.ts b/std/assembly/index.d.ts index 0516bde4..ab54cb4b 100644 --- a/std/assembly/index.d.ts +++ b/std/assembly/index.d.ts @@ -132,6 +132,8 @@ declare function isArray(value?: any): value is Array; declare function isDefined(expression: any): bool; /** Tests if the specified expression evaluates to a constant value. Compiles to a constant. */ declare function isConstant(expression: any): bool; +/** Tests if the specified type *or* expression is of a managed type. Compiles to a constant. */ +declare function isManaged(value?: any): bool; /** Traps if the specified value is not true-ish, otherwise returns the (non-nullable) value. */ declare function assert(isTrueish: T, message?: string): T & object; // any better way to model `: T != null`? /** Parses an integer string to a 64-bit float. */ @@ -354,10 +356,6 @@ declare namespace gc { export function allocate(size: usize, visitFn: (ref: usize) => void): usize; /** Performs a full garbage collection cycle. */ export function collect(): void; - /** Must be called when a managed object becomes a child of another one. */ - export function link(parentRef: usize, childRef: usize): void; - /** Must be called when a managed object is found reachable. */ - export function mark(ref: usize): void; } /** Table operations. */ diff --git a/std/assembly/internal/allocator.ts b/std/assembly/internal/allocator.ts index e478e6eb..04248ad9 100644 --- a/std/assembly/internal/allocator.ts +++ b/std/assembly/internal/allocator.ts @@ -1,11 +1,8 @@ /** Number of alignment bits. */ export const AL_BITS: u32 = 3; - /** Number of possible alignment values. */ export const AL_SIZE: usize = 1 << AL_BITS; - /** Mask to obtain just the alignment bits. */ export const AL_MASK: usize = AL_SIZE - 1; - /** Maximum 32-bit allocation size. */ export const MAX_SIZE_32: usize = 1 << 30; // 1GB diff --git a/std/assembly/internal/array.ts b/std/assembly/internal/array.ts index ef0a46a7..7c30f799 100644 --- a/std/assembly/internal/array.ts +++ b/std/assembly/internal/array.ts @@ -1,19 +1,12 @@ -import { - loadUnsafe, - storeUnsafe -} from "./arraybuffer"; +import { loadUnsafe, storeUnsafe } from "./arraybuffer"; +import { Array } from "../array"; -import { - Array -} from "../array"; - -/** Obtains the default comparator for the specified type. */ -@inline export function defaultComparator(): (a: T, b: T) => i32 { - return (a: T, b: T): i32 => ((a > b) - (a < b)); // compiles to a constant table index + return function compare(a: T, b: T): i32 { + return ((a > b) - (a < b)); + }; } -/** Sorts an Array with the 'Insertion Sort' algorithm. */ export function insertionSort(arr: Array, comparator: (a: T, b: T) => i32): Array { var buffer = arr.buffer_; for (let i: i32 = 0, length: i32 = arr.length; i < length; i++) { @@ -30,7 +23,6 @@ export function insertionSort(arr: Array, comparator: (a: T, b: T) => i32) return arr; } -/** Sorts an Array with the 'Weak Heap Sort' algorithm. */ export function weakHeapSort(arr: Array, comparator: (a: T, b: T) => i32): Array { const shift32 = alignof(); diff --git a/std/assembly/internal/arraybuffer.ts b/std/assembly/internal/arraybuffer.ts index 266e27fe..8484e8f6 100644 --- a/std/assembly/internal/arraybuffer.ts +++ b/std/assembly/internal/arraybuffer.ts @@ -2,12 +2,10 @@ import { AL_MASK, MAX_SIZE_32 } from "./allocator"; /** Size of an ArrayBuffer header. */ export const HEADER_SIZE: usize = (offsetof() + AL_MASK) & ~AL_MASK; - /** Maximum byte length of an ArrayBuffer. */ export const MAX_BLENGTH: i32 = MAX_SIZE_32 - HEADER_SIZE; -/** Computes an ArrayBuffer's size in memory. */ -export function computeSize(byteLength: i32): usize { +function computeSize(byteLength: i32): usize { // round up to power of 2, with HEADER_SIZE=8: // 0 -> 2^3 = 8 // 1..8 -> 2^4 = 16 @@ -17,16 +15,23 @@ export function computeSize(byteLength: i32): usize { return 1 << (32 - clz(byteLength + HEADER_SIZE - 1)); } -/** Allocates a raw ArrayBuffer. Contents remain uninitialized. */ -export function allocUnsafe(byteLength: i32): ArrayBuffer { +// Low-level utility + +function __gc(ref: usize): void {} + +export function allocateUnsafe(byteLength: i32): ArrayBuffer { assert(byteLength <= MAX_BLENGTH); - var buffer = memory.allocate(computeSize(byteLength)); + var buffer: usize; + if (isManaged()) { + buffer = __gc_allocate(computeSize(byteLength), __gc); // tslint:disable-line + } else { + buffer = memory.allocate(computeSize(byteLength)); + } store(buffer, byteLength, offsetof("byteLength")); return changetype(buffer); } -/** Reallocates an ArrayBuffer, resizing it as requested. Tries to modify the buffer in place. */ -export function reallocUnsafe(buffer: ArrayBuffer, newByteLength: i32): ArrayBuffer { +export function reallocateUnsafe(buffer: ArrayBuffer, newByteLength: i32): ArrayBuffer { var oldByteLength = buffer.byteLength; if (newByteLength > oldByteLength) { assert(newByteLength <= MAX_BLENGTH); @@ -38,7 +43,7 @@ export function reallocUnsafe(buffer: ArrayBuffer, newByteLength: i32): ArrayBuf (newByteLength - oldByteLength) ); } else { // slow path: copy to new buffer - let newBuffer = allocUnsafe(newByteLength); + let newBuffer = allocateUnsafe(newByteLength); memory.copy( changetype(newBuffer) + HEADER_SIZE, changetype(buffer) + HEADER_SIZE, @@ -59,22 +64,18 @@ export function reallocUnsafe(buffer: ArrayBuffer, newByteLength: i32): ArrayBuf return buffer; } -@inline -export function loadUnsafe(buffer: ArrayBuffer, index: i32): V { +@inline export function loadUnsafe(buffer: ArrayBuffer, index: i32): V { return load(changetype(buffer) + (index << alignof()), HEADER_SIZE); } -@inline -export function storeUnsafe(buffer: ArrayBuffer, index: i32, value: V): void { +@inline export function storeUnsafe(buffer: ArrayBuffer, index: i32, value: V): void { store(changetype(buffer) + (index << alignof()), value, HEADER_SIZE); } -@inline -export function loadUnsafeWithOffset(buffer: ArrayBuffer, index: i32, byteOffset: i32): V { +@inline export function loadUnsafeWithOffset(buffer: ArrayBuffer, index: i32, byteOffset: i32): V { return load(changetype(buffer) + byteOffset + (index << alignof()), HEADER_SIZE); } -@inline -export function storeUnsafeWithOffset(buffer: ArrayBuffer, index: i32, value: V, byteOffset: i32): void { +@inline export function storeUnsafeWithOffset(buffer: ArrayBuffer, index: i32, value: V, byteOffset: i32): void { store(changetype(buffer) + byteOffset + (index << alignof()), value, HEADER_SIZE); } diff --git a/std/assembly/internal/hash.ts b/std/assembly/internal/hash.ts index 3eb8068a..d0c2c581 100644 --- a/std/assembly/internal/hash.ts +++ b/std/assembly/internal/hash.ts @@ -1,5 +1,5 @@ import { - HEADER_SIZE as HEADER_SIZE_STR + HEADER_SIZE as STRING_HEADER_SIZE } from "./string"; /** Computes the 32-bit hash of a value of any type. */ @@ -66,7 +66,7 @@ function hash64(key: u64): u32 { function hashStr(key: string): u32 { var v = FNV_OFFSET; for (let i: usize = 0, k: usize = key.length << 1; i < k; ++i) { - v = (v ^ load(changetype(key) + i, HEADER_SIZE_STR)) * FNV_PRIME; + v = (v ^ load(changetype(key) + i, STRING_HEADER_SIZE)) * FNV_PRIME; } return v; } diff --git a/std/assembly/internal/itoa.ts b/std/assembly/internal/itoa.ts index 0f5d36f3..611ae543 100644 --- a/std/assembly/internal/itoa.ts +++ b/std/assembly/internal/itoa.ts @@ -1,7 +1,7 @@ import { CharCode, - allocate as allocateString, + allocateUnsafe as allocateUnsafeString, HEADER_SIZE as STRING_HEADER_SIZE } from "./string"; @@ -194,7 +194,7 @@ export function utoa32(value: u32): string { if (!value) return "0"; var decimals = decimalCountU32(value); - var buffer = allocateString(decimals); + var buffer = allocateUnsafeString(decimals); utoa32_core(changetype(buffer), value, decimals); return changetype(buffer); @@ -207,7 +207,7 @@ export function itoa32(value: i32): string { if (isneg) value = -value; var decimals = decimalCountU32(value) + isneg; - var buffer = allocateString(decimals); + var buffer = allocateUnsafeString(decimals); utoa32_core(changetype(buffer), value, decimals); if (isneg) store(changetype(buffer), CharCode.MINUS, STRING_HEADER_SIZE); @@ -222,11 +222,11 @@ export function utoa64(value: u64): string { if (value <= u32.MAX_VALUE) { let value32 = value; let decimals = decimalCountU32(value32); - buffer = allocateString(decimals); + buffer = allocateUnsafeString(decimals); utoa32_core(changetype(buffer), value32, decimals); } else { let decimals = decimalCountU64(value); - buffer = allocateString(decimals); + buffer = allocateUnsafeString(decimals); utoa64_core(changetype(buffer), value, decimals); } @@ -243,11 +243,11 @@ export function itoa64(value: i64): string { if (value <= u32.MAX_VALUE) { let value32 = value; let decimals = decimalCountU32(value32) + isneg; - buffer = allocateString(decimals); + buffer = allocateUnsafeString(decimals); utoa32_core(changetype(buffer), value32, decimals); } else { let decimals = decimalCountU64(value) + isneg; - buffer = allocateString(decimals); + buffer = allocateUnsafeString(decimals); utoa64_core(changetype(buffer), value, decimals); } if (isneg) store(changetype(buffer), CharCode.MINUS, STRING_HEADER_SIZE); diff --git a/std/assembly/internal/memory.ts b/std/assembly/internal/memory.ts new file mode 100644 index 00000000..88de35c8 --- /dev/null +++ b/std/assembly/internal/memory.ts @@ -0,0 +1,254 @@ +// this function will go away once `memory.copy` becomes an intrinsic +export function memcpy(dest: usize, src: usize, n: usize): void { // see: musl/src/string/memcpy.c + var w: u32, x: u32; + + // copy 1 byte each until src is aligned to 4 bytes + while (n && (src & 3)) { + store(dest++, load(src++)); + n--; + } + + // if dst is aligned to 4 bytes as well, copy 4 bytes each + if ((dest & 3) == 0) { + while (n >= 16) { + store(dest , load(src )); + store(dest + 4, load(src + 4)); + store(dest + 8, load(src + 8)); + store(dest + 12, load(src + 12)); + src += 16; dest += 16; n -= 16; + } + if (n & 8) { + store(dest , load(src )); + store(dest + 4, load(src + 4)); + dest += 8; src += 8; + } + if (n & 4) { + store(dest, load(src)); + dest += 4; src += 4; + } + if (n & 2) { // drop to 2 bytes each + store(dest, load(src)); + dest += 2; src += 2; + } + if (n & 1) { // drop to 1 byte + store(dest++, load(src++)); + } + return; + } + + // if dst is not aligned to 4 bytes, use alternating shifts to copy 4 bytes each + // doing shifts if faster when copying enough bytes (here: 32 or more) + if (n >= 32) { + switch (dest & 3) { + // known to be != 0 + case 1: { + w = load(src); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + n -= 3; + while (n >= 17) { + x = load(src + 1); + store(dest, w >> 24 | x << 8); + w = load(src + 5); + store(dest + 4, x >> 24 | w << 8); + x = load(src + 9); + store(dest + 8, w >> 24 | x << 8); + w = load(src + 13); + store(dest + 12, x >> 24 | w << 8); + src += 16; dest += 16; n -= 16; + } + break; + } + case 2: { + w = load(src); + store(dest++, load(src++)); + store(dest++, load(src++)); + n -= 2; + while (n >= 18) { + x = load(src + 2); + store(dest, w >> 16 | x << 16); + w = load(src + 6); + store(dest + 4, x >> 16 | w << 16); + x = load(src + 10); + store(dest + 8, w >> 16 | x << 16); + w = load(src + 14); + store(dest + 12, x >> 16 | w << 16); + src += 16; dest += 16; n -= 16; + } + break; + } + case 3: { + w = load(src); + store(dest++, load(src++)); + n -= 1; + while (n >= 19) { + x = load(src + 3); + store(dest, w >> 8 | x << 24); + w = load(src + 7); + store(dest + 4, x >> 8 | w << 24); + x = load(src + 11); + store(dest + 8, w >> 8 | x << 24); + w = load(src + 15); + store(dest + 12, x >> 8 | w << 24); + src += 16; dest += 16; n -= 16; + } + break; + } + } + } + + // copy remaining bytes one by one + if (n & 16) { + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + } + if (n & 8) { + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + } + if (n & 4) { + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + store(dest++, load(src++)); + } + if (n & 2) { + store(dest++, load(src++)); + store(dest++, load(src++)); + } + if (n & 1) { + store(dest++, load(src++)); + } +} + +// this function will go away once `memory.copy` becomes an intrinsic +export function memmove(dest: usize, src: usize, n: usize): void { // see: musl/src/string/memmove.c + if (dest == src) return; + if (src + n <= dest || dest + n <= src) { + memcpy(dest, src, n); + return; + } + if (dest < src) { + if ((src & 7) == (dest & 7)) { + while (dest & 7) { + if (!n) return; + --n; + store(dest++, load(src++)); + } + while (n >= 8) { + store(dest, load(src)); + n -= 8; + dest += 8; + src += 8; + } + } + while (n) { + store(dest++, load(src++)); + --n; + } + } else { + if ((src & 7) == (dest & 7)) { + while ((dest + n) & 7) { + if (!n) return; + store(dest + --n, load(src + n)); + } + while (n >= 8) { + n -= 8; + store(dest + n, load(src + n)); + } + } + while (n) { + store(dest + --n, load(src + n)); + } + } +} + +// this function will go away once `memory.fill` becomes an intrinsic +export function memset(dest: usize, c: u8, n: usize): void { // see: musl/src/string/memset + + // fill head and tail with minimal branching + if (!n) return; + store(dest, c); + store(dest + n - 1, c); + if (n <= 2) return; + + store(dest + 1, c); + store(dest + 2, c); + store(dest + n - 2, c); + store(dest + n - 3, c); + if (n <= 6) return; + store(dest + 3, c); + store(dest + n - 4, c); + if (n <= 8) return; + + // advance pointer to align it at 4-byte boundary + var k: usize = -dest & 3; + dest += k; + n -= k; + n &= -4; + + var c32: u32 = -1 / 255 * c; + + // fill head/tail up to 28 bytes each in preparation + store(dest, c32); + store(dest + n - 4, c32); + if (n <= 8) return; + store(dest + 4, c32); + store(dest + 8, c32); + store(dest + n - 12, c32); + store(dest + n - 8, c32); + if (n <= 24) return; + store(dest + 12, c32); + store(dest + 16, c32); + store(dest + 20, c32); + store(dest + 24, c32); + store(dest + n - 28, c32); + store(dest + n - 24, c32); + store(dest + n - 20, c32); + store(dest + n - 16, c32); + + // align to a multiple of 8 + k = 24 + (dest & 4); + dest += k; + n -= k; + + // copy 32 bytes each + var c64: u64 = c32 | (c32 << 32); + while (n >= 32) { + store(dest, c64); + store(dest + 8, c64); + store(dest + 16, c64); + store(dest + 24, c64); + n -= 32; + dest += 32; + } +} + +export function memcmp(vl: usize, vr: usize, n: usize): i32 { // see: musl/src/string/memcmp.c + if (vl == vr) return 0; + while (n != 0 && load(vl) == load(vr)) { + n--; vl++; vr++; + } + return n ? load(vl) - load(vr) : 0; +} diff --git a/std/assembly/internal/string.ts b/std/assembly/internal/string.ts index 0f0d08ff..ee1ad803 100644 --- a/std/assembly/internal/string.ts +++ b/std/assembly/internal/string.ts @@ -1,34 +1,27 @@ -import { - MAX_SIZE_32 -} from "./allocator"; - -import { - String -} from "../string"; +import { MAX_SIZE_32 } from "./allocator"; +import { String } from "../string"; /** Size of a String header. */ export const HEADER_SIZE = (offsetof() + 1) & ~1; // 2 byte aligned - /** Maximum length of a String. */ export const MAX_LENGTH = (MAX_SIZE_32 - HEADER_SIZE) >>> 1; -/** Singleton empty String. */ -export const EMPTY = changetype(""); // TODO: is this a bad idea with '===' in place? +// Low-level utility -@inline -export function clamp(val: T, lo: T, hi: T): T { - return min(max(val, lo), hi); -} +function __gc(ref: usize): void {} -/** Allocates a raw String with uninitialized contents. */ -export function allocate(length: i32): String { +export function allocateUnsafe(length: i32): String { assert(length > 0 && length <= MAX_LENGTH); - var buffer = memory.allocate(HEADER_SIZE + (length << 1)); + var buffer: usize; + if (isManaged()) { + buffer = __gc_allocate(HEADER_SIZE + (length << 1), __gc); // tslint:disable-line + } else { + buffer = memory.allocate(HEADER_SIZE + (length << 1)); + } store(buffer, length); return changetype(buffer); } -@inline export function copyUnsafe(dest: String, destOffset: usize, src: String, srcOffset: usize, len: usize): void { memory.copy( changetype(dest) + (destOffset << 1) + HEADER_SIZE, @@ -37,120 +30,6 @@ export function copyUnsafe(dest: String, destOffset: usize, src: String, srcOffs ); } -export function isWhiteSpaceOrLineTerminator(c: u16): bool { - switch (c) { - case 10: // - case 13: // - case 8232: // - case 8233: // - case 9: // - case 11: // - case 12: // - case 32: // - case 160: // - case 65279: { // - return true; - } - default: return false; - } -} - -export const enum CharCode { - PLUS = 0x2B, - MINUS = 0x2D, - DOT = 0x2E, - _0 = 0x30, - _1 = 0x31, - _2 = 0x32, - _3 = 0x33, - _4 = 0x34, - _5 = 0x35, - _6 = 0x36, - _7 = 0x37, - _8 = 0x38, - _9 = 0x39, - A = 0x41, - B = 0x42, - E = 0x45, - O = 0x4F, - X = 0x58, - Z = 0x5a, - a = 0x61, - b = 0x62, - e = 0x65, - o = 0x6F, - x = 0x78, - z = 0x7A -} - -export function parse(str: String, radix: i32 = 0): T { - var len: i32 = str.length; - if (!len) return NaN; - - var ptr = changetype(str) /* + HEAD -> offset */; - var code = load(ptr, HEADER_SIZE); - - // determine sign - var sign: T; - if (code == CharCode.MINUS) { - if (!--len) return NaN; - code = load(ptr += 2, HEADER_SIZE); - sign = -1; - } else if (code == CharCode.PLUS) { - if (!--len) return NaN; - code = load(ptr += 2, HEADER_SIZE); - sign = 1; - } else { - sign = 1; - } - - // determine radix - if (!radix) { - if (code == CharCode._0 && len > 2) { - switch (load(ptr + 2, HEADER_SIZE)) { - case CharCode.B: - case CharCode.b: { - ptr += 4; len -= 2; - radix = 2; - break; - } - case CharCode.O: - case CharCode.o: { - ptr += 4; len -= 2; - radix = 8; - break; - } - case CharCode.X: - case CharCode.x: { - ptr += 4; len -= 2; - radix = 16; - break; - } - default: radix = 10; - } - } else radix = 10; - } else if (radix < 2 || radix > 36) { - return NaN; - } - - // calculate value - var num: T = 0; - while (len--) { - code = load(ptr, HEADER_SIZE); - if (code >= CharCode._0 && code <= CharCode._9) { - code -= CharCode._0; - } else if (code >= CharCode.A && code <= CharCode.Z) { - code -= CharCode.A - 10; - } else if (code >= CharCode.a && code <= CharCode.z) { - code -= CharCode.a - 10; - } else break; - if (code >= radix) break; - num = (num * radix) + code; - ptr += 2; - } - return sign * num; -} - export function compareUnsafe(str1: String, offset1: usize, str2: String, offset2: usize, len: usize): i32 { var cmp: i32 = 0; var ptr1 = changetype(str1) + (offset1 << 1); @@ -219,3 +98,118 @@ export function repeatUnsafe(dest: String, destOffset: usize, src: String, count } } } + +// Helpers + +export const enum CharCode { + PLUS = 0x2B, + MINUS = 0x2D, + DOT = 0x2E, + _0 = 0x30, + _1 = 0x31, + _2 = 0x32, + _3 = 0x33, + _4 = 0x34, + _5 = 0x35, + _6 = 0x36, + _7 = 0x37, + _8 = 0x38, + _9 = 0x39, + A = 0x41, + B = 0x42, + E = 0x45, + O = 0x4F, + X = 0x58, + Z = 0x5a, + a = 0x61, + b = 0x62, + e = 0x65, + o = 0x6F, + x = 0x78, + z = 0x7A +} + +export function isWhiteSpaceOrLineTerminator(c: u16): bool { + switch (c) { + case 10: // + case 13: // + case 8232: // + case 8233: // + case 9: // + case 11: // + case 12: // + case 32: // + case 160: // + case 65279: return true; // + default: return false; + } +} + +/** Parses a string to an integer (usually), using the specified radix. */ +export function parse(str: String, radix: i32 = 0): T { + var len: i32 = str.length; + if (!len) return NaN; + + var ptr = changetype(str) /* + HEAD -> offset */; + var code = load(ptr, HEADER_SIZE); + + // determine sign + var sign: T; + if (code == CharCode.MINUS) { + if (!--len) return NaN; + code = load(ptr += 2, HEADER_SIZE); + sign = -1; + } else if (code == CharCode.PLUS) { + if (!--len) return NaN; + code = load(ptr += 2, HEADER_SIZE); + sign = 1; + } else { + sign = 1; + } + + // determine radix + if (!radix) { + if (code == CharCode._0 && len > 2) { + switch (load(ptr + 2, HEADER_SIZE)) { + case CharCode.B: + case CharCode.b: { + ptr += 4; len -= 2; + radix = 2; + break; + } + case CharCode.O: + case CharCode.o: { + ptr += 4; len -= 2; + radix = 8; + break; + } + case CharCode.X: + case CharCode.x: { + ptr += 4; len -= 2; + radix = 16; + break; + } + default: radix = 10; + } + } else radix = 10; + } else if (radix < 2 || radix > 36) { + return NaN; + } + + // calculate value + var num: T = 0; + while (len--) { + code = load(ptr, HEADER_SIZE); + if (code >= CharCode._0 && code <= CharCode._9) { + code -= CharCode._0; + } else if (code >= CharCode.A && code <= CharCode.Z) { + code -= CharCode.A - 10; + } else if (code >= CharCode.a && code <= CharCode.z) { + code -= CharCode.a - 10; + } else break; + if (code >= radix) break; + num = (num * radix) + code; + ptr += 2; + } + return sign * num; +} diff --git a/std/assembly/internal/typedarray.ts b/std/assembly/internal/typedarray.ts index a2d653bd..1a40a4ff 100644 --- a/std/assembly/internal/typedarray.ts +++ b/std/assembly/internal/typedarray.ts @@ -1,7 +1,7 @@ import { - HEADER_SIZE as HEADER_SIZE_AB, - MAX_BLENGTH, - allocUnsafe, + HEADER_SIZE as AB_HEADER_SIZE, + MAX_BLENGTH as AB_MAX_BLENGTH, + allocateUnsafe, loadUnsafeWithOffset, storeUnsafeWithOffset } from "./arraybuffer"; @@ -14,11 +14,11 @@ export abstract class TypedArray { readonly byteLength: i32; constructor(length: i32) { - const MAX_LENGTH = MAX_BLENGTH / sizeof(); + const MAX_LENGTH = AB_MAX_BLENGTH / sizeof(); if (length > MAX_LENGTH) throw new RangeError("Invalid typed array length"); var byteLength = length << alignof(); - var buffer = allocUnsafe(byteLength); - memory.fill(changetype(buffer) + HEADER_SIZE_AB, 0, byteLength); + var buffer = allocateUnsafe(byteLength); + memory.fill(changetype(buffer) + AB_HEADER_SIZE, 0, byteLength); this.buffer = buffer; this.byteOffset = 0; this.byteLength = byteLength; diff --git a/std/assembly/map.ts b/std/assembly/map.ts index 82e32ef4..62d43a87 100644 --- a/std/assembly/map.ts +++ b/std/assembly/map.ts @@ -114,6 +114,8 @@ export class Map { let bucketPtrBase = changetype(this.buckets) + (hashCode & this.bucketsMask) * BUCKET_SIZE; entry.taggedNext = load(bucketPtrBase, HEADER_SIZE_AB); store(bucketPtrBase, changetype(entry), HEADER_SIZE_AB); + if (isManaged()) __gc_link(changetype(this), changetype(key)); // tslint:disable-line + if (isManaged()) __gc_link(changetype(this), changetype(value)); // tslint:disable-line } } @@ -162,4 +164,22 @@ export class Map { this.entriesCapacity = newEntriesCapacity; this.entriesOffset = this.entriesCount; } + + private __gc(): void { + if (isManaged() || isManaged()) { + let entries = this.entries; + let offset: usize = 0; + let end: usize = this.entriesOffset * ENTRY_SIZE(); + while (offset < end) { + let entry = changetype>( + changetype(entries) + HEADER_SIZE_AB + offset * ENTRY_SIZE() + ); + if (!(entry.taggedNext & EMPTY)) { + if (isManaged()) __gc_mark(changetype(entry.key)); // tslint:disable-line + if (isManaged()) __gc_mark(changetype(entry.value)); // tslint:disable-line + } + offset += ENTRY_SIZE(); + } + } + } } diff --git a/std/assembly/memory.ts b/std/assembly/memory.ts index 51d82695..c4b63790 100644 --- a/std/assembly/memory.ts +++ b/std/assembly/memory.ts @@ -1,21 +1,27 @@ +import { memcmp, memmove, memset } from "./internal/memory"; + +@builtin export declare const HEAP_BASE: usize; // tslint:disable-line + +/* tslint:disable */ + export namespace memory { - @builtin export declare function size(): i32; // tslint:disable-line + @builtin export declare function size(): i32; - @builtin export declare function grow(pages: i32): i32; // tslint:disable-line + @builtin export declare function grow(pages: i32): i32; - export function fill(dest: usize, c: u8, n: usize): void { // see: musl/src/string/memset - if (isDefined(__memory_fill)) { __memory_fill(dest, c, n); return; } // tslint:disable-line + @inline export function fill(dest: usize, c: u8, n: usize): void { // see: musl/src/string/memset + if (isDefined(__memory_fill)) { __memory_fill(dest, c, n); return; } memset(dest, c, n); } - export function copy(dest: usize, src: usize, n: usize): void { // see: musl/src/string/memmove.c - if (isDefined(__memory_copy)) { __memory_copy(dest, src, n); return; } // tslint:disable-line + @inline export function copy(dest: usize, src: usize, n: usize): void { // see: musl/src/string/memmove.c + if (isDefined(__memory_copy)) { __memory_copy(dest, src, n); return; } memmove(dest, src, n); } - export function compare(vl: usize, vr: usize, n: usize): i32 { // see: musl/src/string/memcmp.c - if (isDefined(__memory_compare)) return __memory_compare(vl, vr, n); // tslint:disable-line + @inline export function compare(vl: usize, vr: usize, n: usize): i32 { // see: musl/src/string/memcmp.c + if (isDefined(__memory_compare)) return __memory_compare(vl, vr, n); return memcmp(vl, vr, n); } @@ -31,275 +37,20 @@ export namespace memory { // Allocator - export function allocate(size: usize): usize { - if (isDefined(__memory_allocate)) return __memory_allocate(size); // tslint:disable-line + @inline export function allocate(size: usize): usize { + if (isDefined(__memory_allocate)) return __memory_allocate(size); WARNING("Calling 'memory.allocate' requires a memory manager to be present."); return unreachable(); } - export function free(ptr: usize): void { - if (isDefined(__memory_free)) { __memory_free(ptr); return; } // tslint:disable-line + @inline export function free(ptr: usize): void { + if (isDefined(__memory_free)) { __memory_free(ptr); return; } WARNING("Calling 'memory.free' requires a memory manager to be present."); unreachable(); } - export function reset(): void { - if (isDefined(__memory_reset)) { __memory_reset(); return; } // tslint:disable-line + @inline export function reset(): void { + if (isDefined(__memory_reset)) { __memory_reset(); return; } unreachable(); } } - -// this function will go away once `memory.copy` becomes an intrinsic -function memcpy(dest: usize, src: usize, n: usize): void { // see: musl/src/string/memcpy.c - var w: u32, x: u32; - - // copy 1 byte each until src is aligned to 4 bytes - while (n && (src & 3)) { - store(dest++, load(src++)); - n--; - } - - // if dst is aligned to 4 bytes as well, copy 4 bytes each - if ((dest & 3) == 0) { - while (n >= 16) { - store(dest , load(src )); - store(dest + 4, load(src + 4)); - store(dest + 8, load(src + 8)); - store(dest + 12, load(src + 12)); - src += 16; dest += 16; n -= 16; - } - if (n & 8) { - store(dest , load(src )); - store(dest + 4, load(src + 4)); - dest += 8; src += 8; - } - if (n & 4) { - store(dest, load(src)); - dest += 4; src += 4; - } - if (n & 2) { // drop to 2 bytes each - store(dest, load(src)); - dest += 2; src += 2; - } - if (n & 1) { // drop to 1 byte - store(dest++, load(src++)); - } - return; - } - - // if dst is not aligned to 4 bytes, use alternating shifts to copy 4 bytes each - // doing shifts if faster when copying enough bytes (here: 32 or more) - if (n >= 32) { - switch (dest & 3) { - // known to be != 0 - case 1: { - w = load(src); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - n -= 3; - while (n >= 17) { - x = load(src + 1); - store(dest, w >> 24 | x << 8); - w = load(src + 5); - store(dest + 4, x >> 24 | w << 8); - x = load(src + 9); - store(dest + 8, w >> 24 | x << 8); - w = load(src + 13); - store(dest + 12, x >> 24 | w << 8); - src += 16; dest += 16; n -= 16; - } - break; - } - case 2: { - w = load(src); - store(dest++, load(src++)); - store(dest++, load(src++)); - n -= 2; - while (n >= 18) { - x = load(src + 2); - store(dest, w >> 16 | x << 16); - w = load(src + 6); - store(dest + 4, x >> 16 | w << 16); - x = load(src + 10); - store(dest + 8, w >> 16 | x << 16); - w = load(src + 14); - store(dest + 12, x >> 16 | w << 16); - src += 16; dest += 16; n -= 16; - } - break; - } - case 3: { - w = load(src); - store(dest++, load(src++)); - n -= 1; - while (n >= 19) { - x = load(src + 3); - store(dest, w >> 8 | x << 24); - w = load(src + 7); - store(dest + 4, x >> 8 | w << 24); - x = load(src + 11); - store(dest + 8, w >> 8 | x << 24); - w = load(src + 15); - store(dest + 12, x >> 8 | w << 24); - src += 16; dest += 16; n -= 16; - } - break; - } - } - } - - // copy remaining bytes one by one - if (n & 16) { - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - } - if (n & 8) { - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - } - if (n & 4) { - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - store(dest++, load(src++)); - } - if (n & 2) { - store(dest++, load(src++)); - store(dest++, load(src++)); - } - if (n & 1) { - store(dest++, load(src++)); - } -} - -// this function will go away once `memory.copy` becomes an intrinsic -function memmove(dest: usize, src: usize, n: usize): void { // see: musl/src/string/memmove.c - if (dest == src) return; - if (src + n <= dest || dest + n <= src) { - memcpy(dest, src, n); - return; - } - if (dest < src) { - if ((src & 7) == (dest & 7)) { - while (dest & 7) { - if (!n) return; - --n; - store(dest++, load(src++)); - } - while (n >= 8) { - store(dest, load(src)); - n -= 8; - dest += 8; - src += 8; - } - } - while (n) { - store(dest++, load(src++)); - --n; - } - } else { - if ((src & 7) == (dest & 7)) { - while ((dest + n) & 7) { - if (!n) return; - store(dest + --n, load(src + n)); - } - while (n >= 8) { - n -= 8; - store(dest + n, load(src + n)); - } - } - while (n) { - store(dest + --n, load(src + n)); - } - } -} - -// this function will go away once `memory.fill` becomes an intrinsic -function memset(dest: usize, c: u8, n: usize): void { // see: musl/src/string/memset - - // fill head and tail with minimal branching - if (!n) return; - store(dest, c); - store(dest + n - 1, c); - if (n <= 2) return; - - store(dest + 1, c); - store(dest + 2, c); - store(dest + n - 2, c); - store(dest + n - 3, c); - if (n <= 6) return; - store(dest + 3, c); - store(dest + n - 4, c); - if (n <= 8) return; - - // advance pointer to align it at 4-byte boundary - var k: usize = -dest & 3; - dest += k; - n -= k; - n &= -4; - - var c32: u32 = -1 / 255 * c; - - // fill head/tail up to 28 bytes each in preparation - store(dest, c32); - store(dest + n - 4, c32); - if (n <= 8) return; - store(dest + 4, c32); - store(dest + 8, c32); - store(dest + n - 12, c32); - store(dest + n - 8, c32); - if (n <= 24) return; - store(dest + 12, c32); - store(dest + 16, c32); - store(dest + 20, c32); - store(dest + 24, c32); - store(dest + n - 28, c32); - store(dest + n - 24, c32); - store(dest + n - 20, c32); - store(dest + n - 16, c32); - - // align to a multiple of 8 - k = 24 + (dest & 4); - dest += k; - n -= k; - - // copy 32 bytes each - var c64: u64 = c32 | (c32 << 32); - while (n >= 32) { - store(dest, c64); - store(dest + 8, c64); - store(dest + 16, c64); - store(dest + 24, c64); - n -= 32; - dest += 32; - } -} - -function memcmp(vl: usize, vr: usize, n: usize): i32 { // see: musl/src/string/memcmp.c - if (vl == vr) return 0; - while (n != 0 && load(vl) == load(vr)) { - n--; vl++; vr++; - } - return n ? load(vl) - load(vr) : 0; -} diff --git a/std/assembly/set.ts b/std/assembly/set.ts index 40aba2b7..8a2b602a 100644 --- a/std/assembly/set.ts +++ b/std/assembly/set.ts @@ -104,6 +104,7 @@ export class Set { let bucketPtrBase = changetype(this.buckets) + (hashCode & this.bucketsMask) * BUCKET_SIZE; entry.taggedNext = load(bucketPtrBase, HEADER_SIZE_AB); store(bucketPtrBase, changetype(entry), HEADER_SIZE_AB); + if (isManaged()) __gc_link(changetype(this), changetype(key)); // tslint:disable-line } } @@ -151,4 +152,19 @@ export class Set { this.entriesCapacity = newEntriesCapacity; this.entriesOffset = this.entriesCount; } + + private __gc(): void { + if (isManaged()) { + let entries = this.entries; + let offset: usize = 0; + let end: usize = this.entriesOffset * ENTRY_SIZE(); + while (offset < end) { + let entry = changetype>( + changetype(entries) + HEADER_SIZE_AB + offset * ENTRY_SIZE() + ); + if (!(entry.taggedNext & EMPTY)) __gc_mark(changetype(entry.key)); // tslint:disable-line + offset += ENTRY_SIZE(); + } + } + } } diff --git a/std/assembly/string.ts b/std/assembly/string.ts index a623d961..f650cbd9 100644 --- a/std/assembly/string.ts +++ b/std/assembly/string.ts @@ -1,9 +1,7 @@ import { HEADER_SIZE, MAX_LENGTH, - EMPTY, - clamp, - allocate, + allocateUnsafe, compareUnsafe, repeatUnsafe, copyUnsafe, @@ -20,7 +18,7 @@ export class String { // TODO Add and handle second argument static fromCharCode(code: i32): String { if (!code) return changetype("\0"); - var out = allocate(1); + var out = allocateUnsafe(1); store( changetype(out), code, @@ -33,7 +31,7 @@ export class String { assert(code <= 0x10FFFF); // Invalid code point range if (!code) return changetype("\0"); var sur = code > 0xFFFF; - var out = allocate(sur + 1); + var out = allocateUnsafe(sur + 1); if (!sur) { store( changetype(out), @@ -57,11 +55,9 @@ export class String { charAt(pos: i32): String { assert(this !== null); - if (pos >= this.length) { - return EMPTY; - } + if (pos >= this.length) return changetype(""); - var out = allocate(1); + var out = allocateUnsafe(1); store( changetype(out), load( @@ -115,8 +111,8 @@ export class String { var thisLen: isize = this.length; var otherLen: isize = other.length; var outLen: usize = thisLen + otherLen; - if (outLen == 0) return EMPTY; - var out = allocate(outLen); + if (outLen == 0) return changetype(""); + var out = allocateUnsafe(outLen); copyUnsafe(out, 0, this, 0, thisLen); copyUnsafe(out, thisLen, other, 0, otherLen); return out; @@ -125,7 +121,7 @@ export class String { endsWith(searchString: String, endPosition: i32 = MAX_LENGTH): bool { assert(this !== null); if (searchString === null) return false; - var end = clamp(endPosition, 0, this.length); + var end = min(max(endPosition, 0), this.length); var searchLength: isize = searchString.length; var start: isize = end - searchLength; if (start < 0) return false; @@ -218,7 +214,7 @@ export class String { if (!searchLen) return 0; var len: isize = this.length; if (!len) return -1; - var start = clamp(fromIndex, 0, len); + var start = min(max(fromIndex, 0), len); len -= searchLen; for (let k: isize = start; k <= len; ++k) { if (!compareUnsafe(this, k, searchString, 0, searchLen)) return k; @@ -234,7 +230,7 @@ export class String { var searchLen: isize = searchString.length; if (!searchLen) return len; if (!len) return -1; - var start = clamp(fromIndex, 0, len - searchLen); + var start = min(max(fromIndex, 0), len - searchLen); for (let k = start; k >= 0; --k) { if (!compareUnsafe(this, k, searchString, 0, searchLen)) return k; } @@ -247,7 +243,7 @@ export class String { var pos: isize = position; var len: isize = this.length; - var start = clamp(pos, 0, len); + var start = min(max(pos, 0), len); var searchLength: isize = searchString.length; if (searchLength + start > len) return false; return !compareUnsafe(this, start, searchString, 0, searchLength); @@ -258,10 +254,10 @@ export class String { var intStart: isize = start; var end: isize = length; var size: isize = this.length; - if (intStart < 0) intStart = max(size + intStart, 0); - var resultLength = clamp(end, 0, size - intStart); - if (resultLength <= 0) return EMPTY; - var out = allocate(resultLength); + if (intStart < 0) intStart = max(size + intStart, 0); + var resultLength = min(max(end, 0), size - intStart); + if (resultLength <= 0) return changetype(""); + var out = allocateUnsafe(resultLength); copyUnsafe(out, 0, this, intStart, resultLength); return out; } @@ -269,14 +265,14 @@ export class String { substring(start: i32, end: i32 = i32.MAX_VALUE): String { assert(this !== null); var len = this.length; - var finalStart = clamp(start, 0, len); - var finalEnd = clamp(end, 0, len); + var finalStart = min(max(start, 0), len); + var finalEnd = min(max(end, 0), len); var from = min(finalStart, finalEnd); var to = max(finalStart, finalEnd); len = to - from; - if (!len) return EMPTY; + if (!len) return changetype(""); if (!from && to == this.length) return this; - var out = allocate(len); + var out = allocateUnsafe(len); copyUnsafe(out, 0, this, from, len); return out; } @@ -302,9 +298,9 @@ export class String { ) { ++start, --length; } - if (!length) return EMPTY; + if (!length) return changetype(""); if (!start && length == this.length) return this; - var out = allocate(length); + var out = allocateUnsafe(length); copyUnsafe(out, 0, this, start, length); return out; } @@ -323,8 +319,8 @@ export class String { } if (!start) return this; var outLen = len - start; - if (!outLen) return EMPTY; - var out = allocate(outLen); + if (!outLen) return changetype(""); + var out = allocateUnsafe(outLen); copyUnsafe(out, 0, this, start, outLen); return out; } @@ -340,9 +336,9 @@ export class String { ) { --len; } - if (len <= 0) return EMPTY; + if (len <= 0) return changetype(""); if (len == this.length) return this; - var out = allocate(len); + var out = allocateUnsafe(len); copyUnsafe(out, 0, this, 0, len); return out; } @@ -353,7 +349,7 @@ export class String { var padLen = padString.length; if (targetLength < length || !padLen) return this; var len = targetLength - length; - var out = allocate(targetLength); + var out = allocateUnsafe(targetLength); if (len > padLen) { let count = (len - 1) / padLen; let base = count * padLen; @@ -373,7 +369,7 @@ export class String { var padLen = padString.length; if (targetLength < length || !padLen) return this; var len = targetLength - length; - var out = allocate(targetLength); + var out = allocateUnsafe(targetLength); if (length) copyUnsafe(out, 0, this, 0, length); if (len > padLen) { let count = (len - 1) / padLen; @@ -396,10 +392,10 @@ export class String { throw new RangeError("Invalid count value"); } - if (count === 0 || !length) return EMPTY; + if (count === 0 || !length) return changetype(""); if (count === 1) return this; - var result = allocate(length * count); + var result = allocateUnsafe(length * count); repeatUnsafe(result, 0, this, count); return result; } diff --git a/tests/compiler/abi.optimized.wat b/tests/compiler/abi.optimized.wat index 5243f3b6..b7e18517 100644 --- a/tests/compiler/abi.optimized.wat +++ b/tests/compiler/abi.optimized.wat @@ -12,16 +12,16 @@ (export "exportedExported" (func $abi/exportedExported)) (export "exportedInternal" (func $abi/exportedInternal)) (start $start) - (func $abi/exported (; 1 ;) (type $i) (result i32) + (func $abi/exported (; 1 ;) (; has Stack IR ;) (type $i) (result i32) (i32.const -128) ) - (func $abi/exportedExported (; 2 ;) (type $i) (result i32) + (func $abi/exportedExported (; 2 ;) (; has Stack IR ;) (type $i) (result i32) (call $abi/exported) ) - (func $abi/internal (; 3 ;) (type $i) (result i32) + (func $abi/internal (; 3 ;) (; has Stack IR ;) (type $i) (result i32) (i32.const 128) ) - (func $abi/exportedInternal (; 4 ;) (type $i) (result i32) + (func $abi/exportedInternal (; 4 ;) (; has Stack IR ;) (type $i) (result i32) (i32.shr_s (i32.shl (call $abi/internal) @@ -30,7 +30,7 @@ (i32.const 24) ) ) - (func $start (; 5 ;) (type $v) + (func $start (; 5 ;) (; has Stack IR ;) (type $v) (drop (call $abi/internal) ) diff --git a/tests/compiler/binary.optimized.wat b/tests/compiler/binary.optimized.wat index 0645ef48..1e6b5f1a 100644 --- a/tests/compiler/binary.optimized.wat +++ b/tests/compiler/binary.optimized.wat @@ -12,7 +12,7 @@ (memory $0 0) (export "memory" (memory $0)) (start $start) - (func $~lib/math/NativeMath.scalbn (; 0 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) + (func $~lib/math/NativeMath.scalbn (; 0 ;) (; has Stack IR ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) (local $2 f64) (set_local $2 (get_local $0) @@ -126,7 +126,7 @@ ) ) ) - (func $~lib/math/NativeMath.pow (; 1 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.pow (; 1 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 f64) (local $3 f64) (local $4 i32) @@ -1553,7 +1553,7 @@ (f64.const 1.e+300) ) ) - (func $~lib/math/NativeMathf.mod (; 2 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.mod (; 2 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1901,7 +1901,7 @@ (get_local $0) ) ) - (func $~lib/math/NativeMathf.scalbn (; 3 ;) (type $fif) (param $0 f32) (param $1 i32) (result f32) + (func $~lib/math/NativeMathf.scalbn (; 3 ;) (; has Stack IR ;) (type $fif) (param $0 f32) (param $1 i32) (result f32) (local $2 f32) (set_local $2 (get_local $0) @@ -2013,7 +2013,7 @@ ) ) ) - (func $~lib/math/NativeMathf.pow (; 4 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.pow (; 4 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 f32) (local $3 f32) (local $4 i32) @@ -3200,7 +3200,7 @@ (f32.const 1.0000000031710769e-30) ) ) - (func $~lib/math/NativeMath.mod (; 5 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.mod (; 5 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i32) (local $4 i64) @@ -3575,7 +3575,7 @@ (get_local $0) ) ) - (func $start (; 6 ;) (type $v) + (func $start (; 6 ;) (; has Stack IR ;) (type $v) (drop (i32.rem_s (get_global $binary/i) diff --git a/tests/compiler/binary.untouched.wat b/tests/compiler/binary.untouched.wat index 9ebe4a44..1140d885 100644 --- a/tests/compiler/binary.untouched.wat +++ b/tests/compiler/binary.untouched.wat @@ -409,48 +409,51 @@ (get_local $8) (i32.const 2146435072) ) - (if - (i32.eq - (i32.or - (i32.sub + (block + (if + (i32.eq + (i32.or + (i32.sub + (get_local $7) + (i32.const 1072693248) + ) + (get_local $4) + ) + (i32.const 0) + ) + (return + (f64.const nan:0x8000000000000) + ) + (if + (i32.ge_s (get_local $7) (i32.const 1072693248) ) - (get_local $4) - ) - (i32.const 0) - ) - (return - (f64.const nan:0x8000000000000) - ) - (if - (i32.ge_s - (get_local $7) - (i32.const 1072693248) - ) - (return - (if (result f64) - (i32.ge_s - (get_local $5) - (i32.const 0) - ) - (get_local $1) - (f64.const 0) - ) - ) - (return - (if (result f64) - (i32.ge_s - (get_local $5) - (i32.const 0) - ) - (f64.const 0) - (f64.neg + (return + (if (result f64) + (i32.ge_s + (get_local $5) + (i32.const 0) + ) (get_local $1) + (f64.const 0) + ) + ) + (return + (if (result f64) + (i32.ge_s + (get_local $5) + (i32.const 0) + ) + (f64.const 0) + (f64.neg + (get_local $1) + ) ) ) ) ) + (unreachable) ) ) (if @@ -2394,42 +2397,45 @@ (get_local $5) (i32.const 2139095040) ) - (if - (i32.eq - (get_local $4) - (i32.const 1065353216) - ) - (return - (f32.const nan:0x400000) - ) + (block (if - (i32.gt_s + (i32.eq (get_local $4) (i32.const 1065353216) ) (return - (if (result f32) - (i32.ge_s - (get_local $3) - (i32.const 0) - ) - (get_local $1) - (f32.const 0) - ) + (f32.const nan:0x400000) ) - (return - (if (result f32) - (i32.ge_s - (get_local $3) - (i32.const 0) - ) - (f32.const 0) - (f32.neg + (if + (i32.gt_s + (get_local $4) + (i32.const 1065353216) + ) + (return + (if (result f32) + (i32.ge_s + (get_local $3) + (i32.const 0) + ) (get_local $1) + (f32.const 0) + ) + ) + (return + (if (result f32) + (i32.ge_s + (get_local $3) + (i32.const 0) + ) + (f32.const 0) + (f32.neg + (get_local $1) + ) ) ) ) ) + (unreachable) ) ) (if diff --git a/tests/compiler/builtins.optimized.wat b/tests/compiler/builtins.optimized.wat index 2a588b92..50dc5a41 100644 --- a/tests/compiler/builtins.optimized.wat +++ b/tests/compiler/builtins.optimized.wat @@ -21,13 +21,13 @@ (export "table" (table $0)) (export "test" (func $builtins/test)) (start $start) - (func $start~anonymous|0 (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $start~anonymous|0 (; 1 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (nop) ) - (func $builtins/test (; 2 ;) (type $v) + (func $builtins/test (; 2 ;) (; has Stack IR ;) (type $v) (nop) ) - (func $start (; 3 ;) (type $v) + (func $start (; 3 ;) (; has Stack IR ;) (type $v) (set_global $builtins/i (i32.const 31) ) diff --git a/tests/compiler/call-inferred.optimized.wat b/tests/compiler/call-inferred.optimized.wat index a43eb476..d250e35a 100644 --- a/tests/compiler/call-inferred.optimized.wat +++ b/tests/compiler/call-inferred.optimized.wat @@ -9,16 +9,16 @@ (data (i32.const 8) "\10\00\00\00c\00a\00l\00l\00-\00i\00n\00f\00e\00r\00r\00e\00d\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $call-inferred/foo (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $call-inferred/foo (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (get_local $0) ) - (func $call-inferred/foo (; 2 ;) (type $FF) (param $0 f64) (result f64) + (func $call-inferred/foo (; 2 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (get_local $0) ) - (func $call-inferred/foo (; 3 ;) (type $ff) (param $0 f32) (result f32) + (func $call-inferred/foo (; 3 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (get_local $0) ) - (func $start (; 4 ;) (type $v) + (func $start (; 4 ;) (; has Stack IR ;) (type $v) (if (i32.ne (call $call-inferred/foo diff --git a/tests/compiler/call-optional.optimized.wat b/tests/compiler/call-optional.optimized.wat index 60742a0a..de689ded 100644 --- a/tests/compiler/call-optional.optimized.wat +++ b/tests/compiler/call-optional.optimized.wat @@ -12,7 +12,7 @@ (export "memory" (memory $0)) (export "table" (table $0)) (start $start) - (func $call-optional/opt (; 1 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $call-optional/opt (; 1 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.add (i32.add (get_local $0) @@ -21,7 +21,7 @@ (get_local $2) ) ) - (func $call-optional/opt|trampoline (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $call-optional/opt|trampoline (; 2 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $2of2 (block $1of2 (block $0of2 @@ -49,7 +49,7 @@ (get_local $2) ) ) - (func $start (; 3 ;) (type $v) + (func $start (; 3 ;) (; has Stack IR ;) (type $v) (set_global $~argc (i32.const 1) ) diff --git a/tests/compiler/class-extends.optimized.wat b/tests/compiler/class-extends.optimized.wat index ae544a7c..bc6332e6 100644 --- a/tests/compiler/class-extends.optimized.wat +++ b/tests/compiler/class-extends.optimized.wat @@ -3,7 +3,7 @@ (memory $0 0) (export "memory" (memory $0)) (export "test" (func $class-extends/test)) - (func $class-extends/test (; 0 ;) (type $iv) (param $0 i32) + (func $class-extends/test (; 0 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (drop (i32.load (get_local $0) diff --git a/tests/compiler/class-overloading.optimized.wat b/tests/compiler/class-overloading.optimized.wat index 0ab6aa4c..04b41a23 100644 --- a/tests/compiler/class-overloading.optimized.wat +++ b/tests/compiler/class-overloading.optimized.wat @@ -5,15 +5,15 @@ (export "memory" (memory $0)) (export "test" (func $class-overloading/test)) (start $start) - (func $class-overloading/Foo#baz (; 0 ;) (type $iv) (param $0 i32) + (func $class-overloading/Foo#baz (; 0 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (nop) ) - (func $class-overloading/test (; 1 ;) (type $iv) (param $0 i32) + (func $class-overloading/test (; 1 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (call $class-overloading/Foo#baz (get_local $0) ) ) - (func $start (; 2 ;) (type $v) + (func $start (; 2 ;) (; has Stack IR ;) (type $v) (call $class-overloading/test (i32.const 0) ) diff --git a/tests/compiler/class-with-boolean-field.optimized.wat b/tests/compiler/class-with-boolean-field.optimized.wat index 1ac77525..f35180a3 100644 --- a/tests/compiler/class-with-boolean-field.optimized.wat +++ b/tests/compiler/class-with-boolean-field.optimized.wat @@ -3,7 +3,7 @@ (memory $0 0) (export "memory" (memory $0)) (export "test" (func $class-with-boolean-field/test)) - (func $class-with-boolean-field/test (; 0 ;) (type $i) (result i32) + (func $class-with-boolean-field/test (; 0 ;) (; has Stack IR ;) (type $i) (result i32) (i32.store8 (i32.const 0) (i32.const 1) diff --git a/tests/compiler/class.optimized.wat b/tests/compiler/class.optimized.wat index 6a341863..a09c3c46 100644 --- a/tests/compiler/class.optimized.wat +++ b/tests/compiler/class.optimized.wat @@ -11,7 +11,7 @@ (export "memory" (memory $0)) (export "test" (func $class/test)) (start $start) - (func $class/Animal.add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $class/Animal.add (; 0 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add (i32.add (get_local $0) @@ -20,7 +20,7 @@ (get_global $class/Animal.ONE) ) ) - (func $class/Animal.sub (; 1 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $class/Animal.sub (; 1 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (f32.add (f32.sub (get_local $0) @@ -31,7 +31,7 @@ ) ) ) - (func $class/Animal#instanceAdd (; 2 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $class/Animal#instanceAdd (; 2 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.add (i32.add (get_local $1) @@ -40,7 +40,7 @@ (get_global $class/Animal.ONE) ) ) - (func $class/Animal#instanceSub (; 3 ;) (type $ifff) (param $0 i32) (param $1 f32) (param $2 f32) (result f32) + (func $class/Animal#instanceSub (; 3 ;) (; has Stack IR ;) (type $ifff) (param $0 i32) (param $1 f32) (param $2 f32) (result f32) (f32.add (f32.sub (get_local $1) @@ -51,7 +51,7 @@ ) ) ) - (func $class/test (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $class/test (; 4 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (drop (call $class/Animal#instanceAdd (get_local $0) @@ -95,7 +95,7 @@ ) (get_local $0) ) - (func $start (; 5 ;) (type $v) + (func $start (; 5 ;) (; has Stack IR ;) (type $v) (drop (call $class/Animal.add (i32.const 1) diff --git a/tests/compiler/comma.optimized.wat b/tests/compiler/comma.optimized.wat index f44e60fc..81522dce 100644 --- a/tests/compiler/comma.optimized.wat +++ b/tests/compiler/comma.optimized.wat @@ -8,7 +8,7 @@ (data (i32.const 8) "\08\00\00\00c\00o\00m\00m\00a\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $start (; 1 ;) (type $v) + (func $start (; 1 ;) (; has Stack IR ;) (type $v) (local $0 i32) (set_global $comma/a (i32.add diff --git a/tests/compiler/declare.optimized.wat b/tests/compiler/declare.optimized.wat index 74646836..dfa4bc9b 100644 --- a/tests/compiler/declare.optimized.wat +++ b/tests/compiler/declare.optimized.wat @@ -10,7 +10,7 @@ (data (i32.const 8) "\n\00\00\00d\00e\00c\00l\00a\00r\00e\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $start (; 3 ;) (type $v) + (func $start (; 3 ;) (; has Stack IR ;) (type $v) (call $declare/externalFunction) (if (i32.ne diff --git a/tests/compiler/do.optimized.wat b/tests/compiler/do.optimized.wat index 3fd98af7..3430724e 100644 --- a/tests/compiler/do.optimized.wat +++ b/tests/compiler/do.optimized.wat @@ -9,7 +9,7 @@ (data (i32.const 8) "\05\00\00\00d\00o\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $start (; 1 ;) (type $v) + (func $start (; 1 ;) (; has Stack IR ;) (type $v) (local $0 i32) (loop $continue|0 (set_global $do/n diff --git a/tests/compiler/enum.optimized.wat b/tests/compiler/enum.optimized.wat index 4a2facd2..e976f888 100644 --- a/tests/compiler/enum.optimized.wat +++ b/tests/compiler/enum.optimized.wat @@ -34,10 +34,10 @@ (export "SelfReference.ZERO" (global $enum/SelfReference.ZERO)) (export "SelfReference.ONE" (global $enum/SelfReference.ONE)) (start $start) - (func $enum/getZero (; 0 ;) (type $i) (result i32) + (func $enum/getZero (; 0 ;) (; has Stack IR ;) (type $i) (result i32) (i32.const 0) ) - (func $start (; 1 ;) (type $v) + (func $start (; 1 ;) (; has Stack IR ;) (type $v) (set_global $enum/NonConstant.ZERO (call $enum/getZero) ) diff --git a/tests/compiler/export.optimized.wat b/tests/compiler/export.optimized.wat index 92e0f921..51f54308 100644 --- a/tests/compiler/export.optimized.wat +++ b/tests/compiler/export.optimized.wat @@ -13,25 +13,25 @@ (export "b" (global $export/b)) (export "renamed_c" (global $export/c)) (export "ns.two" (func $export/ns.two)) - (func $export/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $export/add (; 0 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $export/sub (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $export/sub (; 1 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $export/mul (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $export/mul (; 2 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.mul (get_local $0) (get_local $1) ) ) - (func $export/ns.two (; 3 ;) (type $v) + (func $export/ns.two (; 3 ;) (; has Stack IR ;) (type $v) (nop) ) ) diff --git a/tests/compiler/exports.optimized.wat b/tests/compiler/exports.optimized.wat index a0b9e587..da0ea09c 100644 --- a/tests/compiler/exports.optimized.wat +++ b/tests/compiler/exports.optimized.wat @@ -43,22 +43,22 @@ (export "vehicles.Car#openDoors" (func $exports/Car#openDoors)) (export "outer.inner.a" (global $exports/outer.inner.a)) (start $start) - (func $exports/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $exports/add (; 0 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $exports/subOpt (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $exports/subOpt (; 1 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $exports/Car.getNumTires (; 2 ;) (type $i) (result i32) + (func $exports/Car.getNumTires (; 2 ;) (; has Stack IR ;) (type $i) (result i32) (i32.const 4) ) - (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -144,12 +144,12 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 4 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/allocator/arena/__memory_allocate (get_local $0) ) ) - (func $exports/Car#constructor (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $exports/Car#constructor (; 5 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) @@ -169,21 +169,21 @@ ) (get_local $0) ) - (func $exports/Car#get:numDoors (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $exports/Car#get:numDoors (; 6 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.load (get_local $0) ) ) - (func $exports/Car#set:numDoors (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $exports/Car#set:numDoors (; 7 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (i32.store (get_local $0) (get_local $1) ) ) - (func $exports/Car#openDoors (; 8 ;) (type $iv) (param $0 i32) + (func $exports/Car#openDoors (; 8 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (nop) ) - (func $start (; 9 ;) (type $v) + (func $start (; 9 ;) (; has Stack IR ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.const 8) ) @@ -191,7 +191,7 @@ (get_global $~lib/allocator/arena/startOffset) ) ) - (func $exports/subOpt|trampoline (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $exports/subOpt|trampoline (; 10 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange @@ -213,12 +213,12 @@ (get_local $1) ) ) - (func $~setargc (; 11 ;) (type $iv) (param $0 i32) + (func $~setargc (; 11 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (set_global $~argc (get_local $0) ) ) - (func $exports/Car#constructor|trampoline (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $exports/Car#constructor|trampoline (; 12 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange diff --git a/tests/compiler/for.optimized.wat b/tests/compiler/for.optimized.wat index 71ba375f..7c911171 100644 --- a/tests/compiler/for.optimized.wat +++ b/tests/compiler/for.optimized.wat @@ -7,7 +7,7 @@ (data (i32.const 8) "\06\00\00\00f\00o\00r\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $start (; 1 ;) (type $v) + (func $start (; 1 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (block $break|0 diff --git a/tests/compiler/function-expression.optimized.wat b/tests/compiler/function-expression.optimized.wat index 123603b8..24aa4542 100644 --- a/tests/compiler/function-expression.optimized.wat +++ b/tests/compiler/function-expression.optimized.wat @@ -16,16 +16,16 @@ (export "memory" (memory $0)) (export "table" (table $0)) (start $start) - (func $start~anonymous|0 (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $start~anonymous|0 (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (get_local $0) ) - (func $start~someName|2 (; 2 ;) (type $v) + (func $start~someName|2 (; 2 ;) (; has Stack IR ;) (type $v) (nop) ) - (func $start~anonymous|3 (; 3 ;) (type $i) (result i32) + (func $start~anonymous|3 (; 3 ;) (; has Stack IR ;) (type $i) (result i32) (i32.const 1) ) - (func $start (; 4 ;) (type $v) + (func $start (; 4 ;) (; has Stack IR ;) (type $v) (set_global $~argc (i32.const 1) ) diff --git a/tests/compiler/function-types.optimized.wat b/tests/compiler/function-types.optimized.wat index 94f99c3d..e74c81bd 100644 --- a/tests/compiler/function-types.optimized.wat +++ b/tests/compiler/function-types.optimized.wat @@ -17,34 +17,34 @@ (export "memory" (memory $0)) (export "table" (table $0)) (start $start) - (func $function-types/makeAdder~anonymous|0 (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $function-types/makeAdder~anonymous|0 (; 1 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $function-types/makeAdder (; 2 ;) (type $i) (result i32) + (func $function-types/makeAdder (; 2 ;) (; has Stack IR ;) (type $i) (result i32) (i32.const 0) ) - (func $function-types/makeAdder~anonymous|1 (; 3 ;) (type $III) (param $0 i64) (param $1 i64) (result i64) + (func $function-types/makeAdder~anonymous|1 (; 3 ;) (; has Stack IR ;) (type $III) (param $0 i64) (param $1 i64) (result i64) (i64.add (get_local $0) (get_local $1) ) ) - (func $function-types/makeAdder (; 4 ;) (type $i) (result i32) + (func $function-types/makeAdder (; 4 ;) (; has Stack IR ;) (type $i) (result i32) (i32.const 1) ) - (func $function-types/makeAdder~anonymous|2 (; 5 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $function-types/makeAdder~anonymous|2 (; 5 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (f64.add (get_local $0) (get_local $1) ) ) - (func $function-types/makeAdder (; 6 ;) (type $i) (result i32) + (func $function-types/makeAdder (; 6 ;) (; has Stack IR ;) (type $i) (result i32) (i32.const 2) ) - (func $function-types/doAddWithFn (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $function-types/doAddWithFn (; 7 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_global $~argc (i32.const 2) ) @@ -54,7 +54,7 @@ (get_local $2) ) ) - (func $function-types/doAdd (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $function-types/doAdd (; 8 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (set_global $~argc (i32.const 2) ) @@ -64,7 +64,7 @@ (call $function-types/makeAdder) ) ) - (func $function-types/makeAndAdd|trampoline (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $function-types/makeAndAdd|trampoline (; 9 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange @@ -87,7 +87,7 @@ (get_local $2) ) ) - (func $start (; 10 ;) (type $v) + (func $start (; 10 ;) (; has Stack IR ;) (type $v) (set_global $function-types/i32Adder (call $function-types/makeAdder) ) diff --git a/tests/compiler/function.optimized.wat b/tests/compiler/function.optimized.wat index 749c69ea..8da2053b 100644 --- a/tests/compiler/function.optimized.wat +++ b/tests/compiler/function.optimized.wat @@ -17,46 +17,46 @@ (memory $0 0) (export "memory" (memory $0)) (start $start) - (func $function/v (; 0 ;) (type $v) + (func $function/v (; 0 ;) (; has Stack IR ;) (type $v) (nop) ) - (func $function/i (; 1 ;) (type $i) (result i32) + (func $function/i (; 1 ;) (; has Stack IR ;) (type $i) (result i32) (i32.const 0) ) - (func $function/I (; 2 ;) (type $I) (result i64) + (func $function/I (; 2 ;) (; has Stack IR ;) (type $I) (result i64) (i64.const 0) ) - (func $function/f (; 3 ;) (type $f) (result f32) + (func $function/f (; 3 ;) (; has Stack IR ;) (type $f) (result f32) (f32.const 0) ) - (func $function/F (; 4 ;) (type $F) (result f64) + (func $function/F (; 4 ;) (; has Stack IR ;) (type $F) (result f64) (f64.const 0) ) - (func $function/iv (; 5 ;) (type $iv) (param $0 i32) + (func $function/iv (; 5 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (nop) ) - (func $function/ii (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $function/ii (; 6 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (get_local $0) ) - (func $function/II (; 7 ;) (type $II) (param $0 i64) (result i64) + (func $function/II (; 7 ;) (; has Stack IR ;) (type $II) (param $0 i64) (result i64) (get_local $0) ) - (func $function/ff (; 8 ;) (type $ff) (param $0 f32) (result f32) + (func $function/ff (; 8 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (get_local $0) ) - (func $function/FF (; 9 ;) (type $FF) (param $0 f64) (result f64) + (func $function/FF (; 9 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (get_local $0) ) - (func $function/iiv (; 10 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $function/iiv (; 10 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (nop) ) - (func $function/iii (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $function/iii (; 11 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $function/III (; 12 ;) (type $IiI) (param $0 i64) (param $1 i32) (result i64) + (func $function/III (; 12 ;) (; has Stack IR ;) (type $IiI) (param $0 i64) (param $1 i32) (result i64) (i64.add (get_local $0) (i64.extend_s/i32 @@ -64,19 +64,19 @@ ) ) ) - (func $function/fff (; 13 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $function/fff (; 13 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (f32.add (get_local $0) (get_local $1) ) ) - (func $function/FFF (; 14 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $function/FFF (; 14 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (f64.add (get_local $0) (get_local $1) ) ) - (func $start (; 15 ;) (type $v) + (func $start (; 15 ;) (; has Stack IR ;) (type $v) (call $function/v) (drop (call $function/i) diff --git a/tests/compiler/getter-setter.optimized.wat b/tests/compiler/getter-setter.optimized.wat index b5ccba8a..b8c2a524 100644 --- a/tests/compiler/getter-setter.optimized.wat +++ b/tests/compiler/getter-setter.optimized.wat @@ -9,15 +9,15 @@ (data (i32.const 8) "\10\00\00\00g\00e\00t\00t\00e\00r\00-\00s\00e\00t\00t\00e\00r\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $getter-setter/Foo.get:bar (; 1 ;) (type $i) (result i32) + (func $getter-setter/Foo.get:bar (; 1 ;) (; has Stack IR ;) (type $i) (result i32) (get_global $getter-setter/Foo._bar) ) - (func $getter-setter/Foo.set:bar (; 2 ;) (type $iv) (param $0 i32) + (func $getter-setter/Foo.set:bar (; 2 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (set_global $getter-setter/Foo._bar (get_local $0) ) ) - (func $start (; 3 ;) (type $v) + (func $start (; 3 ;) (; has Stack IR ;) (type $v) (if (call $getter-setter/Foo.get:bar) (block diff --git a/tests/compiler/i64-polyfill.optimized.wat b/tests/compiler/i64-polyfill.optimized.wat index 784568a3..5220e325 100644 --- a/tests/compiler/i64-polyfill.optimized.wat +++ b/tests/compiler/i64-polyfill.optimized.wat @@ -37,13 +37,13 @@ (export "gt_u" (func $../../examples/i64-polyfill/assembly/i64/gt_u)) (export "ge_s" (func $../../examples/i64-polyfill/assembly/i64/ge_s)) (export "ge_u" (func $../../examples/i64-polyfill/assembly/i64/ge_u)) - (func $../../examples/i64-polyfill/assembly/i64/getHi (; 0 ;) (type $i) (result i32) + (func $../../examples/i64-polyfill/assembly/i64/getHi (; 0 ;) (; has Stack IR ;) (type $i) (result i32) (get_global $../../examples/i64-polyfill/assembly/i64/hi) ) - (func $../../examples/i64-polyfill/assembly/i64/getLo (; 1 ;) (type $i) (result i32) + (func $../../examples/i64-polyfill/assembly/i64/getLo (; 1 ;) (; has Stack IR ;) (type $i) (result i32) (get_global $../../examples/i64-polyfill/assembly/i64/lo) ) - (func $../../examples/i64-polyfill/assembly/i64/clz (; 2 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $../../examples/i64-polyfill/assembly/i64/clz (; 2 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 (i64.clz @@ -65,7 +65,7 @@ (i32.const 0) ) ) - (func $../../examples/i64-polyfill/assembly/i64/ctz (; 3 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $../../examples/i64-polyfill/assembly/i64/ctz (; 3 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 (i64.ctz @@ -87,7 +87,7 @@ (i32.const 0) ) ) - (func $../../examples/i64-polyfill/assembly/i64/popcnt (; 4 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $../../examples/i64-polyfill/assembly/i64/popcnt (; 4 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 (i64.popcnt @@ -109,7 +109,7 @@ (i32.const 0) ) ) - (func $../../examples/i64-polyfill/assembly/i64/eqz (; 5 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $../../examples/i64-polyfill/assembly/i64/eqz (; 5 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i64.eqz (i64.or @@ -129,7 +129,7 @@ (i32.const 0) ) ) - (func $../../examples/i64-polyfill/assembly/i64/add (; 6 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/add (; 6 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i64) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 @@ -170,7 +170,7 @@ ) ) ) - (func $../../examples/i64-polyfill/assembly/i64/sub (; 7 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/sub (; 7 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i64) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 @@ -211,7 +211,7 @@ ) ) ) - (func $../../examples/i64-polyfill/assembly/i64/mul (; 8 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/mul (; 8 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i64) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 @@ -252,7 +252,7 @@ ) ) ) - (func $../../examples/i64-polyfill/assembly/i64/div_s (; 9 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/div_s (; 9 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i64) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 @@ -293,7 +293,7 @@ ) ) ) - (func $../../examples/i64-polyfill/assembly/i64/div_u (; 10 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/div_u (; 10 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i64) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 @@ -334,7 +334,7 @@ ) ) ) - (func $../../examples/i64-polyfill/assembly/i64/rem_s (; 11 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/rem_s (; 11 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i64) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 @@ -375,7 +375,7 @@ ) ) ) - (func $../../examples/i64-polyfill/assembly/i64/rem_u (; 12 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/rem_u (; 12 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i64) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 @@ -416,7 +416,7 @@ ) ) ) - (func $../../examples/i64-polyfill/assembly/i64/and (; 13 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/and (; 13 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i64) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 @@ -457,7 +457,7 @@ ) ) ) - (func $../../examples/i64-polyfill/assembly/i64/or (; 14 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/or (; 14 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i64) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 @@ -498,7 +498,7 @@ ) ) ) - (func $../../examples/i64-polyfill/assembly/i64/xor (; 15 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/xor (; 15 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i64) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 @@ -539,7 +539,7 @@ ) ) ) - (func $../../examples/i64-polyfill/assembly/i64/shl (; 16 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/shl (; 16 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i64) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 @@ -580,7 +580,7 @@ ) ) ) - (func $../../examples/i64-polyfill/assembly/i64/shr_s (; 17 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/shr_s (; 17 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i64) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 @@ -621,7 +621,7 @@ ) ) ) - (func $../../examples/i64-polyfill/assembly/i64/shr_u (; 18 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/shr_u (; 18 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i64) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 @@ -662,7 +662,7 @@ ) ) ) - (func $../../examples/i64-polyfill/assembly/i64/rotl (; 19 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/rotl (; 19 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i64) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 @@ -703,7 +703,7 @@ ) ) ) - (func $../../examples/i64-polyfill/assembly/i64/rotr (; 20 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/rotr (; 20 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i64) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i32.wrap/i64 @@ -744,7 +744,7 @@ ) ) ) - (func $../../examples/i64-polyfill/assembly/i64/eq (; 21 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/eq (; 21 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i64.eq (i64.or @@ -775,7 +775,7 @@ (i32.const 0) ) ) - (func $../../examples/i64-polyfill/assembly/i64/ne (; 22 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/ne (; 22 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i64.ne (i64.or @@ -806,7 +806,7 @@ (i32.const 0) ) ) - (func $../../examples/i64-polyfill/assembly/i64/lt_s (; 23 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/lt_s (; 23 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i64.lt_s (i64.or @@ -837,7 +837,7 @@ (i32.const 0) ) ) - (func $../../examples/i64-polyfill/assembly/i64/lt_u (; 24 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/lt_u (; 24 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i64.lt_u (i64.or @@ -868,7 +868,7 @@ (i32.const 0) ) ) - (func $../../examples/i64-polyfill/assembly/i64/le_s (; 25 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/le_s (; 25 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i64.le_s (i64.or @@ -899,7 +899,7 @@ (i32.const 0) ) ) - (func $../../examples/i64-polyfill/assembly/i64/le_u (; 26 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/le_u (; 26 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i64.le_u (i64.or @@ -930,7 +930,7 @@ (i32.const 0) ) ) - (func $../../examples/i64-polyfill/assembly/i64/gt_s (; 27 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/gt_s (; 27 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i64.gt_s (i64.or @@ -961,7 +961,7 @@ (i32.const 0) ) ) - (func $../../examples/i64-polyfill/assembly/i64/gt_u (; 28 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/gt_u (; 28 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i64.gt_u (i64.or @@ -992,7 +992,7 @@ (i32.const 0) ) ) - (func $../../examples/i64-polyfill/assembly/i64/ge_s (; 29 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/ge_s (; 29 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i64.ge_s (i64.or @@ -1023,7 +1023,7 @@ (i32.const 0) ) ) - (func $../../examples/i64-polyfill/assembly/i64/ge_u (; 30 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/i64-polyfill/assembly/i64/ge_u (; 30 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (set_global $../../examples/i64-polyfill/assembly/i64/lo (i64.ge_u (i64.or diff --git a/tests/compiler/if.optimized.wat b/tests/compiler/if.optimized.wat index 9c8f90fa..5b47a92d 100644 --- a/tests/compiler/if.optimized.wat +++ b/tests/compiler/if.optimized.wat @@ -11,14 +11,14 @@ (export "ifThenElseBlock" (func $if/ifThenElse)) (export "ifAlwaysReturns" (func $if/ifAlwaysReturns)) (start $start) - (func $if/ifThenElse (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $if/ifThenElse (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (result i32) (get_local $0) (i32.const 1) (i32.const 0) ) ) - (func $if/ifThen (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $if/ifThen (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (get_local $0) (return @@ -27,7 +27,7 @@ ) (i32.const 0) ) - (func $if/ifAlwaysReturns (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $if/ifAlwaysReturns (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (get_local $0) (return @@ -44,7 +44,7 @@ ) ) ) - (func $start (; 4 ;) (type $v) + (func $start (; 4 ;) (; has Stack IR ;) (type $v) (if (call $if/ifThenElse (i32.const 0) diff --git a/tests/compiler/if.untouched.wat b/tests/compiler/if.untouched.wat index e2d68e8c..261d5051 100644 --- a/tests/compiler/if.untouched.wat +++ b/tests/compiler/if.untouched.wat @@ -22,6 +22,7 @@ (i32.const 0) ) ) + (unreachable) ) (func $if/ifThen (; 2 ;) (type $ii) (param $0 i32) (result i32) (if @@ -42,6 +43,7 @@ (i32.const 0) ) ) + (unreachable) ) (func $if/ifAlwaysReturns (; 4 ;) (type $ii) (param $0 i32) (result i32) (if @@ -59,6 +61,7 @@ (unreachable) ) ) + (unreachable) ) (func $start (; 5 ;) (type $v) (if diff --git a/tests/compiler/import.optimized.wat b/tests/compiler/import.optimized.wat index ee378597..b83af45a 100644 --- a/tests/compiler/import.optimized.wat +++ b/tests/compiler/import.optimized.wat @@ -4,28 +4,28 @@ (memory $0 0) (export "memory" (memory $0)) (start $start) - (func $export/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $export/add (; 0 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $export/sub (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $export/sub (; 1 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $export/mul (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $export/mul (; 2 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.mul (get_local $0) (get_local $1) ) ) - (func $export/ns.two (; 3 ;) (type $v) + (func $export/ns.two (; 3 ;) (; has Stack IR ;) (type $v) (nop) ) - (func $start (; 4 ;) (type $v) + (func $start (; 4 ;) (; has Stack IR ;) (type $v) (drop (i32.add (i32.add diff --git a/tests/compiler/infer-type.optimized.wat b/tests/compiler/infer-type.optimized.wat index 52e9cf66..84ecbce9 100644 --- a/tests/compiler/infer-type.optimized.wat +++ b/tests/compiler/infer-type.optimized.wat @@ -12,22 +12,22 @@ (data (i32.const 8) "\0d\00\00\00i\00n\00f\00e\00r\00-\00t\00y\00p\00e\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $infer-type/locals (; 0 ;) (type $v) + (func $infer-type/locals (; 0 ;) (; has Stack IR ;) (type $v) (nop) ) - (func $infer-type/reti (; 1 ;) (type $i) (result i32) + (func $infer-type/reti (; 1 ;) (; has Stack IR ;) (type $i) (result i32) (i32.const 0) ) - (func $infer-type/retI (; 2 ;) (type $I) (result i64) + (func $infer-type/retI (; 2 ;) (; has Stack IR ;) (type $I) (result i64) (i64.const 0) ) - (func $infer-type/retf (; 3 ;) (type $f) (result f32) + (func $infer-type/retf (; 3 ;) (; has Stack IR ;) (type $f) (result f32) (f32.const 0) ) - (func $infer-type/refF (; 4 ;) (type $F) (result f64) + (func $infer-type/refF (; 4 ;) (; has Stack IR ;) (type $F) (result f64) (f64.const 0) ) - (func $start (; 5 ;) (type $v) + (func $start (; 5 ;) (; has Stack IR ;) (type $v) (local $0 i32) (call $infer-type/locals) (set_global $infer-type/ri diff --git a/tests/compiler/inlining-recursive.optimized.wat b/tests/compiler/inlining-recursive.optimized.wat index 8625fdd3..e97d649c 100644 --- a/tests/compiler/inlining-recursive.optimized.wat +++ b/tests/compiler/inlining-recursive.optimized.wat @@ -5,13 +5,13 @@ (export "foo" (func $inlining-recursive/foo)) (export "bar" (func $inlining-recursive/bar)) (export "baz" (func $inlining-recursive/baz)) - (func $inlining-recursive/foo (; 0 ;) (type $v) + (func $inlining-recursive/foo (; 0 ;) (; has Stack IR ;) (type $v) (call $inlining-recursive/foo) ) - (func $inlining-recursive/baz (; 1 ;) (type $v) + (func $inlining-recursive/baz (; 1 ;) (; has Stack IR ;) (type $v) (call $inlining-recursive/bar) ) - (func $inlining-recursive/bar (; 2 ;) (type $v) + (func $inlining-recursive/bar (; 2 ;) (; has Stack IR ;) (type $v) (call $inlining-recursive/baz) ) ) diff --git a/tests/compiler/inlining.optimized.wat b/tests/compiler/inlining.optimized.wat index 08575cb7..3dad4982 100644 --- a/tests/compiler/inlining.optimized.wat +++ b/tests/compiler/inlining.optimized.wat @@ -13,13 +13,13 @@ (export "table" (table $0)) (export "test" (func $inlining/test)) (start $start) - (func $inlining/test (; 1 ;) (type $i) (result i32) + (func $inlining/test (; 1 ;) (; has Stack IR ;) (type $i) (result i32) (i32.const 3) ) - (func $inlining/test_funcs~anonymous|0 (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $inlining/test_funcs~anonymous|0 (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (get_local $0) ) - (func $inlining/test_funcs (; 3 ;) (type $v) + (func $inlining/test_funcs (; 3 ;) (; has Stack IR ;) (type $v) (set_global $~argc (i32.const 1) ) @@ -42,7 +42,7 @@ ) ) ) - (func $start (; 4 ;) (type $v) + (func $start (; 4 ;) (; has Stack IR ;) (type $v) (if (i32.ne (call $inlining/test) diff --git a/tests/compiler/instanceof.optimized.wat b/tests/compiler/instanceof.optimized.wat index 350e1b85..61b1ede5 100644 --- a/tests/compiler/instanceof.optimized.wat +++ b/tests/compiler/instanceof.optimized.wat @@ -9,16 +9,16 @@ (data (i32.const 8) "\0d\00\00\00i\00n\00s\00t\00a\00n\00c\00e\00o\00f\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $instanceof/isI32 (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $instanceof/isI32 (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.const 1) ) - (func $instanceof/isI32 (; 2 ;) (type $Fi) (param $0 f64) (result i32) + (func $instanceof/isI32 (; 2 ;) (; has Stack IR ;) (type $Fi) (param $0 f64) (result i32) (i32.const 0) ) - (func $instanceof/isI32 (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $instanceof/isI32 (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.const 0) ) - (func $start (; 4 ;) (type $v) + (func $start (; 4 ;) (; has Stack IR ;) (type $v) (if (i32.eqz (call $instanceof/isI32 diff --git a/tests/compiler/logical.optimized.wat b/tests/compiler/logical.optimized.wat index 2226d94b..02f35b8b 100644 --- a/tests/compiler/logical.optimized.wat +++ b/tests/compiler/logical.optimized.wat @@ -10,7 +10,7 @@ (data (i32.const 8) "\n\00\00\00l\00o\00g\00i\00c\00a\00l\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $start (; 1 ;) (type $v) + (func $start (; 1 ;) (; has Stack IR ;) (type $v) (set_global $logical/i (i32.const 2) ) diff --git a/tests/compiler/main.optimized.wat b/tests/compiler/main.optimized.wat index 7a3b5019..bbebdeca 100644 --- a/tests/compiler/main.optimized.wat +++ b/tests/compiler/main.optimized.wat @@ -6,7 +6,7 @@ (memory $0 0) (export "memory" (memory $0)) (export "main" (func $main/main)) - (func $main/main (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $main/main (; 0 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_global $~started) @@ -20,7 +20,7 @@ ) (get_global $main/code) ) - (func $start (; 1 ;) (type $v) + (func $start (; 1 ;) (; has Stack IR ;) (type $v) (set_global $main/code (i32.const 1) ) diff --git a/tests/compiler/mandelbrot.optimized.wat b/tests/compiler/mandelbrot.optimized.wat index 93a7f1bc..f88ce7e6 100644 --- a/tests/compiler/mandelbrot.optimized.wat +++ b/tests/compiler/mandelbrot.optimized.wat @@ -6,7 +6,7 @@ (memory $0 0) (export "memory" (memory $0)) (export "computeLine" (func $../../examples/mandelbrot/assembly/index/computeLine)) - (func $~lib/math/NativeMath.log (; 0 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log (; 0 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 i32) (local $3 i32) @@ -268,7 +268,7 @@ ) ) ) - (func $~lib/builtins/isFinite (; 1 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isFinite (; 1 ;) (; has Stack IR ;) (type $Fi) (param $0 f64) (result i32) (f64.eq (f64.sub (get_local $0) @@ -277,7 +277,7 @@ (f64.const 0) ) ) - (func $../../examples/mandelbrot/assembly/index/clamp (; 2 ;) (type $FFFF) (param $0 f64) (param $1 f64) (param $2 f64) (result f64) + (func $../../examples/mandelbrot/assembly/index/clamp (; 2 ;) (; has Stack IR ;) (type $FFFF) (param $0 f64) (param $1 f64) (param $2 f64) (result f64) (f64.min (f64.max (get_local $0) @@ -286,7 +286,7 @@ (get_local $2) ) ) - (func $../../examples/mandelbrot/assembly/index/computeLine (; 3 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $../../examples/mandelbrot/assembly/index/computeLine (; 3 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 f64) (local $5 f64) (local $6 f64) diff --git a/tests/compiler/many-locals.optimized.wat b/tests/compiler/many-locals.optimized.wat index 2564ad0c..7a98b088 100644 --- a/tests/compiler/many-locals.optimized.wat +++ b/tests/compiler/many-locals.optimized.wat @@ -9,10 +9,10 @@ (export "testI32" (func $many-locals/testI32)) (export "testI8" (func $many-locals/testI8)) (start $start) - (func $many-locals/testI32 (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $many-locals/testI32 (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (get_local $0) ) - (func $many-locals/testI8 (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $many-locals/testI8 (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.shr_s (i32.shl (get_local $0) @@ -21,7 +21,7 @@ (i32.const 24) ) ) - (func $start (; 3 ;) (type $v) + (func $start (; 3 ;) (; has Stack IR ;) (type $v) (if (i32.ne (call $many-locals/testI32 diff --git a/tests/compiler/memcpy.optimized.wat b/tests/compiler/memcpy.optimized.wat index 49033b3d..a7d61167 100644 --- a/tests/compiler/memcpy.optimized.wat +++ b/tests/compiler/memcpy.optimized.wat @@ -9,7 +9,7 @@ (export "memory" (memory $0)) (export "memcpy" (func $memcpy/memcpy)) (start $start) - (func $memcpy/memcpy (; 1 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $memcpy/memcpy (; 1 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1402,7 +1402,7 @@ ) (get_local $6) ) - (func $start (; 2 ;) (type $v) + (func $start (; 2 ;) (; has Stack IR ;) (type $v) (i64.store (i32.const 8) (i64.const 1229782938247303441) diff --git a/tests/compiler/memmove.optimized.wat b/tests/compiler/memmove.optimized.wat index 2664509a..75dd360a 100644 --- a/tests/compiler/memmove.optimized.wat +++ b/tests/compiler/memmove.optimized.wat @@ -8,7 +8,7 @@ (data (i32.const 8) "\n\00\00\00m\00e\00m\00m\00o\00v\00e\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $memmove/memmove (; 1 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $memmove/memmove (; 1 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -278,7 +278,7 @@ ) (get_local $4) ) - (func $start (; 2 ;) (type $v) + (func $start (; 2 ;) (; has Stack IR ;) (type $v) (i64.store (i32.const 8) (i64.const 1229782938247303441) diff --git a/tests/compiler/memset.optimized.wat b/tests/compiler/memset.optimized.wat index e195fca9..32edee10 100644 --- a/tests/compiler/memset.optimized.wat +++ b/tests/compiler/memset.optimized.wat @@ -8,7 +8,7 @@ (data (i32.const 8) "\t\00\00\00m\00e\00m\00s\00e\00t\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $memset/memset (; 1 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $memset/memset (; 1 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -342,7 +342,7 @@ ) (get_local $3) ) - (func $start (; 2 ;) (type $v) + (func $start (; 2 ;) (; has Stack IR ;) (type $v) (set_global $memset/dest (i32.const 32) ) diff --git a/tests/compiler/named-export-default.optimized.wat b/tests/compiler/named-export-default.optimized.wat index e346a7d9..d0fc1f86 100644 --- a/tests/compiler/named-export-default.optimized.wat +++ b/tests/compiler/named-export-default.optimized.wat @@ -3,7 +3,7 @@ (memory $0 0) (export "memory" (memory $0)) (export "default" (func $named-export-default/get3)) - (func $named-export-default/get3 (; 0 ;) (type $i) (result i32) + (func $named-export-default/get3 (; 0 ;) (; has Stack IR ;) (type $i) (result i32) (i32.const 3) ) ) diff --git a/tests/compiler/named-import-default.optimized.wat b/tests/compiler/named-import-default.optimized.wat index f4a6b6b8..16858ae7 100644 --- a/tests/compiler/named-import-default.optimized.wat +++ b/tests/compiler/named-import-default.optimized.wat @@ -3,10 +3,10 @@ (memory $0 0) (export "memory" (memory $0)) (export "getValue" (func $named-import-default/getValue)) - (func $named-export-default/get3 (; 0 ;) (type $i) (result i32) + (func $named-export-default/get3 (; 0 ;) (; has Stack IR ;) (type $i) (result i32) (i32.const 3) ) - (func $named-import-default/getValue (; 1 ;) (type $i) (result i32) + (func $named-import-default/getValue (; 1 ;) (; has Stack IR ;) (type $i) (result i32) (call $named-export-default/get3) ) ) diff --git a/tests/compiler/namespace.optimized.wat b/tests/compiler/namespace.optimized.wat index e0b5d12e..e3d45001 100644 --- a/tests/compiler/namespace.optimized.wat +++ b/tests/compiler/namespace.optimized.wat @@ -5,13 +5,13 @@ (memory $0 0) (export "memory" (memory $0)) (start $start) - (func $namespace/Outer.Inner.aFunc (; 0 ;) (type $i) (result i32) + (func $namespace/Outer.Inner.aFunc (; 0 ;) (; has Stack IR ;) (type $i) (result i32) (get_global $namespace/Outer.Inner.aVar) ) - (func $namespace/Joined.anotherFunc (; 1 ;) (type $i) (result i32) + (func $namespace/Joined.anotherFunc (; 1 ;) (; has Stack IR ;) (type $i) (result i32) (i32.const 3) ) - (func $start (; 2 ;) (type $v) + (func $start (; 2 ;) (; has Stack IR ;) (type $v) (drop (call $namespace/Outer.Inner.aFunc) ) diff --git a/tests/compiler/new-without-allocator.optimized.wat b/tests/compiler/new-without-allocator.optimized.wat index bc318bb0..1f96d2e1 100644 --- a/tests/compiler/new-without-allocator.optimized.wat +++ b/tests/compiler/new-without-allocator.optimized.wat @@ -4,10 +4,10 @@ (memory $0 0) (export "memory" (memory $0)) (export "test" (func $new-without-allocator/test)) - (func $~lib/memory/memory.allocate (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 0 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (unreachable) ) - (func $new-without-allocator/test (; 1 ;) (type $i) (result i32) + (func $new-without-allocator/test (; 1 ;) (; has Stack IR ;) (type $i) (result i32) (drop (call $~lib/memory/memory.allocate (i32.const 0) diff --git a/tests/compiler/object-literal.optimized.wat b/tests/compiler/object-literal.optimized.wat index f6f7e27d..f113886b 100644 --- a/tests/compiler/object-literal.optimized.wat +++ b/tests/compiler/object-literal.optimized.wat @@ -13,7 +13,7 @@ (data (i32.const 36) "\11\00\00\00o\00b\00j\00e\00c\00t\00-\00l\00i\00t\00e\00r\00a\00l\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -99,12 +99,12 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/allocator/arena/__memory_allocate (get_local $0) ) ) - (func $~lib/internal/string/compareUnsafe (; 3 ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) + (func $~lib/internal/string/compareUnsafe (; 3 ;) (; has Stack IR ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) (local $5 i32) (set_local $1 (i32.add @@ -169,7 +169,7 @@ ) (get_local $5) ) - (func $~lib/string/String.__eq (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 4 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eq @@ -225,7 +225,7 @@ ) ) ) - (func $object-literal/bar (; 5 ;) (type $iv) (param $0 i32) + (func $object-literal/bar (; 5 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (if (i32.ne (i32.load @@ -263,7 +263,7 @@ ) ) ) - (func $object-literal/bar2 (; 6 ;) (type $iv) (param $0 i32) + (func $object-literal/bar2 (; 6 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (if (i32.ne (i32.load @@ -282,7 +282,7 @@ ) ) ) - (func $object-literal/Foo2#test (; 7 ;) (type $iv) (param $0 i32) + (func $object-literal/Foo2#test (; 7 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (if (i32.ne (i32.load @@ -301,7 +301,7 @@ ) ) ) - (func $start (; 8 ;) (type $v) + (func $start (; 8 ;) (; has Stack IR ;) (type $v) (local $0 i32) (set_global $~lib/allocator/arena/startOffset (i32.const 80) diff --git a/tests/compiler/portable-conversions.optimized.wat b/tests/compiler/portable-conversions.optimized.wat index 2d528b03..253c22ae 100644 --- a/tests/compiler/portable-conversions.optimized.wat +++ b/tests/compiler/portable-conversions.optimized.wat @@ -5,7 +5,7 @@ (memory $0 0) (export "memory" (memory $0)) (start $start) - (func $start (; 0 ;) (type $v) + (func $start (; 0 ;) (; has Stack IR ;) (type $v) (drop (i32.trunc_s/f32 (get_global $portable-conversions/f) diff --git a/tests/compiler/recursive.optimized.wat b/tests/compiler/recursive.optimized.wat index 4d69d845..f0c9e5fb 100644 --- a/tests/compiler/recursive.optimized.wat +++ b/tests/compiler/recursive.optimized.wat @@ -3,7 +3,7 @@ (memory $0 0) (export "memory" (memory $0)) (export "fib" (func $recursive/fib)) - (func $recursive/fib (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $recursive/fib (; 0 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (i32.le_s (get_local $0) diff --git a/tests/compiler/reexport.optimized.wat b/tests/compiler/reexport.optimized.wat index 61849584..77fb6a04 100644 --- a/tests/compiler/reexport.optimized.wat +++ b/tests/compiler/reexport.optimized.wat @@ -18,28 +18,28 @@ (export "rerenamed_sub" (func $export/mul)) (export "renamed_ns.two" (func $export/ns.two)) (start $start) - (func $export/add (; 0 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $export/add (; 0 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $export/sub (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $export/sub (; 1 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $export/mul (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $export/mul (; 2 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.mul (get_local $0) (get_local $1) ) ) - (func $export/ns.two (; 3 ;) (type $v) + (func $export/ns.two (; 3 ;) (; has Stack IR ;) (type $v) (nop) ) - (func $start (; 4 ;) (type $v) + (func $start (; 4 ;) (; has Stack IR ;) (type $v) (drop (i32.add (call $export/add diff --git a/tests/compiler/retain-i32.optimized.wat b/tests/compiler/retain-i32.optimized.wat index 50dbf221..99900bd5 100644 --- a/tests/compiler/retain-i32.optimized.wat +++ b/tests/compiler/retain-i32.optimized.wat @@ -9,10 +9,10 @@ (data (i32.const 8) "\0d\00\00\00r\00e\00t\00a\00i\00n\00-\00i\003\002\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $retain-i32/test (; 1 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $retain-i32/test (; 1 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (nop) ) - (func $start (; 2 ;) (type $v) + (func $start (; 2 ;) (; has Stack IR ;) (type $v) (local $0 i32) (call $retain-i32/test (i32.const 0) diff --git a/tests/compiler/scoped.optimized.wat b/tests/compiler/scoped.optimized.wat index e73e8c81..34be563a 100644 --- a/tests/compiler/scoped.optimized.wat +++ b/tests/compiler/scoped.optimized.wat @@ -4,10 +4,10 @@ (memory $0 0) (export "memory" (memory $0)) (start $start) - (func $scoped/fn (; 0 ;) (type $iv) (param $0 i32) + (func $scoped/fn (; 0 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (nop) ) - (func $start (; 1 ;) (type $v) + (func $start (; 1 ;) (; has Stack IR ;) (type $v) (local $0 i32) (block $break|0 (loop $repeat|0 diff --git a/tests/compiler/static-this.optimized.wat b/tests/compiler/static-this.optimized.wat index 437716e8..8073aff6 100644 --- a/tests/compiler/static-this.optimized.wat +++ b/tests/compiler/static-this.optimized.wat @@ -8,10 +8,10 @@ (data (i32.const 8) "\0e\00\00\00s\00t\00a\00t\00i\00c\00-\00t\00h\00i\00s\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $static-this/Foo.getBar (; 1 ;) (type $i) (result i32) + (func $static-this/Foo.getBar (; 1 ;) (; has Stack IR ;) (type $i) (result i32) (get_global $static-this/Foo.bar) ) - (func $start (; 2 ;) (type $v) + (func $start (; 2 ;) (; has Stack IR ;) (type $v) (if (i32.ne (call $static-this/Foo.getBar) diff --git a/tests/compiler/std/allocator_arena.optimized.wat b/tests/compiler/std/allocator_arena.optimized.wat index a238fd5d..238d083b 100644 --- a/tests/compiler/std/allocator_arena.optimized.wat +++ b/tests/compiler/std/allocator_arena.optimized.wat @@ -15,7 +15,7 @@ (data (i32.const 8) "\16\00\00\00s\00t\00d\00/\00a\00l\00l\00o\00c\00a\00t\00o\00r\00_\00a\00r\00e\00n\00a\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -101,12 +101,7 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - (func $~lib/memory/memset (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memset (; 2 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -436,14 +431,7 @@ ) ) ) - (func $~lib/memory/memory.fill (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/memory/memcpy (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memcpy (; 3 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1829,7 +1817,7 @@ ) ) ) - (func $~lib/memory/memmove (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memmove (; 4 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -1864,7 +1852,7 @@ (if (get_local $3) (block - (call $~lib/memory/memcpy + (call $~lib/internal/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2121,14 +2109,7 @@ ) ) ) - (func $~lib/memory/memory.copy (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memmove - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/memory/memcmp (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/memory/memcmp (; 5 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eq @@ -2198,30 +2179,15 @@ ) ) ) - (func $~lib/memory/memory.compare (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (call $~lib/memory/memcmp - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/allocator/arena/__memory_free (; 10 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 6 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/memory/memory.free (; 11 ;) (type $iv) (param $0 i32) - (call $~lib/allocator/arena/__memory_free - (get_local $0) - ) - ) - (func $~lib/allocator/arena/__memory_reset (; 12 ;) (type $v) + (func $~lib/allocator/arena/__memory_reset (; 7 ;) (; has Stack IR ;) (type $v) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) ) ) - (func $~lib/memory/memory.reset (; 13 ;) (type $v) - (call $~lib/allocator/arena/__memory_reset) - ) - (func $start (; 14 ;) (type $v) + (func $start (; 8 ;) (; has Stack IR ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.const 56) ) @@ -2229,12 +2195,12 @@ (get_global $~lib/allocator/arena/startOffset) ) (set_global $std/allocator_arena/ptr1 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (i32.const 42) ) ) (set_global $std/allocator_arena/ptr2 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (i32.const 42) ) ) @@ -2253,7 +2219,7 @@ (unreachable) ) ) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (get_global $std/allocator_arena/ptr1) (i32.const 18) (i32.const 42) @@ -2300,7 +2266,7 @@ ) ) ) - (call $~lib/memory/memory.copy + (call $~lib/internal/memory/memmove (get_global $std/allocator_arena/ptr2) (get_global $std/allocator_arena/ptr1) (i32.const 42) @@ -2348,7 +2314,7 @@ ) ) (if - (call $~lib/memory/memory.compare + (call $~lib/internal/memory/memcmp (get_global $std/allocator_arena/ptr1) (get_global $std/allocator_arena/ptr2) (i32.const 42) @@ -2363,15 +2329,15 @@ (unreachable) ) ) - (call $~lib/memory/memory.free + (call $~lib/allocator/arena/__memory_free (get_global $std/allocator_arena/ptr1) ) - (call $~lib/memory/memory.free + (call $~lib/allocator/arena/__memory_free (get_global $std/allocator_arena/ptr2) ) - (call $~lib/memory/memory.reset) + (call $~lib/allocator/arena/__memory_reset) (set_global $std/allocator_arena/ptr1 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (i32.const 42) ) ) diff --git a/tests/compiler/std/allocator_arena.untouched.wat b/tests/compiler/std/allocator_arena.untouched.wat index afba45d2..efe111f1 100644 --- a/tests/compiler/std/allocator_arena.untouched.wat +++ b/tests/compiler/std/allocator_arena.untouched.wat @@ -129,14 +129,7 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) - (return - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - ) - (func $~lib/memory/memset (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memset (; 2 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -488,14 +481,7 @@ ) ) ) - (func $~lib/memory/memory.fill (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/memory/memcpy (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memcpy (; 3 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2297,7 +2283,7 @@ ) ) ) - (func $~lib/memory/memmove (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memmove (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.eq @@ -2327,7 +2313,7 @@ ) ) (block - (call $~lib/memory/memcpy + (call $~lib/internal/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2615,14 +2601,7 @@ ) ) ) - (func $~lib/memory/memory.copy (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memmove - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/memory/memcmp (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/memory/memcmp (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eq @@ -2692,32 +2671,18 @@ (i32.const 0) ) ) - (func $~lib/memory/memory.compare (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) - (call $~lib/memory/memcmp - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/allocator/arena/__memory_free (; 10 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 6 ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/memory/memory.free (; 11 ;) (type $iv) (param $0 i32) - (call $~lib/allocator/arena/__memory_free - (get_local $0) - ) - (return) - ) - (func $~lib/allocator/arena/__memory_reset (; 12 ;) (type $v) + (func $~lib/allocator/arena/__memory_reset (; 7 ;) (type $v) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) ) ) - (func $~lib/memory/memory.reset (; 13 ;) (type $v) - (call $~lib/allocator/arena/__memory_reset) - (return) - ) - (func $start (; 14 ;) (type $v) + (func $start (; 8 ;) (type $v) + (local $0 i32) + (local $1 i32) + (local $2 i32) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add @@ -2734,13 +2699,27 @@ (get_global $~lib/allocator/arena/startOffset) ) (set_global $std/allocator_arena/ptr1 - (call $~lib/memory/memory.allocate - (get_global $std/allocator_arena/size) + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $0 + (get_global $std/allocator_arena/size) + ) + (br $~lib/memory/memory.allocate|inlined.0 + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) ) ) (set_global $std/allocator_arena/ptr2 - (call $~lib/memory/memory.allocate - (get_global $std/allocator_arena/size) + (block $~lib/memory/memory.allocate|inlined.1 (result i32) + (set_local $0 + (get_global $std/allocator_arena/size) + ) + (br $~lib/memory/memory.allocate|inlined.1 + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) ) ) (if @@ -2760,10 +2739,21 @@ (unreachable) ) ) - (call $~lib/memory/memory.fill - (get_global $std/allocator_arena/ptr1) - (i32.const 18) - (get_global $std/allocator_arena/size) + (block $~lib/memory/memory.fill|inlined.0 + (set_local $0 + (get_global $std/allocator_arena/ptr1) + ) + (set_local $1 + (i32.const 18) + ) + (set_local $2 + (get_global $std/allocator_arena/size) + ) + (call $~lib/internal/memory/memset + (get_local $0) + (get_local $1) + (get_local $2) + ) ) (block $break|0 (set_global $std/allocator_arena/i @@ -2809,10 +2799,21 @@ (br $repeat|0) ) ) - (call $~lib/memory/memory.copy - (get_global $std/allocator_arena/ptr2) - (get_global $std/allocator_arena/ptr1) - (get_global $std/allocator_arena/size) + (block $~lib/memory/memory.copy|inlined.0 + (set_local $2 + (get_global $std/allocator_arena/ptr2) + ) + (set_local $1 + (get_global $std/allocator_arena/ptr1) + ) + (set_local $0 + (get_global $std/allocator_arena/size) + ) + (call $~lib/internal/memory/memmove + (get_local $2) + (get_local $1) + (get_local $0) + ) ) (block $break|1 (set_global $std/allocator_arena/i @@ -2861,10 +2862,21 @@ (if (i32.eqz (i32.eq - (call $~lib/memory/memory.compare - (get_global $std/allocator_arena/ptr1) - (get_global $std/allocator_arena/ptr2) - (get_global $std/allocator_arena/size) + (block $~lib/memory/memory.compare|inlined.0 (result i32) + (set_local $0 + (get_global $std/allocator_arena/ptr1) + ) + (set_local $1 + (get_global $std/allocator_arena/ptr2) + ) + (set_local $2 + (get_global $std/allocator_arena/size) + ) + (call $~lib/internal/memory/memcmp + (get_local $0) + (get_local $1) + (get_local $2) + ) ) (i32.const 0) ) @@ -2879,16 +2891,44 @@ (unreachable) ) ) - (call $~lib/memory/memory.free - (get_global $std/allocator_arena/ptr1) + (block $~lib/memory/memory.free|inlined.0 + (set_local $2 + (get_global $std/allocator_arena/ptr1) + ) + (block + (call $~lib/allocator/arena/__memory_free + (get_local $2) + ) + (br $~lib/memory/memory.free|inlined.0) + ) ) - (call $~lib/memory/memory.free - (get_global $std/allocator_arena/ptr2) + (block $~lib/memory/memory.free|inlined.1 + (set_local $2 + (get_global $std/allocator_arena/ptr2) + ) + (block + (call $~lib/allocator/arena/__memory_free + (get_local $2) + ) + (br $~lib/memory/memory.free|inlined.1) + ) + ) + (block $~lib/memory/memory.reset|inlined.0 + (block + (call $~lib/allocator/arena/__memory_reset) + (br $~lib/memory/memory.reset|inlined.0) + ) ) - (call $~lib/memory/memory.reset) (set_global $std/allocator_arena/ptr1 - (call $~lib/memory/memory.allocate - (get_global $std/allocator_arena/size) + (block $~lib/memory/memory.allocate|inlined.2 (result i32) + (set_local $2 + (get_global $std/allocator_arena/size) + ) + (br $~lib/memory/memory.allocate|inlined.2 + (call $~lib/allocator/arena/__memory_allocate + (get_local $2) + ) + ) ) ) (if diff --git a/tests/compiler/std/array-access.optimized.wat b/tests/compiler/std/array-access.optimized.wat index 640c9f32..c770f19d 100644 --- a/tests/compiler/std/array-access.optimized.wat +++ b/tests/compiler/std/array-access.optimized.wat @@ -14,7 +14,7 @@ (export "stringArrayMethodCall" (func $std/array-access/stringArrayMethodCall)) (export "stringArrayArrayPropertyAccess" (func $std/array-access/stringArrayArrayPropertyAccess)) (export "stringArrayArrayMethodCall" (func $std/array-access/stringArrayArrayMethodCall)) - (func $~lib/array/Array>#__get (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#__get (; 1 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (i32.lt_u @@ -43,7 +43,7 @@ ) ) ) - (func $std/array-access/i32ArrayArrayElementAccess (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array-access/i32ArrayArrayElementAccess (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/array/Array>#__get (call $~lib/array/Array>#__get (get_local $0) @@ -52,7 +52,7 @@ (i32.const 1) ) ) - (func $std/array-access/stringArrayPropertyAccess (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array-access/stringArrayPropertyAccess (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.load (call $~lib/array/Array>#__get (get_local $0) @@ -60,7 +60,7 @@ ) ) ) - (func $~lib/internal/string/compareUnsafe (; 4 ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) + (func $~lib/internal/string/compareUnsafe (; 4 ;) (; has Stack IR ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) (local $5 i32) (set_local $1 (i32.add @@ -125,7 +125,7 @@ ) (get_local $5) ) - (func $~lib/string/String#startsWith (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#startsWith (; 5 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (if @@ -136,7 +136,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 12) - (i32.const 245) + (i32.const 241) (i32.const 4) ) (unreachable) @@ -198,7 +198,7 @@ ) ) ) - (func $std/array-access/stringArrayMethodCall (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array-access/stringArrayMethodCall (; 6 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/string/String#startsWith (call $~lib/array/Array>#__get (get_local $0) @@ -208,7 +208,7 @@ (i32.const 0) ) ) - (func $std/array-access/stringArrayArrayPropertyAccess (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array-access/stringArrayArrayPropertyAccess (; 7 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.load (call $~lib/array/Array>#__get (call $~lib/array/Array>#__get @@ -219,7 +219,7 @@ ) ) ) - (func $std/array-access/stringArrayArrayMethodCall (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array-access/stringArrayArrayMethodCall (; 8 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/string/String#startsWith (call $~lib/array/Array>#__get (call $~lib/array/Array>#__get diff --git a/tests/compiler/std/array-access.untouched.wat b/tests/compiler/std/array-access.untouched.wat index 56b0214a..a594ff16 100644 --- a/tests/compiler/std/array-access.untouched.wat +++ b/tests/compiler/std/array-access.untouched.wat @@ -210,7 +210,6 @@ (local $6 i32) (local $7 i32) (local $8 i32) - (local $9 i32) (if (i32.eqz (i32.ne @@ -222,7 +221,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 12) - (i32.const 245) + (i32.const 241) (i32.const 4) ) (unreachable) @@ -245,37 +244,32 @@ (get_local $0) ) ) - (set_local $8 - (block $~lib/internal/string/clamp|inlined.0 (result i32) - (set_local $5 - (i32.const 0) - ) - (select - (tee_local $6 - (select - (tee_local $6 - (get_local $3) - ) - (tee_local $7 - (get_local $5) - ) - (i32.gt_s - (get_local $6) - (get_local $7) - ) + (set_local $7 + (select + (tee_local $5 + (select + (tee_local $5 + (get_local $3) + ) + (tee_local $6 + (i32.const 0) + ) + (i32.gt_s + (get_local $5) + (get_local $6) ) ) - (tee_local $7 - (get_local $4) - ) - (i32.lt_s - (get_local $6) - (get_local $7) - ) + ) + (tee_local $6 + (get_local $4) + ) + (i32.lt_s + (get_local $5) + (get_local $6) ) ) ) - (set_local $9 + (set_local $8 (i32.load (get_local $1) ) @@ -283,8 +277,8 @@ (if (i32.gt_s (i32.add - (get_local $9) (get_local $8) + (get_local $7) ) (get_local $4) ) @@ -295,10 +289,10 @@ (i32.eqz (call $~lib/internal/string/compareUnsafe (get_local $0) - (get_local $8) + (get_local $7) (get_local $1) (i32.const 0) - (get_local $9) + (get_local $8) ) ) ) diff --git a/tests/compiler/std/array-literal.optimized.wat b/tests/compiler/std/array-literal.optimized.wat index 825155c5..0625a214 100644 --- a/tests/compiler/std/array-literal.optimized.wat +++ b/tests/compiler/std/array-literal.optimized.wat @@ -7,23 +7,50 @@ (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) - (global $std/array-literal/emptyArray (mut i32) (i32.const 0)) + (global $std/array-literal/emptyArrayI32 (mut i32) (i32.const 120)) (global $std/array-literal/i (mut i32) (i32.const 0)) - (global $std/array-literal/dynamicArray (mut i32) (i32.const 0)) + (global $std/array-literal/dynamicArrayI8 (mut i32) (i32.const 0)) + (global $std/array-literal/dynamicArrayI32 (mut i32) (i32.const 0)) (memory $0 1) - (data (i32.const 8) "\10\00\00\00\03\00\00\00\0c") - (data (i32.const 28) "\01\00\00\00\02") - (data (i32.const 48) "\14\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00-\00l\00i\00t\00e\00r\00a\00l\00.\00t\00s") - (data (i32.const 92) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s") - (data (i32.const 124) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") + (data (i32.const 8) "\10\00\00\00\03\00\00\00\03") + (data (i32.const 25) "\01\02") + (data (i32.const 32) "\14\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00-\00l\00i\00t\00e\00r\00a\00l\00.\00t\00s") + (data (i32.const 80) "X\00\00\00\03\00\00\00\0c") + (data (i32.const 100) "\01\00\00\00\02") + (data (i32.const 120) "\80") + (data (i32.const 136) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s") + (data (i32.const 168) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/array/Array#get:length (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $~lib/array/Array#__get (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__get (; 2 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (tee_local $0 + (if (result i32) + (i32.lt_u + (get_local $1) + (i32.load + (tee_local $0 + (i32.load + (get_local $0) + ) + ) + ) + ) + (i32.load8_s offset=8 + (i32.add + (get_local $0) + (get_local $1) + ) + ) + (unreachable) + ) + ) + ) + (func $~lib/array/Array#__get (; 3 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (i32.lt_u @@ -52,7 +79,7 @@ ) ) ) - (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/computeSize (; 4 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -66,7 +93,7 @@ ) ) ) - (func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 5 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -152,12 +179,7 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 6 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -167,8 +189,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 124) - (i32.const 22) + (i32.const 168) + (i32.const 23) (i32.const 2) ) (unreachable) @@ -176,7 +198,7 @@ ) (i32.store (tee_local $1 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -186,7 +208,12 @@ ) (get_local $1) ) - (func $~lib/memory/memset (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memory.allocate (; 7 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/internal/memory/memset (; 8 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -516,14 +543,77 @@ ) ) ) - (func $~lib/memory/memory.fill (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset + (func $~lib/array/Array#constructor (; 9 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (if + (i32.gt_u + (get_local $1) + (i32.const 1073741816) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 136) + (i32.const 23) + (i32.const 39) + ) + (unreachable) + ) + ) + (set_local $2 + (call $~lib/internal/arraybuffer/allocateUnsafe + (get_local $1) + ) + ) + (if + (i32.eqz + (get_local $0) + ) + (block + (i32.store + (tee_local $0 + (call $~lib/memory/memory.allocate + (i32.const 8) + ) + ) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $0) + (i32.const 0) + ) + ) + ) + (i32.store + (get_local $0) + (get_local $2) + ) + (i32.store offset=4 (get_local $0) (get_local $1) + ) + (call $~lib/internal/memory/memset + (i32.add + (get_local $2) + (i32.const 8) + ) + (i32.const 0) + (get_local $1) + ) + (get_local $0) + ) + (func $~lib/array/Array#__unchecked_set (; 10 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (i32.store8 offset=8 + (i32.add + (i32.load + (get_local $0) + ) + (get_local $1) + ) (get_local $2) ) ) - (func $~lib/array/Array#constructor (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#constructor (; 11 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -534,7 +624,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 92) + (i32.const 136) (i32.const 23) (i32.const 39) ) @@ -542,7 +632,7 @@ ) ) (set_local $2 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (tee_local $3 (i32.shl (get_local $1) @@ -578,7 +668,7 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (i32.add (get_local $2) (i32.const 8) @@ -588,7 +678,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#__unchecked_set (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__unchecked_set (; 12 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (i32.store offset=8 (i32.add (i32.load @@ -602,17 +692,17 @@ (get_local $2) ) ) - (func $start (; 11 ;) (type $v) + (func $start (; 13 ;) (; has Stack IR ;) (type $v) (local $0 i32) (set_global $~lib/allocator/arena/startOffset - (i32.const 184) + (i32.const 232) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) ) (if (i32.ne - (call $~lib/array/Array#get:length + (call $~lib/array/Array#get:length (i32.const 8) ) (i32.const 3) @@ -620,7 +710,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 32) (i32.const 4) (i32.const 0) ) @@ -628,14 +718,17 @@ ) ) (if - (call $~lib/array/Array#__get - (i32.const 8) - (i32.const 0) + (i32.and + (call $~lib/array/Array#__get + (i32.const 8) + (i32.const 0) + ) + (i32.const 255) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 32) (i32.const 5) (i32.const 0) ) @@ -644,26 +737,100 @@ ) (if (i32.ne - (call $~lib/array/Array#__get - (i32.const 8) - (i32.const 1) + (i32.and + (call $~lib/array/Array#__get + (i32.const 8) + (i32.const 1) + ) + (i32.const 255) ) (i32.const 1) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 32) (i32.const 6) (i32.const 0) ) (unreachable) ) ) + (if + (i32.ne + (i32.and + (call $~lib/array/Array#__get + (i32.const 8) + (i32.const 2) + ) + (i32.const 255) + ) + (i32.const 2) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 7) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.ne + (call $~lib/array/Array#get:length + (i32.const 80) + ) + (i32.const 3) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 10) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (call $~lib/array/Array#__get + (i32.const 80) + (i32.const 0) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 11) + (i32.const 0) + ) + (unreachable) + ) + ) (if (i32.ne (call $~lib/array/Array#__get - (i32.const 8) + (i32.const 80) + (i32.const 1) + ) + (i32.const 1) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 12) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.ne + (call $~lib/array/Array#__get + (i32.const 80) (i32.const 2) ) (i32.const 2) @@ -671,33 +838,142 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) - (i32.const 7) + (i32.const 32) + (i32.const 13) (i32.const 0) ) (unreachable) ) ) - (set_global $std/array-literal/emptyArray - (call $~lib/array/Array#constructor - (i32.const 0) - (i32.const 0) - ) - ) (if - (call $~lib/array/Array#get:length - (get_global $std/array-literal/emptyArray) + (call $~lib/array/Array#get:length + (get_global $std/array-literal/emptyArrayI32) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) - (i32.const 10) + (i32.const 32) + (i32.const 16) (i32.const 0) ) (unreachable) ) ) + (call $~lib/array/Array#__unchecked_set + (tee_local $0 + (call $~lib/array/Array#constructor + (i32.const 0) + (i32.const 3) + ) + ) + (i32.const 0) + (get_global $std/array-literal/i) + ) + (set_global $std/array-literal/i + (i32.add + (get_global $std/array-literal/i) + (i32.const 1) + ) + ) + (call $~lib/array/Array#__unchecked_set + (get_local $0) + (i32.const 1) + (get_global $std/array-literal/i) + ) + (set_global $std/array-literal/i + (i32.add + (get_global $std/array-literal/i) + (i32.const 1) + ) + ) + (call $~lib/array/Array#__unchecked_set + (get_local $0) + (i32.const 2) + (get_global $std/array-literal/i) + ) + (set_global $std/array-literal/dynamicArrayI8 + (get_local $0) + ) + (if + (i32.ne + (call $~lib/array/Array#get:length + (get_global $std/array-literal/dynamicArrayI8) + ) + (i32.const 3) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 21) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.and + (call $~lib/array/Array#__get + (get_global $std/array-literal/dynamicArrayI8) + (i32.const 0) + ) + (i32.const 255) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 22) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.ne + (i32.and + (call $~lib/array/Array#__get + (get_global $std/array-literal/dynamicArrayI8) + (i32.const 1) + ) + (i32.const 255) + ) + (i32.const 1) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 23) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.ne + (i32.and + (call $~lib/array/Array#__get + (get_global $std/array-literal/dynamicArrayI8) + (i32.const 2) + ) + (i32.const 255) + ) + (i32.const 2) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 24) + (i32.const 0) + ) + (unreachable) + ) + ) + (set_global $std/array-literal/i + (i32.const 0) + ) (call $~lib/array/Array#__unchecked_set (tee_local $0 (call $~lib/array/Array#constructor @@ -730,21 +1006,21 @@ (i32.const 2) (get_global $std/array-literal/i) ) - (set_global $std/array-literal/dynamicArray + (set_global $std/array-literal/dynamicArrayI32 (get_local $0) ) (if (i32.ne - (call $~lib/array/Array#get:length - (get_global $std/array-literal/dynamicArray) + (call $~lib/array/Array#get:length + (get_global $std/array-literal/dynamicArrayI32) ) (i32.const 3) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) - (i32.const 14) + (i32.const 32) + (i32.const 29) (i32.const 0) ) (unreachable) @@ -752,14 +1028,14 @@ ) (if (call $~lib/array/Array#__get - (get_global $std/array-literal/dynamicArray) + (get_global $std/array-literal/dynamicArrayI32) (i32.const 0) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) - (i32.const 15) + (i32.const 32) + (i32.const 30) (i32.const 0) ) (unreachable) @@ -768,7 +1044,7 @@ (if (i32.ne (call $~lib/array/Array#__get - (get_global $std/array-literal/dynamicArray) + (get_global $std/array-literal/dynamicArrayI32) (i32.const 1) ) (i32.const 1) @@ -776,8 +1052,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) - (i32.const 16) + (i32.const 32) + (i32.const 31) (i32.const 0) ) (unreachable) @@ -786,7 +1062,7 @@ (if (i32.ne (call $~lib/array/Array#__get - (get_global $std/array-literal/dynamicArray) + (get_global $std/array-literal/dynamicArrayI32) (i32.const 2) ) (i32.const 2) @@ -794,8 +1070,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) - (i32.const 17) + (i32.const 32) + (i32.const 32) (i32.const 0) ) (unreachable) diff --git a/tests/compiler/std/array-literal.ts b/tests/compiler/std/array-literal.ts index 332d278d..12b6a8c4 100644 --- a/tests/compiler/std/array-literal.ts +++ b/tests/compiler/std/array-literal.ts @@ -1,17 +1,32 @@ import "allocator/arena"; -const staticArray: i32[] = [0, 1, 2]; -assert(staticArray.length == 3); -assert(staticArray[0] == 0); -assert(staticArray[1] == 1); -assert(staticArray[2] == 2); +const staticArrayI8: i8[] = [0, 1, 2]; +assert(staticArrayI8.length == 3); +assert(staticArrayI8[0] == 0); +assert(staticArrayI8[1] == 1); +assert(staticArrayI8[2] == 2); -var emptyArray: i32[] = []; // not static atm -assert(emptyArray.length == 0); +const staticArrayI32: i32[] = [0, 1, 2]; +assert(staticArrayI32.length == 3); +assert(staticArrayI32[0] == 0); +assert(staticArrayI32[1] == 1); +assert(staticArrayI32[2] == 2); + +var emptyArrayI32: i32[] = []; // static +assert(emptyArrayI32.length == 0); var i = 0; -var dynamicArray: i32[] = [i, ++i, ++i]; -assert(dynamicArray.length == 3); -assert(dynamicArray[0] == 0); -assert(dynamicArray[1] == 1); -assert(dynamicArray[2] == 2); + +var dynamicArrayI8: i8[] = [i, ++i, ++i]; +assert(dynamicArrayI8.length == 3); +assert(dynamicArrayI8[0] == 0); +assert(dynamicArrayI8[1] == 1); +assert(dynamicArrayI8[2] == 2); + +i = 0; + +var dynamicArrayI32: i32[] = [i, ++i, ++i]; +assert(dynamicArrayI32.length == 3); +assert(dynamicArrayI32[0] == 0); +assert(dynamicArrayI32[1] == 1); +assert(dynamicArrayI32[2] == 2); diff --git a/tests/compiler/std/array-literal.untouched.wat b/tests/compiler/std/array-literal.untouched.wat index 70c26658..255f5256 100644 --- a/tests/compiler/std/array-literal.untouched.wat +++ b/tests/compiler/std/array-literal.untouched.wat @@ -11,26 +11,66 @@ (global $~lib/internal/allocator/MAX_SIZE_32 i32 (i32.const 1073741824)) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) - (global $std/array-literal/staticArray i32 (i32.const 8)) + (global $std/array-literal/staticArrayI8 i32 (i32.const 8)) (global $~lib/internal/arraybuffer/HEADER_SIZE i32 (i32.const 8)) - (global $~lib/internal/arraybuffer/MAX_BLENGTH i32 (i32.const 1073741816)) - (global $std/array-literal/emptyArray (mut i32) (i32.const 0)) + (global $std/array-literal/staticArrayI32 i32 (i32.const 80)) + (global $std/array-literal/emptyArrayI32 (mut i32) (i32.const 120)) (global $std/array-literal/i (mut i32) (i32.const 0)) - (global $std/array-literal/dynamicArray (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 184)) + (global $~lib/internal/arraybuffer/MAX_BLENGTH i32 (i32.const 1073741816)) + (global $std/array-literal/dynamicArrayI8 (mut i32) (i32.const 0)) + (global $std/array-literal/dynamicArrayI32 (mut i32) (i32.const 0)) + (global $HEAP_BASE i32 (i32.const 228)) (memory $0 1) - (data (i32.const 8) "\10\00\00\00\03\00\00\00\0c\00\00\00\00\00\00\00\00\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") - (data (i32.const 48) "\14\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00-\00l\00i\00t\00e\00r\00a\00l\00.\00t\00s\00") - (data (i32.const 92) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00") - (data (i32.const 124) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") + (data (i32.const 8) "\10\00\00\00\03\00\00\00\03\00\00\00\00\00\00\00\00\01\02\00\00\00\00\00") + (data (i32.const 32) "\14\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00-\00l\00i\00t\00e\00r\00a\00l\00.\00t\00s\00") + (data (i32.const 80) "X\00\00\00\03\00\00\00\0c\00\00\00\00\00\00\00\00\00\00\00\01\00\00\00\02\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data (i32.const 120) "\80\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data (i32.const 136) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00") + (data (i32.const 168) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") (export "memory" (memory $0)) (start $start) - (func $~lib/array/Array#get:length (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 1 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $~lib/array/Array#__get (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__get (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (set_local $2 + (i32.load + (get_local $0) + ) + ) + (if (result i32) + (i32.lt_u + (get_local $1) + (i32.shr_u + (i32.load + (get_local $2) + ) + (i32.const 0) + ) + ) + (block $~lib/internal/arraybuffer/loadUnsafe|inlined.0 (result i32) + (i32.load8_s offset=8 + (i32.add + (get_local $2) + (i32.shl + (get_local $1) + (i32.const 0) + ) + ) + ) + ) + (unreachable) + ) + ) + (func $~lib/array/Array#get:length (; 3 ;) (type $ii) (param $0 i32) (result i32) + (i32.load offset=4 + (get_local $0) + ) + ) + (func $~lib/array/Array#__get (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -61,7 +101,7 @@ (unreachable) ) ) - (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/computeSize (; 5 ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -78,7 +118,7 @@ ) ) ) - (func $~lib/allocator/arena/__memory_allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -186,15 +226,9 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) - (return - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 7 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) + (local $2 i32) (if (i32.eqz (i32.le_u @@ -205,17 +239,24 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 124) - (i32.const 22) + (i32.const 168) + (i32.const 23) (i32.const 2) ) (unreachable) ) ) (set_local $1 - (call $~lib/memory/memory.allocate - (call $~lib/internal/arraybuffer/computeSize - (get_local $0) + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $2 + (call $~lib/internal/arraybuffer/computeSize + (get_local $0) + ) + ) + (br $~lib/memory/memory.allocate|inlined.0 + (call $~lib/allocator/arena/__memory_allocate + (get_local $2) + ) ) ) ) @@ -225,7 +266,14 @@ ) (get_local $1) ) - (func $~lib/memory/memset (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memory.allocate (; 8 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/internal/memory/memset (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -577,26 +625,20 @@ ) ) ) - (func $~lib/memory/memory.fill (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/array/Array#constructor (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#constructor (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) - (i32.const 268435454) + (i32.const 1073741816) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 92) + (i32.const 136) (i32.const 23) (i32.const 39) ) @@ -606,11 +648,11 @@ (set_local $2 (i32.shl (get_local $1) - (i32.const 2) + (i32.const 0) ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) @@ -645,17 +687,125 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.0 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (get_local $0) ) - (func $~lib/array/Array#__unchecked_set (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__unchecked_set (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (local $3 i32) + (block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 + (set_local $3 + (i32.load + (get_local $0) + ) + ) + (i32.store8 offset=8 + (i32.add + (get_local $3) + (i32.shl + (get_local $1) + (i32.const 0) + ) + ) + (get_local $2) + ) + ) + ) + (func $~lib/array/Array#constructor (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (if + (i32.gt_u + (get_local $1) + (i32.const 268435454) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 136) + (i32.const 23) + (i32.const 39) + ) + (unreachable) + ) + ) + (set_local $2 + (i32.shl + (get_local $1) + (i32.const 2) + ) + ) + (set_local $3 + (call $~lib/internal/arraybuffer/allocateUnsafe + (get_local $2) + ) + ) + (i32.store + (tee_local $0 + (if (result i32) + (get_local $0) + (get_local $0) + (tee_local $0 + (block (result i32) + (set_local $4 + (call $~lib/memory/memory.allocate + (i32.const 8) + ) + ) + (i32.store + (get_local $4) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $4) + (i32.const 0) + ) + (get_local $4) + ) + ) + ) + ) + (get_local $3) + ) + (i32.store offset=4 + (get_local $0) + (get_local $1) + ) + (block $~lib/memory/memory.fill|inlined.1 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) + ) + ) + (get_local $0) + ) + (func $~lib/array/Array#__unchecked_set (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (block $~lib/internal/arraybuffer/storeUnsafe|inlined.0 (set_local $3 @@ -675,7 +825,7 @@ ) ) ) - (func $start (; 11 ;) (type $v) + (func $start (; 14 ;) (type $v) (local $0 i32) (set_global $~lib/allocator/arena/startOffset (i32.and @@ -695,8 +845,8 @@ (if (i32.eqz (i32.eq - (call $~lib/array/Array#get:length - (get_global $std/array-literal/staticArray) + (call $~lib/array/Array#get:length + (get_global $std/array-literal/staticArrayI8) ) (i32.const 3) ) @@ -704,7 +854,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 32) (i32.const 4) (i32.const 0) ) @@ -714,9 +864,15 @@ (if (i32.eqz (i32.eq - (call $~lib/array/Array#__get - (get_global $std/array-literal/staticArray) - (i32.const 0) + (i32.shr_s + (i32.shl + (call $~lib/array/Array#__get + (get_global $std/array-literal/staticArrayI8) + (i32.const 0) + ) + (i32.const 24) + ) + (i32.const 24) ) (i32.const 0) ) @@ -724,7 +880,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 32) (i32.const 5) (i32.const 0) ) @@ -734,9 +890,15 @@ (if (i32.eqz (i32.eq - (call $~lib/array/Array#__get - (get_global $std/array-literal/staticArray) - (i32.const 1) + (i32.shr_s + (i32.shl + (call $~lib/array/Array#__get + (get_global $std/array-literal/staticArrayI8) + (i32.const 1) + ) + (i32.const 24) + ) + (i32.const 24) ) (i32.const 1) ) @@ -744,18 +906,103 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 32) (i32.const 6) (i32.const 0) ) (unreachable) ) ) + (if + (i32.eqz + (i32.eq + (i32.shr_s + (i32.shl + (call $~lib/array/Array#__get + (get_global $std/array-literal/staticArrayI8) + (i32.const 2) + ) + (i32.const 24) + ) + (i32.const 24) + ) + (i32.const 2) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 7) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (call $~lib/array/Array#get:length + (get_global $std/array-literal/staticArrayI32) + ) + (i32.const 3) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 10) + (i32.const 0) + ) + (unreachable) + ) + ) (if (i32.eqz (i32.eq (call $~lib/array/Array#__get - (get_global $std/array-literal/staticArray) + (get_global $std/array-literal/staticArrayI32) + (i32.const 0) + ) + (i32.const 0) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 11) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (call $~lib/array/Array#__get + (get_global $std/array-literal/staticArrayI32) + (i32.const 1) + ) + (i32.const 1) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 12) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (call $~lib/array/Array#__get + (get_global $std/array-literal/staticArrayI32) (i32.const 2) ) (i32.const 2) @@ -764,24 +1011,18 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) - (i32.const 7) + (i32.const 32) + (i32.const 13) (i32.const 0) ) (unreachable) ) ) - (set_global $std/array-literal/emptyArray - (call $~lib/array/Array#constructor - (i32.const 0) - (i32.const 0) - ) - ) (if (i32.eqz (i32.eq (call $~lib/array/Array#get:length - (get_global $std/array-literal/emptyArray) + (get_global $std/array-literal/emptyArrayI32) ) (i32.const 0) ) @@ -789,14 +1030,156 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) - (i32.const 10) + (i32.const 32) + (i32.const 16) (i32.const 0) ) (unreachable) ) ) - (set_global $std/array-literal/dynamicArray + (set_global $std/array-literal/dynamicArrayI8 + (block (result i32) + (set_local $0 + (call $~lib/array/Array#constructor + (i32.const 0) + (i32.const 3) + ) + ) + (call $~lib/array/Array#__unchecked_set + (get_local $0) + (i32.const 0) + (get_global $std/array-literal/i) + ) + (call $~lib/array/Array#__unchecked_set + (get_local $0) + (i32.const 1) + (block (result i32) + (set_global $std/array-literal/i + (i32.add + (get_global $std/array-literal/i) + (i32.const 1) + ) + ) + (get_global $std/array-literal/i) + ) + ) + (call $~lib/array/Array#__unchecked_set + (get_local $0) + (i32.const 2) + (block (result i32) + (set_global $std/array-literal/i + (i32.add + (get_global $std/array-literal/i) + (i32.const 1) + ) + ) + (get_global $std/array-literal/i) + ) + ) + (get_local $0) + ) + ) + (if + (i32.eqz + (i32.eq + (call $~lib/array/Array#get:length + (get_global $std/array-literal/dynamicArrayI8) + ) + (i32.const 3) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 21) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (i32.shr_s + (i32.shl + (call $~lib/array/Array#__get + (get_global $std/array-literal/dynamicArrayI8) + (i32.const 0) + ) + (i32.const 24) + ) + (i32.const 24) + ) + (i32.const 0) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 22) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (i32.shr_s + (i32.shl + (call $~lib/array/Array#__get + (get_global $std/array-literal/dynamicArrayI8) + (i32.const 1) + ) + (i32.const 24) + ) + (i32.const 24) + ) + (i32.const 1) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 23) + (i32.const 0) + ) + (unreachable) + ) + ) + (if + (i32.eqz + (i32.eq + (i32.shr_s + (i32.shl + (call $~lib/array/Array#__get + (get_global $std/array-literal/dynamicArrayI8) + (i32.const 2) + ) + (i32.const 24) + ) + (i32.const 24) + ) + (i32.const 2) + ) + ) + (block + (call $~lib/env/abort + (i32.const 0) + (i32.const 32) + (i32.const 24) + (i32.const 0) + ) + (unreachable) + ) + ) + (set_global $std/array-literal/i + (i32.const 0) + ) + (set_global $std/array-literal/dynamicArrayI32 (block (result i32) (set_local $0 (call $~lib/array/Array#constructor @@ -842,7 +1225,7 @@ (i32.eqz (i32.eq (call $~lib/array/Array#get:length - (get_global $std/array-literal/dynamicArray) + (get_global $std/array-literal/dynamicArrayI32) ) (i32.const 3) ) @@ -850,8 +1233,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) - (i32.const 14) + (i32.const 32) + (i32.const 29) (i32.const 0) ) (unreachable) @@ -861,7 +1244,7 @@ (i32.eqz (i32.eq (call $~lib/array/Array#__get - (get_global $std/array-literal/dynamicArray) + (get_global $std/array-literal/dynamicArrayI32) (i32.const 0) ) (i32.const 0) @@ -870,8 +1253,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) - (i32.const 15) + (i32.const 32) + (i32.const 30) (i32.const 0) ) (unreachable) @@ -881,7 +1264,7 @@ (i32.eqz (i32.eq (call $~lib/array/Array#__get - (get_global $std/array-literal/dynamicArray) + (get_global $std/array-literal/dynamicArrayI32) (i32.const 1) ) (i32.const 1) @@ -890,8 +1273,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) - (i32.const 16) + (i32.const 32) + (i32.const 31) (i32.const 0) ) (unreachable) @@ -901,7 +1284,7 @@ (i32.eqz (i32.eq (call $~lib/array/Array#__get - (get_global $std/array-literal/dynamicArray) + (get_global $std/array-literal/dynamicArrayI32) (i32.const 2) ) (i32.const 2) @@ -910,8 +1293,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) - (i32.const 17) + (i32.const 32) + (i32.const 32) (i32.const 0) ) (unreachable) diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index 0637502a..b42174da 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -12,7 +12,9 @@ (type $Iv (func (param i64))) (type $II (func (param i64) (result i64))) (type $iv (func (param i32))) + (type $i (func (result i32))) (type $iiiiii (func (param i32 i32 i32 i32 i32) (result i32))) + (type $iiiiiv (func (param i32 i32 i32 i32 i32))) (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (import "JSMath" "random" (func $~lib/math/JSMath.random (result f64))) @@ -30,11 +32,11 @@ (global $~lib/math/random_seeded (mut i32) (i32.const 0)) (global $~lib/math/random_state0 (mut i64) (i64.const 0)) (global $~lib/math/random_state1 (mut i64) (i64.const 0)) - (global $std/array/reversed0 (mut i32) (i32.const 0)) - (global $std/array/reversed1 (mut i32) (i32.const 336)) - (global $std/array/reversed2 (mut i32) (i32.const 360)) - (global $std/array/reversed4 (mut i32) (i32.const 384)) - (global $std/array/expected4 (mut i32) (i32.const 424)) + (global $std/array/reversed0 (mut i32) (i32.const 336)) + (global $std/array/reversed1 (mut i32) (i32.const 352)) + (global $std/array/reversed2 (mut i32) (i32.const 376)) + (global $std/array/reversed4 (mut i32) (i32.const 400)) + (global $std/array/expected4 (mut i32) (i32.const 440)) (global $std/array/reversed64 (mut i32) (i32.const 0)) (global $std/array/reversed128 (mut i32) (i32.const 0)) (global $std/array/reversed1024 (mut i32) (i32.const 0)) @@ -44,38 +46,38 @@ (global $std/array/randomized257 (mut i32) (i32.const 0)) (global $std/array/reversedNested512 (mut i32) (i32.const 0)) (global $std/array/reversedElements512 (mut i32) (i32.const 0)) - (global $std/array/randomStringsActual (mut i32) (i32.const 552)) - (global $std/array/randomStringsExpected (mut i32) (i32.const 624)) + (global $std/array/randomStringsActual (mut i32) (i32.const 568)) + (global $std/array/randomStringsExpected (mut i32) (i32.const 640)) (global $std/array/randomStrings400 (mut i32) (i32.const 0)) (table 51 51 anyfunc) - (elem (i32.const 0) $start~anonymous|0 $start~anonymous|1 $start~anonymous|2 $start~anonymous|3 $start~anonymous|2 $start~anonymous|5 $start~anonymous|6 $start~anonymous|7 $start~anonymous|8 $start~anonymous|9 $start~anonymous|10 $start~anonymous|11 $start~anonymous|12 $start~anonymous|13 $start~anonymous|14 $start~anonymous|15 $start~anonymous|16 $start~anonymous|17 $start~anonymous|16 $start~anonymous|19 $start~anonymous|20 $start~anonymous|21 $start~anonymous|22 $start~anonymous|23 $start~anonymous|24 $start~anonymous|25 $start~anonymous|26 $start~anonymous|27 $start~anonymous|28 $start~anonymous|28 $start~anonymous|30 $start~anonymous|31 $start~anonymous|32 $start~anonymous|28 $start~anonymous|34 $start~anonymous|28 $start~anonymous|28 $start~anonymous|30 $start~anonymous|31 $start~anonymous|32 $start~anonymous|28 $start~anonymous|34 $std/array/assertSortedDefault~anonymous|42 $start~anonymous|43 $start~anonymous|44 $start~anonymous|43 $start~anonymous|44 $start~anonymous|47 $start~anonymous|48 $start~anonymous|49 $start~anonymous|49) + (elem (i32.const 0) $start~anonymous|0 $start~anonymous|1 $start~anonymous|2 $start~anonymous|3 $start~anonymous|2 $start~anonymous|5 $start~anonymous|6 $start~anonymous|7 $start~anonymous|8 $start~anonymous|9 $start~anonymous|10 $start~anonymous|11 $start~anonymous|12 $start~anonymous|13 $start~anonymous|14 $start~anonymous|15 $start~anonymous|16 $start~anonymous|17 $start~anonymous|16 $start~anonymous|19 $start~anonymous|20 $start~anonymous|21 $start~anonymous|22 $start~anonymous|23 $start~anonymous|24 $start~anonymous|25 $start~anonymous|26 $start~anonymous|27 $start~anonymous|28 $start~anonymous|28 $start~anonymous|30 $start~anonymous|31 $start~anonymous|32 $start~anonymous|28 $start~anonymous|34 $start~anonymous|28 $start~anonymous|28 $start~anonymous|30 $start~anonymous|31 $start~anonymous|32 $start~anonymous|28 $start~anonymous|34 $~lib/internal/array/defaultComparator~compare|42 $start~anonymous|43 $start~anonymous|44 $start~anonymous|43 $start~anonymous|44 $start~anonymous|47 $start~anonymous|48 $start~anonymous|49 $start~anonymous|49) (memory $0 1) (data (i32.const 8) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s") (data (i32.const 40) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (data (i32.const 100) "\0c\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00.\00t\00s") (data (i32.const 128) "\0c\00\00\00~\00l\00i\00b\00/\00m\00a\00t\00h\00.\00t\00s") (data (i32.const 156) "V\00\00\00A\00B\00C\00D\00E\00F\00G\00H\00I\00J\00K\00L\00M\00N\00O\00P\00Q\00R\00S\00T\00U\00V\00W\00X\00Y\00Z\00a\00b\00c\00d\00e\00f\00g\00h\00i\00j\00k\00l\00m\00n\00o\00p\00q\00r\00s\00t\00u\00v\00w\00x\00y\00z\000\001\002\003\004\005\006\007\008\009\00_\00-\00,\00.\00+\00/\00\\\00[\00]\00{\00}\00(\00)\00<\00>\00*\00&\00$\00%\00^\00@\00#\00!\00?") - (data (i32.const 336) "X\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01") - (data (i32.const 360) "p\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00\02\00\00\00\01") - (data (i32.const 384) "\88\01\00\00\04\00\00\00\10\00\00\00\00\00\00\00\03\00\00\00\02\00\00\00\01") - (data (i32.const 424) "\b0\01\00\00\04\00\00\00\10") - (data (i32.const 444) "\01\00\00\00\02\00\00\00\03") - (data (i32.const 464) "\d8\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01") - (data (i32.const 488) "\f0\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00\01\00\00\00\02") - (data (i32.const 512) "\01\00\00\00a") - (data (i32.const 520) "\01\00\00\00b") - (data (i32.const 528) "\02\00\00\00a\00b") - (data (i32.const 536) "\02\00\00\00b\00a") - (data (i32.const 552) "0\02\00\00\07\00\00\00\1c") - (data (i32.const 569) "\02\00\00\08\02\00\00\00\02\00\00\10\02\00\00\18\02\00\00 \02") - (data (i32.const 624) "x\02\00\00\07\00\00\00\1c\00\00\00\00\00\00\00 \02\00\00\00\02\00\00\00\02\00\00\10\02\00\00\08\02\00\00\18\02") - (data (i32.const 696) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") - (data (i32.const 728) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") - (data (i32.const 780) "\04\00\00\00n\00u\00l\00l") + (data (i32.const 336) "X\01") + (data (i32.const 352) "h\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01") + (data (i32.const 376) "\80\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00\02\00\00\00\01") + (data (i32.const 400) "\98\01\00\00\04\00\00\00\10\00\00\00\00\00\00\00\03\00\00\00\02\00\00\00\01") + (data (i32.const 440) "\c0\01\00\00\04\00\00\00\10") + (data (i32.const 460) "\01\00\00\00\02\00\00\00\03") + (data (i32.const 480) "\e8\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01") + (data (i32.const 505) "\02\00\00\02\00\00\00\08\00\00\00\00\00\00\00\01\00\00\00\02") + (data (i32.const 528) "\01\00\00\00a") + (data (i32.const 536) "\01\00\00\00b") + (data (i32.const 544) "\02\00\00\00a\00b") + (data (i32.const 552) "\02\00\00\00b\00a") + (data (i32.const 568) "@\02\00\00\07\00\00\00\1c\00\00\00\00\00\00\00\10\02\00\00\18\02\00\00\10\02\00\00 \02\00\00(\02\00\000\02") + (data (i32.const 640) "\88\02\00\00\07\00\00\00\1c\00\00\00\00\00\00\000\02\00\00\10\02\00\00\10\02\00\00 \02\00\00\18\02\00\00(\02") + (data (i32.const 712) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") + (data (i32.const 744) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") + (data (i32.const 796) "\04\00\00\00n\00u\00l\00l") (export "memory" (memory $0)) (export "table" (table $0)) (start $start) - (func $~lib/internal/arraybuffer/computeSize (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/computeSize (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -89,7 +91,7 @@ ) ) ) - (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -175,12 +177,7 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 4 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -191,7 +188,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 40) - (i32.const 22) + (i32.const 23) (i32.const 2) ) (unreachable) @@ -199,7 +196,7 @@ ) (i32.store (tee_local $1 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -209,7 +206,12 @@ ) (get_local $1) ) - (func $~lib/memory/memset (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memory.allocate (; 5 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + (func $~lib/internal/memory/memset (; 6 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -539,14 +541,7 @@ ) ) ) - (func $~lib/memory/memory.fill (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/array/Array#constructor (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#constructor (; 7 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -565,7 +560,7 @@ ) ) (set_local $2 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (tee_local $3 (i32.shl (get_local $1) @@ -601,7 +596,7 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (i32.add (get_local $2) (i32.const 8) @@ -611,12 +606,12 @@ ) (get_local $0) ) - (func $~lib/array/Array#get:length (; 9 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 8 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $std/array/internalCapacity (; 10 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/internalCapacity (; 9 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.shr_s (i32.load (i32.load @@ -626,7 +621,7 @@ (i32.const 2) ) ) - (func $~lib/memory/memcpy (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memcpy (; 10 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2012,7 +2007,7 @@ ) ) ) - (func $~lib/memory/memmove (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memmove (; 11 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -2047,7 +2042,7 @@ (if (get_local $3) (block - (call $~lib/memory/memcpy + (call $~lib/internal/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2304,14 +2299,7 @@ ) ) ) - (func $~lib/memory/memory.copy (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memmove - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/internal/arraybuffer/reallocUnsafe (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/arraybuffer/reallocateUnsafe (; 12 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -2333,7 +2321,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 40) - (i32.const 32) + (i32.const 37) (i32.const 4) ) (unreachable) @@ -2354,7 +2342,7 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (i32.add (i32.add (get_local $0) @@ -2370,10 +2358,10 @@ ) ) (block - (call $~lib/memory/memory.copy + (call $~lib/internal/memory/memmove (i32.add (tee_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $1) ) ) @@ -2385,7 +2373,7 @@ ) (get_local $2) ) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (i32.add (i32.add (get_local $3) @@ -2420,7 +2408,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 40) - (i32.const 56) + (i32.const 61) (i32.const 4) ) (unreachable) @@ -2435,7 +2423,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#push (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#push (; 13 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2473,7 +2461,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 143) + (i32.const 145) (i32.const 42) ) (unreachable) @@ -2482,7 +2470,7 @@ (i32.store (get_local $0) (tee_local $4 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $4) (i32.shl (get_local $3) @@ -2509,7 +2497,7 @@ ) (get_local $3) ) - (func $~lib/array/Array#__get (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__get (; 14 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (i32.lt_u @@ -2538,7 +2526,7 @@ ) ) ) - (func $~lib/array/Array#pop (; 17 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#pop (; 15 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -2554,7 +2542,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 154) + (i32.const 157) (i32.const 20) ) (unreachable) @@ -2584,7 +2572,7 @@ ) (get_local $2) ) - (func $~lib/array/Array#unshift (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#unshift (; 16 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2625,7 +2613,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 244) + (i32.const 247) (i32.const 42) ) (unreachable) @@ -2635,7 +2623,7 @@ (i32.shr_u (i32.load (tee_local $2 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $2) (i32.shl (get_local $3) @@ -2653,7 +2641,7 @@ ) ) ) - (call $~lib/memory/memory.copy + (call $~lib/internal/memory/memmove (i32.add (get_local $2) (i32.const 12) @@ -2680,11 +2668,10 @@ ) (get_local $3) ) - (func $~lib/array/Array#shift (; 19 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#shift (; 17 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) - (local $4 i32) (if (i32.lt_s (tee_local $1 @@ -2698,7 +2685,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 215) + (i32.const 218) (i32.const 20) ) (unreachable) @@ -2713,7 +2700,7 @@ ) ) ) - (call $~lib/memory/memory.copy + (call $~lib/internal/memory/memmove (i32.add (get_local $2) (i32.const 8) @@ -2722,22 +2709,23 @@ (get_local $2) (i32.const 12) ) - (tee_local $4 - (i32.shl - (tee_local $1 - (i32.sub - (get_local $1) - (i32.const 1) - ) + (i32.shl + (tee_local $1 + (i32.sub + (get_local $1) + (i32.const 1) ) - (i32.const 2) ) + (i32.const 2) ) ) (i32.store offset=8 (i32.add (get_local $2) - (get_local $4) + (i32.shl + (get_local $1) + (i32.const 2) + ) ) (i32.const 0) ) @@ -2747,7 +2735,7 @@ ) (get_local $3) ) - (func $~lib/array/Array#reverse (; 20 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#reverse (; 18 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -2829,7 +2817,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#indexOf (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#indexOf (; 19 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (if @@ -2919,7 +2907,7 @@ ) (i32.const -1) ) - (func $~lib/array/Array#includes (; 22 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#includes (; 20 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (if @@ -3009,7 +2997,7 @@ ) (i32.const 0) ) - (func $~lib/array/Array#splice (; 23 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#splice (; 21 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -3031,7 +3019,7 @@ ) (set_local $1 (select - (tee_local $4 + (tee_local $1 (i32.add (get_local $3) (get_local $1) @@ -3039,7 +3027,7 @@ ) (i32.const 0) (i32.gt_s - (get_local $4) + (get_local $1) (i32.const 0) ) ) @@ -3052,13 +3040,10 @@ ) (return) ) - (set_local $4 - (get_local $2) - ) - (call $~lib/memory/memory.copy + (call $~lib/internal/memory/memmove (i32.add (i32.add - (tee_local $2 + (tee_local $4 (i32.load (get_local $0) ) @@ -3072,7 +3057,7 @@ ) (i32.add (i32.add - (get_local $2) + (get_local $4) (i32.const 8) ) (i32.shl @@ -3080,7 +3065,7 @@ (get_local $1) (tee_local $2 (select - (get_local $4) + (get_local $2) (tee_local $1 (i32.sub (get_local $3) @@ -3088,7 +3073,7 @@ ) ) (i32.lt_s - (get_local $4) + (get_local $2) (get_local $1) ) ) @@ -3110,7 +3095,7 @@ ) ) ) - (func $~lib/array/Array#__set (; 24 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__set (; 22 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -3146,7 +3131,7 @@ (i32.store (get_local $0) (tee_local $3 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $3) (i32.shl (tee_local $4 @@ -3177,12 +3162,12 @@ (get_local $2) ) ) - (func $start~anonymous|0 (; 25 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|0 (; 23 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.eqz (get_local $0) ) ) - (func $~lib/array/Array#findIndex (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#findIndex (; 24 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3258,19 +3243,19 @@ ) (i32.const -1) ) - (func $start~anonymous|1 (; 27 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|1 (; 25 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.eq (get_local $0) (i32.const 1) ) ) - (func $start~anonymous|2 (; 28 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|2 (; 26 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.eq (get_local $0) (i32.const 100) ) ) - (func $start~anonymous|3 (; 29 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|3 (; 27 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3282,7 +3267,7 @@ (i32.const 100) ) ) - (func $start~anonymous|5 (; 30 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|5 (; 28 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3293,13 +3278,13 @@ (i32.const 100) ) ) - (func $start~anonymous|6 (; 31 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|6 (; 29 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ge_s (get_local $0) (i32.const 0) ) ) - (func $~lib/array/Array#every (; 32 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#every (; 30 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3375,13 +3360,13 @@ ) (i32.const 1) ) - (func $start~anonymous|7 (; 33 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|7 (; 31 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.le_s (get_local $0) (i32.const 0) ) ) - (func $start~anonymous|8 (; 34 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|8 (; 32 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3393,13 +3378,13 @@ (i32.const 10) ) ) - (func $start~anonymous|9 (; 35 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|9 (; 33 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.lt_s (get_local $0) (i32.const 10) ) ) - (func $start~anonymous|10 (; 36 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|10 (; 34 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3410,13 +3395,13 @@ (i32.const 3) ) ) - (func $start~anonymous|11 (; 37 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|11 (; 35 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ge_s (get_local $0) (i32.const 3) ) ) - (func $~lib/array/Array#some (; 38 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#some (; 36 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3492,13 +3477,13 @@ ) (i32.const 0) ) - (func $start~anonymous|12 (; 39 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|12 (; 37 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.le_s (get_local $0) (i32.const -1) ) ) - (func $start~anonymous|13 (; 40 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|13 (; 38 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3510,13 +3495,13 @@ (i32.const 10) ) ) - (func $start~anonymous|14 (; 41 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|14 (; 39 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.gt_s (get_local $0) (i32.const 10) ) ) - (func $start~anonymous|15 (; 42 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|15 (; 40 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3527,7 +3512,7 @@ (i32.const 3) ) ) - (func $start~anonymous|16 (; 43 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|16 (; 41 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (set_global $std/array/i (i32.add (get_global $std/array/i) @@ -3535,7 +3520,7 @@ ) ) ) - (func $~lib/array/Array#forEach (; 44 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/array/Array#forEach (; 42 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3600,7 +3585,7 @@ ) ) ) - (func $start~anonymous|17 (; 45 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|17 (; 43 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3614,7 +3599,7 @@ ) ) ) - (func $start~anonymous|19 (; 46 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|19 (; 44 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3627,12 +3612,12 @@ ) ) ) - (func $start~anonymous|20 (; 47 ;) (type $iiif) (param $0 i32) (param $1 i32) (param $2 i32) (result f32) + (func $start~anonymous|20 (; 45 ;) (; has Stack IR ;) (type $iiif) (param $0 i32) (param $1 i32) (param $2 i32) (result f32) (f32.convert_s/i32 (get_local $0) ) ) - (func $~lib/array/Array#map (; 48 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#map (; 46 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3718,7 +3703,7 @@ ) (get_local $6) ) - (func $~lib/array/Array#__get (; 49 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) + (func $~lib/array/Array#__get (; 47 ;) (; has Stack IR ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) (if (result f32) (i32.lt_u (get_local $1) @@ -3745,7 +3730,7 @@ (unreachable) ) ) - (func $start~anonymous|21 (; 50 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|21 (; 48 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3760,7 +3745,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#map (; 51 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#map (; 49 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3846,7 +3831,7 @@ ) (get_local $6) ) - (func $start~anonymous|22 (; 52 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|22 (; 50 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_global $std/array/i (i32.add (get_global $std/array/i) @@ -3855,7 +3840,7 @@ ) (get_local $0) ) - (func $start~anonymous|23 (; 53 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|23 (; 51 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3869,13 +3854,13 @@ ) (get_local $0) ) - (func $start~anonymous|24 (; 54 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|24 (; 52 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ge_s (get_local $0) (i32.const 2) ) ) - (func $~lib/array/Array#filter (; 55 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#filter (; 53 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3962,7 +3947,7 @@ ) (get_local $4) ) - (func $start~anonymous|25 (; 56 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|25 (; 54 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3980,7 +3965,7 @@ (i32.const 2) ) ) - (func $start~anonymous|26 (; 57 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|26 (; 55 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_global $std/array/i (i32.add (get_global $std/array/i) @@ -3992,7 +3977,7 @@ (i32.const 2) ) ) - (func $start~anonymous|27 (; 58 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|27 (; 56 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -4009,13 +3994,13 @@ (i32.const 2) ) ) - (func $start~anonymous|28 (; 59 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|28 (; 57 ;) (; has Stack IR ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $~lib/array/Array#reduce (; 60 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#reduce (; 58 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4084,7 +4069,7 @@ ) (get_local $2) ) - (func $start~anonymous|30 (; 61 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|30 (; 59 ;) (; has Stack IR ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (if (result i32) (i32.and (get_local $0) @@ -4097,7 +4082,7 @@ ) ) ) - (func $start~anonymous|31 (; 62 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|31 (; 60 ;) (; has Stack IR ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (if (result i32) (i32.and (get_local $0) @@ -4110,7 +4095,7 @@ ) ) ) - (func $start~anonymous|32 (; 63 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|32 (; 61 ;) (; has Stack IR ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $3) @@ -4122,7 +4107,7 @@ (get_local $1) ) ) - (func $start~anonymous|34 (; 64 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|34 (; 62 ;) (; has Stack IR ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $3) @@ -4133,7 +4118,7 @@ (get_local $1) ) ) - (func $~lib/array/Array#reduceRight (; 65 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#reduceRight (; 63 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $4 @@ -4188,7 +4173,7 @@ ) (get_local $2) ) - (func $~lib/math/murmurHash3 (; 66 ;) (type $II) (param $0 i64) (result i64) + (func $~lib/math/murmurHash3 (; 64 ;) (; has Stack IR ;) (type $II) (param $0 i64) (result i64) (i64.xor (tee_local $0 (i64.mul @@ -4219,7 +4204,7 @@ ) ) ) - (func $~lib/math/NativeMath.seedRandom (; 67 ;) (type $Iv) (param $0 i64) + (func $~lib/math/NativeMath.seedRandom (; 65 ;) (; has Stack IR ;) (type $Iv) (param $0 i64) (if (i64.eqz (get_local $0) @@ -4248,7 +4233,7 @@ ) ) ) - (func $std/array/createReverseOrderedArray (; 68 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedArray (; 66 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (call $~lib/array/Array#constructor @@ -4293,7 +4278,7 @@ ) (get_local $1) ) - (func $~lib/math/NativeMath.random (; 69 ;) (type $F) (result f64) + (func $~lib/math/NativeMath.random (; 67 ;) (; has Stack IR ;) (type $F) (result f64) (local $0 i64) (local $1 i64) (if @@ -4362,7 +4347,7 @@ (f64.const 1) ) ) - (func $std/array/createRandomOrderedArray (; 70 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomOrderedArray (; 68 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $0 (call $~lib/array/Array#constructor @@ -4405,7 +4390,7 @@ ) (get_local $0) ) - (func $std/array/assertSortedDefault~anonymous|42 (; 71 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/defaultComparator~compare|42 (; 69 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.gt_s (get_local $0) @@ -4417,7 +4402,10 @@ ) ) ) - (func $~lib/internal/array/insertionSort (; 72 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/defaultComparator (; 70 ;) (; has Stack IR ;) (type $i) (result i32) + (i32.const 42) + ) + (func $~lib/internal/array/insertionSort (; 71 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4544,15 +4532,10 @@ ) (get_local $0) ) - (func $~lib/allocator/arena/__memory_free (; 73 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 72 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/memory/memory.free (; 74 ;) (type $iv) (param $0 i32) - (call $~lib/allocator/arena/__memory_free - (get_local $0) - ) - ) - (func $~lib/internal/array/weakHeapSort (; 75 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/weakHeapSort (; 73 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4561,9 +4544,9 @@ (local $7 i32) (local $8 i32) (local $9 i32) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (tee_local $7 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (tee_local $6 (i32.shl (i32.shr_s @@ -4930,7 +4913,7 @@ (br $repeat|2) ) ) - (call $~lib/memory/memory.free + (call $~lib/allocator/arena/__memory_free (get_local $7) ) (set_local $1 @@ -4956,7 +4939,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#sort (; 76 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort (; 74 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4968,7 +4951,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 306) + (i32.const 310) (i32.const 4) ) (unreachable) @@ -5059,7 +5042,7 @@ ) ) ) - (func $std/array/isSorted (; 77 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted (; 75 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -5116,7 +5099,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted (; 78 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted (; 76 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -5138,13 +5121,13 @@ ) ) ) - (func $std/array/assertSortedDefault (; 79 ;) (type $iv) (param $0 i32) + (func $std/array/assertSortedDefault (; 77 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (call $std/array/assertSorted (get_local $0) - (i32.const 42) + (call $~lib/internal/array/defaultComparator) ) ) - (func $std/array/isArraysEqual (; 80 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/array/isArraysEqual (; 78 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -5207,19 +5190,19 @@ ) (i32.const 1) ) - (func $start~anonymous|43 (; 81 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|43 (; 79 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $start~anonymous|44 (; 82 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|44 (; 80 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $1) (get_local $0) ) ) - (func $std/array/createReverseOrderedNestedArray (; 83 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedNestedArray (; 81 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (call $~lib/array/Array#constructor @@ -5275,7 +5258,7 @@ ) (get_local $1) ) - (func $start~anonymous|47 (; 84 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|47 (; 82 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/array/Array#__get (get_local $0) @@ -5287,7 +5270,7 @@ ) ) ) - (func $~lib/array/Array>#sort (; 85 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#sort (; 83 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5299,7 +5282,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 306) + (i32.const 310) (i32.const 4) ) (unreachable) @@ -5378,7 +5361,7 @@ (get_local $1) ) ) - (func $std/array/assertSorted> (; 86 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted> (; 84 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -5400,7 +5383,7 @@ ) ) ) - (func $std/array/Proxy#constructor (; 87 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/Proxy#constructor (; 85 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) @@ -5416,7 +5399,7 @@ ) (get_local $0) ) - (func $std/array/createReverseOrderedElementsArray (; 88 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedElementsArray (; 86 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (call $~lib/array/Array#constructor @@ -5464,7 +5447,7 @@ ) (get_local $1) ) - (func $start~anonymous|48 (; 89 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|48 (; 87 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.load (get_local $0) @@ -5474,7 +5457,7 @@ ) ) ) - (func $~lib/internal/string/compareUnsafe (; 90 ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) + (func $~lib/internal/string/compareUnsafe (; 88 ;) (; has Stack IR ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) (local $5 i32) (set_local $1 (i32.add @@ -5539,7 +5522,7 @@ ) (get_local $5) ) - (func $~lib/string/String.__gt (; 91 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__gt (; 89 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -5616,7 +5599,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__lt (; 92 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__lt (; 90 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -5693,7 +5676,7 @@ (i32.const 0) ) ) - (func $start~anonymous|49 (; 93 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|49 (; 91 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/string/String.__gt (get_local $0) @@ -5705,7 +5688,7 @@ ) ) ) - (func $~lib/string/String.__eq (; 94 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 92 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eq @@ -5761,7 +5744,7 @@ ) ) ) - (func $~lib/string/String.__ne (; 95 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__ne (; 93 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.eqz (call $~lib/string/String.__eq (get_local $0) @@ -5769,7 +5752,7 @@ ) ) ) - (func $std/array/isArraysEqual (; 96 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/array/isArraysEqual (; 94 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -5832,7 +5815,7 @@ ) (i32.const 1) ) - (func $~lib/internal/string/allocate (; 97 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/string/allocateUnsafe (; 95 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (tee_local $1 @@ -5855,8 +5838,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 728) - (i32.const 25) + (i32.const 744) + (i32.const 14) (i32.const 2) ) (unreachable) @@ -5864,7 +5847,7 @@ ) (i32.store (tee_local $1 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (i32.add (i32.shl (get_local $0) @@ -5878,7 +5861,7 @@ ) (get_local $1) ) - (func $~lib/string/String#charAt (; 98 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#charAt (; 96 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -5887,8 +5870,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 696) - (i32.const 58) + (i32.const 712) + (i32.const 56) (i32.const 4) ) (unreachable) @@ -5902,12 +5885,12 @@ ) ) (return - (i32.const 544) + (i32.const 560) ) ) (i32.store16 offset=4 (tee_local $2 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (i32.const 1) ) ) @@ -5923,7 +5906,35 @@ ) (get_local $2) ) - (func $~lib/string/String#concat (; 99 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/string/copyUnsafe (; 97 ;) (; has Stack IR ;) (type $iiiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) + (call $~lib/internal/memory/memmove + (i32.add + (i32.add + (get_local $0) + (i32.shl + (get_local $1) + (i32.const 1) + ) + ) + (i32.const 4) + ) + (i32.add + (i32.add + (get_local $2) + (i32.shl + (get_local $3) + (i32.const 1) + ) + ) + (i32.const 4) + ) + (i32.shl + (get_local $4) + (i32.const 1) + ) + ) + ) + (func $~lib/string/String#concat (; 98 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5934,8 +5945,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 696) - (i32.const 112) + (i32.const 712) + (i32.const 108) (i32.const 4) ) (unreachable) @@ -5946,7 +5957,7 @@ (get_local $1) ) (set_local $1 - (i32.const 780) + (i32.const 796) ) ) (if @@ -5967,56 +5978,36 @@ ) ) (return - (i32.const 544) + (i32.const 560) ) ) - (call $~lib/memory/memory.copy - (i32.add - (tee_local $2 - (call $~lib/internal/string/allocate - (get_local $2) - ) - ) - (i32.const 4) - ) - (i32.add - (get_local $0) - (i32.const 4) - ) - (i32.shl - (get_local $3) - (i32.const 1) - ) - ) - (call $~lib/memory/memory.copy - (i32.add - (i32.add + (call $~lib/internal/string/copyUnsafe + (tee_local $2 + (call $~lib/internal/string/allocateUnsafe (get_local $2) - (i32.shl - (get_local $3) - (i32.const 1) - ) ) - (i32.const 4) - ) - (i32.add - (get_local $1) - (i32.const 4) - ) - (i32.shl - (get_local $4) - (i32.const 1) ) + (i32.const 0) + (get_local $0) + (i32.const 0) + (get_local $3) + ) + (call $~lib/internal/string/copyUnsafe + (get_local $2) + (get_local $3) + (get_local $1) + (i32.const 0) + (get_local $4) ) (get_local $2) ) - (func $~lib/string/String.__concat (; 100 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__concat (; 99 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) ) (set_local $0 - (i32.const 780) + (i32.const 796) ) ) (call $~lib/string/String#concat @@ -6024,11 +6015,11 @@ (get_local $1) ) ) - (func $std/array/createRandomString (; 101 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomString (; 100 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 - (i32.const 544) + (i32.const 560) ) (block $break|0 (loop $repeat|0 @@ -6069,7 +6060,7 @@ ) (get_local $1) ) - (func $std/array/createRandomStringArray (; 102 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomStringArray (; 101 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (call $~lib/array/Array#constructor @@ -6113,9 +6104,9 @@ ) (get_local $1) ) - (func $start (; 103 ;) (type $v) + (func $start (; 102 ;) (; has Stack IR ;) (type $v) (set_global $~lib/allocator/arena/startOffset - (i32.const 792) + (i32.const 808) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) @@ -9073,12 +9064,6 @@ (call $~lib/math/JSMath.random) ) ) - (set_global $std/array/reversed0 - (call $~lib/array/Array#constructor - (i32.const 0) - (i32.const 0) - ) - ) (set_global $std/array/reversed64 (call $std/array/createReverseOrderedArray (i32.const 64) @@ -9114,7 +9099,7 @@ (i32.eqz (call $std/array/isArraysEqual (get_global $std/array/reversed1) - (i32.const 464) + (i32.const 480) (i32.const 0) ) ) @@ -9135,7 +9120,7 @@ (i32.eqz (call $std/array/isArraysEqual (get_global $std/array/reversed2) - (i32.const 488) + (i32.const 504) (i32.const 0) ) ) diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index 6cba54b1..109abd53 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -12,7 +12,9 @@ (type $Iv (func (param i64))) (type $II (func (param i64) (result i64))) (type $iv (func (param i32))) + (type $i (func (result i32))) (type $iiiiii (func (param i32 i32 i32 i32 i32) (result i32))) + (type $iiiiiv (func (param i32 i32 i32 i32 i32))) (type $v (func)) (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (import "JSMath" "random" (func $~lib/math/JSMath.random (result f64))) @@ -37,11 +39,11 @@ (global $~lib/math/random_state0 (mut i64) (i64.const 0)) (global $~lib/math/random_state1 (mut i64) (i64.const 0)) (global $std/array/charset i32 (i32.const 156)) - (global $std/array/reversed0 (mut i32) (i32.const 0)) - (global $std/array/reversed1 (mut i32) (i32.const 336)) - (global $std/array/reversed2 (mut i32) (i32.const 360)) - (global $std/array/reversed4 (mut i32) (i32.const 384)) - (global $std/array/expected4 (mut i32) (i32.const 424)) + (global $std/array/reversed0 (mut i32) (i32.const 336)) + (global $std/array/reversed1 (mut i32) (i32.const 352)) + (global $std/array/reversed2 (mut i32) (i32.const 376)) + (global $std/array/reversed4 (mut i32) (i32.const 400)) + (global $std/array/expected4 (mut i32) (i32.const 440)) (global $std/array/reversed64 (mut i32) (i32.const 0)) (global $std/array/reversed128 (mut i32) (i32.const 0)) (global $std/array/reversed1024 (mut i32) (i32.const 0)) @@ -51,37 +53,37 @@ (global $std/array/randomized257 (mut i32) (i32.const 0)) (global $std/array/reversedNested512 (mut i32) (i32.const 0)) (global $std/array/reversedElements512 (mut i32) (i32.const 0)) - (global $std/array/randomStringsActual (mut i32) (i32.const 552)) - (global $std/array/randomStringsExpected (mut i32) (i32.const 624)) + (global $std/array/randomStringsActual (mut i32) (i32.const 568)) + (global $std/array/randomStringsExpected (mut i32) (i32.const 640)) (global $~lib/internal/string/HEADER_SIZE i32 (i32.const 4)) - (global $~lib/internal/string/EMPTY i32 (i32.const 544)) (global $~lib/internal/string/MAX_LENGTH i32 (i32.const 536870910)) (global $std/array/randomStrings400 (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 792)) + (global $HEAP_BASE i32 (i32.const 808)) (table 51 51 anyfunc) - (elem (i32.const 0) $start~anonymous|0 $start~anonymous|1 $start~anonymous|2 $start~anonymous|3 $start~anonymous|4 $start~anonymous|5 $start~anonymous|6 $start~anonymous|7 $start~anonymous|8 $start~anonymous|9 $start~anonymous|10 $start~anonymous|11 $start~anonymous|12 $start~anonymous|13 $start~anonymous|14 $start~anonymous|15 $start~anonymous|16 $start~anonymous|17 $start~anonymous|18 $start~anonymous|19 $start~anonymous|20 $start~anonymous|21 $start~anonymous|22 $start~anonymous|23 $start~anonymous|24 $start~anonymous|25 $start~anonymous|26 $start~anonymous|27 $start~anonymous|28 $start~anonymous|29 $start~anonymous|30 $start~anonymous|31 $start~anonymous|32 $start~anonymous|33 $start~anonymous|34 $start~anonymous|35 $start~anonymous|36 $start~anonymous|37 $start~anonymous|38 $start~anonymous|39 $start~anonymous|40 $start~anonymous|41 $std/array/assertSortedDefault~anonymous|42 $start~anonymous|43 $start~anonymous|44 $start~anonymous|45 $start~anonymous|46 $start~anonymous|47 $start~anonymous|48 $start~anonymous|49 $start~anonymous|50) + (elem (i32.const 0) $start~anonymous|0 $start~anonymous|1 $start~anonymous|2 $start~anonymous|3 $start~anonymous|4 $start~anonymous|5 $start~anonymous|6 $start~anonymous|7 $start~anonymous|8 $start~anonymous|9 $start~anonymous|10 $start~anonymous|11 $start~anonymous|12 $start~anonymous|13 $start~anonymous|14 $start~anonymous|15 $start~anonymous|16 $start~anonymous|17 $start~anonymous|18 $start~anonymous|19 $start~anonymous|20 $start~anonymous|21 $start~anonymous|22 $start~anonymous|23 $start~anonymous|24 $start~anonymous|25 $start~anonymous|26 $start~anonymous|27 $start~anonymous|28 $start~anonymous|29 $start~anonymous|30 $start~anonymous|31 $start~anonymous|32 $start~anonymous|33 $start~anonymous|34 $start~anonymous|35 $start~anonymous|36 $start~anonymous|37 $start~anonymous|38 $start~anonymous|39 $start~anonymous|40 $start~anonymous|41 $~lib/internal/array/defaultComparator~compare|42 $start~anonymous|43 $start~anonymous|44 $start~anonymous|45 $start~anonymous|46 $start~anonymous|47 $start~anonymous|48 $start~anonymous|49 $start~anonymous|50) (memory $0 1) (data (i32.const 8) "\0d\00\00\00~\00l\00i\00b\00/\00a\00r\00r\00a\00y\00.\00t\00s\00") (data (i32.const 40) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s\00") (data (i32.const 100) "\0c\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00.\00t\00s\00") (data (i32.const 128) "\0c\00\00\00~\00l\00i\00b\00/\00m\00a\00t\00h\00.\00t\00s\00") (data (i32.const 156) "V\00\00\00A\00B\00C\00D\00E\00F\00G\00H\00I\00J\00K\00L\00M\00N\00O\00P\00Q\00R\00S\00T\00U\00V\00W\00X\00Y\00Z\00a\00b\00c\00d\00e\00f\00g\00h\00i\00j\00k\00l\00m\00n\00o\00p\00q\00r\00s\00t\00u\00v\00w\00x\00y\00z\000\001\002\003\004\005\006\007\008\009\00_\00-\00,\00.\00+\00/\00\\\00[\00]\00{\00}\00(\00)\00<\00>\00*\00&\00$\00%\00^\00@\00#\00!\00?\00") - (data (i32.const 336) "X\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01\00\00\00\00\00\00\00") - (data (i32.const 360) "p\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00") - (data (i32.const 384) "\88\01\00\00\04\00\00\00\10\00\00\00\00\00\00\00\03\00\00\00\02\00\00\00\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") - (data (i32.const 424) "\b0\01\00\00\04\00\00\00\10\00\00\00\00\00\00\00\00\00\00\00\01\00\00\00\02\00\00\00\03\00\00\00\00\00\00\00\00\00\00\00") - (data (i32.const 464) "\d8\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01\00\00\00\00\00\00\00") - (data (i32.const 488) "\f0\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00\01\00\00\00\02\00\00\00") - (data (i32.const 512) "\01\00\00\00a\00") - (data (i32.const 520) "\01\00\00\00b\00") - (data (i32.const 528) "\02\00\00\00a\00b\00") - (data (i32.const 536) "\02\00\00\00b\00a\00") - (data (i32.const 544) "\00\00\00\00") - (data (i32.const 552) "0\02\00\00\07\00\00\00\1c\00\00\00\00\00\00\00\00\02\00\00\08\02\00\00\00\02\00\00\10\02\00\00\18\02\00\00 \02\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") - (data (i32.const 624) "x\02\00\00\07\00\00\00\1c\00\00\00\00\00\00\00 \02\00\00\00\02\00\00\00\02\00\00\10\02\00\00\08\02\00\00\18\02\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") - (data (i32.const 696) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") - (data (i32.const 728) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") - (data (i32.const 780) "\04\00\00\00n\00u\00l\00l\00") + (data (i32.const 336) "X\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data (i32.const 352) "h\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01\00\00\00\00\00\00\00") + (data (i32.const 376) "\80\01\00\00\02\00\00\00\08\00\00\00\00\00\00\00\02\00\00\00\01\00\00\00") + (data (i32.const 400) "\98\01\00\00\04\00\00\00\10\00\00\00\00\00\00\00\03\00\00\00\02\00\00\00\01\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data (i32.const 440) "\c0\01\00\00\04\00\00\00\10\00\00\00\00\00\00\00\00\00\00\00\01\00\00\00\02\00\00\00\03\00\00\00\00\00\00\00\00\00\00\00") + (data (i32.const 480) "\e8\01\00\00\01\00\00\00\04\00\00\00\00\00\00\00\01\00\00\00\00\00\00\00") + (data (i32.const 504) "\00\02\00\00\02\00\00\00\08\00\00\00\00\00\00\00\01\00\00\00\02\00\00\00") + (data (i32.const 528) "\01\00\00\00a\00") + (data (i32.const 536) "\01\00\00\00b\00") + (data (i32.const 544) "\02\00\00\00a\00b\00") + (data (i32.const 552) "\02\00\00\00b\00a\00") + (data (i32.const 560) "\00\00\00\00") + (data (i32.const 568) "@\02\00\00\07\00\00\00\1c\00\00\00\00\00\00\00\10\02\00\00\18\02\00\00\10\02\00\00 \02\00\00(\02\00\000\02\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data (i32.const 640) "\88\02\00\00\07\00\00\00\1c\00\00\00\00\00\00\000\02\00\00\10\02\00\00\10\02\00\00 \02\00\00\18\02\00\00(\02\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00") + (data (i32.const 712) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") + (data (i32.const 744) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") + (data (i32.const 796) "\04\00\00\00n\00u\00l\00l\00") (export "memory" (memory $0)) (export "table" (table $0)) (start $start) @@ -210,15 +212,9 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) - (return - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) + (local $2 i32) (if (i32.eqz (i32.le_u @@ -230,16 +226,23 @@ (call $~lib/env/abort (i32.const 0) (i32.const 40) - (i32.const 22) + (i32.const 23) (i32.const 2) ) (unreachable) ) ) (set_local $1 - (call $~lib/memory/memory.allocate - (call $~lib/internal/arraybuffer/computeSize - (get_local $0) + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $2 + (call $~lib/internal/arraybuffer/computeSize + (get_local $0) + ) + ) + (br $~lib/memory/memory.allocate|inlined.0 + (call $~lib/allocator/arena/__memory_allocate + (get_local $2) + ) ) ) ) @@ -249,7 +252,14 @@ ) (get_local $1) ) - (func $~lib/memory/memset (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/memory/memory.allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) + ) + ) + (func $~lib/internal/memory/memset (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -601,17 +611,11 @@ ) ) ) - (func $~lib/memory/memory.fill (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/array/Array#constructor (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#constructor (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -634,7 +638,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) @@ -669,22 +673,30 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.0 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (get_local $0) ) - (func $~lib/array/Array#get:length (; 9 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 8 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $std/array/internalCapacity (; 10 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/internalCapacity (; 9 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (i32.load @@ -698,7 +710,7 @@ (i32.const 2) ) ) - (func $~lib/memory/memcpy (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memcpy (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2500,7 +2512,7 @@ ) ) ) - (func $~lib/memory/memmove (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memmove (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.eq @@ -2530,7 +2542,7 @@ ) ) (block - (call $~lib/memory/memcpy + (call $~lib/internal/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2818,16 +2830,12 @@ ) ) ) - (func $~lib/memory/memory.copy (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memmove - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/internal/arraybuffer/reallocUnsafe (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/arraybuffer/reallocateUnsafe (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) (set_local $2 (i32.load (get_local $0) @@ -2850,7 +2858,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 40) - (i32.const 32) + (i32.const 37) (i32.const 4) ) (unreachable) @@ -2871,54 +2879,84 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/memory.fill - (i32.add + (block $~lib/memory/memory.fill|inlined.1 + (set_local $3 (i32.add - (get_local $0) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (i32.add + (get_local $0) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + (get_local $2) ) - (get_local $2) ) - (i32.const 0) - (i32.sub - (get_local $1) - (get_local $2) + (set_local $4 + (i32.const 0) + ) + (set_local $5 + (i32.sub + (get_local $1) + (get_local $2) + ) + ) + (call $~lib/internal/memory/memset + (get_local $3) + (get_local $4) + (get_local $5) ) ) ) (block - (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (set_local $5 + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $1) ) ) - (call $~lib/memory/memory.copy - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) - ) - (i32.add - (get_local $0) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) - ) - (get_local $2) - ) - (call $~lib/memory/memory.fill - (i32.add + (block $~lib/memory/memory.copy|inlined.0 + (set_local $4 (i32.add - (get_local $3) + (get_local $5) (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) + ) + (set_local $3 + (i32.add + (get_local $0) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (call $~lib/internal/memory/memmove + (get_local $4) + (get_local $3) (get_local $2) ) - (i32.const 0) - (i32.sub - (get_local $1) - (get_local $2) + ) + (block $~lib/memory/memory.fill|inlined.2 + (set_local $3 + (i32.add + (i32.add + (get_local $5) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + (get_local $2) + ) + ) + (set_local $4 + (i32.const 0) + ) + (set_local $6 + (i32.sub + (get_local $1) + (get_local $2) + ) + ) + (call $~lib/internal/memory/memset + (get_local $3) + (get_local $4) + (get_local $6) ) ) (return - (get_local $3) + (get_local $5) ) ) ) @@ -2940,7 +2978,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 40) - (i32.const 56) + (i32.const 61) (i32.const 4) ) (unreachable) @@ -2955,7 +2993,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#push (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#push (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2999,14 +3037,14 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 143) + (i32.const 145) (i32.const 42) ) (unreachable) ) ) (set_local $3 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $3) (i32.shl (get_local $5) @@ -3038,7 +3076,7 @@ ) (get_local $5) ) - (func $~lib/array/Array#__get (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__get (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -3069,7 +3107,7 @@ (unreachable) ) ) - (func $~lib/array/Array#pop (; 17 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#pop (; 15 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -3088,7 +3126,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 154) + (i32.const 157) (i32.const 20) ) (unreachable) @@ -3126,12 +3164,14 @@ ) (get_local $4) ) - (func $~lib/array/Array#unshift (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#unshift (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) + (local $7 i32) + (local $8 i32) (set_local $2 (i32.load (get_local $0) @@ -3171,14 +3211,14 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 244) + (i32.const 247) (i32.const 42) ) (unreachable) ) ) (set_local $2 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $2) (i32.shl (get_local $5) @@ -3200,35 +3240,46 @@ ) ) ) - (call $~lib/memory/memory.copy - (i32.add + (block $~lib/memory/memory.copy|inlined.1 + (set_local $6 + (i32.add + (i32.add + (get_local $2) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + (i32.const 4) + ) + ) + (set_local $7 (i32.add (get_local $2) (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) - (i32.const 4) ) - (i32.add - (get_local $2) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) - ) - (i32.shl - (i32.sub - (get_local $3) - (i32.const 1) + (set_local $8 + (i32.shl + (i32.sub + (get_local $3) + (i32.const 1) + ) + (i32.const 2) ) - (i32.const 2) + ) + (call $~lib/internal/memory/memmove + (get_local $6) + (get_local $7) + (get_local $8) ) ) (block $~lib/internal/arraybuffer/storeUnsafe|inlined.1 - (set_local $6 + (set_local $8 (i32.const 0) ) (i32.store offset=8 (i32.add (get_local $2) (i32.shl - (get_local $6) + (get_local $8) (i32.const 2) ) ) @@ -3241,12 +3292,14 @@ ) (get_local $5) ) - (func $~lib/array/Array#shift (; 19 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#shift (; 17 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) + (local $6 i32) + (local $7 i32) (set_local $1 (i32.load offset=4 (get_local $0) @@ -3261,7 +3314,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 215) + (i32.const 218) (i32.const 20) ) (unreachable) @@ -3294,25 +3347,36 @@ (i32.const 1) ) ) - (call $~lib/memory/memory.copy - (i32.add - (get_local $2) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) - ) - (i32.add + (block $~lib/memory/memory.copy|inlined.2 + (set_local $3 (i32.add (get_local $2) (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) - (i32.const 4) ) - (i32.shl - (get_local $5) - (i32.const 2) + (set_local $6 + (i32.add + (i32.add + (get_local $2) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + (i32.const 4) + ) + ) + (set_local $7 + (i32.shl + (get_local $5) + (i32.const 2) + ) + ) + (call $~lib/internal/memory/memmove + (get_local $3) + (get_local $6) + (get_local $7) ) ) (block $~lib/internal/arraybuffer/storeUnsafe|inlined.2 - (set_local $3 + (set_local $7 (i32.const 0) ) (i32.store offset=8 @@ -3323,7 +3387,7 @@ (i32.const 2) ) ) - (get_local $3) + (get_local $7) ) ) (i32.store offset=4 @@ -3332,7 +3396,7 @@ ) (get_local $4) ) - (func $~lib/array/Array#reverse (; 20 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#reverse (; 18 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -3437,7 +3501,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#indexOf (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#indexOf (; 19 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3535,7 +3599,7 @@ ) (i32.const -1) ) - (func $~lib/array/Array#includes (; 22 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#includes (; 20 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3633,11 +3697,12 @@ ) (i32.const 0) ) - (func $~lib/array/Array#splice (; 23 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#splice (; 21 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) + (local $7 i32) (if (i32.lt_s (get_local $2) @@ -3702,33 +3767,44 @@ (get_local $0) ) ) - (call $~lib/memory/memory.copy - (i32.add + (block $~lib/memory/memory.copy|inlined.3 + (set_local $4 (i32.add - (get_local $6) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) - ) - (i32.shl - (get_local $1) - (i32.const 2) - ) - ) - (i32.add - (i32.add - (get_local $6) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) - ) - (i32.shl (i32.add - (get_local $1) - (get_local $2) + (get_local $6) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) + (i32.shl + (get_local $1) + (i32.const 2) + ) + ) + ) + (set_local $5 + (i32.add + (i32.add + (get_local $6) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + (i32.shl + (i32.add + (get_local $1) + (get_local $2) + ) + (i32.const 2) + ) + ) + ) + (set_local $7 + (i32.shl + (get_local $2) (i32.const 2) ) ) - (i32.shl - (get_local $2) - (i32.const 2) + (call $~lib/internal/memory/memmove + (get_local $4) + (get_local $5) + (get_local $7) ) ) (i32.store offset=4 @@ -3739,7 +3815,7 @@ ) ) ) - (func $~lib/array/Array#__set (; 24 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__set (; 22 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -3777,7 +3853,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $3) (i32.shl (i32.add @@ -3814,13 +3890,13 @@ ) ) ) - (func $start~anonymous|0 (; 25 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|0 (; 23 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.eq (get_local $0) (i32.const 0) ) ) - (func $~lib/array/Array#findIndex (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#findIndex (; 24 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3901,19 +3977,19 @@ ) (i32.const -1) ) - (func $start~anonymous|1 (; 27 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|1 (; 25 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.eq (get_local $0) (i32.const 1) ) ) - (func $start~anonymous|2 (; 28 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|2 (; 26 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.eq (get_local $0) (i32.const 100) ) ) - (func $start~anonymous|3 (; 29 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|3 (; 27 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -3925,13 +4001,13 @@ (i32.const 100) ) ) - (func $start~anonymous|4 (; 30 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|4 (; 28 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.eq (get_local $0) (i32.const 100) ) ) - (func $start~anonymous|5 (; 31 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|5 (; 29 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -3942,13 +4018,13 @@ (i32.const 100) ) ) - (func $start~anonymous|6 (; 32 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|6 (; 30 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ge_s (get_local $0) (i32.const 0) ) ) - (func $~lib/array/Array#every (; 33 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#every (; 31 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4031,13 +4107,13 @@ ) (i32.const 1) ) - (func $start~anonymous|7 (; 34 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|7 (; 32 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.le_s (get_local $0) (i32.const 0) ) ) - (func $start~anonymous|8 (; 35 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|8 (; 33 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -4049,13 +4125,13 @@ (i32.const 10) ) ) - (func $start~anonymous|9 (; 36 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|9 (; 34 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.lt_s (get_local $0) (i32.const 10) ) ) - (func $start~anonymous|10 (; 37 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|10 (; 35 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -4066,13 +4142,13 @@ (i32.const 3) ) ) - (func $start~anonymous|11 (; 38 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|11 (; 36 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ge_s (get_local $0) (i32.const 3) ) ) - (func $~lib/array/Array#some (; 39 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#some (; 37 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4153,13 +4229,13 @@ ) (i32.const 0) ) - (func $start~anonymous|12 (; 40 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|12 (; 38 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.le_s (get_local $0) (i32.const -1) ) ) - (func $start~anonymous|13 (; 41 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|13 (; 39 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -4171,13 +4247,13 @@ (i32.const 10) ) ) - (func $start~anonymous|14 (; 42 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|14 (; 40 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.gt_s (get_local $0) (i32.const 10) ) ) - (func $start~anonymous|15 (; 43 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|15 (; 41 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -4188,7 +4264,7 @@ (i32.const 3) ) ) - (func $start~anonymous|16 (; 44 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|16 (; 42 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (set_global $std/array/i (i32.add (get_global $std/array/i) @@ -4196,7 +4272,7 @@ ) ) ) - (func $~lib/array/Array#forEach (; 45 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/array/Array#forEach (; 43 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4268,7 +4344,7 @@ ) ) ) - (func $start~anonymous|17 (; 46 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|17 (; 44 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -4282,7 +4358,7 @@ ) ) ) - (func $start~anonymous|18 (; 47 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|18 (; 45 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (set_global $std/array/i (i32.add (get_global $std/array/i) @@ -4290,7 +4366,7 @@ ) ) ) - (func $start~anonymous|19 (; 48 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $start~anonymous|19 (; 46 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -4303,15 +4379,16 @@ ) ) ) - (func $start~anonymous|20 (; 49 ;) (type $iiif) (param $0 i32) (param $1 i32) (param $2 i32) (result f32) + (func $start~anonymous|20 (; 47 ;) (type $iiif) (param $0 i32) (param $1 i32) (param $2 i32) (result f32) (f32.convert_s/i32 (get_local $0) ) ) - (func $~lib/array/Array#constructor (; 50 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#constructor (; 48 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -4334,7 +4411,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) @@ -4369,17 +4446,25 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.3 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (get_local $0) ) - (func $~lib/array/Array#map (; 51 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#map (; 49 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4478,12 +4563,12 @@ ) (get_local $4) ) - (func $~lib/array/Array#get:length (; 52 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 50 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $~lib/array/Array#__get (; 53 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) + (func $~lib/array/Array#__get (; 51 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) (set_local $2 (i32.load @@ -4514,7 +4599,7 @@ (unreachable) ) ) - (func $start~anonymous|21 (; 54 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|21 (; 52 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -4529,7 +4614,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#map (; 55 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#map (; 53 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4627,7 +4712,7 @@ ) (get_local $4) ) - (func $start~anonymous|22 (; 56 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|22 (; 54 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_global $std/array/i (i32.add (get_global $std/array/i) @@ -4636,7 +4721,7 @@ ) (get_local $0) ) - (func $start~anonymous|23 (; 57 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|23 (; 55 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -4650,13 +4735,13 @@ ) (get_local $0) ) - (func $start~anonymous|24 (; 58 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|24 (; 56 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ge_s (get_local $0) (i32.const 2) ) ) - (func $~lib/array/Array#filter (; 59 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#filter (; 57 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4750,7 +4835,7 @@ ) (get_local $4) ) - (func $start~anonymous|25 (; 60 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|25 (; 58 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $2) @@ -4768,7 +4853,7 @@ (i32.const 2) ) ) - (func $start~anonymous|26 (; 61 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|26 (; 59 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_global $std/array/i (i32.add (get_global $std/array/i) @@ -4780,7 +4865,7 @@ (i32.const 2) ) ) - (func $start~anonymous|27 (; 62 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $start~anonymous|27 (; 60 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $2) @@ -4797,13 +4882,13 @@ (i32.const 2) ) ) - (func $start~anonymous|28 (; 63 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|28 (; 61 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $~lib/array/Array#reduce (; 64 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#reduce (; 62 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4883,13 +4968,13 @@ ) (get_local $3) ) - (func $start~anonymous|29 (; 65 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|29 (; 63 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $start~anonymous|30 (; 66 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|30 (; 64 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (if (result i32) (i32.and (get_local $0) @@ -4902,7 +4987,7 @@ ) ) ) - (func $~lib/array/Array#reduce (; 67 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#reduce (; 65 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4982,7 +5067,7 @@ ) (get_local $3) ) - (func $start~anonymous|31 (; 68 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|31 (; 66 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (if (result i32) (i32.and (get_local $0) @@ -4995,7 +5080,7 @@ ) ) ) - (func $start~anonymous|32 (; 69 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|32 (; 67 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $3) @@ -5007,13 +5092,13 @@ (get_local $1) ) ) - (func $start~anonymous|33 (; 70 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|33 (; 68 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $start~anonymous|34 (; 71 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|34 (; 69 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $3) @@ -5024,13 +5109,13 @@ (get_local $1) ) ) - (func $start~anonymous|35 (; 72 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|35 (; 70 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $~lib/array/Array#reduceRight (; 73 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#reduceRight (; 71 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -5095,13 +5180,13 @@ ) (get_local $3) ) - (func $start~anonymous|36 (; 74 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|36 (; 72 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $start~anonymous|37 (; 75 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|37 (; 73 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (if (result i32) (i32.and (get_local $0) @@ -5114,7 +5199,7 @@ ) ) ) - (func $~lib/array/Array#reduceRight (; 76 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/array/Array#reduceRight (; 74 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -5179,7 +5264,7 @@ ) (get_local $3) ) - (func $start~anonymous|38 (; 77 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|38 (; 75 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (if (result i32) (i32.and (get_local $0) @@ -5192,7 +5277,7 @@ ) ) ) - (func $start~anonymous|39 (; 78 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|39 (; 76 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (drop (call $~lib/array/Array#push (get_local $3) @@ -5204,13 +5289,13 @@ (get_local $1) ) ) - (func $start~anonymous|40 (; 79 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|40 (; 77 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (i32.add (get_local $0) (get_local $1) ) ) - (func $start~anonymous|41 (; 80 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) + (func $start~anonymous|41 (; 78 ;) (type $iiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (drop (call $~lib/array/Array#pop (get_local $3) @@ -5221,7 +5306,7 @@ (get_local $1) ) ) - (func $~lib/math/murmurHash3 (; 81 ;) (type $II) (param $0 i64) (result i64) + (func $~lib/math/murmurHash3 (; 79 ;) (type $II) (param $0 i64) (result i64) (set_local $0 (i64.xor (get_local $0) @@ -5263,7 +5348,7 @@ ) (get_local $0) ) - (func $~lib/math/NativeMath.seedRandom (; 82 ;) (type $Iv) (param $0 i64) + (func $~lib/math/NativeMath.seedRandom (; 80 ;) (type $Iv) (param $0 i64) (if (i64.eqz (get_local $0) @@ -5292,7 +5377,7 @@ ) ) ) - (func $std/array/createReverseOrderedArray (; 83 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedArray (; 81 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -5340,7 +5425,7 @@ ) (get_local $1) ) - (func $~lib/math/NativeMath.random (; 84 ;) (type $F) (result f64) + (func $~lib/math/NativeMath.random (; 82 ;) (type $F) (result f64) (local $0 i64) (local $1 i64) (local $2 i64) @@ -5422,7 +5507,7 @@ (f64.const 1) ) ) - (func $std/array/createRandomOrderedArray (; 85 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomOrderedArray (; 83 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -5471,7 +5556,7 @@ ) (get_local $1) ) - (func $std/array/assertSortedDefault~anonymous|42 (; 86 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/defaultComparator~compare|42 (; 84 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.gt_s (get_local $0) @@ -5483,7 +5568,10 @@ ) ) ) - (func $~lib/internal/array/insertionSort (; 87 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/defaultComparator (; 85 ;) (type $i) (result i32) + (i32.const 42) + ) + (func $~lib/internal/array/insertionSort (; 86 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5639,16 +5727,10 @@ ) (get_local $0) ) - (func $~lib/allocator/arena/__memory_free (; 88 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 87 ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/memory/memory.free (; 89 ;) (type $iv) (param $0 i32) - (call $~lib/allocator/arena/__memory_free - (get_local $0) - ) - (return) - ) - (func $~lib/internal/array/weakHeapSort (; 90 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/weakHeapSort (; 88 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5678,22 +5760,31 @@ ) ) (set_local $4 - (call $~lib/memory/memory.allocate + (block $~lib/memory/memory.allocate|inlined.1 (result i32) + (br $~lib/memory/memory.allocate|inlined.1 + (call $~lib/allocator/arena/__memory_allocate + (get_local $3) + ) + ) + ) + ) + (block $~lib/memory/memory.fill|inlined.4 + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) (get_local $3) ) ) - (call $~lib/memory/memory.fill - (get_local $4) - (i32.const 0) - (get_local $3) - ) - (set_local $5 + (set_local $6 (i32.load (get_local $0) ) ) (block $break|0 - (set_local $6 + (set_local $5 (i32.sub (get_local $2) (i32.const 1) @@ -5703,14 +5794,14 @@ (br_if $break|0 (i32.eqz (i32.gt_s - (get_local $6) + (get_local $5) (i32.const 0) ) ) ) (block (set_local $7 - (get_local $6) + (get_local $5) ) (block $break|1 (loop $continue|1 @@ -5767,7 +5858,7 @@ (block $~lib/internal/arraybuffer/loadUnsafe|inlined.27 (result i32) (i32.load offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl (get_local $8) (i32.const 2) @@ -5780,9 +5871,9 @@ (block $~lib/internal/arraybuffer/loadUnsafe|inlined.28 (result i32) (i32.load offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl - (get_local $6) + (get_local $5) (i32.const 2) ) ) @@ -5809,7 +5900,7 @@ (get_local $4) (i32.shl (i32.shr_s - (get_local $6) + (get_local $5) (i32.const 5) ) (i32.const 2) @@ -5821,7 +5912,7 @@ (get_local $4) (i32.shl (i32.shr_s - (get_local $6) + (get_local $5) (i32.const 5) ) (i32.const 2) @@ -5831,7 +5922,7 @@ (i32.shl (i32.const 1) (i32.and - (get_local $6) + (get_local $5) (i32.const 31) ) ) @@ -5840,9 +5931,9 @@ (block $~lib/internal/arraybuffer/storeUnsafe|inlined.11 (i32.store offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl - (get_local $6) + (get_local $5) (i32.const 2) ) ) @@ -5852,7 +5943,7 @@ (block $~lib/internal/arraybuffer/storeUnsafe|inlined.12 (i32.store offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl (get_local $8) (i32.const 2) @@ -5864,9 +5955,9 @@ ) ) ) - (set_local $6 + (set_local $5 (i32.sub - (get_local $6) + (get_local $5) (i32.const 1) ) ) @@ -5874,7 +5965,7 @@ ) ) (block $break|2 - (set_local $6 + (set_local $5 (i32.sub (get_local $2) (i32.const 1) @@ -5884,7 +5975,7 @@ (br_if $break|2 (i32.eqz (i32.ge_s - (get_local $6) + (get_local $5) (i32.const 2) ) ) @@ -5897,7 +5988,7 @@ ) (i32.load offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl (get_local $10) (i32.const 2) @@ -5914,9 +6005,9 @@ (block $~lib/internal/arraybuffer/loadUnsafe|inlined.30 (result i32) (i32.load offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl - (get_local $6) + (get_local $5) (i32.const 2) ) ) @@ -5925,7 +6016,7 @@ ) (i32.store offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl (get_local $9) (i32.const 2) @@ -5937,9 +6028,9 @@ (block $~lib/internal/arraybuffer/storeUnsafe|inlined.14 (i32.store offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl - (get_local $6) + (get_local $5) (i32.const 2) ) ) @@ -5982,7 +6073,7 @@ ) ) ) - (get_local $6) + (get_local $5) ) (block (set_local $8 @@ -6009,7 +6100,7 @@ ) (i32.load offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl (get_local $7) (i32.const 2) @@ -6022,7 +6113,7 @@ (block $~lib/internal/arraybuffer/loadUnsafe|inlined.32 (result i32) (i32.load offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl (get_local $8) (i32.const 2) @@ -6082,7 +6173,7 @@ (block $~lib/internal/arraybuffer/storeUnsafe|inlined.15 (i32.store offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl (get_local $8) (i32.const 2) @@ -6097,7 +6188,7 @@ ) (i32.store offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl (get_local $11) (i32.const 2) @@ -6121,28 +6212,33 @@ ) ) ) - (set_local $6 + (set_local $5 (i32.sub - (get_local $6) + (get_local $5) (i32.const 1) ) ) (br $repeat|2) ) ) - (call $~lib/memory/memory.free - (get_local $4) + (block $~lib/memory/memory.free|inlined.0 + (block + (call $~lib/allocator/arena/__memory_free + (get_local $4) + ) + (br $~lib/memory/memory.free|inlined.0) + ) ) (set_local $12 (block $~lib/internal/arraybuffer/loadUnsafe|inlined.33 (result i32) - (set_local $6 + (set_local $5 (i32.const 1) ) (i32.load offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl - (get_local $6) + (get_local $5) (i32.const 2) ) ) @@ -6150,7 +6246,7 @@ ) ) (block $~lib/internal/arraybuffer/storeUnsafe|inlined.17 - (set_local $6 + (set_local $5 (i32.const 1) ) (set_local $9 @@ -6160,7 +6256,7 @@ ) (i32.load offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl (get_local $9) (i32.const 2) @@ -6171,9 +6267,9 @@ ) (i32.store offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl - (get_local $6) + (get_local $5) (i32.const 2) ) ) @@ -6186,7 +6282,7 @@ ) (i32.store offset=8 (i32.add - (get_local $5) + (get_local $6) (i32.shl (get_local $9) (i32.const 2) @@ -6197,7 +6293,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#sort (; 91 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort (; 89 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6211,7 +6307,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 306) + (i32.const 310) (i32.const 4) ) (unreachable) @@ -6343,7 +6439,7 @@ ) ) ) - (func $std/array/isSorted (; 92 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted (; 90 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -6404,7 +6500,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted (; 93 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted (; 91 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -6426,15 +6522,13 @@ ) ) ) - (func $std/array/assertSortedDefault (; 94 ;) (type $iv) (param $0 i32) + (func $std/array/assertSortedDefault (; 92 ;) (type $iv) (param $0 i32) (call $std/array/assertSorted (get_local $0) - (block $~lib/internal/array/defaultComparator|inlined.0 (result i32) - (i32.const 42) - ) + (call $~lib/internal/array/defaultComparator) ) ) - (func $std/array/isArraysEqual (; 95 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/array/isArraysEqual (; 93 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -6500,34 +6594,35 @@ ) (i32.const 1) ) - (func $start~anonymous|43 (; 96 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|43 (; 94 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $start~anonymous|44 (; 97 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|44 (; 95 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $1) (get_local $0) ) ) - (func $start~anonymous|45 (; 98 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|45 (; 96 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $0) (get_local $1) ) ) - (func $start~anonymous|46 (; 99 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|46 (; 97 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (get_local $1) (get_local $0) ) ) - (func $~lib/array/Array>#constructor (; 100 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#constructor (; 98 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -6550,7 +6645,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) @@ -6585,22 +6680,30 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.5 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (get_local $0) ) - (func $~lib/array/Array>#get:length (; 101 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array>#get:length (; 99 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $~lib/array/Array>#__set (; 102 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array>#__set (; 100 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -6638,7 +6741,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $3) (i32.shl (i32.add @@ -6675,7 +6778,7 @@ ) ) ) - (func $~lib/array/Array>#__get (; 103 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#__get (; 101 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -6706,7 +6809,7 @@ (unreachable) ) ) - (func $std/array/createReverseOrderedNestedArray (; 104 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedNestedArray (; 102 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -6767,7 +6870,7 @@ ) (get_local $1) ) - (func $start~anonymous|47 (; 105 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|47 (; 103 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/array/Array#__get (get_local $0) @@ -6779,7 +6882,7 @@ ) ) ) - (func $~lib/internal/array/insertionSort> (; 106 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/insertionSort> (; 104 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6935,7 +7038,7 @@ ) (get_local $0) ) - (func $~lib/array/Array>#sort (; 107 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#sort (; 105 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6949,7 +7052,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 306) + (i32.const 310) (i32.const 4) ) (unreachable) @@ -7071,7 +7174,7 @@ ) ) ) - (func $std/array/isSorted> (; 108 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted> (; 106 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -7132,7 +7235,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted> (; 109 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted> (; 107 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted> @@ -7154,10 +7257,11 @@ ) ) ) - (func $~lib/array/Array>#constructor (; 110 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#constructor (; 108 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -7180,7 +7284,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) @@ -7215,22 +7319,30 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.6 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (get_local $0) ) - (func $~lib/array/Array>#get:length (; 111 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array>#get:length (; 109 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $std/array/Proxy#constructor (; 112 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/Proxy#constructor (; 110 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (tee_local $0 (if (result i32) @@ -7253,7 +7365,7 @@ ) ) ) - (func $~lib/array/Array>#__set (; 113 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array>#__set (; 111 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -7291,7 +7403,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $3) (i32.shl (i32.add @@ -7328,7 +7440,7 @@ ) ) ) - (func $std/array/createReverseOrderedElementsArray (; 114 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createReverseOrderedElementsArray (; 112 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -7379,7 +7491,7 @@ ) (get_local $1) ) - (func $start~anonymous|48 (; 115 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|48 (; 113 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (i32.load (get_local $0) @@ -7389,7 +7501,7 @@ ) ) ) - (func $~lib/internal/array/insertionSort> (; 116 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/insertionSort> (; 114 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7545,7 +7657,7 @@ ) (get_local $0) ) - (func $~lib/array/Array>#sort (; 117 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#sort (; 115 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7559,7 +7671,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 306) + (i32.const 310) (i32.const 4) ) (unreachable) @@ -7681,7 +7793,7 @@ ) ) ) - (func $~lib/array/Array>#__get (; 118 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array>#__get (; 116 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -7712,7 +7824,7 @@ (unreachable) ) ) - (func $std/array/isSorted> (; 119 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted> (; 117 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -7773,7 +7885,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted> (; 120 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted> (; 118 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted> @@ -7795,7 +7907,7 @@ ) ) ) - (func $~lib/internal/string/compareUnsafe (; 121 ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) + (func $~lib/internal/string/compareUnsafe (; 119 ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) (local $5 i32) (local $6 i32) (local $7 i32) @@ -7867,7 +7979,7 @@ ) (get_local $5) ) - (func $~lib/string/String.__gt (; 122 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__gt (; 120 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7951,7 +8063,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__lt (; 123 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__lt (; 121 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8035,7 +8147,7 @@ (i32.const 0) ) ) - (func $start~anonymous|49 (; 124 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|49 (; 122 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/string/String.__gt (get_local $0) @@ -8047,12 +8159,12 @@ ) ) ) - (func $~lib/array/Array#get:length (; 125 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 123 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $~lib/internal/array/insertionSort (; 126 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/array/insertionSort (; 124 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8208,7 +8320,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#sort (; 127 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#sort (; 125 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8222,7 +8334,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 306) + (i32.const 310) (i32.const 4) ) (unreachable) @@ -8344,7 +8456,7 @@ ) ) ) - (func $~lib/array/Array#__get (; 128 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__get (; 126 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (i32.load @@ -8375,7 +8487,7 @@ (unreachable) ) ) - (func $std/array/isSorted (; 129 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/array/isSorted (; 127 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (block $break|0 @@ -8436,7 +8548,7 @@ ) (i32.const 1) ) - (func $std/array/assertSorted (; 130 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $std/array/assertSorted (; 128 ;) (type $iiv) (param $0 i32) (param $1 i32) (if (i32.eqz (call $std/array/isSorted @@ -8458,7 +8570,7 @@ ) ) ) - (func $~lib/string/String.__eq (; 131 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 129 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -8514,7 +8626,7 @@ ) ) ) - (func $~lib/string/String.__ne (; 132 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__ne (; 130 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.eqz (call $~lib/string/String.__eq (get_local $0) @@ -8522,7 +8634,7 @@ ) ) ) - (func $std/array/isArraysEqual (; 133 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/array/isArraysEqual (; 131 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -8588,10 +8700,11 @@ ) (i32.const 1) ) - (func $~lib/array/Array#constructor (; 134 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#constructor (; 132 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -8614,7 +8727,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) @@ -8649,17 +8762,25 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.7 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (get_local $0) ) - (func $~lib/internal/string/allocate (; 135 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/string/allocateUnsafe (; 133 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -8681,20 +8802,27 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 728) - (i32.const 25) + (i32.const 744) + (i32.const 14) (i32.const 2) ) (unreachable) ) ) (set_local $2 - (call $~lib/memory/memory.allocate - (i32.add - (get_global $~lib/internal/string/HEADER_SIZE) - (i32.shl - (get_local $0) - (i32.const 1) + (block $~lib/memory/memory.allocate|inlined.2 (result i32) + (set_local $1 + (i32.add + (get_global $~lib/internal/string/HEADER_SIZE) + (i32.shl + (get_local $0) + (i32.const 1) + ) + ) + ) + (br $~lib/memory/memory.allocate|inlined.2 + (call $~lib/allocator/arena/__memory_allocate + (get_local $1) ) ) ) @@ -8705,7 +8833,7 @@ ) (get_local $2) ) - (func $~lib/string/String#charAt (; 136 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#charAt (; 134 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -8717,8 +8845,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 696) - (i32.const 58) + (i32.const 712) + (i32.const 56) (i32.const 4) ) (unreachable) @@ -8732,11 +8860,11 @@ ) ) (return - (get_global $~lib/internal/string/EMPTY) + (i32.const 560) ) ) (set_local $2 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (i32.const 1) ) ) @@ -8754,13 +8882,53 @@ ) (get_local $2) ) - (func $~lib/string/String#concat (; 137 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/string/copyUnsafe (; 135 ;) (type $iiiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (block $~lib/memory/memory.copy|inlined.4 + (set_local $5 + (i32.add + (i32.add + (get_local $0) + (i32.shl + (get_local $1) + (i32.const 1) + ) + ) + (get_global $~lib/internal/string/HEADER_SIZE) + ) + ) + (set_local $6 + (i32.add + (i32.add + (get_local $2) + (i32.shl + (get_local $3) + (i32.const 1) + ) + ) + (get_global $~lib/internal/string/HEADER_SIZE) + ) + ) + (set_local $7 + (i32.shl + (get_local $4) + (i32.const 1) + ) + ) + (call $~lib/internal/memory/memmove + (get_local $5) + (get_local $6) + (get_local $7) + ) + ) + ) + (func $~lib/string/String#concat (; 136 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 i32) - (local $7 i32) (if (i32.eqz (i32.ne @@ -8771,8 +8939,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 696) - (i32.const 112) + (i32.const 712) + (i32.const 108) (i32.const 4) ) (unreachable) @@ -8784,7 +8952,7 @@ (i32.const 0) ) (set_local $1 - (i32.const 780) + (i32.const 796) ) ) (set_local $2 @@ -8809,88 +8977,37 @@ (i32.const 0) ) (return - (get_global $~lib/internal/string/EMPTY) + (i32.const 560) ) ) (set_local $5 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (get_local $4) ) ) - (block $~lib/internal/string/copyUnsafe|inlined.0 - (set_local $6 - (i32.const 0) - ) - (set_local $7 - (i32.const 0) - ) - (call $~lib/memory/memory.copy - (i32.add - (i32.add - (get_local $5) - (i32.shl - (get_local $6) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.add - (i32.add - (get_local $0) - (i32.shl - (get_local $7) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.shl - (get_local $2) - (i32.const 1) - ) - ) + (call $~lib/internal/string/copyUnsafe + (get_local $5) + (i32.const 0) + (get_local $0) + (i32.const 0) + (get_local $2) ) - (block $~lib/internal/string/copyUnsafe|inlined.1 - (set_local $7 - (i32.const 0) - ) - (call $~lib/memory/memory.copy - (i32.add - (i32.add - (get_local $5) - (i32.shl - (get_local $2) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.add - (i32.add - (get_local $1) - (i32.shl - (get_local $7) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.shl - (get_local $3) - (i32.const 1) - ) - ) + (call $~lib/internal/string/copyUnsafe + (get_local $5) + (get_local $2) + (get_local $1) + (i32.const 0) + (get_local $3) ) (get_local $5) ) - (func $~lib/string/String.__concat (; 138 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__concat (; 137 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) ) (set_local $0 - (i32.const 780) + (i32.const 796) ) ) (call $~lib/string/String#concat @@ -8898,12 +9015,12 @@ (get_local $1) ) ) - (func $std/array/createRandomString (; 139 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomString (; 138 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 f64) (set_local $1 - (i32.const 544) + (i32.const 560) ) (block $break|0 (set_local $2 @@ -8954,7 +9071,7 @@ ) (get_local $1) ) - (func $~lib/array/Array#__set (; 140 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__set (; 139 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -8992,7 +9109,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $3) (i32.shl (i32.add @@ -9029,7 +9146,7 @@ ) ) ) - (func $std/array/createRandomStringArray (; 141 ;) (type $ii) (param $0 i32) (result i32) + (func $std/array/createRandomStringArray (; 140 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -9076,7 +9193,7 @@ ) (get_local $1) ) - (func $start~anonymous|50 (; 142 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $start~anonymous|50 (; 141 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.sub (call $~lib/string/String.__gt (get_local $0) @@ -9088,7 +9205,7 @@ ) ) ) - (func $start (; 143 ;) (type $v) + (func $start (; 142 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add @@ -12370,12 +12487,6 @@ (call $~lib/math/JSMath.random) ) ) - (set_global $std/array/reversed0 - (call $~lib/array/Array#constructor - (i32.const 0) - (i32.const 0) - ) - ) (set_global $std/array/reversed64 (call $std/array/createReverseOrderedArray (i32.const 64) @@ -12411,7 +12522,7 @@ (i32.eqz (call $std/array/isArraysEqual (get_global $std/array/reversed1) - (i32.const 464) + (i32.const 480) (i32.const 0) ) ) @@ -12432,7 +12543,7 @@ (i32.eqz (call $std/array/isArraysEqual (get_global $std/array/reversed2) - (i32.const 488) + (i32.const 504) (i32.const 0) ) ) diff --git a/tests/compiler/std/arraybuffer.optimized.wat b/tests/compiler/std/arraybuffer.optimized.wat index 5d4e4ce8..d851663b 100644 --- a/tests/compiler/std/arraybuffer.optimized.wat +++ b/tests/compiler/std/arraybuffer.optimized.wat @@ -16,7 +16,7 @@ (data (i32.const 112) "\12\00\00\00s\00t\00d\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/internal/arraybuffer/computeSize (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/computeSize (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -30,7 +30,7 @@ ) ) ) - (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -116,12 +116,7 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -132,7 +127,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 52) - (i32.const 22) + (i32.const 23) (i32.const 2) ) (unreachable) @@ -140,7 +135,7 @@ ) (i32.store (tee_local $1 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -150,7 +145,7 @@ ) (get_local $1) ) - (func $~lib/memory/memset (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memset (; 4 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -480,14 +475,7 @@ ) ) ) - (func $~lib/memory/memory.fill (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 5 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u @@ -505,7 +493,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $1) ) ) @@ -516,7 +504,7 @@ (i32.const 1) ) ) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (i32.add (get_local $3) (i32.const 8) @@ -527,7 +515,7 @@ ) (get_local $3) ) - (func $~lib/memory/memcpy (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memcpy (; 6 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1913,7 +1901,7 @@ ) ) ) - (func $~lib/memory/memmove (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memmove (; 7 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -1948,7 +1936,7 @@ (if (get_local $3) (block - (call $~lib/memory/memcpy + (call $~lib/internal/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2205,17 +2193,10 @@ ) ) ) - (func $~lib/memory/memory.copy (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memmove - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/arraybuffer/ArrayBuffer#slice (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/arraybuffer/ArrayBuffer#slice (; 8 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) - (set_local $4 + (set_local $3 (i32.load (get_local $0) ) @@ -2227,82 +2208,84 @@ (i32.const 0) ) (select - (tee_local $3 + (tee_local $4 (i32.add - (get_local $4) + (get_local $3) (get_local $1) ) ) (i32.const 0) (i32.gt_s - (get_local $3) + (get_local $4) (i32.const 0) ) ) (select - (tee_local $3 + (tee_local $4 (get_local $1) ) - (get_local $4) + (get_local $3) (i32.lt_s + (get_local $1) (get_local $3) - (get_local $4) ) ) ) ) - (call $~lib/memory/memory.copy - (i32.add - (tee_local $2 - (call $~lib/internal/arraybuffer/allocUnsafe - (tee_local $3 - (select - (tee_local $3 - (i32.sub - (tee_local $2 - (if (result i32) - (i32.lt_s - (get_local $2) - (i32.const 0) - ) - (select - (tee_local $3 - (i32.add - (get_local $4) - (get_local $2) - ) - ) - (i32.const 0) - (i32.gt_s - (get_local $3) + (call $~lib/internal/memory/memmove + (tee_local $4 + (i32.add + (tee_local $3 + (call $~lib/internal/arraybuffer/allocateUnsafe + (tee_local $2 + (select + (tee_local $4 + (i32.sub + (tee_local $2 + (if (result i32) + (i32.lt_s + (get_local $2) (i32.const 0) ) - ) - (select - (tee_local $3 - (get_local $2) + (select + (tee_local $4 + (i32.add + (get_local $3) + (get_local $2) + ) + ) + (i32.const 0) + (i32.gt_s + (get_local $4) + (i32.const 0) + ) ) - (get_local $4) - (i32.lt_s + (select + (tee_local $4 + (get_local $2) + ) (get_local $3) - (get_local $4) + (i32.lt_s + (get_local $2) + (get_local $3) + ) ) ) ) + (get_local $1) ) - (get_local $1) ) - ) - (i32.const 0) - (i32.gt_s - (get_local $3) (i32.const 0) + (i32.gt_s + (get_local $4) + (i32.const 0) + ) ) ) ) ) + (i32.const 8) ) - (i32.const 8) ) (i32.add (i32.add @@ -2311,11 +2294,11 @@ ) (get_local $1) ) - (get_local $3) + (get_local $2) ) - (get_local $2) + (get_local $3) ) - (func $~lib/arraybuffer/ArrayBuffer#slice|trampoline (; 12 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/arraybuffer/ArrayBuffer#slice|trampoline (; 9 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $2of2 (block $1of2 (block $0of2 @@ -2340,7 +2323,7 @@ (get_local $2) ) ) - (func $start (; 13 ;) (type $v) + (func $start (; 10 ;) (; has Stack IR ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.const 152) ) diff --git a/tests/compiler/std/arraybuffer.untouched.wat b/tests/compiler/std/arraybuffer.untouched.wat index dfff6835..f12fe8ef 100644 --- a/tests/compiler/std/arraybuffer.untouched.wat +++ b/tests/compiler/std/arraybuffer.untouched.wat @@ -148,15 +148,9 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) - (return - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) + (local $2 i32) (if (i32.eqz (i32.le_u @@ -168,16 +162,23 @@ (call $~lib/env/abort (i32.const 0) (i32.const 52) - (i32.const 22) + (i32.const 23) (i32.const 2) ) (unreachable) ) ) (set_local $1 - (call $~lib/memory/memory.allocate - (call $~lib/internal/arraybuffer/computeSize - (get_local $0) + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $2 + (call $~lib/internal/arraybuffer/computeSize + (get_local $0) + ) + ) + (br $~lib/memory/memory.allocate|inlined.0 + (call $~lib/allocator/arena/__memory_allocate + (get_local $2) + ) ) ) ) @@ -187,7 +188,7 @@ ) (get_local $1) ) - (func $~lib/memory/memset (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memset (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -539,15 +540,10 @@ ) ) ) - (func $~lib/memory/memory.fill (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 5 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) + (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -564,7 +560,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $1) ) ) @@ -575,18 +571,26 @@ (i32.const 1) ) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.0 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $1) ) - (i32.const 0) - (get_local $1) ) ) (get_local $3) ) - (func $~lib/memory/memcpy (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memcpy (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2388,7 +2392,7 @@ ) ) ) - (func $~lib/memory/memmove (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memmove (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.eq @@ -2418,7 +2422,7 @@ ) ) (block - (call $~lib/memory/memcpy + (call $~lib/internal/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2706,14 +2710,7 @@ ) ) ) - (func $~lib/memory/memory.copy (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memmove - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/arraybuffer/ArrayBuffer#slice (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/arraybuffer/ArrayBuffer#slice (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2816,27 +2813,35 @@ ) ) (set_local $7 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $6) ) ) - (call $~lib/memory/memory.copy - (i32.add - (get_local $7) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) - ) - (i32.add + (block $~lib/memory/memory.copy|inlined.0 + (set_local $4 (i32.add - (get_local $0) + (get_local $7) (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) - (get_local $1) ) - (get_local $6) + (set_local $5 + (i32.add + (i32.add + (get_local $0) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + (get_local $1) + ) + ) + (call $~lib/internal/memory/memmove + (get_local $4) + (get_local $5) + (get_local $6) + ) ) (get_local $7) ) - (func $~lib/arraybuffer/ArrayBuffer#slice|trampoline (; 12 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/arraybuffer/ArrayBuffer#slice|trampoline (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $2of2 (block $1of2 (block $0of2 @@ -2861,7 +2866,7 @@ (get_local $2) ) ) - (func $start (; 13 ;) (type $v) + (func $start (; 10 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add diff --git a/tests/compiler/std/constructor.optimized.wat b/tests/compiler/std/constructor.optimized.wat index fa51bb3a..1cbcd37b 100644 --- a/tests/compiler/std/constructor.optimized.wat +++ b/tests/compiler/std/constructor.optimized.wat @@ -17,7 +17,7 @@ (memory $0 0) (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/__memory_allocate (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 0 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -103,12 +103,12 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/allocator/arena/__memory_allocate (get_local $0) ) ) - (func $std/constructor/EmptyCtor#constructor (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/EmptyCtor#constructor (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (result i32) (get_local $0) (get_local $0) @@ -117,7 +117,7 @@ ) ) ) - (func $std/constructor/EmptyCtorWithFieldInit#constructor (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/EmptyCtorWithFieldInit#constructor (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -133,7 +133,7 @@ ) (get_local $0) ) - (func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/EmptyCtorWithFieldNoInit#constructor (; 4 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -149,29 +149,35 @@ ) (get_local $0) ) - (func $std/constructor/CtorReturns#constructor (; 5 ;) (type $ii) (param $0 i32) (result i32) - (call $~lib/memory/memory.allocate + (func $std/constructor/CtorReturns#constructor (; 5 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate (i32.const 0) ) ) - (func $std/constructor/CtorConditionallyReturns#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/CtorConditionallyReturns#constructor (; 6 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (get_global $std/constructor/b) (return + (tee_local $0 + (call $~lib/allocator/arena/__memory_allocate + (i32.const 0) + ) + ) + ) + ) + (if + (i32.eqz + (get_local $0) + ) + (set_local $0 (call $~lib/memory/memory.allocate (i32.const 0) ) ) ) - (if (result i32) - (get_local $0) - (get_local $0) - (call $~lib/memory/memory.allocate - (i32.const 0) - ) - ) + (get_local $0) ) - (func $std/constructor/CtorConditionallyAllocates#constructor (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $std/constructor/CtorConditionallyAllocates#constructor (; 7 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (get_global $std/constructor/b) (if @@ -197,7 +203,7 @@ ) (get_local $0) ) - (func $start (; 8 ;) (type $v) + (func $start (; 8 ;) (; has Stack IR ;) (type $v) (local $0 i32) (set_global $~lib/allocator/arena/startOffset (i32.const 8) diff --git a/tests/compiler/std/constructor.untouched.wat b/tests/compiler/std/constructor.untouched.wat index d2ded3be..3e0568bd 100644 --- a/tests/compiler/std/constructor.untouched.wat +++ b/tests/compiler/std/constructor.untouched.wat @@ -203,8 +203,16 @@ ) ) (func $std/constructor/CtorReturns#constructor (; 5 ;) (type $ii) (param $0 i32) (result i32) - (call $~lib/memory/memory.allocate - (i32.const 0) + (local $1 i32) + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $1 + (i32.const 0) + ) + (br $~lib/memory/memory.allocate|inlined.0 + (call $~lib/allocator/arena/__memory_allocate + (get_local $1) + ) + ) ) ) (func $std/constructor/CtorConditionallyReturns#constructor (; 6 ;) (type $ii) (param $0 i32) (result i32) @@ -212,8 +220,15 @@ (if (get_global $std/constructor/b) (return - (call $~lib/memory/memory.allocate - (i32.const 0) + (block $~lib/memory/memory.allocate|inlined.1 (result i32) + (set_local $1 + (i32.const 0) + ) + (br $~lib/memory/memory.allocate|inlined.1 + (call $~lib/allocator/arena/__memory_allocate + (get_local $1) + ) + ) ) ) ) diff --git a/tests/compiler/std/gc.optimized.wat b/tests/compiler/std/gc-basics.optimized.wat similarity index 73% rename from tests/compiler/std/gc.optimized.wat rename to tests/compiler/std/gc-basics.optimized.wat index fc717b82..4b3106df 100644 --- a/tests/compiler/std/gc.optimized.wat +++ b/tests/compiler/std/gc-basics.optimized.wat @@ -11,24 +11,24 @@ (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) (global $~lib/collector/itcm/state (mut i32) (i32.const 0)) (global $~lib/collector/itcm/white (mut i32) (i32.const 0)) - (global $~lib/collector/itcm/from (mut i32) (i32.const 0)) - (global $~lib/collector/itcm/to (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/fromSpace (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/toSpace (mut i32) (i32.const 0)) (global $~lib/collector/itcm/iter (mut i32) (i32.const 0)) (global $~argc (mut i32) (i32.const 0)) - (global $std/gc/obj (mut i32) (i32.const 0)) - (global $std/gc/obj2 (mut i32) (i32.const 0)) + (global $std/gc-basics/obj (mut i32) (i32.const 0)) + (global $std/gc-basics/obj2 (mut i32) (i32.const 0)) (global $~started (mut i32) (i32.const 0)) (table 2 2 anyfunc) - (elem (i32.const 0) $std/gc/MyObject_visit $~lib/collector/itcm/__gc_mark) + (elem (i32.const 0) $std/gc-basics/MyObject_visit $~lib/collector/itcm/__gc_mark) (memory $0 1) - (data (i32.const 8) "\t\00\00\00s\00t\00d\00/\00g\00c\00.\00t\00s") + (data (i32.const 24) "\10\00\00\00s\00t\00d\00/\00g\00c\00-\00b\00a\00s\00i\00c\00s\00.\00t\00s") (export "memory" (memory $0)) (export "table" (table $0)) - (export "main" (func $std/gc/main)) - (func $std/gc/MyObject_visit (; 1 ;) (type $iv) (param $0 i32) + (export "main" (func $std/gc-basics/main)) + (func $std/gc-basics/MyObject_visit (; 1 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -114,12 +114,7 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - (func $~lib/collector/itcm/ManagedObjectList#clear (; 4 ;) (type $iv) (param $0 i32) + (func $~lib/collector/itcm/ManagedObjectList#clear (; 3 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (get_local $0) @@ -129,7 +124,7 @@ (get_local $0) ) ) - (func $~lib/collector/itcm/ManagedObject#get:color (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/collector/itcm/ManagedObject#get:color (; 4 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.and (i32.load (get_local $0) @@ -137,7 +132,7 @@ (i32.const 3) ) ) - (func $~lib/collector/itcm/ManagedObject#get:next (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/collector/itcm/ManagedObject#get:next (; 5 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.and (i32.load (get_local $0) @@ -145,7 +140,7 @@ (i32.const -4) ) ) - (func $~lib/collector/itcm/ManagedObject#set:next (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/collector/itcm/ManagedObject#set:next (; 6 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (i32.store (get_local $0) (i32.or @@ -159,7 +154,7 @@ ) ) ) - (func $~lib/collector/itcm/ManagedObject#unlink (; 8 ;) (type $iv) (param $0 i32) + (func $~lib/collector/itcm/ManagedObject#unlink (; 7 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (local $1 i32) (i32.store offset=4 (tee_local $1 @@ -178,7 +173,7 @@ (get_local $1) ) ) - (func $~lib/collector/itcm/ManagedObjectList#push (; 9 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/collector/itcm/ManagedObjectList#push (; 8 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (set_local $2 (i32.load offset=4 @@ -202,7 +197,7 @@ (get_local $1) ) ) - (func $~lib/collector/itcm/ManagedObject#makeGray (; 10 ;) (type $iv) (param $0 i32) + (func $~lib/collector/itcm/ManagedObject#makeGray (; 9 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (if (i32.eq (get_local $0) @@ -218,7 +213,7 @@ (get_local $0) ) (call $~lib/collector/itcm/ManagedObjectList#push - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) (get_local $0) ) (i32.store @@ -234,7 +229,7 @@ ) ) ) - (func $~lib/collector/itcm/__gc_mark (; 11 ;) (type $iv) (param $0 i32) + (func $~lib/collector/itcm/__gc_mark (; 10 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (local $1 i32) (if (get_local $0) @@ -256,7 +251,7 @@ ) ) ) - (func $~lib/collector/itcm/ManagedObject#set:color (; 12 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/collector/itcm/ManagedObject#set:color (; 11 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (i32.store (get_local $0) (i32.or @@ -270,12 +265,7 @@ ) ) ) - (func $~lib/memory/memory.free (; 13 ;) (type $iv) (param $0 i32) - (call $std/gc/MyObject_visit - (get_local $0) - ) - ) - (func $~lib/collector/itcm/step (; 14 ;) (type $v) + (func $~lib/collector/itcm/step (; 12 ;) (; has Stack IR ;) (type $v) (local $0 i32) (block $break|0 (block $case3|0 @@ -297,32 +287,36 @@ (br $break|0) ) ) - (set_global $~lib/collector/itcm/from - (call $~lib/memory/memory.allocate - (i32.const 16) + (set_global $~lib/collector/itcm/fromSpace + (tee_local $0 + (call $~lib/allocator/arena/__memory_allocate + (i32.const 16) + ) ) ) (i32.store offset=8 - (get_global $~lib/collector/itcm/from) + (get_global $~lib/collector/itcm/fromSpace) (i32.const -1) ) (call $~lib/collector/itcm/ManagedObjectList#clear - (get_global $~lib/collector/itcm/from) + (get_global $~lib/collector/itcm/fromSpace) ) - (set_global $~lib/collector/itcm/to - (call $~lib/memory/memory.allocate - (i32.const 16) + (set_global $~lib/collector/itcm/toSpace + (tee_local $0 + (call $~lib/allocator/arena/__memory_allocate + (i32.const 16) + ) ) ) (i32.store offset=8 - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) (i32.const -1) ) (call $~lib/collector/itcm/ManagedObjectList#clear - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) ) (set_global $~lib/collector/itcm/iter - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) ) (set_global $~lib/collector/itcm/state (i32.const 1) @@ -343,7 +337,7 @@ (get_global $~lib/collector/itcm/iter) ) ) - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) ) (block (set_global $~lib/collector/itcm/iter @@ -377,16 +371,16 @@ (call $~lib/collector/itcm/ManagedObject#get:next (get_global $~lib/collector/itcm/iter) ) - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) ) (block (set_local $0 - (get_global $~lib/collector/itcm/from) + (get_global $~lib/collector/itcm/fromSpace) ) - (set_global $~lib/collector/itcm/from - (get_global $~lib/collector/itcm/to) + (set_global $~lib/collector/itcm/fromSpace + (get_global $~lib/collector/itcm/toSpace) ) - (set_global $~lib/collector/itcm/to + (set_global $~lib/collector/itcm/toSpace (get_local $0) ) (set_global $~lib/collector/itcm/white @@ -413,7 +407,7 @@ (tee_local $0 (get_global $~lib/collector/itcm/iter) ) - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) ) (block (set_global $~lib/collector/itcm/iter @@ -421,13 +415,19 @@ (get_local $0) ) ) - (call $~lib/memory/memory.free - (get_local $0) + (if + (i32.ge_u + (get_local $0) + (i32.const 60) + ) + (call $std/gc-basics/MyObject_visit + (get_local $0) + ) ) ) (block (call $~lib/collector/itcm/ManagedObjectList#clear - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) ) (set_global $~lib/collector/itcm/state (i32.const 1) @@ -436,8 +436,7 @@ ) ) ) - (func $~lib/collector/itcm/__gc_allocate (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) + (func $~lib/collector/itcm/__gc_allocate (; 13 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.gt_u (get_local $0) @@ -447,8 +446,8 @@ ) (call $~lib/collector/itcm/step) (i32.store offset=8 - (tee_local $2 - (call $~lib/memory/memory.allocate + (tee_local $0 + (call $~lib/allocator/arena/__memory_allocate (i32.add (get_local $0) (i32.const 16) @@ -458,25 +457,19 @@ (get_local $1) ) (call $~lib/collector/itcm/ManagedObject#set:color - (get_local $2) + (get_local $0) (get_global $~lib/collector/itcm/white) ) (call $~lib/collector/itcm/ManagedObjectList#push - (get_global $~lib/collector/itcm/from) - (get_local $2) + (get_global $~lib/collector/itcm/fromSpace) + (get_local $0) ) (i32.add - (get_local $2) + (get_local $0) (i32.const 16) ) ) - (func $~lib/gc/gc.allocate (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) - (call $~lib/collector/itcm/__gc_allocate - (get_local $0) - (get_local $1) - ) - ) - (func $~lib/collector/itcm/__gc_collect (; 17 ;) (type $v) + (func $~lib/collector/itcm/__gc_collect (; 14 ;) (; has Stack IR ;) (type $v) (local $0 i32) (block $break|0 (block $case1|0 @@ -510,10 +503,10 @@ ) ) ) - (func $~lib/gc/gc.collect (; 18 ;) (type $v) + (func $~lib/gc/gc.collect (; 15 ;) (; has Stack IR ;) (type $v) (call $~lib/collector/itcm/__gc_collect) ) - (func $std/gc/main (; 19 ;) (type $i) (result i32) + (func $std/gc-basics/main (; 16 ;) (; has Stack IR ;) (type $i) (result i32) (if (i32.eqz (get_global $~started) @@ -527,13 +520,13 @@ ) (i32.const 0) ) - (func $start (; 20 ;) (type $v) + (func $start (; 17 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) (set_global $~lib/allocator/arena/startOffset - (i32.const 32) + (i32.const 64) ) (set_global $~lib/allocator/arena/offset (get_global $~lib/allocator/arena/startOffset) @@ -541,21 +534,21 @@ (set_global $~lib/collector/itcm/state (i32.const 0) ) - (set_global $std/gc/obj - (call $~lib/gc/gc.allocate + (set_global $std/gc-basics/obj + (call $~lib/collector/itcm/__gc_allocate (i32.const 4) (i32.const 0) ) ) (i32.store - (get_global $std/gc/obj) + (get_global $std/gc-basics/obj) (i32.const 123) ) (set_local $2 (i32.load offset=4 (tee_local $0 (i32.sub - (get_global $std/gc/obj) + (get_global $std/gc-basics/obj) (i32.const 16) ) ) @@ -598,7 +591,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 8) + (i32.const 24) (i32.const 19) (i32.const 2) ) @@ -651,18 +644,18 @@ ) ) (call $~lib/gc/gc.collect) - (set_global $std/gc/obj + (set_global $std/gc-basics/obj (i32.const 0) ) (call $~lib/gc/gc.collect) ) - (func $~iterateRoots (; 21 ;) (type $iv) (param $0 i32) + (func $~iterateRoots (; 18 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (call_indirect (type $iv) - (get_global $std/gc/obj) + (get_global $std/gc-basics/obj) (get_local $0) ) (call_indirect (type $iv) - (get_global $std/gc/obj2) + (get_global $std/gc-basics/obj2) (get_local $0) ) ) diff --git a/tests/compiler/std/gc.ts b/tests/compiler/std/gc-basics.ts similarity index 75% rename from tests/compiler/std/gc.ts rename to tests/compiler/std/gc-basics.ts index dfaadbf4..b4ddfa86 100644 --- a/tests/compiler/std/gc.ts +++ b/tests/compiler/std/gc-basics.ts @@ -8,7 +8,7 @@ class MyObject { function MyObject_visit(ref: usize): void {} // function table index == classId ? // allocate a managed instance -var obj: MyObject | null = changetype(gc.allocate(offsetof(), MyObject_visit)); +var obj: MyObject | null = changetype(__gc_allocate(offsetof(), MyObject_visit)); obj.a = 123; // check header @@ -32,6 +32,3 @@ gc.collect(); // should free 'obj' because it isn't referenced anymore (see trac var obj2: MyObject; // should also iterate globals defined late export function main(): i32 { return 0; } - -// BEWARE: The compiler does not emit any integrations except gc.iterateRoots yet, hence trying to -// use the GC with a 'normally' allocated object will break it, as it has no managed header! diff --git a/tests/compiler/std/gc.untouched.wat b/tests/compiler/std/gc-basics.untouched.wat similarity index 75% rename from tests/compiler/std/gc.untouched.wat rename to tests/compiler/std/gc-basics.untouched.wat index 5eae52f2..8c7dd46a 100644 --- a/tests/compiler/std/gc.untouched.wat +++ b/tests/compiler/std/gc-basics.untouched.wat @@ -14,29 +14,29 @@ (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) (global $~lib/collector/itcm/TRACE i32 (i32.const 0)) + (global $~lib/collector/itcm/HEADER_SIZE i32 (i32.const 16)) (global $~lib/collector/itcm/State.INIT i32 (i32.const 0)) (global $~lib/collector/itcm/State.IDLE i32 (i32.const 1)) (global $~lib/collector/itcm/State.MARK i32 (i32.const 2)) (global $~lib/collector/itcm/State.SWEEP i32 (i32.const 3)) (global $~lib/collector/itcm/state (mut i32) (i32.const 0)) (global $~lib/collector/itcm/white (mut i32) (i32.const 0)) - (global $~lib/collector/itcm/from (mut i32) (i32.const 0)) - (global $~lib/collector/itcm/to (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/fromSpace (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/toSpace (mut i32) (i32.const 0)) (global $~lib/collector/itcm/iter (mut i32) (i32.const 0)) - (global $~lib/collector/itcm/ManagedObject.SIZE i32 (i32.const 16)) (global $~argc (mut i32) (i32.const 0)) - (global $std/gc/obj (mut i32) (i32.const 0)) - (global $std/gc/obj2 (mut i32) (i32.const 0)) + (global $std/gc-basics/obj (mut i32) (i32.const 0)) + (global $std/gc-basics/obj2 (mut i32) (i32.const 0)) (global $~started (mut i32) (i32.const 0)) - (global $HEAP_BASE i32 (i32.const 32)) + (global $HEAP_BASE i32 (i32.const 60)) (table 2 2 anyfunc) - (elem (i32.const 0) $std/gc/MyObject_visit $~lib/collector/itcm/__gc_mark) + (elem (i32.const 0) $std/gc-basics/MyObject_visit $~lib/collector/itcm/__gc_mark) (memory $0 1) - (data (i32.const 8) "\t\00\00\00s\00t\00d\00/\00g\00c\00.\00t\00s\00") + (data (i32.const 8) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\10\00\00\00s\00t\00d\00/\00g\00c\00-\00b\00a\00s\00i\00c\00s\00.\00t\00s\00") (export "memory" (memory $0)) (export "table" (table $0)) - (export "main" (func $std/gc/main)) - (func $std/gc/MyObject_visit (; 1 ;) (type $iv) (param $0 i32) + (export "main" (func $std/gc-basics/main)) + (func $std/gc-basics/MyObject_visit (; 1 ;) (type $iv) (param $0 i32) (nop) ) (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) @@ -147,14 +147,7 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) - (return - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - ) - (func $~lib/collector/itcm/ManagedObjectList#clear (; 4 ;) (type $iv) (param $0 i32) + (func $~lib/collector/itcm/ManagedObjectList#clear (; 3 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (get_local $0) @@ -164,7 +157,7 @@ (get_local $0) ) ) - (func $~lib/collector/itcm/ManagedObject#get:color (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/collector/itcm/ManagedObject#get:color (; 4 ;) (type $ii) (param $0 i32) (result i32) (i32.and (i32.load (get_local $0) @@ -172,7 +165,7 @@ (i32.const 3) ) ) - (func $~lib/collector/itcm/ManagedObject#get:next (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/collector/itcm/ManagedObject#get:next (; 5 ;) (type $ii) (param $0 i32) (result i32) (i32.and (i32.load (get_local $0) @@ -183,7 +176,7 @@ ) ) ) - (func $~lib/collector/itcm/ManagedObject#set:next (; 7 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/collector/itcm/ManagedObject#set:next (; 6 ;) (type $iiv) (param $0 i32) (param $1 i32) (i32.store (get_local $0) (i32.or @@ -197,7 +190,7 @@ ) ) ) - (func $~lib/collector/itcm/ManagedObject#unlink (; 8 ;) (type $iv) (param $0 i32) + (func $~lib/collector/itcm/ManagedObject#unlink (; 7 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) (set_local $1 @@ -219,7 +212,7 @@ (get_local $1) ) ) - (func $~lib/collector/itcm/ManagedObjectList#push (; 9 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/collector/itcm/ManagedObjectList#push (; 8 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (set_local $2 (i32.load offset=4 @@ -243,7 +236,7 @@ (get_local $1) ) ) - (func $~lib/collector/itcm/ManagedObject#makeGray (; 10 ;) (type $iv) (param $0 i32) + (func $~lib/collector/itcm/ManagedObject#makeGray (; 9 ;) (type $iv) (param $0 i32) (if (i32.eq (get_local $0) @@ -259,7 +252,7 @@ (get_local $0) ) (call $~lib/collector/itcm/ManagedObjectList#push - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) (get_local $0) ) (i32.store @@ -278,7 +271,7 @@ ) ) ) - (func $~lib/collector/itcm/__gc_mark (; 11 ;) (type $iv) (param $0 i32) + (func $~lib/collector/itcm/__gc_mark (; 10 ;) (type $iv) (param $0 i32) (local $1 i32) (if (get_local $0) @@ -287,7 +280,7 @@ (block $~lib/collector/itcm/refToObj|inlined.0 (result i32) (i32.sub (get_local $0) - (get_global $~lib/collector/itcm/ManagedObject.SIZE) + (get_global $~lib/collector/itcm/HEADER_SIZE) ) ) ) @@ -305,7 +298,7 @@ ) ) ) - (func $~lib/collector/itcm/ManagedObject#set:color (; 12 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/collector/itcm/ManagedObject#set:color (; 11 ;) (type $iiv) (param $0 i32) (param $1 i32) (i32.store (get_local $0) (i32.or @@ -322,16 +315,10 @@ ) ) ) - (func $~lib/allocator/arena/__memory_free (; 13 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 12 ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/memory/memory.free (; 14 ;) (type $iv) (param $0 i32) - (call $~lib/allocator/arena/__memory_free - (get_local $0) - ) - (return) - ) - (func $~lib/collector/itcm/step (; 15 ;) (type $v) + (func $~lib/collector/itcm/step (; 13 ;) (type $v) (local $0 i32) (local $1 i32) (block $break|0 @@ -369,32 +356,46 @@ (br $break|0) ) (block - (set_global $~lib/collector/itcm/from - (call $~lib/memory/memory.allocate - (get_global $~lib/collector/itcm/ManagedObject.SIZE) + (set_global $~lib/collector/itcm/fromSpace + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $1 + (get_global $~lib/collector/itcm/HEADER_SIZE) + ) + (br $~lib/memory/memory.allocate|inlined.0 + (call $~lib/allocator/arena/__memory_allocate + (get_local $1) + ) + ) ) ) (i32.store offset=8 - (get_global $~lib/collector/itcm/from) + (get_global $~lib/collector/itcm/fromSpace) (i32.const -1) ) (call $~lib/collector/itcm/ManagedObjectList#clear - (get_global $~lib/collector/itcm/from) + (get_global $~lib/collector/itcm/fromSpace) ) - (set_global $~lib/collector/itcm/to - (call $~lib/memory/memory.allocate - (get_global $~lib/collector/itcm/ManagedObject.SIZE) + (set_global $~lib/collector/itcm/toSpace + (block $~lib/memory/memory.allocate|inlined.1 (result i32) + (set_local $1 + (get_global $~lib/collector/itcm/HEADER_SIZE) + ) + (br $~lib/memory/memory.allocate|inlined.1 + (call $~lib/allocator/arena/__memory_allocate + (get_local $1) + ) + ) ) ) (i32.store offset=8 - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) (i32.const -1) ) (call $~lib/collector/itcm/ManagedObjectList#clear - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) ) (set_global $~lib/collector/itcm/iter - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) ) (set_global $~lib/collector/itcm/state (get_global $~lib/collector/itcm/State.IDLE) @@ -420,7 +421,7 @@ (if (i32.ne (get_local $0) - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) ) (block (set_global $~lib/collector/itcm/iter @@ -439,7 +440,7 @@ (block $~lib/collector/itcm/objToRef|inlined.0 (result i32) (i32.add (get_local $0) - (get_global $~lib/collector/itcm/ManagedObject.SIZE) + (get_global $~lib/collector/itcm/HEADER_SIZE) ) ) (i32.load offset=8 @@ -459,16 +460,16 @@ (if (i32.eq (get_local $0) - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) ) (block (set_local $1 - (get_global $~lib/collector/itcm/from) + (get_global $~lib/collector/itcm/fromSpace) ) - (set_global $~lib/collector/itcm/from - (get_global $~lib/collector/itcm/to) + (set_global $~lib/collector/itcm/fromSpace + (get_global $~lib/collector/itcm/toSpace) ) - (set_global $~lib/collector/itcm/to + (set_global $~lib/collector/itcm/toSpace (get_local $1) ) (set_global $~lib/collector/itcm/white @@ -498,7 +499,7 @@ (if (i32.ne (get_local $0) - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) ) (block (set_global $~lib/collector/itcm/iter @@ -506,13 +507,24 @@ (get_local $0) ) ) - (call $~lib/memory/memory.free - (get_local $0) + (if + (i32.ge_u + (get_local $0) + (get_global $HEAP_BASE) + ) + (block $~lib/memory/memory.free|inlined.0 + (block + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + (br $~lib/memory/memory.free|inlined.0) + ) + ) ) ) (block (call $~lib/collector/itcm/ManagedObjectList#clear - (get_global $~lib/collector/itcm/to) + (get_global $~lib/collector/itcm/toSpace) ) (set_global $~lib/collector/itcm/state (get_global $~lib/collector/itcm/State.IDLE) @@ -523,55 +535,55 @@ ) ) ) - (func $~lib/collector/itcm/__gc_allocate (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/collector/itcm/__gc_allocate (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) + (local $3 i32) (if (i32.gt_u (get_local $0) (i32.sub (get_global $~lib/internal/allocator/MAX_SIZE_32) - (get_global $~lib/collector/itcm/ManagedObject.SIZE) + (get_global $~lib/collector/itcm/HEADER_SIZE) ) ) (unreachable) ) (call $~lib/collector/itcm/step) - (set_local $2 - (call $~lib/memory/memory.allocate - (i32.add - (get_global $~lib/collector/itcm/ManagedObject.SIZE) - (get_local $0) + (set_local $3 + (block $~lib/memory/memory.allocate|inlined.2 (result i32) + (set_local $2 + (i32.add + (get_global $~lib/collector/itcm/HEADER_SIZE) + (get_local $0) + ) + ) + (br $~lib/memory/memory.allocate|inlined.2 + (call $~lib/allocator/arena/__memory_allocate + (get_local $2) + ) ) ) ) (i32.store offset=8 - (get_local $2) + (get_local $3) (get_local $1) ) (call $~lib/collector/itcm/ManagedObject#set:color - (get_local $2) + (get_local $3) (get_global $~lib/collector/itcm/white) ) (call $~lib/collector/itcm/ManagedObjectList#push - (get_global $~lib/collector/itcm/from) - (get_local $2) + (get_global $~lib/collector/itcm/fromSpace) + (get_local $3) ) (block $~lib/collector/itcm/objToRef|inlined.1 (result i32) (i32.add - (get_local $2) - (get_global $~lib/collector/itcm/ManagedObject.SIZE) + (get_local $3) + (get_global $~lib/collector/itcm/HEADER_SIZE) ) ) ) - (func $~lib/gc/gc.allocate (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) - (return - (call $~lib/collector/itcm/__gc_allocate - (get_local $0) - (get_local $1) - ) - ) - ) - (func $~lib/collector/itcm/__gc_collect (; 18 ;) (type $v) + (func $~lib/collector/itcm/__gc_collect (; 15 ;) (type $v) (local $0 i32) (block $break|0 (block $case1|0 @@ -611,11 +623,11 @@ ) ) ) - (func $~lib/gc/gc.collect (; 19 ;) (type $v) + (func $~lib/gc/gc.collect (; 16 ;) (type $v) (call $~lib/collector/itcm/__gc_collect) (return) ) - (func $std/gc/main (; 20 ;) (type $i) (result i32) + (func $std/gc-basics/main (; 17 ;) (type $i) (result i32) (if (i32.eqz (get_global $~started) @@ -629,7 +641,7 @@ ) (i32.const 0) ) - (func $start (; 21 ;) (type $v) + (func $start (; 18 ;) (type $v) (local $0 i32) (local $1 i32) (local $2 i32) @@ -654,20 +666,20 @@ (set_global $~lib/collector/itcm/state (get_global $~lib/collector/itcm/State.INIT) ) - (set_global $std/gc/obj - (call $~lib/gc/gc.allocate + (set_global $std/gc-basics/obj + (call $~lib/collector/itcm/__gc_allocate (i32.const 4) (i32.const 0) ) ) (i32.store - (get_global $std/gc/obj) + (get_global $std/gc-basics/obj) (i32.const 123) ) (block (set_local $0 (i32.sub - (get_global $std/gc/obj) + (get_global $std/gc-basics/obj) (i32.const 16) ) ) @@ -715,7 +727,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 8) + (i32.const 24) (i32.const 19) (i32.const 2) ) @@ -790,18 +802,18 @@ ) ) (call $~lib/gc/gc.collect) - (set_global $std/gc/obj + (set_global $std/gc-basics/obj (i32.const 0) ) (call $~lib/gc/gc.collect) ) - (func $~iterateRoots (; 22 ;) (type $iv) (param $0 i32) + (func $~iterateRoots (; 19 ;) (type $iv) (param $0 i32) (call_indirect (type $iv) - (get_global $std/gc/obj) + (get_global $std/gc-basics/obj) (get_local $0) ) (call_indirect (type $iv) - (get_global $std/gc/obj2) + (get_global $std/gc-basics/obj2) (get_local $0) ) ) diff --git a/tests/compiler/std/gc-integration.optimized.wat b/tests/compiler/std/gc-integration.optimized.wat index 8c31124f..40163fcd 100644 --- a/tests/compiler/std/gc-integration.optimized.wat +++ b/tests/compiler/std/gc-integration.optimized.wat @@ -14,7 +14,7 @@ (export "memory" (memory $0)) (export "table" (table $0)) (start $start) - (func $start~anonymous|0 (; 1 ;) (type $iv) (param $0 i32) + (func $start~anonymous|0 (; 1 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (set_global $std/gc-integration/i (i32.add (get_global $std/gc-integration/i) @@ -33,14 +33,14 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 14) + (i32.const 18) (i32.const 37) ) (unreachable) ) ) ) - (func $start (; 2 ;) (type $v) + (func $start (; 2 ;) (; has Stack IR ;) (type $v) (call $~iterateRoots (i32.const 0) ) @@ -53,14 +53,14 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 15) + (i32.const 19) (i32.const 0) ) (unreachable) ) ) ) - (func $~iterateRoots (; 3 ;) (type $iv) (param $0 i32) + (func $~iterateRoots (; 3 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (call_indirect (type $iv) (i32.const 8) (get_local $0) diff --git a/tests/compiler/std/gc-integration.ts b/tests/compiler/std/gc-integration.ts index 5650381f..bbb92c70 100644 --- a/tests/compiler/std/gc-integration.ts +++ b/tests/compiler/std/gc-integration.ts @@ -1,14 +1,18 @@ +// declare classes to test with class A {} class B { - static readonly c: B = changetype(8); - static d: A = changetype(16); + static readonly c: B = changetype(8); // static root, readonly + static d: A = changetype(16); // static root, writable } + +// make sure static properties are compiled B.c; B.d; -var no_ref: usize = 64; -var a_ref: A | null = changetype(24); -var b_ref: B = changetype(32); +// declare roots +var no_ref: usize = 64; // NOT a root, basic value +var a_ref: A | null = changetype(24); // global root, nullable +var b_ref: B = changetype(32); // global root, non-nullable var i: i32 = 0; iterateRoots((ref: usize): void => { assert(ref == ++i << 3); }); diff --git a/tests/compiler/std/gc-integration.untouched.wat b/tests/compiler/std/gc-integration.untouched.wat index 58fd3644..7553ebe0 100644 --- a/tests/compiler/std/gc-integration.untouched.wat +++ b/tests/compiler/std/gc-integration.untouched.wat @@ -40,7 +40,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 14) + (i32.const 18) (i32.const 37) ) (unreachable) @@ -68,7 +68,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 8) - (i32.const 15) + (i32.const 19) (i32.const 0) ) (unreachable) diff --git a/tests/compiler/std/gc-object.optimized.wat b/tests/compiler/std/gc-object.optimized.wat new file mode 100644 index 00000000..66213818 --- /dev/null +++ b/tests/compiler/std/gc-object.optimized.wat @@ -0,0 +1,594 @@ +(module + (type $iii (func (param i32 i32) (result i32))) + (type $v (func)) + (type $ii (func (param i32) (result i32))) + (type $iv (func (param i32))) + (type $iiv (func (param i32 i32))) + (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) + (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/state (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/white (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/fromSpace (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/toSpace (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/iter (mut i32) (i32.const 0)) + (global $~argc (mut i32) (i32.const 0)) + (global $std/gc-object/obj (mut i32) (i32.const 0)) + (global $~started (mut i32) (i32.const 0)) + (table 3 3 anyfunc) + (elem (i32.const 0) $~lib/collector/itcm/__gc_mark $std/gc-object/Custom~gc $std/gc-object/Base~gc) + (memory $0 0) + (export "memory" (memory $0)) + (export "table" (table $0)) + (export "main" (func $std/gc-object/main)) + (func $~lib/allocator/arena/__memory_allocate (; 0 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (if + (get_local $0) + (block + (if + (i32.gt_u + (get_local $0) + (i32.const 1073741824) + ) + (unreachable) + ) + (if + (i32.gt_u + (tee_local $0 + (i32.and + (i32.add + (i32.add + (tee_local $1 + (get_global $~lib/allocator/arena/offset) + ) + (get_local $0) + ) + (i32.const 7) + ) + (i32.const -8) + ) + ) + (i32.shl + (tee_local $2 + (current_memory) + ) + (i32.const 16) + ) + ) + (if + (i32.lt_s + (grow_memory + (select + (get_local $2) + (tee_local $3 + (i32.shr_u + (i32.and + (i32.add + (i32.sub + (get_local $0) + (get_local $1) + ) + (i32.const 65535) + ) + (i32.const -65536) + ) + (i32.const 16) + ) + ) + (i32.gt_s + (get_local $2) + (get_local $3) + ) + ) + ) + (i32.const 0) + ) + (if + (i32.lt_s + (grow_memory + (get_local $3) + ) + (i32.const 0) + ) + (unreachable) + ) + ) + ) + (set_global $~lib/allocator/arena/offset + (get_local $0) + ) + (return + (get_local $1) + ) + ) + ) + (i32.const 0) + ) + (func $~lib/collector/itcm/ManagedObjectList#clear (; 1 ;) (; has Stack IR ;) (type $iv) (param $0 i32) + (i32.store + (get_local $0) + (get_local $0) + ) + (i32.store offset=4 + (get_local $0) + (get_local $0) + ) + ) + (func $~lib/collector/itcm/ManagedObject#get:color (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (i32.and + (i32.load + (get_local $0) + ) + (i32.const 3) + ) + ) + (func $~lib/collector/itcm/ManagedObject#get:next (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (i32.and + (i32.load + (get_local $0) + ) + (i32.const -4) + ) + ) + (func $~lib/collector/itcm/ManagedObject#set:next (; 4 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store + (get_local $0) + (i32.or + (get_local $1) + (i32.and + (i32.load + (get_local $0) + ) + (i32.const 3) + ) + ) + ) + ) + (func $~lib/collector/itcm/ManagedObject#unlink (; 5 ;) (; has Stack IR ;) (type $iv) (param $0 i32) + (local $1 i32) + (i32.store offset=4 + (tee_local $1 + (call $~lib/collector/itcm/ManagedObject#get:next + (get_local $0) + ) + ) + (tee_local $0 + (i32.load offset=4 + (get_local $0) + ) + ) + ) + (call $~lib/collector/itcm/ManagedObject#set:next + (get_local $0) + (get_local $1) + ) + ) + (func $~lib/collector/itcm/ManagedObjectList#push (; 6 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) + (local $2 i32) + (set_local $2 + (i32.load offset=4 + (get_local $0) + ) + ) + (call $~lib/collector/itcm/ManagedObject#set:next + (get_local $1) + (get_local $0) + ) + (i32.store offset=4 + (get_local $1) + (get_local $2) + ) + (call $~lib/collector/itcm/ManagedObject#set:next + (get_local $2) + (get_local $1) + ) + (i32.store offset=4 + (get_local $0) + (get_local $1) + ) + ) + (func $~lib/collector/itcm/ManagedObject#makeGray (; 7 ;) (; has Stack IR ;) (type $iv) (param $0 i32) + (if + (i32.eq + (get_local $0) + (get_global $~lib/collector/itcm/iter) + ) + (set_global $~lib/collector/itcm/iter + (i32.load offset=4 + (get_local $0) + ) + ) + ) + (call $~lib/collector/itcm/ManagedObject#unlink + (get_local $0) + ) + (call $~lib/collector/itcm/ManagedObjectList#push + (get_global $~lib/collector/itcm/toSpace) + (get_local $0) + ) + (i32.store + (get_local $0) + (i32.or + (i32.and + (i32.load + (get_local $0) + ) + (i32.const -4) + ) + (i32.const 2) + ) + ) + ) + (func $~lib/collector/itcm/__gc_mark (; 8 ;) (; has Stack IR ;) (type $iv) (param $0 i32) + (local $1 i32) + (if + (get_local $0) + (if + (i32.eq + (call $~lib/collector/itcm/ManagedObject#get:color + (tee_local $1 + (i32.sub + (get_local $0) + (i32.const 16) + ) + ) + ) + (get_global $~lib/collector/itcm/white) + ) + (call $~lib/collector/itcm/ManagedObject#makeGray + (get_local $1) + ) + ) + ) + ) + (func $~lib/collector/itcm/ManagedObject#set:color (; 9 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store + (get_local $0) + (i32.or + (i32.and + (i32.load + (get_local $0) + ) + (i32.const -4) + ) + (get_local $1) + ) + ) + ) + (func $~lib/allocator/arena/__memory_free (; 10 ;) (; has Stack IR ;) (type $iv) (param $0 i32) + (nop) + ) + (func $~lib/collector/itcm/step (; 11 ;) (; has Stack IR ;) (type $v) + (local $0 i32) + (block $break|0 + (block $case3|0 + (block $case2|0 + (block $case1|0 + (if + (tee_local $0 + (get_global $~lib/collector/itcm/state) + ) + (block + (block $tablify|0 + (br_table $case1|0 $case2|0 $case3|0 $tablify|0 + (i32.sub + (get_local $0) + (i32.const 1) + ) + ) + ) + (br $break|0) + ) + ) + (set_global $~lib/collector/itcm/fromSpace + (tee_local $0 + (call $~lib/allocator/arena/__memory_allocate + (i32.const 16) + ) + ) + ) + (i32.store offset=8 + (get_global $~lib/collector/itcm/fromSpace) + (i32.const -1) + ) + (call $~lib/collector/itcm/ManagedObjectList#clear + (get_global $~lib/collector/itcm/fromSpace) + ) + (set_global $~lib/collector/itcm/toSpace + (tee_local $0 + (call $~lib/allocator/arena/__memory_allocate + (i32.const 16) + ) + ) + ) + (i32.store offset=8 + (get_global $~lib/collector/itcm/toSpace) + (i32.const -1) + ) + (call $~lib/collector/itcm/ManagedObjectList#clear + (get_global $~lib/collector/itcm/toSpace) + ) + (set_global $~lib/collector/itcm/iter + (get_global $~lib/collector/itcm/toSpace) + ) + (set_global $~lib/collector/itcm/state + (i32.const 1) + ) + ) + (call $~iterateRoots + (i32.const 0) + ) + (set_global $~lib/collector/itcm/state + (i32.const 2) + ) + (br $break|0) + ) + (if + (i32.ne + (tee_local $0 + (call $~lib/collector/itcm/ManagedObject#get:next + (get_global $~lib/collector/itcm/iter) + ) + ) + (get_global $~lib/collector/itcm/toSpace) + ) + (block + (set_global $~lib/collector/itcm/iter + (get_local $0) + ) + (call $~lib/collector/itcm/ManagedObject#set:color + (get_local $0) + (i32.eqz + (get_global $~lib/collector/itcm/white) + ) + ) + (set_global $~argc + (i32.const 1) + ) + (call_indirect (type $iv) + (i32.add + (get_local $0) + (i32.const 16) + ) + (i32.load offset=8 + (get_local $0) + ) + ) + ) + (block + (call $~iterateRoots + (i32.const 0) + ) + (if + (i32.eq + (call $~lib/collector/itcm/ManagedObject#get:next + (get_global $~lib/collector/itcm/iter) + ) + (get_global $~lib/collector/itcm/toSpace) + ) + (block + (set_local $0 + (get_global $~lib/collector/itcm/fromSpace) + ) + (set_global $~lib/collector/itcm/fromSpace + (get_global $~lib/collector/itcm/toSpace) + ) + (set_global $~lib/collector/itcm/toSpace + (get_local $0) + ) + (set_global $~lib/collector/itcm/white + (i32.eqz + (get_global $~lib/collector/itcm/white) + ) + ) + (set_global $~lib/collector/itcm/iter + (call $~lib/collector/itcm/ManagedObject#get:next + (get_local $0) + ) + ) + (set_global $~lib/collector/itcm/state + (i32.const 3) + ) + ) + ) + ) + ) + (br $break|0) + ) + (if + (i32.ne + (tee_local $0 + (get_global $~lib/collector/itcm/iter) + ) + (get_global $~lib/collector/itcm/toSpace) + ) + (block + (set_global $~lib/collector/itcm/iter + (call $~lib/collector/itcm/ManagedObject#get:next + (get_local $0) + ) + ) + (if + (i32.ge_u + (get_local $0) + (i32.const 8) + ) + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + ) + ) + (block + (call $~lib/collector/itcm/ManagedObjectList#clear + (get_global $~lib/collector/itcm/toSpace) + ) + (set_global $~lib/collector/itcm/state + (i32.const 1) + ) + ) + ) + ) + ) + (func $~lib/collector/itcm/__gc_allocate (; 12 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (if + (i32.gt_u + (get_local $0) + (i32.const 1073741808) + ) + (unreachable) + ) + (call $~lib/collector/itcm/step) + (i32.store offset=8 + (tee_local $0 + (call $~lib/allocator/arena/__memory_allocate + (i32.add + (get_local $0) + (i32.const 16) + ) + ) + ) + (get_local $1) + ) + (call $~lib/collector/itcm/ManagedObject#set:color + (get_local $0) + (get_global $~lib/collector/itcm/white) + ) + (call $~lib/collector/itcm/ManagedObjectList#push + (get_global $~lib/collector/itcm/fromSpace) + (get_local $0) + ) + (i32.add + (get_local $0) + (i32.const 16) + ) + ) + (func $std/gc-object/Base~gc (; 13 ;) (; has Stack IR ;) (type $iv) (param $0 i32) + (if + (i32.eqz + (get_local $0) + ) + (return) + ) + (call $~lib/collector/itcm/__gc_mark + (get_local $0) + ) + ) + (func $std/gc-object/Custom~gc (; 14 ;) (; has Stack IR ;) (type $iv) (param $0 i32) + (if + (i32.eqz + (get_local $0) + ) + (return) + ) + (call_indirect (type $iv) + (get_local $0) + (i32.const 2) + ) + (call $~lib/collector/itcm/__gc_mark + (i32.load + (get_local $0) + ) + ) + (call $~lib/collector/itcm/__gc_mark + (i32.load offset=4 + (get_local $0) + ) + ) + ) + (func $~lib/collector/itcm/__gc_collect (; 15 ;) (; has Stack IR ;) (type $v) + (local $0 i32) + (block $break|0 + (block $case1|0 + (br_if $case1|0 + (i32.eqz + (tee_local $0 + (get_global $~lib/collector/itcm/state) + ) + ) + ) + (br_if $case1|0 + (i32.eq + (get_local $0) + (i32.const 1) + ) + ) + (br $break|0) + ) + (call $~lib/collector/itcm/step) + ) + (loop $continue|1 + (if + (i32.ne + (get_global $~lib/collector/itcm/state) + (i32.const 1) + ) + (block + (call $~lib/collector/itcm/step) + (br $continue|1) + ) + ) + ) + ) + (func $~lib/gc/gc.collect (; 16 ;) (; has Stack IR ;) (type $v) + (call $~lib/collector/itcm/__gc_collect) + ) + (func $std/gc-object/main (; 17 ;) (; has Stack IR ;) (type $v) + (if + (i32.eqz + (get_global $~started) + ) + (block + (call $start) + (set_global $~started + (i32.const 1) + ) + ) + ) + ) + (func $start (; 18 ;) (; has Stack IR ;) (type $v) + (local $0 i32) + (set_global $~lib/allocator/arena/startOffset + (i32.const 8) + ) + (set_global $~lib/allocator/arena/offset + (get_global $~lib/allocator/arena/startOffset) + ) + (set_global $~lib/collector/itcm/state + (i32.const 0) + ) + (i32.store + (tee_local $0 + (call $~lib/collector/itcm/__gc_allocate + (i32.const 8) + (i32.const 1) + ) + ) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $0) + (i32.const 0) + ) + (set_global $std/gc-object/obj + (get_local $0) + ) + (call $~lib/gc/gc.collect) + (i32.store + (get_global $std/gc-object/obj) + (get_global $std/gc-object/obj) + ) + (call $~lib/gc/gc.collect) + (set_global $std/gc-object/obj + (i32.const 0) + ) + (call $~lib/gc/gc.collect) + ) + (func $~iterateRoots (; 19 ;) (; has Stack IR ;) (type $iv) (param $0 i32) + (call_indirect (type $iv) + (get_global $std/gc-object/obj) + (get_local $0) + ) + ) +) diff --git a/tests/compiler/std/gc-object.ts b/tests/compiler/std/gc-object.ts new file mode 100644 index 00000000..4d04737b --- /dev/null +++ b/tests/compiler/std/gc-object.ts @@ -0,0 +1,24 @@ +import "allocator/arena"; +import "collector/itcm"; + +class Base { +} + +class Custom extends Base { + a: Custom; + b: Base; +} + +var obj: Custom | null = new Custom(); + +gc.collect(); + +obj.a = obj; + +gc.collect(); + +obj = null; + +gc.collect(); + +export function main(): void {} diff --git a/tests/compiler/std/gc-object.untouched.wat b/tests/compiler/std/gc-object.untouched.wat new file mode 100644 index 00000000..0ccff193 --- /dev/null +++ b/tests/compiler/std/gc-object.untouched.wat @@ -0,0 +1,724 @@ +(module + (type $iii (func (param i32 i32) (result i32))) + (type $v (func)) + (type $ii (func (param i32) (result i32))) + (type $iv (func (param i32))) + (type $iiv (func (param i32 i32))) + (global $~lib/internal/allocator/AL_BITS i32 (i32.const 3)) + (global $~lib/internal/allocator/AL_SIZE i32 (i32.const 8)) + (global $~lib/internal/allocator/AL_MASK i32 (i32.const 7)) + (global $~lib/internal/allocator/MAX_SIZE_32 i32 (i32.const 1073741824)) + (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) + (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/TRACE i32 (i32.const 0)) + (global $~lib/collector/itcm/HEADER_SIZE i32 (i32.const 16)) + (global $~lib/collector/itcm/State.INIT i32 (i32.const 0)) + (global $~lib/collector/itcm/State.IDLE i32 (i32.const 1)) + (global $~lib/collector/itcm/State.MARK i32 (i32.const 2)) + (global $~lib/collector/itcm/State.SWEEP i32 (i32.const 3)) + (global $~lib/collector/itcm/state (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/white (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/fromSpace (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/toSpace (mut i32) (i32.const 0)) + (global $~lib/collector/itcm/iter (mut i32) (i32.const 0)) + (global $~argc (mut i32) (i32.const 0)) + (global $std/gc-object/obj (mut i32) (i32.const 0)) + (global $~started (mut i32) (i32.const 0)) + (global $HEAP_BASE i32 (i32.const 8)) + (table 3 3 anyfunc) + (elem (i32.const 0) $~lib/collector/itcm/__gc_mark $std/gc-object/Custom~gc $std/gc-object/Base~gc) + (memory $0 0) + (export "memory" (memory $0)) + (export "table" (table $0)) + (export "main" (func $std/gc-object/main)) + (func $~lib/allocator/arena/__memory_allocate (; 0 ;) (type $ii) (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) + (if + (get_local $0) + (block + (if + (i32.gt_u + (get_local $0) + (get_global $~lib/internal/allocator/MAX_SIZE_32) + ) + (unreachable) + ) + (set_local $1 + (get_global $~lib/allocator/arena/offset) + ) + (set_local $2 + (i32.and + (i32.add + (i32.add + (get_local $1) + (get_local $0) + ) + (get_global $~lib/internal/allocator/AL_MASK) + ) + (i32.xor + (get_global $~lib/internal/allocator/AL_MASK) + (i32.const -1) + ) + ) + ) + (set_local $3 + (current_memory) + ) + (if + (i32.gt_u + (get_local $2) + (i32.shl + (get_local $3) + (i32.const 16) + ) + ) + (block + (set_local $4 + (i32.shr_u + (i32.and + (i32.add + (i32.sub + (get_local $2) + (get_local $1) + ) + (i32.const 65535) + ) + (i32.xor + (i32.const 65535) + (i32.const -1) + ) + ) + (i32.const 16) + ) + ) + (set_local $5 + (select + (tee_local $5 + (get_local $3) + ) + (tee_local $6 + (get_local $4) + ) + (i32.gt_s + (get_local $5) + (get_local $6) + ) + ) + ) + (if + (i32.lt_s + (grow_memory + (get_local $5) + ) + (i32.const 0) + ) + (if + (i32.lt_s + (grow_memory + (get_local $4) + ) + (i32.const 0) + ) + (unreachable) + ) + ) + ) + ) + (set_global $~lib/allocator/arena/offset + (get_local $2) + ) + (return + (get_local $1) + ) + ) + ) + (i32.const 0) + ) + (func $~lib/collector/itcm/ManagedObjectList#clear (; 1 ;) (type $iv) (param $0 i32) + (i32.store + (get_local $0) + (get_local $0) + ) + (i32.store offset=4 + (get_local $0) + (get_local $0) + ) + ) + (func $~lib/collector/itcm/ManagedObject#get:color (; 2 ;) (type $ii) (param $0 i32) (result i32) + (i32.and + (i32.load + (get_local $0) + ) + (i32.const 3) + ) + ) + (func $~lib/collector/itcm/ManagedObject#get:next (; 3 ;) (type $ii) (param $0 i32) (result i32) + (i32.and + (i32.load + (get_local $0) + ) + (i32.xor + (i32.const 3) + (i32.const -1) + ) + ) + ) + (func $~lib/collector/itcm/ManagedObject#set:next (; 4 ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store + (get_local $0) + (i32.or + (get_local $1) + (i32.and + (i32.load + (get_local $0) + ) + (i32.const 3) + ) + ) + ) + ) + (func $~lib/collector/itcm/ManagedObject#unlink (; 5 ;) (type $iv) (param $0 i32) + (local $1 i32) + (local $2 i32) + (set_local $1 + (call $~lib/collector/itcm/ManagedObject#get:next + (get_local $0) + ) + ) + (set_local $2 + (i32.load offset=4 + (get_local $0) + ) + ) + (i32.store offset=4 + (get_local $1) + (get_local $2) + ) + (call $~lib/collector/itcm/ManagedObject#set:next + (get_local $2) + (get_local $1) + ) + ) + (func $~lib/collector/itcm/ManagedObjectList#push (; 6 ;) (type $iiv) (param $0 i32) (param $1 i32) + (local $2 i32) + (set_local $2 + (i32.load offset=4 + (get_local $0) + ) + ) + (call $~lib/collector/itcm/ManagedObject#set:next + (get_local $1) + (get_local $0) + ) + (i32.store offset=4 + (get_local $1) + (get_local $2) + ) + (call $~lib/collector/itcm/ManagedObject#set:next + (get_local $2) + (get_local $1) + ) + (i32.store offset=4 + (get_local $0) + (get_local $1) + ) + ) + (func $~lib/collector/itcm/ManagedObject#makeGray (; 7 ;) (type $iv) (param $0 i32) + (if + (i32.eq + (get_local $0) + (get_global $~lib/collector/itcm/iter) + ) + (set_global $~lib/collector/itcm/iter + (i32.load offset=4 + (get_local $0) + ) + ) + ) + (call $~lib/collector/itcm/ManagedObject#unlink + (get_local $0) + ) + (call $~lib/collector/itcm/ManagedObjectList#push + (get_global $~lib/collector/itcm/toSpace) + (get_local $0) + ) + (i32.store + (get_local $0) + (i32.or + (i32.and + (i32.load + (get_local $0) + ) + (i32.xor + (i32.const 3) + (i32.const -1) + ) + ) + (i32.const 2) + ) + ) + ) + (func $~lib/collector/itcm/__gc_mark (; 8 ;) (type $iv) (param $0 i32) + (local $1 i32) + (if + (get_local $0) + (block + (set_local $1 + (block $~lib/collector/itcm/refToObj|inlined.0 (result i32) + (i32.sub + (get_local $0) + (get_global $~lib/collector/itcm/HEADER_SIZE) + ) + ) + ) + (if + (i32.eq + (call $~lib/collector/itcm/ManagedObject#get:color + (get_local $1) + ) + (get_global $~lib/collector/itcm/white) + ) + (call $~lib/collector/itcm/ManagedObject#makeGray + (get_local $1) + ) + ) + ) + ) + ) + (func $~lib/collector/itcm/ManagedObject#set:color (; 9 ;) (type $iiv) (param $0 i32) (param $1 i32) + (i32.store + (get_local $0) + (i32.or + (i32.and + (i32.load + (get_local $0) + ) + (i32.xor + (i32.const 3) + (i32.const -1) + ) + ) + (get_local $1) + ) + ) + ) + (func $~lib/allocator/arena/__memory_free (; 10 ;) (type $iv) (param $0 i32) + (nop) + ) + (func $~lib/collector/itcm/step (; 11 ;) (type $v) + (local $0 i32) + (local $1 i32) + (block $break|0 + (block $case3|0 + (block $case2|0 + (block $case1|0 + (block $case0|0 + (set_local $1 + (get_global $~lib/collector/itcm/state) + ) + (br_if $case0|0 + (i32.eq + (get_local $1) + (get_global $~lib/collector/itcm/State.INIT) + ) + ) + (br_if $case1|0 + (i32.eq + (get_local $1) + (get_global $~lib/collector/itcm/State.IDLE) + ) + ) + (br_if $case2|0 + (i32.eq + (get_local $1) + (get_global $~lib/collector/itcm/State.MARK) + ) + ) + (br_if $case3|0 + (i32.eq + (get_local $1) + (get_global $~lib/collector/itcm/State.SWEEP) + ) + ) + (br $break|0) + ) + (block + (set_global $~lib/collector/itcm/fromSpace + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $1 + (get_global $~lib/collector/itcm/HEADER_SIZE) + ) + (br $~lib/memory/memory.allocate|inlined.0 + (call $~lib/allocator/arena/__memory_allocate + (get_local $1) + ) + ) + ) + ) + (i32.store offset=8 + (get_global $~lib/collector/itcm/fromSpace) + (i32.const -1) + ) + (call $~lib/collector/itcm/ManagedObjectList#clear + (get_global $~lib/collector/itcm/fromSpace) + ) + (set_global $~lib/collector/itcm/toSpace + (block $~lib/memory/memory.allocate|inlined.1 (result i32) + (set_local $1 + (get_global $~lib/collector/itcm/HEADER_SIZE) + ) + (br $~lib/memory/memory.allocate|inlined.1 + (call $~lib/allocator/arena/__memory_allocate + (get_local $1) + ) + ) + ) + ) + (i32.store offset=8 + (get_global $~lib/collector/itcm/toSpace) + (i32.const -1) + ) + (call $~lib/collector/itcm/ManagedObjectList#clear + (get_global $~lib/collector/itcm/toSpace) + ) + (set_global $~lib/collector/itcm/iter + (get_global $~lib/collector/itcm/toSpace) + ) + (set_global $~lib/collector/itcm/state + (get_global $~lib/collector/itcm/State.IDLE) + ) + ) + ) + (block + (call $~iterateRoots + (i32.const 0) + ) + (set_global $~lib/collector/itcm/state + (get_global $~lib/collector/itcm/State.MARK) + ) + (br $break|0) + ) + ) + (block + (set_local $0 + (call $~lib/collector/itcm/ManagedObject#get:next + (get_global $~lib/collector/itcm/iter) + ) + ) + (if + (i32.ne + (get_local $0) + (get_global $~lib/collector/itcm/toSpace) + ) + (block + (set_global $~lib/collector/itcm/iter + (get_local $0) + ) + (call $~lib/collector/itcm/ManagedObject#set:color + (get_local $0) + (i32.eqz + (get_global $~lib/collector/itcm/white) + ) + ) + (set_global $~argc + (i32.const 1) + ) + (call_indirect (type $iv) + (block $~lib/collector/itcm/objToRef|inlined.0 (result i32) + (i32.add + (get_local $0) + (get_global $~lib/collector/itcm/HEADER_SIZE) + ) + ) + (i32.load offset=8 + (get_local $0) + ) + ) + ) + (block + (call $~iterateRoots + (i32.const 0) + ) + (set_local $0 + (call $~lib/collector/itcm/ManagedObject#get:next + (get_global $~lib/collector/itcm/iter) + ) + ) + (if + (i32.eq + (get_local $0) + (get_global $~lib/collector/itcm/toSpace) + ) + (block + (set_local $1 + (get_global $~lib/collector/itcm/fromSpace) + ) + (set_global $~lib/collector/itcm/fromSpace + (get_global $~lib/collector/itcm/toSpace) + ) + (set_global $~lib/collector/itcm/toSpace + (get_local $1) + ) + (set_global $~lib/collector/itcm/white + (i32.eqz + (get_global $~lib/collector/itcm/white) + ) + ) + (set_global $~lib/collector/itcm/iter + (call $~lib/collector/itcm/ManagedObject#get:next + (get_local $1) + ) + ) + (set_global $~lib/collector/itcm/state + (get_global $~lib/collector/itcm/State.SWEEP) + ) + ) + ) + ) + ) + (br $break|0) + ) + ) + (block + (set_local $0 + (get_global $~lib/collector/itcm/iter) + ) + (if + (i32.ne + (get_local $0) + (get_global $~lib/collector/itcm/toSpace) + ) + (block + (set_global $~lib/collector/itcm/iter + (call $~lib/collector/itcm/ManagedObject#get:next + (get_local $0) + ) + ) + (if + (i32.ge_u + (get_local $0) + (get_global $HEAP_BASE) + ) + (block $~lib/memory/memory.free|inlined.0 + (block + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + (br $~lib/memory/memory.free|inlined.0) + ) + ) + ) + ) + (block + (call $~lib/collector/itcm/ManagedObjectList#clear + (get_global $~lib/collector/itcm/toSpace) + ) + (set_global $~lib/collector/itcm/state + (get_global $~lib/collector/itcm/State.IDLE) + ) + ) + ) + (br $break|0) + ) + ) + ) + (func $~lib/collector/itcm/__gc_allocate (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (local $2 i32) + (local $3 i32) + (if + (i32.gt_u + (get_local $0) + (i32.sub + (get_global $~lib/internal/allocator/MAX_SIZE_32) + (get_global $~lib/collector/itcm/HEADER_SIZE) + ) + ) + (unreachable) + ) + (call $~lib/collector/itcm/step) + (set_local $3 + (block $~lib/memory/memory.allocate|inlined.2 (result i32) + (set_local $2 + (i32.add + (get_global $~lib/collector/itcm/HEADER_SIZE) + (get_local $0) + ) + ) + (br $~lib/memory/memory.allocate|inlined.2 + (call $~lib/allocator/arena/__memory_allocate + (get_local $2) + ) + ) + ) + ) + (i32.store offset=8 + (get_local $3) + (get_local $1) + ) + (call $~lib/collector/itcm/ManagedObject#set:color + (get_local $3) + (get_global $~lib/collector/itcm/white) + ) + (call $~lib/collector/itcm/ManagedObjectList#push + (get_global $~lib/collector/itcm/fromSpace) + (get_local $3) + ) + (block $~lib/collector/itcm/objToRef|inlined.1 (result i32) + (i32.add + (get_local $3) + (get_global $~lib/collector/itcm/HEADER_SIZE) + ) + ) + ) + (func $std/gc-object/Base~gc (; 13 ;) (type $iv) (param $0 i32) + (if + (i32.eqz + (get_local $0) + ) + (return) + ) + (call $~lib/collector/itcm/__gc_mark + (get_local $0) + ) + ) + (func $std/gc-object/Custom~gc (; 14 ;) (type $iv) (param $0 i32) + (if + (i32.eqz + (get_local $0) + ) + (return) + ) + (call_indirect (type $iv) + (get_local $0) + (i32.const 2) + ) + (call $~lib/collector/itcm/__gc_mark + (i32.load + (get_local $0) + ) + ) + (call $~lib/collector/itcm/__gc_mark + (i32.load offset=4 + (get_local $0) + ) + ) + ) + (func $~lib/collector/itcm/__gc_collect (; 15 ;) (type $v) + (local $0 i32) + (block $break|0 + (block $case1|0 + (block $case0|0 + (set_local $0 + (get_global $~lib/collector/itcm/state) + ) + (br_if $case0|0 + (i32.eq + (get_local $0) + (get_global $~lib/collector/itcm/State.INIT) + ) + ) + (br_if $case1|0 + (i32.eq + (get_local $0) + (get_global $~lib/collector/itcm/State.IDLE) + ) + ) + (br $break|0) + ) + ) + (call $~lib/collector/itcm/step) + ) + (block $break|1 + (loop $continue|1 + (if + (i32.ne + (get_global $~lib/collector/itcm/state) + (get_global $~lib/collector/itcm/State.IDLE) + ) + (block + (call $~lib/collector/itcm/step) + (br $continue|1) + ) + ) + ) + ) + ) + (func $~lib/gc/gc.collect (; 16 ;) (type $v) + (call $~lib/collector/itcm/__gc_collect) + (return) + ) + (func $std/gc-object/main (; 17 ;) (type $v) + (if + (i32.eqz + (get_global $~started) + ) + (block + (call $start) + (set_global $~started + (i32.const 1) + ) + ) + ) + ) + (func $start (; 18 ;) (type $v) + (local $0 i32) + (set_global $~lib/allocator/arena/startOffset + (i32.and + (i32.add + (get_global $HEAP_BASE) + (get_global $~lib/internal/allocator/AL_MASK) + ) + (i32.xor + (get_global $~lib/internal/allocator/AL_MASK) + (i32.const -1) + ) + ) + ) + (set_global $~lib/allocator/arena/offset + (get_global $~lib/allocator/arena/startOffset) + ) + (set_global $~lib/collector/itcm/state + (get_global $~lib/collector/itcm/State.INIT) + ) + (set_global $std/gc-object/obj + (block (result i32) + (set_local $0 + (call $~lib/collector/itcm/__gc_allocate + (i32.const 8) + (i32.const 1) + ) + ) + (i32.store + (get_local $0) + (i32.const 0) + ) + (i32.store offset=4 + (get_local $0) + (i32.const 0) + ) + (get_local $0) + ) + ) + (call $~lib/gc/gc.collect) + (i32.store + (get_global $std/gc-object/obj) + (get_global $std/gc-object/obj) + ) + (call $~lib/gc/gc.collect) + (set_global $std/gc-object/obj + (i32.const 0) + ) + (call $~lib/gc/gc.collect) + ) + (func $~iterateRoots (; 19 ;) (type $iv) (param $0 i32) + (call_indirect (type $iv) + (get_global $std/gc-object/obj) + (get_local $0) + ) + ) +) diff --git a/tests/compiler/std/hash.optimized.wat b/tests/compiler/std/hash.optimized.wat index ef7d2550..ab908c3e 100644 --- a/tests/compiler/std/hash.optimized.wat +++ b/tests/compiler/std/hash.optimized.wat @@ -8,7 +8,7 @@ (data (i32.const 28) "\03\00\00\00a\00b\00c") (export "memory" (memory $0)) (start $start) - (func $~lib/internal/hash/hashStr (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hashStr (; 0 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -56,10 +56,10 @@ ) (get_local $2) ) - (func $std/hash/check (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $std/hash/check (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.const 1) ) - (func $~lib/internal/hash/hash32 (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -104,7 +104,7 @@ (i32.const 16777619) ) ) - (func $~lib/internal/hash/hash64 (; 3 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash64 (; 3 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (i32.mul (i32.xor @@ -203,7 +203,7 @@ (i32.const 16777619) ) ) - (func $start (; 4 ;) (type $v) + (func $start (; 4 ;) (; has Stack IR ;) (type $v) (drop (call $std/hash/check (call $~lib/internal/hash/hashStr diff --git a/tests/compiler/std/hash.untouched.wat b/tests/compiler/std/hash.untouched.wat index c09f890d..3315a22b 100644 --- a/tests/compiler/std/hash.untouched.wat +++ b/tests/compiler/std/hash.untouched.wat @@ -8,7 +8,6 @@ (global $~lib/internal/allocator/MAX_SIZE_32 i32 (i32.const 1073741824)) (global $~lib/internal/string/HEADER_SIZE i32 (i32.const 4)) (global $~lib/internal/string/MAX_LENGTH i32 (i32.const 536870910)) - (global $~lib/internal/string/EMPTY i32 (i32.const 8)) (global $~lib/internal/hash/FNV_OFFSET i32 (i32.const -2128831035)) (global $~lib/internal/hash/FNV_PRIME i32 (i32.const 16777619)) (global $Infinity f64 (f64.const inf)) diff --git a/tests/compiler/std/libm.optimized.wat b/tests/compiler/std/libm.optimized.wat index 834fea7b..e849f2fe 100644 --- a/tests/compiler/std/libm.optimized.wat +++ b/tests/compiler/std/libm.optimized.wat @@ -56,12 +56,12 @@ (export "tan" (func $std/libm/cos)) (export "tanh" (func $std/libm/tanh)) (export "trunc" (func $std/libm/trunc)) - (func $std/libm/abs (; 0 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/abs (; 0 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (f64.abs (get_local $0) ) ) - (func $~lib/math/R (; 1 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/R (; 1 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (f64.div (f64.mul (get_local $0) @@ -124,7 +124,7 @@ ) ) ) - (func $~lib/math/NativeMath.acos (; 2 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.acos (; 2 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 i32) (local $3 f64) @@ -318,12 +318,12 @@ ) ) ) - (func $std/libm/acos (; 3 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/acos (; 3 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.acos (get_local $0) ) ) - (func $~lib/math/NativeMath.log1p (; 4 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log1p (; 4 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 i32) (local $3 i32) @@ -624,7 +624,7 @@ ) ) ) - (func $~lib/math/NativeMath.log (; 5 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log (; 5 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 i32) (local $3 i32) @@ -886,7 +886,7 @@ ) ) ) - (func $~lib/math/NativeMath.acosh (; 6 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.acosh (; 6 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (if (i64.lt_u @@ -966,12 +966,12 @@ (f64.const 0.6931471805599453) ) ) - (func $std/libm/acosh (; 7 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/acosh (; 7 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.acosh (get_local $0) ) ) - (func $~lib/math/NativeMath.asin (; 8 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.asin (; 8 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 i32) (local $3 i32) @@ -1179,12 +1179,12 @@ ) (get_local $0) ) - (func $std/libm/asin (; 9 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/asin (; 9 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.asin (get_local $0) ) ) - (func $~lib/math/NativeMath.asinh (; 10 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.asinh (; 10 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 i64) (local $3 i64) @@ -1303,18 +1303,18 @@ ) (get_local $0) ) - (func $std/libm/asinh (; 11 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/asinh (; 11 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.asinh (get_local $0) ) ) - (func $~lib/builtins/isNaN (; 12 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isNaN (; 12 ;) (; has Stack IR ;) (type $Fi) (param $0 f64) (result i32) (f64.ne (get_local $0) (get_local $0) ) ) - (func $~lib/math/NativeMath.atan (; 13 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.atan (; 13 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 f64) (local $3 f64) @@ -1677,12 +1677,12 @@ ) (get_local $3) ) - (func $std/libm/atan (; 14 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/atan (; 14 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.atan (get_local $0) ) ) - (func $~lib/math/NativeMath.atanh (; 15 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.atanh (; 15 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 i64) (local $3 i64) @@ -1781,12 +1781,12 @@ ) (get_local $0) ) - (func $std/libm/atanh (; 16 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/atanh (; 16 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.atanh (get_local $0) ) ) - (func $~lib/math/NativeMath.atan2 (; 17 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.atan2 (; 17 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2136,13 +2136,13 @@ ) ) ) - (func $std/libm/atan2 (; 18 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/atan2 (; 18 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (call $~lib/math/NativeMath.atan2 (get_local $0) (get_local $1) ) ) - (func $~lib/math/NativeMath.cbrt (; 19 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.cbrt (; 19 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 f64) (local $3 i32) @@ -2325,17 +2325,17 @@ ) ) ) - (func $std/libm/cbrt (; 20 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/cbrt (; 20 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.cbrt (get_local $0) ) ) - (func $std/libm/ceil (; 21 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/ceil (; 21 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (f64.ceil (get_local $0) ) ) - (func $std/libm/clz32 (; 22 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/clz32 (; 22 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (f64.convert_s/i32 (i32.clz (i32.trunc_s/f64 @@ -2344,15 +2344,15 @@ ) ) ) - (func $~lib/math/NativeMath.cos (; 23 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.cos (; 23 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (unreachable) ) - (func $std/libm/cos (; 24 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/cos (; 24 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.cos (get_local $0) ) ) - (func $~lib/math/NativeMath.expm1 (; 25 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.expm1 (; 25 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 i32) (local $3 f64) @@ -2796,7 +2796,7 @@ ) ) ) - (func $~lib/math/NativeMath.scalbn (; 26 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) + (func $~lib/math/NativeMath.scalbn (; 26 ;) (; has Stack IR ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) (local $2 f64) (set_local $2 (get_local $0) @@ -2910,7 +2910,7 @@ ) ) ) - (func $~lib/math/NativeMath.exp (; 27 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.exp (; 27 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 i32) (local $3 i32) @@ -3114,7 +3114,7 @@ (get_local $2) ) ) - (func $~lib/math/expo2 (; 28 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/expo2 (; 28 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (f64.mul (f64.mul (call $~lib/math/NativeMath.exp @@ -3128,7 +3128,7 @@ (f64.const 2247116418577894884661631e283) ) ) - (func $~lib/math/NativeMath.cosh (; 29 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.cosh (; 29 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 i64) (set_local $0 @@ -3215,32 +3215,32 @@ (get_local $0) ) ) - (func $std/libm/cosh (; 30 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/cosh (; 30 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.cosh (get_local $0) ) ) - (func $std/libm/exp (; 31 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/exp (; 31 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.exp (get_local $0) ) ) - (func $std/libm/expm1 (; 32 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/expm1 (; 32 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.expm1 (get_local $0) ) ) - (func $std/libm/floor (; 33 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/floor (; 33 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (f64.floor (get_local $0) ) ) - (func $std/libm/fround (; 34 ;) (type $Ff) (param $0 f64) (result f32) + (func $std/libm/fround (; 34 ;) (; has Stack IR ;) (type $Ff) (param $0 f64) (result f32) (f32.demote/f64 (get_local $0) ) ) - (func $~lib/math/NativeMath.hypot (; 35 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.hypot (; 35 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 f64) (local $3 f64) (local $4 i64) @@ -3513,13 +3513,13 @@ ) ) ) - (func $std/libm/hypot (; 36 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/hypot (; 36 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (call $~lib/math/NativeMath.hypot (get_local $0) (get_local $1) ) ) - (func $~lib/math/NativeMath.imul (; 37 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.imul (; 37 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (f64.convert_s/i32 (i32.mul (i32.trunc_s/f64 @@ -3531,18 +3531,18 @@ ) ) ) - (func $std/libm/imul (; 38 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/imul (; 38 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (call $~lib/math/NativeMath.imul (get_local $0) (get_local $1) ) ) - (func $std/libm/log (; 39 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/log (; 39 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.log (get_local $0) ) ) - (func $~lib/math/NativeMath.log10 (; 40 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log10 (; 40 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 f64) (local $3 i32) @@ -3865,17 +3865,17 @@ ) ) ) - (func $std/libm/log10 (; 41 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/log10 (; 41 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.log10 (get_local $0) ) ) - (func $std/libm/log1p (; 42 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/log1p (; 42 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.log1p (get_local $0) ) ) - (func $~lib/math/NativeMath.log2 (; 43 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log2 (; 43 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 f64) (local $3 i32) @@ -4186,24 +4186,24 @@ ) ) ) - (func $std/libm/log2 (; 44 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/log2 (; 44 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.log2 (get_local $0) ) ) - (func $std/libm/max (; 45 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/max (; 45 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (f64.max (get_local $0) (get_local $1) ) ) - (func $std/libm/min (; 46 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/min (; 46 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (f64.min (get_local $0) (get_local $1) ) ) - (func $~lib/math/NativeMath.pow (; 47 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.pow (; 47 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 f64) (local $3 f64) (local $4 i32) @@ -5630,13 +5630,13 @@ (f64.const 1.e+300) ) ) - (func $std/libm/pow (; 48 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $std/libm/pow (; 48 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (call $~lib/math/NativeMath.pow (get_local $0) (get_local $1) ) ) - (func $~lib/math/NativeMath.round (; 49 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.round (; 49 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 i64) (local $3 i32) @@ -5769,12 +5769,12 @@ ) ) ) - (func $std/libm/round (; 50 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/round (; 50 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.round (get_local $0) ) ) - (func $std/libm/sign (; 51 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/sign (; 51 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (if (result f64) (f64.gt (f64.abs @@ -5789,7 +5789,7 @@ (get_local $0) ) ) - (func $~lib/math/NativeMath.sinh (; 52 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.sinh (; 52 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 f64) (local $3 i64) @@ -5906,17 +5906,17 @@ ) ) ) - (func $std/libm/sinh (; 53 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/sinh (; 53 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.sinh (get_local $0) ) ) - (func $std/libm/sqrt (; 54 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/sqrt (; 54 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (f64.sqrt (get_local $0) ) ) - (func $~lib/math/NativeMath.tanh (; 55 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.tanh (; 55 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 i32) (local $3 i32) @@ -6041,12 +6041,12 @@ ) (get_local $0) ) - (func $std/libm/tanh (; 56 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/tanh (; 56 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (call $~lib/math/NativeMath.tanh (get_local $0) ) ) - (func $std/libm/trunc (; 57 ;) (type $FF) (param $0 f64) (result f64) + (func $std/libm/trunc (; 57 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (f64.trunc (get_local $0) ) diff --git a/tests/compiler/std/libm.untouched.wat b/tests/compiler/std/libm.untouched.wat index a601a0a4..5c7e3066 100644 --- a/tests/compiler/std/libm.untouched.wat +++ b/tests/compiler/std/libm.untouched.wat @@ -5128,48 +5128,51 @@ (get_local $8) (i32.const 2146435072) ) - (if - (i32.eq - (i32.or - (i32.sub + (block + (if + (i32.eq + (i32.or + (i32.sub + (get_local $7) + (i32.const 1072693248) + ) + (get_local $4) + ) + (i32.const 0) + ) + (return + (f64.const nan:0x8000000000000) + ) + (if + (i32.ge_s (get_local $7) (i32.const 1072693248) ) - (get_local $4) - ) - (i32.const 0) - ) - (return - (f64.const nan:0x8000000000000) - ) - (if - (i32.ge_s - (get_local $7) - (i32.const 1072693248) - ) - (return - (if (result f64) - (i32.ge_s - (get_local $5) - (i32.const 0) - ) - (get_local $1) - (f64.const 0) - ) - ) - (return - (if (result f64) - (i32.ge_s - (get_local $5) - (i32.const 0) - ) - (f64.const 0) - (f64.neg + (return + (if (result f64) + (i32.ge_s + (get_local $5) + (i32.const 0) + ) (get_local $1) + (f64.const 0) + ) + ) + (return + (if (result f64) + (i32.ge_s + (get_local $5) + (i32.const 0) + ) + (f64.const 0) + (f64.neg + (get_local $1) + ) ) ) ) ) + (unreachable) ) ) (if diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index 1e0dde64..60d228fe 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -26,7 +26,7 @@ (data (i32.const 112) "\n\00\00\00s\00t\00d\00/\00m\00a\00p\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -112,12 +112,12 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/allocator/arena/__memory_allocate (get_local $0) ) ) - (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -131,7 +131,7 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 4 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -142,7 +142,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 52) - (i32.const 22) + (i32.const 23) (i32.const 2) ) (unreachable) @@ -150,7 +150,7 @@ ) (i32.store (tee_local $1 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -160,7 +160,7 @@ ) (get_local $1) ) - (func $~lib/memory/memset (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memset (; 5 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -490,14 +490,7 @@ ) ) ) - (func $~lib/memory/memory.fill (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 6 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u @@ -515,7 +508,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $1) ) ) @@ -526,7 +519,7 @@ (i32.const 1) ) ) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (i32.add (get_local $3) (i32.const 8) @@ -537,7 +530,7 @@ ) (get_local $3) ) - (func $~lib/map/Map#clear (; 8 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 7 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -571,7 +564,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 8 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -612,7 +605,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash8 (; 10 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash8 (; 9 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (get_local $0) @@ -621,7 +614,7 @@ (i32.const 16777619) ) ) - (func $~lib/map/Map#find (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 10 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -687,7 +680,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 11 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -705,7 +698,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 13 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 12 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -868,7 +861,7 @@ ) ) ) - (func $~lib/map/Map#set (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 13 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1011,7 +1004,7 @@ ) ) ) - (func $~lib/map/Map#get (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 14 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -1036,12 +1029,12 @@ ) ) ) - (func $~lib/map/Map#get:size (; 16 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 15 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 16 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -1142,7 +1135,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 18 ;) (type $v) + (func $std/map/test (; 17 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -1628,7 +1621,7 @@ ) ) ) - (func $~lib/map/Map#has (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 18 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -1643,7 +1636,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 20 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 19 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1806,7 +1799,7 @@ ) ) ) - (func $~lib/map/Map#set (; 21 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 20 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1946,7 +1939,7 @@ ) ) ) - (func $~lib/map/Map#get (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 21 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -1968,7 +1961,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 22 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -2066,7 +2059,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 24 ;) (type $v) + (func $std/map/test (; 23 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -2531,7 +2524,7 @@ ) ) ) - (func $~lib/internal/hash/hash16 (; 25 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash16 (; 24 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -2552,7 +2545,7 @@ (i32.const 16777619) ) ) - (func $~lib/map/Map#find (; 26 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 25 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -2618,7 +2611,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 26 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -2636,7 +2629,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 28 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 27 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2799,7 +2792,7 @@ ) ) ) - (func $~lib/map/Map#set (; 29 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 28 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2942,7 +2935,7 @@ ) ) ) - (func $~lib/map/Map#get (; 30 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 29 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -2967,7 +2960,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 31 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 30 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -3068,7 +3061,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 32 ;) (type $v) + (func $std/map/test (; 31 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -3554,7 +3547,7 @@ ) ) ) - (func $~lib/map/Map#has (; 33 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 32 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -3569,7 +3562,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 34 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 33 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3732,7 +3725,7 @@ ) ) ) - (func $~lib/map/Map#set (; 35 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 34 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3872,7 +3865,7 @@ ) ) ) - (func $~lib/map/Map#get (; 36 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 35 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -3894,7 +3887,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 37 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 36 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -3992,7 +3985,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 38 ;) (type $v) + (func $std/map/test (; 37 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -4457,7 +4450,7 @@ ) ) ) - (func $~lib/internal/hash/hash32 (; 39 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 38 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -4502,7 +4495,7 @@ (i32.const 16777619) ) ) - (func $~lib/map/Map#find (; 40 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 39 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -4565,7 +4558,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 41 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 40 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -4577,7 +4570,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 42 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 41 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4740,7 +4733,7 @@ ) ) ) - (func $~lib/map/Map#set (; 43 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 42 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4877,7 +4870,7 @@ ) ) ) - (func $~lib/map/Map#get (; 44 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 43 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -4896,7 +4889,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 45 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 44 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -4991,7 +4984,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 46 ;) (type $v) + (func $std/map/test (; 45 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -5435,7 +5428,7 @@ ) ) ) - (func $std/map/test (; 47 ;) (type $v) + (func $std/map/test (; 46 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -5879,7 +5872,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 48 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 47 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -5913,7 +5906,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 49 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 48 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -5954,7 +5947,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash64 (; 50 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash64 (; 49 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (i32.mul (i32.xor @@ -6053,7 +6046,7 @@ (i32.const 16777619) ) ) - (func $~lib/map/Map#find (; 51 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 50 ;) (; has Stack IR ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -6116,7 +6109,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 52 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#has (; 51 ;) (; has Stack IR ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -6128,7 +6121,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 53 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 52 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6291,7 +6284,7 @@ ) ) ) - (func $~lib/map/Map#set (; 54 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/map/Map#set (; 53 ;) (; has Stack IR ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -6428,7 +6421,7 @@ ) ) ) - (func $~lib/map/Map#get (; 55 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#get (; 54 ;) (; has Stack IR ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -6447,7 +6440,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 56 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#delete (; 55 ;) (; has Stack IR ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (if @@ -6543,7 +6536,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 57 ;) (type $v) + (func $std/map/test (; 56 ;) (; has Stack IR ;) (type $v) (local $0 i64) (local $1 i32) (set_local $1 @@ -7001,7 +6994,7 @@ ) ) ) - (func $std/map/test (; 58 ;) (type $v) + (func $std/map/test (; 57 ;) (; has Stack IR ;) (type $v) (local $0 i64) (local $1 i32) (set_local $1 @@ -7459,7 +7452,7 @@ ) ) ) - (func $~lib/map/Map#find (; 59 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 58 ;) (; has Stack IR ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -7522,7 +7515,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 60 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/map/Map#has (; 59 ;) (; has Stack IR ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -7536,7 +7529,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 61 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 60 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7701,7 +7694,7 @@ ) ) ) - (func $~lib/map/Map#set (; 62 ;) (type $ifiv) (param $0 i32) (param $1 f32) (param $2 i32) + (func $~lib/map/Map#set (; 61 ;) (; has Stack IR ;) (type $ifiv) (param $0 i32) (param $1 f32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -7840,7 +7833,7 @@ ) ) ) - (func $~lib/map/Map#get (; 63 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/map/Map#get (; 62 ;) (; has Stack IR ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -7861,7 +7854,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 64 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/map/Map#delete (; 63 ;) (; has Stack IR ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (local $3 i32) (if @@ -7959,7 +7952,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 65 ;) (type $v) + (func $std/map/test (; 64 ;) (; has Stack IR ;) (type $v) (local $0 f32) (local $1 i32) (set_local $1 @@ -8425,7 +8418,7 @@ ) ) ) - (func $~lib/map/Map#find (; 66 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 65 ;) (; has Stack IR ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -8488,7 +8481,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 67 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/map/Map#has (; 66 ;) (; has Stack IR ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -8502,7 +8495,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 68 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 67 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8667,7 +8660,7 @@ ) ) ) - (func $~lib/map/Map#set (; 69 ;) (type $iFiv) (param $0 i32) (param $1 f64) (param $2 i32) + (func $~lib/map/Map#set (; 68 ;) (; has Stack IR ;) (type $iFiv) (param $0 i32) (param $1 f64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -8806,7 +8799,7 @@ ) ) ) - (func $~lib/map/Map#get (; 70 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/map/Map#get (; 69 ;) (; has Stack IR ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -8827,7 +8820,7 @@ ) ) ) - (func $~lib/map/Map#delete (; 71 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/map/Map#delete (; 70 ;) (; has Stack IR ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 i32) (if @@ -8925,7 +8918,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 72 ;) (type $v) + (func $std/map/test (; 71 ;) (; has Stack IR ;) (type $v) (local $0 f64) (local $1 i32) (set_local $1 @@ -9391,7 +9384,7 @@ ) ) ) - (func $start (; 73 ;) (type $v) + (func $start (; 72 ;) (; has Stack IR ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.const 136) ) diff --git a/tests/compiler/std/map.untouched.wat b/tests/compiler/std/map.untouched.wat index ed6f6fab..ec9be585 100644 --- a/tests/compiler/std/map.untouched.wat +++ b/tests/compiler/std/map.untouched.wat @@ -172,8 +172,9 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) + (local $2 i32) (if (i32.eqz (i32.le_u @@ -185,16 +186,23 @@ (call $~lib/env/abort (i32.const 0) (i32.const 52) - (i32.const 22) + (i32.const 23) (i32.const 2) ) (unreachable) ) ) (set_local $1 - (call $~lib/memory/memory.allocate - (call $~lib/internal/arraybuffer/computeSize - (get_local $0) + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $2 + (call $~lib/internal/arraybuffer/computeSize + (get_local $0) + ) + ) + (br $~lib/memory/memory.allocate|inlined.0 + (call $~lib/allocator/arena/__memory_allocate + (get_local $2) + ) ) ) ) @@ -204,7 +212,7 @@ ) (get_local $1) ) - (func $~lib/memory/memset (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memset (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -556,15 +564,10 @@ ) ) ) - (func $~lib/memory/memory.fill (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) + (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -581,7 +584,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $1) ) ) @@ -592,18 +595,26 @@ (i32.const 1) ) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.0 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $1) ) - (i32.const 0) - (get_local $1) ) ) (get_local $3) ) - (func $~lib/map/Map#clear (; 8 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 7 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -640,7 +651,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -686,7 +697,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash8 (; 10 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash8 (; 9 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (get_global $~lib/internal/hash/FNV_OFFSET) @@ -695,7 +706,7 @@ (get_global $~lib/internal/hash/FNV_PRIME) ) ) - (func $~lib/map/Map#find (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 10 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -771,7 +782,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -793,7 +804,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 13 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 12 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -990,7 +1001,7 @@ ) ) ) - (func $~lib/map/Map#set (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1145,7 +1156,7 @@ ) ) ) - (func $~lib/map/Map#get (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -1174,12 +1185,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 16 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 15 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1285,7 +1296,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 18 ;) (type $v) + (func $std/map/test (; 17 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -1819,7 +1830,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 19 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 18 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -1856,7 +1867,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 20 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 19 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -1902,7 +1913,7 @@ ) (get_local $0) ) - (func $~lib/map/Map#find (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 20 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -1975,7 +1986,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -1994,7 +2005,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 23 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 22 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2191,7 +2202,7 @@ ) ) ) - (func $~lib/map/Map#set (; 24 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 23 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2343,7 +2354,7 @@ ) ) ) - (func $~lib/map/Map#get (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 24 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -2369,12 +2380,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 26 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 25 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2477,7 +2488,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 28 ;) (type $v) + (func $std/map/test (; 27 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -2990,7 +3001,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 29 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 28 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -3027,7 +3038,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 30 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 29 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -3073,7 +3084,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash16 (; 31 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash16 (; 30 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (get_global $~lib/internal/hash/FNV_OFFSET) @@ -3104,7 +3115,7 @@ ) (get_local $1) ) - (func $~lib/map/Map#find (; 32 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 31 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -3180,7 +3191,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 33 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 32 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -3202,7 +3213,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 34 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 33 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3399,7 +3410,7 @@ ) ) ) - (func $~lib/map/Map#set (; 35 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 34 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3554,7 +3565,7 @@ ) ) ) - (func $~lib/map/Map#get (; 36 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 35 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -3583,12 +3594,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 37 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 36 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 38 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 37 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3694,7 +3705,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 39 ;) (type $v) + (func $std/map/test (; 38 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -4228,7 +4239,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 40 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 39 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -4265,7 +4276,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 41 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 40 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -4311,7 +4322,7 @@ ) (get_local $0) ) - (func $~lib/map/Map#find (; 42 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 41 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -4384,7 +4395,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 43 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 42 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -4403,7 +4414,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 44 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 43 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4600,7 +4611,7 @@ ) ) ) - (func $~lib/map/Map#set (; 45 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 44 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4752,7 +4763,7 @@ ) ) ) - (func $~lib/map/Map#get (; 46 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 45 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -4778,12 +4789,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 47 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 46 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 48 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 47 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4886,7 +4897,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 49 ;) (type $v) + (func $std/map/test (; 48 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -5399,7 +5410,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 50 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 49 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -5436,7 +5447,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 51 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 50 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -5482,7 +5493,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash32 (; 52 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 51 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (get_global $~lib/internal/hash/FNV_OFFSET) @@ -5543,7 +5554,7 @@ ) (get_local $1) ) - (func $~lib/map/Map#find (; 53 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 52 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -5613,7 +5624,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 54 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 53 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -5629,7 +5640,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 55 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 54 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5826,7 +5837,7 @@ ) ) ) - (func $~lib/map/Map#set (; 56 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 55 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -5975,7 +5986,7 @@ ) ) ) - (func $~lib/map/Map#get (; 57 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 56 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -5998,12 +6009,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 58 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 57 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 59 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 58 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6103,7 +6114,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 60 ;) (type $v) + (func $std/map/test (; 59 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -6595,7 +6606,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 61 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 60 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -6632,7 +6643,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 62 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 61 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -6678,7 +6689,7 @@ ) (get_local $0) ) - (func $~lib/map/Map#find (; 63 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 62 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -6748,7 +6759,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 64 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 63 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -6764,7 +6775,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 65 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 64 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6961,7 +6972,7 @@ ) ) ) - (func $~lib/map/Map#set (; 66 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 65 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -7110,7 +7121,7 @@ ) ) ) - (func $~lib/map/Map#get (; 67 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 66 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -7133,12 +7144,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 68 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 67 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 69 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#delete (; 68 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7238,7 +7249,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 70 ;) (type $v) + (func $std/map/test (; 69 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -7730,7 +7741,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 71 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 70 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -7767,7 +7778,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 72 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 71 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -7813,7 +7824,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash64 (; 73 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash64 (; 72 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -7943,7 +7954,7 @@ ) (get_local $3) ) - (func $~lib/map/Map#find (; 74 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 73 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -8013,7 +8024,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 75 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#has (; 74 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -8029,7 +8040,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 76 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 75 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8227,7 +8238,7 @@ ) ) ) - (func $~lib/map/Map#set (; 77 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/map/Map#set (; 76 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -8376,7 +8387,7 @@ ) ) ) - (func $~lib/map/Map#get (; 78 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#get (; 77 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -8399,12 +8410,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 79 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 78 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 80 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#delete (; 79 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8504,7 +8515,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 81 ;) (type $v) + (func $std/map/test (; 80 ;) (type $v) (local $0 i32) (local $1 i64) (set_local $0 @@ -9010,7 +9021,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 82 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 81 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -9047,7 +9058,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 83 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 82 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -9093,7 +9104,7 @@ ) (get_local $0) ) - (func $~lib/map/Map#find (; 84 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 83 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -9163,7 +9174,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 85 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#has (; 84 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -9179,7 +9190,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 86 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 85 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9377,7 +9388,7 @@ ) ) ) - (func $~lib/map/Map#set (; 87 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/map/Map#set (; 86 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -9526,7 +9537,7 @@ ) ) ) - (func $~lib/map/Map#get (; 88 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#get (; 87 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -9549,12 +9560,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 89 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 88 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 90 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/map/Map#delete (; 89 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9654,7 +9665,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 91 ;) (type $v) + (func $std/map/test (; 90 ;) (type $v) (local $0 i32) (local $1 i64) (set_local $0 @@ -10160,7 +10171,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 92 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 91 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -10197,7 +10208,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 93 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 92 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -10243,7 +10254,7 @@ ) (get_local $0) ) - (func $~lib/map/Map#find (; 94 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 93 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -10313,7 +10324,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 95 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/map/Map#has (; 94 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -10331,7 +10342,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 96 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 95 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10531,7 +10542,7 @@ ) ) ) - (func $~lib/map/Map#set (; 97 ;) (type $ifiv) (param $0 i32) (param $1 f32) (param $2 i32) + (func $~lib/map/Map#set (; 96 ;) (type $ifiv) (param $0 i32) (param $1 f32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -10682,7 +10693,7 @@ ) ) ) - (func $~lib/map/Map#get (; 98 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/map/Map#get (; 97 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -10707,12 +10718,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 99 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 98 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 100 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/map/Map#delete (; 99 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10814,7 +10825,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 101 ;) (type $v) + (func $std/map/test (; 100 ;) (type $v) (local $0 i32) (local $1 f32) (set_local $0 @@ -11320,7 +11331,7 @@ ) ) ) - (func $~lib/map/Map#clear (; 102 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 101 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -11357,7 +11368,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 103 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 102 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -11403,7 +11414,7 @@ ) (get_local $0) ) - (func $~lib/map/Map#find (; 104 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 103 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -11473,7 +11484,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 105 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/map/Map#has (; 104 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -11491,7 +11502,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#rehash (; 106 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 105 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -11691,7 +11702,7 @@ ) ) ) - (func $~lib/map/Map#set (; 107 ;) (type $iFiv) (param $0 i32) (param $1 f64) (param $2 i32) + (func $~lib/map/Map#set (; 106 ;) (type $iFiv) (param $0 i32) (param $1 f64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -11842,7 +11853,7 @@ ) ) ) - (func $~lib/map/Map#get (; 108 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/map/Map#get (; 107 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -11867,12 +11878,12 @@ (unreachable) ) ) - (func $~lib/map/Map#get:size (; 109 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#get:size (; 108 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/map/Map#delete (; 110 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/map/Map#delete (; 109 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -11974,7 +11985,7 @@ ) (i32.const 1) ) - (func $std/map/test (; 111 ;) (type $v) + (func $std/map/test (; 110 ;) (type $v) (local $0 i32) (local $1 f64) (set_local $0 @@ -12480,7 +12491,7 @@ ) ) ) - (func $start (; 112 ;) (type $v) + (func $start (; 111 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add diff --git a/tests/compiler/std/math.optimized.wat b/tests/compiler/std/math.optimized.wat index 18bc66ba..30c1e9d8 100644 --- a/tests/compiler/std/math.optimized.wat +++ b/tests/compiler/std/math.optimized.wat @@ -66,13 +66,13 @@ (data (i32.const 36) "\0c\00\00\00~\00l\00i\00b\00/\00m\00a\00t\00h\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/builtins/isNaN (; 30 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isNaN (; 30 ;) (; has Stack IR ;) (type $Fi) (param $0 f64) (result i32) (f64.ne (get_local $0) (get_local $0) ) ) - (func $std/math/signbit (; 31 ;) (type $Fi) (param $0 f64) (result i32) + (func $std/math/signbit (; 31 ;) (; has Stack IR ;) (type $Fi) (param $0 f64) (result i32) (i32.wrap/i64 (i64.shr_u (i64.reinterpret/f64 @@ -82,7 +82,7 @@ ) ) ) - (func $~lib/builtins/isFinite (; 32 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isFinite (; 32 ;) (; has Stack IR ;) (type $Fi) (param $0 f64) (result i32) (f64.eq (f64.sub (get_local $0) @@ -91,7 +91,7 @@ (f64.const 0) ) ) - (func $std/math/eulp (; 33 ;) (type $Fi) (param $0 f64) (result i32) + (func $std/math/eulp (; 33 ;) (; has Stack IR ;) (type $Fi) (param $0 f64) (result i32) (local $1 i32) (if (i32.eqz @@ -121,7 +121,7 @@ (i32.const -1075) ) ) - (func $~lib/math/NativeMath.scalbn (; 34 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) + (func $~lib/math/NativeMath.scalbn (; 34 ;) (; has Stack IR ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) (local $2 f64) (set_local $2 (get_local $0) @@ -235,7 +235,7 @@ ) ) ) - (func $std/math/ulperr (; 35 ;) (type $FFFF) (param $0 f64) (param $1 f64) (param $2 f64) (result f64) + (func $std/math/ulperr (; 35 ;) (; has Stack IR ;) (type $FFFF) (param $0 f64) (param $1 f64) (param $2 f64) (result f64) (local $3 i32) (if (tee_local $3 @@ -316,7 +316,7 @@ (get_local $2) ) ) - (func $std/math/check (; 36 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/check (; 36 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (if (f64.eq (get_local $0) @@ -353,13 +353,13 @@ ) (i32.const 1) ) - (func $~lib/builtins/isNaN (; 37 ;) (type $fi) (param $0 f32) (result i32) + (func $~lib/builtins/isNaN (; 37 ;) (; has Stack IR ;) (type $fi) (param $0 f32) (result i32) (f32.ne (get_local $0) (get_local $0) ) ) - (func $std/math/signbitf (; 38 ;) (type $fi) (param $0 f32) (result i32) + (func $std/math/signbitf (; 38 ;) (; has Stack IR ;) (type $fi) (param $0 f32) (result i32) (i32.shr_u (i32.reinterpret/f32 (get_local $0) @@ -367,7 +367,7 @@ (i32.const 31) ) ) - (func $~lib/builtins/isFinite (; 39 ;) (type $fi) (param $0 f32) (result i32) + (func $~lib/builtins/isFinite (; 39 ;) (; has Stack IR ;) (type $fi) (param $0 f32) (result i32) (f32.eq (f32.sub (get_local $0) @@ -376,7 +376,7 @@ (f32.const 0) ) ) - (func $std/math/eulpf (; 40 ;) (type $fi) (param $0 f32) (result i32) + (func $std/math/eulpf (; 40 ;) (; has Stack IR ;) (type $fi) (param $0 f32) (result i32) (local $1 i32) (if (i32.eqz @@ -404,7 +404,7 @@ (i32.const -150) ) ) - (func $~lib/math/NativeMathf.scalbn (; 41 ;) (type $fif) (param $0 f32) (param $1 i32) (result f32) + (func $~lib/math/NativeMathf.scalbn (; 41 ;) (; has Stack IR ;) (type $fif) (param $0 f32) (param $1 i32) (result f32) (local $2 f32) (set_local $2 (get_local $0) @@ -516,7 +516,7 @@ ) ) ) - (func $std/math/ulperrf (; 42 ;) (type $ffff) (param $0 f32) (param $1 f32) (param $2 f32) (result f32) + (func $std/math/ulperrf (; 42 ;) (; has Stack IR ;) (type $ffff) (param $0 f32) (param $1 f32) (param $2 f32) (result f32) (local $3 i32) (if (tee_local $3 @@ -597,7 +597,7 @@ (get_local $2) ) ) - (func $std/math/check (; 43 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/check (; 43 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (if (f32.eq (get_local $0) @@ -634,7 +634,7 @@ ) (i32.const 1) ) - (func $std/math/test_scalbn (; 44 ;) (type $FiFFii) (param $0 f64) (param $1 i32) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_scalbn (; 44 ;) (; has Stack IR ;) (type $FiFFii) (param $0 f64) (param $1 i32) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMath.scalbn (get_local $0) @@ -645,7 +645,7 @@ (get_local $4) ) ) - (func $std/math/test_scalbnf (; 45 ;) (type $fiffii) (param $0 f32) (param $1 i32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_scalbnf (; 45 ;) (; has Stack IR ;) (type $fiffii) (param $0 f32) (param $1 i32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.scalbn (get_local $0) @@ -656,7 +656,7 @@ (get_local $4) ) ) - (func $std/math/test_abs (; 46 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_abs (; 46 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -684,7 +684,7 @@ ) ) ) - (func $std/math/test_absf (; 47 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_absf (; 47 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (f32.abs (get_local $0) @@ -694,7 +694,7 @@ (get_local $3) ) ) - (func $~lib/math/R (; 48 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/R (; 48 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (f64.div (f64.mul (get_local $0) @@ -757,7 +757,7 @@ ) ) ) - (func $~lib/math/NativeMath.acos (; 49 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.acos (; 49 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 i32) (local $3 f64) @@ -951,7 +951,7 @@ ) ) ) - (func $std/math/test_acos (; 50 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_acos (; 50 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -979,7 +979,7 @@ ) ) ) - (func $~lib/math/Rf (; 51 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/Rf (; 51 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (f32.div (f32.mul (get_local $0) @@ -1006,7 +1006,7 @@ ) ) ) - (func $~lib/math/NativeMathf.acos (; 52 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.acos (; 52 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 f32) (local $3 i32) @@ -1188,7 +1188,7 @@ ) ) ) - (func $std/math/test_acosf (; 53 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_acosf (; 53 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.acos (get_local $0) @@ -1198,7 +1198,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.log1p (; 54 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log1p (; 54 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 i32) (local $3 i32) @@ -1499,7 +1499,7 @@ ) ) ) - (func $~lib/math/NativeMath.log (; 55 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log (; 55 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 i32) (local $3 i32) @@ -1761,7 +1761,7 @@ ) ) ) - (func $~lib/math/NativeMath.acosh (; 56 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.acosh (; 56 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (if (i64.lt_u @@ -1841,7 +1841,7 @@ (f64.const 0.6931471805599453) ) ) - (func $std/math/test_acosh (; 57 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_acosh (; 57 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -1869,7 +1869,7 @@ ) ) ) - (func $~lib/math/NativeMathf.log1p (; 58 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.log1p (; 58 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 f32) (local $2 i32) (local $3 i32) @@ -2123,7 +2123,7 @@ ) ) ) - (func $~lib/math/NativeMathf.log (; 59 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.log (; 59 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 f32) (local $3 i32) @@ -2324,7 +2324,7 @@ ) ) ) - (func $~lib/math/NativeMathf.acosh (; 60 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.acosh (; 60 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (if (i32.lt_u @@ -2401,7 +2401,7 @@ (f32.const 0.6931471824645996) ) ) - (func $std/math/test_acoshf (; 61 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_acoshf (; 61 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.acosh (get_local $0) @@ -2411,7 +2411,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.asin (; 62 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.asin (; 62 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 i32) (local $3 i32) @@ -2619,7 +2619,7 @@ ) (get_local $0) ) - (func $std/math/test_asin (; 63 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_asin (; 63 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -2647,7 +2647,7 @@ ) ) ) - (func $~lib/math/NativeMathf.asin (; 64 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.asin (; 64 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 i32) (local $3 f64) @@ -2784,7 +2784,7 @@ ) (get_local $0) ) - (func $std/math/test_asinf (; 65 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_asinf (; 65 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.asin (get_local $0) @@ -2794,7 +2794,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.asinh (; 66 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.asinh (; 66 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 i64) (local $3 i64) @@ -2913,7 +2913,7 @@ ) (get_local $0) ) - (func $std/math/test_asinh (; 67 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_asinh (; 67 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -2941,7 +2941,7 @@ ) ) ) - (func $~lib/math/NativeMathf.asinh (; 68 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.asinh (; 68 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -3052,7 +3052,7 @@ ) (get_local $0) ) - (func $std/math/test_asinhf (; 69 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_asinhf (; 69 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.asinh (get_local $0) @@ -3062,7 +3062,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.atan (; 70 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.atan (; 70 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 f64) (local $3 f64) @@ -3425,7 +3425,7 @@ ) (get_local $3) ) - (func $std/math/test_atan (; 71 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_atan (; 71 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -3453,7 +3453,7 @@ ) ) ) - (func $~lib/math/NativeMathf.atan (; 72 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.atan (; 72 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 f32) (local $3 f32) @@ -3775,7 +3775,7 @@ ) (get_local $2) ) - (func $std/math/test_atanf (; 73 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_atanf (; 73 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.atan (get_local $0) @@ -3785,7 +3785,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.atanh (; 74 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.atanh (; 74 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 i64) (local $3 i64) @@ -3884,7 +3884,7 @@ ) (get_local $0) ) - (func $std/math/test_atanh (; 75 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_atanh (; 75 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -3912,7 +3912,7 @@ ) ) ) - (func $~lib/math/NativeMathf.atanh (; 76 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.atanh (; 76 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 i32) (local $3 f32) @@ -4000,7 +4000,7 @@ ) (get_local $0) ) - (func $std/math/test_atanhf (; 77 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_atanhf (; 77 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.atanh (get_local $0) @@ -4010,7 +4010,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.atan2 (; 78 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.atan2 (; 78 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4360,7 +4360,7 @@ ) ) ) - (func $std/math/test_atan2 (; 79 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_atan2 (; 79 ;) (; has Stack IR ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (local $5 i32) (tee_local $4 (if (result i32) @@ -4390,7 +4390,7 @@ ) ) ) - (func $~lib/math/NativeMathf.atan2 (; 80 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.atan2 (; 80 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4702,7 +4702,7 @@ ) ) ) - (func $std/math/test_atan2f (; 81 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_atan2f (; 81 ;) (; has Stack IR ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.atan2 (get_local $0) @@ -4713,7 +4713,7 @@ (get_local $4) ) ) - (func $~lib/math/NativeMath.cbrt (; 82 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.cbrt (; 82 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 f64) (local $3 i32) @@ -4896,7 +4896,7 @@ ) ) ) - (func $std/math/test_cbrt (; 83 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_cbrt (; 83 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -4924,7 +4924,7 @@ ) ) ) - (func $~lib/math/NativeMathf.cbrt (; 84 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.cbrt (; 84 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 f64) (local $2 f64) (local $3 i32) @@ -5068,7 +5068,7 @@ ) ) ) - (func $std/math/test_cbrtf (; 85 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_cbrtf (; 85 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.cbrt (get_local $0) @@ -5078,7 +5078,7 @@ (get_local $3) ) ) - (func $std/math/test_ceil (; 86 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_ceil (; 86 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -5106,7 +5106,7 @@ ) ) ) - (func $std/math/test_ceilf (; 87 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_ceilf (; 87 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (f32.ceil (get_local $0) @@ -5116,7 +5116,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.expm1 (; 88 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.expm1 (; 88 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 i32) (local $3 f64) @@ -5560,7 +5560,7 @@ ) ) ) - (func $~lib/math/NativeMath.exp (; 89 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.exp (; 89 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 i32) (local $3 i32) @@ -5764,7 +5764,7 @@ (get_local $2) ) ) - (func $~lib/math/expo2 (; 90 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/expo2 (; 90 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (f64.mul (f64.mul (call $~lib/math/NativeMath.exp @@ -5778,7 +5778,7 @@ (f64.const 2247116418577894884661631e283) ) ) - (func $~lib/math/NativeMath.cosh (; 91 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.cosh (; 91 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 i64) (set_local $0 @@ -5865,7 +5865,7 @@ (get_local $0) ) ) - (func $std/math/test_cosh (; 92 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_cosh (; 92 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -5893,7 +5893,7 @@ ) ) ) - (func $~lib/math/NativeMathf.expm1 (; 93 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.expm1 (; 93 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 f32) (local $2 i32) (local $3 i32) @@ -6310,7 +6310,7 @@ ) ) ) - (func $~lib/math/NativeMathf.exp (; 94 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.exp (; 94 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -6504,7 +6504,7 @@ (get_local $1) ) ) - (func $~lib/math/expo2f (; 95 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/expo2f (; 95 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (f32.mul (f32.mul (call $~lib/math/NativeMathf.exp @@ -6518,7 +6518,7 @@ (f32.const 1661534994731144841129758e11) ) ) - (func $~lib/math/NativeMathf.cosh (; 96 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.cosh (; 96 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (set_local $0 (f32.reinterpret/i32 @@ -6597,7 +6597,7 @@ (get_local $0) ) ) - (func $std/math/test_coshf (; 97 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_coshf (; 97 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.cosh (get_local $0) @@ -6607,7 +6607,7 @@ (get_local $3) ) ) - (func $std/math/test_exp (; 98 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_exp (; 98 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -6635,7 +6635,7 @@ ) ) ) - (func $std/math/test_expf (; 99 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_expf (; 99 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.exp (get_local $0) @@ -6645,7 +6645,7 @@ (get_local $3) ) ) - (func $std/math/test_expm1 (; 100 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_expm1 (; 100 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -6673,7 +6673,7 @@ ) ) ) - (func $std/math/test_expm1f (; 101 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_expm1f (; 101 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.expm1 (get_local $0) @@ -6683,7 +6683,7 @@ (get_local $3) ) ) - (func $std/math/test_floor (; 102 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_floor (; 102 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -6711,7 +6711,7 @@ ) ) ) - (func $std/math/test_floorf (; 103 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_floorf (; 103 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (f32.floor (get_local $0) @@ -6721,7 +6721,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.hypot (; 104 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.hypot (; 104 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 f64) (local $3 f64) (local $4 i64) @@ -6994,7 +6994,7 @@ ) ) ) - (func $std/math/test_hypot (; 105 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_hypot (; 105 ;) (; has Stack IR ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (local $5 i32) (tee_local $4 (if (result i32) @@ -7024,7 +7024,7 @@ ) ) ) - (func $~lib/math/NativeMathf.hypot (; 106 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.hypot (; 106 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7193,7 +7193,7 @@ ) ) ) - (func $std/math/test_hypotf (; 107 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_hypotf (; 107 ;) (; has Stack IR ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.hypot (get_local $0) @@ -7204,7 +7204,7 @@ (get_local $4) ) ) - (func $std/math/test_log (; 108 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_log (; 108 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -7232,7 +7232,7 @@ ) ) ) - (func $std/math/test_logf (; 109 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_logf (; 109 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.log (get_local $0) @@ -7242,7 +7242,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.log10 (; 110 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log10 (; 110 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 f64) (local $3 i32) @@ -7565,7 +7565,7 @@ ) ) ) - (func $std/math/test_log10 (; 111 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_log10 (; 111 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -7593,7 +7593,7 @@ ) ) ) - (func $~lib/math/NativeMathf.log10 (; 112 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.log10 (; 112 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 i32) (local $3 f32) @@ -7832,7 +7832,7 @@ ) ) ) - (func $std/math/test_log10f (; 113 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_log10f (; 113 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.log10 (get_local $0) @@ -7842,7 +7842,7 @@ (get_local $3) ) ) - (func $std/math/test_log1p (; 114 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_log1p (; 114 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -7870,7 +7870,7 @@ ) ) ) - (func $std/math/test_log1pf (; 115 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_log1pf (; 115 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.log1p (get_local $0) @@ -7880,7 +7880,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.log2 (; 116 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.log2 (; 116 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i32) (local $2 f64) (local $3 i32) @@ -8191,7 +8191,7 @@ ) ) ) - (func $std/math/test_log2 (; 117 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_log2 (; 117 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -8219,7 +8219,7 @@ ) ) ) - (func $~lib/math/NativeMathf.log2 (; 118 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.log2 (; 118 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 i32) (local $3 f32) @@ -8446,7 +8446,7 @@ ) ) ) - (func $std/math/test_log2f (; 119 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_log2f (; 119 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.log2 (get_local $0) @@ -8456,7 +8456,7 @@ (get_local $3) ) ) - (func $std/math/test_max (; 120 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_max (; 120 ;) (; has Stack IR ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (local $5 i32) (tee_local $4 (if (result i32) @@ -8486,7 +8486,7 @@ ) ) ) - (func $std/math/test_maxf (; 121 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_maxf (; 121 ;) (; has Stack IR ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (f32.max (get_local $0) @@ -8497,7 +8497,7 @@ (get_local $4) ) ) - (func $std/math/test_min (; 122 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_min (; 122 ;) (; has Stack IR ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (local $5 i32) (tee_local $4 (if (result i32) @@ -8527,7 +8527,7 @@ ) ) ) - (func $std/math/test_minf (; 123 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_minf (; 123 ;) (; has Stack IR ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (f32.min (get_local $0) @@ -8538,7 +8538,7 @@ (get_local $4) ) ) - (func $~lib/math/NativeMath.mod (; 124 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.mod (; 124 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i32) (local $4 i64) @@ -8913,7 +8913,7 @@ (get_local $0) ) ) - (func $std/math/test_mod (; 125 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_mod (; 125 ;) (; has Stack IR ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (local $5 i32) (tee_local $4 (if (result i32) @@ -8943,7 +8943,7 @@ ) ) ) - (func $~lib/math/NativeMathf.mod (; 126 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.mod (; 126 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9291,7 +9291,7 @@ (get_local $0) ) ) - (func $std/math/test_modf (; 127 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_modf (; 127 ;) (; has Stack IR ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.mod (get_local $0) @@ -9302,7 +9302,7 @@ (get_local $4) ) ) - (func $~lib/math/NativeMath.pow (; 128 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.pow (; 128 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 f64) (local $3 f64) (local $4 i32) @@ -10729,7 +10729,7 @@ (f64.const 1.e+300) ) ) - (func $std/math/test_pow (; 129 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_pow (; 129 ;) (; has Stack IR ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (local $5 i32) (tee_local $4 (if (result i32) @@ -10759,7 +10759,7 @@ ) ) ) - (func $~lib/math/NativeMathf.pow (; 130 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.pow (; 130 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 f32) (local $3 f32) (local $4 i32) @@ -11946,7 +11946,7 @@ (f32.const 1.0000000031710769e-30) ) ) - (func $std/math/test_powf (; 131 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_powf (; 131 ;) (; has Stack IR ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.pow (get_local $0) @@ -11957,7 +11957,7 @@ (get_local $4) ) ) - (func $~lib/math/murmurHash3 (; 132 ;) (type $II) (param $0 i64) (result i64) + (func $~lib/math/murmurHash3 (; 132 ;) (; has Stack IR ;) (type $II) (param $0 i64) (result i64) (i64.xor (tee_local $0 (i64.mul @@ -11988,7 +11988,7 @@ ) ) ) - (func $~lib/math/NativeMath.seedRandom (; 133 ;) (type $Iv) (param $0 i64) + (func $~lib/math/NativeMath.seedRandom (; 133 ;) (; has Stack IR ;) (type $Iv) (param $0 i64) (if (i64.eqz (get_local $0) @@ -12017,7 +12017,7 @@ ) ) ) - (func $~lib/math/NativeMath.random (; 134 ;) (type $F) (result f64) + (func $~lib/math/NativeMath.random (; 134 ;) (; has Stack IR ;) (type $F) (result f64) (local $0 i64) (local $1 i64) (if @@ -12086,7 +12086,7 @@ (f64.const 1) ) ) - (func $~lib/math/NativeMathf.random (; 135 ;) (type $f) (result f32) + (func $~lib/math/NativeMathf.random (; 135 ;) (; has Stack IR ;) (type $f) (result f32) (local $0 f32) (loop $continue|0 (br_if $continue|0 @@ -12102,7 +12102,7 @@ ) (get_local $0) ) - (func $~lib/math/NativeMath.round (; 136 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.round (; 136 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 i64) (local $3 i32) @@ -12235,7 +12235,7 @@ ) ) ) - (func $std/math/test_round (; 137 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_round (; 137 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMath.round (get_local $0) @@ -12245,7 +12245,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMathf.round (; 138 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.round (; 138 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 f32) (local $2 i32) (local $3 i32) @@ -12373,7 +12373,7 @@ ) ) ) - (func $std/math/test_roundf (; 139 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_roundf (; 139 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.round (get_local $0) @@ -12383,7 +12383,7 @@ (get_local $3) ) ) - (func $std/math/test_sign (; 140 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_sign (; 140 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -12421,7 +12421,7 @@ ) ) ) - (func $std/math/test_signf (; 141 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_signf (; 141 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (if (result f32) (f32.gt @@ -12441,7 +12441,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.rem (; 142 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.rem (; 142 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i32) (local $4 i64) @@ -12909,7 +12909,7 @@ ) (get_local $0) ) - (func $std/math/test_rem (; 143 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) + (func $std/math/test_rem (; 143 ;) (; has Stack IR ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMath.rem (get_local $0) @@ -12920,7 +12920,7 @@ (get_local $4) ) ) - (func $~lib/math/NativeMathf.rem (; 144 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.rem (; 144 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -13355,7 +13355,7 @@ ) (get_local $0) ) - (func $std/math/test_remf (; 145 ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) + (func $std/math/test_remf (; 145 ;) (; has Stack IR ;) (type $ffffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 f32) (param $4 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.rem (get_local $0) @@ -13366,7 +13366,7 @@ (get_local $4) ) ) - (func $~lib/math/NativeMath.sinh (; 146 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.sinh (; 146 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 f64) (local $2 f64) (local $3 i64) @@ -13483,7 +13483,7 @@ ) ) ) - (func $std/math/test_sinh (; 147 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_sinh (; 147 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -13511,7 +13511,7 @@ ) ) ) - (func $~lib/math/NativeMathf.sinh (; 148 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.sinh (; 148 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 f32) (local $2 i32) (local $3 f32) @@ -13617,7 +13617,7 @@ ) ) ) - (func $std/math/test_sinhf (; 149 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_sinhf (; 149 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.sinh (get_local $0) @@ -13627,7 +13627,7 @@ (get_local $3) ) ) - (func $std/math/test_sqrt (; 150 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_sqrt (; 150 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -13655,7 +13655,7 @@ ) ) ) - (func $std/math/test_sqrtf (; 151 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_sqrtf (; 151 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (f32.sqrt (get_local $0) @@ -13665,7 +13665,7 @@ (get_local $3) ) ) - (func $~lib/math/NativeMath.tanh (; 152 ;) (type $FF) (param $0 f64) (result f64) + (func $~lib/math/NativeMath.tanh (; 152 ;) (; has Stack IR ;) (type $FF) (param $0 f64) (result f64) (local $1 i64) (local $2 i32) (local $3 i32) @@ -13790,7 +13790,7 @@ ) (get_local $0) ) - (func $std/math/test_tanh (; 153 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_tanh (; 153 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -13818,7 +13818,7 @@ ) ) ) - (func $~lib/math/NativeMathf.tanh (; 154 ;) (type $ff) (param $0 f32) (result f32) + (func $~lib/math/NativeMathf.tanh (; 154 ;) (; has Stack IR ;) (type $ff) (param $0 f32) (result f32) (local $1 i32) (local $2 i32) (set_local $2 @@ -13933,7 +13933,7 @@ ) (get_local $0) ) - (func $std/math/test_tanhf (; 155 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_tanhf (; 155 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (call $~lib/math/NativeMathf.tanh (get_local $0) @@ -13943,7 +13943,7 @@ (get_local $3) ) ) - (func $std/math/test_trunc (; 156 ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) + (func $std/math/test_trunc (; 156 ;) (; has Stack IR ;) (type $FFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 i32) (result i32) (local $4 i32) (tee_local $3 (if (result i32) @@ -13971,7 +13971,7 @@ ) ) ) - (func $std/math/test_truncf (; 157 ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) + (func $std/math/test_truncf (; 157 ;) (; has Stack IR ;) (type $fffii) (param $0 f32) (param $1 f32) (param $2 f32) (param $3 i32) (result i32) (call $std/math/check (f32.trunc (get_local $0) @@ -13981,7 +13981,7 @@ (get_local $3) ) ) - (func $start (; 158 ;) (type $v) + (func $start (; 158 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (local $2 f64) diff --git a/tests/compiler/std/math.untouched.wat b/tests/compiler/std/math.untouched.wat index f2d3b8af..7be21d88 100644 --- a/tests/compiler/std/math.untouched.wat +++ b/tests/compiler/std/math.untouched.wat @@ -11089,48 +11089,51 @@ (get_local $8) (i32.const 2146435072) ) - (if - (i32.eq - (i32.or - (i32.sub + (block + (if + (i32.eq + (i32.or + (i32.sub + (get_local $7) + (i32.const 1072693248) + ) + (get_local $4) + ) + (i32.const 0) + ) + (return + (f64.const nan:0x8000000000000) + ) + (if + (i32.ge_s (get_local $7) (i32.const 1072693248) ) - (get_local $4) - ) - (i32.const 0) - ) - (return - (f64.const nan:0x8000000000000) - ) - (if - (i32.ge_s - (get_local $7) - (i32.const 1072693248) - ) - (return - (if (result f64) - (i32.ge_s - (get_local $5) - (i32.const 0) - ) - (get_local $1) - (f64.const 0) - ) - ) - (return - (if (result f64) - (i32.ge_s - (get_local $5) - (i32.const 0) - ) - (f64.const 0) - (f64.neg + (return + (if (result f64) + (i32.ge_s + (get_local $5) + (i32.const 0) + ) (get_local $1) + (f64.const 0) + ) + ) + (return + (if (result f64) + (i32.ge_s + (get_local $5) + (i32.const 0) + ) + (f64.const 0) + (f64.neg + (get_local $1) + ) ) ) ) ) + (unreachable) ) ) (if @@ -12562,42 +12565,45 @@ (get_local $5) (i32.const 2139095040) ) - (if - (i32.eq - (get_local $4) - (i32.const 1065353216) - ) - (return - (f32.const nan:0x400000) - ) + (block (if - (i32.gt_s + (i32.eq (get_local $4) (i32.const 1065353216) ) (return - (if (result f32) - (i32.ge_s - (get_local $3) - (i32.const 0) - ) - (get_local $1) - (f32.const 0) - ) + (f32.const nan:0x400000) ) - (return - (if (result f32) - (i32.ge_s - (get_local $3) - (i32.const 0) - ) - (f32.const 0) - (f32.neg + (if + (i32.gt_s + (get_local $4) + (i32.const 1065353216) + ) + (return + (if (result f32) + (i32.ge_s + (get_local $3) + (i32.const 0) + ) (get_local $1) + (f32.const 0) + ) + ) + (return + (if (result f32) + (i32.ge_s + (get_local $3) + (i32.const 0) + ) + (f32.const 0) + (f32.neg + (get_local $1) + ) ) ) ) ) + (unreachable) ) ) (if @@ -14720,6 +14726,7 @@ ) (br $break|2) ) + (unreachable) ) (if (i32.gt_s @@ -15269,6 +15276,7 @@ ) (br $break|2) ) + (unreachable) ) (if (i32.gt_s diff --git a/tests/compiler/std/mod.optimized.wat b/tests/compiler/std/mod.optimized.wat index 142fa083..63ba3772 100644 --- a/tests/compiler/std/mod.optimized.wat +++ b/tests/compiler/std/mod.optimized.wat @@ -15,7 +15,7 @@ (data (i32.const 8) "\n\00\00\00s\00t\00d\00/\00m\00o\00d\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/math/NativeMath.mod (; 2 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.mod (; 2 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 i64) (local $3 i32) (local $4 i64) @@ -390,13 +390,13 @@ (get_local $0) ) ) - (func $~lib/builtins/isNaN (; 3 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/builtins/isNaN (; 3 ;) (; has Stack IR ;) (type $Fi) (param $0 f64) (result i32) (f64.ne (get_local $0) (get_local $0) ) ) - (func $std/mod/check (; 4 ;) (type $FFi) (param $0 f64) (param $1 f64) (result i32) + (func $std/mod/check (; 4 ;) (; has Stack IR ;) (type $FFi) (param $0 f64) (param $1 f64) (result i32) (if (call $~lib/builtins/isNaN (get_local $1) @@ -430,7 +430,7 @@ (get_local $1) ) ) - (func $std/mod/test_fmod (; 5 ;) (type $FFFi) (param $0 f64) (param $1 f64) (param $2 f64) (result i32) + (func $std/mod/test_fmod (; 5 ;) (; has Stack IR ;) (type $FFFi) (param $0 f64) (param $1 f64) (param $2 f64) (result i32) (local $3 i32) (if (tee_local $3 @@ -456,7 +456,7 @@ ) (get_local $3) ) - (func $~lib/math/NativeMathf.mod (; 6 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) + (func $~lib/math/NativeMathf.mod (; 6 ;) (; has Stack IR ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -804,13 +804,13 @@ (get_local $0) ) ) - (func $~lib/builtins/isNaN (; 7 ;) (type $fi) (param $0 f32) (result i32) + (func $~lib/builtins/isNaN (; 7 ;) (; has Stack IR ;) (type $fi) (param $0 f32) (result i32) (f32.ne (get_local $0) (get_local $0) ) ) - (func $std/mod/check (; 8 ;) (type $ffi) (param $0 f32) (param $1 f32) (result i32) + (func $std/mod/check (; 8 ;) (; has Stack IR ;) (type $ffi) (param $0 f32) (param $1 f32) (result i32) (if (call $~lib/builtins/isNaN (get_local $1) @@ -844,7 +844,7 @@ (get_local $1) ) ) - (func $std/mod/test_fmodf (; 9 ;) (type $fffi) (param $0 f32) (param $1 f32) (param $2 f32) (result i32) + (func $std/mod/test_fmodf (; 9 ;) (; has Stack IR ;) (type $fffi) (param $0 f32) (param $1 f32) (param $2 f32) (result i32) (call $std/mod/check (call $~lib/math/NativeMathf.mod (get_local $0) @@ -853,7 +853,7 @@ (get_local $2) ) ) - (func $start (; 10 ;) (type $v) + (func $start (; 10 ;) (; has Stack IR ;) (type $v) (if (i32.eqz (call $std/mod/test_fmod diff --git a/tests/compiler/std/new.optimized.wat b/tests/compiler/std/new.optimized.wat index 748c7cce..ad6d17cd 100644 --- a/tests/compiler/std/new.optimized.wat +++ b/tests/compiler/std/new.optimized.wat @@ -8,7 +8,7 @@ (memory $0 0) (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/__memory_allocate (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 0 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -94,12 +94,12 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/allocator/arena/__memory_allocate (get_local $0) ) ) - (func $std/new/AClass#constructor (; 2 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $std/new/AClass#constructor (; 2 ;) (; has Stack IR ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (if (i32.eqz @@ -137,7 +137,7 @@ ) (get_local $0) ) - (func $start (; 3 ;) (type $v) + (func $start (; 3 ;) (; has Stack IR ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.const 8) ) diff --git a/tests/compiler/std/operator-overloading.optimized.wat b/tests/compiler/std/operator-overloading.optimized.wat index fef8a1bb..e538e1ec 100644 --- a/tests/compiler/std/operator-overloading.optimized.wat +++ b/tests/compiler/std/operator-overloading.optimized.wat @@ -78,7 +78,7 @@ (data (i32.const 8) "\1b\00\00\00s\00t\00d\00/\00o\00p\00e\00r\00a\00t\00o\00r\00-\00o\00v\00e\00r\00l\00o\00a\00d\00i\00n\00g\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -164,12 +164,12 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/allocator/arena/__memory_allocate (get_local $0) ) ) - (func $std/operator-overloading/Tester#constructor (; 3 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $std/operator-overloading/Tester#constructor (; 3 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (if (i32.eqz (get_local $0) @@ -191,7 +191,7 @@ ) (get_local $0) ) - (func $std/operator-overloading/Tester.add (; 4 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.add (; 4 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.add @@ -212,7 +212,7 @@ ) ) ) - (func $std/operator-overloading/Tester.sub (; 5 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.sub (; 5 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.sub @@ -233,7 +233,7 @@ ) ) ) - (func $std/operator-overloading/Tester.mul (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.mul (; 6 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.mul @@ -254,7 +254,7 @@ ) ) ) - (func $std/operator-overloading/Tester.div (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.div (; 7 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.div_s @@ -275,7 +275,7 @@ ) ) ) - (func $std/operator-overloading/Tester.mod (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.mod (; 8 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.rem_s @@ -296,7 +296,7 @@ ) ) ) - (func $~lib/math/NativeMath.scalbn (; 9 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) + (func $~lib/math/NativeMath.scalbn (; 9 ;) (; has Stack IR ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) (local $2 f64) (set_local $2 (get_local $0) @@ -410,7 +410,7 @@ ) ) ) - (func $~lib/math/NativeMath.pow (; 10 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) + (func $~lib/math/NativeMath.pow (; 10 ;) (; has Stack IR ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) (local $2 f64) (local $3 f64) (local $4 i32) @@ -1837,7 +1837,7 @@ (f64.const 1.e+300) ) ) - (func $std/operator-overloading/Tester.pow (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.pow (; 11 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.trunc_s/f64 @@ -1870,7 +1870,7 @@ ) ) ) - (func $std/operator-overloading/Tester.and (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.and (; 12 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.and @@ -1891,7 +1891,7 @@ ) ) ) - (func $std/operator-overloading/Tester.or (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.or (; 13 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.or @@ -1912,7 +1912,7 @@ ) ) ) - (func $std/operator-overloading/Tester.xor (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.xor (; 14 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.xor @@ -1933,7 +1933,7 @@ ) ) ) - (func $std/operator-overloading/Tester.equals (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.equals (; 15 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -1959,7 +1959,7 @@ ) (get_local $2) ) - (func $std/operator-overloading/Tester.notEquals (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.notEquals (; 16 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -1985,7 +1985,7 @@ ) (get_local $2) ) - (func $std/operator-overloading/Tester.greater (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.greater (; 17 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -2011,7 +2011,7 @@ ) (get_local $2) ) - (func $std/operator-overloading/Tester.greaterEquals (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.greaterEquals (; 18 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -2037,7 +2037,7 @@ ) (get_local $2) ) - (func $std/operator-overloading/Tester.less (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.less (; 19 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -2063,7 +2063,7 @@ ) (get_local $2) ) - (func $std/operator-overloading/Tester.lessEquals (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.lessEquals (; 20 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (tee_local $2 @@ -2089,7 +2089,7 @@ ) (get_local $2) ) - (func $std/operator-overloading/Tester.shr (; 21 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.shr (; 21 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.shr_s @@ -2106,7 +2106,7 @@ ) ) ) - (func $std/operator-overloading/Tester.shu (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.shu (; 22 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.shr_u @@ -2123,7 +2123,7 @@ ) ) ) - (func $std/operator-overloading/Tester.shl (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/operator-overloading/Tester.shl (; 23 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.shl @@ -2140,7 +2140,7 @@ ) ) ) - (func $std/operator-overloading/Tester.pos (; 24 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.pos (; 24 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.load @@ -2151,7 +2151,7 @@ ) ) ) - (func $std/operator-overloading/Tester.neg (; 25 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.neg (; 25 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.sub @@ -2168,7 +2168,7 @@ ) ) ) - (func $std/operator-overloading/Tester.not (; 26 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.not (; 26 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $std/operator-overloading/Tester#constructor (i32.const 0) (i32.xor @@ -2185,7 +2185,7 @@ ) ) ) - (func $std/operator-overloading/Tester.excl (; 27 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester.excl (; 27 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (tee_local $1 @@ -2205,7 +2205,7 @@ ) (get_local $1) ) - (func $std/operator-overloading/Tester#inc (; 28 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester#inc (; 28 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.store (get_local $0) (i32.add @@ -2226,7 +2226,7 @@ ) (get_local $0) ) - (func $std/operator-overloading/Tester#dec (; 29 ;) (type $ii) (param $0 i32) (result i32) + (func $std/operator-overloading/Tester#dec (; 29 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.store (get_local $0) (i32.sub @@ -2247,7 +2247,7 @@ ) (get_local $0) ) - (func $start (; 30 ;) (type $v) + (func $start (; 30 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (set_global $~lib/allocator/arena/startOffset diff --git a/tests/compiler/std/operator-overloading.untouched.wat b/tests/compiler/std/operator-overloading.untouched.wat index 0a5e2551..70fdb3aa 100644 --- a/tests/compiler/std/operator-overloading.untouched.wat +++ b/tests/compiler/std/operator-overloading.untouched.wat @@ -727,48 +727,51 @@ (get_local $8) (i32.const 2146435072) ) - (if - (i32.eq - (i32.or - (i32.sub + (block + (if + (i32.eq + (i32.or + (i32.sub + (get_local $7) + (i32.const 1072693248) + ) + (get_local $4) + ) + (i32.const 0) + ) + (return + (f64.const nan:0x8000000000000) + ) + (if + (i32.ge_s (get_local $7) (i32.const 1072693248) ) - (get_local $4) - ) - (i32.const 0) - ) - (return - (f64.const nan:0x8000000000000) - ) - (if - (i32.ge_s - (get_local $7) - (i32.const 1072693248) - ) - (return - (if (result f64) - (i32.ge_s - (get_local $5) - (i32.const 0) - ) - (get_local $1) - (f64.const 0) - ) - ) - (return - (if (result f64) - (i32.ge_s - (get_local $5) - (i32.const 0) - ) - (f64.const 0) - (f64.neg + (return + (if (result f64) + (i32.ge_s + (get_local $5) + (i32.const 0) + ) (get_local $1) + (f64.const 0) + ) + ) + (return + (if (result f64) + (i32.ge_s + (get_local $5) + (i32.const 0) + ) + (f64.const 0) + (f64.neg + (get_local $1) + ) ) ) ) ) + (unreachable) ) ) (if diff --git a/tests/compiler/std/pointer.optimized.wat b/tests/compiler/std/pointer.optimized.wat index 407f031b..303664fe 100644 --- a/tests/compiler/std/pointer.optimized.wat +++ b/tests/compiler/std/pointer.optimized.wat @@ -16,10 +16,10 @@ (export "_setargc" (func $~setargc)) (export "Pointer#constructor" (func $std/pointer/Pointer#constructor|trampoline)) (start $start) - (func $std/pointer/Pointer#constructor (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/pointer/Pointer#constructor (; 1 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (get_local $1) ) - (func $start (; 2 ;) (type $v) + (func $start (; 2 ;) (; has Stack IR ;) (type $v) (set_global $std/pointer/one (call $std/pointer/Pointer#constructor (i32.const 0) @@ -277,7 +277,7 @@ ) ) ) - (func $std/pointer/Pointer#constructor|trampoline (; 3 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $std/pointer/Pointer#constructor|trampoline (; 3 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange @@ -296,7 +296,7 @@ (get_local $1) ) ) - (func $~setargc (; 4 ;) (type $iv) (param $0 i32) + (func $~setargc (; 4 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (set_global $~argc (get_local $0) ) diff --git a/tests/compiler/std/polyfills.optimized.wat b/tests/compiler/std/polyfills.optimized.wat index 376afbcf..52acc61a 100644 --- a/tests/compiler/std/polyfills.optimized.wat +++ b/tests/compiler/std/polyfills.optimized.wat @@ -9,7 +9,7 @@ (data (i32.const 48) "\10\00\00\00s\00t\00d\00/\00p\00o\00l\00y\00f\00i\00l\00l\00s\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/polyfills/bswap16 (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap16 (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.eqz @@ -66,7 +66,7 @@ ) (get_local $0) ) - (func $~lib/polyfills/bswap (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.eqz @@ -104,7 +104,7 @@ (get_local $0) ) ) - (func $~lib/polyfills/bswap16 (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap16 (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.eqz @@ -164,7 +164,7 @@ ) (get_local $0) ) - (func $~lib/polyfills/bswap (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap (; 4 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.eqz @@ -202,7 +202,7 @@ (get_local $0) ) ) - (func $~lib/polyfills/bswap (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap (; 5 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.eqz @@ -245,7 +245,7 @@ ) ) ) - (func $~lib/polyfills/bswap (; 6 ;) (type $II) (param $0 i64) (result i64) + (func $~lib/polyfills/bswap (; 6 ;) (; has Stack IR ;) (type $II) (param $0 i64) (result i64) (i64.rotr (i64.or (i64.and @@ -283,7 +283,7 @@ (i64.const 32) ) ) - (func $~lib/polyfills/bswap16 (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap16 (; 7 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.or (i32.or (i32.and @@ -307,7 +307,7 @@ ) ) ) - (func $~lib/polyfills/bswap16 (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/polyfills/bswap16 (; 8 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.or (i32.or (i32.and @@ -331,7 +331,7 @@ ) ) ) - (func $start (; 9 ;) (type $v) + (func $start (; 9 ;) (; has Stack IR ;) (type $v) (if (i32.ne (i32.and diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index 8516d51a..a60806e6 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -28,7 +28,7 @@ (data (i32.const 112) "\n\00\00\00s\00t\00d\00/\00s\00e\00t\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/allocator/arena/__memory_allocate (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -114,12 +114,12 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/allocator/arena/__memory_allocate (get_local $0) ) ) - (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -133,7 +133,7 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 4 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -144,7 +144,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 52) - (i32.const 22) + (i32.const 23) (i32.const 2) ) (unreachable) @@ -152,7 +152,7 @@ ) (i32.store (tee_local $1 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -162,7 +162,7 @@ ) (get_local $1) ) - (func $~lib/memory/memset (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memset (; 5 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -492,14 +492,7 @@ ) ) ) - (func $~lib/memory/memory.fill (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 6 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u @@ -517,7 +510,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $1) ) ) @@ -528,7 +521,7 @@ (i32.const 1) ) ) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (i32.add (get_local $3) (i32.const 8) @@ -539,7 +532,7 @@ ) (get_local $3) ) - (func $~lib/set/Set#clear (; 8 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 7 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -573,7 +566,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 8 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -614,7 +607,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash8 (; 10 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash8 (; 9 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (get_local $0) @@ -623,7 +616,7 @@ (i32.const 16777619) ) ) - (func $~lib/internal/hash/hash (; 11 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 10 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/hash/hash8 (i32.shr_s (i32.shl @@ -634,7 +627,7 @@ ) ) ) - (func $~lib/set/Set#find (; 12 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 11 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -700,7 +693,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 12 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -712,7 +705,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 14 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 13 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -869,7 +862,7 @@ ) ) ) - (func $~lib/set/Set#add (; 15 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 14 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -998,12 +991,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 16 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 15 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 16 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -1104,7 +1097,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 18 ;) (type $v) + (func $std/set/test (; 17 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -1448,7 +1441,7 @@ ) ) ) - (func $~lib/internal/hash/hash (; 19 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 18 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/hash/hash8 (i32.and (get_local $0) @@ -1456,7 +1449,7 @@ ) ) ) - (func $~lib/set/Set#has (; 20 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 19 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -1468,7 +1461,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 21 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 20 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1625,7 +1618,7 @@ ) ) ) - (func $~lib/set/Set#add (; 22 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 21 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1754,7 +1747,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 22 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -1852,7 +1845,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 24 ;) (type $v) + (func $std/set/test (; 23 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -2196,7 +2189,7 @@ ) ) ) - (func $~lib/internal/hash/hash16 (; 25 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash16 (; 24 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -2217,7 +2210,7 @@ (i32.const 16777619) ) ) - (func $~lib/internal/hash/hash (; 26 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 25 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/hash/hash16 (i32.shr_s (i32.shl @@ -2228,7 +2221,7 @@ ) ) ) - (func $~lib/set/Set#find (; 27 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 26 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -2294,7 +2287,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 28 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 27 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -2306,7 +2299,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 29 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 28 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2463,7 +2456,7 @@ ) ) ) - (func $~lib/set/Set#add (; 30 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 29 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2592,7 +2585,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 31 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 30 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -2693,7 +2686,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 32 ;) (type $v) + (func $std/set/test (; 31 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -3037,7 +3030,7 @@ ) ) ) - (func $~lib/internal/hash/hash (; 33 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 32 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/hash/hash16 (i32.and (get_local $0) @@ -3045,7 +3038,7 @@ ) ) ) - (func $~lib/set/Set#has (; 34 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 33 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -3057,7 +3050,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 35 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 34 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3214,7 +3207,7 @@ ) ) ) - (func $~lib/set/Set#add (; 36 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 35 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3343,7 +3336,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 37 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 36 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -3441,7 +3434,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 38 ;) (type $v) + (func $std/set/test (; 37 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -3785,7 +3778,7 @@ ) ) ) - (func $~lib/internal/hash/hash32 (; 39 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 38 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -3830,12 +3823,12 @@ (i32.const 16777619) ) ) - (func $~lib/internal/hash/hash (; 40 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 39 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/internal/hash/hash32 (get_local $0) ) ) - (func $~lib/set/Set#find (; 41 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 40 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -3898,7 +3891,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 42 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 41 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -3910,7 +3903,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 43 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 42 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4067,7 +4060,7 @@ ) ) ) - (func $~lib/set/Set#add (; 44 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 43 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4196,7 +4189,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 45 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 44 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eqz @@ -4291,7 +4284,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 46 ;) (type $v) + (func $std/set/test (; 45 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -4635,7 +4628,7 @@ ) ) ) - (func $std/set/test (; 47 ;) (type $v) + (func $std/set/test (; 46 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i32) (set_local $1 @@ -4979,7 +4972,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 48 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 47 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -5013,7 +5006,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 49 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 48 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -5054,7 +5047,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash64 (; 50 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash64 (; 49 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (i32.mul (i32.xor @@ -5153,12 +5146,12 @@ (i32.const 16777619) ) ) - (func $~lib/internal/hash/hash (; 51 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash (; 50 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) (call $~lib/internal/hash/hash64 (get_local $0) ) ) - (func $~lib/set/Set#find (; 52 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 51 ;) (; has Stack IR ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -5221,7 +5214,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 53 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#has (; 52 ;) (; has Stack IR ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -5233,7 +5226,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 54 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 53 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5390,7 +5383,7 @@ ) ) ) - (func $~lib/set/Set#add (; 55 ;) (type $iIv) (param $0 i32) (param $1 i64) + (func $~lib/set/Set#add (; 54 ;) (; has Stack IR ;) (type $iIv) (param $0 i32) (param $1 i64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5519,7 +5512,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 56 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#delete (; 55 ;) (; has Stack IR ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (if @@ -5615,7 +5608,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 57 ;) (type $v) + (func $std/set/test (; 56 ;) (; has Stack IR ;) (type $v) (local $0 i64) (local $1 i32) (set_local $1 @@ -5959,7 +5952,7 @@ ) ) ) - (func $std/set/test (; 58 ;) (type $v) + (func $std/set/test (; 57 ;) (; has Stack IR ;) (type $v) (local $0 i64) (local $1 i32) (set_local $1 @@ -6303,14 +6296,14 @@ ) ) ) - (func $~lib/internal/hash/hash (; 59 ;) (type $fi) (param $0 f32) (result i32) + (func $~lib/internal/hash/hash (; 58 ;) (; has Stack IR ;) (type $fi) (param $0 f32) (result i32) (call $~lib/internal/hash/hash32 (i32.reinterpret/f32 (get_local $0) ) ) ) - (func $~lib/set/Set#find (; 60 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 59 ;) (; has Stack IR ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -6373,7 +6366,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 61 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/set/Set#has (; 60 ;) (; has Stack IR ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -6385,7 +6378,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 62 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 61 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6544,7 +6537,7 @@ ) ) ) - (func $~lib/set/Set#add (; 63 ;) (type $ifv) (param $0 i32) (param $1 f32) + (func $~lib/set/Set#add (; 62 ;) (; has Stack IR ;) (type $ifv) (param $0 i32) (param $1 f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6673,7 +6666,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 64 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/set/Set#delete (; 63 ;) (; has Stack IR ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (local $3 i32) (if @@ -6771,7 +6764,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 65 ;) (type $v) + (func $std/set/test (; 64 ;) (; has Stack IR ;) (type $v) (local $0 f32) (local $1 i32) (set_local $1 @@ -7123,14 +7116,14 @@ ) ) ) - (func $~lib/internal/hash/hash (; 66 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/internal/hash/hash (; 65 ;) (; has Stack IR ;) (type $Fi) (param $0 f64) (result i32) (call $~lib/internal/hash/hash64 (i64.reinterpret/f64 (get_local $0) ) ) ) - (func $~lib/set/Set#find (; 67 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 66 ;) (; has Stack IR ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -7193,7 +7186,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 68 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/set/Set#has (; 67 ;) (; has Stack IR ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -7205,7 +7198,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 69 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 68 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7364,7 +7357,7 @@ ) ) ) - (func $~lib/set/Set#add (; 70 ;) (type $iFv) (param $0 i32) (param $1 f64) + (func $~lib/set/Set#add (; 69 ;) (; has Stack IR ;) (type $iFv) (param $0 i32) (param $1 f64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7493,7 +7486,7 @@ ) ) ) - (func $~lib/set/Set#delete (; 71 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/set/Set#delete (; 70 ;) (; has Stack IR ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 i32) (if @@ -7591,7 +7584,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 72 ;) (type $v) + (func $std/set/test (; 71 ;) (; has Stack IR ;) (type $v) (local $0 f64) (local $1 i32) (set_local $1 @@ -7943,7 +7936,7 @@ ) ) ) - (func $start (; 73 ;) (type $v) + (func $start (; 72 ;) (; has Stack IR ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.const 136) ) diff --git a/tests/compiler/std/set.untouched.wat b/tests/compiler/std/set.untouched.wat index c9fa1d85..a2a6d4d0 100644 --- a/tests/compiler/std/set.untouched.wat +++ b/tests/compiler/std/set.untouched.wat @@ -174,8 +174,9 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) + (local $2 i32) (if (i32.eqz (i32.le_u @@ -187,16 +188,23 @@ (call $~lib/env/abort (i32.const 0) (i32.const 52) - (i32.const 22) + (i32.const 23) (i32.const 2) ) (unreachable) ) ) (set_local $1 - (call $~lib/memory/memory.allocate - (call $~lib/internal/arraybuffer/computeSize - (get_local $0) + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $2 + (call $~lib/internal/arraybuffer/computeSize + (get_local $0) + ) + ) + (br $~lib/memory/memory.allocate|inlined.0 + (call $~lib/allocator/arena/__memory_allocate + (get_local $2) + ) ) ) ) @@ -206,7 +214,7 @@ ) (get_local $1) ) - (func $~lib/memory/memset (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memset (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -558,15 +566,10 @@ ) ) ) - (func $~lib/memory/memory.fill (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 6 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) + (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -583,7 +586,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $1) ) ) @@ -594,18 +597,26 @@ (i32.const 1) ) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.0 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $1) ) - (i32.const 0) - (get_local $1) ) ) (get_local $3) ) - (func $~lib/set/Set#clear (; 8 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 7 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -642,7 +653,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 8 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -688,7 +699,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash8 (; 10 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash8 (; 9 ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (get_global $~lib/internal/hash/FNV_OFFSET) @@ -697,7 +708,7 @@ (get_global $~lib/internal/hash/FNV_PRIME) ) ) - (func $~lib/internal/hash/hash (; 11 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 10 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash8 (i32.shr_s @@ -710,7 +721,7 @@ ) ) ) - (func $~lib/set/Set#find (; 12 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -786,7 +797,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -798,7 +809,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 14 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 13 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -989,7 +1000,7 @@ ) ) ) - (func $~lib/set/Set#add (; 15 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 14 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1128,12 +1139,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 16 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 15 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1239,7 +1250,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 18 ;) (type $v) + (func $std/set/test (; 17 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -1627,7 +1638,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 19 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 18 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -1664,7 +1675,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 20 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 19 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -1710,7 +1721,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 21 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 20 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash8 (i32.and @@ -1720,7 +1731,7 @@ ) ) ) - (func $~lib/set/Set#find (; 22 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -1793,7 +1804,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -1805,7 +1816,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 24 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 23 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1996,7 +2007,7 @@ ) ) ) - (func $~lib/set/Set#add (; 25 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 24 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2135,12 +2146,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 26 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 25 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2243,7 +2254,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 28 ;) (type $v) + (func $std/set/test (; 27 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -2631,7 +2642,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 29 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 28 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -2668,7 +2679,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 30 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 29 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -2714,7 +2725,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash16 (; 31 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash16 (; 30 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (get_global $~lib/internal/hash/FNV_OFFSET) @@ -2745,7 +2756,7 @@ ) (get_local $1) ) - (func $~lib/internal/hash/hash (; 32 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 31 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash16 (i32.shr_s @@ -2758,7 +2769,7 @@ ) ) ) - (func $~lib/set/Set#find (; 33 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 32 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -2834,7 +2845,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 34 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 33 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -2846,7 +2857,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 35 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 34 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3037,7 +3048,7 @@ ) ) ) - (func $~lib/set/Set#add (; 36 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 35 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3176,12 +3187,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 37 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 36 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 38 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 37 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3287,7 +3298,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 39 ;) (type $v) + (func $std/set/test (; 38 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -3675,7 +3686,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 40 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 39 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -3712,7 +3723,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 41 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 40 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -3758,7 +3769,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 42 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 41 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash16 (i32.and @@ -3768,7 +3779,7 @@ ) ) ) - (func $~lib/set/Set#find (; 43 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 42 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -3841,7 +3852,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 44 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 43 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -3853,7 +3864,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 45 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 44 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4044,7 +4055,7 @@ ) ) ) - (func $~lib/set/Set#add (; 46 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 45 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4183,12 +4194,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 47 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 46 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 48 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 47 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4291,7 +4302,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 49 ;) (type $v) + (func $std/set/test (; 48 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -4679,7 +4690,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 50 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 49 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -4716,7 +4727,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 51 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 50 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -4762,7 +4773,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash32 (; 52 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 51 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (get_global $~lib/internal/hash/FNV_OFFSET) @@ -4823,14 +4834,14 @@ ) (get_local $1) ) - (func $~lib/internal/hash/hash (; 53 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 52 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash32 (get_local $0) ) ) ) - (func $~lib/set/Set#find (; 54 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 53 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -4900,7 +4911,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 55 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 54 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -4912,7 +4923,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 56 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 55 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5103,7 +5114,7 @@ ) ) ) - (func $~lib/set/Set#add (; 57 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 56 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5242,12 +5253,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 58 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 57 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 59 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 58 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5347,7 +5358,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 60 ;) (type $v) + (func $std/set/test (; 59 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -5735,7 +5746,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 61 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 60 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -5772,7 +5783,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 62 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 61 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -5818,14 +5829,14 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 63 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash (; 62 ;) (type $ii) (param $0 i32) (result i32) (return (call $~lib/internal/hash/hash32 (get_local $0) ) ) ) - (func $~lib/set/Set#find (; 64 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 63 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -5895,7 +5906,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 65 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#has (; 64 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -5907,7 +5918,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 66 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 65 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6098,7 +6109,7 @@ ) ) ) - (func $~lib/set/Set#add (; 67 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#add (; 66 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6237,12 +6248,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 68 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 67 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 69 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/set/Set#delete (; 68 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -6342,7 +6353,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 70 ;) (type $v) + (func $std/set/test (; 69 ;) (type $v) (local $0 i32) (local $1 i32) (set_local $0 @@ -6730,7 +6741,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 71 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 70 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -6767,7 +6778,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 72 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 71 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -6813,7 +6824,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash64 (; 73 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash64 (; 72 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -6943,14 +6954,14 @@ ) (get_local $3) ) - (func $~lib/internal/hash/hash (; 74 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash (; 73 ;) (type $Ii) (param $0 i64) (result i32) (return (call $~lib/internal/hash/hash64 (get_local $0) ) ) ) - (func $~lib/set/Set#find (; 75 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 74 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -7020,7 +7031,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 76 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#has (; 75 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -7032,7 +7043,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 77 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 76 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7224,7 +7235,7 @@ ) ) ) - (func $~lib/set/Set#add (; 78 ;) (type $iIv) (param $0 i32) (param $1 i64) + (func $~lib/set/Set#add (; 77 ;) (type $iIv) (param $0 i32) (param $1 i64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7363,12 +7374,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 79 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 78 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 80 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#delete (; 79 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -7468,7 +7479,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 81 ;) (type $v) + (func $std/set/test (; 80 ;) (type $v) (local $0 i32) (local $1 i64) (set_local $0 @@ -7856,7 +7867,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 82 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 81 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -7893,7 +7904,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 83 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 82 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -7939,14 +7950,14 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 84 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/hash/hash (; 83 ;) (type $Ii) (param $0 i64) (result i32) (return (call $~lib/internal/hash/hash64 (get_local $0) ) ) ) - (func $~lib/set/Set#find (; 85 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 84 ;) (type $iIii) (param $0 i32) (param $1 i64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -8016,7 +8027,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 86 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#has (; 85 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -8028,7 +8039,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 87 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 86 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8220,7 +8231,7 @@ ) ) ) - (func $~lib/set/Set#add (; 88 ;) (type $iIv) (param $0 i32) (param $1 i64) + (func $~lib/set/Set#add (; 87 ;) (type $iIv) (param $0 i32) (param $1 i64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8359,12 +8370,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 89 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 88 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 90 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) + (func $~lib/set/Set#delete (; 89 ;) (type $iIi) (param $0 i32) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -8464,7 +8475,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 91 ;) (type $v) + (func $std/set/test (; 90 ;) (type $v) (local $0 i32) (local $1 i64) (set_local $0 @@ -8852,7 +8863,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 92 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 91 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -8889,7 +8900,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 93 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 92 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -8935,7 +8946,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 94 ;) (type $fi) (param $0 f32) (result i32) + (func $~lib/internal/hash/hash (; 93 ;) (type $fi) (param $0 f32) (result i32) (return (call $~lib/internal/hash/hash32 (i32.reinterpret/f32 @@ -8944,7 +8955,7 @@ ) ) ) - (func $~lib/set/Set#find (; 95 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 94 ;) (type $ifii) (param $0 i32) (param $1 f32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -9014,7 +9025,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 96 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/set/Set#has (; 95 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -9026,7 +9037,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 97 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 96 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9220,7 +9231,7 @@ ) ) ) - (func $~lib/set/Set#add (; 98 ;) (type $ifv) (param $0 i32) (param $1 f32) + (func $~lib/set/Set#add (; 97 ;) (type $ifv) (param $0 i32) (param $1 f32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9359,12 +9370,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 99 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 98 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 100 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) + (func $~lib/set/Set#delete (; 99 ;) (type $ifi) (param $0 i32) (param $1 f32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -9466,7 +9477,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 101 ;) (type $v) + (func $std/set/test (; 100 ;) (type $v) (local $0 i32) (local $1 f32) (set_local $0 @@ -9854,7 +9865,7 @@ ) ) ) - (func $~lib/set/Set#clear (; 102 ;) (type $iv) (param $0 i32) + (func $~lib/set/Set#clear (; 101 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -9891,7 +9902,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#constructor (; 103 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#constructor (; 102 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/set/Set#clear (tee_local $0 @@ -9937,7 +9948,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hash (; 104 ;) (type $Fi) (param $0 f64) (result i32) + (func $~lib/internal/hash/hash (; 103 ;) (type $Fi) (param $0 f64) (result i32) (return (call $~lib/internal/hash/hash64 (i64.reinterpret/f64 @@ -9946,7 +9957,7 @@ ) ) ) - (func $~lib/set/Set#find (; 105 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) + (func $~lib/set/Set#find (; 104 ;) (type $iFii) (param $0 i32) (param $1 f64) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -10016,7 +10027,7 @@ ) (i32.const 0) ) - (func $~lib/set/Set#has (; 106 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/set/Set#has (; 105 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (i32.ne (call $~lib/set/Set#find (get_local $0) @@ -10028,7 +10039,7 @@ (i32.const 0) ) ) - (func $~lib/set/Set#rehash (; 107 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/set/Set#rehash (; 106 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10222,7 +10233,7 @@ ) ) ) - (func $~lib/set/Set#add (; 108 ;) (type $iFv) (param $0 i32) (param $1 f64) + (func $~lib/set/Set#add (; 107 ;) (type $iFv) (param $0 i32) (param $1 f64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10361,12 +10372,12 @@ ) ) ) - (func $~lib/set/Set#get:size (; 109 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/set/Set#get:size (; 108 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=20 (get_local $0) ) ) - (func $~lib/set/Set#delete (; 110 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) + (func $~lib/set/Set#delete (; 109 ;) (type $iFi) (param $0 i32) (param $1 f64) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -10468,7 +10479,7 @@ ) (i32.const 1) ) - (func $std/set/test (; 111 ;) (type $v) + (func $std/set/test (; 110 ;) (type $v) (local $0 i32) (local $1 f64) (set_local $0 @@ -10856,7 +10867,7 @@ ) ) ) - (func $start (; 112 ;) (type $v) + (func $start (; 111 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add diff --git a/tests/compiler/std/static-array.optimized.wat b/tests/compiler/std/static-array.optimized.wat index 2ed2947e..fa1d0b79 100644 --- a/tests/compiler/std/static-array.optimized.wat +++ b/tests/compiler/std/static-array.optimized.wat @@ -25,12 +25,12 @@ (data (i32.const 212) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/array/Array#get:length (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $~lib/array/Array#__get (; 2 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/array/Array#__get (; 2 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (i32.lt_u @@ -59,7 +59,7 @@ ) ) ) - (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/computeSize (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -73,7 +73,7 @@ ) ) ) - (func $~lib/memory/memset (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memset (; 4 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -403,14 +403,7 @@ ) ) ) - (func $~lib/memory/memory.fill (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/allocator/arena/__memory_allocate (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 5 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -496,12 +489,7 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 7 ;) (type $ii) (param $0 i32) (result i32) - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 6 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -512,7 +500,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 212) - (i32.const 22) + (i32.const 23) (i32.const 2) ) (unreachable) @@ -520,7 +508,7 @@ ) (i32.store (tee_local $1 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -530,7 +518,7 @@ ) (get_local $1) ) - (func $~lib/memory/memcpy (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memcpy (; 7 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1916,7 +1904,7 @@ ) ) ) - (func $~lib/memory/memmove (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memmove (; 8 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -1951,7 +1939,7 @@ (if (get_local $3) (block - (call $~lib/memory/memcpy + (call $~lib/internal/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2208,14 +2196,7 @@ ) ) ) - (func $~lib/memory/memory.copy (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memmove - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/internal/arraybuffer/reallocUnsafe (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/arraybuffer/reallocateUnsafe (; 9 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -2237,7 +2218,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 212) - (i32.const 32) + (i32.const 37) (i32.const 4) ) (unreachable) @@ -2258,7 +2239,7 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (i32.add (i32.add (get_local $0) @@ -2274,10 +2255,10 @@ ) ) (block - (call $~lib/memory/memory.copy + (call $~lib/internal/memory/memmove (i32.add (tee_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $1) ) ) @@ -2289,7 +2270,7 @@ ) (get_local $2) ) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (i32.add (i32.add (get_local $3) @@ -2324,7 +2305,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 212) - (i32.const 56) + (i32.const 61) (i32.const 4) ) (unreachable) @@ -2339,7 +2320,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#__set (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__set (; 10 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -2375,7 +2356,7 @@ (i32.store (get_local $0) (tee_local $3 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $3) (i32.shl (tee_local $4 @@ -2406,7 +2387,7 @@ (get_local $2) ) ) - (func $~lib/array/Array#__get (; 14 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64) + (func $~lib/array/Array#__get (; 11 ;) (; has Stack IR ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64) (if (result i64) (i32.lt_u (get_local $1) @@ -2433,7 +2414,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 15 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64) + (func $~lib/array/Array#__set (; 12 ;) (; has Stack IR ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (local $4 i32) (if @@ -2469,7 +2450,7 @@ (i32.store (get_local $0) (tee_local $3 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $3) (i32.shl (tee_local $4 @@ -2500,7 +2481,7 @@ (get_local $2) ) ) - (func $~lib/array/Array#__get (; 16 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) + (func $~lib/array/Array#__get (; 13 ;) (; has Stack IR ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) (if (result f32) (i32.lt_u (get_local $1) @@ -2527,7 +2508,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 17 ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32) + (func $~lib/array/Array#__set (; 14 ;) (; has Stack IR ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32) (local $3 i32) (local $4 i32) (if @@ -2563,7 +2544,7 @@ (i32.store (get_local $0) (tee_local $3 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $3) (i32.shl (tee_local $4 @@ -2594,7 +2575,7 @@ (get_local $2) ) ) - (func $~lib/array/Array#__get (; 18 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/array/Array#__get (; 15 ;) (; has Stack IR ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (if (result f64) (i32.lt_u (get_local $1) @@ -2621,7 +2602,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 19 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64) + (func $~lib/array/Array#__set (; 16 ;) (; has Stack IR ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (local $4 i32) (if @@ -2657,7 +2638,7 @@ (i32.store (get_local $0) (tee_local $3 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $3) (i32.shl (tee_local $4 @@ -2688,7 +2669,7 @@ (get_local $2) ) ) - (func $start (; 20 ;) (type $v) + (func $start (; 17 ;) (; has Stack IR ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.const 272) ) diff --git a/tests/compiler/std/static-array.untouched.wat b/tests/compiler/std/static-array.untouched.wat index 70dd5c69..ad6395c0 100644 --- a/tests/compiler/std/static-array.untouched.wat +++ b/tests/compiler/std/static-array.untouched.wat @@ -87,7 +87,7 @@ ) ) ) - (func $~lib/memory/memset (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memset (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -439,14 +439,7 @@ ) ) ) - (func $~lib/memory/memory.fill (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/allocator/arena/__memory_allocate (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -554,15 +547,9 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 7 ;) (type $ii) (param $0 i32) (result i32) - (return - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 6 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) + (local $2 i32) (if (i32.eqz (i32.le_u @@ -574,16 +561,23 @@ (call $~lib/env/abort (i32.const 0) (i32.const 212) - (i32.const 22) + (i32.const 23) (i32.const 2) ) (unreachable) ) ) (set_local $1 - (call $~lib/memory/memory.allocate - (call $~lib/internal/arraybuffer/computeSize - (get_local $0) + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $2 + (call $~lib/internal/arraybuffer/computeSize + (get_local $0) + ) + ) + (br $~lib/memory/memory.allocate|inlined.0 + (call $~lib/allocator/arena/__memory_allocate + (get_local $2) + ) ) ) ) @@ -593,7 +587,7 @@ ) (get_local $1) ) - (func $~lib/memory/memcpy (; 9 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memcpy (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2395,7 +2389,7 @@ ) ) ) - (func $~lib/memory/memmove (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memmove (; 8 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.eq @@ -2425,7 +2419,7 @@ ) ) (block - (call $~lib/memory/memcpy + (call $~lib/internal/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2713,16 +2707,12 @@ ) ) ) - (func $~lib/memory/memory.copy (; 11 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memmove - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/internal/arraybuffer/reallocUnsafe (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/arraybuffer/reallocateUnsafe (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) + (local $4 i32) + (local $5 i32) + (local $6 i32) (set_local $2 (i32.load (get_local $0) @@ -2745,7 +2735,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 212) - (i32.const 32) + (i32.const 37) (i32.const 4) ) (unreachable) @@ -2766,54 +2756,84 @@ (get_local $0) (get_local $1) ) - (call $~lib/memory/memory.fill - (i32.add + (block $~lib/memory/memory.fill|inlined.0 + (set_local $3 (i32.add - (get_local $0) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (i32.add + (get_local $0) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + (get_local $2) ) - (get_local $2) ) - (i32.const 0) - (i32.sub - (get_local $1) - (get_local $2) + (set_local $4 + (i32.const 0) + ) + (set_local $5 + (i32.sub + (get_local $1) + (get_local $2) + ) + ) + (call $~lib/internal/memory/memset + (get_local $3) + (get_local $4) + (get_local $5) ) ) ) (block - (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (set_local $5 + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $1) ) ) - (call $~lib/memory/memory.copy - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) - ) - (i32.add - (get_local $0) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) - ) - (get_local $2) - ) - (call $~lib/memory/memory.fill - (i32.add + (block $~lib/memory/memory.copy|inlined.0 + (set_local $4 (i32.add - (get_local $3) + (get_local $5) (get_global $~lib/internal/arraybuffer/HEADER_SIZE) ) + ) + (set_local $3 + (i32.add + (get_local $0) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (call $~lib/internal/memory/memmove + (get_local $4) + (get_local $3) (get_local $2) ) - (i32.const 0) - (i32.sub - (get_local $1) - (get_local $2) + ) + (block $~lib/memory/memory.fill|inlined.1 + (set_local $3 + (i32.add + (i32.add + (get_local $5) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + (get_local $2) + ) + ) + (set_local $4 + (i32.const 0) + ) + (set_local $6 + (i32.sub + (get_local $1) + (get_local $2) + ) + ) + (call $~lib/internal/memory/memset + (get_local $3) + (get_local $4) + (get_local $6) ) ) (return - (get_local $3) + (get_local $5) ) ) ) @@ -2835,7 +2855,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 212) - (i32.const 56) + (i32.const 61) (i32.const 4) ) (unreachable) @@ -2850,7 +2870,7 @@ ) (get_local $0) ) - (func $~lib/array/Array#__set (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/array/Array#__set (; 10 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -2888,7 +2908,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $3) (i32.shl (i32.add @@ -2925,12 +2945,12 @@ ) ) ) - (func $~lib/array/Array#get:length (; 14 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 11 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $~lib/array/Array#__get (; 15 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64) + (func $~lib/array/Array#__get (; 12 ;) (type $iiI) (param $0 i32) (param $1 i32) (result i64) (local $2 i32) (set_local $2 (i32.load @@ -2961,7 +2981,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 16 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64) + (func $~lib/array/Array#__set (; 13 ;) (type $iiIv) (param $0 i32) (param $1 i32) (param $2 i64) (local $3 i32) (local $4 i32) (set_local $3 @@ -2999,7 +3019,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $3) (i32.shl (i32.add @@ -3036,12 +3056,12 @@ ) ) ) - (func $~lib/array/Array#get:length (; 17 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 14 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $~lib/array/Array#__get (; 18 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) + (func $~lib/array/Array#__get (; 15 ;) (type $iif) (param $0 i32) (param $1 i32) (result f32) (local $2 i32) (set_local $2 (i32.load @@ -3072,7 +3092,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 19 ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32) + (func $~lib/array/Array#__set (; 16 ;) (type $iifv) (param $0 i32) (param $1 i32) (param $2 f32) (local $3 i32) (local $4 i32) (set_local $3 @@ -3110,7 +3130,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $3) (i32.shl (i32.add @@ -3147,12 +3167,12 @@ ) ) ) - (func $~lib/array/Array#get:length (; 20 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/array/Array#get:length (; 17 ;) (type $ii) (param $0 i32) (result i32) (i32.load offset=4 (get_local $0) ) ) - (func $~lib/array/Array#__get (; 21 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/array/Array#__get (; 18 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (set_local $2 (i32.load @@ -3183,7 +3203,7 @@ (unreachable) ) ) - (func $~lib/array/Array#__set (; 22 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64) + (func $~lib/array/Array#__set (; 19 ;) (type $iiFv) (param $0 i32) (param $1 i32) (param $2 f64) (local $3 i32) (local $4 i32) (set_local $3 @@ -3221,7 +3241,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/reallocUnsafe + (call $~lib/internal/arraybuffer/reallocateUnsafe (get_local $3) (i32.shl (i32.add @@ -3258,7 +3278,7 @@ ) ) ) - (func $start (; 23 ;) (type $v) + (func $start (; 20 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add diff --git a/tests/compiler/std/string-utf8.optimized.wat b/tests/compiler/std/string-utf8.optimized.wat index 0e94dcfc..fa12f704 100644 --- a/tests/compiler/std/string-utf8.optimized.wat +++ b/tests/compiler/std/string-utf8.optimized.wat @@ -14,7 +14,7 @@ (data (i32.const 24) "\12\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00-\00u\00t\00f\008\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/string/String#get:lengthUTF8 (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/string/String#get:lengthUTF8 (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -160,7 +160,7 @@ ) (get_local $1) ) - (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -246,12 +246,7 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - (func $~lib/string/String#toUTF8 (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/string/String#toUTF8 (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -260,7 +255,7 @@ (local $6 i32) (local $7 i32) (set_local $5 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (call $~lib/string/String#get:lengthUTF8 (get_local $0) ) @@ -537,15 +532,10 @@ ) (get_local $5) ) - (func $~lib/allocator/arena/__memory_free (; 5 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 4 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/memory/memory.free (; 6 ;) (type $iv) (param $0 i32) - (call $~lib/allocator/arena/__memory_free - (get_local $0) - ) - ) - (func $start (; 7 ;) (type $v) + (func $start (; 5 ;) (; has Stack IR ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.const 64) ) @@ -761,7 +751,7 @@ (unreachable) ) ) - (call $~lib/memory/memory.free + (call $~lib/allocator/arena/__memory_free (get_global $std/string-utf8/ptr) ) ) diff --git a/tests/compiler/std/string-utf8.untouched.wat b/tests/compiler/std/string-utf8.untouched.wat index aff3a817..d662ce10 100644 --- a/tests/compiler/std/string-utf8.untouched.wat +++ b/tests/compiler/std/string-utf8.untouched.wat @@ -285,14 +285,7 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) - (return - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - ) - (func $~lib/string/String#toUTF8 (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/string/String#toUTF8 (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -300,39 +293,46 @@ (local $5 i32) (local $6 i32) (local $7 i32) - (set_local $1 - (call $~lib/memory/memory.allocate - (call $~lib/string/String#get:lengthUTF8 - (get_local $0) + (set_local $2 + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $1 + (call $~lib/string/String#get:lengthUTF8 + (get_local $0) + ) + ) + (br $~lib/memory/memory.allocate|inlined.0 + (call $~lib/allocator/arena/__memory_allocate + (get_local $1) + ) ) ) ) - (set_local $2 + (set_local $3 (i32.const 0) ) - (set_local $3 + (set_local $4 (i32.load (get_local $0) ) ) - (set_local $4 + (set_local $5 (i32.const 0) ) (block $break|0 (loop $continue|0 (if (i32.lt_u - (get_local $2) (get_local $3) + (get_local $4) ) (block (block - (set_local $5 + (set_local $1 (i32.load16_u offset=4 (i32.add (get_local $0) (i32.shl - (get_local $2) + (get_local $3) (i32.const 1) ) ) @@ -340,47 +340,47 @@ ) (if (i32.lt_u - (get_local $5) + (get_local $1) (i32.const 128) ) (block (i32.store8 (i32.add - (get_local $1) - (get_local $4) + (get_local $2) + (get_local $5) ) - (get_local $5) + (get_local $1) ) - (set_local $4 + (set_local $5 (i32.add - (get_local $4) + (get_local $5) (i32.const 1) ) ) - (set_local $2 + (set_local $3 (i32.add - (get_local $2) + (get_local $3) (i32.const 1) ) ) ) (if (i32.lt_u - (get_local $5) + (get_local $1) (i32.const 2048) ) (block (set_local $6 (i32.add - (get_local $1) - (get_local $4) + (get_local $2) + (get_local $5) ) ) (i32.store8 (get_local $6) (i32.or (i32.shr_u - (get_local $5) + (get_local $1) (i32.const 6) ) (i32.const 192) @@ -390,21 +390,21 @@ (get_local $6) (i32.or (i32.and - (get_local $5) + (get_local $1) (i32.const 63) ) (i32.const 128) ) ) - (set_local $4 + (set_local $5 (i32.add - (get_local $4) + (get_local $5) (i32.const 2) ) ) - (set_local $2 + (set_local $3 (i32.add - (get_local $2) + (get_local $3) (i32.const 1) ) ) @@ -412,8 +412,8 @@ (block (set_local $6 (i32.add - (get_local $1) - (get_local $4) + (get_local $2) + (get_local $5) ) ) (if @@ -421,7 +421,7 @@ (tee_local $7 (i32.eq (i32.and - (get_local $5) + (get_local $1) (i32.const 64512) ) (i32.const 55296) @@ -429,10 +429,10 @@ ) (i32.lt_u (i32.add - (get_local $2) + (get_local $3) (i32.const 1) ) - (get_local $3) + (get_local $4) ) (get_local $7) ) @@ -443,7 +443,7 @@ (get_local $0) (i32.shl (i32.add - (get_local $2) + (get_local $3) (i32.const 1) ) (i32.const 1) @@ -460,13 +460,13 @@ (i32.const 56320) ) (block - (set_local $5 + (set_local $1 (i32.add (i32.add (i32.const 65536) (i32.shl (i32.and - (get_local $5) + (get_local $1) (i32.const 1023) ) (i32.const 10) @@ -482,7 +482,7 @@ (get_local $6) (i32.or (i32.shr_u - (get_local $5) + (get_local $1) (i32.const 18) ) (i32.const 240) @@ -493,7 +493,7 @@ (i32.or (i32.and (i32.shr_u - (get_local $5) + (get_local $1) (i32.const 12) ) (i32.const 63) @@ -506,7 +506,7 @@ (i32.or (i32.and (i32.shr_u - (get_local $5) + (get_local $1) (i32.const 6) ) (i32.const 63) @@ -518,21 +518,21 @@ (get_local $6) (i32.or (i32.and - (get_local $5) + (get_local $1) (i32.const 63) ) (i32.const 128) ) ) - (set_local $4 + (set_local $5 (i32.add - (get_local $4) + (get_local $5) (i32.const 4) ) ) - (set_local $2 + (set_local $3 (i32.add - (get_local $2) + (get_local $3) (i32.const 2) ) ) @@ -545,7 +545,7 @@ (get_local $6) (i32.or (i32.shr_u - (get_local $5) + (get_local $1) (i32.const 12) ) (i32.const 224) @@ -556,7 +556,7 @@ (i32.or (i32.and (i32.shr_u - (get_local $5) + (get_local $1) (i32.const 6) ) (i32.const 63) @@ -568,21 +568,21 @@ (get_local $6) (i32.or (i32.and - (get_local $5) + (get_local $1) (i32.const 63) ) (i32.const 128) ) ) - (set_local $4 + (set_local $5 (i32.add - (get_local $4) + (get_local $5) (i32.const 3) ) ) - (set_local $2 + (set_local $3 (i32.add - (get_local $2) + (get_local $3) (i32.const 1) ) ) @@ -597,23 +597,18 @@ ) (i32.store8 (i32.add - (get_local $1) - (get_local $4) + (get_local $2) + (get_local $5) ) (i32.const 0) ) - (get_local $1) + (get_local $2) ) - (func $~lib/allocator/arena/__memory_free (; 5 ;) (type $iv) (param $0 i32) + (func $~lib/allocator/arena/__memory_free (; 4 ;) (type $iv) (param $0 i32) (nop) ) - (func $~lib/memory/memory.free (; 6 ;) (type $iv) (param $0 i32) - (call $~lib/allocator/arena/__memory_free - (get_local $0) - ) - (return) - ) - (func $start (; 7 ;) (type $v) + (func $start (; 5 ;) (type $v) + (local $0 i32) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add @@ -865,8 +860,16 @@ (unreachable) ) ) - (call $~lib/memory/memory.free - (get_global $std/string-utf8/ptr) + (block $~lib/memory/memory.free|inlined.0 + (set_local $0 + (get_global $std/string-utf8/ptr) + ) + (block + (call $~lib/allocator/arena/__memory_free + (get_local $0) + ) + (br $~lib/memory/memory.free|inlined.0) + ) ) ) ) diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index dde8dddb..9739b319 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -5,6 +5,7 @@ (type $iiiiii (func (param i32 i32 i32 i32 i32) (result i32))) (type $iiii (func (param i32 i32 i32) (result i32))) (type $iiiv (func (param i32 i32 i32))) + (type $iiiiiv (func (param i32 i32 i32 i32 i32))) (type $i (func (result i32))) (type $iiF (func (param i32 i32) (result f64))) (type $iF (func (param i32) (result f64))) @@ -14,25 +15,25 @@ (import "env" "abort" (func $~lib/env/abort (param i32 i32 i32 i32))) (global $~lib/allocator/arena/startOffset (mut i32) (i32.const 0)) (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) - (global $std/string/str (mut i32) (i32.const 12)) + (global $std/string/str (mut i32) (i32.const 8)) (global $std/string/nullStr (mut i32) (i32.const 0)) (global $~argc (mut i32) (i32.const 0)) (global $std/string/c (mut i32) (i32.const 0)) (global $std/string/a (mut i32) (i32.const 0)) (global $std/string/b (mut i32) (i32.const 0)) (memory $0 1) - (data (i32.const 12) "\10\00\00\00h\00i\00,\00 \00I\00\'\00m\00 \00a\00 \00s\00t\00r\00i\00n\00g") - (data (i32.const 48) "\0d\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") - (data (i32.const 80) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") - (data (i32.const 112) "\01") - (data (i32.const 120) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") - (data (i32.const 172) "\01\00\00\006") - (data (i32.const 180) "\02\00\00\004\d8\06\df") - (data (i32.const 188) "\02\00\00\00h\00i") - (data (i32.const 196) "\04\00\00\00n\00u\00l\00l") - (data (i32.const 208) "\06\00\00\00s\00t\00r\00i\00n\00g") - (data (i32.const 224) "\03\00\00\00I\00\'\00m") - (data (i32.const 236) "\01\00\00\00 ") + (data (i32.const 8) "\10\00\00\00h\00i\00,\00 \00I\00\'\00m\00 \00a\00 \00s\00t\00r\00i\00n\00g") + (data (i32.const 44) "\0d\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") + (data (i32.const 76) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") + (data (i32.const 108) "\01") + (data (i32.const 116) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s") + (data (i32.const 168) "\01\00\00\006") + (data (i32.const 176) "\02\00\00\004\d8\06\df") + (data (i32.const 184) "\02\00\00\00h\00i") + (data (i32.const 192) "\04\00\00\00n\00u\00l\00l") + (data (i32.const 204) "\06\00\00\00s\00t\00r\00i\00n\00g") + (data (i32.const 220) "\03\00\00\00I\00\'\00m") + (data (i32.const 232) "\01\00\00\00 ") (data (i32.const 244) "\03\00\00\00 \00 \00 ") (data (i32.const 256) "\01\00\00\00a") (data (i32.const 264) "\03\00\00\00a\00b\00c") @@ -105,7 +106,7 @@ (export "memory" (memory $0)) (export "getString" (func $std/string/getString)) (start $start) - (func $~lib/string/String#charCodeAt (; 1 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#charCodeAt (; 1 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) @@ -113,8 +114,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 77) + (i32.const 76) + (i32.const 73) (i32.const 4) ) (unreachable) @@ -141,7 +142,7 @@ ) ) ) - (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -227,12 +228,7 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - (func $~lib/internal/string/allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/string/allocateUnsafe (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (tee_local $1 @@ -255,8 +251,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 120) - (i32.const 25) + (i32.const 116) + (i32.const 14) (i32.const 2) ) (unreachable) @@ -264,7 +260,7 @@ ) (i32.store (tee_local $1 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (i32.add (i32.shl (get_local $0) @@ -278,19 +274,19 @@ ) (get_local $1) ) - (func $~lib/string/String.fromCharCode (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/string/String.fromCharCode (; 4 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.eqz (get_local $0) ) (return - (i32.const 112) + (i32.const 108) ) ) (i32.store16 offset=4 (tee_local $1 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (i32.const 1) ) ) @@ -298,7 +294,7 @@ ) (get_local $1) ) - (func $~lib/internal/string/compareUnsafe (; 6 ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) + (func $~lib/internal/string/compareUnsafe (; 5 ;) (; has Stack IR ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) (local $5 i32) (set_local $1 (i32.add @@ -363,7 +359,7 @@ ) (get_local $5) ) - (func $~lib/string/String.__eq (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 6 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eq @@ -419,7 +415,7 @@ ) ) ) - (func $~lib/string/String.fromCodePoint (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/string/String.fromCodePoint (; 7 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -430,8 +426,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 33) + (i32.const 76) + (i32.const 31) (i32.const 4) ) (unreachable) @@ -442,11 +438,11 @@ (get_local $0) ) (return - (i32.const 112) + (i32.const 108) ) ) (set_local $1 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (i32.add (tee_local $2 (i32.gt_s @@ -494,7 +490,7 @@ ) (get_local $1) ) - (func $~lib/string/String#startsWith (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#startsWith (; 8 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (if @@ -504,8 +500,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 245) + (i32.const 76) + (i32.const 241) (i32.const 4) ) (unreachable) @@ -516,7 +512,7 @@ (get_local $1) ) (set_local $1 - (i32.const 196) + (i32.const 192) ) ) (if @@ -567,7 +563,7 @@ ) ) ) - (func $~lib/string/String#endsWith (; 10 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#endsWith (; 9 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.eqz @@ -576,8 +572,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 126) + (i32.const 76) + (i32.const 122) (i32.const 4) ) (unreachable) @@ -639,7 +635,7 @@ ) ) ) - (func $~lib/string/String#endsWith|trampoline (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#endsWith|trampoline (; 10 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange @@ -662,7 +658,7 @@ (get_local $2) ) ) - (func $~lib/string/String#indexOf (; 12 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#indexOf (; 11 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (if @@ -672,8 +668,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 214) + (i32.const 76) + (i32.const 210) (i32.const 4) ) (unreachable) @@ -684,7 +680,7 @@ (get_local $1) ) (set_local $1 - (i32.const 196) + (i32.const 192) ) ) (if @@ -769,7 +765,7 @@ ) (i32.const -1) ) - (func $~lib/string/String#includes (; 13 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#includes (; 12 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ne (call $~lib/string/String#indexOf (get_local $0) @@ -779,7 +775,7 @@ (i32.const -1) ) ) - (func $~lib/memory/memcpy (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memcpy (; 13 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2165,7 +2161,7 @@ ) ) ) - (func $~lib/memory/memmove (; 15 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memmove (; 14 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (if @@ -2200,7 +2196,7 @@ (if (get_local $3) (block - (call $~lib/memory/memcpy + (call $~lib/internal/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -2457,14 +2453,7 @@ ) ) ) - (func $~lib/memory/memory.copy (; 16 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memmove - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/internal/string/repeatUnsafe (; 17 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/internal/string/repeatUnsafe (; 15 ;) (; has Stack IR ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) @@ -2735,7 +2724,7 @@ (get_local $2) ) ) - (call $~lib/memory/memory.copy + (call $~lib/internal/memory/memmove (i32.add (get_local $4) (get_local $1) @@ -2754,7 +2743,35 @@ ) ) ) - (func $~lib/string/String#padStart (; 18 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/string/copyUnsafe (; 16 ;) (; has Stack IR ;) (type $iiiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) + (call $~lib/internal/memory/memmove + (i32.add + (i32.add + (get_local $0) + (i32.shl + (get_local $1) + (i32.const 1) + ) + ) + (i32.const 4) + ) + (i32.add + (i32.add + (get_local $2) + (i32.shl + (get_local $3) + (i32.const 1) + ) + ) + (i32.const 4) + ) + (i32.shl + (get_local $4) + (i32.const 1) + ) + ) + ) + (func $~lib/string/String#padStart (; 17 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2766,8 +2783,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 351) + (i32.const 76) + (i32.const 347) (i32.const 4) ) (unreachable) @@ -2804,7 +2821,7 @@ ) ) (set_local $5 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (get_local $1) ) ) @@ -2846,69 +2863,36 @@ (get_local $3) ) ) - (call $~lib/memory/memory.copy - (i32.add - (i32.add - (get_local $5) - (i32.shl - (get_local $3) - (i32.const 1) - ) - ) - (i32.const 4) - ) - (i32.add - (get_local $2) - (i32.const 4) - ) - (i32.shl - (get_local $4) - (i32.const 1) - ) + (call $~lib/internal/string/copyUnsafe + (get_local $5) + (get_local $3) + (get_local $2) + (i32.const 0) + (get_local $4) ) ) ) - (call $~lib/memory/memory.copy - (i32.add - (get_local $5) - (i32.const 4) - ) - (i32.add - (get_local $2) - (i32.const 4) - ) - (i32.shl - (get_local $1) - (i32.const 1) - ) + (call $~lib/internal/string/copyUnsafe + (get_local $5) + (i32.const 0) + (get_local $2) + (i32.const 0) + (get_local $1) ) ) (if (get_local $6) - (call $~lib/memory/memory.copy - (i32.add - (i32.add - (get_local $5) - (i32.shl - (get_local $1) - (i32.const 1) - ) - ) - (i32.const 4) - ) - (i32.add - (get_local $0) - (i32.const 4) - ) - (i32.shl - (get_local $6) - (i32.const 1) - ) + (call $~lib/internal/string/copyUnsafe + (get_local $5) + (get_local $1) + (get_local $0) + (i32.const 0) + (get_local $6) ) ) (get_local $5) ) - (func $~lib/string/String#padStart|trampoline (; 19 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#padStart|trampoline (; 18 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange @@ -2922,7 +2906,7 @@ (unreachable) ) (set_local $2 - (i32.const 236) + (i32.const 232) ) ) (call $~lib/string/String#padStart @@ -2931,7 +2915,7 @@ (get_local $2) ) ) - (func $~lib/string/String#padEnd (; 20 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#padEnd (; 19 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2943,8 +2927,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 371) + (i32.const 76) + (i32.const 367) (i32.const 4) ) (unreachable) @@ -2987,25 +2971,18 @@ ) ) (set_local $1 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (get_local $1) ) ) (if (get_local $3) - (call $~lib/memory/memory.copy - (i32.add - (get_local $1) - (i32.const 4) - ) - (i32.add - (get_local $0) - (i32.const 4) - ) - (i32.shl - (get_local $3) - (i32.const 1) - ) + (call $~lib/internal/string/copyUnsafe + (get_local $1) + (i32.const 0) + (get_local $0) + (i32.const 0) + (get_local $3) ) ) (if @@ -3014,9 +2991,9 @@ (get_local $5) ) (block - (set_local $4 + (set_local $0 (i32.mul - (tee_local $0 + (tee_local $4 (i32.div_s (i32.sub (get_local $6) @@ -3032,64 +3009,38 @@ (get_local $1) (get_local $3) (get_local $2) - (get_local $0) + (get_local $4) ) (if - (tee_local $0 + (tee_local $4 (i32.sub (get_local $6) - (get_local $4) + (get_local $0) ) ) - (call $~lib/memory/memory.copy + (call $~lib/internal/string/copyUnsafe + (get_local $1) (i32.add - (i32.add - (get_local $1) - (i32.shl - (i32.add - (get_local $4) - (get_local $3) - ) - (i32.const 1) - ) - ) - (i32.const 4) - ) - (i32.add - (get_local $2) - (i32.const 4) - ) - (i32.shl (get_local $0) - (i32.const 1) + (get_local $3) ) + (get_local $2) + (i32.const 0) + (get_local $4) ) ) ) - (call $~lib/memory/memory.copy - (i32.add - (i32.add - (get_local $1) - (i32.shl - (get_local $3) - (i32.const 1) - ) - ) - (i32.const 4) - ) - (i32.add - (get_local $2) - (i32.const 4) - ) - (i32.shl - (get_local $6) - (i32.const 1) - ) + (call $~lib/internal/string/copyUnsafe + (get_local $1) + (get_local $3) + (get_local $2) + (i32.const 0) + (get_local $6) ) ) (get_local $1) ) - (func $~lib/string/String#padEnd|trampoline (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#padEnd|trampoline (; 20 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange @@ -3103,7 +3054,7 @@ (unreachable) ) (set_local $2 - (i32.const 236) + (i32.const 232) ) ) (call $~lib/string/String#padEnd @@ -3112,7 +3063,7 @@ (get_local $2) ) ) - (func $~lib/string/String#lastIndexOf (; 22 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#lastIndexOf (; 21 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (if @@ -3122,8 +3073,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 230) + (i32.const 76) + (i32.const 226) (i32.const 4) ) (unreachable) @@ -3134,7 +3085,7 @@ (get_local $1) ) (set_local $1 - (i32.const 196) + (i32.const 192) ) ) (set_local $3 @@ -3163,7 +3114,7 @@ ) ) (block $break|0 - (set_local $3 + (set_local $2 (select (tee_local $2 (select @@ -3190,36 +3141,36 @@ (loop $repeat|0 (br_if $break|0 (i32.lt_s - (get_local $3) + (get_local $2) (i32.const 0) ) ) (if (call $~lib/internal/string/compareUnsafe (get_local $0) - (get_local $3) + (get_local $2) (get_local $1) (i32.const 0) (get_local $4) ) (block - (set_local $3 + (set_local $2 (i32.sub - (get_local $3) + (get_local $2) (i32.const 1) ) ) (br $repeat|0) ) (return - (get_local $3) + (get_local $2) ) ) ) ) (i32.const -1) ) - (func $~lib/string/String#lastIndexOf|trampoline (; 23 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#lastIndexOf|trampoline (; 22 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange @@ -3242,10 +3193,10 @@ (get_local $2) ) ) - (func $std/string/getString (; 24 ;) (type $i) (result i32) + (func $std/string/getString (; 23 ;) (; has Stack IR ;) (type $i) (result i32) (get_global $std/string/str) ) - (func $~lib/internal/string/parse (; 25 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/internal/string/parse (; 24 ;) (; has Stack IR ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3608,13 +3559,13 @@ (get_local $5) ) ) - (func $~lib/string/parseInt (; 26 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/string/parseInt (; 25 ;) (; has Stack IR ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (call $~lib/internal/string/parse (get_local $0) (get_local $1) ) ) - (func $~lib/string/parseFloat (; 27 ;) (type $iF) (param $0 i32) (result f64) + (func $~lib/string/parseFloat (; 26 ;) (; has Stack IR ;) (type $iF) (param $0 i32) (result f64) (local $1 i32) (local $2 i32) (local $3 i32) @@ -3777,8 +3728,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 519) + (i32.const 76) + (i32.const 515) (i32.const 10) ) (unreachable) @@ -3864,7 +3815,7 @@ (get_local $4) ) ) - (func $~lib/string/String#concat (; 28 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#concat (; 27 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -3875,8 +3826,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 112) + (i32.const 76) + (i32.const 108) (i32.const 4) ) (unreachable) @@ -3887,7 +3838,7 @@ (get_local $1) ) (set_local $1 - (i32.const 196) + (i32.const 192) ) ) (if @@ -3908,56 +3859,36 @@ ) ) (return - (i32.const 8) + (i32.const 240) ) ) - (call $~lib/memory/memory.copy - (i32.add - (tee_local $2 - (call $~lib/internal/string/allocate - (get_local $2) - ) - ) - (i32.const 4) - ) - (i32.add - (get_local $0) - (i32.const 4) - ) - (i32.shl - (get_local $3) - (i32.const 1) - ) - ) - (call $~lib/memory/memory.copy - (i32.add - (i32.add + (call $~lib/internal/string/copyUnsafe + (tee_local $2 + (call $~lib/internal/string/allocateUnsafe (get_local $2) - (i32.shl - (get_local $3) - (i32.const 1) - ) ) - (i32.const 4) - ) - (i32.add - (get_local $1) - (i32.const 4) - ) - (i32.shl - (get_local $4) - (i32.const 1) ) + (i32.const 0) + (get_local $0) + (i32.const 0) + (get_local $3) + ) + (call $~lib/internal/string/copyUnsafe + (get_local $2) + (get_local $3) + (get_local $1) + (i32.const 0) + (get_local $4) ) (get_local $2) ) - (func $~lib/string/String.__concat (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__concat (; 28 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) ) (set_local $0 - (i32.const 196) + (i32.const 192) ) ) (call $~lib/string/String#concat @@ -3965,7 +3896,7 @@ (get_local $1) ) ) - (func $~lib/string/String.__ne (; 30 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__ne (; 29 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.eqz (call $~lib/string/String.__eq (get_local $0) @@ -3973,7 +3904,7 @@ ) ) ) - (func $~lib/string/String.__gt (; 31 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__gt (; 30 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -4050,7 +3981,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__gte (; 32 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__gte (; 31 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -4127,7 +4058,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__lt (; 33 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__lt (; 32 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -4204,7 +4135,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__lte (; 34 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__lte (; 33 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -4281,7 +4212,7 @@ (i32.const 0) ) ) - (func $~lib/string/String#repeat (; 35 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#repeat (; 34 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -4291,8 +4222,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 391) + (i32.const 76) + (i32.const 387) (i32.const 4) ) (unreachable) @@ -4327,8 +4258,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 396) + (i32.const 76) + (i32.const 392) (i32.const 6) ) (unreachable) @@ -4351,7 +4282,7 @@ (if (get_local $2) (return - (i32.const 8) + (i32.const 240) ) ) (if @@ -4365,7 +4296,7 @@ ) (call $~lib/internal/string/repeatUnsafe (tee_local $2 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (i32.mul (get_local $3) (get_local $1) @@ -4378,7 +4309,7 @@ ) (get_local $2) ) - (func $~lib/internal/itoa/decimalCountU32 (; 36 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/decimalCountU32 (; 35 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (set_local $2 @@ -4418,7 +4349,7 @@ (i32.const 1) ) ) - (func $~lib/internal/itoa/utoa32_lut (; 37 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/itoa/utoa32_lut (; 36 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -4579,7 +4510,7 @@ ) ) ) - (func $~lib/internal/itoa/itoa32 (; 38 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/itoa32 (; 37 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4607,7 +4538,7 @@ ) (call $~lib/internal/itoa/utoa32_lut (tee_local $2 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (tee_local $3 (i32.add (call $~lib/internal/itoa/decimalCountU32 @@ -4630,7 +4561,7 @@ ) (get_local $2) ) - (func $~lib/internal/itoa/utoa32 (; 39 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/utoa32 (; 38 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -4643,7 +4574,7 @@ ) (call $~lib/internal/itoa/utoa32_lut (tee_local $2 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (tee_local $1 (call $~lib/internal/itoa/decimalCountU32 (get_local $0) @@ -4656,7 +4587,7 @@ ) (get_local $2) ) - (func $~lib/internal/itoa/decimalCountU64 (; 40 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/decimalCountU64 (; 39 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i64) (set_local $2 @@ -4704,7 +4635,7 @@ (i32.const 1) ) ) - (func $~lib/internal/itoa/utoa64_lut (; 41 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/internal/itoa/utoa64_lut (; 40 ;) (; has Stack IR ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -4850,7 +4781,7 @@ (get_local $2) ) ) - (func $~lib/internal/itoa/utoa64 (; 42 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/utoa64 (; 41 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4869,7 +4800,7 @@ ) (call $~lib/internal/itoa/utoa32_lut (tee_local $2 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (tee_local $1 (call $~lib/internal/itoa/decimalCountU32 (tee_local $3 @@ -4886,7 +4817,7 @@ ) (call $~lib/internal/itoa/utoa64_lut (tee_local $2 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (tee_local $1 (call $~lib/internal/itoa/decimalCountU64 (get_local $0) @@ -4900,7 +4831,7 @@ ) (get_local $2) ) - (func $~lib/internal/itoa/itoa64 (; 43 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/itoa64 (; 42 ;) (; has Stack IR ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4934,7 +4865,7 @@ ) (call $~lib/internal/itoa/utoa32_lut (tee_local $3 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (tee_local $2 (i32.add (call $~lib/internal/itoa/decimalCountU32 @@ -4954,7 +4885,7 @@ ) (call $~lib/internal/itoa/utoa64_lut (tee_local $3 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (tee_local $2 (i32.add (call $~lib/internal/itoa/decimalCountU64 @@ -4978,7 +4909,7 @@ ) (get_local $3) ) - (func $start (; 44 ;) (type $v) + (func $start (; 43 ;) (; has Stack IR ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.const 2672) ) @@ -4988,12 +4919,12 @@ (if (i32.ne (get_global $std/string/str) - (i32.const 12) + (i32.const 8) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 11) (i32.const 0) ) @@ -5010,7 +4941,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 13) (i32.const 0) ) @@ -5028,7 +4959,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 14) (i32.const 0) ) @@ -5041,13 +4972,13 @@ (call $~lib/string/String.fromCharCode (i32.const 0) ) - (i32.const 112) + (i32.const 108) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 16) (i32.const 0) ) @@ -5060,13 +4991,13 @@ (call $~lib/string/String.fromCharCode (i32.const 54) ) - (i32.const 172) + (i32.const 168) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 17) (i32.const 0) ) @@ -5079,13 +5010,13 @@ (call $~lib/string/String.fromCharCode (i32.const 65590) ) - (i32.const 172) + (i32.const 168) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 18) (i32.const 0) ) @@ -5098,13 +5029,13 @@ (call $~lib/string/String.fromCodePoint (i32.const 0) ) - (i32.const 112) + (i32.const 108) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 20) (i32.const 0) ) @@ -5117,13 +5048,13 @@ (call $~lib/string/String.fromCodePoint (i32.const 54) ) - (i32.const 172) + (i32.const 168) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 21) (i32.const 0) ) @@ -5138,8 +5069,8 @@ ) (block (call $~lib/env/abort - (i32.const 180) - (i32.const 48) + (i32.const 176) + (i32.const 44) (i32.const 22) (i32.const 0) ) @@ -5150,14 +5081,14 @@ (i32.eqz (call $~lib/string/String#startsWith (get_global $std/string/str) - (i32.const 188) + (i32.const 184) (i32.const 0) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 24) (i32.const 0) ) @@ -5171,14 +5102,14 @@ (i32.eqz (call $~lib/string/String#endsWith|trampoline (get_global $std/string/str) - (i32.const 208) + (i32.const 204) (i32.const 0) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 25) (i32.const 0) ) @@ -5189,14 +5120,14 @@ (i32.eqz (call $~lib/string/String#includes (get_global $std/string/str) - (i32.const 224) + (i32.const 220) (i32.const 0) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 26) (i32.const 0) ) @@ -5220,7 +5151,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 28) (i32.const 0) ) @@ -5244,7 +5175,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 29) (i32.const 0) ) @@ -5258,7 +5189,7 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/string/String#padStart|trampoline - (i32.const 8) + (i32.const 240) (i32.const 3) (i32.const 0) ) @@ -5268,7 +5199,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 30) (i32.const 0) ) @@ -5279,17 +5210,17 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/string/String#padStart - (i32.const 8) + (i32.const 240) (i32.const 10) - (i32.const 8) + (i32.const 240) ) - (i32.const 8) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 31) (i32.const 0) ) @@ -5302,7 +5233,7 @@ (call $~lib/string/String#padStart (i32.const 256) (i32.const 100) - (i32.const 8) + (i32.const 240) ) (i32.const 256) ) @@ -5310,7 +5241,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 32) (i32.const 0) ) @@ -5334,7 +5265,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 33) (i32.const 0) ) @@ -5355,7 +5286,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 34) (i32.const 0) ) @@ -5376,7 +5307,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 35) (i32.const 0) ) @@ -5400,7 +5331,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 37) (i32.const 0) ) @@ -5424,7 +5355,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 38) (i32.const 0) ) @@ -5438,7 +5369,7 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/string/String#padEnd|trampoline - (i32.const 8) + (i32.const 240) (i32.const 3) (i32.const 0) ) @@ -5448,7 +5379,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 39) (i32.const 0) ) @@ -5459,17 +5390,17 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/string/String#padEnd - (i32.const 8) + (i32.const 240) (i32.const 10) - (i32.const 8) + (i32.const 240) ) - (i32.const 8) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 40) (i32.const 0) ) @@ -5482,7 +5413,7 @@ (call $~lib/string/String#padEnd (i32.const 256) (i32.const 100) - (i32.const 8) + (i32.const 240) ) (i32.const 256) ) @@ -5490,7 +5421,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 41) (i32.const 0) ) @@ -5514,7 +5445,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 42) (i32.const 0) ) @@ -5535,7 +5466,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 43) (i32.const 0) ) @@ -5556,7 +5487,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 44) (i32.const 0) ) @@ -5565,14 +5496,14 @@ ) (if (call $~lib/string/String#indexOf - (i32.const 8) - (i32.const 8) + (i32.const 240) + (i32.const 240) (i32.const 0) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 46) (i32.const 0) ) @@ -5582,8 +5513,8 @@ (if (i32.ne (call $~lib/string/String#indexOf - (i32.const 8) - (i32.const 188) + (i32.const 240) + (i32.const 184) (i32.const 0) ) (i32.const -1) @@ -5591,7 +5522,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 47) (i32.const 0) ) @@ -5601,13 +5532,13 @@ (if (call $~lib/string/String#indexOf (get_global $std/string/str) - (i32.const 8) + (i32.const 240) (i32.const 0) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 48) (i32.const 0) ) @@ -5626,7 +5557,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 49) (i32.const 0) ) @@ -5645,7 +5576,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 50) (i32.const 0) ) @@ -5664,7 +5595,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 51) (i32.const 0) ) @@ -5683,7 +5614,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 52) (i32.const 0) ) @@ -5702,7 +5633,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 53) (i32.const 0) ) @@ -5714,14 +5645,14 @@ ) (if (call $~lib/string/String#lastIndexOf|trampoline - (i32.const 8) - (i32.const 8) + (i32.const 240) + (i32.const 240) (i32.const 0) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 55) (i32.const 0) ) @@ -5734,8 +5665,8 @@ (if (i32.ne (call $~lib/string/String#lastIndexOf|trampoline - (i32.const 8) - (i32.const 188) + (i32.const 240) + (i32.const 184) (i32.const 0) ) (i32.const -1) @@ -5743,7 +5674,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 56) (i32.const 0) ) @@ -5757,7 +5688,7 @@ (i32.ne (call $~lib/string/String#lastIndexOf|trampoline (get_global $std/string/str) - (i32.const 8) + (i32.const 240) (i32.const 0) ) (i32.load @@ -5767,7 +5698,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 57) (i32.const 0) ) @@ -5789,7 +5720,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 58) (i32.const 0) ) @@ -5811,7 +5742,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 59) (i32.const 0) ) @@ -5833,7 +5764,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 60) (i32.const 0) ) @@ -5852,7 +5783,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 61) (i32.const 0) ) @@ -5871,7 +5802,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 62) (i32.const 0) ) @@ -5890,7 +5821,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 63) (i32.const 0) ) @@ -5909,7 +5840,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 64) (i32.const 0) ) @@ -5919,13 +5850,13 @@ (if (call $~lib/string/String#lastIndexOf (get_global $std/string/str) - (i32.const 188) + (i32.const 184) (i32.const 0) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 65) (i32.const 0) ) @@ -5943,7 +5874,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 71) (i32.const 0) ) @@ -5961,7 +5892,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 72) (i32.const 0) ) @@ -5979,7 +5910,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 73) (i32.const 0) ) @@ -5997,7 +5928,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 74) (i32.const 0) ) @@ -6015,7 +5946,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 75) (i32.const 0) ) @@ -6033,7 +5964,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 76) (i32.const 0) ) @@ -6051,7 +5982,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 77) (i32.const 0) ) @@ -6069,7 +6000,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 78) (i32.const 0) ) @@ -6086,7 +6017,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 80) (i32.const 0) ) @@ -6103,7 +6034,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 81) (i32.const 0) ) @@ -6120,7 +6051,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 82) (i32.const 0) ) @@ -6137,7 +6068,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 83) (i32.const 0) ) @@ -6154,7 +6085,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 84) (i32.const 0) ) @@ -6177,7 +6108,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 87) (i32.const 0) ) @@ -6194,7 +6125,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 88) (i32.const 0) ) @@ -6204,14 +6135,14 @@ (if (i32.eqz (call $~lib/string/String.__eq - (i32.const 8) - (i32.const 8) + (i32.const 240) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 89) (i32.const 0) ) @@ -6221,14 +6152,14 @@ (if (i32.eqz (call $~lib/string/String.__ne - (i32.const 8) + (i32.const 240) (get_global $std/string/nullStr) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 90) (i32.const 0) ) @@ -6245,7 +6176,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 92) (i32.const 0) ) @@ -6262,7 +6193,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 93) (i32.const 0) ) @@ -6279,7 +6210,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 94) (i32.const 0) ) @@ -6296,7 +6227,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 95) (i32.const 0) ) @@ -6311,7 +6242,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 96) (i32.const 0) ) @@ -6326,7 +6257,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 98) (i32.const 0) ) @@ -6341,7 +6272,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 99) (i32.const 0) ) @@ -6352,13 +6283,13 @@ (i32.eqz (call $~lib/string/String.__gt (i32.const 264) - (i32.const 8) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 101) (i32.const 0) ) @@ -6368,14 +6299,14 @@ (if (i32.eqz (call $~lib/string/String.__lt - (i32.const 8) + (i32.const 240) (i32.const 264) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 102) (i32.const 0) ) @@ -6386,13 +6317,13 @@ (i32.eqz (call $~lib/string/String.__gte (i32.const 264) - (i32.const 8) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 103) (i32.const 0) ) @@ -6402,14 +6333,14 @@ (if (i32.eqz (call $~lib/string/String.__lte - (i32.const 8) + (i32.const 240) (i32.const 264) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 104) (i32.const 0) ) @@ -6419,12 +6350,12 @@ (if (call $~lib/string/String.__lt (i32.const 264) - (i32.const 8) + (i32.const 240) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 105) (i32.const 0) ) @@ -6433,13 +6364,13 @@ ) (if (call $~lib/string/String.__gt - (i32.const 8) + (i32.const 240) (i32.const 264) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 106) (i32.const 0) ) @@ -6448,13 +6379,13 @@ ) (if (call $~lib/string/String.__lt - (i32.const 8) - (i32.const 8) + (i32.const 240) + (i32.const 240) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 107) (i32.const 0) ) @@ -6463,13 +6394,13 @@ ) (if (call $~lib/string/String.__gt - (i32.const 8) - (i32.const 8) + (i32.const 240) + (i32.const 240) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 108) (i32.const 0) ) @@ -6479,14 +6410,14 @@ (if (i32.eqz (call $~lib/string/String.__gte - (i32.const 8) - (i32.const 8) + (i32.const 240) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 109) (i32.const 0) ) @@ -6496,14 +6427,14 @@ (if (i32.eqz (call $~lib/string/String.__lte - (i32.const 8) - (i32.const 8) + (i32.const 240) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 110) (i32.const 0) ) @@ -6535,7 +6466,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 114) (i32.const 0) ) @@ -6552,7 +6483,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 116) (i32.const 0) ) @@ -6563,16 +6494,16 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/string/String#repeat - (i32.const 8) + (i32.const 240) (i32.const 100) ) - (i32.const 8) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 118) (i32.const 0) ) @@ -6586,13 +6517,13 @@ (i32.const 256) (i32.const 0) ) - (i32.const 8) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 119) (i32.const 0) ) @@ -6612,7 +6543,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 120) (i32.const 0) ) @@ -6632,7 +6563,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 121) (i32.const 0) ) @@ -6652,7 +6583,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 122) (i32.const 0) ) @@ -6672,7 +6603,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 123) (i32.const 0) ) @@ -6692,7 +6623,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 124) (i32.const 0) ) @@ -6712,7 +6643,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 125) (i32.const 0) ) @@ -6732,7 +6663,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 126) (i32.const 0) ) @@ -6751,7 +6682,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 128) (i32.const 0) ) @@ -6770,7 +6701,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 129) (i32.const 0) ) @@ -6789,7 +6720,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 130) (i32.const 0) ) @@ -6808,7 +6739,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 131) (i32.const 0) ) @@ -6827,7 +6758,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 132) (i32.const 0) ) @@ -6846,7 +6777,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 133) (i32.const 0) ) @@ -6865,7 +6796,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 134) (i32.const 0) ) @@ -6884,7 +6815,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 135) (i32.const 0) ) @@ -6903,7 +6834,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 136) (i32.const 0) ) @@ -6922,7 +6853,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 137) (i32.const 0) ) @@ -6941,7 +6872,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 138) (i32.const 0) ) @@ -6960,7 +6891,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 139) (i32.const 0) ) @@ -6979,7 +6910,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 140) (i32.const 0) ) @@ -6998,7 +6929,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 141) (i32.const 0) ) @@ -7017,7 +6948,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 143) (i32.const 0) ) @@ -7036,7 +6967,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 144) (i32.const 0) ) @@ -7055,7 +6986,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 145) (i32.const 0) ) @@ -7074,7 +7005,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 146) (i32.const 0) ) @@ -7093,7 +7024,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 147) (i32.const 0) ) @@ -7112,7 +7043,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 149) (i32.const 0) ) @@ -7131,7 +7062,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 150) (i32.const 0) ) @@ -7150,7 +7081,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 151) (i32.const 0) ) @@ -7169,7 +7100,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 152) (i32.const 0) ) @@ -7188,7 +7119,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 153) (i32.const 0) ) @@ -7207,7 +7138,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 154) (i32.const 0) ) @@ -7226,7 +7157,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 155) (i32.const 0) ) @@ -7245,7 +7176,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 156) (i32.const 0) ) @@ -7264,7 +7195,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 157) (i32.const 0) ) @@ -7283,7 +7214,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 158) (i32.const 0) ) @@ -7302,7 +7233,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 159) (i32.const 0) ) @@ -7321,7 +7252,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 161) (i32.const 0) ) @@ -7340,7 +7271,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 162) (i32.const 0) ) @@ -7359,7 +7290,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 163) (i32.const 0) ) @@ -7378,7 +7309,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 164) (i32.const 0) ) @@ -7397,7 +7328,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 165) (i32.const 0) ) @@ -7416,7 +7347,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 166) (i32.const 0) ) @@ -7435,7 +7366,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 167) (i32.const 0) ) @@ -7454,7 +7385,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 168) (i32.const 0) ) @@ -7473,7 +7404,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 169) (i32.const 0) ) @@ -7492,7 +7423,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 170) (i32.const 0) ) @@ -7511,7 +7442,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 171) (i32.const 0) ) diff --git a/tests/compiler/std/string.untouched.wat b/tests/compiler/std/string.untouched.wat index 51038617..152cd839 100644 --- a/tests/compiler/std/string.untouched.wat +++ b/tests/compiler/std/string.untouched.wat @@ -5,6 +5,7 @@ (type $iiiiii (func (param i32 i32 i32 i32 i32) (result i32))) (type $iiii (func (param i32 i32 i32) (result i32))) (type $iiiv (func (param i32 i32 i32))) + (type $iiiiiv (func (param i32 i32 i32 i32 i32))) (type $i (func (result i32))) (type $iiF (func (param i32 i32) (result f64))) (type $iF (func (param i32) (result f64))) @@ -20,10 +21,9 @@ (global $~lib/allocator/arena/offset (mut i32) (i32.const 0)) (global $~lib/internal/string/HEADER_SIZE i32 (i32.const 4)) (global $~lib/internal/string/MAX_LENGTH i32 (i32.const 536870910)) - (global $~lib/internal/string/EMPTY i32 (i32.const 8)) (global $~lib/internal/arraybuffer/HEADER_SIZE i32 (i32.const 8)) (global $~lib/internal/arraybuffer/MAX_BLENGTH i32 (i32.const 1073741816)) - (global $std/string/str (mut i32) (i32.const 12)) + (global $std/string/str (mut i32) (i32.const 8)) (global $std/string/nullStr (mut i32) (i32.const 0)) (global $~argc (mut i32) (i32.const 0)) (global $ASC_SHRINK_LEVEL i32 (i32.const 0)) @@ -63,19 +63,19 @@ (global $~lib/builtins/i64.MIN_VALUE i64 (i64.const -9223372036854775808)) (global $HEAP_BASE i32 (i32.const 2668)) (memory $0 1) - (data (i32.const 8) "\00\00\00\00") - (data (i32.const 12) "\10\00\00\00h\00i\00,\00 \00I\00\'\00m\00 \00a\00 \00s\00t\00r\00i\00n\00g\00") - (data (i32.const 48) "\0d\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") - (data (i32.const 80) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") - (data (i32.const 112) "\01\00\00\00\00\00") - (data (i32.const 120) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") - (data (i32.const 172) "\01\00\00\006\00") - (data (i32.const 180) "\02\00\00\004\d8\06\df") - (data (i32.const 188) "\02\00\00\00h\00i\00") - (data (i32.const 196) "\04\00\00\00n\00u\00l\00l\00") - (data (i32.const 208) "\06\00\00\00s\00t\00r\00i\00n\00g\00") - (data (i32.const 224) "\03\00\00\00I\00\'\00m\00") - (data (i32.const 236) "\01\00\00\00 \00") + (data (i32.const 8) "\10\00\00\00h\00i\00,\00 \00I\00\'\00m\00 \00a\00 \00s\00t\00r\00i\00n\00g\00") + (data (i32.const 44) "\0d\00\00\00s\00t\00d\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") + (data (i32.const 76) "\0e\00\00\00~\00l\00i\00b\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") + (data (i32.const 108) "\01\00\00\00\00\00") + (data (i32.const 116) "\17\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00s\00t\00r\00i\00n\00g\00.\00t\00s\00") + (data (i32.const 168) "\01\00\00\006\00") + (data (i32.const 176) "\02\00\00\004\d8\06\df") + (data (i32.const 184) "\02\00\00\00h\00i\00") + (data (i32.const 192) "\04\00\00\00n\00u\00l\00l\00") + (data (i32.const 204) "\06\00\00\00s\00t\00r\00i\00n\00g\00") + (data (i32.const 220) "\03\00\00\00I\00\'\00m\00") + (data (i32.const 232) "\01\00\00\00 \00") + (data (i32.const 240) "\00\00\00\00") (data (i32.const 244) "\03\00\00\00 \00 \00 \00") (data (i32.const 256) "\01\00\00\00a\00") (data (i32.const 264) "\03\00\00\00a\00b\00c\00") @@ -159,8 +159,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 77) + (i32.const 76) + (i32.const 73) (i32.const 4) ) (unreachable) @@ -295,14 +295,7 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) - (return - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - ) - (func $~lib/internal/string/allocate (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/string/allocateUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -324,20 +317,27 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 120) - (i32.const 25) + (i32.const 116) + (i32.const 14) (i32.const 2) ) (unreachable) ) ) (set_local $2 - (call $~lib/memory/memory.allocate - (i32.add - (get_global $~lib/internal/string/HEADER_SIZE) - (i32.shl - (get_local $0) - (i32.const 1) + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $1 + (i32.add + (get_global $~lib/internal/string/HEADER_SIZE) + (i32.shl + (get_local $0) + (i32.const 1) + ) + ) + ) + (br $~lib/memory/memory.allocate|inlined.0 + (call $~lib/allocator/arena/__memory_allocate + (get_local $1) ) ) ) @@ -348,18 +348,18 @@ ) (get_local $2) ) - (func $~lib/string/String.fromCharCode (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/string/String.fromCharCode (; 4 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.eqz (get_local $0) ) (return - (i32.const 112) + (i32.const 108) ) ) (set_local $1 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (i32.const 1) ) ) @@ -369,7 +369,7 @@ ) (get_local $1) ) - (func $~lib/internal/string/compareUnsafe (; 6 ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) + (func $~lib/internal/string/compareUnsafe (; 5 ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) (local $5 i32) (local $6 i32) (local $7 i32) @@ -441,7 +441,7 @@ ) (get_local $5) ) - (func $~lib/string/String.__eq (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -497,7 +497,7 @@ ) ) ) - (func $~lib/string/String.fromCodePoint (; 8 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/string/String.fromCodePoint (; 7 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -512,8 +512,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 33) + (i32.const 76) + (i32.const 31) (i32.const 4) ) (unreachable) @@ -524,7 +524,7 @@ (get_local $0) ) (return - (i32.const 112) + (i32.const 108) ) ) (set_local $1 @@ -534,7 +534,7 @@ ) ) (set_local $2 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (i32.add (get_local $1) (i32.const 1) @@ -588,14 +588,13 @@ ) (get_local $2) ) - (func $~lib/string/String#startsWith (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#startsWith (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) (local $7 i32) (local $8 i32) - (local $9 i32) (if (i32.eqz (i32.ne @@ -606,8 +605,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 245) + (i32.const 76) + (i32.const 241) (i32.const 4) ) (unreachable) @@ -619,7 +618,7 @@ (i32.const 0) ) (set_local $1 - (i32.const 196) + (i32.const 192) ) ) (set_local $3 @@ -630,37 +629,32 @@ (get_local $0) ) ) - (set_local $8 - (block $~lib/internal/string/clamp|inlined.0 (result i32) - (set_local $5 - (i32.const 0) - ) - (select - (tee_local $6 - (select - (tee_local $6 - (get_local $3) - ) - (tee_local $7 - (get_local $5) - ) - (i32.gt_s - (get_local $6) - (get_local $7) - ) + (set_local $7 + (select + (tee_local $5 + (select + (tee_local $5 + (get_local $3) + ) + (tee_local $6 + (i32.const 0) + ) + (i32.gt_s + (get_local $5) + (get_local $6) ) ) - (tee_local $7 - (get_local $4) - ) - (i32.lt_s - (get_local $6) - (get_local $7) - ) + ) + (tee_local $6 + (get_local $4) + ) + (i32.lt_s + (get_local $5) + (get_local $6) ) ) ) - (set_local $9 + (set_local $8 (i32.load (get_local $1) ) @@ -668,8 +662,8 @@ (if (i32.gt_s (i32.add - (get_local $9) (get_local $8) + (get_local $7) ) (get_local $4) ) @@ -680,21 +674,19 @@ (i32.eqz (call $~lib/internal/string/compareUnsafe (get_local $0) - (get_local $8) + (get_local $7) (get_local $1) (i32.const 0) - (get_local $9) + (get_local $8) ) ) ) - (func $~lib/string/String#endsWith (; 10 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#endsWith (; 9 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) (local $7 i32) - (local $8 i32) - (local $9 i32) (if (i32.eqz (i32.ne @@ -705,8 +697,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 126) + (i32.const 76) + (i32.const 122) (i32.const 4) ) (unreachable) @@ -721,55 +713,47 @@ (i32.const 0) ) ) - (set_local $7 - (block $~lib/internal/string/clamp|inlined.1 (result i32) - (set_local $3 - (i32.const 0) + (set_local $5 + (select + (tee_local $3 + (select + (tee_local $3 + (get_local $2) + ) + (tee_local $4 + (i32.const 0) + ) + (i32.gt_s + (get_local $3) + (get_local $4) + ) + ) ) - (set_local $4 + (tee_local $4 (i32.load (get_local $0) ) ) - (select - (tee_local $5 - (select - (tee_local $5 - (get_local $2) - ) - (tee_local $6 - (get_local $3) - ) - (i32.gt_s - (get_local $5) - (get_local $6) - ) - ) - ) - (tee_local $6 - (get_local $4) - ) - (i32.lt_s - (get_local $5) - (get_local $6) - ) + (i32.lt_s + (get_local $3) + (get_local $4) ) ) ) - (set_local $8 + (set_local $6 (i32.load (get_local $1) ) ) - (set_local $9 + (set_local $7 (i32.sub - (get_local $7) - (get_local $8) + (get_local $5) + (get_local $6) ) ) (if (i32.lt_s - (get_local $9) + (get_local $7) (i32.const 0) ) (return @@ -779,14 +763,14 @@ (i32.eqz (call $~lib/internal/string/compareUnsafe (get_local $0) - (get_local $9) + (get_local $7) (get_local $1) (i32.const 0) - (get_local $8) + (get_local $6) ) ) ) - (func $~lib/string/String#endsWith|trampoline (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#endsWith|trampoline (; 10 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange @@ -809,13 +793,12 @@ (get_local $2) ) ) - (func $~lib/string/String#indexOf (; 12 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#indexOf (; 11 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) (local $7 i32) - (local $8 i32) (if (i32.eqz (i32.ne @@ -826,8 +809,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 214) + (i32.const 76) + (i32.const 210) (i32.const 4) ) (unreachable) @@ -839,7 +822,7 @@ (i32.const 0) ) (set_local $1 - (i32.const 196) + (i32.const 192) ) ) (set_local $3 @@ -868,33 +851,28 @@ (i32.const -1) ) ) - (set_local $8 - (block $~lib/internal/string/clamp|inlined.2 (result i32) - (set_local $5 - (i32.const 0) - ) - (select - (tee_local $6 - (select - (tee_local $6 - (get_local $2) - ) - (tee_local $7 - (get_local $5) - ) - (i32.gt_s - (get_local $6) - (get_local $7) - ) + (set_local $7 + (select + (tee_local $5 + (select + (tee_local $5 + (get_local $2) + ) + (tee_local $6 + (i32.const 0) + ) + (i32.gt_s + (get_local $5) + (get_local $6) ) ) - (tee_local $7 - (get_local $4) - ) - (i32.lt_s - (get_local $6) - (get_local $7) - ) + ) + (tee_local $6 + (get_local $4) + ) + (i32.lt_s + (get_local $5) + (get_local $6) ) ) ) @@ -906,7 +884,7 @@ ) (block $break|0 (set_local $5 - (get_local $8) + (get_local $7) ) (loop $repeat|0 (br_if $break|0 @@ -942,7 +920,7 @@ ) (i32.const -1) ) - (func $~lib/string/String#includes (; 13 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#includes (; 12 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (i32.ne (call $~lib/string/String#indexOf (get_local $0) @@ -952,7 +930,7 @@ (i32.const -1) ) ) - (func $~lib/memory/memcpy (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memcpy (; 13 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2754,7 +2732,7 @@ ) ) ) - (func $~lib/memory/memmove (; 15 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memmove (; 14 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.eq @@ -2784,7 +2762,7 @@ ) ) (block - (call $~lib/memory/memcpy + (call $~lib/internal/memory/memcpy (get_local $0) (get_local $1) (get_local $2) @@ -3072,14 +3050,7 @@ ) ) ) - (func $~lib/memory/memory.copy (; 16 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memmove - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/internal/string/repeatUnsafe (; 17 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) + (func $~lib/internal/string/repeatUnsafe (; 15 ;) (type $iiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) @@ -3087,6 +3058,7 @@ (local $8 i32) (local $9 i64) (local $10 i32) + (local $11 i32) (set_local $4 (i32.load (get_local $2) @@ -3399,13 +3371,18 @@ ) ) ) - (call $~lib/memory/memory.copy - (i32.add - (get_local $6) - (get_local $8) + (block $~lib/memory/memory.copy|inlined.0 + (set_local $11 + (i32.add + (get_local $6) + (get_local $8) + ) + ) + (call $~lib/internal/memory/memmove + (get_local $11) + (get_local $5) + (get_local $7) ) - (get_local $5) - (get_local $7) ) (set_local $8 (i32.add @@ -3420,7 +3397,49 @@ ) ) ) - (func $~lib/string/String#padStart (; 18 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/internal/string/copyUnsafe (; 16 ;) (type $iiiiiv) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) + (local $5 i32) + (local $6 i32) + (local $7 i32) + (block $~lib/memory/memory.copy|inlined.1 + (set_local $5 + (i32.add + (i32.add + (get_local $0) + (i32.shl + (get_local $1) + (i32.const 1) + ) + ) + (get_global $~lib/internal/string/HEADER_SIZE) + ) + ) + (set_local $6 + (i32.add + (i32.add + (get_local $2) + (i32.shl + (get_local $3) + (i32.const 1) + ) + ) + (get_global $~lib/internal/string/HEADER_SIZE) + ) + ) + (set_local $7 + (i32.shl + (get_local $4) + (i32.const 1) + ) + ) + (call $~lib/internal/memory/memmove + (get_local $5) + (get_local $6) + (get_local $7) + ) + ) + ) + (func $~lib/string/String#padStart (; 17 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3428,7 +3447,6 @@ (local $7 i32) (local $8 i32) (local $9 i32) - (local $10 i32) (if (i32.eqz (i32.ne @@ -3439,8 +3457,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 351) + (i32.const 76) + (i32.const 347) (i32.const 4) ) (unreachable) @@ -3480,7 +3498,7 @@ ) ) (set_local $7 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (get_local $1) ) ) @@ -3519,111 +3537,36 @@ ) (if (get_local $9) - (block $~lib/internal/string/copyUnsafe|inlined.0 - (set_local $10 - (i32.const 0) - ) - (call $~lib/memory/memory.copy - (i32.add - (i32.add - (get_local $7) - (i32.shl - (get_local $8) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.add - (i32.add - (get_local $2) - (i32.shl - (get_local $10) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.shl - (get_local $9) - (i32.const 1) - ) - ) + (call $~lib/internal/string/copyUnsafe + (get_local $7) + (get_local $8) + (get_local $2) + (i32.const 0) + (get_local $9) ) ) ) - (block $~lib/internal/string/copyUnsafe|inlined.1 - (set_local $9 - (i32.const 0) - ) - (set_local $8 - (i32.const 0) - ) - (call $~lib/memory/memory.copy - (i32.add - (i32.add - (get_local $7) - (i32.shl - (get_local $9) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.add - (i32.add - (get_local $2) - (i32.shl - (get_local $8) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.shl - (get_local $6) - (i32.const 1) - ) - ) + (call $~lib/internal/string/copyUnsafe + (get_local $7) + (i32.const 0) + (get_local $2) + (i32.const 0) + (get_local $6) ) ) (if (get_local $3) - (block $~lib/internal/string/copyUnsafe|inlined.2 - (set_local $8 - (i32.const 0) - ) - (call $~lib/memory/memory.copy - (i32.add - (i32.add - (get_local $7) - (i32.shl - (get_local $6) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.add - (i32.add - (get_local $0) - (i32.shl - (get_local $8) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.shl - (get_local $3) - (i32.const 1) - ) - ) + (call $~lib/internal/string/copyUnsafe + (get_local $7) + (get_local $6) + (get_local $0) + (i32.const 0) + (get_local $3) ) ) (get_local $7) ) - (func $~lib/string/String#padStart|trampoline (; 19 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#padStart|trampoline (; 18 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange @@ -3637,7 +3580,7 @@ (unreachable) ) (set_local $2 - (i32.const 236) + (i32.const 232) ) ) (call $~lib/string/String#padStart @@ -3646,7 +3589,7 @@ (get_local $2) ) ) - (func $~lib/string/String#padEnd (; 20 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#padEnd (; 19 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -3654,8 +3597,6 @@ (local $7 i32) (local $8 i32) (local $9 i32) - (local $10 i32) - (local $11 i32) (if (i32.eqz (i32.ne @@ -3666,8 +3607,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 371) + (i32.const 76) + (i32.const 367) (i32.const 4) ) (unreachable) @@ -3707,45 +3648,18 @@ ) ) (set_local $7 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (get_local $1) ) ) (if (get_local $3) - (block $~lib/internal/string/copyUnsafe|inlined.3 - (set_local $5 - (i32.const 0) - ) - (set_local $8 - (i32.const 0) - ) - (call $~lib/memory/memory.copy - (i32.add - (i32.add - (get_local $7) - (i32.shl - (get_local $5) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.add - (i32.add - (get_local $0) - (i32.shl - (get_local $8) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.shl - (get_local $3) - (i32.const 1) - ) - ) + (call $~lib/internal/string/copyUnsafe + (get_local $7) + (i32.const 0) + (get_local $0) + (i32.const 0) + (get_local $3) ) ) (if @@ -3754,7 +3668,7 @@ (get_local $4) ) (block - (set_local $8 + (set_local $5 (i32.div_s (i32.sub (get_local $6) @@ -3763,100 +3677,49 @@ (get_local $4) ) ) - (set_local $5 + (set_local $8 (i32.mul - (get_local $8) + (get_local $5) (get_local $4) ) ) (set_local $9 (i32.sub (get_local $6) - (get_local $5) + (get_local $8) ) ) (call $~lib/internal/string/repeatUnsafe (get_local $7) (get_local $3) (get_local $2) - (get_local $8) + (get_local $5) ) (if (get_local $9) - (block $~lib/internal/string/copyUnsafe|inlined.4 - (set_local $10 - (i32.add - (get_local $5) - (get_local $3) - ) - ) - (set_local $11 - (i32.const 0) - ) - (call $~lib/memory/memory.copy - (i32.add - (i32.add - (get_local $7) - (i32.shl - (get_local $10) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.add - (i32.add - (get_local $2) - (i32.shl - (get_local $11) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.shl - (get_local $9) - (i32.const 1) - ) + (call $~lib/internal/string/copyUnsafe + (get_local $7) + (i32.add + (get_local $8) + (get_local $3) ) + (get_local $2) + (i32.const 0) + (get_local $9) ) ) ) - (block $~lib/internal/string/copyUnsafe|inlined.5 - (set_local $9 - (i32.const 0) - ) - (call $~lib/memory/memory.copy - (i32.add - (i32.add - (get_local $7) - (i32.shl - (get_local $3) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.add - (i32.add - (get_local $2) - (i32.shl - (get_local $9) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.shl - (get_local $6) - (i32.const 1) - ) - ) + (call $~lib/internal/string/copyUnsafe + (get_local $7) + (get_local $3) + (get_local $2) + (i32.const 0) + (get_local $6) ) ) (get_local $7) ) - (func $~lib/string/String#padEnd|trampoline (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#padEnd|trampoline (; 20 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange @@ -3870,7 +3733,7 @@ (unreachable) ) (set_local $2 - (i32.const 236) + (i32.const 232) ) ) (call $~lib/string/String#padEnd @@ -3879,14 +3742,12 @@ (get_local $2) ) ) - (func $~lib/string/String#lastIndexOf (; 22 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#lastIndexOf (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) (local $6 i32) (local $7 i32) - (local $8 i32) - (local $9 i32) (if (i32.eqz (i32.ne @@ -3897,8 +3758,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 230) + (i32.const 76) + (i32.const 226) (i32.const 4) ) (unreachable) @@ -3910,7 +3771,7 @@ (i32.const 0) ) (set_local $1 - (i32.const 196) + (i32.const 192) ) ) (set_local $3 @@ -3939,51 +3800,43 @@ (i32.const -1) ) ) - (set_local $9 - (block $~lib/internal/string/clamp|inlined.3 (result i32) - (set_local $5 - (i32.const 0) + (set_local $7 + (select + (tee_local $5 + (select + (tee_local $5 + (get_local $2) + ) + (tee_local $6 + (i32.const 0) + ) + (i32.gt_s + (get_local $5) + (get_local $6) + ) + ) ) - (set_local $6 + (tee_local $6 (i32.sub (get_local $3) (get_local $4) ) ) - (select - (tee_local $7 - (select - (tee_local $7 - (get_local $2) - ) - (tee_local $8 - (get_local $5) - ) - (i32.gt_s - (get_local $7) - (get_local $8) - ) - ) - ) - (tee_local $8 - (get_local $6) - ) - (i32.lt_s - (get_local $7) - (get_local $8) - ) + (i32.lt_s + (get_local $5) + (get_local $6) ) ) ) (block $break|0 - (set_local $6 - (get_local $9) + (set_local $5 + (get_local $7) ) (loop $repeat|0 (br_if $break|0 (i32.eqz (i32.ge_s - (get_local $6) + (get_local $5) (i32.const 0) ) ) @@ -3992,19 +3845,19 @@ (i32.eqz (call $~lib/internal/string/compareUnsafe (get_local $0) - (get_local $6) + (get_local $5) (get_local $1) (i32.const 0) (get_local $4) ) ) (return - (get_local $6) + (get_local $5) ) ) - (set_local $6 + (set_local $5 (i32.sub - (get_local $6) + (get_local $5) (i32.const 1) ) ) @@ -4013,7 +3866,7 @@ ) (i32.const -1) ) - (func $~lib/string/String#lastIndexOf|trampoline (; 23 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/string/String#lastIndexOf|trampoline (; 22 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $1of1 (block $0of1 (block $outOfRange @@ -4036,10 +3889,10 @@ (get_local $2) ) ) - (func $std/string/getString (; 24 ;) (type $i) (result i32) + (func $std/string/getString (; 23 ;) (type $i) (result i32) (get_global $std/string/str) ) - (func $~lib/internal/string/parse (; 25 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/internal/string/parse (; 24 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4429,13 +4282,13 @@ (get_local $7) ) ) - (func $~lib/string/parseInt (; 26 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) + (func $~lib/string/parseInt (; 25 ;) (type $iiF) (param $0 i32) (param $1 i32) (result f64) (call $~lib/internal/string/parse (get_local $0) (get_local $1) ) ) - (func $~lib/string/parseFloat (; 27 ;) (type $iF) (param $0 i32) (result f64) + (func $~lib/string/parseFloat (; 26 ;) (type $iF) (param $0 i32) (result f64) (local $1 i32) (local $2 i32) (local $3 i32) @@ -4618,8 +4471,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 519) + (i32.const 76) + (i32.const 515) (i32.const 10) ) (unreachable) @@ -4712,13 +4565,11 @@ (get_local $5) ) ) - (func $~lib/string/String#concat (; 28 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#concat (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) - (local $6 i32) - (local $7 i32) (if (i32.eqz (i32.ne @@ -4729,8 +4580,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 112) + (i32.const 76) + (i32.const 108) (i32.const 4) ) (unreachable) @@ -4742,7 +4593,7 @@ (i32.const 0) ) (set_local $1 - (i32.const 196) + (i32.const 192) ) ) (set_local $2 @@ -4767,88 +4618,37 @@ (i32.const 0) ) (return - (get_global $~lib/internal/string/EMPTY) + (i32.const 240) ) ) (set_local $5 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (get_local $4) ) ) - (block $~lib/internal/string/copyUnsafe|inlined.6 - (set_local $6 - (i32.const 0) - ) - (set_local $7 - (i32.const 0) - ) - (call $~lib/memory/memory.copy - (i32.add - (i32.add - (get_local $5) - (i32.shl - (get_local $6) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.add - (i32.add - (get_local $0) - (i32.shl - (get_local $7) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.shl - (get_local $2) - (i32.const 1) - ) - ) + (call $~lib/internal/string/copyUnsafe + (get_local $5) + (i32.const 0) + (get_local $0) + (i32.const 0) + (get_local $2) ) - (block $~lib/internal/string/copyUnsafe|inlined.7 - (set_local $7 - (i32.const 0) - ) - (call $~lib/memory/memory.copy - (i32.add - (i32.add - (get_local $5) - (i32.shl - (get_local $2) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.add - (i32.add - (get_local $1) - (i32.shl - (get_local $7) - (i32.const 1) - ) - ) - (get_global $~lib/internal/string/HEADER_SIZE) - ) - (i32.shl - (get_local $3) - (i32.const 1) - ) - ) + (call $~lib/internal/string/copyUnsafe + (get_local $5) + (get_local $2) + (get_local $1) + (i32.const 0) + (get_local $3) ) (get_local $5) ) - (func $~lib/string/String.__concat (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__concat (; 28 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (if (i32.eqz (get_local $0) ) (set_local $0 - (i32.const 196) + (i32.const 192) ) ) (call $~lib/string/String#concat @@ -4856,7 +4656,7 @@ (get_local $1) ) ) - (func $~lib/string/String.__ne (; 30 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__ne (; 29 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.eqz (call $~lib/string/String.__eq (get_local $0) @@ -4864,7 +4664,7 @@ ) ) ) - (func $~lib/string/String.__gt (; 31 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__gt (; 30 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -4948,7 +4748,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__gte (; 32 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__gte (; 31 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5034,7 +4834,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__lt (; 33 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__lt (; 32 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5118,7 +4918,7 @@ (i32.const 0) ) ) - (func $~lib/string/String.__lte (; 34 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__lte (; 33 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5204,7 +5004,7 @@ (i32.const 0) ) ) - (func $~lib/string/String#repeat (; 35 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String#repeat (; 34 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -5218,8 +5018,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 391) + (i32.const 76) + (i32.const 387) (i32.const 4) ) (unreachable) @@ -5253,8 +5053,8 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 80) - (i32.const 396) + (i32.const 76) + (i32.const 392) (i32.const 6) ) (unreachable) @@ -5274,7 +5074,7 @@ ) ) (return - (get_global $~lib/internal/string/EMPTY) + (i32.const 240) ) ) (if @@ -5287,7 +5087,7 @@ ) ) (set_local $4 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (i32.mul (get_local $2) (get_local $1) @@ -5302,7 +5102,7 @@ ) (get_local $4) ) - (func $~lib/internal/itoa/decimalCountU32 (; 36 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/decimalCountU32 (; 35 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -5358,7 +5158,7 @@ (i32.const 1) ) ) - (func $~lib/internal/itoa/utoa32_lut (; 37 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/itoa/utoa32_lut (; 36 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -5577,7 +5377,7 @@ ) ) ) - (func $~lib/internal/itoa/itoa32 (; 38 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/itoa32 (; 37 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -5613,7 +5413,7 @@ ) ) (set_local $3 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (get_local $2) ) ) @@ -5633,7 +5433,7 @@ ) (get_local $3) ) - (func $~lib/internal/itoa/utoa32 (; 39 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/itoa/utoa32 (; 38 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -5650,7 +5450,7 @@ ) ) (set_local $2 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (get_local $1) ) ) @@ -5663,7 +5463,7 @@ ) (get_local $2) ) - (func $~lib/internal/itoa/decimalCountU64 (; 40 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/decimalCountU64 (; 39 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -5731,7 +5531,7 @@ (i32.const 1) ) ) - (func $~lib/internal/itoa/utoa64_lut (; 41 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) + (func $~lib/internal/itoa/utoa64_lut (; 40 ;) (type $iIiv) (param $0 i32) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i64) (local $5 i32) @@ -5925,7 +5725,7 @@ (get_local $2) ) ) - (func $~lib/internal/itoa/utoa64 (; 42 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/utoa64 (; 41 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -5956,7 +5756,7 @@ ) ) (set_local $1 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (get_local $3) ) ) @@ -5975,7 +5775,7 @@ ) ) (set_local $1 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (get_local $3) ) ) @@ -5990,7 +5790,7 @@ ) (get_local $1) ) - (func $~lib/internal/itoa/itoa64 (; 43 ;) (type $Ii) (param $0 i64) (result i32) + (func $~lib/internal/itoa/itoa64 (; 42 ;) (type $Ii) (param $0 i64) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -6040,7 +5840,7 @@ ) ) (set_local $2 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (get_local $4) ) ) @@ -6062,7 +5862,7 @@ ) ) (set_local $2 - (call $~lib/internal/string/allocate + (call $~lib/internal/string/allocateUnsafe (get_local $4) ) ) @@ -6084,7 +5884,7 @@ ) (get_local $2) ) - (func $start (; 44 ;) (type $v) + (func $start (; 43 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add @@ -6104,13 +5904,13 @@ (i32.eqz (i32.eq (get_global $std/string/str) - (i32.const 12) + (i32.const 8) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 11) (i32.const 0) ) @@ -6129,7 +5929,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 13) (i32.const 0) ) @@ -6149,7 +5949,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 14) (i32.const 0) ) @@ -6162,13 +5962,13 @@ (call $~lib/string/String.fromCharCode (i32.const 0) ) - (i32.const 112) + (i32.const 108) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 16) (i32.const 0) ) @@ -6181,13 +5981,13 @@ (call $~lib/string/String.fromCharCode (i32.const 54) ) - (i32.const 172) + (i32.const 168) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 17) (i32.const 0) ) @@ -6203,13 +6003,13 @@ (i32.const 54) ) ) - (i32.const 172) + (i32.const 168) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 18) (i32.const 0) ) @@ -6222,13 +6022,13 @@ (call $~lib/string/String.fromCodePoint (i32.const 0) ) - (i32.const 112) + (i32.const 108) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 20) (i32.const 0) ) @@ -6241,13 +6041,13 @@ (call $~lib/string/String.fromCodePoint (i32.const 54) ) - (i32.const 172) + (i32.const 168) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 21) (i32.const 0) ) @@ -6262,8 +6062,8 @@ ) (block (call $~lib/env/abort - (i32.const 180) - (i32.const 48) + (i32.const 176) + (i32.const 44) (i32.const 22) (i32.const 0) ) @@ -6274,14 +6074,14 @@ (i32.eqz (call $~lib/string/String#startsWith (get_global $std/string/str) - (i32.const 188) + (i32.const 184) (i32.const 0) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 24) (i32.const 0) ) @@ -6296,7 +6096,7 @@ ) (call $~lib/string/String#endsWith|trampoline (get_global $std/string/str) - (i32.const 208) + (i32.const 204) (i32.const 0) ) ) @@ -6304,7 +6104,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 25) (i32.const 0) ) @@ -6315,14 +6115,14 @@ (i32.eqz (call $~lib/string/String#includes (get_global $std/string/str) - (i32.const 224) + (i32.const 220) (i32.const 0) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 26) (i32.const 0) ) @@ -6348,7 +6148,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 28) (i32.const 0) ) @@ -6374,7 +6174,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 29) (i32.const 0) ) @@ -6389,7 +6189,7 @@ (i32.const 1) ) (call $~lib/string/String#padStart|trampoline - (i32.const 8) + (i32.const 240) (i32.const 3) (i32.const 0) ) @@ -6400,7 +6200,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 30) (i32.const 0) ) @@ -6411,17 +6211,17 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/string/String#padStart - (i32.const 8) + (i32.const 240) (i32.const 10) - (i32.const 8) + (i32.const 240) ) - (i32.const 8) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 31) (i32.const 0) ) @@ -6434,7 +6234,7 @@ (call $~lib/string/String#padStart (i32.const 256) (i32.const 100) - (i32.const 8) + (i32.const 240) ) (i32.const 256) ) @@ -6442,7 +6242,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 32) (i32.const 0) ) @@ -6468,7 +6268,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 33) (i32.const 0) ) @@ -6489,7 +6289,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 34) (i32.const 0) ) @@ -6510,7 +6310,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 35) (i32.const 0) ) @@ -6536,7 +6336,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 37) (i32.const 0) ) @@ -6562,7 +6362,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 38) (i32.const 0) ) @@ -6577,7 +6377,7 @@ (i32.const 1) ) (call $~lib/string/String#padEnd|trampoline - (i32.const 8) + (i32.const 240) (i32.const 3) (i32.const 0) ) @@ -6588,7 +6388,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 39) (i32.const 0) ) @@ -6599,17 +6399,17 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/string/String#padEnd - (i32.const 8) + (i32.const 240) (i32.const 10) - (i32.const 8) + (i32.const 240) ) - (i32.const 8) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 40) (i32.const 0) ) @@ -6622,7 +6422,7 @@ (call $~lib/string/String#padEnd (i32.const 256) (i32.const 100) - (i32.const 8) + (i32.const 240) ) (i32.const 256) ) @@ -6630,7 +6430,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 41) (i32.const 0) ) @@ -6656,7 +6456,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 42) (i32.const 0) ) @@ -6677,7 +6477,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 43) (i32.const 0) ) @@ -6698,7 +6498,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 44) (i32.const 0) ) @@ -6709,8 +6509,8 @@ (i32.eqz (i32.eq (call $~lib/string/String#indexOf - (i32.const 8) - (i32.const 8) + (i32.const 240) + (i32.const 240) (i32.const 0) ) (i32.const 0) @@ -6719,7 +6519,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 46) (i32.const 0) ) @@ -6730,8 +6530,8 @@ (i32.eqz (i32.eq (call $~lib/string/String#indexOf - (i32.const 8) - (i32.const 188) + (i32.const 240) + (i32.const 184) (i32.const 0) ) (i32.const -1) @@ -6740,7 +6540,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 47) (i32.const 0) ) @@ -6752,7 +6552,7 @@ (i32.eq (call $~lib/string/String#indexOf (get_global $std/string/str) - (i32.const 8) + (i32.const 240) (i32.const 0) ) (i32.const 0) @@ -6761,7 +6561,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 48) (i32.const 0) ) @@ -6782,7 +6582,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 49) (i32.const 0) ) @@ -6803,7 +6603,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 50) (i32.const 0) ) @@ -6824,7 +6624,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 51) (i32.const 0) ) @@ -6845,7 +6645,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 52) (i32.const 0) ) @@ -6866,7 +6666,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 53) (i32.const 0) ) @@ -6881,8 +6681,8 @@ (i32.const 1) ) (call $~lib/string/String#lastIndexOf|trampoline - (i32.const 8) - (i32.const 8) + (i32.const 240) + (i32.const 240) (i32.const 0) ) ) @@ -6892,7 +6692,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 55) (i32.const 0) ) @@ -6907,8 +6707,8 @@ (i32.const 1) ) (call $~lib/string/String#lastIndexOf|trampoline - (i32.const 8) - (i32.const 188) + (i32.const 240) + (i32.const 184) (i32.const 0) ) ) @@ -6918,7 +6718,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 56) (i32.const 0) ) @@ -6934,7 +6734,7 @@ ) (call $~lib/string/String#lastIndexOf|trampoline (get_global $std/string/str) - (i32.const 8) + (i32.const 240) (i32.const 0) ) ) @@ -6946,7 +6746,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 57) (i32.const 0) ) @@ -6972,7 +6772,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 58) (i32.const 0) ) @@ -6998,7 +6798,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 59) (i32.const 0) ) @@ -7024,7 +6824,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 60) (i32.const 0) ) @@ -7045,7 +6845,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 61) (i32.const 0) ) @@ -7066,7 +6866,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 62) (i32.const 0) ) @@ -7087,7 +6887,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 63) (i32.const 0) ) @@ -7108,7 +6908,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 64) (i32.const 0) ) @@ -7120,7 +6920,7 @@ (i32.eq (call $~lib/string/String#lastIndexOf (get_global $std/string/str) - (i32.const 188) + (i32.const 184) (i32.const 0) ) (i32.const 0) @@ -7129,7 +6929,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 65) (i32.const 0) ) @@ -7149,7 +6949,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 71) (i32.const 0) ) @@ -7169,7 +6969,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 72) (i32.const 0) ) @@ -7189,7 +6989,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 73) (i32.const 0) ) @@ -7209,7 +7009,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 74) (i32.const 0) ) @@ -7229,7 +7029,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 75) (i32.const 0) ) @@ -7249,7 +7049,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 76) (i32.const 0) ) @@ -7269,7 +7069,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 77) (i32.const 0) ) @@ -7289,7 +7089,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 78) (i32.const 0) ) @@ -7308,7 +7108,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 80) (i32.const 0) ) @@ -7327,7 +7127,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 81) (i32.const 0) ) @@ -7346,7 +7146,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 82) (i32.const 0) ) @@ -7365,7 +7165,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 83) (i32.const 0) ) @@ -7384,7 +7184,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 84) (i32.const 0) ) @@ -7407,7 +7207,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 87) (i32.const 0) ) @@ -7424,7 +7224,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 88) (i32.const 0) ) @@ -7434,14 +7234,14 @@ (if (i32.eqz (call $~lib/string/String.__eq - (i32.const 8) - (i32.const 8) + (i32.const 240) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 89) (i32.const 0) ) @@ -7451,14 +7251,14 @@ (if (i32.eqz (call $~lib/string/String.__ne - (i32.const 8) + (i32.const 240) (get_global $std/string/nullStr) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 90) (i32.const 0) ) @@ -7475,7 +7275,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 92) (i32.const 0) ) @@ -7492,7 +7292,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 93) (i32.const 0) ) @@ -7509,7 +7309,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 94) (i32.const 0) ) @@ -7526,7 +7326,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 95) (i32.const 0) ) @@ -7545,7 +7345,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 96) (i32.const 0) ) @@ -7564,7 +7364,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 98) (i32.const 0) ) @@ -7583,7 +7383,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 99) (i32.const 0) ) @@ -7594,13 +7394,13 @@ (i32.eqz (call $~lib/string/String.__gt (i32.const 264) - (i32.const 8) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 101) (i32.const 0) ) @@ -7610,14 +7410,14 @@ (if (i32.eqz (call $~lib/string/String.__lt - (i32.const 8) + (i32.const 240) (i32.const 264) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 102) (i32.const 0) ) @@ -7628,13 +7428,13 @@ (i32.eqz (call $~lib/string/String.__gte (i32.const 264) - (i32.const 8) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 103) (i32.const 0) ) @@ -7644,14 +7444,14 @@ (if (i32.eqz (call $~lib/string/String.__lte - (i32.const 8) + (i32.const 240) (i32.const 264) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 104) (i32.const 0) ) @@ -7663,14 +7463,14 @@ (i32.eqz (call $~lib/string/String.__lt (i32.const 264) - (i32.const 8) + (i32.const 240) ) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 105) (i32.const 0) ) @@ -7681,7 +7481,7 @@ (i32.eqz (i32.eqz (call $~lib/string/String.__gt - (i32.const 8) + (i32.const 240) (i32.const 264) ) ) @@ -7689,7 +7489,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 106) (i32.const 0) ) @@ -7700,15 +7500,15 @@ (i32.eqz (i32.eqz (call $~lib/string/String.__lt - (i32.const 8) - (i32.const 8) + (i32.const 240) + (i32.const 240) ) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 107) (i32.const 0) ) @@ -7719,15 +7519,15 @@ (i32.eqz (i32.eqz (call $~lib/string/String.__gt - (i32.const 8) - (i32.const 8) + (i32.const 240) + (i32.const 240) ) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 108) (i32.const 0) ) @@ -7737,14 +7537,14 @@ (if (i32.eqz (call $~lib/string/String.__gte - (i32.const 8) - (i32.const 8) + (i32.const 240) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 109) (i32.const 0) ) @@ -7754,14 +7554,14 @@ (if (i32.eqz (call $~lib/string/String.__lte - (i32.const 8) - (i32.const 8) + (i32.const 240) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 110) (i32.const 0) ) @@ -7793,7 +7593,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 114) (i32.const 0) ) @@ -7812,7 +7612,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 116) (i32.const 0) ) @@ -7823,16 +7623,16 @@ (i32.eqz (call $~lib/string/String.__eq (call $~lib/string/String#repeat - (i32.const 8) + (i32.const 240) (i32.const 100) ) - (i32.const 8) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 118) (i32.const 0) ) @@ -7846,13 +7646,13 @@ (i32.const 256) (i32.const 0) ) - (i32.const 8) + (i32.const 240) ) ) (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 119) (i32.const 0) ) @@ -7872,7 +7672,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 120) (i32.const 0) ) @@ -7892,7 +7692,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 121) (i32.const 0) ) @@ -7912,7 +7712,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 122) (i32.const 0) ) @@ -7932,7 +7732,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 123) (i32.const 0) ) @@ -7952,7 +7752,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 124) (i32.const 0) ) @@ -7972,7 +7772,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 125) (i32.const 0) ) @@ -7992,7 +7792,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 126) (i32.const 0) ) @@ -8011,7 +7811,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 128) (i32.const 0) ) @@ -8030,7 +7830,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 129) (i32.const 0) ) @@ -8049,7 +7849,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 130) (i32.const 0) ) @@ -8068,7 +7868,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 131) (i32.const 0) ) @@ -8087,7 +7887,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 132) (i32.const 0) ) @@ -8106,7 +7906,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 133) (i32.const 0) ) @@ -8125,7 +7925,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 134) (i32.const 0) ) @@ -8144,7 +7944,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 135) (i32.const 0) ) @@ -8163,7 +7963,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 136) (i32.const 0) ) @@ -8182,7 +7982,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 137) (i32.const 0) ) @@ -8201,7 +8001,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 138) (i32.const 0) ) @@ -8220,7 +8020,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 139) (i32.const 0) ) @@ -8239,7 +8039,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 140) (i32.const 0) ) @@ -8258,7 +8058,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 141) (i32.const 0) ) @@ -8277,7 +8077,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 143) (i32.const 0) ) @@ -8296,7 +8096,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 144) (i32.const 0) ) @@ -8315,7 +8115,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 145) (i32.const 0) ) @@ -8334,7 +8134,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 146) (i32.const 0) ) @@ -8353,7 +8153,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 147) (i32.const 0) ) @@ -8372,7 +8172,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 149) (i32.const 0) ) @@ -8391,7 +8191,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 150) (i32.const 0) ) @@ -8410,7 +8210,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 151) (i32.const 0) ) @@ -8429,7 +8229,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 152) (i32.const 0) ) @@ -8448,7 +8248,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 153) (i32.const 0) ) @@ -8467,7 +8267,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 154) (i32.const 0) ) @@ -8486,7 +8286,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 155) (i32.const 0) ) @@ -8505,7 +8305,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 156) (i32.const 0) ) @@ -8524,7 +8324,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 157) (i32.const 0) ) @@ -8543,7 +8343,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 158) (i32.const 0) ) @@ -8562,7 +8362,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 159) (i32.const 0) ) @@ -8581,7 +8381,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 161) (i32.const 0) ) @@ -8600,7 +8400,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 162) (i32.const 0) ) @@ -8619,7 +8419,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 163) (i32.const 0) ) @@ -8638,7 +8438,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 164) (i32.const 0) ) @@ -8657,7 +8457,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 165) (i32.const 0) ) @@ -8676,7 +8476,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 166) (i32.const 0) ) @@ -8695,7 +8495,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 167) (i32.const 0) ) @@ -8714,7 +8514,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 168) (i32.const 0) ) @@ -8733,7 +8533,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 169) (i32.const 0) ) @@ -8752,7 +8552,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 170) (i32.const 0) ) @@ -8771,7 +8571,7 @@ (block (call $~lib/env/abort (i32.const 0) - (i32.const 48) + (i32.const 44) (i32.const 171) (i32.const 0) ) diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index cd35fa75..3591d499 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -29,7 +29,7 @@ (data (i32.const 96) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/symbol/Symbol (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/symbol/Symbol (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (set_global $~lib/symbol/nextId (i32.add (tee_local $0 @@ -46,7 +46,7 @@ ) (get_local $0) ) - (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -132,12 +132,12 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/memory/memory.allocate (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (call $~lib/allocator/arena/__memory_allocate (get_local $0) ) ) - (func $~lib/internal/arraybuffer/computeSize (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/computeSize (; 4 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -151,7 +151,7 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 5 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -162,7 +162,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 96) - (i32.const 22) + (i32.const 23) (i32.const 2) ) (unreachable) @@ -170,7 +170,7 @@ ) (i32.store (tee_local $1 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -180,7 +180,7 @@ ) (get_local $1) ) - (func $~lib/memory/memset (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memset (; 6 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -510,14 +510,7 @@ ) ) ) - (func $~lib/memory/memory.fill (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 7 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (if (i32.gt_u @@ -535,7 +528,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $1) ) ) @@ -546,7 +539,7 @@ (i32.const 1) ) ) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (i32.add (get_local $3) (i32.const 8) @@ -557,7 +550,7 @@ ) (get_local $3) ) - (func $~lib/map/Map#clear (; 9 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 8 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -591,7 +584,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 10 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 9 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (i32.eqz (get_local $0) @@ -632,7 +625,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hashStr (; 11 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hashStr (; 10 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -680,7 +673,7 @@ ) (get_local $2) ) - (func $~lib/internal/string/compareUnsafe (; 12 ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) + (func $~lib/internal/string/compareUnsafe (; 11 ;) (; has Stack IR ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) (local $5 i32) (set_local $1 (i32.add @@ -745,7 +738,7 @@ ) (get_local $5) ) - (func $~lib/string/String.__eq (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 12 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.eq @@ -801,7 +794,7 @@ ) ) ) - (func $~lib/map/Map#find (; 14 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 13 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -864,7 +857,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 14 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -876,7 +869,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#get (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 15 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -895,7 +888,7 @@ ) ) ) - (func $~lib/map/Map#rehash (; 17 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 16 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1058,7 +1051,7 @@ ) ) ) - (func $~lib/map/Map#set (; 18 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 17 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1195,7 +1188,7 @@ ) ) ) - (func $~lib/internal/hash/hash32 (; 19 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 18 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.mul (i32.xor (i32.mul @@ -1240,7 +1233,7 @@ (i32.const 16777619) ) ) - (func $~lib/map/Map#find (; 20 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 19 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (set_local $2 (i32.load offset=8 (i32.add @@ -1303,7 +1296,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#rehash (; 21 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 20 ;) (; has Stack IR ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1466,7 +1459,7 @@ ) ) ) - (func $~lib/map/Map#set (; 22 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 21 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1603,7 +1596,7 @@ ) ) ) - (func $~lib/symbol/Symbol.for (; 23 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/symbol/Symbol.for (; 22 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (get_global $~lib/symbol/stringToId) @@ -1658,7 +1651,7 @@ ) (get_local $1) ) - (func $~lib/map/Map#has (; 24 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 23 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -1670,7 +1663,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#get (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 24 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (tee_local $0 (if (result i32) (tee_local $0 @@ -1689,7 +1682,7 @@ ) ) ) - (func $~lib/symbol/Symbol.keyFor (; 26 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/symbol/Symbol.keyFor (; 25 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (tee_local $1 @@ -1716,7 +1709,7 @@ ) ) ) - (func $start (; 27 ;) (type $v) + (func $start (; 26 ;) (; has Stack IR ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.const 160) ) diff --git a/tests/compiler/std/symbol.untouched.wat b/tests/compiler/std/symbol.untouched.wat index f974d62f..62bf73e8 100644 --- a/tests/compiler/std/symbol.untouched.wat +++ b/tests/compiler/std/symbol.untouched.wat @@ -203,8 +203,9 @@ ) ) ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 5 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) + (local $2 i32) (if (i32.eqz (i32.le_u @@ -216,16 +217,23 @@ (call $~lib/env/abort (i32.const 0) (i32.const 96) - (i32.const 22) + (i32.const 23) (i32.const 2) ) (unreachable) ) ) (set_local $1 - (call $~lib/memory/memory.allocate - (call $~lib/internal/arraybuffer/computeSize - (get_local $0) + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $2 + (call $~lib/internal/arraybuffer/computeSize + (get_local $0) + ) + ) + (br $~lib/memory/memory.allocate|inlined.0 + (call $~lib/allocator/arena/__memory_allocate + (get_local $2) + ) ) ) ) @@ -235,7 +243,7 @@ ) (get_local $1) ) - (func $~lib/memory/memset (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memset (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -587,15 +595,10 @@ ) ) ) - (func $~lib/memory/memory.fill (; 7 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) - ) - ) - (func $~lib/arraybuffer/ArrayBuffer#constructor (; 8 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/arraybuffer/ArrayBuffer#constructor (; 7 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) + (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -612,7 +615,7 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $1) ) ) @@ -623,18 +626,26 @@ (i32.const 1) ) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.0 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $1) ) - (i32.const 0) - (get_local $1) ) ) (get_local $3) ) - (func $~lib/map/Map#clear (; 9 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 8 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -671,7 +682,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 10 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 9 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -717,7 +728,7 @@ ) (get_local $0) ) - (func $~lib/map/Map#clear (; 11 ;) (type $iv) (param $0 i32) + (func $~lib/map/Map#clear (; 10 ;) (type $iv) (param $0 i32) (i32.store (get_local $0) (call $~lib/arraybuffer/ArrayBuffer#constructor @@ -754,7 +765,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#constructor (; 12 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/map/Map#constructor (; 11 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (call $~lib/map/Map#clear (tee_local $0 @@ -800,7 +811,7 @@ ) (get_local $0) ) - (func $~lib/internal/hash/hashStr (; 13 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hashStr (; 12 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -855,7 +866,7 @@ ) (get_local $1) ) - (func $~lib/internal/string/compareUnsafe (; 14 ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) + (func $~lib/internal/string/compareUnsafe (; 13 ;) (type $iiiiii) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) (local $5 i32) (local $6 i32) (local $7 i32) @@ -927,7 +938,7 @@ ) (get_local $5) ) - (func $~lib/string/String.__eq (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/string/String.__eq (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (if @@ -983,7 +994,7 @@ ) ) ) - (func $~lib/map/Map#find (; 16 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 15 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -1053,7 +1064,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#has (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -1069,7 +1080,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#get (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -1092,7 +1103,7 @@ (unreachable) ) ) - (func $~lib/map/Map#rehash (; 19 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 18 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1289,7 +1300,7 @@ ) ) ) - (func $~lib/map/Map#set (; 20 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 19 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1438,7 +1449,7 @@ ) ) ) - (func $~lib/internal/hash/hash32 (; 21 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/hash/hash32 (; 20 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (set_local $1 (get_global $~lib/internal/hash/FNV_OFFSET) @@ -1499,7 +1510,7 @@ ) (get_local $1) ) - (func $~lib/map/Map#find (; 22 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/map/Map#find (; 21 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $3 @@ -1569,7 +1580,7 @@ ) (i32.const 0) ) - (func $~lib/map/Map#rehash (; 23 ;) (type $iiv) (param $0 i32) (param $1 i32) + (func $~lib/map/Map#rehash (; 22 ;) (type $iiv) (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -1766,7 +1777,7 @@ ) ) ) - (func $~lib/map/Map#set (; 24 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/map/Map#set (; 23 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -1915,7 +1926,7 @@ ) ) ) - (func $~lib/symbol/Symbol.for (; 25 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/symbol/Symbol.for (; 24 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (if @@ -1979,7 +1990,7 @@ ) (get_local $2) ) - (func $~lib/map/Map#has (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#has (; 25 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (i32.ne (call $~lib/map/Map#find (get_local $0) @@ -1995,7 +2006,7 @@ (i32.const 0) ) ) - (func $~lib/map/Map#get (; 27 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/map/Map#get (; 26 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (set_local $2 (call $~lib/map/Map#find @@ -2018,7 +2029,7 @@ (unreachable) ) ) - (func $~lib/symbol/Symbol.keyFor (; 28 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/symbol/Symbol.keyFor (; 27 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (result i32) (if (result i32) @@ -2041,7 +2052,7 @@ (i32.const 0) ) ) - (func $start (; 29 ;) (type $v) + (func $start (; 28 ;) (type $v) (set_global $~lib/allocator/arena/startOffset (i32.and (i32.add diff --git a/tests/compiler/std/trace.optimized.wat b/tests/compiler/std/trace.optimized.wat index 3e56415a..d3733b9f 100644 --- a/tests/compiler/std/trace.optimized.wat +++ b/tests/compiler/std/trace.optimized.wat @@ -14,7 +14,7 @@ (data (i32.const 176) "\08\00\00\00f\00i\00v\00e\00_\00d\00b\00l") (export "memory" (memory $0)) (export "main" (func $std/trace/main)) - (func $std/trace/main (; 1 ;) (type $v) + (func $std/trace/main (; 1 ;) (; has Stack IR ;) (type $v) (if (i32.eqz (get_global $~started) @@ -27,7 +27,7 @@ ) ) ) - (func $start (; 2 ;) (type $v) + (func $start (; 2 ;) (; has Stack IR ;) (type $v) (call $~lib/env/trace (i32.const 8) (i32.const 0) diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index 7934def5..383efc30 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -17,7 +17,7 @@ (data (i32.const 108) "\1c\00\00\00~\00l\00i\00b\00/\00i\00n\00t\00e\00r\00n\00a\00l\00/\00a\00r\00r\00a\00y\00b\00u\00f\00f\00e\00r\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $~lib/internal/arraybuffer/computeSize (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/computeSize (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.shl (i32.const 1) (i32.sub @@ -31,7 +31,7 @@ ) ) ) - (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/allocator/arena/__memory_allocate (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -117,12 +117,7 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (if (i32.gt_u @@ -133,7 +128,7 @@ (call $~lib/env/abort (i32.const 0) (i32.const 108) - (i32.const 22) + (i32.const 23) (i32.const 2) ) (unreachable) @@ -141,7 +136,7 @@ ) (i32.store (tee_local $1 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (call $~lib/internal/arraybuffer/computeSize (get_local $0) ) @@ -151,7 +146,7 @@ ) (get_local $1) ) - (func $~lib/memory/memset (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memset (; 4 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (if @@ -481,14 +476,12 @@ ) ) ) - (func $~lib/memory/memory.fill (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset + (func $~lib/memory/memory.allocate (; 5 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) + (call $~lib/allocator/arena/__memory_allocate (get_local $0) - (get_local $1) - (get_local $2) ) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 6 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.gt_u @@ -505,10 +498,10 @@ (unreachable) ) ) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (i32.add (tee_local $2 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $1) ) ) @@ -554,7 +547,7 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 7 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.gt_u @@ -571,10 +564,10 @@ (unreachable) ) ) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (i32.add (tee_local $2 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (tee_local $1 (i32.shl (get_local $1) @@ -625,7 +618,7 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 8 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.gt_u @@ -642,10 +635,10 @@ (unreachable) ) ) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (i32.add (tee_local $2 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (tee_local $1 (i32.shl (get_local $1) @@ -696,7 +689,7 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 9 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.gt_u @@ -713,10 +706,10 @@ (unreachable) ) ) - (call $~lib/memory/memory.fill + (call $~lib/internal/memory/memset (i32.add (tee_local $2 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (tee_local $1 (i32.shl (get_local $1) @@ -767,7 +760,7 @@ ) (get_local $0) ) - (func $std/typedarray/testInstantiate (; 11 ;) (type $iv) (param $0 i32) + (func $std/typedarray/testInstantiate (; 10 ;) (; has Stack IR ;) (type $iv) (param $0 i32) (local $1 i32) (if (i32.load offset=4 @@ -1456,7 +1449,7 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#__set (; 12 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/typedarray/TypedArray#__set (; 11 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.ge_u @@ -1501,7 +1494,7 @@ (get_local $2) ) ) - (func $~lib/internal/typedarray/TypedArray#__get (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#__get (; 12 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.ge_u @@ -1545,7 +1538,7 @@ ) ) ) - (func $~lib/typedarray/Int32Array#subarray (; 14 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Int32Array#subarray (; 13 ;) (; has Stack IR ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (set_local $4 @@ -1632,7 +1625,7 @@ ) (i32.store (tee_local $3 - (call $~lib/memory/memory.allocate + (call $~lib/allocator/arena/__memory_allocate (i32.const 12) ) ) @@ -1656,7 +1649,7 @@ ) (get_local $3) ) - (func $~lib/internal/typedarray/TypedArray#__set (; 15 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/typedarray/TypedArray#__set (; 14 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (if (i32.ge_u @@ -1695,7 +1688,7 @@ (get_local $2) ) ) - (func $~lib/typedarray/Uint8ClampedArray#__set (; 16 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/typedarray/Uint8ClampedArray#__set (; 15 ;) (; has Stack IR ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (call $~lib/internal/typedarray/TypedArray#__set (get_local $0) @@ -1719,7 +1712,7 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#__get (; 17 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#__get (; 16 ;) (; has Stack IR ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (if (i32.ge_u @@ -1757,7 +1750,7 @@ ) ) ) - (func $start (; 18 ;) (type $v) + (func $start (; 17 ;) (; has Stack IR ;) (type $v) (local $0 i32) (set_global $~lib/allocator/arena/startOffset (i32.const 168) diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index 34544f1c..429e1e0e 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -161,15 +161,9 @@ ) (i32.const 0) ) - (func $~lib/memory/memory.allocate (; 3 ;) (type $ii) (param $0 i32) (result i32) - (return - (call $~lib/allocator/arena/__memory_allocate - (get_local $0) - ) - ) - ) - (func $~lib/internal/arraybuffer/allocUnsafe (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $~lib/internal/arraybuffer/allocateUnsafe (; 3 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) + (local $2 i32) (if (i32.eqz (i32.le_u @@ -181,16 +175,23 @@ (call $~lib/env/abort (i32.const 0) (i32.const 108) - (i32.const 22) + (i32.const 23) (i32.const 2) ) (unreachable) ) ) (set_local $1 - (call $~lib/memory/memory.allocate - (call $~lib/internal/arraybuffer/computeSize - (get_local $0) + (block $~lib/memory/memory.allocate|inlined.0 (result i32) + (set_local $2 + (call $~lib/internal/arraybuffer/computeSize + (get_local $0) + ) + ) + (br $~lib/memory/memory.allocate|inlined.0 + (call $~lib/allocator/arena/__memory_allocate + (get_local $2) + ) ) ) ) @@ -200,7 +201,7 @@ ) (get_local $1) ) - (func $~lib/memory/memset (; 5 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/memory/memset (; 4 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -552,17 +553,18 @@ ) ) ) - (func $~lib/memory/memory.fill (; 6 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) - (call $~lib/memory/memset - (get_local $0) - (get_local $1) - (get_local $2) + (func $~lib/memory/memory.allocate (; 5 ;) (type $ii) (param $0 i32) (result i32) + (return + (call $~lib/allocator/arena/__memory_allocate + (get_local $0) + ) ) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 6 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -585,17 +587,25 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.0 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (i32.store (tee_local $0 @@ -604,24 +614,24 @@ (get_local $0) (tee_local $0 (block (result i32) - (set_local $4 + (set_local $5 (call $~lib/memory/memory.allocate (i32.const 12) ) ) (i32.store - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=4 - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=8 - (get_local $4) + (get_local $5) (i32.const 0) ) - (get_local $4) + (get_local $5) ) ) ) @@ -638,10 +648,11 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 7 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -664,17 +675,25 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.1 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (i32.store (tee_local $0 @@ -683,24 +702,24 @@ (get_local $0) (tee_local $0 (block (result i32) - (set_local $4 + (set_local $5 (call $~lib/memory/memory.allocate (i32.const 12) ) ) (i32.store - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=4 - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=8 - (get_local $4) + (get_local $5) (i32.const 0) ) - (get_local $4) + (get_local $5) ) ) ) @@ -717,10 +736,11 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 8 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -743,17 +763,25 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.2 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (i32.store (tee_local $0 @@ -762,24 +790,24 @@ (get_local $0) (tee_local $0 (block (result i32) - (set_local $4 + (set_local $5 (call $~lib/memory/memory.allocate (i32.const 12) ) ) (i32.store - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=4 - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=8 - (get_local $4) + (get_local $5) (i32.const 0) ) - (get_local $4) + (get_local $5) ) ) ) @@ -796,10 +824,11 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 9 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -822,17 +851,25 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.3 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (i32.store (tee_local $0 @@ -841,24 +878,24 @@ (get_local $0) (tee_local $0 (block (result i32) - (set_local $4 + (set_local $5 (call $~lib/memory/memory.allocate (i32.const 12) ) ) (i32.store - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=4 - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=8 - (get_local $4) + (get_local $5) (i32.const 0) ) - (get_local $4) + (get_local $5) ) ) ) @@ -875,10 +912,11 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 10 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -901,17 +939,25 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.4 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (i32.store (tee_local $0 @@ -920,24 +966,24 @@ (get_local $0) (tee_local $0 (block (result i32) - (set_local $4 + (set_local $5 (call $~lib/memory/memory.allocate (i32.const 12) ) ) (i32.store - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=4 - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=8 - (get_local $4) + (get_local $5) (i32.const 0) ) - (get_local $4) + (get_local $5) ) ) ) @@ -954,10 +1000,11 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -980,17 +1027,25 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.5 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (i32.store (tee_local $0 @@ -999,24 +1054,24 @@ (get_local $0) (tee_local $0 (block (result i32) - (set_local $4 + (set_local $5 (call $~lib/memory/memory.allocate (i32.const 12) ) ) (i32.store - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=4 - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=8 - (get_local $4) + (get_local $5) (i32.const 0) ) - (get_local $4) + (get_local $5) ) ) ) @@ -1033,10 +1088,11 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 12 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -1059,17 +1115,25 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.6 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (i32.store (tee_local $0 @@ -1078,24 +1142,24 @@ (get_local $0) (tee_local $0 (block (result i32) - (set_local $4 + (set_local $5 (call $~lib/memory/memory.allocate (i32.const 12) ) ) (i32.store - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=4 - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=8 - (get_local $4) + (get_local $5) (i32.const 0) ) - (get_local $4) + (get_local $5) ) ) ) @@ -1112,10 +1176,11 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 13 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -1138,17 +1203,25 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.7 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (i32.store (tee_local $0 @@ -1157,24 +1230,24 @@ (get_local $0) (tee_local $0 (block (result i32) - (set_local $4 + (set_local $5 (call $~lib/memory/memory.allocate (i32.const 12) ) ) (i32.store - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=4 - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=8 - (get_local $4) + (get_local $5) (i32.const 0) ) - (get_local $4) + (get_local $5) ) ) ) @@ -1191,10 +1264,11 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 14 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -1217,17 +1291,25 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.8 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (i32.store (tee_local $0 @@ -1236,24 +1318,24 @@ (get_local $0) (tee_local $0 (block (result i32) - (set_local $4 + (set_local $5 (call $~lib/memory/memory.allocate (i32.const 12) ) ) (i32.store - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=4 - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=8 - (get_local $4) + (get_local $5) (i32.const 0) ) - (get_local $4) + (get_local $5) ) ) ) @@ -1270,10 +1352,11 @@ ) (get_local $0) ) - (func $~lib/internal/typedarray/TypedArray#constructor (; 16 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#constructor (; 15 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) + (local $5 i32) (if (i32.gt_u (get_local $1) @@ -1296,17 +1379,25 @@ ) ) (set_local $3 - (call $~lib/internal/arraybuffer/allocUnsafe + (call $~lib/internal/arraybuffer/allocateUnsafe (get_local $2) ) ) - (call $~lib/memory/memory.fill - (i32.add - (get_local $3) - (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + (block $~lib/memory/memory.fill|inlined.9 + (set_local $4 + (i32.add + (get_local $3) + (get_global $~lib/internal/arraybuffer/HEADER_SIZE) + ) + ) + (set_local $5 + (i32.const 0) + ) + (call $~lib/internal/memory/memset + (get_local $4) + (get_local $5) + (get_local $2) ) - (i32.const 0) - (get_local $2) ) (i32.store (tee_local $0 @@ -1315,24 +1406,24 @@ (get_local $0) (tee_local $0 (block (result i32) - (set_local $4 + (set_local $5 (call $~lib/memory/memory.allocate (i32.const 12) ) ) (i32.store - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=4 - (get_local $4) + (get_local $5) (i32.const 0) ) (i32.store offset=8 - (get_local $4) + (get_local $5) (i32.const 0) ) - (get_local $4) + (get_local $5) ) ) ) @@ -1349,7 +1440,7 @@ ) (get_local $0) ) - (func $std/typedarray/testInstantiate (; 17 ;) (type $iv) (param $0 i32) + (func $std/typedarray/testInstantiate (; 16 ;) (type $iv) (param $0 i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -2198,7 +2289,7 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#__set (; 18 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/typedarray/TypedArray#__set (; 17 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2254,7 +2345,7 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#__get (; 19 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#__get (; 18 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2309,7 +2400,7 @@ ) ) ) - (func $~lib/typedarray/Int32Array#subarray (; 20 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $~lib/typedarray/Int32Array#subarray (; 19 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2415,8 +2506,15 @@ ) ) (set_local $4 - (call $~lib/memory/memory.allocate - (i32.const 12) + (block $~lib/memory/memory.allocate|inlined.1 (result i32) + (set_local $4 + (i32.const 12) + ) + (br $~lib/memory/memory.allocate|inlined.1 + (call $~lib/allocator/arena/__memory_allocate + (get_local $4) + ) + ) ) ) (i32.store @@ -2442,7 +2540,7 @@ (get_local $4) ) ) - (func $~lib/internal/typedarray/TypedArray#__set (; 21 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/internal/typedarray/TypedArray#__set (; 20 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2498,7 +2596,7 @@ ) ) ) - (func $~lib/typedarray/Uint8ClampedArray#__set (; 22 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) + (func $~lib/typedarray/Uint8ClampedArray#__set (; 21 ;) (type $iiiv) (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (call $~lib/internal/typedarray/TypedArray#__set @@ -2529,7 +2627,7 @@ ) ) ) - (func $~lib/internal/typedarray/TypedArray#__get (; 23 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) + (func $~lib/internal/typedarray/TypedArray#__get (; 22 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i32) (local $4 i32) @@ -2584,7 +2682,7 @@ ) ) ) - (func $start (; 24 ;) (type $v) + (func $start (; 23 ;) (type $v) (local $0 i32) (if (i32.eqz diff --git a/tests/compiler/switch.optimized.wat b/tests/compiler/switch.optimized.wat index bc6a3367..0f24a907 100644 --- a/tests/compiler/switch.optimized.wat +++ b/tests/compiler/switch.optimized.wat @@ -7,7 +7,7 @@ (data (i32.const 8) "\t\00\00\00s\00w\00i\00t\00c\00h\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $switch/doSwitch (; 1 ;) (type $ii) (param $0 i32) (result i32) + (func $switch/doSwitch (; 1 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (block $case4|0 (block $case2|0 @@ -49,7 +49,7 @@ ) (i32.const 23) ) - (func $switch/doSwitchDefaultOmitted (; 2 ;) (type $ii) (param $0 i32) (result i32) + (func $switch/doSwitchDefaultOmitted (; 2 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) (block $break|0 (block $case2|0 @@ -86,7 +86,7 @@ ) (i32.const 0) ) - (func $switch/doSwitchBreakCase (; 3 ;) (type $ii) (param $0 i32) (result i32) + (func $switch/doSwitchBreakCase (; 3 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (block $break|0 (br_if $break|0 (i32.eq @@ -100,7 +100,7 @@ ) (i32.const 1) ) - (func $switch/doSwitchBreakDefault (; 4 ;) (type $ii) (param $0 i32) (result i32) + (func $switch/doSwitchBreakDefault (; 4 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (block $break|0 (block $case1|0 (br_if $break|0 @@ -116,7 +116,7 @@ ) (i32.const 2) ) - (func $switch/doSwitchFallThroughCase (; 5 ;) (type $ii) (param $0 i32) (result i32) + (func $switch/doSwitchFallThroughCase (; 5 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (i32.ne (get_local $0) @@ -128,7 +128,7 @@ ) (i32.const 1) ) - (func $switch/doSwitchFallThroughDefault (; 6 ;) (type $ii) (param $0 i32) (result i32) + (func $switch/doSwitchFallThroughDefault (; 6 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (if (i32.eq (get_local $0) @@ -140,10 +140,10 @@ ) (i32.const 2) ) - (func $switch/doSwitchEmpty (; 7 ;) (type $ii) (param $0 i32) (result i32) + (func $switch/doSwitchEmpty (; 7 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (i32.const 2) ) - (func $start (; 8 ;) (type $v) + (func $start (; 8 ;) (; has Stack IR ;) (type $v) (if (call $switch/doSwitch (i32.const 0) diff --git a/tests/compiler/switch.untouched.wat b/tests/compiler/switch.untouched.wat index 08693145..2341b6d2 100644 --- a/tests/compiler/switch.untouched.wat +++ b/tests/compiler/switch.untouched.wat @@ -59,6 +59,7 @@ (i32.const 23) ) ) + (unreachable) ) (func $switch/doSwitchDefaultOmitted (; 2 ;) (type $ii) (param $0 i32) (result i32) (local $1 i32) diff --git a/tests/compiler/ternary.optimized.wat b/tests/compiler/ternary.optimized.wat index 75d1df5d..78da9422 100644 --- a/tests/compiler/ternary.optimized.wat +++ b/tests/compiler/ternary.optimized.wat @@ -4,7 +4,7 @@ (memory $0 0) (export "memory" (memory $0)) (start $start) - (func $start (; 0 ;) (type $v) + (func $start (; 0 ;) (; has Stack IR ;) (type $v) (set_global $ternary/a (i32.const 1) ) diff --git a/tests/compiler/typealias.optimized.wat b/tests/compiler/typealias.optimized.wat index ea87f3f8..3d5784e2 100644 --- a/tests/compiler/typealias.optimized.wat +++ b/tests/compiler/typealias.optimized.wat @@ -3,7 +3,7 @@ (memory $0 0) (export "memory" (memory $0)) (export "alias" (func $typealias/alias)) - (func $typealias/alias (; 0 ;) (type $ii) (param $0 i32) (result i32) + (func $typealias/alias (; 0 ;) (; has Stack IR ;) (type $ii) (param $0 i32) (result i32) (get_local $0) ) ) diff --git a/tests/compiler/unary.optimized.wat b/tests/compiler/unary.optimized.wat index b5486e4e..cabba720 100644 --- a/tests/compiler/unary.optimized.wat +++ b/tests/compiler/unary.optimized.wat @@ -7,7 +7,7 @@ (memory $0 0) (export "memory" (memory $0)) (start $start) - (func $start (; 0 ;) (type $v) + (func $start (; 0 ;) (; has Stack IR ;) (type $v) (local $0 i32) (local $1 i64) (local $2 f32) diff --git a/tests/compiler/void.optimized.wat b/tests/compiler/void.optimized.wat index 3d76d99e..f3bad575 100644 --- a/tests/compiler/void.optimized.wat +++ b/tests/compiler/void.optimized.wat @@ -4,10 +4,10 @@ (memory $0 0) (export "memory" (memory $0)) (start $start) - (func $void/anInt (; 0 ;) (type $i) (result i32) + (func $void/anInt (; 0 ;) (; has Stack IR ;) (type $i) (result i32) (i32.const 2) ) - (func $start (; 1 ;) (type $v) + (func $start (; 1 ;) (; has Stack IR ;) (type $v) (drop (call $void/anInt) ) diff --git a/tests/compiler/while.optimized.wat b/tests/compiler/while.optimized.wat index 812e75f1..57e89b2c 100644 --- a/tests/compiler/while.optimized.wat +++ b/tests/compiler/while.optimized.wat @@ -9,7 +9,7 @@ (data (i32.const 8) "\08\00\00\00w\00h\00i\00l\00e\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $start (; 1 ;) (type $v) + (func $start (; 1 ;) (; has Stack IR ;) (type $v) (local $0 i32) (loop $continue|0 (if