From a82e77c5e5f4c74ea13cdb2999adf911c39f1e76 Mon Sep 17 00:00:00 2001 From: dcode Date: Sat, 14 Sep 2019 10:23:22 +0200 Subject: [PATCH 1/2] Update Binaryen with WebAssembly/binaryen##2336 --- package-lock.json | 6 +++--- package.json | 2 +- src/glue/binaryen.d.ts | 2 +- src/module.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 13a13d878d..6b96245a1e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -469,9 +469,9 @@ "dev": true }, "binaryen": { - "version": "89.0.0-nightly.20190909", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-89.0.0-nightly.20190909.tgz", - "integrity": "sha512-IQZjTZ5K8no8SJLQ8j6g8CgTQ98bHVYaqFYEKl8y4i+Z+Vev702b7arjIJq9mn10F4uvL4qqOYI1f7zGteChhA==" + "version": "89.0.0-nightly.20190913", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-89.0.0-nightly.20190913.tgz", + "integrity": "sha512-9En7uvCcel2+nUG2Z5dvHRAc4Mo70nt41cVO/MAFFUu/zsCd5PUBA1F14mBGRFEowa+cO+ldT5u/e90XejHwdQ==" }, "bluebird": { "version": "3.5.5", diff --git a/package.json b/package.json index 228750d0a2..dfefa18ec8 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@protobufjs/utf8": "^1.1.0", - "binaryen": "89.0.0-nightly.20190909", + "binaryen": "89.0.0-nightly.20190913", "glob": "^7.1.4", "long": "^4.0.0", "opencollective-postinstall": "^2.0.0", diff --git a/src/glue/binaryen.d.ts b/src/glue/binaryen.d.ts index 78b1a3a67e..d6a7663843 100644 --- a/src/glue/binaryen.d.ts +++ b/src/glue/binaryen.d.ts @@ -322,6 +322,7 @@ declare function _BinaryenNotVec128(): BinaryenSIMDOp; declare function _BinaryenAndVec128(): BinaryenSIMDOp; declare function _BinaryenOrVec128(): BinaryenSIMDOp; declare function _BinaryenXorVec128(): BinaryenSIMDOp; +declare function _BinaryenBitselectVec128(): BinaryenSIMDOp; declare function _BinaryenNegVecI8x16(): BinaryenSIMDOp; declare function _BinaryenAnyTrueVecI8x16(): BinaryenSIMDOp; declare function _BinaryenAllTrueVecI8x16(): BinaryenSIMDOp; @@ -395,7 +396,6 @@ declare function _BinaryenConvertSVecI32x4ToVecF32x4(): BinaryenSIMDOp; declare function _BinaryenConvertUVecI32x4ToVecF32x4(): BinaryenSIMDOp; declare function _BinaryenConvertSVecI64x2ToVecF64x2(): BinaryenSIMDOp; declare function _BinaryenConvertUVecI64x2ToVecF64x2(): BinaryenSIMDOp; -declare function _BinaryenBitselect(): BinaryenSIMDOp; declare type BinaryenExpressionRef = usize; diff --git a/src/module.ts b/src/module.ts index f3973bcf7c..72da45bf96 100644 --- a/src/module.ts +++ b/src/module.ts @@ -400,7 +400,7 @@ export enum SIMDShiftOp { } export enum SIMDTernaryOp { - Bitselect = 0, // FIXME: _BinaryenBitselect(), requires https://github.com/WebAssembly/binaryen/pull/2336 + Bitselect = _BinaryenBitselectVec128(), QFMAF32x4 = _BinaryenQFMAVecF32x4(), QFMSF32x4 = _BinaryenQFMSVecF32x4(), QFMAF64x2 = _BinaryenQFMAVecF64x2(), From 80f02b8e870896e6072fb9a5060c1e784a1435ab Mon Sep 17 00:00:00 2001 From: dcode Date: Sat, 14 Sep 2019 13:42:01 +0200 Subject: [PATCH 2/2] latest --- package-lock.json | 6 +- package.json | 2 +- tests/compiler/abi.optimized.wat | 17 +- tests/compiler/bool.optimized.wat | 100 +-- tests/compiler/builtins.optimized.wat | 60 -- tests/compiler/call-super.optimized.wat | 2 +- tests/compiler/comma.optimized.wat | 13 +- tests/compiler/constructor.optimized.wat | 30 +- tests/compiler/exports.optimized.wat | 2 +- tests/compiler/function-types.optimized.wat | 22 +- tests/compiler/getter-call.optimized.wat | 2 +- tests/compiler/getter-setter.optimized.wat | 22 - .../inlining-blocklocals.optimized.wat | 11 - tests/compiler/inlining.optimized.wat | 2 +- tests/compiler/instanceof.optimized.wat | 10 - tests/compiler/logical.optimized.wat | 96 +-- tests/compiler/memset.optimized.wat | 2 +- tests/compiler/number.optimized.wat | 19 +- .../optional-typeparameters.optimized.wat | 2 +- .../portable-conversions.optimized.wat | 608 +----------------- tests/compiler/resolve-access.optimized.wat | 2 +- tests/compiler/resolve-binary.optimized.wat | 8 +- .../resolve-function-expression.optimized.wat | 2 +- tests/compiler/resolve-new.optimized.wat | 2 +- tests/compiler/resolve-ternary.optimized.wat | 87 +-- tests/compiler/resolve-ternary.untouched.wat | 110 ++-- tests/compiler/resolve-unary.optimized.wat | 2 +- tests/compiler/retain-i32.optimized.wat | 202 +----- tests/compiler/retain-release.optimized.wat | 2 +- tests/compiler/rt/instanceof.optimized.wat | 29 +- tests/compiler/rt/stub-realloc.optimized.wat | 2 +- tests/compiler/runtime-stub.optimized.wat | 2 +- tests/compiler/static-this.optimized.wat | 18 +- .../compiler/std/array-literal.optimized.wat | 4 +- tests/compiler/std/array.optimized.wat | 318 ++++----- tests/compiler/std/date.optimized.wat | 2 +- tests/compiler/std/new.optimized.wat | 2 +- .../compiler/std/object-literal.optimized.wat | 2 +- .../std/operator-overloading.optimized.wat | 2 +- tests/compiler/std/pointer.optimized.wat | 17 +- tests/compiler/std/static-array.optimized.wat | 2 +- tests/compiler/std/string.optimized.wat | 2 +- tests/compiler/std/symbol.optimized.wat | 4 +- tests/compiler/std/typedarray.optimized.wat | 466 +++++--------- tests/compiler/unary.optimized.wat | 14 +- 45 files changed, 438 insertions(+), 1893 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6b96245a1e..18d9973077 100644 --- a/package-lock.json +++ b/package-lock.json @@ -469,9 +469,9 @@ "dev": true }, "binaryen": { - "version": "89.0.0-nightly.20190913", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-89.0.0-nightly.20190913.tgz", - "integrity": "sha512-9En7uvCcel2+nUG2Z5dvHRAc4Mo70nt41cVO/MAFFUu/zsCd5PUBA1F14mBGRFEowa+cO+ldT5u/e90XejHwdQ==" + "version": "89.0.0-nightly.20190914", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-89.0.0-nightly.20190914.tgz", + "integrity": "sha512-pfGX5IwPguli8IPuPjjcCYriZ2CzoEuk0XE70g6bmibZfieDUoK7miEq0FlPLNixL+n8vvyjRSPK5NtMuCcqNg==" }, "bluebird": { "version": "3.5.5", diff --git a/package.json b/package.json index dfefa18ec8..7d4f764b6a 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@protobufjs/utf8": "^1.1.0", - "binaryen": "89.0.0-nightly.20190913", + "binaryen": "89.0.0-nightly.20190914", "glob": "^7.1.4", "long": "^4.0.0", "opencollective-postinstall": "^2.0.0", diff --git a/tests/compiler/abi.optimized.wat b/tests/compiler/abi.optimized.wat index 8e470f0dbd..daf93339b5 100644 --- a/tests/compiler/abi.optimized.wat +++ b/tests/compiler/abi.optimized.wat @@ -1,8 +1,6 @@ (module (type $FUNCSIG$i (func (result i32))) - (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (type $FUNCSIG$v (func)) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 8) "\0c\00\00\00\01\00\00\00\01\00\00\00\0c\00\00\00a\00b\00i\00.\00t\00s") (global $abi/condition (mut i32) (i32.const 0)) @@ -12,25 +10,16 @@ (export "exportedExported" (func $abi/exported)) (export "exportedInternal" (func $abi/exported)) (start $start) - (func $abi/exported (; 1 ;) (type $FUNCSIG$i) (result i32) + (func $abi/exported (; 0 ;) (type $FUNCSIG$i) (result i32) i32.const -128 ) - (func $start (; 2 ;) (type $FUNCSIG$v) + (func $start (; 1 ;) (type $FUNCSIG$v) i32.const 1 global.set $abi/condition i32.const 0 global.set $abi/y - global.get $abi/y - if - i32.const 0 - i32.const 24 - i32.const 65 - i32.const 2 - call $~lib/builtins/abort - unreachable - end ) - (func $null (; 3 ;) (type $FUNCSIG$v) + (func $null (; 2 ;) (type $FUNCSIG$v) nop ) ) diff --git a/tests/compiler/bool.optimized.wat b/tests/compiler/bool.optimized.wat index 19d2a22b8c..5d46ff41ec 100644 --- a/tests/compiler/bool.optimized.wat +++ b/tests/compiler/bool.optimized.wat @@ -1,108 +1,16 @@ (module - (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (type $FUNCSIG$v (func)) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 8) "\0e\00\00\00\01\00\00\00\01\00\00\00\0e\00\00\00b\00o\00o\00l\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $start:bool (; 1 ;) (type $FUNCSIG$v) - i32.const 2 - i32.const 0 - i32.ne - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 2 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i64.const 2 - i64.const 0 - i64.ne - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 4 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 2 - i32.const 0 - i32.ne - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 6 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i64.const 2 - i64.const 0 - i64.ne - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 8 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f32.const 2 - f32.const 0 - f32.ne - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 10 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f64.const 2 - f64.const 0 - f64.ne - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 12 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 2 - i32.const 0 - i32.ne - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 14 - i32.const 0 - call $~lib/builtins/abort - unreachable - end + (func $start:bool (; 0 ;) (type $FUNCSIG$v) + nop ) - (func $start (; 2 ;) (type $FUNCSIG$v) + (func $start (; 1 ;) (type $FUNCSIG$v) call $start:bool ) - (func $null (; 3 ;) (type $FUNCSIG$v) + (func $null (; 2 ;) (type $FUNCSIG$v) nop ) ) diff --git a/tests/compiler/builtins.optimized.wat b/tests/compiler/builtins.optimized.wat index 523b5b1273..cc18c11f31 100644 --- a/tests/compiler/builtins.optimized.wat +++ b/tests/compiler/builtins.optimized.wat @@ -166,43 +166,10 @@ global.set $builtins/i i32.const 42 global.set $builtins/i - global.get $builtins/i - i32.const 42 - i32.ne - if - i32.const 0 - i32.const 64 - i32.const 67 - i32.const 19 - call $~lib/builtins/abort - unreachable - end i32.const 2 global.set $builtins/i - global.get $builtins/i - i32.const 2 - i32.ne - if - i32.const 0 - i32.const 64 - i32.const 68 - i32.const 20 - call $~lib/builtins/abort - unreachable - end i32.const 1 global.set $builtins/i - global.get $builtins/i - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 64 - i32.const 69 - i32.const 20 - call $~lib/builtins/abort - unreachable - end i64.const 63 global.set $builtins/I i64.const 0 @@ -215,30 +182,8 @@ global.set $builtins/I i64.const 42 global.set $builtins/I - global.get $builtins/I - i64.const 42 - i64.ne - if - i32.const 0 - i32.const 64 - i32.const 85 - i32.const 19 - call $~lib/builtins/abort - unreachable - end i64.const 2 global.set $builtins/I - global.get $builtins/I - i64.const 2 - i64.ne - if - i32.const 0 - i32.const 64 - i32.const 86 - i32.const 20 - call $~lib/builtins/abort - unreachable - end i64.const 1 global.set $builtins/I global.get $builtins/i @@ -626,11 +571,6 @@ global.set $builtins/f f64.const 25 global.set $builtins/F - global.get $builtins/i - i32.eqz - if - unreachable - end i32.const 1 i32.const 2 call $start:builtins~anonymous|0 diff --git a/tests/compiler/call-super.optimized.wat b/tests/compiler/call-super.optimized.wat index 4d182dd23b..ad00d717d7 100644 --- a/tests/compiler/call-super.optimized.wat +++ b/tests/compiler/call-super.optimized.wat @@ -422,7 +422,7 @@ (func $start (; 14 ;) (type $FUNCSIG$v) i32.const 64 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 64 global.set $~lib/rt/stub/offset call $call-super/test1 call $call-super/test2 diff --git a/tests/compiler/comma.optimized.wat b/tests/compiler/comma.optimized.wat index 1ca52c717b..87a8e1743f 100644 --- a/tests/compiler/comma.optimized.wat +++ b/tests/compiler/comma.optimized.wat @@ -67,11 +67,9 @@ end i32.const 0 global.set $comma/b - global.get $comma/b + i32.const 0 global.set $comma/a - global.get $comma/a i32.const 1 - i32.add global.set $comma/a global.get $comma/a global.set $comma/b @@ -130,11 +128,10 @@ i32.const 0 local.set $0 loop $loop|0 - block $break|0 - local.get $0 - global.get $comma/a - i32.ge_s - br_if $break|0 + local.get $0 + global.get $comma/a + i32.lt_s + if global.get $comma/a i32.const 1 i32.sub diff --git a/tests/compiler/constructor.optimized.wat b/tests/compiler/constructor.optimized.wat index 1db1f1f419..0d7b12b95d 100644 --- a/tests/compiler/constructor.optimized.wat +++ b/tests/compiler/constructor.optimized.wat @@ -108,7 +108,7 @@ (local $0 i32) i32.const 16 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 16 global.set $~lib/rt/stub/offset i32.const 0 i32.const 3 @@ -152,37 +152,23 @@ global.set $constructor/justFieldNoInit i32.const 0 global.set $constructor/ctorReturns - i32.const 1 - if (result i32) - i32.const 0 - else - i32.const 0 - i32.const 10 - call $~lib/rt/stub/__alloc - end + i32.const 0 global.set $constructor/ctorConditionallyReturns i32.const 0 i32.const 11 call $~lib/rt/stub/__alloc global.set $constructor/ctorAllocates i32.const 0 - local.set $0 - i32.const 1 - if - i32.const 0 - i32.const 12 - call $~lib/rt/stub/__alloc - local.set $0 - end - local.get $0 - i32.eqz - if + i32.const 12 + call $~lib/rt/stub/__alloc + local.tee $0 + if (result i32) + local.get $0 + else i32.const 0 i32.const 12 call $~lib/rt/stub/__alloc - local.set $0 end - local.get $0 global.set $constructor/ctorConditionallyAllocates ) (func $start (; 3 ;) (type $FUNCSIG$v) diff --git a/tests/compiler/exports.optimized.wat b/tests/compiler/exports.optimized.wat index 07e64a70cb..3befaaa6b6 100644 --- a/tests/compiler/exports.optimized.wat +++ b/tests/compiler/exports.optimized.wat @@ -144,7 +144,7 @@ (func $start (; 8 ;) (type $FUNCSIG$v) i32.const 16 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 16 global.set $~lib/rt/stub/offset ) (func $null (; 9 ;) (type $FUNCSIG$v) diff --git a/tests/compiler/function-types.optimized.wat b/tests/compiler/function-types.optimized.wat index dd5f05c0ea..5db5e9cadf 100644 --- a/tests/compiler/function-types.optimized.wat +++ b/tests/compiler/function-types.optimized.wat @@ -39,15 +39,13 @@ call_indirect (type $FUNCSIG$iii) ) (func $start:function-types (; 5 ;) (type $FUNCSIG$v) - (local $0 i32) i32.const 1 global.set $function-types/i32Adder i32.const 2 global.set $~lib/argc i32.const 1 i32.const 2 - global.get $function-types/i32Adder - call_indirect (type $FUNCSIG$iii) + call $function-types/makeAdder~anonymous|0 i32.const 3 i32.ne if @@ -64,8 +62,7 @@ global.set $~lib/argc i64.const 10 i64.const 20 - global.get $function-types/i64Adder - call_indirect (type $FUNCSIG$jjj) + call $function-types/makeAdder~anonymous|0 i64.const 30 i64.ne if @@ -136,22 +133,9 @@ end i32.const 2 global.set $~lib/argc - block $1of1 - block $0of1 - block $outOfRange - global.get $~lib/argc - i32.const 2 - i32.sub - br_table $0of1 $1of1 $outOfRange - end - unreachable - end - i32.const 1 - local.set $0 - end i32.const 1 i32.const 2 - local.get $0 + i32.const 1 call $function-types/doAddWithFn i32.const 3 i32.ne diff --git a/tests/compiler/getter-call.optimized.wat b/tests/compiler/getter-call.optimized.wat index 5edabea077..9b0b82a4ff 100644 --- a/tests/compiler/getter-call.optimized.wat +++ b/tests/compiler/getter-call.optimized.wat @@ -93,7 +93,7 @@ (func $start (; 4 ;) (type $FUNCSIG$v) i32.const 16 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 16 global.set $~lib/rt/stub/offset ) (func $null (; 5 ;) (type $FUNCSIG$v) diff --git a/tests/compiler/getter-setter.optimized.wat b/tests/compiler/getter-setter.optimized.wat index d966cb489e..a3928a12c0 100644 --- a/tests/compiler/getter-setter.optimized.wat +++ b/tests/compiler/getter-setter.optimized.wat @@ -19,30 +19,8 @@ end i32.const 1 global.set $getter-setter/Foo._bar - global.get $getter-setter/Foo._bar - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 15 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const 2 global.set $getter-setter/Foo._bar - global.get $getter-setter/Foo._bar - i32.const 2 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 16 - i32.const 0 - call $~lib/builtins/abort - unreachable - end ) (func $start (; 2 ;) (type $FUNCSIG$v) call $start:getter-setter diff --git a/tests/compiler/inlining-blocklocals.optimized.wat b/tests/compiler/inlining-blocklocals.optimized.wat index 5fee10c696..eab3e0f06d 100644 --- a/tests/compiler/inlining-blocklocals.optimized.wat +++ b/tests/compiler/inlining-blocklocals.optimized.wat @@ -23,17 +23,6 @@ global.set $inlining-blocklocals/theCall_b i32.const 3 global.set $inlining-blocklocals/theCall_c - global.get $inlining-blocklocals/theCall_a - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 18 - i32.const 2 - call $~lib/builtins/abort - unreachable - end global.get $inlining-blocklocals/theCall_b i32.const 2 i32.ne diff --git a/tests/compiler/inlining.optimized.wat b/tests/compiler/inlining.optimized.wat index df12a651e7..833540bcfb 100644 --- a/tests/compiler/inlining.optimized.wat +++ b/tests/compiler/inlining.optimized.wat @@ -209,7 +209,7 @@ call $inlining/test_funcs i32.const 48 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 48 global.set $~lib/rt/stub/offset call $inlining/test_ctor ) diff --git a/tests/compiler/instanceof.optimized.wat b/tests/compiler/instanceof.optimized.wat index ea52f4791a..474ae7b02f 100644 --- a/tests/compiler/instanceof.optimized.wat +++ b/tests/compiler/instanceof.optimized.wat @@ -19,16 +19,6 @@ end i32.const 1 global.set $instanceof/an - global.get $instanceof/an - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 71 - i32.const 0 - call $~lib/builtins/abort - unreachable - end ) (func $start (; 2 ;) (type $FUNCSIG$v) call $start:instanceof diff --git a/tests/compiler/logical.optimized.wat b/tests/compiler/logical.optimized.wat index ef1c6385b9..9047619606 100644 --- a/tests/compiler/logical.optimized.wat +++ b/tests/compiler/logical.optimized.wat @@ -1,7 +1,5 @@ (module - (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (type $FUNCSIG$v (func)) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 8) "\14\00\00\00\01\00\00\00\01\00\00\00\14\00\00\00l\00o\00g\00i\00c\00a\00l\00.\00t\00s") (global $logical/i (mut i32) (i32.const 0)) @@ -10,116 +8,28 @@ (global $logical/F (mut f64) (f64.const 0)) (export "memory" (memory $0)) (start $start) - (func $start:logical (; 1 ;) (type $FUNCSIG$v) + (func $start:logical (; 0 ;) (type $FUNCSIG$v) i32.const 2 global.set $logical/i - global.get $logical/i - i32.const 2 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 12 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const 1 global.set $logical/i - global.get $logical/i - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 15 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i64.const 2 global.set $logical/I - global.get $logical/I - i64.const 2 - i64.ne - if - i32.const 0 - i32.const 24 - i32.const 20 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i64.const 1 global.set $logical/I - global.get $logical/I - i64.const 1 - i64.ne - if - i32.const 0 - i32.const 24 - i32.const 23 - i32.const 0 - call $~lib/builtins/abort - unreachable - end f32.const 2 global.set $logical/f - global.get $logical/f - f32.const 2 - f32.ne - if - i32.const 0 - i32.const 24 - i32.const 28 - i32.const 0 - call $~lib/builtins/abort - unreachable - end f32.const 1 global.set $logical/f - global.get $logical/f - f32.const 1 - f32.ne - if - i32.const 0 - i32.const 24 - i32.const 31 - i32.const 0 - call $~lib/builtins/abort - unreachable - end f64.const 2 global.set $logical/F - global.get $logical/F - f64.const 2 - f64.ne - if - i32.const 0 - i32.const 24 - i32.const 36 - i32.const 0 - call $~lib/builtins/abort - unreachable - end f64.const 1 global.set $logical/F - global.get $logical/F - f64.const 1 - f64.ne - if - i32.const 0 - i32.const 24 - i32.const 39 - i32.const 0 - call $~lib/builtins/abort - unreachable - end ) - (func $start (; 2 ;) (type $FUNCSIG$v) + (func $start (; 1 ;) (type $FUNCSIG$v) call $start:logical ) - (func $null (; 3 ;) (type $FUNCSIG$v) + (func $null (; 2 ;) (type $FUNCSIG$v) nop ) ) diff --git a/tests/compiler/memset.optimized.wat b/tests/compiler/memset.optimized.wat index b3c5d17a76..d062bff123 100644 --- a/tests/compiler/memset.optimized.wat +++ b/tests/compiler/memset.optimized.wat @@ -234,7 +234,7 @@ (func $start:memset (; 2 ;) (type $FUNCSIG$v) i32.const 44 global.set $memset/dest - global.get $memset/dest + i32.const 44 i32.const 1 i32.const 16 call $memset/memset diff --git a/tests/compiler/number.optimized.wat b/tests/compiler/number.optimized.wat index b5b4d4fc15..d53876ae0e 100644 --- a/tests/compiler/number.optimized.wat +++ b/tests/compiler/number.optimized.wat @@ -1168,14 +1168,7 @@ i32.const -62 global.set $~lib/util/number/_exp i32.const 348 - i32.const -61 - global.get $~lib/util/number/_exp - i32.sub - f64.convert_i32_s - f64.const 0.30102999566398114 - f64.mul - f64.const 347 - f64.add + f64.const 347.30102999566395 local.tee $6 i32.trunc_f64_s local.tee $4 @@ -1209,7 +1202,7 @@ i32.add i32.load16_s global.set $~lib/util/number/_exp_pow - global.get $~lib/util/number/_frc_plus + i64.const -9223372036854774784 local.tee $1 i64.const 4294967295 i64.and @@ -1283,13 +1276,11 @@ i32.const 2 i32.add local.get $1 - global.get $~lib/util/number/_exp local.get $0 + i32.const 2 i32.add - i32.const -64 - i32.sub local.get $1 - global.get $~lib/util/number/_frc_minus + i64.const 9223372036854775296 local.tee $1 i64.const 4294967295 i64.and @@ -1540,7 +1531,7 @@ (local $0 i32) i32.const 1520 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 1520 global.set $~lib/rt/stub/offset global.get $number/a call $~lib/util/number/itoa32 diff --git a/tests/compiler/optional-typeparameters.optimized.wat b/tests/compiler/optional-typeparameters.optimized.wat index 9169976248..2189da8971 100644 --- a/tests/compiler/optional-typeparameters.optimized.wat +++ b/tests/compiler/optional-typeparameters.optimized.wat @@ -81,7 +81,7 @@ (func $start (; 2 ;) (type $FUNCSIG$v) i32.const 16 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 16 global.set $~lib/rt/stub/offset i32.const 3 call $~lib/rt/stub/__alloc diff --git a/tests/compiler/portable-conversions.optimized.wat b/tests/compiler/portable-conversions.optimized.wat index 6b1359eb7b..59de98a923 100644 --- a/tests/compiler/portable-conversions.optimized.wat +++ b/tests/compiler/portable-conversions.optimized.wat @@ -1,616 +1,16 @@ (module - (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (type $FUNCSIG$v (func)) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 8) ".\00\00\00\01\00\00\00\01\00\00\00.\00\00\00p\00o\00r\00t\00a\00b\00l\00e\00-\00c\00o\00n\00v\00e\00r\00s\00i\00o\00n\00s\00.\00t\00s") (export "memory" (memory $0)) (start $start) - (func $start:portable-conversions (; 1 ;) (type $FUNCSIG$v) - i32.const 1 - i32.const 255 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 6 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i64.const 1 - i32.wrap_i64 - i32.const 255 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 7 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f32.const 1 - i32.trunc_f32_s - i32.const 255 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 8 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f64.const 1 - i32.trunc_f64_s - i32.const 255 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 9 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - i32.const 65535 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 11 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i64.const 1 - i32.wrap_i64 - i32.const 65535 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 12 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f32.const 1 - i32.trunc_f32_s - i32.const 65535 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 13 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f64.const 1 - i32.trunc_f64_s - i32.const 65535 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 14 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 16 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i64.const 1 - i32.wrap_i64 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 17 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f32.const 1 - i32.trunc_f32_s - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 18 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f64.const 1 - i32.trunc_f64_s - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 19 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - i64.extend_i32_s - i64.eqz - if - i32.const 0 - i32.const 24 - i32.const 21 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i64.const 1 - i64.eqz - if - i32.const 0 - i32.const 24 - i32.const 22 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f32.const 1 - i64.trunc_f32_s - i64.eqz - if - i32.const 0 - i32.const 24 - i32.const 23 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f64.const 1 - i64.trunc_f64_s - i64.eqz - if - i32.const 0 - i32.const 24 - i32.const 24 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 26 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i64.const 1 - i32.wrap_i64 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 27 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f32.const 1 - i32.trunc_f32_s - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 28 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f64.const 1 - i32.trunc_f64_s - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 29 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - i32.const 255 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 31 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i64.const 1 - i32.wrap_i64 - i32.const 255 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 32 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f32.const 1 - i32.trunc_f32_u - i32.const 255 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 33 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f64.const 1 - i32.trunc_f64_u - i32.const 255 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 34 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - i32.const 65535 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 36 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i64.const 1 - i32.wrap_i64 - i32.const 65535 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 37 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f32.const 1 - i32.trunc_f32_u - i32.const 65535 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 38 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f64.const 1 - i32.trunc_f64_u - i32.const 65535 - i32.and - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 39 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 41 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i64.const 1 - i32.wrap_i64 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 42 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f32.const 1 - i32.trunc_f32_u - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 43 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f64.const 1 - i32.trunc_f64_u - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 44 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - i64.extend_i32_s - i64.eqz - if - i32.const 0 - i32.const 24 - i32.const 46 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i64.const 1 - i64.eqz - if - i32.const 0 - i32.const 24 - i32.const 47 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f32.const 1 - i64.trunc_f32_u - i64.eqz - if - i32.const 0 - i32.const 24 - i32.const 48 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f64.const 1 - i64.trunc_f64_u - i64.eqz - if - i32.const 0 - i32.const 24 - i32.const 49 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 51 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i64.const 1 - i32.wrap_i64 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 52 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f32.const 1 - i32.trunc_f32_u - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 53 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f64.const 1 - i32.trunc_f64_u - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 54 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - i32.eqz - if - i32.const 0 - i32.const 24 - i32.const 56 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i64.const 1 - i64.const 0 - i64.eq - if - i32.const 0 - i32.const 24 - i32.const 57 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f32.const 1 - f32.const 0 - f32.eq - if - i32.const 0 - i32.const 24 - i32.const 58 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f64.const 1 - f64.const 0 - f64.eq - if - i32.const 0 - i32.const 24 - i32.const 59 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - f32.convert_i32_s - f32.const 0 - f32.eq - if - i32.const 0 - i32.const 24 - i32.const 61 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i64.const 1 - f32.convert_i64_s - f32.const 0 - f32.eq - if - i32.const 0 - i32.const 24 - i32.const 62 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f32.const 1 - f32.const 0 - f32.eq - if - i32.const 0 - i32.const 24 - i32.const 63 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f64.const 1 - f32.demote_f64 - f32.const 0 - f32.eq - if - i32.const 0 - i32.const 24 - i32.const 64 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 1 - f64.convert_i32_s - f64.const 0 - f64.eq - if - i32.const 0 - i32.const 24 - i32.const 66 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i64.const 1 - f64.convert_i64_s - f64.const 0 - f64.eq - if - i32.const 0 - i32.const 24 - i32.const 67 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f32.const 1 - f64.promote_f32 - f64.const 0 - f64.eq - if - i32.const 0 - i32.const 24 - i32.const 68 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - f64.const 1 - f64.const 0 - f64.eq - if - i32.const 0 - i32.const 24 - i32.const 69 - i32.const 0 - call $~lib/builtins/abort - unreachable - end + (func $start:portable-conversions (; 0 ;) (type $FUNCSIG$v) + nop ) - (func $start (; 2 ;) (type $FUNCSIG$v) + (func $start (; 1 ;) (type $FUNCSIG$v) call $start:portable-conversions ) - (func $null (; 3 ;) (type $FUNCSIG$v) + (func $null (; 2 ;) (type $FUNCSIG$v) nop ) ) diff --git a/tests/compiler/resolve-access.optimized.wat b/tests/compiler/resolve-access.optimized.wat index c719920e9a..91dd79ac27 100644 --- a/tests/compiler/resolve-access.optimized.wat +++ b/tests/compiler/resolve-access.optimized.wat @@ -585,7 +585,7 @@ (func $start (; 16 ;) (type $FUNCSIG$v) i32.const 160 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 160 global.set $~lib/rt/stub/offset ) (func $null (; 17 ;) (type $FUNCSIG$v) diff --git a/tests/compiler/resolve-binary.optimized.wat b/tests/compiler/resolve-binary.optimized.wat index 744e72b84e..62b6c94c0d 100644 --- a/tests/compiler/resolve-binary.optimized.wat +++ b/tests/compiler/resolve-binary.optimized.wat @@ -1776,11 +1776,11 @@ end i32.const 1840 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 1840 global.set $~lib/rt/stub/offset i32.const 1 global.set $resolve-binary/a - global.get $resolve-binary/a + i32.const 1 call $~lib/util/number/itoa32 i32.const 184 call $~lib/string/String.__eq @@ -1846,7 +1846,7 @@ end f64.const 2 global.set $resolve-binary/f - global.get $resolve-binary/f + f64.const 2 call $~lib/math/NativeMath.pow global.set $resolve-binary/f global.get $resolve-binary/f @@ -1864,9 +1864,7 @@ end i32.const 4 global.set $resolve-binary/a - global.get $resolve-binary/a i32.const 2 - i32.div_s global.set $resolve-binary/a global.get $resolve-binary/a call $~lib/util/number/itoa32 diff --git a/tests/compiler/resolve-function-expression.optimized.wat b/tests/compiler/resolve-function-expression.optimized.wat index 195b72a17f..80f2c8139a 100644 --- a/tests/compiler/resolve-function-expression.optimized.wat +++ b/tests/compiler/resolve-function-expression.optimized.wat @@ -339,7 +339,7 @@ end i32.const 144 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 144 global.set $~lib/rt/stub/offset i32.const 1 global.set $~lib/argc diff --git a/tests/compiler/resolve-new.optimized.wat b/tests/compiler/resolve-new.optimized.wat index 9874dba1bf..7a0a791c2f 100644 --- a/tests/compiler/resolve-new.optimized.wat +++ b/tests/compiler/resolve-new.optimized.wat @@ -80,7 +80,7 @@ (func $start (; 2 ;) (type $FUNCSIG$v) i32.const 16 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 16 global.set $~lib/rt/stub/offset call $~lib/rt/stub/__alloc global.set $resolve-new/foo diff --git a/tests/compiler/resolve-ternary.optimized.wat b/tests/compiler/resolve-ternary.optimized.wat index 0672841651..5d995368d7 100644 --- a/tests/compiler/resolve-ternary.optimized.wat +++ b/tests/compiler/resolve-ternary.optimized.wat @@ -39,7 +39,6 @@ (global $~lib/rt/pure/CUR (mut i32) (i32.const 0)) (global $~lib/rt/pure/END (mut i32) (i32.const 0)) (global $~lib/rt/pure/ROOTS (mut i32) (i32.const 0)) - (global $resolve-ternary/b i32 (i32.const 1)) (global $~lib/util/number/_frc_plus (mut i64) (i64.const 0)) (global $~lib/util/number/_frc_minus (mut i64) (i64.const 0)) (global $~lib/util/number/_exp (mut i32) (i32.const 0)) @@ -84,7 +83,7 @@ local.get $2 i32.const 1073741808 i32.lt_u - else + else i32.const 0 end i32.eqz @@ -105,7 +104,7 @@ i32.shr_u local.set $2 i32.const 0 - else + else local.get $2 i32.const 31 local.get $2 @@ -129,7 +128,7 @@ local.get $2 i32.const 16 i32.lt_u - else + else i32.const 0 end i32.eqz @@ -350,7 +349,7 @@ local.tee $3 i32.store local.get $2 - else + else local.get $1 end local.set $1 @@ -370,7 +369,7 @@ local.get $2 i32.const 1073741808 i32.lt_u - else + else i32.const 0 end i32.eqz @@ -411,7 +410,7 @@ i32.shr_u local.set $4 i32.const 0 - else + else local.get $2 i32.const 31 local.get $2 @@ -435,7 +434,7 @@ local.get $4 i32.const 16 i32.lt_u - else + else i32.const 0 end i32.eqz @@ -564,7 +563,7 @@ i32.sub local.set $1 end - else + else local.get $1 local.get $0 i32.const 1572 @@ -634,7 +633,7 @@ memory.grow i32.const 0 i32.lt_s - else + else i32.const 0 end if @@ -738,7 +737,7 @@ i32.shr_u local.set $1 i32.const 0 - else + else local.get $1 i32.const 536870904 i32.lt_u @@ -778,7 +777,7 @@ local.get $1 i32.const 16 i32.lt_u - else + else i32.const 0 end i32.eqz @@ -813,7 +812,7 @@ local.get $0 i32.add i32.load offset=96 - else + else local.get $0 i32.load i32.const -1 @@ -853,7 +852,7 @@ local.get $0 i32.add i32.load offset=96 - else + else i32.const 0 end end @@ -968,7 +967,7 @@ local.get $0 local.get $1 call $~lib/rt/tlsf/insertBlock - else + else local.get $1 local.get $3 i32.const -2 @@ -1059,7 +1058,7 @@ local.tee $2 if (result i32) local.get $2 - else + else call $~lib/rt/tlsf/initializeRoot global.get $~lib/rt/tlsf/ROOT end @@ -1268,7 +1267,7 @@ br $continue|2 end end - else + else local.get $1 i32.const 7 i32.and @@ -1472,12 +1471,12 @@ local.get $0 i32.const -2147483648 i32.store offset=4 - else + else global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/freeBlock end - else + else local.get $1 i32.const 0 i32.le_u @@ -1504,7 +1503,7 @@ i32.and i32.or i32.store offset=4 - else + else local.get $0 local.get $1 i32.const 1 @@ -1589,7 +1588,7 @@ if local.get $0 call $~lib/rt/pure/scanBlack - else + else local.get $0 local.get $1 i32.const -1879048193 @@ -1619,7 +1618,7 @@ i32.const -2147483648 i32.and i32.eqz - else + else i32.const 0 end if @@ -1672,7 +1671,7 @@ i32.and i32.const 0 i32.gt_u - else + else i32.const 0 end if @@ -1685,7 +1684,7 @@ i32.const 4 i32.add local.set $2 - else + else i32.const 0 local.get $1 i32.const 268435455 @@ -1699,7 +1698,7 @@ global.get $~lib/rt/tlsf/ROOT local.get $4 call $~lib/rt/tlsf/freeBlock - else + else local.get $4 local.get $1 i32.const 2147483647 @@ -1912,7 +1911,7 @@ i32.sub local.tee $5 i32.eqz - else + else i32.const 0 end if @@ -2417,7 +2416,7 @@ local.get $3 i32.const 21 i32.le_s - else + else i32.const 0 end if (result i32) @@ -2451,7 +2450,7 @@ local.get $3 i32.const 2 i32.add - else + else local.get $3 i32.const 21 i32.le_s @@ -2482,7 +2481,7 @@ local.get $1 i32.const 1 i32.add - else + else local.get $3 i32.const 0 i32.le_s @@ -2533,7 +2532,7 @@ local.get $1 local.get $3 i32.add - else + else local.get $1 i32.const 1 i32.eq @@ -2574,7 +2573,7 @@ local.get $2 i32.const 2 i32.add - else + else local.get $0 i32.const 4 i32.add @@ -2977,7 +2976,7 @@ local.get $3 if (result i32) i32.const 0 - else + else local.get $0 call $~lib/string/String#get:length i32.const 1 @@ -3081,9 +3080,6 @@ (local $1 i32) (local $2 i32) i32.const 1 - i32.const 2 - global.get $resolve-ternary/b - select call $~lib/util/number/itoa32 local.tee $0 call $~lib/rt/pure/__retain @@ -3103,9 +3099,6 @@ unreachable end f64.const 1 - f64.const 2 - global.get $resolve-ternary/b - select call $~lib/util/number/dtoa local.tee $2 local.get $2 @@ -3123,11 +3116,7 @@ i32.const 1 global.set $~lib/argc i32.const 1 - i32.const 1 - i32.const 2 - global.get $resolve-ternary/b - select - call_indirect (type $FUNCSIG$ii) + call $start:resolve-ternary~anonymous|0 i32.const 2 i32.ne if @@ -3141,11 +3130,7 @@ i32.const 1 global.set $~lib/argc i32.const 1 - i32.const 3 - i32.const 4 - global.get $resolve-ternary/b - select - call_indirect (type $FUNCSIG$ii) + call $resolve-ternary/g1 i32.const 4 i32.ne if @@ -3159,11 +3144,7 @@ i32.const 1 global.set $~lib/argc i32.const 1 - i32.const 2 - i32.const 4 - global.get $resolve-ternary/b - select - call_indirect (type $FUNCSIG$ii) + call $start:resolve-ternary~anonymous|1 i32.const 3 i32.ne if diff --git a/tests/compiler/resolve-ternary.untouched.wat b/tests/compiler/resolve-ternary.untouched.wat index fe0e360e3a..49bd9cf119 100644 --- a/tests/compiler/resolve-ternary.untouched.wat +++ b/tests/compiler/resolve-ternary.untouched.wat @@ -103,7 +103,7 @@ local.get $3 i32.const 1073741808 i32.lt_u - else + else i32.const 0 end i32.eqz @@ -125,7 +125,7 @@ i32.const 4 i32.shr_u local.set $5 - else + else i32.const 31 local.get $3 i32.clz @@ -155,7 +155,7 @@ local.get $5 i32.const 16 i32.lt_u - else + else i32.const 0 end i32.eqz @@ -456,7 +456,7 @@ local.get $8 i32.const 1073741808 i32.lt_u - else + else i32.const 0 end i32.eqz @@ -499,7 +499,7 @@ i32.const 4 i32.shr_u local.set $10 - else + else i32.const 31 local.get $8 i32.clz @@ -529,7 +529,7 @@ local.get $10 i32.const 16 i32.lt_u - else + else i32.const 0 end i32.eqz @@ -640,7 +640,7 @@ i32.const 15 i32.and i32.eqz - else + else i32.const 0 end if (result i32) @@ -648,7 +648,7 @@ i32.const 15 i32.and i32.eqz - else + else i32.const 0 end i32.eqz @@ -696,10 +696,10 @@ local.get $4 i32.load local.set $5 - else + else nop end - else + else local.get $1 local.get $0 i32.const 1572 @@ -815,7 +815,7 @@ memory.grow i32.const 0 i32.lt_s - else + else i32.const 0 end if @@ -965,7 +965,7 @@ i32.const 4 i32.shr_u local.set $3 - else + else local.get $1 i32.const 536870904 i32.lt_u @@ -980,7 +980,7 @@ i32.add i32.const 1 i32.sub - else + else local.get $1 end local.set $4 @@ -1013,7 +1013,7 @@ local.get $3 i32.const 16 i32.lt_u - else + else i32.const 0 end i32.eqz @@ -1063,7 +1063,7 @@ if i32.const 0 local.set $7 - else + else local.get $5 i32.ctz local.set $2 @@ -1107,7 +1107,7 @@ i32.load offset=96 local.set $7 end - else + else local.get $0 local.set $9 local.get $2 @@ -1268,7 +1268,7 @@ local.get $0 local.get $5 call $~lib/rt/tlsf/insertBlock - else + else local.get $1 local.get $3 i32.const 1 @@ -1510,7 +1510,7 @@ local.get $1 i32.const 3 i32.and - else + else i32.const 0 end i32.eqz @@ -2552,7 +2552,7 @@ i32.le_u if (result i32) i32.const 1 - else + else local.get $5 local.get $3 i32.add @@ -2667,7 +2667,7 @@ end unreachable end - else + else local.get $4 i32.const 7 i32.and @@ -2771,7 +2771,7 @@ i32.const 15 i32.and i32.eqz - else + else i32.const 0 end i32.eqz @@ -2900,7 +2900,7 @@ global.get $~lib/rt/tlsf/ROOT local.get $0 call $~lib/rt/tlsf/freeBlock - else + else local.get $0 i32.const -2147483648 i32.const 0 @@ -2909,7 +2909,7 @@ i32.or i32.store offset=4 end - else + else local.get $2 i32.const 0 i32.gt_u @@ -2946,7 +2946,7 @@ local.get $0 call $~lib/rt/pure/appendRoot end - else + else local.get $0 local.get $1 i32.const 268435455 @@ -3035,7 +3035,7 @@ if local.get $0 call $~lib/rt/pure/scanBlack - else + else local.get $0 local.get $1 i32.const 1879048192 @@ -3068,7 +3068,7 @@ i32.const -2147483648 i32.and i32.eqz - else + else i32.const 0 end if @@ -3130,7 +3130,7 @@ i32.and i32.const 0 i32.gt_u - else + else i32.const 0 end if @@ -3143,7 +3143,7 @@ i32.const 4 i32.add local.set $1 - else + else local.get $5 i32.const 1879048192 i32.and @@ -3154,14 +3154,14 @@ i32.const 268435455 i32.and i32.eqz - else + else i32.const 0 end if global.get $~lib/rt/tlsf/ROOT local.get $4 call $~lib/rt/tlsf/freeBlock - else + else local.get $4 local.get $5 i32.const -2147483648 @@ -3251,7 +3251,7 @@ i32.lt_u select return - else + else i32.const 4 i32.const 5 local.get $0 @@ -3268,7 +3268,7 @@ return end unreachable - else + else local.get $0 i32.const 10000000 i32.lt_u @@ -3280,7 +3280,7 @@ i32.lt_u select return - else + else i32.const 9 i32.const 10 local.get $0 @@ -3424,7 +3424,7 @@ i32.add local.get $5 i32.store - else + else local.get $2 i32.const 1 i32.sub @@ -3558,7 +3558,7 @@ i32.sub local.tee $5 i32.eqz - else + else i32.const 0 end i32.eqz @@ -3614,7 +3614,7 @@ i32.eq if (result i32) i32.const 1 - else + else local.get $1 i32.const 0 i32.eq @@ -3994,7 +3994,7 @@ i64.sub local.get $21 i64.ge_u - else + else i32.const 0 end if (result i32) @@ -4005,7 +4005,7 @@ i64.lt_u if (result i32) i32.const 1 - else + else local.get $20 local.get $22 i64.sub @@ -4016,7 +4016,7 @@ i64.sub i64.gt_u end - else + else i32.const 0 end i32.eqz @@ -4143,7 +4143,7 @@ i64.sub local.get $21 i64.ge_u - else + else i32.const 0 end if (result i32) @@ -4154,7 +4154,7 @@ i64.lt_u if (result i32) i32.const 1 - else + else local.get $20 local.get $22 i64.sub @@ -4165,7 +4165,7 @@ i64.sub i64.gt_u end - else + else i32.const 0 end i32.eqz @@ -4232,7 +4232,7 @@ local.get $3 i32.const 21 i32.le_s - else + else i32.const 0 end if @@ -4275,7 +4275,7 @@ i32.const 2 i32.add return - else + else local.get $3 i32.const 0 i32.gt_s @@ -4283,7 +4283,7 @@ local.get $3 i32.const 21 i32.le_s - else + else i32.const 0 end if @@ -4314,7 +4314,7 @@ i32.const 1 i32.add return - else + else i32.const -6 local.get $3 i32.lt_s @@ -4322,7 +4322,7 @@ local.get $3 i32.const 0 i32.le_s - else + else i32.const 0 end if @@ -4375,7 +4375,7 @@ local.get $4 i32.add return - else + else local.get $1 i32.const 1 i32.eq @@ -4429,7 +4429,7 @@ i32.const 2 i32.add return - else + else local.get $1 i32.const 1 i32.shl @@ -5019,7 +5019,7 @@ i32.const 1 i32.shl i32.eq - else + else i32.const 0 end if @@ -5129,7 +5129,7 @@ global.get $resolve-ternary/b if (result i32) i32.const 1 - else + else i32.const 2 end call $~lib/number/I32#toString @@ -5148,7 +5148,7 @@ global.get $resolve-ternary/b if (result f64) f64.const 1 - else + else f64.const 2 end i32.const 0 @@ -5171,7 +5171,7 @@ global.get $resolve-ternary/b if (result i32) i32.const 1 - else + else i32.const 2 end call_indirect (type $FUNCSIG$ii) @@ -5192,7 +5192,7 @@ global.get $resolve-ternary/b if (result i32) i32.const 3 - else + else i32.const 4 end call_indirect (type $FUNCSIG$ii) @@ -5213,7 +5213,7 @@ global.get $resolve-ternary/b if (result i32) i32.const 2 - else + else i32.const 4 end call_indirect (type $FUNCSIG$ii) diff --git a/tests/compiler/resolve-unary.optimized.wat b/tests/compiler/resolve-unary.optimized.wat index 9f5ac3f554..d6f4e4048d 100644 --- a/tests/compiler/resolve-unary.optimized.wat +++ b/tests/compiler/resolve-unary.optimized.wat @@ -318,7 +318,7 @@ (local $0 i32) i32.const 432 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 432 global.set $~lib/rt/stub/offset i32.const -1 call $~lib/util/number/itoa32 diff --git a/tests/compiler/retain-i32.optimized.wat b/tests/compiler/retain-i32.optimized.wat index 431e76c8ff..69313b4629 100644 --- a/tests/compiler/retain-i32.optimized.wat +++ b/tests/compiler/retain-i32.optimized.wat @@ -1,7 +1,5 @@ (module - (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (type $FUNCSIG$v (func)) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 8) "\1a\00\00\00\01\00\00\00\01\00\00\00\1a\00\00\00r\00e\00t\00a\00i\00n\00-\00i\003\002\00.\00t\00s") (global $retain-i32/si (mut i32) (i32.const 0)) @@ -9,7 +7,7 @@ (global $retain-i32/ri (mut i32) (i32.const 0)) (export "memory" (memory $0)) (start $start) - (func $start:retain-i32 (; 1 ;) (type $FUNCSIG$v) + (func $start:retain-i32 (; 0 ;) (type $FUNCSIG$v) (local $0 i32) i32.const -128 local.set $0 @@ -27,234 +25,40 @@ end i32.const -1 global.set $retain-i32/si - global.get $retain-i32/si - i32.const -1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 78 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const -1 global.set $retain-i32/si - global.get $retain-i32/si - i32.const -1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 81 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const -2 global.set $retain-i32/si - global.get $retain-i32/si - i32.const -2 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 84 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const -128 global.set $retain-i32/si - global.get $retain-i32/si - i32.const -128 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 87 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const -128 global.set $retain-i32/si - global.get $retain-i32/si - i32.const -128 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 90 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const -127 global.set $retain-i32/si - global.get $retain-i32/si - i32.const -127 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 93 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const -128 global.set $retain-i32/si - global.get $retain-i32/si - i32.const -128 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 96 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const 1 global.set $retain-i32/si - global.get $retain-i32/si - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 99 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const 1 global.set $retain-i32/si - global.get $retain-i32/si - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 102 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const 0 global.set $retain-i32/si - global.get $retain-i32/si - if - i32.const 0 - i32.const 24 - i32.const 105 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const 1 global.set $retain-i32/si - global.get $retain-i32/si - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 108 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const 255 global.set $retain-i32/ui - global.get $retain-i32/ui - i32.const 255 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 113 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const 255 global.set $retain-i32/ui - global.get $retain-i32/ui - i32.const 255 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 116 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const 254 global.set $retain-i32/ui - global.get $retain-i32/ui - i32.const 254 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 119 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const 1 global.set $retain-i32/ui - global.get $retain-i32/ui - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 122 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const 1 global.set $retain-i32/ui - global.get $retain-i32/ui - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 125 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const 1 global.set $retain-i32/ui - global.get $retain-i32/ui - i32.const 1 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 128 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const 0 global.set $retain-i32/ui - global.get $retain-i32/ui - if - i32.const 0 - i32.const 24 - i32.const 131 - i32.const 0 - call $~lib/builtins/abort - unreachable - end i32.const 0 i32.load8_s global.set $retain-i32/ri @@ -262,10 +66,10 @@ i32.load8_s drop ) - (func $start (; 2 ;) (type $FUNCSIG$v) + (func $start (; 1 ;) (type $FUNCSIG$v) call $start:retain-i32 ) - (func $null (; 3 ;) (type $FUNCSIG$v) + (func $null (; 2 ;) (type $FUNCSIG$v) nop ) ) diff --git a/tests/compiler/retain-release.optimized.wat b/tests/compiler/retain-release.optimized.wat index ffbc2c5523..6a8666c5c9 100644 --- a/tests/compiler/retain-release.optimized.wat +++ b/tests/compiler/retain-release.optimized.wat @@ -227,7 +227,7 @@ end i32.const 96 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 96 global.set $~lib/rt/stub/offset call $retain-release/Ref#constructor global.set $retain-release/REF diff --git a/tests/compiler/rt/instanceof.optimized.wat b/tests/compiler/rt/instanceof.optimized.wat index 8c97b10f8b..7162b0e5bd 100644 --- a/tests/compiler/rt/instanceof.optimized.wat +++ b/tests/compiler/rt/instanceof.optimized.wat @@ -149,7 +149,7 @@ (local $0 i32) i32.const 112 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 112 global.set $~lib/rt/stub/offset i32.const 0 call $rt/instanceof/Animal#constructor @@ -408,15 +408,6 @@ unreachable end i32.const 0 - if - i32.const 0 - i32.const 24 - i32.const 41 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 0 local.tee $0 if (result i32) local.get $0 @@ -451,15 +442,6 @@ unreachable end i32.const 0 - if - i32.const 0 - i32.const 24 - i32.const 45 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 0 local.tee $0 if (result i32) local.get $0 @@ -494,15 +476,6 @@ unreachable end i32.const 0 - if - i32.const 0 - i32.const 24 - i32.const 49 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - i32.const 0 local.tee $0 if (result i32) local.get $0 diff --git a/tests/compiler/rt/stub-realloc.optimized.wat b/tests/compiler/rt/stub-realloc.optimized.wat index 459c281a0b..bbbc60c392 100644 --- a/tests/compiler/rt/stub-realloc.optimized.wat +++ b/tests/compiler/rt/stub-realloc.optimized.wat @@ -604,7 +604,7 @@ end i32.const 144 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 144 global.set $~lib/rt/stub/offset call $start:rt/stub-realloc ) diff --git a/tests/compiler/runtime-stub.optimized.wat b/tests/compiler/runtime-stub.optimized.wat index cf05ce677d..f03216c6ac 100644 --- a/tests/compiler/runtime-stub.optimized.wat +++ b/tests/compiler/runtime-stub.optimized.wat @@ -114,7 +114,7 @@ (func $start (; 5 ;) (type $FUNCSIG$v) i32.const 48 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 48 global.set $~lib/rt/stub/offset ) ) diff --git a/tests/compiler/static-this.optimized.wat b/tests/compiler/static-this.optimized.wat index e1ce1ed8a0..1f9aaca932 100644 --- a/tests/compiler/static-this.optimized.wat +++ b/tests/compiler/static-this.optimized.wat @@ -1,25 +1,9 @@ (module - (type $FUNCSIG$viiii (func (param i32 i32 i32 i32))) (type $FUNCSIG$v (func)) - (import "env" "abort" (func $~lib/builtins/abort (param i32 i32 i32 i32))) (memory $0 1) (data (i32.const 8) "\1c\00\00\00\01\00\00\00\01\00\00\00\1c\00\00\00s\00t\00a\00t\00i\00c\00-\00t\00h\00i\00s\00.\00t\00s") (export "memory" (memory $0)) - (start $start) - (func $start (; 1 ;) (type $FUNCSIG$v) - i32.const 42 - i32.const 42 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 8 - i32.const 0 - call $~lib/builtins/abort - unreachable - end - ) - (func $null (; 2 ;) (type $FUNCSIG$v) + (func $null (; 0 ;) (type $FUNCSIG$v) nop ) ) diff --git a/tests/compiler/std/array-literal.optimized.wat b/tests/compiler/std/array-literal.optimized.wat index aff8ca1fd2..48a7018df9 100644 --- a/tests/compiler/std/array-literal.optimized.wat +++ b/tests/compiler/std/array-literal.optimized.wat @@ -1719,8 +1719,8 @@ call $~lib/builtins/abort unreachable end - i32.const 320 - i32.load offset=12 + i32.const 332 + i32.load if i32.const 0 i32.const 80 diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index 797a4d1223..ff53c1cf57 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -11199,22 +11199,22 @@ i32.const 440 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $4 + local.tee $5 call $~lib/rt/pure/__retain - local.tee $3 + local.tee $2 i32.const 1 i32.const 1 i32.const 3 call $~lib/array/Array#fill call $~lib/rt/pure/__release - local.get $3 + local.get $2 i32.const 5 i32.const 0 i32.const 6 i32.const 464 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $5 + local.tee $4 call $std/array/isArraysEqual i32.eqz if @@ -11225,13 +11225,13 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.const 0 i32.const 0 i32.const 2147483647 call $~lib/array/Array#fill call $~lib/rt/pure/__release - local.get $3 + local.get $2 i32.const 5 i32.const 0 i32.const 6 @@ -11249,20 +11249,20 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.const 1 i32.const 0 i32.const -3 call $~lib/array/Array#fill call $~lib/rt/pure/__release - local.get $3 + local.get $2 i32.const 5 i32.const 0 i32.const 6 i32.const 560 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $2 + local.tee $3 call $std/array/isArraysEqual i32.eqz if @@ -11273,13 +11273,13 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.const 2 i32.const -2 i32.const 2147483647 call $~lib/array/Array#fill call $~lib/rt/pure/__release - local.get $3 + local.get $2 i32.const 5 i32.const 0 i32.const 6 @@ -11297,13 +11297,13 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.const 0 i32.const 1 i32.const 0 call $~lib/array/Array#fill call $~lib/rt/pure/__release - local.get $3 + local.get $2 i32.const 5 i32.const 0 i32.const 6 @@ -11321,15 +11321,15 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $5 call $~lib/rt/pure/__release - local.get $3 + local.get $2 call $~lib/rt/pure/__release - local.get $5 + local.get $4 call $~lib/rt/pure/__release local.get $6 call $~lib/rt/pure/__release - local.get $2 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release @@ -11341,22 +11341,22 @@ i32.const 632 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $4 + local.tee $5 call $~lib/rt/pure/__retain - local.tee $3 + local.tee $2 i32.const 1 i32.const 1 i32.const 3 call $~lib/array/Array#fill call $~lib/rt/pure/__release - local.get $3 + local.get $2 i32.const 5 i32.const 2 i32.const 7 i32.const 672 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $5 + local.tee $4 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -11368,13 +11368,13 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.const 0 i32.const 0 i32.const 2147483647 call $~lib/array/Array#fill call $~lib/rt/pure/__release - local.get $3 + local.get $2 i32.const 5 i32.const 2 i32.const 7 @@ -11393,20 +11393,20 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.const 1 i32.const 0 i32.const -3 call $~lib/array/Array#fill call $~lib/rt/pure/__release - local.get $3 + local.get $2 i32.const 5 i32.const 2 i32.const 7 i32.const 752 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $2 + local.tee $3 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -11418,13 +11418,13 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.const 2 i32.const -2 i32.const 2147483647 call $~lib/array/Array#fill call $~lib/rt/pure/__release - local.get $3 + local.get $2 i32.const 5 i32.const 2 i32.const 7 @@ -11443,13 +11443,13 @@ call $~lib/builtins/abort unreachable end - local.get $3 + local.get $2 i32.const 0 i32.const 1 i32.const 0 call $~lib/array/Array#fill call $~lib/rt/pure/__release - local.get $3 + local.get $2 i32.const 5 i32.const 2 i32.const 7 @@ -11468,15 +11468,15 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $5 call $~lib/rt/pure/__release - local.get $3 + local.get $2 call $~lib/rt/pure/__release - local.get $5 + local.get $4 call $~lib/rt/pure/__release local.get $6 call $~lib/rt/pure/__release - local.get $2 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release @@ -11736,9 +11736,9 @@ unreachable end call $~lib/array/Array#constructor - local.set $5 + local.set $4 global.get $std/array/arr - local.get $5 + local.get $4 call $~lib/array/Array#concat local.set $1 global.get $std/array/arr @@ -11838,16 +11838,16 @@ call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.const 46 call $~lib/array/Array#push - local.get $5 + local.get $4 i32.const 47 call $~lib/array/Array#push global.get $std/array/arr - local.get $5 + local.get $4 call $~lib/array/Array#concat - local.set $4 + local.set $5 local.get $1 call $~lib/rt/pure/__release global.get $std/array/arr @@ -11862,7 +11862,7 @@ call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 i32.load offset=12 i32.const 2 i32.ne @@ -11874,7 +11874,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $5 i32.load offset=12 i32.const 5 i32.ne @@ -11886,7 +11886,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $5 i32.const 0 call $~lib/array/Array#__get i32.const 43 @@ -11899,7 +11899,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $5 i32.const 1 call $~lib/array/Array#__get i32.const 44 @@ -11912,7 +11912,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $5 i32.const 2 call $~lib/array/Array#__get i32.const 45 @@ -11925,7 +11925,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $5 i32.const 3 call $~lib/array/Array#__get i32.const 46 @@ -11938,7 +11938,7 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $5 i32.const 4 call $~lib/array/Array#__get i32.const 47 @@ -11951,10 +11951,10 @@ call $~lib/builtins/abort unreachable end - local.get $4 + local.get $5 call $~lib/array/Array#pop drop - local.get $4 + local.get $5 i32.load offset=12 i32.const 4 i32.ne @@ -11987,10 +11987,10 @@ local.get $6 global.get $std/array/arr call $~lib/array/Array#concat - local.set $2 - local.get $4 + local.set $3 + local.get $5 call $~lib/rt/pure/__release - local.get $2 + local.get $3 i32.load offset=12 i32.const 3 i32.ne @@ -12012,9 +12012,9 @@ call $~lib/builtins/abort unreachable end - local.get $5 + local.get $4 call $~lib/rt/pure/__release - local.get $2 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release @@ -12425,7 +12425,7 @@ i32.const 1712 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $3 + local.tee $2 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -12445,7 +12445,7 @@ i32.const 1752 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $4 + local.tee $5 local.tee $0 i32.ne if @@ -12460,7 +12460,7 @@ i32.const -3 i32.const -1 call $~lib/array/Array#copyWithin - local.tee $5 + local.tee $4 i32.const 5 i32.const 2 i32.const 3 @@ -12487,7 +12487,7 @@ i32.const 1832 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $2 + local.tee $3 local.tee $29 i32.ne if @@ -12581,15 +12581,15 @@ call $~lib/rt/pure/__release local.get $27 call $~lib/rt/pure/__release - local.get $3 - call $~lib/rt/pure/__release - local.get $4 + local.get $2 call $~lib/rt/pure/__release local.get $5 call $~lib/rt/pure/__release + local.get $4 + call $~lib/rt/pure/__release local.get $6 call $~lib/rt/pure/__release - local.get $2 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release @@ -14025,14 +14025,14 @@ i32.const 7 i32.const 0 call $~lib/array/Array#splice - local.tee $3 + local.tee $2 i32.const 0 i32.const 2 i32.const 3 i32.const 3008 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $4 + local.tee $5 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -14051,7 +14051,7 @@ i32.const 3024 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $5 + local.tee $4 i32.const 0 call $std/array/isArraysEqual i32.eqz @@ -14085,7 +14085,7 @@ i32.const 7 i32.const 5 call $~lib/array/Array#splice - local.tee $2 + local.tee $3 i32.const 0 i32.const 2 i32.const 3 @@ -14215,15 +14215,15 @@ call $~lib/rt/pure/__release local.get $27 call $~lib/rt/pure/__release - local.get $3 - call $~lib/rt/pure/__release - local.get $4 + local.get $2 call $~lib/rt/pure/__release local.get $5 call $~lib/rt/pure/__release + local.get $4 + call $~lib/rt/pure/__release local.get $6 call $~lib/rt/pure/__release - local.get $2 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release @@ -14701,19 +14701,19 @@ unreachable end i32.const 0 - local.set $2 + local.set $3 loop $loop|0 - local.get $2 + local.get $3 i32.const 100 i32.lt_s if global.get $std/array/arr call $~lib/array/Array#pop drop - local.get $2 + local.get $3 i32.const 1 i32.add - local.set $2 + local.set $3 br $loop|0 end end @@ -15282,21 +15282,8 @@ local.set $10 i32.const 0 global.set $~lib/argc - i32.const 0 - local.set $2 - block $1of1 - block $0of1 - block $outOfRange - global.get $~lib/argc - br_table $0of1 $1of1 $outOfRange - end - unreachable - end - i32.const 44 - local.set $2 - end local.get $10 - local.get $2 + i32.const 44 call $~lib/array/Array#sort call $~lib/rt/pure/__release local.get $10 @@ -15328,21 +15315,8 @@ local.set $15 i32.const 0 global.set $~lib/argc - i32.const 0 - local.set $2 - block $1of138 - block $0of139 - block $outOfRange40 - global.get $~lib/argc - br_table $0of139 $1of138 $outOfRange40 - end - unreachable - end - i32.const 45 - local.set $2 - end local.get $15 - local.get $2 + i32.const 45 call $~lib/array/Array#sort call $~lib/rt/pure/__release local.get $15 @@ -15374,21 +15348,8 @@ local.set $16 i32.const 0 global.set $~lib/argc - i32.const 0 - local.set $2 - block $1of141 - block $0of142 - block $outOfRange43 - global.get $~lib/argc - br_table $0of142 $1of141 $outOfRange43 - end - unreachable - end - i32.const 46 - local.set $2 - end local.get $16 - local.get $2 + i32.const 46 call $~lib/array/Array#sort call $~lib/rt/pure/__release local.get $16 @@ -15421,21 +15382,8 @@ local.set $17 i32.const 0 global.set $~lib/argc - i32.const 0 - local.set $4 - block $1of144 - block $0of145 - block $outOfRange46 - global.get $~lib/argc - br_table $0of145 $1of144 $outOfRange46 - end - unreachable - end - i32.const 47 - local.set $4 - end local.get $17 - local.get $4 + i32.const 47 call $~lib/array/Array#sort call $~lib/rt/pure/__release local.get $17 @@ -15463,7 +15411,7 @@ i32.const 3808 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $3 + local.tee $2 call $~lib/rt/pure/__retain local.set $28 i32.const 1 @@ -15472,7 +15420,7 @@ i32.const 3824 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $4 + local.tee $5 call $~lib/rt/pure/__retain local.set $18 i32.const 2 @@ -15481,7 +15429,7 @@ i32.const 3848 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $5 + local.tee $4 call $~lib/rt/pure/__retain local.set $19 i32.const 4 @@ -15499,7 +15447,7 @@ i32.const 3904 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $2 + local.tee $3 call $~lib/rt/pure/__retain local.set $7 i32.const 64 @@ -15662,15 +15610,15 @@ call $~lib/rt/pure/__release local.get $27 call $~lib/rt/pure/__release - local.get $3 + local.get $2 call $~lib/rt/pure/__release local.get $28 call $~lib/rt/pure/__release - local.get $4 + local.get $5 call $~lib/rt/pure/__release local.get $18 call $~lib/rt/pure/__release - local.get $5 + local.get $4 call $~lib/rt/pure/__release local.get $19 call $~lib/rt/pure/__release @@ -15678,7 +15626,7 @@ call $~lib/rt/pure/__release local.get $20 call $~lib/rt/pure/__release - local.get $2 + local.get $3 call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release @@ -15738,7 +15686,7 @@ call $~lib/rt/pure/__retain local.tee $0 call $~lib/rt/pure/__retain - local.set $5 + local.set $4 i32.const 7 i32.const 2 i32.const 13 @@ -15750,25 +15698,10 @@ local.set $6 i32.const 1 global.set $~lib/argc - i32.const 0 - local.set $2 - block $1of147 - block $0of148 - block $outOfRange49 - global.get $~lib/argc - i32.const 1 - i32.sub - br_table $0of148 $1of147 $outOfRange49 - end - unreachable - end - i32.const 55 - local.set $2 - end - local.get $5 - local.get $2 + local.get $4 + i32.const 55 call $std/array/assertSorted<~lib/string/String | null> - local.get $5 + local.get $4 local.get $6 call $std/array/isArraysEqual<~lib/string/String | null> i32.eqz @@ -15781,36 +15714,21 @@ unreachable end call $std/array/createRandomStringArray - local.set $2 + local.set $3 i32.const 1 global.set $~lib/argc - i32.const 0 - local.set $4 - block $1of150 - block $0of151 - block $outOfRange52 - global.get $~lib/argc - i32.const 1 - i32.sub - br_table $0of151 $1of150 $outOfRange52 - end - unreachable - end - i32.const 56 - local.set $4 - end - local.get $2 - local.get $4 + local.get $3 + i32.const 56 call $std/array/assertSorted<~lib/array/Array> local.get $0 call $~lib/rt/pure/__release - local.get $5 + local.get $4 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release local.get $6 call $~lib/rt/pure/__release - local.get $2 + local.get $3 call $~lib/rt/pure/__release i32.const 2 i32.const 0 @@ -15887,10 +15805,10 @@ i32.const 4672 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $3 + local.tee $2 i32.const 4696 call $~lib/array/Array#join - local.tee $4 + local.tee $5 i32.const 4720 call $~lib/string/String.__eq i32.eqz @@ -15935,7 +15853,7 @@ i32.const 6168 call $~lib/rt/__allocArray call $~lib/rt/pure/__retain - local.tee $5 + local.tee $4 i32.const 4248 call $~lib/array/Array<~lib/string/String | null>#join local.tee $6 @@ -15955,7 +15873,7 @@ i32.const 19 i32.const 0 call $~lib/rt/__allocArray - local.tee $2 + local.tee $3 i32.load offset=4 local.tee $1 call $std/array/Ref#constructor @@ -15971,7 +15889,7 @@ local.tee $1 call $~lib/rt/pure/__retain i32.store offset=8 - local.get $2 + local.get $3 call $~lib/rt/pure/__retain local.set $14 i32.const 4464 @@ -15979,10 +15897,10 @@ drop local.get $14 call $~lib/array/Array#join_ref - local.set $2 + local.set $3 i32.const 4464 call $~lib/rt/pure/__release - local.get $2 + local.get $3 i32.const 6248 call $~lib/string/String.__eq i32.eqz @@ -16006,15 +15924,15 @@ call $~lib/rt/pure/__release local.get $27 call $~lib/rt/pure/__release - local.get $3 + local.get $2 call $~lib/rt/pure/__release - local.get $4 + local.get $5 call $~lib/rt/pure/__release local.get $12 call $~lib/rt/pure/__release local.get $13 call $~lib/rt/pure/__release - local.get $5 + local.get $4 call $~lib/rt/pure/__release local.get $6 call $~lib/rt/pure/__release @@ -16024,7 +15942,7 @@ call $~lib/rt/pure/__release local.get $14 call $~lib/rt/pure/__release - local.get $2 + local.get $3 call $~lib/rt/pure/__release i32.const 0 i32.const 2 @@ -16130,10 +16048,10 @@ drop local.get $33 call $~lib/array/Array#join_int - local.set $3 + local.set $2 i32.const 4464 call $~lib/rt/pure/__release - local.get $3 + local.get $2 i32.const 6504 call $~lib/string/String.__eq i32.eqz @@ -16157,10 +16075,10 @@ drop local.get $34 call $~lib/array/Array#join_int - local.set $4 + local.set $5 i32.const 4464 call $~lib/rt/pure/__release - local.get $4 + local.get $5 i32.const 6560 call $~lib/string/String.__eq i32.eqz @@ -16184,10 +16102,10 @@ drop local.get $35 call $~lib/array/Array#join_int - local.set $5 + local.set $4 i32.const 4464 call $~lib/rt/pure/__release - local.get $5 + local.get $4 i32.const 6640 call $~lib/string/String.__eq i32.eqz @@ -16303,10 +16221,10 @@ drop local.get $7 call $~lib/array/Array<~lib/array/Array>#join_arr - local.set $2 + local.set $3 i32.const 4464 call $~lib/rt/pure/__release - local.get $2 + local.get $3 i32.const 7112 call $~lib/string/String.__eq i32.eqz @@ -16443,15 +16361,15 @@ call $~lib/rt/pure/__release local.get $33 call $~lib/rt/pure/__release - local.get $3 + local.get $2 call $~lib/rt/pure/__release local.get $34 call $~lib/rt/pure/__release - local.get $4 + local.get $5 call $~lib/rt/pure/__release local.get $35 call $~lib/rt/pure/__release - local.get $5 + local.get $4 call $~lib/rt/pure/__release local.get $36 call $~lib/rt/pure/__release @@ -16471,7 +16389,7 @@ call $~lib/rt/pure/__release local.get $13 call $~lib/rt/pure/__release - local.get $2 + local.get $3 call $~lib/rt/pure/__release local.get $14 call $~lib/rt/pure/__release diff --git a/tests/compiler/std/date.optimized.wat b/tests/compiler/std/date.optimized.wat index 66ad05beb2..18d9ef4aa9 100644 --- a/tests/compiler/std/date.optimized.wat +++ b/tests/compiler/std/date.optimized.wat @@ -161,7 +161,7 @@ end i32.const 48 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 48 global.set $~lib/rt/stub/offset global.get $std/date/creationTime local.set $1 diff --git a/tests/compiler/std/new.optimized.wat b/tests/compiler/std/new.optimized.wat index 3e2d84ab44..d537cbb35b 100644 --- a/tests/compiler/std/new.optimized.wat +++ b/tests/compiler/std/new.optimized.wat @@ -100,7 +100,7 @@ (func $start (; 3 ;) (type $FUNCSIG$v) i32.const 16 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 16 global.set $~lib/rt/stub/offset call $std/new/AClass#constructor global.set $std/new/aClass diff --git a/tests/compiler/std/object-literal.optimized.wat b/tests/compiler/std/object-literal.optimized.wat index 3c8c1d08ce..3241bbc8f6 100644 --- a/tests/compiler/std/object-literal.optimized.wat +++ b/tests/compiler/std/object-literal.optimized.wat @@ -203,7 +203,7 @@ (local $0 i32) i32.const 112 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 112 global.set $~lib/rt/stub/offset i32.const 8 i32.const 3 diff --git a/tests/compiler/std/operator-overloading.optimized.wat b/tests/compiler/std/operator-overloading.optimized.wat index 7c359f999e..6c7927dd2b 100644 --- a/tests/compiler/std/operator-overloading.optimized.wat +++ b/tests/compiler/std/operator-overloading.optimized.wat @@ -1225,7 +1225,7 @@ (local $1 i32) i32.const 80 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 80 global.set $~lib/rt/stub/offset i32.const 1 i32.const 2 diff --git a/tests/compiler/std/pointer.optimized.wat b/tests/compiler/std/pointer.optimized.wat index e4e7ee332f..2dbea92c9e 100644 --- a/tests/compiler/std/pointer.optimized.wat +++ b/tests/compiler/std/pointer.optimized.wat @@ -239,17 +239,6 @@ global.set $std/pointer/one i32.const 24 global.set $std/pointer/two - global.get $std/pointer/one - i32.const 8 - i32.ne - if - i32.const 0 - i32.const 24 - i32.const 78 - i32.const 0 - call $~lib/builtins/abort - unreachable - end global.get $std/pointer/two i32.const 24 i32.ne @@ -463,15 +452,13 @@ end i32.const 0 global.set $std/pointer/buf - global.get $std/pointer/buf + i32.const 0 f32.const 1.100000023841858 f32.store - global.get $std/pointer/buf i32.const 4 - i32.add f32.const 1.2000000476837158 f32.store - global.get $std/pointer/buf + i32.const 0 f32.load f32.const 1.100000023841858 f32.ne diff --git a/tests/compiler/std/static-array.optimized.wat b/tests/compiler/std/static-array.optimized.wat index 80fd68402c..5fbb3dd8ed 100644 --- a/tests/compiler/std/static-array.optimized.wat +++ b/tests/compiler/std/static-array.optimized.wat @@ -892,7 +892,7 @@ end i32.const 512 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 512 global.set $~lib/rt/stub/offset call $~lib/array/Array#__set i32.const 0 diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index 5ece103c32..b2b22157ce 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -8977,7 +8977,7 @@ end i32.const 3000 global.set $std/string/str - global.get $std/string/str + i32.const 3000 i32.const 0 i32.const 2147483647 call $~lib/string/String#slice diff --git a/tests/compiler/std/symbol.optimized.wat b/tests/compiler/std/symbol.optimized.wat index b2dd56a267..e51df11398 100644 --- a/tests/compiler/std/symbol.optimized.wat +++ b/tests/compiler/std/symbol.optimized.wat @@ -1524,7 +1524,7 @@ end i32.const 992 global.set $~lib/rt/stub/startOffset - global.get $~lib/rt/stub/startOffset + i32.const 992 global.set $~lib/rt/stub/offset call $~lib/symbol/_Symbol.for global.set $std/symbol/sym3 @@ -1638,7 +1638,7 @@ global.set $std/symbol/hasInstance i32.const 2 global.set $std/symbol/isConcatSpreadable - global.get $std/symbol/hasInstance + i32.const 1 call $~lib/symbol/_Symbol#toString i32.const 872 call $~lib/string/String.__eq diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index aec8a5d6a9..6975da530b 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -23297,21 +23297,21 @@ (local $7 i32) i32.const 1768 call $~lib/rt/pure/__retain - local.tee $4 + local.tee $3 i32.load offset=12 - local.tee $5 + local.tee $4 call $~lib/typedarray/Int8Array#constructor local.tee $6 call $~lib/rt/pure/__retain local.set $0 loop $loop|0 local.get $1 - local.get $5 + local.get $4 i32.lt_s if local.get $0 local.get $1 - local.get $4 + local.get $3 local.get $1 call $~lib/array/Array#__get i32.const 24 @@ -23340,35 +23340,22 @@ local.set $1 i32.const 1 global.set $~lib/argc - block $2of2 - block $1of2 - block $outOfRange - global.get $~lib/argc - i32.const 1 - i32.sub - br_table $1of2 $1of2 $2of2 $outOfRange - end - unreachable - end - i32.const -1 - local.set $2 - end local.get $1 - local.get $2 + i32.const -1 call $~lib/typedarray/Int8Array.wrap - local.set $2 + local.set $5 i32.const 0 call $~lib/rt/pure/__release loop $loop|1 - local.get $3 - local.get $5 + local.get $2 + local.get $4 i32.lt_s if local.get $0 - local.get $3 + local.get $2 call $~lib/typedarray/Int8Array#__get + local.get $5 local.get $2 - local.get $3 call $~lib/typedarray/Int8Array#__get i32.ne if @@ -23379,10 +23366,10 @@ call $~lib/builtins/abort unreachable else - local.get $3 + local.get $2 i32.const 1 i32.add - local.set $3 + local.set $2 br $loop|1 end unreachable @@ -23392,13 +23379,13 @@ call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release - local.get $4 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $2 + local.get $5 call $~lib/rt/pure/__release ) (func $~lib/typedarray/Uint8Array.wrap (; 354 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -23518,21 +23505,21 @@ (local $7 i32) i32.const 1768 call $~lib/rt/pure/__retain - local.tee $4 + local.tee $3 i32.load offset=12 - local.tee $5 + local.tee $4 call $~lib/typedarray/Uint8Array#constructor local.tee $6 call $~lib/rt/pure/__retain local.set $0 loop $loop|0 local.get $1 - local.get $5 + local.get $4 i32.lt_s if local.get $0 local.get $1 - local.get $4 + local.get $3 local.get $1 call $~lib/array/Array#__get i32.const 255 @@ -23559,35 +23546,22 @@ local.set $1 i32.const 1 global.set $~lib/argc - block $2of2 - block $1of2 - block $outOfRange - global.get $~lib/argc - i32.const 1 - i32.sub - br_table $1of2 $1of2 $2of2 $outOfRange - end - unreachable - end - i32.const -1 - local.set $2 - end local.get $1 - local.get $2 + i32.const -1 call $~lib/typedarray/Uint8Array.wrap - local.set $2 + local.set $5 i32.const 0 call $~lib/rt/pure/__release loop $loop|1 - local.get $3 - local.get $5 + local.get $2 + local.get $4 i32.lt_s if local.get $0 - local.get $3 + local.get $2 call $~lib/typedarray/Uint8Array#__get + local.get $5 local.get $2 - local.get $3 call $~lib/typedarray/Uint8Array#__get i32.ne if @@ -23598,10 +23572,10 @@ call $~lib/builtins/abort unreachable else - local.get $3 + local.get $2 i32.const 1 i32.add - local.set $3 + local.set $2 br $loop|1 end unreachable @@ -23611,13 +23585,13 @@ call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release - local.get $4 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $2 + local.get $5 call $~lib/rt/pure/__release ) (func $~lib/typedarray/Uint8ClampedArray.wrap (; 356 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -23737,21 +23711,21 @@ (local $7 i32) i32.const 1768 call $~lib/rt/pure/__retain - local.tee $4 + local.tee $3 i32.load offset=12 - local.tee $5 + local.tee $4 call $~lib/typedarray/Uint8ClampedArray#constructor local.tee $6 call $~lib/rt/pure/__retain local.set $0 loop $loop|0 local.get $1 - local.get $5 + local.get $4 i32.lt_s if local.get $0 local.get $1 - local.get $4 + local.get $3 local.get $1 call $~lib/array/Array#__get i32.const 255 @@ -23778,35 +23752,22 @@ local.set $1 i32.const 1 global.set $~lib/argc - block $2of2 - block $1of2 - block $outOfRange - global.get $~lib/argc - i32.const 1 - i32.sub - br_table $1of2 $1of2 $2of2 $outOfRange - end - unreachable - end - i32.const -1 - local.set $2 - end local.get $1 - local.get $2 + i32.const -1 call $~lib/typedarray/Uint8ClampedArray.wrap - local.set $2 + local.set $5 i32.const 0 call $~lib/rt/pure/__release loop $loop|1 - local.get $3 - local.get $5 + local.get $2 + local.get $4 i32.lt_s if local.get $0 - local.get $3 + local.get $2 call $~lib/typedarray/Uint8ClampedArray#__get + local.get $5 local.get $2 - local.get $3 call $~lib/typedarray/Uint8ClampedArray#__get i32.ne if @@ -23817,10 +23778,10 @@ call $~lib/builtins/abort unreachable else - local.get $3 + local.get $2 i32.const 1 i32.add - local.set $3 + local.set $2 br $loop|1 end unreachable @@ -23830,13 +23791,13 @@ call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release - local.get $4 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $2 + local.get $5 call $~lib/rt/pure/__release ) (func $~lib/typedarray/Int16Array.wrap (; 358 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -23959,21 +23920,21 @@ (local $7 i32) i32.const 1768 call $~lib/rt/pure/__retain - local.tee $4 + local.tee $3 i32.load offset=12 - local.tee $5 + local.tee $4 call $~lib/typedarray/Int16Array#constructor local.tee $6 call $~lib/rt/pure/__retain local.set $0 loop $loop|0 local.get $1 - local.get $5 + local.get $4 i32.lt_s if local.get $0 local.get $1 - local.get $4 + local.get $3 local.get $1 call $~lib/array/Array#__get i32.const 16 @@ -24002,35 +23963,22 @@ local.set $1 i32.const 1 global.set $~lib/argc - block $2of2 - block $1of2 - block $outOfRange - global.get $~lib/argc - i32.const 1 - i32.sub - br_table $1of2 $1of2 $2of2 $outOfRange - end - unreachable - end - i32.const -1 - local.set $2 - end local.get $1 - local.get $2 + i32.const -1 call $~lib/typedarray/Int16Array.wrap - local.set $2 + local.set $5 i32.const 0 call $~lib/rt/pure/__release loop $loop|1 - local.get $3 - local.get $5 + local.get $2 + local.get $4 i32.lt_s if local.get $0 - local.get $3 + local.get $2 call $~lib/typedarray/Int16Array#__get + local.get $5 local.get $2 - local.get $3 call $~lib/typedarray/Int16Array#__get i32.ne if @@ -24041,10 +23989,10 @@ call $~lib/builtins/abort unreachable else - local.get $3 + local.get $2 i32.const 1 i32.add - local.set $3 + local.set $2 br $loop|1 end unreachable @@ -24054,13 +24002,13 @@ call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release - local.get $4 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $2 + local.get $5 call $~lib/rt/pure/__release ) (func $~lib/typedarray/Uint16Array.wrap (; 360 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -24183,21 +24131,21 @@ (local $7 i32) i32.const 1768 call $~lib/rt/pure/__retain - local.tee $4 + local.tee $3 i32.load offset=12 - local.tee $5 + local.tee $4 call $~lib/typedarray/Uint16Array#constructor local.tee $6 call $~lib/rt/pure/__retain local.set $0 loop $loop|0 local.get $1 - local.get $5 + local.get $4 i32.lt_s if local.get $0 local.get $1 - local.get $4 + local.get $3 local.get $1 call $~lib/array/Array#__get i32.const 65535 @@ -24224,35 +24172,22 @@ local.set $1 i32.const 1 global.set $~lib/argc - block $2of2 - block $1of2 - block $outOfRange - global.get $~lib/argc - i32.const 1 - i32.sub - br_table $1of2 $1of2 $2of2 $outOfRange - end - unreachable - end - i32.const -1 - local.set $2 - end local.get $1 - local.get $2 + i32.const -1 call $~lib/typedarray/Uint16Array.wrap - local.set $2 + local.set $5 i32.const 0 call $~lib/rt/pure/__release loop $loop|1 - local.get $3 - local.get $5 + local.get $2 + local.get $4 i32.lt_s if local.get $0 - local.get $3 + local.get $2 call $~lib/typedarray/Uint16Array#__get + local.get $5 local.get $2 - local.get $3 call $~lib/typedarray/Uint16Array#__get i32.ne if @@ -24263,10 +24198,10 @@ call $~lib/builtins/abort unreachable else - local.get $3 + local.get $2 i32.const 1 i32.add - local.set $3 + local.set $2 br $loop|1 end unreachable @@ -24276,13 +24211,13 @@ call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release - local.get $4 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $2 + local.get $5 call $~lib/rt/pure/__release ) (func $~lib/typedarray/Int32Array.wrap (; 362 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -24405,21 +24340,21 @@ (local $7 i32) i32.const 1768 call $~lib/rt/pure/__retain - local.tee $4 + local.tee $3 i32.load offset=12 - local.tee $5 + local.tee $4 call $~lib/typedarray/Int32Array#constructor local.tee $6 call $~lib/rt/pure/__retain local.set $0 loop $loop|0 local.get $1 - local.get $5 + local.get $4 i32.lt_s if local.get $0 local.get $1 - local.get $4 + local.get $3 local.get $1 call $~lib/array/Array#__get call $~lib/typedarray/Int32Array#__set @@ -24444,35 +24379,22 @@ local.set $1 i32.const 1 global.set $~lib/argc - block $2of2 - block $1of2 - block $outOfRange - global.get $~lib/argc - i32.const 1 - i32.sub - br_table $1of2 $1of2 $2of2 $outOfRange - end - unreachable - end - i32.const -1 - local.set $2 - end local.get $1 - local.get $2 + i32.const -1 call $~lib/typedarray/Int32Array.wrap - local.set $2 + local.set $5 i32.const 0 call $~lib/rt/pure/__release loop $loop|1 - local.get $3 - local.get $5 + local.get $2 + local.get $4 i32.lt_s if local.get $0 - local.get $3 + local.get $2 call $~lib/typedarray/Int32Array#__get + local.get $5 local.get $2 - local.get $3 call $~lib/typedarray/Int32Array#__get i32.ne if @@ -24483,10 +24405,10 @@ call $~lib/builtins/abort unreachable else - local.get $3 + local.get $2 i32.const 1 i32.add - local.set $3 + local.set $2 br $loop|1 end unreachable @@ -24496,13 +24418,13 @@ call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release - local.get $4 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $2 + local.get $5 call $~lib/rt/pure/__release ) (func $~lib/typedarray/Uint32Array.wrap (; 364 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -24625,21 +24547,21 @@ (local $7 i32) i32.const 1768 call $~lib/rt/pure/__retain - local.tee $4 + local.tee $3 i32.load offset=12 - local.tee $5 + local.tee $4 call $~lib/typedarray/Uint32Array#constructor local.tee $6 call $~lib/rt/pure/__retain local.set $0 loop $loop|0 local.get $1 - local.get $5 + local.get $4 i32.lt_s if local.get $0 local.get $1 - local.get $4 + local.get $3 local.get $1 call $~lib/array/Array#__get call $~lib/typedarray/Uint32Array#__set @@ -24664,35 +24586,22 @@ local.set $1 i32.const 1 global.set $~lib/argc - block $2of2 - block $1of2 - block $outOfRange - global.get $~lib/argc - i32.const 1 - i32.sub - br_table $1of2 $1of2 $2of2 $outOfRange - end - unreachable - end - i32.const -1 - local.set $2 - end local.get $1 - local.get $2 + i32.const -1 call $~lib/typedarray/Uint32Array.wrap - local.set $2 + local.set $5 i32.const 0 call $~lib/rt/pure/__release loop $loop|1 - local.get $3 - local.get $5 + local.get $2 + local.get $4 i32.lt_s if local.get $0 - local.get $3 + local.get $2 call $~lib/typedarray/Uint32Array#__get + local.get $5 local.get $2 - local.get $3 call $~lib/typedarray/Uint32Array#__get i32.ne if @@ -24703,10 +24612,10 @@ call $~lib/builtins/abort unreachable else - local.get $3 + local.get $2 i32.const 1 i32.add - local.set $3 + local.set $2 br $loop|1 end unreachable @@ -24716,13 +24625,13 @@ call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release - local.get $4 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $2 + local.get $5 call $~lib/rt/pure/__release ) (func $~lib/typedarray/Int64Array.wrap (; 366 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -24845,21 +24754,21 @@ (local $7 i32) i32.const 1768 call $~lib/rt/pure/__retain - local.tee $4 + local.tee $3 i32.load offset=12 - local.tee $5 + local.tee $4 call $~lib/typedarray/Int64Array#constructor local.tee $6 call $~lib/rt/pure/__retain local.set $0 loop $loop|0 local.get $1 - local.get $5 + local.get $4 i32.lt_s if local.get $0 local.get $1 - local.get $4 + local.get $3 local.get $1 call $~lib/array/Array#__get i64.extend_i32_s @@ -24885,35 +24794,22 @@ local.set $1 i32.const 1 global.set $~lib/argc - block $2of2 - block $1of2 - block $outOfRange - global.get $~lib/argc - i32.const 1 - i32.sub - br_table $1of2 $1of2 $2of2 $outOfRange - end - unreachable - end - i32.const -1 - local.set $2 - end local.get $1 - local.get $2 + i32.const -1 call $~lib/typedarray/Int64Array.wrap - local.set $2 + local.set $5 i32.const 0 call $~lib/rt/pure/__release loop $loop|1 - local.get $3 - local.get $5 + local.get $2 + local.get $4 i32.lt_s if local.get $0 - local.get $3 + local.get $2 call $~lib/typedarray/Int64Array#__get + local.get $5 local.get $2 - local.get $3 call $~lib/typedarray/Int64Array#__get i64.ne if @@ -24924,10 +24820,10 @@ call $~lib/builtins/abort unreachable else - local.get $3 + local.get $2 i32.const 1 i32.add - local.set $3 + local.set $2 br $loop|1 end unreachable @@ -24937,13 +24833,13 @@ call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release - local.get $4 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $2 + local.get $5 call $~lib/rt/pure/__release ) (func $~lib/typedarray/Uint64Array.wrap (; 368 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -25066,21 +24962,21 @@ (local $7 i32) i32.const 1768 call $~lib/rt/pure/__retain - local.tee $4 + local.tee $3 i32.load offset=12 - local.tee $5 + local.tee $4 call $~lib/typedarray/Uint64Array#constructor local.tee $6 call $~lib/rt/pure/__retain local.set $0 loop $loop|0 local.get $1 - local.get $5 + local.get $4 i32.lt_s if local.get $0 local.get $1 - local.get $4 + local.get $3 local.get $1 call $~lib/array/Array#__get i64.extend_i32_s @@ -25106,35 +25002,22 @@ local.set $1 i32.const 1 global.set $~lib/argc - block $2of2 - block $1of2 - block $outOfRange - global.get $~lib/argc - i32.const 1 - i32.sub - br_table $1of2 $1of2 $2of2 $outOfRange - end - unreachable - end - i32.const -1 - local.set $2 - end local.get $1 - local.get $2 + i32.const -1 call $~lib/typedarray/Uint64Array.wrap - local.set $2 + local.set $5 i32.const 0 call $~lib/rt/pure/__release loop $loop|1 - local.get $3 - local.get $5 + local.get $2 + local.get $4 i32.lt_s if local.get $0 - local.get $3 + local.get $2 call $~lib/typedarray/Uint64Array#__get + local.get $5 local.get $2 - local.get $3 call $~lib/typedarray/Uint64Array#__get i64.ne if @@ -25145,10 +25028,10 @@ call $~lib/builtins/abort unreachable else - local.get $3 + local.get $2 i32.const 1 i32.add - local.set $3 + local.set $2 br $loop|1 end unreachable @@ -25158,13 +25041,13 @@ call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release - local.get $4 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $2 + local.get $5 call $~lib/rt/pure/__release ) (func $~lib/typedarray/Float32Array.wrap (; 370 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -25287,21 +25170,21 @@ (local $7 i32) i32.const 1768 call $~lib/rt/pure/__retain - local.tee $4 + local.tee $3 i32.load offset=12 - local.tee $5 + local.tee $4 call $~lib/typedarray/Float32Array#constructor local.tee $6 call $~lib/rt/pure/__retain local.set $0 loop $loop|0 local.get $1 - local.get $5 + local.get $4 i32.lt_s if local.get $0 local.get $1 - local.get $4 + local.get $3 local.get $1 call $~lib/array/Array#__get f32.convert_i32_s @@ -25327,35 +25210,22 @@ local.set $1 i32.const 1 global.set $~lib/argc - block $2of2 - block $1of2 - block $outOfRange - global.get $~lib/argc - i32.const 1 - i32.sub - br_table $1of2 $1of2 $2of2 $outOfRange - end - unreachable - end - i32.const -1 - local.set $2 - end local.get $1 - local.get $2 + i32.const -1 call $~lib/typedarray/Float32Array.wrap - local.set $2 + local.set $5 i32.const 0 call $~lib/rt/pure/__release loop $loop|1 - local.get $3 - local.get $5 + local.get $2 + local.get $4 i32.lt_s if local.get $0 - local.get $3 + local.get $2 call $~lib/typedarray/Float32Array#__get + local.get $5 local.get $2 - local.get $3 call $~lib/typedarray/Float32Array#__get f32.ne if @@ -25366,10 +25236,10 @@ call $~lib/builtins/abort unreachable else - local.get $3 + local.get $2 i32.const 1 i32.add - local.set $3 + local.set $2 br $loop|1 end unreachable @@ -25379,13 +25249,13 @@ call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release - local.get $4 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $2 + local.get $5 call $~lib/rt/pure/__release ) (func $~lib/typedarray/Float64Array.wrap (; 372 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) @@ -25508,21 +25378,21 @@ (local $7 i32) i32.const 1768 call $~lib/rt/pure/__retain - local.tee $4 + local.tee $3 i32.load offset=12 - local.tee $5 + local.tee $4 call $~lib/typedarray/Float64Array#constructor local.tee $6 call $~lib/rt/pure/__retain local.set $0 loop $loop|0 local.get $1 - local.get $5 + local.get $4 i32.lt_s if local.get $0 local.get $1 - local.get $4 + local.get $3 local.get $1 call $~lib/array/Array#__get f64.convert_i32_s @@ -25548,35 +25418,22 @@ local.set $1 i32.const 1 global.set $~lib/argc - block $2of2 - block $1of2 - block $outOfRange - global.get $~lib/argc - i32.const 1 - i32.sub - br_table $1of2 $1of2 $2of2 $outOfRange - end - unreachable - end - i32.const -1 - local.set $2 - end local.get $1 - local.get $2 + i32.const -1 call $~lib/typedarray/Float64Array.wrap - local.set $2 + local.set $5 i32.const 0 call $~lib/rt/pure/__release loop $loop|1 - local.get $3 - local.get $5 + local.get $2 + local.get $4 i32.lt_s if local.get $0 - local.get $3 + local.get $2 call $~lib/typedarray/Float64Array#__get + local.get $5 local.get $2 - local.get $3 call $~lib/typedarray/Float64Array#__get f64.ne if @@ -25587,10 +25444,10 @@ call $~lib/builtins/abort unreachable else - local.get $3 + local.get $2 i32.const 1 i32.add - local.set $3 + local.set $2 br $loop|1 end unreachable @@ -25600,13 +25457,13 @@ call $~lib/rt/pure/__release local.get $7 call $~lib/rt/pure/__release - local.get $4 + local.get $3 call $~lib/rt/pure/__release local.get $0 call $~lib/rt/pure/__release local.get $1 call $~lib/rt/pure/__release - local.get $2 + local.get $5 call $~lib/rt/pure/__release ) (func $start:std/typedarray (; 374 ;) (type $FUNCSIG$v) @@ -25864,21 +25721,8 @@ end i32.const 0 global.set $~lib/argc - i32.const 0 - local.set $0 - block $1of1 - block $0of1 - block $outOfRange - global.get $~lib/argc - br_table $0of1 $1of1 $outOfRange - end - unreachable - end - i32.const 1 - local.set $0 - end local.get $1 - local.get $0 + i32.const 1 call $~lib/typedarray/Float64Array#sort call $~lib/rt/pure/__release local.get $1 diff --git a/tests/compiler/unary.optimized.wat b/tests/compiler/unary.optimized.wat index 38c2bba4f9..cfa2553843 100644 --- a/tests/compiler/unary.optimized.wat +++ b/tests/compiler/unary.optimized.wat @@ -36,9 +36,7 @@ global.set $unary/i i32.const -2 global.set $unary/i - i32.const 0 - global.get $unary/i - i32.sub + i32.const 2 global.set $unary/i global.get $unary/i i32.eqz @@ -93,9 +91,7 @@ global.set $unary/I i64.const -2 global.set $unary/I - i64.const 0 - global.get $unary/I - i64.sub + i64.const 2 global.set $unary/I global.get $unary/I i64.eqz @@ -149,8 +145,7 @@ global.set $unary/f i32.const 0 global.set $unary/i - global.get $unary/f - f32.neg + f32.const 1.25 global.set $unary/f global.get $unary/f f32.const 0 @@ -200,8 +195,7 @@ global.set $unary/F i64.const 0 global.set $unary/I - global.get $unary/F - f64.neg + f64.const 1.25 global.set $unary/F global.get $unary/F f64.const 0