From fcffc40603e2c97ffa75ceccd6a764faea48165e Mon Sep 17 00:00:00 2001 From: Agustin Mendez Date: Wed, 5 Aug 2020 12:48:49 -0300 Subject: [PATCH] fix: broken dependencies (#65) * fix broken dependencies * revert ebnf upgrade * revert grammar changes * revert grammar changes --- package-lock.json | 366 ++++++++++++------ package.json | 30 +- src/compiler/phases/canonicalPhase.ts | 56 +-- src/compiler/phases/codeGenerationPhase.ts | 6 +- src/grammar.ts | 2 +- test/Canonical.spec.ts | 2 +- test/Parser.spec.ts | 31 +- test/Semantic.spec.ts | 28 +- test/TestHelpers.ts | 6 +- test/fixtures/cli/smoke/main.lys | 2 +- .../compiler/0-struct.lys.optimized.wast | 52 +-- .../compiler/0-wast.lys.optimized.wast | 40 +- .../compiler/1-wast-sha3.lys.optimized.wast | 76 ++-- test/fixtures/compiler/a.lys.optimized.wast | 42 +- test/fixtures/compiler/b.lys.optimized.wast | 32 +- .../compiler/booleanLogic.lys.optimized.wast | 32 +- .../compiler/bytes.lys.optimized.wast | 42 +- test/fixtures/compiler/c.lys.optimized.wast | 32 +- .../compiler/deconstruct.lys.optimized.wast | 32 +- .../dynamicLhsMatch.lys.optimized.wast | 32 +- .../compiler/emptyFn.lys.optimized.wast | 32 +- .../compiler/extern.lys.optimized.wast | 32 +- .../fixtures/compiler/fib1.lys.optimized.wast | 34 +- .../fixtures/compiler/fib2.lys.optimized.wast | 36 +- .../fixtures/compiler/fib3.lys.optimized.wast | 36 +- .../compiler/getter.lys.optimized.wast | 32 +- .../globalMutability.lys.optimized.wast | 48 +-- test/fixtures/compiler/if.lys.optimized.wast | 36 +- test/fixtures/compiler/if2.lys.optimized.wast | 34 +- .../compiler/infix.lys.optimized.wast | 34 +- test/fixtures/compiler/is.lys.optimized.wast | 46 +-- .../compiler/iterator-loco.lys.optimized.wast | 48 +-- .../compiler/loops.lys.optimized.wast | 34 +- .../compiler/mutability.lys.optimized.wast | 34 +- test/fixtures/compiler/nop.lys.optimized.wast | 32 +- .../compiler/panic-match.lys.optimized.wast | 32 +- .../patternMatchinIs.lys.optimized.wast | 96 ++--- .../patternMatching.lys.optimized.wast | 48 +-- .../execution/fibo.lys.optimized.wast | 50 +-- .../execution/implicitCast.lys.optimized.wast | 42 +- .../indirect-smoke.lys.optimized.wast | 46 +-- test/fixtures/execution/is.lys.optimized.wast | 90 ++--- .../isPatternMatching.lys.optimized.wast | 92 ++--- ...PatternMatchingVariable.lys.optimized.wast | 68 ++-- .../execution/numberOps.lys.optimized.wast | 42 +- ...ternMatchingDeconstruct.lys.optimized.wast | 54 +-- .../recursiveStruct.lys.optimized.wast | 56 ++- .../setStructValues.lys.optimized.wast | 112 +++--- .../simpleIterator.lys.optimized.wast | 60 ++- .../execution/strConcat.lys.optimized.wast | 128 +++--- .../stringifyNumbers.lys.optimized.wast | 120 +++--- .../structValuesExtended.lys.optimized.wast | 56 ++- .../execution/traverseTree.lys.optimized.wast | 52 +-- test/fixtures/parser-error/j.lys.txt | 4 +- 54 files changed, 1008 insertions(+), 1729 deletions(-) diff --git a/package-lock.json b/package-lock.json index 110f3b9d..06088864 100644 --- a/package-lock.json +++ b/package-lock.json @@ -189,15 +189,9 @@ } }, "@types/chai": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.6.tgz", - "integrity": "sha512-HF8faEUA4JurIm+68VaA2KedtZf5LYdXpQEAbIAN79DwWQbO82BNTksZgCH3UMqbZHXex9C6TrBfg7OUInRISQ==", - "dev": true - }, - "@types/events": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", - "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==", + "version": "4.2.12", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.12.tgz", + "integrity": "sha512-aN5IAC8QNtSUdQzxu7lGBgYAOuU1tmRU4c9dIq5OKGf/SBVjXo+ffM2wEjudAWbgpOhy60nLoAGH1xm8fpCKFQ==", "dev": true }, "@types/git-rev-sync": { @@ -207,12 +201,11 @@ "dev": true }, "@types/glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz", - "integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==", + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==", "dev": true, "requires": { - "@types/events": "*", "@types/minimatch": "*", "@types/node": "*" } @@ -249,24 +242,25 @@ "dev": true }, "@types/node": { - "version": "12.12.16", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.16.tgz", - "integrity": "sha512-vRuMyoOr5yfNf8QWxXegOjeyjpWJxFePzHzmBOIzDIzo+rSqF94RW0PkS6y4T2+VjAWLXHWrfbIJY3E3aS7lUw==", + "version": "12.12.53", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.53.tgz", + "integrity": "sha512-51MYTDTyCziHb70wtGNFRwB4l+5JNvdqzFSkbDvpbftEgVUBEE+T5f7pROhWMp/fxp07oNIEQZd5bbfAH22ohQ==", "dev": true }, "@types/node-fetch": { - "version": "2.5.4", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.4.tgz", - "integrity": "sha512-Oz6id++2qAOFuOlE1j0ouk1dzl3mmI1+qINPNBhi9nt/gVOz0G+13Ao6qjhdF0Ys+eOkhu6JnFmt38bR3H0POQ==", + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.7.tgz", + "integrity": "sha512-o2WVNf5UhWRkxlf6eq+jMZDu7kjgpgJfl4xVNlvryc95O/6F2ld8ztKX+qu+Rjyet93WAWm5LjeX9H5FGkODvw==", "dev": true, "requires": { - "@types/node": "*" + "@types/node": "*", + "form-data": "^3.0.0" } }, "@types/semver": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-6.2.0.tgz", - "integrity": "sha512-1OzrNb4RuAzIT7wHSsgZRlMBlNsJl+do6UblR7JMW4oB7bbR+uBEYtUh7gEc/jM84GGilh68lSOokyM/zNUlBA==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-6.2.1.tgz", + "integrity": "sha512-+beqKQOh9PYxuHvijhVl+tIHvT6tuwOrE9m14zd+MT2A38KoKZhh7pYJ0SNleLtwDsiIxHDsIk9bv01oOxvSvA==", "dev": true }, "@types/stack-utils": { @@ -414,9 +408,9 @@ "dev": true }, "arg": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.2.tgz", - "integrity": "sha512-+ytCkGcBtHZ3V2r2Z06AncYO8jz46UEamcspGoU8lHcEbpn6J77QK0vdWvChsclg/tM5XIJC5tnjmPp7Eq6Obg==" + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==" }, "argparse": { "version": "1.0.10", @@ -469,6 +463,12 @@ "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", "dev": true }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, "atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", @@ -537,9 +537,9 @@ } }, "binaryen": { - "version": "91.0.0", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-91.0.0.tgz", - "integrity": "sha512-IPeiSHceT5/VXOQ9W4f9k/ryoA1QGdCvpeyFPKsIZQvctN8e1xgvVFK5HHxgfAPf2gWy+plrFdJK5xSe4W8cFQ==" + "version": "95.0.0", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-95.0.0.tgz", + "integrity": "sha512-W6ZyhcE1fm+89NddaNmdsc8UBer28CxOoJUp5GXRxkOqXr6nml3qDD/b+WKmqDA0KSUJHLMtpjc0rYJ3J3U0kw==" }, "brace-expansion": { "version": "1.1.11", @@ -772,6 +772,15 @@ "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", @@ -957,6 +966,12 @@ } } }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", @@ -994,9 +1009,9 @@ } }, "ebnf": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/ebnf/-/ebnf-1.8.0.tgz", - "integrity": "sha512-1MdC+ct8nu4lMZQ89Y8zGR6Eeh+dYF/aiGDlMCKJhRCWbZbOixrx/QIbeVgFeRx9JlJP0AoUfQ5iP9tIGyZwTw==", + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/ebnf/-/ebnf-1.7.4.tgz", + "integrity": "sha512-KE+ZeeBHZMHZGJ2wW33MwsJAvkmBMbpo4ee+ApAqrvadaaAvVAP5Hgt7xw8fVieUgQbHi151XmdIYASXSdzDiQ==", "requires": { "colors": "^1.4.0" } @@ -1026,21 +1041,22 @@ } }, "es-abstract": { - "version": "1.16.3", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.16.3.tgz", - "integrity": "sha512-WtY7Fx5LiOnSYgF5eg/1T+GONaGmpvpPdCpSnYij+U2gDTL0UPfWrhDw7b2IYb+9NQJsYpCA0wOQvZfsd6YwRw==", + "version": "1.17.6", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.6.tgz", + "integrity": "sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw==", "dev": true, "requires": { "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.1", - "is-callable": "^1.1.4", - "is-regex": "^1.0.4", + "is-callable": "^1.2.0", + "is-regex": "^1.1.0", "object-inspect": "^1.7.0", "object-keys": "^1.1.1", - "string.prototype.trimleft": "^2.1.0", - "string.prototype.trimright": "^2.1.0" + "object.assign": "^4.1.0", + "string.prototype.trimend": "^1.0.1", + "string.prototype.trimstart": "^1.0.1" } }, "es-to-primitive": { @@ -1341,6 +1357,17 @@ } } }, + "form-data": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", + "integrity": "sha512-CKMFDglpbMi6PyN+brwB9Q/GOw0eAnsrEZDgcsH5Krhz5Od/haKHAX0NmQfha2zPPz0JpWzA7GJHGSnvCRLWsg==", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -1601,9 +1628,9 @@ "dev": true }, "is-callable": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.0.tgz", + "integrity": "sha512-pyVD9AaGLxtg6srb2Ng6ynWJqkHU9bEM087AKck0w8QwDarTfNcpIYoU8x8Hv2Icm8u6kFJM18Dag8lyqGkviw==", "dev": true }, "is-data-descriptor": { @@ -1627,9 +1654,9 @@ } }, "is-date-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", + "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", "dev": true }, "is-descriptor": { @@ -1693,12 +1720,12 @@ } }, "is-regex": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", - "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.1.tgz", + "integrity": "sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg==", "dev": true, "requires": { - "has": "^1.0.1" + "has-symbols": "^1.0.1" } }, "is-stream": { @@ -2103,14 +2130,14 @@ } }, "md5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz", - "integrity": "sha1-U6s41f48iJG6RlMp6iP6wFQBJvk=", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", "dev": true, "requires": { - "charenc": "~0.0.1", - "crypt": "~0.0.1", - "is-buffer": "~1.1.1" + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" } }, "mem": { @@ -2168,6 +2195,21 @@ "to-regex": "^3.0.2" } }, + "mime-db": { + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==", + "dev": true + }, + "mime-types": { + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", + "dev": true, + "requires": { + "mime-db": "1.44.0" + } + }, "mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", @@ -2228,9 +2270,9 @@ } }, "mocha": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.2.tgz", - "integrity": "sha512-FgDS9Re79yU1xz5d+C4rv1G7QagNGHZ+iXF81hO8zY35YZZcLEsJVfFolfsqKFWunATEvNzMK0r/CwWd/szO9A==", + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-6.2.3.tgz", + "integrity": "sha512-0R/3FvjIGH3eEuG17ccFPk117XL2rWxatr81a57D+r/x2uTYZRbdZ4oVidEUMh2W2TJDa7MdAb12Lm2/qrKajg==", "dev": true, "requires": { "ansi-colors": "3.2.3", @@ -2245,7 +2287,7 @@ "js-yaml": "3.13.1", "log-symbols": "2.2.0", "minimatch": "3.0.4", - "mkdirp": "0.5.1", + "mkdirp": "0.5.4", "ms": "2.1.1", "node-environment-flags": "1.0.5", "object.assign": "4.1.0", @@ -2253,8 +2295,8 @@ "supports-color": "6.0.0", "which": "1.3.1", "wide-align": "1.1.3", - "yargs": "13.3.0", - "yargs-parser": "13.1.1", + "yargs": "13.3.2", + "yargs-parser": "13.1.2", "yargs-unparser": "1.6.0" }, "dependencies": { @@ -2298,6 +2340,21 @@ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "mkdirp": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz", + "integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, "ms": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", @@ -2354,9 +2411,9 @@ } }, "yargs": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", - "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", "dev": true, "requires": { "cliui": "^5.0.0", @@ -2368,13 +2425,13 @@ "string-width": "^3.0.0", "which-module": "^2.0.0", "y18n": "^4.0.0", - "yargs-parser": "^13.1.1" + "yargs-parser": "^13.1.2" } }, "yargs-parser": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", - "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", "dev": true, "requires": { "camelcase": "^5.0.0", @@ -2384,9 +2441,9 @@ } }, "mocha-junit-reporter": { - "version": "1.23.1", - "resolved": "https://registry.npmjs.org/mocha-junit-reporter/-/mocha-junit-reporter-1.23.1.tgz", - "integrity": "sha512-qeDvKlZyAH2YJE1vhryvjUQ06t2hcnwwu4k5Ddwn0GQINhgEYFhlGM0DwYCVUHq5cuo32qAW6HDsTHt7zz99Ng==", + "version": "1.23.3", + "resolved": "https://registry.npmjs.org/mocha-junit-reporter/-/mocha-junit-reporter-1.23.3.tgz", + "integrity": "sha512-ed8LqbRj1RxZfjt/oC9t12sfrWsjZ3gNnbhV1nuj9R/Jb5/P3Xb4duv2eCfCDMYH+fEu0mqca7m4wsiVjsxsvA==", "dev": true, "requires": { "debug": "^2.2.0", @@ -2596,9 +2653,9 @@ } }, "object-inspect": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz", - "integrity": "sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.8.0.tgz", + "integrity": "sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA==", "dev": true }, "object-keys": { @@ -2629,13 +2686,13 @@ } }, "object.getownpropertydescriptors": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", - "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz", + "integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==", "dev": true, "requires": { - "define-properties": "^1.1.2", - "es-abstract": "^1.5.1" + "define-properties": "^1.1.3", + "es-abstract": "^1.17.0-next.1" } }, "object.pick": { @@ -3214,9 +3271,9 @@ } }, "source-map-support": { - "version": "0.5.16", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz", - "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==", + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", "dev": true, "requires": { "buffer-from": "^1.0.0", @@ -3341,24 +3398,24 @@ "strip-ansi": "^4.0.0" } }, - "string.prototype.trimleft": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz", - "integrity": "sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw==", + "string.prototype.trimend": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz", + "integrity": "sha512-LRPxFUaTtpqYsTeNKaFOw3R4bxIzWOnbQ837QfBylo8jIxtcbK/A/sMV7Q+OAV/vWo+7s25pOE10KYSjaSO06g==", "dev": true, "requires": { "define-properties": "^1.1.3", - "function-bind": "^1.1.1" + "es-abstract": "^1.17.5" } }, - "string.prototype.trimright": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz", - "integrity": "sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg==", + "string.prototype.trimstart": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz", + "integrity": "sha512-XxZn+QpvrBI1FOcg6dIpxUPgWCPuNXvMD72aaRaUQv1eD4e/Qy8i/hFTe0BUmD60p/QA6bh1avmuPTfNjqVWRw==", "dev": true, "requires": { "define-properties": "^1.1.3", - "function-bind": "^1.1.1" + "es-abstract": "^1.17.5" } }, "strip-ansi": { @@ -3472,15 +3529,15 @@ "dev": true }, "ts-node": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.7.0.tgz", - "integrity": "sha512-s659CsHrsxaRVDEleuOkGvbsA0rWHtszUNEt1r0CgAFN5ZZTQtDzpsluS7W5pOGJIa1xZE8R/zK4dEs+ldFezg==", + "version": "8.10.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", + "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", "dev": true, "requires": { "arg": "^4.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", - "source-map-support": "^0.5.6", + "source-map-support": "^0.5.17", "yn": "3.1.1" }, "dependencies": { @@ -3499,9 +3556,9 @@ "dev": true }, "tslint": { - "version": "5.20.1", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", - "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.3.tgz", + "integrity": "sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", @@ -3512,23 +3569,38 @@ "glob": "^7.1.1", "js-yaml": "^3.13.1", "minimatch": "^3.0.4", - "mkdirp": "^0.5.1", + "mkdirp": "^0.5.3", "resolve": "^1.3.2", "semver": "^5.3.0", - "tslib": "^1.8.0", + "tslib": "^1.13.0", "tsutils": "^2.29.0" }, "dependencies": { "diff": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", - "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, "resolve": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.13.1.tgz", - "integrity": "sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w==", + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", "dev": true, "requires": { "path-parse": "^1.0.6" @@ -3539,6 +3611,12 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "dev": true + }, + "tslib": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", + "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", + "dev": true } } }, @@ -3617,6 +3695,48 @@ "integrity": "sha512-tGVTbA+i3qfXsLbq9rEq/hezaHY55QxQLeXQL2ejNgFAxxrgu8eMmYIOsRcl7hN1uTLVsKOOYacV/rcJM3sfgQ==", "dev": true }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "tslint": { + "version": "5.20.1", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz", + "integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", + "glob": "^7.1.1", + "js-yaml": "^3.13.1", + "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", + "resolve": "^1.3.2", + "semver": "^5.3.0", + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + } + }, "typescript": { "version": "2.9.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", @@ -3650,9 +3770,9 @@ "dev": true }, "typescript": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz", - "integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==", + "version": "3.9.7", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", + "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", "dev": true }, "uglify-js": { @@ -3768,9 +3888,9 @@ } }, "wabt": { - "version": "1.0.13", - "resolved": "https://registry.npmjs.org/wabt/-/wabt-1.0.13.tgz", - "integrity": "sha512-nkWPyUjYt+SqPox2mjJF5jrpWv30awdXKdG0OmryzfhtahHBrPz/BGSbakPgcJU2SFjC1s7Mb8MadRhQ6lmqUg==" + "version": "1.0.19", + "resolved": "https://registry.npmjs.org/wabt/-/wabt-1.0.19.tgz", + "integrity": "sha512-z/7XRZB8tPRW0XdE8HYbA95w2kjus5AwOHnJ5NT9PqzaNZ7z/zHnUdpNdB78TFMgWt+D/u01lg1jG6nWiFmyEw==" }, "which": { "version": "1.3.0", @@ -3958,9 +4078,9 @@ } }, "lodash": { - "version": "4.17.15", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", - "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", "dev": true }, "string-width": { @@ -3995,9 +4115,9 @@ } }, "yargs": { - "version": "13.3.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.0.tgz", - "integrity": "sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA==", + "version": "13.3.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-13.3.2.tgz", + "integrity": "sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw==", "dev": true, "requires": { "cliui": "^5.0.0", @@ -4009,13 +4129,13 @@ "string-width": "^3.0.0", "which-module": "^2.0.0", "y18n": "^4.0.0", - "yargs-parser": "^13.1.1" + "yargs-parser": "^13.1.2" } }, "yargs-parser": { - "version": "13.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz", - "integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==", + "version": "13.1.2", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz", + "integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==", "dev": true, "requires": { "camelcase": "^5.0.0", diff --git a/package.json b/package.json index 2b77d3f1..79d18db3 100644 --- a/package.json +++ b/package.json @@ -30,36 +30,36 @@ "dependencies": { "@webassemblyjs/ast": "^1.9.0", "@webassemblyjs/wast-printer": "^1.9.0", - "arg": "^4.1.2", - "binaryen": "^91.0.0", - "ebnf": "^1.8.0", + "arg": "^4.1.3", + "binaryen": "^95.0.0", + "ebnf": "^1.7.4", "utf8-bytes": "0.0.1", - "wabt": "^1.0.13" + "wabt": "^1.0.19" }, "devDependencies": { - "@types/chai": "^4.2.6", + "@types/chai": "^4.2.12", "@types/git-rev-sync": "^1.12.0", - "@types/glob": "^7.1.1", - "@types/node": "^12.12.16", - "@types/node-fetch": "^2.5.4", - "@types/semver": "^6.2.0", + "@types/glob": "^7.1.3", + "@types/node": "^12.12.53", + "@types/node-fetch": "^2.5.7", + "@types/semver": "^6.2.1", "chai": "^4.2.0", "dcl-tslint-config-standard": "^1.1.0", "expect": "^24.9.0", "git-rev-sync": "^1.12.0", "glob": "^7.1.6", "istanbul": "^0.4.5", - "mocha": "^6.2.2", - "mocha-junit-reporter": "^1.23.1", + "mocha": "^6.2.3", + "mocha-junit-reporter": "^1.23.3", "mocha-performance": "^0.1.1", "node-fetch": "^2.6.0", "nyc": "^14.1.1", "semver": "^6.3.0", - "source-map-support": "^0.5.16", - "ts-node": "^8.7.0", - "tslint": "^5.20.1", + "source-map-support": "^0.5.19", + "ts-node": "^8.10.2", + "tslint": "^6.1.3", "tslint-language-service": "^0.9.9", - "typescript": "^3.8.3" + "typescript": "^3.9.7" }, "nyc": { "extension": [ diff --git a/src/compiler/phases/canonicalPhase.ts b/src/compiler/phases/canonicalPhase.ts index e3e13a84..e0f1b46e 100644 --- a/src/compiler/phases/canonicalPhase.ts +++ b/src/compiler/phases/canonicalPhase.ts @@ -112,7 +112,7 @@ const visitor = { return ret; }, ImplDirective(astNode: Nodes.ASTNode) { - const references = astNode.children.filter($ => $.type === 'Reference'); + const references = astNode.children.filter(($) => $.type === 'Reference'); // the last Reference is the target const target = visit(references.pop()!); @@ -141,7 +141,7 @@ const visitor = { const list = findChildrenType(astNode, 'EffectElementList'); if (list) { - ret.elements = list.children.map($ => visit($)); + ret.elements = list.children.map(($) => visit($)); } else { // TODO: warn } @@ -159,7 +159,7 @@ const visitor = { throw new PositionCapableError('Missing param list in function declaration', astNode); } - ret.parameters = params.children.map($ => visit($)); + ret.parameters = params.children.map(($) => visit($)); return ret; }, @@ -232,7 +232,7 @@ const visitor = { const typeDeclElements = findChildrenType(astNode, 'TypeDeclElements'); - const declarations = typeDeclElements ? typeDeclElements.children.map($ => visit($)) : []; + const declarations = typeDeclElements ? typeDeclElements.children.map(($) => visit($)) : []; const ret = new Nodes.EnumDirectiveNode(astNode, variableName, declarations); ret.isPublic = isPublic; @@ -254,9 +254,9 @@ const visitor = { const typeDeclElements = findChildrenType(astNode, 'TraitDeclElements'); - const declarations = typeDeclElements ? typeDeclElements.children.map($ => visit($)) : []; + const declarations = typeDeclElements ? typeDeclElements.children.map(($) => visit($)) : []; - declarations.forEach($ => { + declarations.forEach(($) => { if ($ instanceof Nodes.FunDirectiveNode && !$.functionNode.body) { $.functionNode.annotate(new annotations.SignatureDeclaration()); } @@ -287,7 +287,7 @@ const visitor = { throw new PositionCapableError('Missing param list in function declaration', astNode); } - fun.parameters = params.children.map($ => visit($)); + fun.parameters = params.children.map(($) => visit($)); const body = findChildrenType(astNode, 'FunAssignExpression'); @@ -325,7 +325,7 @@ const visitor = { return ret; }, CodeBlock(astNode: Nodes.ASTNode) { - const statements = astNode.children.map($ => visit($)).filter($ => !!$); + const statements = astNode.children.map(($) => visit($)).filter(($) => !!$); return new Nodes.BlockNode(astNode, statements); }, Parameter(astNode: Nodes.ASTNode) { @@ -368,7 +368,7 @@ const visitor = { const doesItHaveMemberExpression = currentNode && currentNode.type === 'MemberExpression'; if (doesItHaveCallArguments) { - const argumentsNode = currentNode.children.map($ => visit($)); + const argumentsNode = currentNode.children.map(($) => visit($)); const fnCall = new Nodes.FunctionCallNode(currentNode, ret, argumentsNode); fnCall.isInfix = true; ret = fnCall; @@ -394,7 +394,7 @@ const visitor = { }, MatchExpression(astNode: Nodes.ASTNode) { const lhs = visit(astNode.children[0]); - const matchingSet = astNode.children[1].children.map($ => visit($)); + const matchingSet = astNode.children[1].children.map(($) => visit($)); return new Nodes.PatternMatcherNode(astNode, lhs, matchingSet); }, @@ -422,7 +422,7 @@ const visitor = { FunctionTypeLiteral(child: Nodes.ASTNode) { const parametersNode = findChildrenType(child, 'FunctionTypeParameters'); - const ret = new Nodes.FunctionTypeNode(child, parametersNode ? parametersNode.children.map($ => visit($)) : []); + const ret = new Nodes.FunctionTypeNode(child, parametersNode ? parametersNode.children.map(($) => visit($)) : []); ret.returnType = visitChildTypeOrNull(child, 'Type') as Nodes.TypeNode; @@ -458,7 +458,7 @@ const visitor = { const deconstruct = findChildrenType(x, 'DeconstructStruct'); if (deconstruct) { - ret.deconstructorNames = deconstruct.children.map($ => visit($)); + ret.deconstructorNames = deconstruct.children.map(($) => visit($)); } return ret; @@ -509,9 +509,15 @@ const visitor = { return new Nodes.HexLiteral(x, typeName); }, StringLiteral(x: Nodes.ASTNode) { - const ret = new Nodes.StringLiteral(x, 'string'); - ret.value = JSON.parse(x.text); - return ret; + try { + const ret = new Nodes.StringLiteral(x, 'string'); + ret.value = JSON.parse(x.text); + return ret; + } catch (e) { + const err = 'Cannot parse string: ' + x.text; + console.log(err); + return new PositionCapableError(err, x); + } }, BinNegExpression(x: Nodes.ASTNode) { return new Nodes.UnaryExpressionNode(x, Nodes.NameIdentifierNode.fromString('~', x), visit(x.children[0])); @@ -527,7 +533,7 @@ const visitor = { }, Document(astNode: Nodes.ASTNode) { const doc = new Nodes.DocumentNode(astNode); - astNode.children.forEach($ => doc.directives.push(visit($))); + astNode.children.forEach(($) => doc.directives.push(visit($))); return doc; }, @@ -566,7 +572,7 @@ const visitor = { }, StructLiteral(astNode: Nodes.ASTNode) { const parametersNode = findChildrenTypeOrFail(astNode, 'StructParamsList'); - const parameters = parametersNode.children.filter($ => $.type === 'Parameter').map($ => visit($)); + const parameters = parametersNode.children.filter(($) => $.type === 'Parameter').map(($) => visit($)); return new Nodes.StructTypeNode(astNode, parameters); }, StackLiteral(astNode: Nodes.ASTNode) { @@ -588,16 +594,16 @@ const visitor = { const params = findChildrenType(astNode, 'FunctionParamsList'); - return new Nodes.StructDeclarationNode(astNode, declaredName, params ? params.children.map($ => visit($)) : []); + return new Nodes.StructDeclarationNode(astNode, declaredName, params ? params.children.map(($) => visit($)) : []); }, UnionType(astNode: Nodes.ASTNode) { const ret = new Nodes.UnionTypeNode(astNode); - ret.of = astNode.children.map($ => visit($)); + ret.of = astNode.children.map(($) => visit($)); return ret; }, IntersectionType(astNode: Nodes.ASTNode) { const ret = new Nodes.IntersectionTypeNode(astNode); - ret.of = astNode.children.map($ => visit($)); + ret.of = astNode.children.map(($) => visit($)); return ret; }, TypeParen(astNode: Nodes.ASTNode) { @@ -606,14 +612,14 @@ const visitor = { return ret; }, WasmExpression(astNode: Nodes.ASTNode) { - const atoms = astNode.children.map($ => visit($)); + const atoms = astNode.children.map(($) => visit($)); return new Nodes.WasmExpressionNode(astNode, atoms); }, SExpression(astNode: Nodes.ASTNode) { const children = astNode.children.slice(); const symbol = children.shift() as any; - const newChildren = children.map($ => visit($) as Nodes.ExpressionNode); + const newChildren = children.map(($) => visit($) as Nodes.ExpressionNode); const ret = new Nodes.WasmAtomNode(astNode, symbol.text, newChildren); @@ -639,7 +645,7 @@ const visitor = { } return ret; - } + }, }; function visit(astNode: Nodes.ASTNode): T & any { @@ -661,13 +667,13 @@ function visit(astNode: Nodes.ASTNode): T & any { } function findChildrenTypeOrFail(token: Nodes.ASTNode, type: string, message?: string) { - const ret = token.children.find($ => $.type === type); + const ret = token.children.find(($) => $.type === type); if (!ret) throw new PositionCapableError(message || `Cannot find child node of type ${type}`, token); return ret; } function findChildrenType(token: Nodes.ASTNode, type: string) { - return token.children.find($ => $.type === type); + return token.children.find(($) => $.type === type); } function visitChildTypeOrNull(token: Nodes.ASTNode, type: string) { diff --git a/src/compiler/phases/codeGenerationPhase.ts b/src/compiler/phases/codeGenerationPhase.ts index 521cdd6d..c2a4f7d1 100644 --- a/src/compiler/phases/codeGenerationPhase.ts +++ b/src/compiler/phases/codeGenerationPhase.ts @@ -542,11 +542,11 @@ export class CodeGenerationPhaseResult { }> { let text = print(this.programAST); - await wabt.ready; - let wabtModule: ReturnType; + const theWabt = await wabt; + let wabtModule: ReturnType; try { - wabtModule = wabt.parseWat(this.document.moduleName, text, {}); + wabtModule = theWabt.parseWat(this.document.moduleName, text, {}); } catch (e) { const invalidFile = this.parsingContext.system.resolvePath(this.parsingContext.system.getCurrentDirectory(), 'failed_debug_wat.wat') this.parsingContext.system.writeFile(invalidFile, text) diff --git a/src/grammar.ts b/src/grammar.ts index 5ec37586..cffdf210 100644 --- a/src/grammar.ts +++ b/src/grammar.ts @@ -183,7 +183,7 @@ PostfixNumber ::= (HexLiteral | NumberLiteral) Reference? {pin=1,simplifyWhe NumberLiteral ::= !('0x') ("0" | [1-9] [0-9]*) ("." [0-9]+)? (("e" | "E") ( "-" | "+" )? ("0" | [1-9] [0-9]*))? {pin=2} NegNumberLiteral ::= '-'? NumberLiteral {pin=2} HexLiteral ::= "0x" [0-9A-Fa-f]+ {pin=1} -StringLiteral ::= STRING_DELIMITER ((![\\\\"] [#x20-#xFFFF])* | ('\\\\' (STRING_DELIMITER | '\\\\' | '/' | 'b' | 'f' | 'n' | 'r' | 't' | 'u' HEXDIG HEXDIG HEXDIG HEXDIG)?))* STRING_DELIMITER +StringLiteral ::= STRING_DELIMITER ((![\\\\"] [#x20-#xFFFF])* | ('\\' (STRING_DELIMITER | '\\' | '/' | 'b' | 'f' | 'n' | 'r' | 't' | 'u' HEXDIG HEXDIG HEXDIG HEXDIG)?))* STRING_DELIMITER {pin=1} Literal ::= StringLiteral | PostfixNumber | BooleanLiteral {fragment=true} diff --git a/test/Canonical.spec.ts b/test/Canonical.spec.ts index 76a0e84c..23bf45d7 100644 --- a/test/Canonical.spec.ts +++ b/test/Canonical.spec.ts @@ -59,7 +59,7 @@ describe('Canonical', function() { // add the last literal result += literals[literals.length - 1]; - testParseToken(result, getFileName(), 'Document', async () => void 0, phases); + testParseToken(result, getFileName(), async () => void 0, phases); } test`var a = 1`; diff --git a/test/Parser.spec.ts b/test/Parser.spec.ts index be99c23b..9cbe57b3 100644 --- a/test/Parser.spec.ts +++ b/test/Parser.spec.ts @@ -8,7 +8,7 @@ import { nodeSystem } from '../dist/support/NodeSystem'; import { printErrors } from '../dist/utils/errorPrinter'; describe('Parser', () => { - const phases = function(txt: string, fileName: string) { + const phases = function (txt: string, fileName: string) { const parsingContext = new ParsingContext(nodeSystem); parsingContext.paths.push(nodeSystem.resolvePath(__dirname, '../stdlib')); @@ -18,7 +18,7 @@ describe('Parser', () => { return { document: parsingContext.getParsingPhaseForContent(fileName, moduleName, txt), - parsingContext + parsingContext, }; }; describe('Failing examples', () => { @@ -46,7 +46,7 @@ describe('Parser', () => { return `tests/parser_tests_${testCount++}.lys`; } - describe('Basic sanity tests', function() { + describe('Basic sanity tests', function () { function test(literals: any, ...placeholders: any[]) { let result = ''; @@ -58,7 +58,7 @@ describe('Parser', () => { // add the last literal result += literals[literals.length - 1]; - testParseToken(result, getFileName(), 'Document', async () => void 0, phases); + testParseToken(result, getFileName(),async () => void 0, phases); } function testEquivalence(a: string, b: string) { @@ -67,7 +67,6 @@ describe('Parser', () => { testParseToken( a, getFileName(), - 'Document', async (doc, err) => { if (err) throw err; if (!doc) throw new Error('No result'); @@ -78,7 +77,6 @@ describe('Parser', () => { testParseToken( b, getFileName(), - 'Document', async (doc, err) => { if (err) throw err; if (!doc) throw new Error('No result'); @@ -675,6 +673,25 @@ describe('Parser', () => { }); describe('Literals', () => { + function testLiteral(text: string) { + testParseToken( + 'var a = ' + text, + getFileName(), + async (result, e) => { + if (e) throw e; + if (!result) throw new Error('No result'); + }, + phases + ); + } + + testLiteral(JSON.stringify('\\')); + testLiteral(JSON.stringify('\"')); + testLiteral(JSON.stringify('A string')); + testLiteral(JSON.stringify('A string')); + testLiteral(JSON.stringify("asdasd`\"`'''`\\\"")); + testLiteral(JSON.stringify(213422342344234)); + test` var a = 1 var b = 2.0 @@ -687,7 +704,7 @@ describe('Parser', () => { test` fun x(): string = "\\"'\`\\\\" - ` + `; // test` // fun x(): string = "// a comment inside a string" diff --git a/test/Semantic.spec.ts b/test/Semantic.spec.ts index 4210a551..ed90c240 100644 --- a/test/Semantic.spec.ts +++ b/test/Semantic.spec.ts @@ -11,8 +11,8 @@ import { nodeSystem } from '../dist/support/NodeSystem'; const parsingContext = new ParsingContext(nodeSystem); parsingContext.paths.push(nodeSystem.resolvePath(__dirname, '../stdlib')); -describe('Semantic', function() { - const semanticPhases = function(txt: string, fileName: string): PhasesResult { +describe('Semantic', function () { + const semanticPhases = function (txt: string, fileName: string): PhasesResult { parsingContext.reset(); const moduleName = parsingContext.getModuleFQNForFile(fileName); parsingContext.invalidateModule(moduleName); @@ -20,7 +20,7 @@ describe('Semantic', function() { return { parsingContext, document: parsingContext.getPhase(moduleName, PhaseFlags.Semantic) }; }; - const scopePhases = function(txt: string, fileName: string): PhasesResult { + const scopePhases = function (txt: string, fileName: string): PhasesResult { parsingContext.reset(); const moduleName = parsingContext.getModuleFQNForFile(fileName); parsingContext.invalidateModule(moduleName); @@ -85,7 +85,7 @@ describe('Semantic', function() { testParseToken( result, getFileName(), - 'Document', + async (_, e) => { if (e) throw e; expect(parsingContext.messageCollector.hasErrors()).toEqual(false); @@ -108,7 +108,7 @@ describe('Semantic', function() { testParseTokenFailsafe( result, 'MUST_FAIL_' + getFileName(), - 'Document', + async (result, err) => { const didFail = !!err || !result || parsingContext.messageCollector.hasErrors(); if (!didFail && result) { @@ -191,7 +191,7 @@ describe('Semantic', function() { b }`, getFileName(), - 'Document', + async (result, e) => { if (e) throw e; if (!result) throw new Error('No result'); @@ -211,7 +211,7 @@ describe('Semantic', function() { b }`, getFileName(), - 'Document', + async (result, e) => { if (e) throw e; if (!result) throw new Error('No result'); @@ -301,7 +301,7 @@ describe('Semantic', function() { map(1,3) }`, getFileName(), - 'Document', + async (result, e) => { if (e) throw e; if (!result) throw new Error('No result'); @@ -320,7 +320,7 @@ describe('Semantic', function() { } `, getFileName(), - 'Document', + async (result, e) => { if (e) throw e; if (!result) throw new Error('No result'); @@ -339,7 +339,7 @@ describe('Semantic', function() { b }`, getFileName(), - 'Document', + async (result, e) => { if (e) throw e; if (!result) throw new Error('No result'); @@ -357,7 +357,7 @@ describe('Semantic', function() { fun a(): void = {} `, getFileName(), - 'Document', + async (result, e) => { if (e) throw e; if (!result) throw new Error('No result'); @@ -374,7 +374,7 @@ describe('Semantic', function() { fun a(): void = {} `, getFileName(), - 'Document', + async (result, e) => { if (e) throw e; if (!result) throw new Error('No result'); @@ -389,7 +389,7 @@ describe('Semantic', function() { fun a(): i32 = system::random::nextInt() `, getFileName(), - 'Document', + async (result, e) => { if (e) throw e; if (!result) throw new Error('No result'); @@ -403,7 +403,7 @@ describe('Semantic', function() { fun hash(): i32 = 1 `, getFileName(), - 'Document', + async (result, e) => { if (e) throw e; if (!result) throw new Error('No result'); diff --git a/test/TestHelpers.ts b/test/TestHelpers.ts index b962ca35..979f51b4 100644 --- a/test/TestHelpers.ts +++ b/test/TestHelpers.ts @@ -15,7 +15,6 @@ export type PhasesResult = { document: Nodes.DocumentNode; parsingContext: Parsi export function testParseToken( txt: string, fileName: string, - target: string, customTest: (document: V | void, error?: Error) => Promise, phases: (txt: string, fileName: string) => V, debug?: boolean @@ -23,7 +22,6 @@ export function testParseToken( testParseTokenFailsafe( txt, fileName, - target, async (result: V | void, e) => { if (result && result.parsingContext.messageCollector.hasErrors()) { failWithErrors('testParseToken', result.parsingContext); @@ -43,12 +41,11 @@ export function testParseToken( export function testParseTokenFailsafe( txt: string, fileName: string, - target: string, customTest: (document: V | void, error?: Error) => Promise, phases: (txt: string, fileName: string) => V, debug?: boolean ) { - it(fileName || inspect(txt, false, 1, true) + ' must resolve into ' + (target || '(FIRST RULE)'), async function( + it(fileName || inspect(txt, false, 1, true) + ' must resolve', async function( this: any ) { this.timeout(10000); @@ -85,7 +82,6 @@ export function folderBasedTest( testParseTokenFailsafe( content, fileName, - 'Document', async (resultNode: V | void, err) => { if (!resultNode && !err) throw new Error('WTF'); diff --git a/test/fixtures/cli/smoke/main.lys b/test/fixtures/cli/smoke/main.lys index 8ce21bdf..8ef30ffb 100644 --- a/test/fixtures/cli/smoke/main.lys +++ b/test/fixtures/cli/smoke/main.lys @@ -3,7 +3,7 @@ import support::test #[export] fun test(): void = { - START("This is a test suite") + START("This is a \"test suite\"") printf(" Hello world %X", 0xDEADFACE) mustEqual(3 as u8, 3 as u16, "assertion name") diff --git a/test/fixtures/compiler/0-struct.lys.optimized.wast b/test/fixtures/compiler/0-struct.lys.optimized.wast index 056a50e2..462012a0 100644 --- a/test/fixtures/compiler/0-struct.lys.optimized.wast +++ b/test/fixtures/compiler/0-struct.lys.optimized.wast @@ -34,16 +34,13 @@ (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getLastErrorMessage" (func $0)) (export "test_getMaxMemory" (func $2)) (export "isRed" (func $7)) (export "testColors" (func $8)) (start $9) - (func $0 (; 1 ;) (result i32) + (func $0 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -71,7 +68,7 @@ ) ) ) - (func $1 (; 2 ;) (param $0 i32) + (func $1 (param $0 i32) (local $1 i64) (call $fimport$0 (local.get $0) @@ -107,10 +104,10 @@ ) ) ) - (func $2 (; 3 ;) (result i32) - (global.get $global$7) + (func $2 (result i32) + (global.get $global$4) ) - (func $3 (; 4 ;) (param $0 i32) (result i32) + (func $3 (param $0 i32) (result i32) (local $1 i32) (call $5 (local.tee $1 @@ -122,7 +119,7 @@ ) (local.get $1) ) - (func $4 (; 5 ;) (param $0 i32) (result i32) + (func $4 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -136,7 +133,7 @@ (if (i32.gt_u (local.get $0) - (global.get $global$4) + (global.get $global$2) ) (unreachable) ) @@ -145,11 +142,11 @@ (local.tee $0 (i32.and (i32.add - (global.get $global$3) + (global.get $global$1) (i32.add (i32.add (local.tee $1 - (global.get $global$7) + (global.get $global$4) ) (i32.const 16) ) @@ -164,7 +161,7 @@ ) ) (i32.xor - (global.get $global$3) + (global.get $global$1) (i32.const -1) ) ) @@ -217,7 +214,7 @@ ) ) ) - (global.set $global$7 + (global.set $global$4 (local.get $0) ) (i32.add @@ -225,7 +222,7 @@ (i32.const 16) ) ) - (func $5 (; 6 ;) (param $0 i32) (param $1 i32) + (func $5 (param $0 i32) (param $1 i32) (local.set $1 (i32.add (local.get $0) @@ -256,7 +253,7 @@ ) ) ) - (func $6 (; 7 ;) (result i64) + (func $6 (result i64) (local $0 i64) (i32.store (i32.wrap_i64 @@ -293,7 +290,7 @@ ) (local.get $0) ) - (func $7 (; 8 ;) (param $0 i64) (result i32) + (func $7 (param $0 i64) (result i32) (select (i32.const 0) (i32.const 1) @@ -308,7 +305,7 @@ ) ) ) - (func $8 (; 9 ;) + (func $8 (call $1 (i32.const 1) ) @@ -339,30 +336,21 @@ ) ) ) - (func $9 (; 10 ;) + (func $9 (global.set $global$0 (i64.const 8589934592) ) (global.set $global$1 - (i32.const 4) - ) - (global.set $global$2 - (i32.const 16) - ) - (global.set $global$3 (i32.const 15) ) - (global.set $global$4 + (global.set $global$2 (i32.const 1073741824) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 + (global.set $global$3 (i32.const 65536) ) - (global.set $global$7 - (global.get $global$6) + (global.set $global$4 + (global.get $global$3) ) ) ) diff --git a/test/fixtures/compiler/0-wast.lys.optimized.wast b/test/fixtures/compiler/0-wast.lys.optimized.wast index 110ef0d5..96f67607 100644 --- a/test/fixtures/compiler/0-wast.lys.optimized.wast +++ b/test/fixtures/compiler/0-wast.lys.optimized.wast @@ -10,17 +10,14 @@ (global $global$1 (mut i32) (i32.const 0)) (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "main" (func $2)) (start $3) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$3) ) - (func $1 (; 1 ;) + (func $1 (local $0 i32) (local $1 i32) (local $2 i32) @@ -28,7 +25,7 @@ (if (i32.gt_u (i32.const 1) - (global.get $global$3) + (global.get $global$1) ) (unreachable) ) @@ -37,16 +34,16 @@ (local.tee $1 (i32.and (i32.add - (global.get $global$2) + (global.get $global$0) (i32.add (local.tee $0 - (global.get $global$6) + (global.get $global$3) ) (i32.const 32) ) ) (i32.xor - (global.get $global$2) + (global.get $global$0) (i32.const -1) ) ) @@ -99,35 +96,26 @@ ) ) ) - (global.set $global$6 + (global.set $global$3 (local.get $1) ) ) - (func $2 (; 2 ;) (result i32) + (func $2 (result i32) (call $1) (i32.const 9) ) - (func $3 (; 3 ;) + (func $3 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 (i32.const 15) ) - (global.set $global$3 + (global.set $global$1 (i32.const 1073741824) ) - (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 + (global.set $global$2 (i32.const 65536) ) - (global.set $global$6 - (global.get $global$5) + (global.set $global$3 + (global.get $global$2) ) ) ) diff --git a/test/fixtures/compiler/1-wast-sha3.lys.optimized.wast b/test/fixtures/compiler/1-wast-sha3.lys.optimized.wast index 74a4570d..b86557b4 100644 --- a/test/fixtures/compiler/1-wast-sha3.lys.optimized.wast +++ b/test/fixtures/compiler/1-wast-sha3.lys.optimized.wast @@ -19,18 +19,15 @@ (global $global$1 (mut i32) (i32.const 0)) (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i64) (i64.const 0)) + (global $global$4 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "keccak" (func $15)) (start $16) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$3) ) - (func $1 (; 1 ;) (param $0 i32) (result i32) + (func $1 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -44,7 +41,7 @@ (if (i32.gt_u (local.get $0) - (global.get $global$3) + (global.get $global$1) ) (unreachable) ) @@ -53,11 +50,11 @@ (local.tee $0 (i32.and (i32.add - (global.get $global$2) + (global.get $global$0) (i32.add (i32.add (local.tee $1 - (global.get $global$6) + (global.get $global$3) ) (i32.const 16) ) @@ -72,7 +69,7 @@ ) ) (i32.xor - (global.get $global$2) + (global.get $global$0) (i32.const -1) ) ) @@ -125,7 +122,7 @@ ) ) ) - (global.set $global$6 + (global.set $global$3 (local.get $0) ) (i32.add @@ -133,7 +130,7 @@ (i32.const 16) ) ) - (func $2 (; 2 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $2 (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i64) (local $5 i64) @@ -181,7 +178,7 @@ ) ) ) - (func $3 (; 3 ;) (param $0 i32) (param $1 i32) + (func $3 (param $0 i32) (param $1 i32) (local.set $1 (i32.add (local.get $0) @@ -212,7 +209,7 @@ ) ) ) - (func $4 (; 4 ;) (param $0 i64) (param $1 i64) (result i64) + (func $4 (param $0 i64) (param $1 i64) (result i64) (local $2 i32) (local $3 i64) (call $3 @@ -247,7 +244,7 @@ ) (local.get $3) ) - (func $5 (; 5 ;) (param $0 i64) + (func $5 (param $0 i64) (local $1 i64) (local $2 i64) (local $3 i64) @@ -1009,7 +1006,7 @@ ) ) ) - (func $6 (; 6 ;) (param $0 i64) (param $1 i64) + (func $6 (param $0 i64) (param $1 i64) (local $2 i32) (local $3 i32) (local $4 i64) @@ -1068,7 +1065,7 @@ ) ) ) - (func $7 (; 7 ;) (param $0 i64) + (func $7 (param $0 i64) (local $1 i64) (local.set $1 (i64.load @@ -1458,7 +1455,7 @@ (local.get $1) ) ) - (func $8 (; 8 ;) (param $0 i64) + (func $8 (param $0 i64) (local $1 i32) (local $2 i64) (local $3 i64) @@ -1765,7 +1762,7 @@ ) ) ) - (func $9 (; 9 ;) (param $0 i32) + (func $9 (param $0 i32) (local $1 i64) (local $2 i64) (local $3 i64) @@ -1847,7 +1844,7 @@ ) ) ) - (func $10 (; 10 ;) (param $0 i32) (param $1 i32) + (func $10 (param $0 i32) (param $1 i32) (local $2 i64) (local $3 i64) (i64.store @@ -2295,7 +2292,7 @@ (local.get $1) ) ) - (func $11 (; 11 ;) (param $0 i32) + (func $11 (param $0 i32) (local $1 i64) (call $3 (local.get $0) @@ -2742,7 +2739,7 @@ (i32.const 14) ) ) - (func $12 (; 12 ;) (param $0 i32) (param $1 i32) (param $2 i32) + (func $12 (param $0 i32) (param $1 i32) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i32) @@ -2884,7 +2881,7 @@ ) ) ) - (func $13 (; 13 ;) (param $0 i32) (param $1 i32) + (func $13 (param $0 i32) (param $1 i32) (local $2 i32) (local $3 i32) (local $4 i64) @@ -3029,7 +3026,7 @@ ) ) ) - (func $14 (; 14 ;) (param $0 i32) (result i64) + (func $14 (param $0 i32) (result i64) (local $1 i32) (local $2 i32) (call $3 @@ -3056,13 +3053,13 @@ (i64.const 38654705664) ) ) - (func $15 (; 15 ;) (param $0 i64) (result i64) + (func $15 (param $0 i64) (result i64) (call $11 (i32.add (i32.wrap_i64 (i64.load (i32.wrap_i64 - (global.get $global$7) + (global.get $global$4) ) ) ) @@ -3074,7 +3071,7 @@ (i32.wrap_i64 (i64.load (i32.wrap_i64 - (global.get $global$7) + (global.get $global$4) ) ) ) @@ -3098,7 +3095,7 @@ (i64.load (i32.wrap_i64 (local.tee $0 - (global.get $global$7) + (global.get $global$4) ) ) ) @@ -3128,29 +3125,20 @@ ) ) ) - (func $16 (; 16 ;) + (func $16 (local $0 i64) (local $1 i64) (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 (i32.const 15) ) - (global.set $global$3 + (global.set $global$1 (i32.const 1073741824) ) - (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 + (global.set $global$2 (i32.const 65536) ) - (global.set $global$6 - (global.get $global$5) + (global.set $global$3 + (global.get $global$2) ) (local.set $0 (call $14 @@ -3170,7 +3158,7 @@ (i32.const 4) ) ) - (global.set $global$7 + (global.set $global$4 (call $4 (local.get $0) (local.get $1) diff --git a/test/fixtures/compiler/a.lys.optimized.wast b/test/fixtures/compiler/a.lys.optimized.wast index 485d3b05..754488aa 100644 --- a/test/fixtures/compiler/a.lys.optimized.wast +++ b/test/fixtures/compiler/a.lys.optimized.wast @@ -11,12 +11,6 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test" (func $2)) @@ -27,31 +21,31 @@ (export "addInts" (func $5)) (export "x" (func $6)) (start $7) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (param $0 i32) (result i32) + (func $1 (param $0 i32) (result i32) (local.get $0) ) - (func $2 (; 2 ;) (result i32) + (func $2 (result i32) (i32.const 1) ) - (func $3 (; 3 ;) (param $0 f32) (param $1 f64) (result f32) + (func $3 (param $0 f32) (param $1 f64) (result f32) (local.get $0) ) - (func $4 (; 4 ;) (param $0 f32) (param $1 f32) (result f32) + (func $4 (param $0 f32) (param $1 f32) (result f32) (f32.add (local.get $0) (local.get $1) ) ) - (func $5 (; 5 ;) (param $0 i32) (param $1 i32) (result i32) + (func $5 (param $0 i32) (param $1 i32) (result i32) (i32.add (local.get $0) (local.get $1) ) ) - (func $6 (; 6 ;) (param $0 f32) (param $1 f32) (result f32) + (func $6 (param $0 f32) (param $1 f32) (result f32) (f32.mul (f32.add (local.get $0) @@ -60,27 +54,9 @@ (local.get $1) ) ) - (func $7 (; 7 ;) + (func $7 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/b.lys.optimized.wast b/test/fixtures/compiler/b.lys.optimized.wast index 94778f01..edd3403d 100644 --- a/test/fixtures/compiler/b.lys.optimized.wast +++ b/test/fixtures/compiler/b.lys.optimized.wast @@ -7,43 +7,19 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "outerFunction" (func $1)) (start $2) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (result i32) + (func $1 (result i32) (i32.const 4) ) - (func $2 (; 2 ;) + (func $2 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/booleanLogic.lys.optimized.wast b/test/fixtures/compiler/booleanLogic.lys.optimized.wast index 3769067d..5ec1d0d1 100644 --- a/test/fixtures/compiler/booleanLogic.lys.optimized.wast +++ b/test/fixtures/compiler/booleanLogic.lys.optimized.wast @@ -8,20 +8,14 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test" (func $1)) (start $2) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (param $0 i32) (param $1 i32) (result i32) + (func $1 (param $0 i32) (param $1 i32) (result i32) (i32.and (i32.ne (local.get $0) @@ -33,27 +27,9 @@ ) ) ) - (func $2 (; 2 ;) + (func $2 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/bytes.lys.optimized.wast b/test/fixtures/compiler/bytes.lys.optimized.wast index 7dd0c4c2..c69834f2 100644 --- a/test/fixtures/compiler/bytes.lys.optimized.wast +++ b/test/fixtures/compiler/bytes.lys.optimized.wast @@ -10,51 +10,23 @@ (data (i32.const 16) "\0c\00\00\00a\00s\00d\00a\00s\00d") (data (i32.const 33) "\10\00\00\00u\00t\00f\00 \00\ab\00\100\110\bb") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i64) (i64.const 0)) - (global $global$8 (mut i64) (i64.const 0)) + (global $global$1 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "main" (func $1)) (start $2) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (result i64) - (global.get $global$7) + (func $1 (result i64) + (global.get $global$1) ) - (func $2 (; 2 ;) + (func $2 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 + (global.set $global$1 (i64.const 12884901904) ) - (global.set $global$8 - (i64.const 12884901921) - ) ) ) diff --git a/test/fixtures/compiler/c.lys.optimized.wast b/test/fixtures/compiler/c.lys.optimized.wast index 9b596b06..28d98c93 100644 --- a/test/fixtures/compiler/c.lys.optimized.wast +++ b/test/fixtures/compiler/c.lys.optimized.wast @@ -7,43 +7,19 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "outer" (func $1)) (start $2) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (result i32) + (func $1 (result i32) (i32.const 1) ) - (func $2 (; 2 ;) + (func $2 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/deconstruct.lys.optimized.wast b/test/fixtures/compiler/deconstruct.lys.optimized.wast index 7d937947..157692af 100644 --- a/test/fixtures/compiler/deconstruct.lys.optimized.wast +++ b/test/fixtures/compiler/deconstruct.lys.optimized.wast @@ -8,20 +8,14 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "isRed" (func $1)) (start $2) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (param $0 i64) (result i32) + (func $1 (param $0 i64) (result i32) (block $label$1 (result i32) (if (i32.ne @@ -63,27 +57,9 @@ (i32.const 1) ) ) - (func $2 (; 2 ;) + (func $2 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/dynamicLhsMatch.lys.optimized.wast b/test/fixtures/compiler/dynamicLhsMatch.lys.optimized.wast index 4e5cef27..6c004695 100644 --- a/test/fixtures/compiler/dynamicLhsMatch.lys.optimized.wast +++ b/test/fixtures/compiler/dynamicLhsMatch.lys.optimized.wast @@ -8,48 +8,24 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test" (func $1)) (export "test2" (func $1)) (start $2) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (param $0 i32) (result i32) + (func $1 (param $0 i32) (result i32) (select (i32.const 1) (i32.const 0) (local.get $0) ) ) - (func $2 (; 2 ;) + (func $2 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/emptyFn.lys.optimized.wast b/test/fixtures/compiler/emptyFn.lys.optimized.wast index a9c85fa4..1d415ec4 100644 --- a/test/fixtures/compiler/emptyFn.lys.optimized.wast +++ b/test/fixtures/compiler/emptyFn.lys.optimized.wast @@ -7,44 +7,20 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "main" (func $1)) (export "returningValueFn" (func $1)) (start $2) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) + (func $1 (nop) ) - (func $2 (; 2 ;) + (func $2 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/extern.lys.optimized.wast b/test/fixtures/compiler/extern.lys.optimized.wast index 116eb409..24ce8e6a 100644 --- a/test/fixtures/compiler/extern.lys.optimized.wast +++ b/test/fixtures/compiler/extern.lys.optimized.wast @@ -11,20 +11,14 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "main" (func $1)) (start $2) - (func $0 (; 2 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 3 ;) + (func $1 (call $fimport$1 (i32.const 0) ) @@ -33,27 +27,9 @@ (i32.const 0) ) ) - (func $2 (; 4 ;) + (func $2 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/fib1.lys.optimized.wast b/test/fixtures/compiler/fib1.lys.optimized.wast index 6c79e169..353fd1c2 100644 --- a/test/fixtures/compiler/fib1.lys.optimized.wast +++ b/test/fixtures/compiler/fib1.lys.optimized.wast @@ -9,20 +9,14 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "fib" (func $2)) (start $3) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (block $label$1 (result i32) (if (local.get $0) @@ -54,34 +48,16 @@ (local.get $1) ) ) - (func $2 (; 2 ;) (param $0 i32) (result i32) + (func $2 (param $0 i32) (result i32) (call $1 (local.get $0) (i32.const 0) (i32.const 1) ) ) - (func $3 (; 3 ;) + (func $3 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/fib2.lys.optimized.wast b/test/fixtures/compiler/fib2.lys.optimized.wast index c6d3af15..4e0aa967 100644 --- a/test/fixtures/compiler/fib2.lys.optimized.wast +++ b/test/fixtures/compiler/fib2.lys.optimized.wast @@ -9,21 +9,15 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "fib" (func $2)) (export "test" (func $3)) (start $4) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (if (result i32) (i32.gt_s (local.get $0) @@ -43,39 +37,21 @@ (local.get $1) ) ) - (func $2 (; 2 ;) (param $0 i32) (result i32) + (func $2 (param $0 i32) (result i32) (call $1 (local.get $0) (i32.const 0) (i32.const 1) ) ) - (func $3 (; 3 ;) (result i32) + (func $3 (result i32) (call $2 (i32.const 46) ) ) - (func $4 (; 4 ;) + (func $4 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/fib3.lys.optimized.wast b/test/fixtures/compiler/fib3.lys.optimized.wast index c6d3af15..4e0aa967 100644 --- a/test/fixtures/compiler/fib3.lys.optimized.wast +++ b/test/fixtures/compiler/fib3.lys.optimized.wast @@ -9,21 +9,15 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "fib" (func $2)) (export "test" (func $3)) (start $4) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $1 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (if (result i32) (i32.gt_s (local.get $0) @@ -43,39 +37,21 @@ (local.get $1) ) ) - (func $2 (; 2 ;) (param $0 i32) (result i32) + (func $2 (param $0 i32) (result i32) (call $1 (local.get $0) (i32.const 0) (i32.const 1) ) ) - (func $3 (; 3 ;) (result i32) + (func $3 (result i32) (call $2 (i32.const 46) ) ) - (func $4 (; 4 ;) + (func $4 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/getter.lys.optimized.wast b/test/fixtures/compiler/getter.lys.optimized.wast index 4e2019c2..61ad1d53 100644 --- a/test/fixtures/compiler/getter.lys.optimized.wast +++ b/test/fixtures/compiler/getter.lys.optimized.wast @@ -8,20 +8,14 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "main" (func $1)) (start $2) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (param $0 i64) (result i32) + (func $1 (param $0 i64) (result i32) (i32.or (i32.load (i32.add @@ -54,27 +48,9 @@ ) ) ) - (func $2 (; 2 ;) + (func $2 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/globalMutability.lys.optimized.wast b/test/fixtures/compiler/globalMutability.lys.optimized.wast index 1b2a1be7..e6478c41 100644 --- a/test/fixtures/compiler/globalMutability.lys.optimized.wast +++ b/test/fixtures/compiler/globalMutability.lys.optimized.wast @@ -9,61 +9,33 @@ (global $global$0 (mut i32) (i32.const 0)) (global $global$1 (mut i32) (i32.const 0)) (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i32) (i32.const 0)) - (global $global$8 (mut i32) (i32.const 0)) - (global $global$9 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "main" (func $1)) (start $2) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (result i32) - (global.set $global$7 + (func $1 (result i32) + (global.set $global$1 (i32.sub (i32.add - (global.get $global$7) + (global.get $global$1) (i32.const 1) ) - (global.get $global$9) + (global.get $global$2) ) ) - (global.get $global$7) + (global.get $global$1) ) - (func $2 (; 2 ;) + (func $2 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 + (global.set $global$1 (i32.const 2) ) - (global.set $global$8 - (i32.const 1) - ) - (global.set $global$9 + (global.set $global$2 (i32.const -1) ) ) diff --git a/test/fixtures/compiler/if.lys.optimized.wast b/test/fixtures/compiler/if.lys.optimized.wast index 22e272e0..0d574c04 100644 --- a/test/fixtures/compiler/if.lys.optimized.wast +++ b/test/fixtures/compiler/if.lys.optimized.wast @@ -9,22 +9,16 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "gcd" (func $1)) (export "test" (func $2)) (export "ifWithoutElse" (func $3)) (start $4) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (param $0 i32) (param $1 i32) (result i32) + (func $1 (param $0 i32) (param $1 i32) (result i32) (if (result i32) (i32.gt_s (local.get $0) @@ -53,13 +47,13 @@ ) ) ) - (func $2 (; 2 ;) (result i32) + (func $2 (result i32) (call $1 (i32.const 119) (i32.const 7) ) ) - (func $3 (; 3 ;) (param $0 i32) (result i32) + (func $3 (param $0 i32) (result i32) (select (i32.const 3) (i32.const 1) @@ -69,27 +63,9 @@ ) ) ) - (func $4 (; 4 ;) + (func $4 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/if2.lys.optimized.wast b/test/fixtures/compiler/if2.lys.optimized.wast index b97409d4..b668b999 100644 --- a/test/fixtures/compiler/if2.lys.optimized.wast +++ b/test/fixtures/compiler/if2.lys.optimized.wast @@ -8,21 +8,15 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "gcd" (func $1)) (export "test" (func $2)) (start $3) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (param $0 i32) (param $1 i32) (result i32) + (func $1 (param $0 i32) (param $1 i32) (result i32) (if (result i32) (i32.gt_s (local.get $0) @@ -51,33 +45,15 @@ ) ) ) - (func $2 (; 2 ;) (result i32) + (func $2 (result i32) (call $1 (i32.const 119) (i32.const 7) ) ) - (func $3 (; 3 ;) + (func $3 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/infix.lys.optimized.wast b/test/fixtures/compiler/infix.lys.optimized.wast index ce2ec51f..cb85d581 100644 --- a/test/fixtures/compiler/infix.lys.optimized.wast +++ b/test/fixtures/compiler/infix.lys.optimized.wast @@ -9,53 +9,29 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "testInt" (func $1)) (export "testFloat" (func $2)) (start $3) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (param $0 i32) (param $1 i32) (result i32) + (func $1 (param $0 i32) (param $1 i32) (result i32) (i32.add (local.get $0) (local.get $1) ) ) - (func $2 (; 2 ;) (param $0 f32) (param $1 f32) (result f32) + (func $2 (param $0 f32) (param $1 f32) (result f32) (f32.add (local.get $0) (local.get $1) ) ) - (func $3 (; 3 ;) + (func $3 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/is.lys.optimized.wast b/test/fixtures/compiler/is.lys.optimized.wast index e1afb890..ccefab61 100644 --- a/test/fixtures/compiler/is.lys.optimized.wast +++ b/test/fixtures/compiler/is.lys.optimized.wast @@ -8,59 +8,23 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i64) (i64.const 0)) - (global $global$8 (mut i64) (i64.const 0)) - (global $global$9 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "identity" (func $1)) (export "test" (func $2)) (start $3) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (param $0 i64) (result i64) + (func $1 (param $0 i64) (result i64) (local.get $0) ) - (func $2 (; 2 ;) + (func $2 (nop) ) - (func $3 (; 3 ;) + (func $3 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 (i32.const 65536) ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 - (i64.const 4294967296) - ) - (global.set $global$8 - (i64.const 4294967296) - ) - (global.set $global$9 - (i64.const 4294967296) - ) ) ) diff --git a/test/fixtures/compiler/iterator-loco.lys.optimized.wast b/test/fixtures/compiler/iterator-loco.lys.optimized.wast index a55340ab..3afef15e 100644 --- a/test/fixtures/compiler/iterator-loco.lys.optimized.wast +++ b/test/fixtures/compiler/iterator-loco.lys.optimized.wast @@ -15,17 +15,14 @@ (global $global$1 (mut i32) (i32.const 0)) (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test" (func $6)) (start $7) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$3) ) - (func $1 (; 1 ;) (param $0 i32) (result i32) + (func $1 (param $0 i32) (result i32) (local $1 i32) (call $3 (local.tee $1 @@ -37,7 +34,7 @@ ) (local.get $1) ) - (func $2 (; 2 ;) (param $0 i32) (result i32) + (func $2 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -51,7 +48,7 @@ (if (i32.gt_u (local.get $0) - (global.get $global$3) + (global.get $global$1) ) (unreachable) ) @@ -60,11 +57,11 @@ (local.tee $0 (i32.and (i32.add - (global.get $global$2) + (global.get $global$0) (i32.add (i32.add (local.tee $1 - (global.get $global$6) + (global.get $global$3) ) (i32.const 16) ) @@ -79,7 +76,7 @@ ) ) (i32.xor - (global.get $global$2) + (global.get $global$0) (i32.const -1) ) ) @@ -132,7 +129,7 @@ ) ) ) - (global.set $global$6 + (global.set $global$3 (local.get $0) ) (i32.add @@ -140,7 +137,7 @@ (i32.const 16) ) ) - (func $3 (; 3 ;) (param $0 i32) (param $1 i32) + (func $3 (param $0 i32) (param $1 i32) (local.set $1 (i32.add (local.get $0) @@ -171,7 +168,7 @@ ) ) ) - (func $4 (; 4 ;) (param $0 i32) (param $1 i32) (result i64) + (func $4 (param $0 i32) (param $1 i32) (result i64) (local $2 i64) (i32.store (i32.wrap_i64 @@ -199,7 +196,7 @@ ) (local.get $2) ) - (func $5 (; 5 ;) (param $0 i64) (result i64) + (func $5 (param $0 i64) (result i64) (local $1 i32) (local $2 i64) (if (result i64) @@ -259,7 +256,7 @@ (i64.const 8589934592) ) ) - (func $6 (; 6 ;) (param $0 i32) (param $1 i32) (result i32) + (func $6 (param $0 i32) (param $1 i32) (result i32) (local $2 i32) (local $3 i64) (local $4 i64) @@ -301,27 +298,18 @@ ) (local.get $2) ) - (func $7 (; 7 ;) + (func $7 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 (i32.const 15) ) - (global.set $global$3 + (global.set $global$1 (i32.const 1073741824) ) - (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 + (global.set $global$2 (i32.const 65536) ) - (global.set $global$6 - (global.get $global$5) + (global.set $global$3 + (global.get $global$2) ) ) ) diff --git a/test/fixtures/compiler/loops.lys.optimized.wast b/test/fixtures/compiler/loops.lys.optimized.wast index 058ffe35..a190868d 100644 --- a/test/fixtures/compiler/loops.lys.optimized.wast +++ b/test/fixtures/compiler/loops.lys.optimized.wast @@ -7,12 +7,6 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test" (func $1)) @@ -20,13 +14,13 @@ (export "test2" (func $2)) (export "test3" (func $1)) (start $3) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) + (func $1 (nop) ) - (func $2 (; 2 ;) + (func $2 (local $0 i32) (local.set $0 (i32.const 1) @@ -41,27 +35,9 @@ (br $label$1) ) ) - (func $3 (; 3 ;) + (func $3 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/mutability.lys.optimized.wast b/test/fixtures/compiler/mutability.lys.optimized.wast index 48295ed5..1bcb6027 100644 --- a/test/fixtures/compiler/mutability.lys.optimized.wast +++ b/test/fixtures/compiler/mutability.lys.optimized.wast @@ -8,24 +8,18 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "main" (func $1)) (export "main2" (func $2)) (start $3) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (result i32) + (func $1 (result i32) (i32.const 2) ) - (func $2 (; 2 ;) (param $0 i32) (result i32) + (func $2 (param $0 i32) (result i32) (select (i32.const 3) (i32.const 1) @@ -35,27 +29,9 @@ ) ) ) - (func $3 (; 3 ;) + (func $3 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/nop.lys.optimized.wast b/test/fixtures/compiler/nop.lys.optimized.wast index 41a020a5..986b2363 100644 --- a/test/fixtures/compiler/nop.lys.optimized.wast +++ b/test/fixtures/compiler/nop.lys.optimized.wast @@ -7,43 +7,19 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "x" (func $1)) (start $2) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) + (func $1 (nop) ) - (func $2 (; 2 ;) + (func $2 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/panic-match.lys.optimized.wast b/test/fixtures/compiler/panic-match.lys.optimized.wast index f867868f..3b0bfe48 100644 --- a/test/fixtures/compiler/panic-match.lys.optimized.wast +++ b/test/fixtures/compiler/panic-match.lys.optimized.wast @@ -8,20 +8,14 @@ (data (i32.const 49) "\02\00\00\000") (data (i32.const 56) "\02\00\00\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test" (func $1)) (start $2) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 1 ;) (param $0 i32) + (func $1 (param $0 i32) (if (i32.ne (local.get $0) @@ -30,27 +24,9 @@ (unreachable) ) ) - (func $2 (; 2 ;) + (func $2 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) ) ) diff --git a/test/fixtures/compiler/patternMatchinIs.lys.optimized.wast b/test/fixtures/compiler/patternMatchinIs.lys.optimized.wast index 61a29246..8445308d 100644 --- a/test/fixtures/compiler/patternMatchinIs.lys.optimized.wast +++ b/test/fixtures/compiler/patternMatchinIs.lys.optimized.wast @@ -34,12 +34,9 @@ (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i32) (i32.const 0)) - (global $global$8 (mut i64) (i64.const 0)) - (global $global$9 (mut i64) (i64.const 0)) - (global $global$10 (mut i64) (i64.const 0)) + (global $global$5 (mut i64) (i64.const 0)) + (global $global$6 (mut i64) (i64.const 0)) + (global $global$7 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getLastErrorMessage" (func $0)) (export "test_getMaxMemory" (func $2)) @@ -51,7 +48,7 @@ (export "isCustom" (func $14)) (export "testPassing" (func $15)) (start $16) - (func $0 (; 1 ;) (result i32) + (func $0 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -79,7 +76,7 @@ ) ) ) - (func $1 (; 2 ;) (param $0 i32) + (func $1 (param $0 i32) (local $1 i64) (call $fimport$0 (local.get $0) @@ -115,10 +112,10 @@ ) ) ) - (func $2 (; 3 ;) (result i32) - (global.get $global$7) + (func $2 (result i32) + (global.get $global$4) ) - (func $3 (; 4 ;) (param $0 i32) (result i32) + (func $3 (param $0 i32) (result i32) (local $1 i32) (call $5 (local.tee $1 @@ -130,7 +127,7 @@ ) (local.get $1) ) - (func $4 (; 5 ;) (param $0 i32) (result i32) + (func $4 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -144,7 +141,7 @@ (if (i32.gt_u (local.get $0) - (global.get $global$4) + (global.get $global$2) ) (unreachable) ) @@ -153,11 +150,11 @@ (local.tee $0 (i32.and (i32.add - (global.get $global$3) + (global.get $global$1) (i32.add (i32.add (local.tee $1 - (global.get $global$7) + (global.get $global$4) ) (i32.const 16) ) @@ -172,7 +169,7 @@ ) ) (i32.xor - (global.get $global$3) + (global.get $global$1) (i32.const -1) ) ) @@ -225,7 +222,7 @@ ) ) ) - (global.set $global$7 + (global.set $global$4 (local.get $0) ) (i32.add @@ -233,7 +230,7 @@ (i32.const 16) ) ) - (func $5 (; 6 ;) (param $0 i32) (param $1 i32) + (func $5 (param $0 i32) (param $1 i32) (local.set $1 (i32.add (local.get $0) @@ -264,7 +261,7 @@ ) ) ) - (func $6 (; 7 ;) (param $0 i64) (result i32) + (func $6 (param $0 i64) (result i32) (if (result i32) (i32.eq (i32.wrap_i64 @@ -305,7 +302,7 @@ ) ) ) - (func $7 (; 8 ;) (param $0 i64) (result i32) + (func $7 (param $0 i64) (result i32) (if (result i32) (i32.eq (i32.wrap_i64 @@ -361,7 +358,7 @@ ) ) ) - (func $8 (; 9 ;) (result i64) + (func $8 (result i64) (local $0 i64) (i32.store (i32.wrap_i64 @@ -380,7 +377,7 @@ ) (local.get $0) ) - (func $9 (; 10 ;) (param $0 i64) (result i32) + (func $9 (param $0 i64) (result i32) (select (i32.const 0) (i32.const 1) @@ -395,7 +392,7 @@ ) ) ) - (func $10 (; 11 ;) (param $0 i64) (result i32) + (func $10 (param $0 i64) (result i32) (select (i32.const 0) (i32.const 1) @@ -410,7 +407,7 @@ ) ) ) - (func $11 (; 12 ;) (param $0 i64) (result i32) + (func $11 (param $0 i64) (result i32) (block $label$1 (result i32) (drop (br_if $label$1 @@ -425,7 +422,7 @@ (i32.const 1) ) ) - (func $12 (; 13 ;) (param $0 i64) (result i32) + (func $12 (param $0 i64) (result i32) (select (i32.const 0) (i32.const 1) @@ -440,7 +437,7 @@ ) ) ) - (func $13 (; 14 ;) (param $0 i64) (result i32) + (func $13 (param $0 i64) (result i32) (block $label$1 (result i32) (drop (br_if $label$1 @@ -455,7 +452,7 @@ (i32.const 1) ) ) - (func $14 (; 15 ;) (param $0 i64) (result i32) + (func $14 (param $0 i64) (result i32) (select (i32.const 0) (i32.const 1) @@ -470,7 +467,7 @@ ) ) ) - (func $15 (; 16 ;) + (func $15 (call $1 (i32.const 1) ) @@ -525,7 +522,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$8) + (global.get $global$5) (i64.const 32) ) ) @@ -544,7 +541,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$8) + (global.get $global$5) (i64.const 32) ) ) @@ -559,7 +556,7 @@ (i32.eqz (i32.eqz (call $11 - (global.get $global$8) + (global.get $global$5) ) ) ) @@ -573,7 +570,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$9) + (global.get $global$6) (i64.const 32) ) ) @@ -592,7 +589,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$9) + (global.get $global$6) (i64.const 32) ) ) @@ -607,7 +604,7 @@ (i32.eqz (i32.eqz (call $11 - (global.get $global$9) + (global.get $global$6) ) ) ) @@ -621,7 +618,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$10) + (global.get $global$7) (i64.const 32) ) ) @@ -640,7 +637,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$10) + (global.get $global$7) (i64.const 32) ) ) @@ -655,7 +652,7 @@ (i32.eqz (i32.eqz (call $11 - (global.get $global$10) + (global.get $global$7) ) ) ) @@ -669,7 +666,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$10) + (global.get $global$7) (i64.const 32) ) ) @@ -752,38 +749,29 @@ ) ) ) - (func $16 (; 17 ;) + (func $16 (global.set $global$0 (i64.const 8589934592) ) (global.set $global$1 - (i32.const 4) + (i32.const 15) ) (global.set $global$2 - (i32.const 16) + (i32.const 1073741824) ) (global.set $global$3 - (i32.const 15) + (i32.const 65536) ) (global.set $global$4 - (i32.const 1073741824) + (global.get $global$3) ) (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (i32.const 65536) - ) - (global.set $global$7 - (global.get $global$6) - ) - (global.set $global$8 (i64.const 4294967296) ) - (global.set $global$9 + (global.set $global$6 (i64.const 4294967296) ) - (global.set $global$10 + (global.set $global$7 (i64.const 4294967296) ) ) diff --git a/test/fixtures/compiler/patternMatching.lys.optimized.wast b/test/fixtures/compiler/patternMatching.lys.optimized.wast index e66ad9f1..ffcaddb8 100644 --- a/test/fixtures/compiler/patternMatching.lys.optimized.wast +++ b/test/fixtures/compiler/patternMatching.lys.optimized.wast @@ -14,9 +14,6 @@ (global $global$1 (mut i32) (i32.const 0)) (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test" (func $3)) @@ -24,10 +21,10 @@ (export "test3" (func $5)) (export "test4" (func $6)) (start $7) - (func $0 (; 0 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$3) ) - (func $1 (; 1 ;) (result i32) + (func $1 (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -36,7 +33,7 @@ (if (i32.gt_u (i32.const 4) - (global.get $global$3) + (global.get $global$1) ) (unreachable) ) @@ -45,16 +42,16 @@ (local.tee $1 (i32.and (i32.add - (global.get $global$2) + (global.get $global$0) (i32.add (local.tee $0 - (global.get $global$6) + (global.get $global$3) ) (i32.const 32) ) ) (i32.xor - (global.get $global$2) + (global.get $global$0) (i32.const -1) ) ) @@ -107,7 +104,7 @@ ) ) ) - (global.set $global$6 + (global.set $global$3 (local.get $1) ) (i32.add @@ -115,7 +112,7 @@ (i32.const 16) ) ) - (func $2 (; 2 ;) (param $0 i32) + (func $2 (param $0 i32) (local $1 i32) (local.set $1 (i32.add @@ -147,7 +144,7 @@ ) ) ) - (func $3 (; 3 ;) (param $0 i32) (result i32) + (func $3 (param $0 i32) (result i32) (select (i32.const 0) (i32.const 1) @@ -157,7 +154,7 @@ ) ) ) - (func $4 (; 4 ;) (param $0 i32) (result i32) + (func $4 (param $0 i32) (result i32) (block $label$1 (result i32) (if (i32.ne @@ -259,7 +256,7 @@ (i32.const 1) ) ) - (func $5 (; 5 ;) (param $0 i64) (result i32) + (func $5 (param $0 i64) (result i32) (block $label$1 (result i32) (if (i32.ne @@ -293,7 +290,7 @@ (i32.const 1) ) ) - (func $6 (; 6 ;) (param $0 i64) (result i64) + (func $6 (param $0 i64) (result i64) (local $1 i32) (block $label$1 (result i64) (if @@ -346,27 +343,18 @@ (local.get $0) ) ) - (func $7 (; 7 ;) + (func $7 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 (i32.const 15) ) - (global.set $global$3 + (global.set $global$1 (i32.const 1073741824) ) - (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 + (global.set $global$2 (i32.const 65536) ) - (global.set $global$6 - (global.get $global$5) + (global.set $global$3 + (global.get $global$2) ) ) ) diff --git a/test/fixtures/execution/fibo.lys.optimized.wast b/test/fixtures/execution/fibo.lys.optimized.wast index afc9ab22..a7ae21f1 100644 --- a/test/fixtures/execution/fibo.lys.optimized.wast +++ b/test/fixtures/execution/fibo.lys.optimized.wast @@ -40,19 +40,13 @@ (data (i32.const 183) "\12\00\00\00f\00a\00c\00t\00o\00r\00i\00a\00l") (data (i32.const 206) ":\00\00\00f\00a\00c\00t\00o\00r\00i\00a\00l\00(\001\000\00)\00 \00m\00u\00s\00t\00 \00b\00e\00 \003\006\002\008\008\000\000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i64) (i64.const 0)) + (global $global$1 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $1)) (export "test_getLastErrorMessage" (func $3)) (export "main" (func $7)) (start $8) - (func $0 (; 4 ;) (param $0 i64) (param $1 i32) + (func $0 (param $0 i64) (param $1 i32) (call $fimport$3 (i32.wrap_i64 (local.get $0) @@ -60,10 +54,10 @@ (local.get $1) ) ) - (func $1 (; 5 ;) (result i32) - (global.get $global$6) + (func $1 (result i32) + (global.get $global$0) ) - (func $2 (; 6 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $2 (param $0 i32) (param $1 i32) (param $2 i64) (call $fimport$1 (i32.eq (local.get $0) @@ -90,7 +84,7 @@ ) ) ) - (func $3 (; 7 ;) (result i32) + (func $3 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -100,7 +94,7 @@ (i32.wrap_i64 (i64.shr_u (local.tee $0 - (global.get $global$7) + (global.get $global$1) ) (i64.const 32) ) @@ -118,14 +112,14 @@ ) ) ) - (func $4 (; 8 ;) (param $0 i64) + (func $4 (param $0 i64) (call $fimport$0 (i32.wrap_i64 (local.get $0) ) ) ) - (func $5 (; 9 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $5 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (if (result i32) (i32.gt_s (local.get $0) @@ -145,7 +139,7 @@ (local.get $1) ) ) - (func $6 (; 10 ;) (param $0 i32) (result i32) + (func $6 (param $0 i32) (result i32) (if (result i32) (i32.ge_s (local.get $0) @@ -163,7 +157,7 @@ (i32.const 1) ) ) - (func $7 (; 11 ;) + (func $7 (call $4 (i64.const 12884901904) ) @@ -198,29 +192,11 @@ ) (call $fimport$2) ) - (func $8 (; 12 ;) + (func $8 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 + (global.set $global$1 (i64.const 8589934592) ) ) diff --git a/test/fixtures/execution/implicitCast.lys.optimized.wast b/test/fixtures/execution/implicitCast.lys.optimized.wast index be89d266..732c3d33 100644 --- a/test/fixtures/execution/implicitCast.lys.optimized.wast +++ b/test/fixtures/execution/implicitCast.lys.optimized.wast @@ -35,22 +35,16 @@ (data (i32.const 127) "\0e\00\00\00m\00a\00t\00c\00h\00 \001") (data (i32.const 146) "\10\00\00\000\00.\000\00 \00=\00=\00 \000") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i64) (i64.const 0)) + (global $global$1 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test_getLastErrorMessage" (func $1)) (export "main" (func $3)) (start $4) - (func $0 (; 3 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 4 ;) (result i32) + (func $1 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -60,7 +54,7 @@ (i32.wrap_i64 (i64.shr_u (local.tee $0 - (global.get $global$7) + (global.get $global$1) ) (i64.const 32) ) @@ -78,7 +72,7 @@ ) ) ) - (func $2 (; 5 ;) (param $0 i64) + (func $2 (param $0 i64) (call $fimport$1 (i32.const 1) (i32.wrap_i64 @@ -86,7 +80,7 @@ ) ) ) - (func $3 (; 6 ;) + (func $3 (call $fimport$0 (i32.const 16) ) @@ -104,29 +98,11 @@ ) (call $fimport$2) ) - (func $4 (; 7 ;) + (func $4 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 (i32.const 65536) ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 + (global.set $global$1 (i64.const 8589934592) ) ) diff --git a/test/fixtures/execution/indirect-smoke.lys.optimized.wast b/test/fixtures/execution/indirect-smoke.lys.optimized.wast index 0c10e3aa..06cfa41b 100644 --- a/test/fixtures/execution/indirect-smoke.lys.optimized.wast +++ b/test/fixtures/execution/indirect-smoke.lys.optimized.wast @@ -39,19 +39,13 @@ (data (i32.const 184) "\02\00\00\00A") (data (i32.const 191) "\02\00\00\00B") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i64) (i64.const 0)) + (global $global$1 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $1)) (export "test_getLastErrorMessage" (func $3)) (export "main" (func $5)) (start $6) - (func $0 (; 4 ;) (param $0 i64) (param $1 i32) + (func $0 (param $0 i64) (param $1 i32) (call $fimport$3 (i32.wrap_i64 (local.get $0) @@ -59,10 +53,10 @@ (local.get $1) ) ) - (func $1 (; 5 ;) (result i32) - (global.get $global$6) + (func $1 (result i32) + (global.get $global$0) ) - (func $2 (; 6 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $2 (param $0 i32) (param $1 i32) (param $2 i64) (call $fimport$1 (i32.eq (local.get $0) @@ -89,7 +83,7 @@ ) ) ) - (func $3 (; 7 ;) (result i32) + (func $3 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -99,7 +93,7 @@ (i32.wrap_i64 (i64.shr_u (local.tee $0 - (global.get $global$7) + (global.get $global$1) ) (i64.const 32) ) @@ -117,14 +111,14 @@ ) ) ) - (func $4 (; 8 ;) (param $0 i64) + (func $4 (param $0 i64) (call $fimport$0 (i32.wrap_i64 (local.get $0) ) ) ) - (func $5 (; 9 ;) + (func $5 (call $4 (i64.const 12884901904) ) @@ -154,29 +148,11 @@ ) (call $fimport$2) ) - (func $6 (; 10 ;) + (func $6 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 (i32.const 65536) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 + (global.set $global$1 (i64.const 8589934592) ) ) diff --git a/test/fixtures/execution/is.lys.optimized.wast b/test/fixtures/execution/is.lys.optimized.wast index e1732e51..3c1c5612 100644 --- a/test/fixtures/execution/is.lys.optimized.wast +++ b/test/fixtures/execution/is.lys.optimized.wast @@ -36,22 +36,19 @@ (global $global$1 (mut i32) (i32.const 0)) (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) + (global $global$4 (mut i64) (i64.const 0)) + (global $global$5 (mut i64) (i64.const 0)) + (global $global$6 (mut i64) (i64.const 0)) (global $global$7 (mut i64) (i64.const 0)) - (global $global$8 (mut i64) (i64.const 0)) - (global $global$9 (mut i64) (i64.const 0)) - (global $global$10 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test_getLastErrorMessage" (func $4)) (export "main" (func $9)) (start $10) - (func $0 (; 3 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$3) ) - (func $1 (; 4 ;) (param $0 i32) (result i32) + (func $1 (param $0 i32) (result i32) (local $1 i32) (call $3 (local.tee $1 @@ -63,7 +60,7 @@ ) (local.get $1) ) - (func $2 (; 5 ;) (param $0 i32) (result i32) + (func $2 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -77,7 +74,7 @@ (if (i32.gt_u (local.get $0) - (global.get $global$3) + (global.get $global$1) ) (unreachable) ) @@ -86,11 +83,11 @@ (local.tee $0 (i32.and (i32.add - (global.get $global$2) + (global.get $global$0) (i32.add (i32.add (local.tee $1 - (global.get $global$6) + (global.get $global$3) ) (i32.const 16) ) @@ -105,7 +102,7 @@ ) ) (i32.xor - (global.get $global$2) + (global.get $global$0) (i32.const -1) ) ) @@ -158,7 +155,7 @@ ) ) ) - (global.set $global$6 + (global.set $global$3 (local.get $0) ) (i32.add @@ -166,7 +163,7 @@ (i32.const 16) ) ) - (func $3 (; 6 ;) (param $0 i32) (param $1 i32) + (func $3 (param $0 i32) (param $1 i32) (local.set $1 (i32.add (local.get $0) @@ -197,7 +194,7 @@ ) ) ) - (func $4 (; 7 ;) (result i32) + (func $4 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -207,7 +204,7 @@ (i32.wrap_i64 (i64.shr_u (local.tee $0 - (global.get $global$7) + (global.get $global$4) ) (i64.const 32) ) @@ -225,7 +222,7 @@ ) ) ) - (func $5 (; 8 ;) (param $0 i32) + (func $5 (param $0 i32) (local $1 i64) (call $fimport$1 (local.get $0) @@ -254,14 +251,14 @@ ) (i64.const 12884902532) ) - (global.set $global$7 + (global.set $global$4 (local.get $1) ) (unreachable) ) ) ) - (func $6 (; 9 ;) (param $0 i64) (result i32) + (func $6 (param $0 i64) (result i32) (if (result i32) (i32.eq (i32.wrap_i64 @@ -302,7 +299,7 @@ ) ) ) - (func $7 (; 10 ;) (param $0 i64) (result i32) + (func $7 (param $0 i64) (result i32) (if (result i32) (i32.eq (i32.wrap_i64 @@ -358,7 +355,7 @@ ) ) ) - (func $8 (; 11 ;) (result i64) + (func $8 (result i64) (local $0 i64) (i32.store (i32.wrap_i64 @@ -377,7 +374,7 @@ ) (local.get $0) ) - (func $9 (; 12 ;) + (func $9 (call $fimport$0 (i32.const 16) ) @@ -430,7 +427,7 @@ (i32.eq (i32.wrap_i64 (i64.shr_u - (global.get $global$8) + (global.get $global$5) (i64.const 32) ) ) @@ -442,7 +439,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$8) + (global.get $global$5) (i64.const 32) ) ) @@ -455,7 +452,7 @@ (i32.eqz (i32.eqz (call $6 - (global.get $global$8) + (global.get $global$5) ) ) ) @@ -464,7 +461,7 @@ (i32.eq (i32.wrap_i64 (i64.shr_u - (global.get $global$9) + (global.get $global$6) (i64.const 32) ) ) @@ -476,7 +473,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$9) + (global.get $global$6) (i64.const 32) ) ) @@ -489,7 +486,7 @@ (i32.eqz (i32.eqz (call $6 - (global.get $global$9) + (global.get $global$6) ) ) ) @@ -498,7 +495,7 @@ (i32.eq (i32.wrap_i64 (i64.shr_u - (global.get $global$10) + (global.get $global$7) (i64.const 32) ) ) @@ -510,7 +507,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$10) + (global.get $global$7) (i64.const 32) ) ) @@ -523,7 +520,7 @@ (i32.eqz (i32.eqz (call $6 - (global.get $global$10) + (global.get $global$7) ) ) ) @@ -533,7 +530,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$10) + (global.get $global$7) (i64.const 32) ) ) @@ -595,38 +592,29 @@ ) (call $fimport$2) ) - (func $10 (; 13 ;) + (func $10 (global.set $global$0 - (i32.const 4) + (i32.const 15) ) (global.set $global$1 - (i32.const 16) + (i32.const 1073741824) ) (global.set $global$2 - (i32.const 15) + (i32.const 65536) ) (global.set $global$3 - (i32.const 1073741824) + (global.get $global$2) ) (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 (i64.const 8589934592) ) - (global.set $global$8 + (global.set $global$5 (i64.const 4294967296) ) - (global.set $global$9 + (global.set $global$6 (i64.const 4294967296) ) - (global.set $global$10 + (global.set $global$7 (i64.const 4294967296) ) ) diff --git a/test/fixtures/execution/isPatternMatching.lys.optimized.wast b/test/fixtures/execution/isPatternMatching.lys.optimized.wast index a0f00127..f63a109c 100644 --- a/test/fixtures/execution/isPatternMatching.lys.optimized.wast +++ b/test/fixtures/execution/isPatternMatching.lys.optimized.wast @@ -36,22 +36,19 @@ (global $global$1 (mut i32) (i32.const 0)) (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) + (global $global$4 (mut i64) (i64.const 0)) + (global $global$5 (mut i64) (i64.const 0)) + (global $global$6 (mut i64) (i64.const 0)) (global $global$7 (mut i64) (i64.const 0)) - (global $global$8 (mut i64) (i64.const 0)) - (global $global$9 (mut i64) (i64.const 0)) - (global $global$10 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test_getLastErrorMessage" (func $4)) (export "main" (func $10)) (start $11) - (func $0 (; 3 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$3) ) - (func $1 (; 4 ;) (param $0 i32) (result i32) + (func $1 (param $0 i32) (result i32) (local $1 i32) (call $3 (local.tee $1 @@ -63,7 +60,7 @@ ) (local.get $1) ) - (func $2 (; 5 ;) (param $0 i32) (result i32) + (func $2 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -77,7 +74,7 @@ (if (i32.gt_u (local.get $0) - (global.get $global$3) + (global.get $global$1) ) (unreachable) ) @@ -86,11 +83,11 @@ (local.tee $0 (i32.and (i32.add - (global.get $global$2) + (global.get $global$0) (i32.add (i32.add (local.tee $1 - (global.get $global$6) + (global.get $global$3) ) (i32.const 16) ) @@ -105,7 +102,7 @@ ) ) (i32.xor - (global.get $global$2) + (global.get $global$0) (i32.const -1) ) ) @@ -158,7 +155,7 @@ ) ) ) - (global.set $global$6 + (global.set $global$3 (local.get $0) ) (i32.add @@ -166,7 +163,7 @@ (i32.const 16) ) ) - (func $3 (; 6 ;) (param $0 i32) (param $1 i32) + (func $3 (param $0 i32) (param $1 i32) (local.set $1 (i32.add (local.get $0) @@ -197,7 +194,7 @@ ) ) ) - (func $4 (; 7 ;) (result i32) + (func $4 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -207,7 +204,7 @@ (i32.wrap_i64 (i64.shr_u (local.tee $0 - (global.get $global$7) + (global.get $global$4) ) (i64.const 32) ) @@ -225,7 +222,7 @@ ) ) ) - (func $5 (; 8 ;) (param $0 i32) + (func $5 (param $0 i32) (local $1 i64) (call $fimport$1 (local.get $0) @@ -254,14 +251,14 @@ ) (i64.const 12884902546) ) - (global.set $global$7 + (global.set $global$4 (local.get $1) ) (unreachable) ) ) ) - (func $6 (; 9 ;) (param $0 i64) (result i32) + (func $6 (param $0 i64) (result i32) (if (result i32) (i32.eq (i32.wrap_i64 @@ -302,7 +299,7 @@ ) ) ) - (func $7 (; 10 ;) (param $0 i64) (result i32) + (func $7 (param $0 i64) (result i32) (if (result i32) (i32.eq (i32.wrap_i64 @@ -358,7 +355,7 @@ ) ) ) - (func $8 (; 11 ;) (result i64) + (func $8 (result i64) (local $0 i64) (i32.store (i32.wrap_i64 @@ -377,7 +374,7 @@ ) (local.get $0) ) - (func $9 (; 12 ;) (param $0 i64) (result i32) + (func $9 (param $0 i64) (result i32) (block $label$1 (result i32) (drop (br_if $label$1 @@ -392,7 +389,7 @@ (i32.const 1) ) ) - (func $10 (; 13 ;) + (func $10 (call $fimport$0 (i32.const 16) ) @@ -450,7 +447,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$8) + (global.get $global$5) (i64.const 32) ) ) @@ -469,7 +466,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$8) + (global.get $global$5) (i64.const 32) ) ) @@ -484,7 +481,7 @@ (i32.eqz (i32.eqz (call $9 - (global.get $global$8) + (global.get $global$5) ) ) ) @@ -498,7 +495,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$9) + (global.get $global$6) (i64.const 32) ) ) @@ -517,7 +514,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$9) + (global.get $global$6) (i64.const 32) ) ) @@ -532,7 +529,7 @@ (i32.eqz (i32.eqz (call $9 - (global.get $global$9) + (global.get $global$6) ) ) ) @@ -546,7 +543,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$10) + (global.get $global$7) (i64.const 32) ) ) @@ -565,7 +562,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$10) + (global.get $global$7) (i64.const 32) ) ) @@ -580,7 +577,7 @@ (i32.eqz (i32.eqz (call $9 - (global.get $global$10) + (global.get $global$7) ) ) ) @@ -594,7 +591,7 @@ (i32.ne (i32.wrap_i64 (i64.shr_u - (global.get $global$10) + (global.get $global$7) (i64.const 32) ) ) @@ -692,38 +689,29 @@ ) (call $fimport$2) ) - (func $11 (; 14 ;) + (func $11 (global.set $global$0 - (i32.const 4) + (i32.const 15) ) (global.set $global$1 - (i32.const 16) + (i32.const 1073741824) ) (global.set $global$2 - (i32.const 15) + (i32.const 65536) ) (global.set $global$3 - (i32.const 1073741824) + (global.get $global$2) ) (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 (i64.const 8589934592) ) - (global.set $global$8 + (global.set $global$5 (i64.const 4294967296) ) - (global.set $global$9 + (global.set $global$6 (i64.const 4294967296) ) - (global.set $global$10 + (global.set $global$7 (i64.const 4294967296) ) ) diff --git a/test/fixtures/execution/isPatternMatchingVariable.lys.optimized.wast b/test/fixtures/execution/isPatternMatchingVariable.lys.optimized.wast index ae8d4181..2aa9a35c 100644 --- a/test/fixtures/execution/isPatternMatchingVariable.lys.optimized.wast +++ b/test/fixtures/execution/isPatternMatchingVariable.lys.optimized.wast @@ -35,22 +35,16 @@ (global $global$1 (mut i32) (i32.const 0)) (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i64) (i64.const 0)) - (global $global$8 (mut i64) (i64.const 0)) - (global $global$9 (mut i64) (i64.const 0)) - (global $global$10 (mut i64) (i64.const 0)) + (global $global$4 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test_getLastErrorMessage" (func $3)) (export "main" (func $7)) (start $8) - (func $0 (; 3 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$3) ) - (func $1 (; 4 ;) (result i32) + (func $1 (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -59,7 +53,7 @@ (if (i32.gt_u (i32.const 8) - (global.get $global$3) + (global.get $global$1) ) (unreachable) ) @@ -68,16 +62,16 @@ (local.tee $1 (i32.and (i32.add - (global.get $global$2) + (global.get $global$0) (i32.add (local.tee $0 - (global.get $global$6) + (global.get $global$3) ) (i32.const 32) ) ) (i32.xor - (global.get $global$2) + (global.get $global$0) (i32.const -1) ) ) @@ -130,7 +124,7 @@ ) ) ) - (global.set $global$6 + (global.set $global$3 (local.get $1) ) (i32.add @@ -138,7 +132,7 @@ (i32.const 16) ) ) - (func $2 (; 5 ;) (param $0 i32) + (func $2 (param $0 i32) (local $1 i32) (local.set $1 (i32.add @@ -170,7 +164,7 @@ ) ) ) - (func $3 (; 6 ;) (result i32) + (func $3 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -180,7 +174,7 @@ (i32.wrap_i64 (i64.shr_u (local.tee $0 - (global.get $global$7) + (global.get $global$4) ) (i64.const 32) ) @@ -198,7 +192,7 @@ ) ) ) - (func $4 (; 7 ;) (param $0 i32) + (func $4 (param $0 i32) (local $1 i64) (call $fimport$1 (local.get $0) @@ -230,14 +224,14 @@ ) (i64.const 12884902600) ) - (global.set $global$7 + (global.set $global$4 (local.get $1) ) (unreachable) ) ) ) - (func $5 (; 8 ;) (param $0 i64) (result i32) + (func $5 (param $0 i64) (result i32) (if (result i32) (i32.eq (i32.wrap_i64 @@ -278,7 +272,7 @@ ) ) ) - (func $6 (; 9 ;) (param $0 i64) (result i64) + (func $6 (param $0 i64) (result i64) (block $label$1 (result i64) (if (i32.ne @@ -321,7 +315,7 @@ (local.get $0) ) ) - (func $7 (; 10 ;) + (func $7 (call $fimport$0 (i32.const 16) ) @@ -392,39 +386,21 @@ ) (call $fimport$2) ) - (func $8 (; 11 ;) + (func $8 (global.set $global$0 - (i32.const 4) + (i32.const 15) ) (global.set $global$1 - (i32.const 16) + (i32.const 1073741824) ) (global.set $global$2 - (i32.const 15) + (i32.const 65536) ) (global.set $global$3 - (i32.const 1073741824) + (global.get $global$2) ) (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 (i64.const 8589934592) ) - (global.set $global$8 - (i64.const 4294967296) - ) - (global.set $global$9 - (i64.const 4294967296) - ) - (global.set $global$10 - (i64.const 4294967296) - ) ) ) diff --git a/test/fixtures/execution/numberOps.lys.optimized.wast b/test/fixtures/execution/numberOps.lys.optimized.wast index dfde2bd6..b0ab0298 100644 --- a/test/fixtures/execution/numberOps.lys.optimized.wast +++ b/test/fixtures/execution/numberOps.lys.optimized.wast @@ -49,22 +49,16 @@ (data (i32.const 325) "\0e\00\00\00s\00q\00r\00t\00(\001\00)") (data (i32.const 344) "\0e\00\00\00s\00q\00r\00t\00(\004\00)") (global $global$0 (mut i32) (i32.const 0)) - (global $global$1 (mut i32) (i32.const 0)) - (global $global$2 (mut i32) (i32.const 0)) - (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i64) (i64.const 0)) + (global $global$1 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test_getLastErrorMessage" (func $1)) (export "main" (func $3)) (start $4) - (func $0 (; 3 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$0) ) - (func $1 (; 4 ;) (result i32) + (func $1 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -74,7 +68,7 @@ (i32.wrap_i64 (i64.shr_u (local.tee $0 - (global.get $global$7) + (global.get $global$1) ) (i64.const 32) ) @@ -92,7 +86,7 @@ ) ) ) - (func $2 (; 5 ;) (param $0 i64) + (func $2 (param $0 i64) (call $fimport$1 (i32.const 1) (i32.wrap_i64 @@ -100,7 +94,7 @@ ) ) ) - (func $3 (; 6 ;) + (func $3 (call $fimport$0 (i32.const 16) ) @@ -160,29 +154,11 @@ ) (call $fimport$2) ) - (func $4 (; 7 ;) + (func $4 (global.set $global$0 - (i32.const 4) - ) - (global.set $global$1 - (i32.const 16) - ) - (global.set $global$2 - (i32.const 15) - ) - (global.set $global$3 - (i32.const 1073741824) - ) - (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 (i32.const 65536) ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 + (global.set $global$1 (i64.const 8589934592) ) ) diff --git a/test/fixtures/execution/patternMatchingDeconstruct.lys.optimized.wast b/test/fixtures/execution/patternMatchingDeconstruct.lys.optimized.wast index 2cf570b9..5ff1051f 100644 --- a/test/fixtures/execution/patternMatchingDeconstruct.lys.optimized.wast +++ b/test/fixtures/execution/patternMatchingDeconstruct.lys.optimized.wast @@ -42,19 +42,16 @@ (global $global$1 (mut i32) (i32.const 0)) (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i64) (i64.const 0)) + (global $global$4 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test_getLastErrorMessage" (func $4)) (export "main" (func $7)) (start $8) - (func $0 (; 3 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$3) ) - (func $1 (; 4 ;) (result i32) + (func $1 (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -63,7 +60,7 @@ (if (i32.gt_u (i32.const 12) - (global.get $global$3) + (global.get $global$1) ) (unreachable) ) @@ -72,16 +69,16 @@ (local.tee $1 (i32.and (i32.add - (global.get $global$2) + (global.get $global$0) (i32.add (local.tee $0 - (global.get $global$6) + (global.get $global$3) ) (i32.const 32) ) ) (i32.xor - (global.get $global$2) + (global.get $global$0) (i32.const -1) ) ) @@ -134,7 +131,7 @@ ) ) ) - (global.set $global$6 + (global.set $global$3 (local.get $1) ) (i32.add @@ -142,7 +139,7 @@ (i32.const 16) ) ) - (func $2 (; 5 ;) (param $0 i32) + (func $2 (param $0 i32) (local $1 i32) (local.set $1 (i32.add @@ -174,7 +171,7 @@ ) ) ) - (func $3 (; 6 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $3 (param $0 i32) (param $1 i32) (param $2 i64) (call $fimport$1 (i32.eq (i32.eqz @@ -189,7 +186,7 @@ ) ) ) - (func $4 (; 7 ;) (result i32) + (func $4 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -199,7 +196,7 @@ (i32.wrap_i64 (i64.shr_u (local.tee $0 - (global.get $global$7) + (global.get $global$4) ) (i64.const 32) ) @@ -217,7 +214,7 @@ ) ) ) - (func $5 (; 8 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i64) + (func $5 (param $0 i32) (param $1 i32) (param $2 i32) (result i64) (local $3 i32) (local $4 i64) (call $2 @@ -258,7 +255,7 @@ ) (local.get $4) ) - (func $6 (; 9 ;) (param $0 i64) (result i32) + (func $6 (param $0 i64) (result i32) (block $label$1 (result i32) (if (i32.ne @@ -336,7 +333,7 @@ (i32.const 1) ) ) - (func $7 (; 10 ;) + (func $7 (call $fimport$0 (i32.const 16) ) @@ -396,29 +393,20 @@ ) (call $fimport$2) ) - (func $8 (; 11 ;) + (func $8 (global.set $global$0 - (i32.const 4) + (i32.const 15) ) (global.set $global$1 - (i32.const 16) + (i32.const 1073741824) ) (global.set $global$2 - (i32.const 15) + (i32.const 65536) ) (global.set $global$3 - (i32.const 1073741824) + (global.get $global$2) ) (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 (i64.const 8589934592) ) ) diff --git a/test/fixtures/execution/recursiveStruct.lys.optimized.wast b/test/fixtures/execution/recursiveStruct.lys.optimized.wast index 08715bf9..60de4369 100644 --- a/test/fixtures/execution/recursiveStruct.lys.optimized.wast +++ b/test/fixtures/execution/recursiveStruct.lys.optimized.wast @@ -41,19 +41,16 @@ (global $global$1 (mut i32) (i32.const 0)) (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i64) (i64.const 0)) + (global $global$4 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test_getLastErrorMessage" (func $4)) (export "main" (func $8)) (start $9) - (func $0 (; 3 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$3) ) - (func $1 (; 4 ;) (result i32) + (func $1 (result i32) (local $0 i32) (call $3 (local.tee $0 @@ -62,7 +59,7 @@ ) (local.get $0) ) - (func $2 (; 5 ;) (result i32) + (func $2 (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -71,7 +68,7 @@ (if (i32.gt_u (i32.const 8) - (global.get $global$3) + (global.get $global$1) ) (unreachable) ) @@ -80,16 +77,16 @@ (local.tee $1 (i32.and (i32.add - (global.get $global$2) + (global.get $global$0) (i32.add (local.tee $0 - (global.get $global$6) + (global.get $global$3) ) (i32.const 32) ) ) (i32.xor - (global.get $global$2) + (global.get $global$0) (i32.const -1) ) ) @@ -142,7 +139,7 @@ ) ) ) - (global.set $global$6 + (global.set $global$3 (local.get $1) ) (i32.add @@ -150,7 +147,7 @@ (i32.const 16) ) ) - (func $3 (; 6 ;) (param $0 i32) + (func $3 (param $0 i32) (local $1 i32) (local.set $1 (i32.add @@ -182,7 +179,7 @@ ) ) ) - (func $4 (; 7 ;) (result i32) + (func $4 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -192,7 +189,7 @@ (i32.wrap_i64 (i64.shr_u (local.tee $0 - (global.get $global$7) + (global.get $global$4) ) (i64.const 32) ) @@ -210,7 +207,7 @@ ) ) ) - (func $5 (; 8 ;) (param $0 i32) (param $1 i64) + (func $5 (param $0 i32) (param $1 i64) (call $fimport$1 (local.get $0) (i32.wrap_i64 @@ -218,7 +215,7 @@ ) ) ) - (func $6 (; 9 ;) (param $0 i64) (result i64) + (func $6 (param $0 i64) (result i64) (local $1 i64) (i64.store (i32.wrap_i64 @@ -235,7 +232,7 @@ ) (local.get $1) ) - (func $7 (; 10 ;) (param $0 i64) (result i64) + (func $7 (param $0 i64) (result i64) (local $1 i64) (i64.store (i32.wrap_i64 @@ -252,7 +249,7 @@ ) (local.get $1) ) - (func $8 (; 11 ;) + (func $8 (local $0 i64) (local $1 i64) (local $2 i64) @@ -372,29 +369,20 @@ ) (call $fimport$2) ) - (func $9 (; 12 ;) + (func $9 (global.set $global$0 - (i32.const 4) + (i32.const 15) ) (global.set $global$1 - (i32.const 16) + (i32.const 1073741824) ) (global.set $global$2 - (i32.const 15) + (i32.const 65536) ) (global.set $global$3 - (i32.const 1073741824) + (global.get $global$2) ) (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 (i64.const 8589934592) ) ) diff --git a/test/fixtures/execution/setStructValues.lys.optimized.wast b/test/fixtures/execution/setStructValues.lys.optimized.wast index 3cf99ced..9845ae31 100644 --- a/test/fixtures/execution/setStructValues.lys.optimized.wast +++ b/test/fixtures/execution/setStructValues.lys.optimized.wast @@ -82,21 +82,18 @@ (global $global$1 (mut i32) (i32.const 0)) (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i64) (i64.const 0)) - (global $global$8 (mut i64) (i64.const 0)) - (global $global$9 (mut i64) (i64.const 0)) + (global $global$4 (mut i64) (i64.const 0)) + (global $global$5 (mut i64) (i64.const 0)) + (global $global$6 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test_getLastErrorMessage" (func $9)) (export "main" (func $17)) (start $18) - (func $0 (; 5 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$3) ) - (func $1 (; 6 ;) (param $0 i32) (result i32) + (func $1 (param $0 i32) (result i32) (local $1 i32) (call $3 (local.tee $1 @@ -108,7 +105,7 @@ ) (local.get $1) ) - (func $2 (; 7 ;) (param $0 i32) (result i32) + (func $2 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -122,7 +119,7 @@ (if (i32.gt_u (local.get $0) - (global.get $global$3) + (global.get $global$1) ) (unreachable) ) @@ -131,11 +128,11 @@ (local.tee $0 (i32.and (i32.add - (global.get $global$2) + (global.get $global$0) (i32.add (i32.add (local.tee $1 - (global.get $global$6) + (global.get $global$3) ) (i32.const 16) ) @@ -150,7 +147,7 @@ ) ) (i32.xor - (global.get $global$2) + (global.get $global$0) (i32.const -1) ) ) @@ -203,7 +200,7 @@ ) ) ) - (global.set $global$6 + (global.set $global$3 (local.get $0) ) (i32.add @@ -211,7 +208,7 @@ (i32.const 16) ) ) - (func $3 (; 8 ;) (param $0 i32) (param $1 i32) + (func $3 (param $0 i32) (param $1 i32) (local.set $1 (i32.add (local.get $0) @@ -242,7 +239,7 @@ ) ) ) - (func $4 (; 9 ;) (param $0 i64) (param $1 i32) + (func $4 (param $0 i64) (param $1 i32) (call $fimport$4 (i32.wrap_i64 (local.get $0) @@ -250,7 +247,7 @@ (local.get $1) ) ) - (func $5 (; 10 ;) (param $0 i64) + (func $5 (param $0 i64) (call $11 (i64.eq (local.get $0) @@ -290,7 +287,7 @@ ) ) ) - (func $6 (; 11 ;) (param $0 i64) (param $1 i64) (param $2 i64) + (func $6 (param $0 i64) (param $1 i64) (param $2 i64) (call $11 (i64.eq (local.get $0) @@ -337,7 +334,7 @@ ) ) ) - (func $7 (; 12 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $7 (param $0 i32) (param $1 i32) (param $2 i64) (call $11 (i32.eq (local.get $0) @@ -362,7 +359,7 @@ ) ) ) - (func $8 (; 13 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $8 (param $0 i32) (param $1 i32) (param $2 i64) (call $11 (i32.eq (local.get $0) @@ -387,7 +384,7 @@ ) ) ) - (func $9 (; 14 ;) (result i32) + (func $9 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -397,7 +394,7 @@ (i32.wrap_i64 (i64.shr_u (local.tee $0 - (global.get $global$7) + (global.get $global$4) ) (i64.const 32) ) @@ -415,14 +412,14 @@ ) ) ) - (func $10 (; 15 ;) (param $0 i64) + (func $10 (param $0 i64) (call $fimport$1 (i32.wrap_i64 (local.get $0) ) ) ) - (func $11 (; 16 ;) (param $0 i32) (param $1 i64) + (func $11 (param $0 i32) (param $1 i64) (call $fimport$2 (local.get $0) (i32.wrap_i64 @@ -430,7 +427,7 @@ ) ) ) - (func $12 (; 17 ;) (param $0 i64) (result i32) + (func $12 (param $0 i64) (result i32) (if (result i32) (i32.eq (i32.wrap_i64 @@ -471,7 +468,7 @@ ) ) ) - (func $13 (; 18 ;) (result i64) + (func $13 (result i64) (local $0 i64) (i64.store (i32.wrap_i64 @@ -499,7 +496,7 @@ ) (local.get $0) ) - (func $14 (; 19 ;) (result i64) + (func $14 (result i64) (local $0 i64) (i32.store (i32.wrap_i64 @@ -527,26 +524,26 @@ ) (local.get $0) ) - (func $15 (; 20 ;) + (func $15 (call $10 (i64.const 12884901999) ) (i32.store (i32.wrap_i64 - (global.get $global$8) + (global.get $global$5) ) (i32.const 3) ) (i32.store (i32.wrap_i64 - (global.get $global$9) + (global.get $global$6) ) (i32.const -1412567295) ) (i32.store (i32.add (i32.wrap_i64 - (global.get $global$9) + (global.get $global$6) ) (i32.const 5) ) @@ -554,7 +551,7 @@ ) (call $fimport$3) ) - (func $16 (; 21 ;) + (func $16 (call $10 (i64.const 12884902022) ) @@ -574,7 +571,7 @@ (call $8 (i32.load (i32.wrap_i64 - (global.get $global$8) + (global.get $global$5) ) ) (i32.const 0) @@ -583,7 +580,7 @@ (call $8 (i32.load (i32.wrap_i64 - (global.get $global$9) + (global.get $global$6) ) ) (i32.const 0) @@ -595,7 +592,7 @@ (i64.const 12884902151) (i32.load (i32.wrap_i64 - (global.get $global$8) + (global.get $global$5) ) ) ) @@ -603,7 +600,7 @@ (i64.const 12884902184) (i32.load (i32.wrap_i64 - (global.get $global$9) + (global.get $global$6) ) ) ) @@ -615,7 +612,7 @@ (call $8 (i32.load (i32.wrap_i64 - (global.get $global$8) + (global.get $global$5) ) ) (i32.const 3) @@ -624,7 +621,7 @@ (call $7 (i32.load (i32.wrap_i64 - (global.get $global$9) + (global.get $global$6) ) ) (i32.const -1412567295) @@ -633,7 +630,7 @@ (call $8 (i32.load (i32.wrap_i64 - (global.get $global$9) + (global.get $global$6) ) ) (i32.const -1412567295) @@ -643,7 +640,7 @@ (i64.extend_i32_s (i32.load (i32.wrap_i64 - (global.get $global$9) + (global.get $global$6) ) ) ) @@ -654,7 +651,7 @@ (i64.extend_i32_s (i32.load (i32.wrap_i64 - (global.get $global$9) + (global.get $global$6) ) ) ) @@ -665,7 +662,7 @@ (i64.extend_i32_s (i32.load (i32.wrap_i64 - (global.get $global$9) + (global.get $global$6) ) ) ) @@ -673,7 +670,7 @@ (call $8 (i32.load8_u (i32.wrap_i64 - (global.get $global$9) + (global.get $global$6) ) ) (i32.const 1) @@ -683,7 +680,7 @@ (i32.load8_u (i32.add (i32.wrap_i64 - (global.get $global$9) + (global.get $global$6) ) (i32.const 5) ) @@ -693,7 +690,7 @@ ) (call $fimport$3) ) - (func $17 (; 22 ;) + (func $17 (local $0 i32) (local $1 i64) (local $2 i64) @@ -1005,35 +1002,26 @@ (call $16) (call $fimport$3) ) - (func $18 (; 23 ;) + (func $18 (global.set $global$0 - (i32.const 4) + (i32.const 15) ) (global.set $global$1 - (i32.const 16) + (i32.const 1073741824) ) (global.set $global$2 - (i32.const 15) + (i32.const 65536) ) (global.set $global$3 - (i32.const 1073741824) + (global.get $global$2) ) (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 (i64.const 8589934592) ) - (global.set $global$8 + (global.set $global$5 (call $14) ) - (global.set $global$9 + (global.set $global$6 (call $14) ) ) diff --git a/test/fixtures/execution/simpleIterator.lys.optimized.wast b/test/fixtures/execution/simpleIterator.lys.optimized.wast index 1ea6fe49..d2bb725c 100644 --- a/test/fixtures/execution/simpleIterator.lys.optimized.wast +++ b/test/fixtures/execution/simpleIterator.lys.optimized.wast @@ -39,16 +39,13 @@ (global $global$1 (mut i32) (i32.const 0)) (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i64) (i64.const 0)) + (global $global$4 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $1)) (export "test_getLastErrorMessage" (func $6)) (export "main" (func $10)) (start $11) - (func $0 (; 4 ;) (param $0 i64) (param $1 i32) + (func $0 (param $0 i64) (param $1 i32) (call $fimport$3 (i32.wrap_i64 (local.get $0) @@ -56,10 +53,10 @@ (local.get $1) ) ) - (func $1 (; 5 ;) (result i32) - (global.get $global$6) + (func $1 (result i32) + (global.get $global$3) ) - (func $2 (; 6 ;) (param $0 i32) (result i32) + (func $2 (param $0 i32) (result i32) (local $1 i32) (call $4 (local.tee $1 @@ -71,7 +68,7 @@ ) (local.get $1) ) - (func $3 (; 7 ;) (param $0 i32) (result i32) + (func $3 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -85,7 +82,7 @@ (if (i32.gt_u (local.get $0) - (global.get $global$3) + (global.get $global$1) ) (unreachable) ) @@ -94,11 +91,11 @@ (local.tee $0 (i32.and (i32.add - (global.get $global$2) + (global.get $global$0) (i32.add (i32.add (local.tee $1 - (global.get $global$6) + (global.get $global$3) ) (i32.const 16) ) @@ -113,7 +110,7 @@ ) ) (i32.xor - (global.get $global$2) + (global.get $global$0) (i32.const -1) ) ) @@ -166,7 +163,7 @@ ) ) ) - (global.set $global$6 + (global.set $global$3 (local.get $0) ) (i32.add @@ -174,7 +171,7 @@ (i32.const 16) ) ) - (func $4 (; 8 ;) (param $0 i32) (param $1 i32) + (func $4 (param $0 i32) (param $1 i32) (local.set $1 (i32.add (local.get $0) @@ -205,7 +202,7 @@ ) ) ) - (func $5 (; 9 ;) (param $0 i32) + (func $5 (param $0 i32) (call $fimport$1 (i32.eq (local.get $0) @@ -230,7 +227,7 @@ ) ) ) - (func $6 (; 10 ;) (result i32) + (func $6 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -240,7 +237,7 @@ (i32.wrap_i64 (i64.shr_u (local.tee $0 - (global.get $global$7) + (global.get $global$4) ) (i64.const 32) ) @@ -258,7 +255,7 @@ ) ) ) - (func $7 (; 11 ;) (result i64) + (func $7 (result i64) (local $0 i64) (i32.store (i32.wrap_i64 @@ -286,7 +283,7 @@ ) (local.get $0) ) - (func $8 (; 12 ;) (param $0 i64) (result i64) + (func $8 (param $0 i64) (result i64) (local $1 i32) (local $2 i64) (if (result i64) @@ -346,7 +343,7 @@ (i64.const 8589934592) ) ) - (func $9 (; 13 ;) (result i32) + (func $9 (result i32) (local $0 i32) (local $1 i64) (local $2 i64) @@ -385,7 +382,7 @@ ) (local.get $0) ) - (func $10 (; 14 ;) + (func $10 (call $fimport$0 (i32.const 16) ) @@ -394,29 +391,20 @@ ) (call $fimport$2) ) - (func $11 (; 15 ;) + (func $11 (global.set $global$0 - (i32.const 4) + (i32.const 15) ) (global.set $global$1 - (i32.const 16) + (i32.const 1073741824) ) (global.set $global$2 - (i32.const 15) + (i32.const 65536) ) (global.set $global$3 - (i32.const 1073741824) + (global.get $global$2) ) (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 (i64.const 8589934592) ) ) diff --git a/test/fixtures/execution/strConcat.lys.optimized.wast b/test/fixtures/execution/strConcat.lys.optimized.wast index 0814e27d..5e759532 100644 --- a/test/fixtures/execution/strConcat.lys.optimized.wast +++ b/test/fixtures/execution/strConcat.lys.optimized.wast @@ -82,16 +82,13 @@ (global $global$1 (mut i32) (i32.const 0)) (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i64) (i64.const 0)) + (global $global$4 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $3)) (export "test_getLastErrorMessage" (func $10)) (export "main" (func $18)) (start $19) - (func $0 (; 5 ;) (param $0 i64) + (func $0 (param $0 i64) (call $fimport$3 (i32.wrap_i64 (local.get $0) @@ -99,7 +96,7 @@ (i32.const 0) ) ) - (func $1 (; 6 ;) (param $0 i64) (param $1 i32) + (func $1 (param $0 i64) (param $1 i32) (call $fimport$3 (i32.wrap_i64 (local.get $0) @@ -107,7 +104,7 @@ (local.get $1) ) ) - (func $2 (; 7 ;) (param $0 i64) (param $1 f64) + (func $2 (param $0 i64) (param $1 f64) (call $fimport$4 (i32.wrap_i64 (local.get $0) @@ -115,10 +112,10 @@ (local.get $1) ) ) - (func $3 (; 8 ;) (result i32) - (global.get $global$6) + (func $3 (result i32) + (global.get $global$3) ) - (func $4 (; 9 ;) (param $0 i32) (result i32) + (func $4 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -132,7 +129,7 @@ (if (i32.gt_u (local.get $0) - (global.get $global$3) + (global.get $global$1) ) (unreachable) ) @@ -141,11 +138,11 @@ (local.tee $0 (i32.and (i32.add - (global.get $global$2) + (global.get $global$0) (i32.add (i32.add (local.tee $1 - (global.get $global$6) + (global.get $global$3) ) (i32.const 16) ) @@ -160,7 +157,7 @@ ) ) (i32.xor - (global.get $global$2) + (global.get $global$0) (i32.const -1) ) ) @@ -213,7 +210,7 @@ ) ) ) - (global.set $global$6 + (global.set $global$3 (local.get $0) ) (i32.add @@ -221,7 +218,7 @@ (i32.const 16) ) ) - (func $5 (; 10 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $5 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i64) (local $5 i64) @@ -273,7 +270,7 @@ (local.get $2) ) ) - (func $6 (; 11 ;) (param $0 i32) (param $1 i32) + (func $6 (param $0 i32) (param $1 i32) (local.set $1 (i32.add (local.get $0) @@ -304,7 +301,7 @@ ) ) ) - (func $7 (; 12 ;) (param $0 f64) (param $1 f64) (param $2 i64) + (func $7 (param $0 f64) (param $1 f64) (param $2 i64) (call $12 (f64.eq (local.get $0) @@ -329,7 +326,7 @@ ) ) ) - (func $8 (; 13 ;) (param $0 i32) (param $1 i32) (param $2 i64) + (func $8 (param $0 i32) (param $1 i32) (param $2 i64) (call $12 (i32.eq (local.get $0) @@ -354,7 +351,7 @@ ) ) ) - (func $9 (; 14 ;) (param $0 i64) (param $1 i64) (param $2 i64) + (func $9 (param $0 i64) (param $1 i64) (param $2 i64) (call $12 (call $16 (local.get $0) @@ -381,7 +378,7 @@ ) ) ) - (func $10 (; 15 ;) (result i32) + (func $10 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -391,7 +388,7 @@ (i32.wrap_i64 (i64.shr_u (local.tee $0 - (global.get $global$7) + (global.get $global$4) ) (i64.const 32) ) @@ -409,14 +406,14 @@ ) ) ) - (func $11 (; 16 ;) (param $0 i64) + (func $11 (param $0 i64) (call $fimport$0 (i32.wrap_i64 (local.get $0) ) ) ) - (func $12 (; 17 ;) (param $0 i32) (param $1 i64) + (func $12 (param $0 i32) (param $1 i64) (call $fimport$1 (local.get $0) (i32.wrap_i64 @@ -424,23 +421,23 @@ ) ) ) - (func $13 (; 18 ;) (param $0 i64) (param $1 i64) (result i64) + (func $13 (param $0 i64) (param $1 i64) (result i64) (call $15 (local.get $0) (local.get $1) ) ) - (func $14 (; 19 ;) (param $0 i64) (param $1 i32) (result i32) + (func $14 (param $0 i64) (param $1 i32) (result i32) (if (i32.gt_u (local.get $1) - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (local.get $0) ) ) - (i32.const 2) + (i32.const 1) ) ) (unreachable) @@ -471,7 +468,7 @@ ) ) ) - (func $15 (; 20 ;) (param $0 i64) (param $1 i64) (result i64) + (func $15 (param $0 i64) (param $1 i64) (result i64) (local $2 i32) (local $3 i32) (local $4 i64) @@ -485,26 +482,26 @@ (i32.add (local.tee $2 (i32.shl - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (local.get $0) ) ) - (i32.const 2) + (i32.const 1) ) (i32.const 1) ) ) (local.tee $3 (i32.shl - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (local.get $1) ) ) - (i32.const 2) + (i32.const 1) ) (i32.const 1) ) @@ -540,26 +537,26 @@ (i64.const 12884901888) ) ) - (func $16 (; 21 ;) (param $0 i64) (param $1 i64) (result i32) + (func $16 (param $0 i64) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (if (result i32) (i32.eq - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (local.get $0) ) ) - (i32.const 2) + (i32.const 1) ) - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (local.get $1) ) ) - (i32.const 2) + (i32.const 1) ) ) (if (result i32) @@ -574,13 +571,13 @@ (i32.const 1) (block (result i32) (local.set $2 - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (local.get $0) ) ) - (i32.const 2) + (i32.const 1) ) ) (local.set $3 @@ -631,7 +628,7 @@ (i32.const 0) ) ) - (func $17 (; 22 ;) (param $0 i32) (result i64) + (func $17 (param $0 i32) (result i64) (local $1 i32) (local $2 i32) (call $6 @@ -658,7 +655,7 @@ (i64.const 38654705664) ) ) - (func $18 (; 23 ;) + (func $18 (local $0 i64) (local $1 i64) (call $11 @@ -671,33 +668,33 @@ ) ) (call $8 - (i32.div_u + (i32.shr_u (i32.load (i32.const 67) ) - (i32.const 2) + (i32.const 1) ) (i32.const 3) (i64.const 12884901979) ) (call $8 - (i32.div_u + (i32.shr_u (i32.load (i32.const 78) ) - (i32.const 2) + (i32.const 1) ) (i32.const 4) (i64.const 12884902010) ) (call $8 - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (local.get $0) ) ) - (i32.const 2) + (i32.const 1) ) (i32.const 7) (i64.const 12884902041) @@ -719,13 +716,13 @@ (i64.const 12884902151) ) (call $8 - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (local.get $1) ) ) - (i32.const 2) + (i32.const 1) ) (i32.const 14) (i64.const 12884902192) @@ -740,11 +737,11 @@ (i64.const 12884902258) ) (call $8 - (i32.div_u + (i32.shr_u (i32.load (i32.const 419) ) - (i32.const 2) + (i32.const 1) ) (i32.const 6) (i64.const 12884902324) @@ -814,7 +811,7 @@ (i64.const 12884902497) ) (call $8 - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (call $13 @@ -823,7 +820,7 @@ ) ) ) - (i32.const 2) + (i32.const 1) ) (i32.const 4) (i64.const 12884902560) @@ -833,7 +830,7 @@ (i64.const 12884902611) ) (call $8 - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (local.tee $0 @@ -844,7 +841,7 @@ ) ) ) - (i32.const 2) + (i32.const 1) ) (i32.const 5) (i64.const 12884902688) @@ -891,29 +888,20 @@ ) (call $fimport$2) ) - (func $19 (; 24 ;) + (func $19 (global.set $global$0 - (i32.const 4) + (i32.const 15) ) (global.set $global$1 - (i32.const 16) + (i32.const 1073741824) ) (global.set $global$2 - (i32.const 15) + (i32.const 65536) ) (global.set $global$3 - (i32.const 1073741824) + (global.get $global$2) ) (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 (i64.const 8589934592) ) ) diff --git a/test/fixtures/execution/stringifyNumbers.lys.optimized.wast b/test/fixtures/execution/stringifyNumbers.lys.optimized.wast index 21b67f93..98f64cb6 100644 --- a/test/fixtures/execution/stringifyNumbers.lys.optimized.wast +++ b/test/fixtures/execution/stringifyNumbers.lys.optimized.wast @@ -71,19 +71,16 @@ (global $global$1 (mut i32) (i32.const 0)) (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i64) (i64.const 0)) + (global $global$4 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test_getLastErrorMessage" (func $6)) (export "main" (func $24)) (start $25) - (func $0 (; 4 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$3) ) - (func $1 (; 5 ;) (param $0 i32) (result i32) + (func $1 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -97,7 +94,7 @@ (if (i32.gt_u (local.get $0) - (global.get $global$3) + (global.get $global$1) ) (unreachable) ) @@ -106,11 +103,11 @@ (local.tee $0 (i32.and (i32.add - (global.get $global$2) + (global.get $global$0) (i32.add (i32.add (local.tee $1 - (global.get $global$6) + (global.get $global$3) ) (i32.const 16) ) @@ -125,7 +122,7 @@ ) ) (i32.xor - (global.get $global$2) + (global.get $global$0) (i32.const -1) ) ) @@ -178,7 +175,7 @@ ) ) ) - (global.set $global$6 + (global.set $global$3 (local.get $0) ) (i32.add @@ -186,7 +183,7 @@ (i32.const 16) ) ) - (func $2 (; 6 ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) + (func $2 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) (local $4 i64) (local $5 i64) @@ -238,7 +235,7 @@ (local.get $2) ) ) - (func $3 (; 7 ;) (param $0 i32) (param $1 i32) + (func $3 (param $0 i32) (param $1 i32) (local.set $1 (i32.add (local.get $0) @@ -269,7 +266,7 @@ ) ) ) - (func $4 (; 8 ;) (param $0 i64) (param $1 i32) + (func $4 (param $0 i64) (param $1 i32) (call $fimport$3 (i32.wrap_i64 (local.get $0) @@ -277,13 +274,13 @@ (local.get $1) ) ) - (func $5 (; 9 ;) (param $0 i64) + (func $5 (param $0 i64) (call $4 (local.get $0) (i32.const 0) ) ) - (func $6 (; 10 ;) (result i32) + (func $6 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -293,7 +290,7 @@ (i32.wrap_i64 (i64.shr_u (local.tee $0 - (global.get $global$7) + (global.get $global$4) ) (i64.const 32) ) @@ -311,14 +308,14 @@ ) ) ) - (func $7 (; 11 ;) (param $0 i64) + (func $7 (param $0 i64) (call $fimport$0 (i32.wrap_i64 (local.get $0) ) ) ) - (func $8 (; 12 ;) (param $0 i32) (param $1 i64) + (func $8 (param $0 i32) (param $1 i64) (call $fimport$1 (local.get $0) (i32.wrap_i64 @@ -326,7 +323,7 @@ ) ) ) - (func $9 (; 13 ;) (param $0 i32) (result i64) + (func $9 (param $0 i32) (result i64) (local $1 i32) (local $2 i32) (call $3 @@ -353,23 +350,23 @@ (i64.const 38654705664) ) ) - (func $10 (; 14 ;) (param $0 i64) (param $1 i64) (result i64) + (func $10 (param $0 i64) (param $1 i64) (result i64) (call $12 (local.get $0) (local.get $1) ) ) - (func $11 (; 15 ;) (param $0 i64) (param $1 i32) (result i32) + (func $11 (param $0 i64) (param $1 i32) (result i32) (if (i32.gt_u (local.get $1) - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (local.get $0) ) ) - (i32.const 2) + (i32.const 1) ) ) (unreachable) @@ -400,7 +397,7 @@ ) ) ) - (func $12 (; 16 ;) (param $0 i64) (param $1 i64) (result i64) + (func $12 (param $0 i64) (param $1 i64) (result i64) (local $2 i32) (local $3 i32) (local $4 i64) @@ -414,26 +411,26 @@ (i32.add (local.tee $2 (i32.shl - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (local.get $0) ) ) - (i32.const 2) + (i32.const 1) ) (i32.const 1) ) ) (local.tee $3 (i32.shl - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (local.get $1) ) ) - (i32.const 2) + (i32.const 1) ) (i32.const 1) ) @@ -469,26 +466,26 @@ (i64.const 12884901888) ) ) - (func $13 (; 17 ;) (param $0 i64) (param $1 i64) (result i32) + (func $13 (param $0 i64) (param $1 i64) (result i32) (local $2 i32) (local $3 i32) (if (result i32) (i32.eq - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (local.get $0) ) ) - (i32.const 2) + (i32.const 1) ) - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (local.get $1) ) ) - (i32.const 2) + (i32.const 1) ) ) (if (result i32) @@ -503,13 +500,13 @@ (i32.const 1) (block (result i32) (local.set $2 - (i32.div_u + (i32.shr_u (i32.load (i32.wrap_i64 (local.get $0) ) ) - (i32.const 2) + (i32.const 1) ) ) (local.set $3 @@ -560,7 +557,7 @@ (i32.const 0) ) ) - (func $14 (; 18 ;) (param $0 i64) (result i32) + (func $14 (param $0 i64) (result i32) (local $1 i32) (if (result i32) (i64.eqz @@ -578,9 +575,9 @@ (i32.const 1) ) (local.set $0 - (i64.mul + (i64.sub + (i64.const 0) (local.get $0) - (i64.const -1) ) ) ) @@ -608,7 +605,7 @@ ) ) ) - (func $15 (; 19 ;) (param $0 i64) (result i32) + (func $15 (param $0 i64) (result i32) (local $1 i32) (if (result i32) (i64.eqz @@ -639,7 +636,7 @@ ) ) ) - (func $16 (; 20 ;) (param $0 i64) (param $1 i64) (param $2 i32) + (func $16 (param $0 i64) (param $1 i64) (param $2 i32) (local $3 i32) (local $4 i32) (local $5 i64) @@ -721,7 +718,7 @@ ) ) ) - (func $17 (; 21 ;) (param $0 i64) (result i64) + (func $17 (param $0 i64) (result i64) (local $1 i32) (local $2 i64) (if (result i64) @@ -754,9 +751,9 @@ ) (call $16 (local.get $2) - (i64.mul + (i64.sub + (i64.const 0) (local.get $0) - (i64.const -1) ) (local.get $1) ) @@ -790,7 +787,7 @@ ) ) ) - (func $18 (; 22 ;) (param $0 i64) (result i64) + (func $18 (param $0 i64) (result i64) (local $1 i32) (local $2 i64) (if (result i64) @@ -825,7 +822,7 @@ ) ) ) - (func $19 (; 23 ;) (param $0 i64) (param $1 i64) + (func $19 (param $0 i64) (param $1 i64) (call $23 (call $18 (local.get $0) @@ -833,7 +830,7 @@ (local.get $1) ) ) - (func $20 (; 24 ;) (param $0 i32) (param $1 i64) + (func $20 (param $0 i32) (param $1 i64) (call $23 (call $17 (i64.extend_i32_s @@ -843,7 +840,7 @@ (local.get $1) ) ) - (func $21 (; 25 ;) (param $0 i32) (param $1 i64) + (func $21 (param $0 i32) (param $1 i64) (call $19 (i64.extend_i32_u (local.get $0) @@ -851,7 +848,7 @@ (local.get $1) ) ) - (func $22 (; 26 ;) (param $0 i64) (param $1 i32) + (func $22 (param $0 i64) (param $1 i32) (local $2 i32) (local $3 i32) (if @@ -891,7 +888,7 @@ (i64.const 12884902003) ) ) - (func $23 (; 27 ;) (param $0 i64) (param $1 i64) + (func $23 (param $0 i64) (param $1 i64) (local $2 i32) (local $3 i64) (local.set $3 @@ -940,7 +937,7 @@ (local.get $3) ) ) - (func $24 (; 28 ;) + (func $24 (call $7 (i64.const 12884902143) ) @@ -1062,29 +1059,20 @@ (call $fimport$2) (call $fimport$2) ) - (func $25 (; 29 ;) + (func $25 (global.set $global$0 - (i32.const 4) + (i32.const 15) ) (global.set $global$1 - (i32.const 16) + (i32.const 1073741824) ) (global.set $global$2 - (i32.const 15) + (i32.const 65536) ) (global.set $global$3 - (i32.const 1073741824) + (global.get $global$2) ) (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 (i64.const 8589934592) ) ) diff --git a/test/fixtures/execution/structValuesExtended.lys.optimized.wast b/test/fixtures/execution/structValuesExtended.lys.optimized.wast index c8739bc5..b768b68c 100644 --- a/test/fixtures/execution/structValuesExtended.lys.optimized.wast +++ b/test/fixtures/execution/structValuesExtended.lys.optimized.wast @@ -62,19 +62,16 @@ (global $global$1 (mut i32) (i32.const 0)) (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) - (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i64) (i64.const 0)) + (global $global$4 (mut i64) (i64.const 0)) (export "memory" (memory $0)) (export "test_getMaxMemory" (func $0)) (export "test_getLastErrorMessage" (func $4)) (export "main" (func $8)) (start $9) - (func $0 (; 5 ;) (result i32) - (global.get $global$6) + (func $0 (result i32) + (global.get $global$3) ) - (func $1 (; 6 ;) (param $0 i32) (result i32) + (func $1 (param $0 i32) (result i32) (local $1 i32) (call $3 (local.tee $1 @@ -86,7 +83,7 @@ ) (local.get $1) ) - (func $2 (; 7 ;) (param $0 i32) (result i32) + (func $2 (param $0 i32) (result i32) (local $1 i32) (local $2 i32) (local $3 i32) @@ -100,7 +97,7 @@ (if (i32.gt_u (local.get $0) - (global.get $global$3) + (global.get $global$1) ) (unreachable) ) @@ -109,11 +106,11 @@ (local.tee $0 (i32.and (i32.add - (global.get $global$2) + (global.get $global$0) (i32.add (i32.add (local.tee $1 - (global.get $global$6) + (global.get $global$3) ) (i32.const 16) ) @@ -128,7 +125,7 @@ ) ) (i32.xor - (global.get $global$2) + (global.get $global$0) (i32.const -1) ) ) @@ -181,7 +178,7 @@ ) ) ) - (global.set $global$6 + (global.set $global$3 (local.get $0) ) (i32.add @@ -189,7 +186,7 @@ (i32.const 16) ) ) - (func $3 (; 8 ;) (param $0 i32) (param $1 i32) + (func $3 (param $0 i32) (param $1 i32) (local.set $1 (i32.add (local.get $0) @@ -220,7 +217,7 @@ ) ) ) - (func $4 (; 9 ;) (result i32) + (func $4 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -230,7 +227,7 @@ (i32.wrap_i64 (i64.shr_u (local.tee $0 - (global.get $global$7) + (global.get $global$4) ) (i64.const 32) ) @@ -248,7 +245,7 @@ ) ) ) - (func $5 (; 10 ;) (param $0 i32) (param $1 i64) + (func $5 (param $0 i32) (param $1 i64) (call $fimport$3 (local.get $0) (i32.wrap_i64 @@ -256,7 +253,7 @@ ) ) ) - (func $6 (; 11 ;) (param $0 i64) (result i32) + (func $6 (param $0 i64) (result i32) (if (result i32) (i32.eq (i32.wrap_i64 @@ -327,7 +324,7 @@ ) ) ) - (func $7 (; 12 ;) (result i64) + (func $7 (result i64) (local $0 i64) (i32.store (i32.wrap_i64 @@ -400,7 +397,7 @@ ) (local.get $0) ) - (func $8 (; 13 ;) + (func $8 (local $0 i64) (local $1 i64) (call $fimport$2 @@ -875,29 +872,20 @@ ) (call $fimport$4) ) - (func $9 (; 14 ;) + (func $9 (global.set $global$0 - (i32.const 4) + (i32.const 15) ) (global.set $global$1 - (i32.const 16) + (i32.const 1073741824) ) (global.set $global$2 - (i32.const 15) + (i32.const 65536) ) (global.set $global$3 - (i32.const 1073741824) + (global.get $global$2) ) (global.set $global$4 - (i32.const 65536) - ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 - (global.get $global$5) - ) - (global.set $global$7 (i64.const 8589934592) ) ) diff --git a/test/fixtures/execution/traverseTree.lys.optimized.wast b/test/fixtures/execution/traverseTree.lys.optimized.wast index dd5ad521..f21c7612 100644 --- a/test/fixtures/execution/traverseTree.lys.optimized.wast +++ b/test/fixtures/execution/traverseTree.lys.optimized.wast @@ -39,15 +39,12 @@ (global $global$2 (mut i32) (i32.const 0)) (global $global$3 (mut i32) (i32.const 0)) (global $global$4 (mut i32) (i32.const 0)) - (global $global$5 (mut i32) (i32.const 0)) - (global $global$6 (mut i32) (i32.const 0)) - (global $global$7 (mut i32) (i32.const 0)) (export "memory" (memory $0)) (export "test_getLastErrorMessage" (func $2)) (export "test_getMaxMemory" (func $3)) (export "main" (func $8)) (start $9) - (func $0 (; 4 ;) (param $0 i64) (param $1 i32) + (func $0 (param $0 i64) (param $1 i32) (call $fimport$3 (i32.wrap_i64 (local.get $0) @@ -55,7 +52,7 @@ (local.get $1) ) ) - (func $1 (; 5 ;) (param $0 i32) + (func $1 (param $0 i32) (call $fimport$1 (i32.eq (local.get $0) @@ -80,7 +77,7 @@ ) ) ) - (func $2 (; 6 ;) (result i32) + (func $2 (result i32) (local $0 i64) (block $label$1 (result i32) (drop @@ -108,10 +105,10 @@ ) ) ) - (func $3 (; 7 ;) (result i32) - (global.get $global$7) + (func $3 (result i32) + (global.get $global$4) ) - (func $4 (; 8 ;) (result i32) + (func $4 (result i32) (local $0 i32) (local $1 i32) (local $2 i32) @@ -120,7 +117,7 @@ (if (i32.gt_u (i32.const 20) - (global.get $global$4) + (global.get $global$2) ) (unreachable) ) @@ -129,16 +126,16 @@ (local.tee $1 (i32.and (i32.add - (global.get $global$3) + (global.get $global$1) (i32.add (local.tee $0 - (global.get $global$7) + (global.get $global$4) ) (i32.const 36) ) ) (i32.xor - (global.get $global$3) + (global.get $global$1) (i32.const -1) ) ) @@ -191,7 +188,7 @@ ) ) ) - (global.set $global$7 + (global.set $global$4 (local.get $1) ) (i32.add @@ -199,7 +196,7 @@ (i32.const 16) ) ) - (func $5 (; 9 ;) (param $0 i32) + (func $5 (param $0 i32) (local $1 i32) (local.set $1 (i32.add @@ -231,7 +228,7 @@ ) ) ) - (func $6 (; 10 ;) (param $0 i32) (param $1 i64) (result i64) + (func $6 (param $0 i32) (param $1 i64) (result i64) (local $2 i32) (local $3 i64) (call $5 @@ -272,7 +269,7 @@ ) (local.get $3) ) - (func $7 (; 11 ;) (param $0 i64) (result i32) + (func $7 (param $0 i64) (result i32) (local $1 i32) (local $2 i64) (block $label$1 (result i32) @@ -342,7 +339,7 @@ (i32.const 0) ) ) - (func $8 (; 12 ;) + (func $8 (call $fimport$0 (i32.const 16) ) @@ -359,30 +356,21 @@ ) (call $fimport$2) ) - (func $9 (; 13 ;) + (func $9 (global.set $global$0 (i64.const 8589934592) ) (global.set $global$1 - (i32.const 4) - ) - (global.set $global$2 - (i32.const 16) - ) - (global.set $global$3 (i32.const 15) ) - (global.set $global$4 + (global.set $global$2 (i32.const 1073741824) ) - (global.set $global$5 - (i32.const 65536) - ) - (global.set $global$6 + (global.set $global$3 (i32.const 65536) ) - (global.set $global$7 - (global.get $global$6) + (global.set $global$4 + (global.get $global$3) ) ) ) diff --git a/test/fixtures/parser-error/j.lys.txt b/test/fixtures/parser-error/j.lys.txt index 1a126485..2d0ea79f 100644 --- a/test/fixtures/parser-error/j.lys.txt +++ b/test/fixtures/parser-error/j.lys.txt @@ -1,4 +1,4 @@ test/fixtures/parser-error/j.lys 1│ var a = .0 - │ ^^^^^^^^^^ Unexpected end of input. Expecting %Assign15 Got: .0 - │ ^^ Unexpected end of input. Expecting %Assign15 Got: .0 \ No newline at end of file + │ ^^^^^^^^^^ Unexpected end of input. Expecting Assign Got: = .0 + │ ^^^^ Unexpected end of input. Expecting Assign Got: = .0 \ No newline at end of file