From 629736209b647810e690a1f08fd4d9a01f513ea5 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Wed, 30 Sep 2020 17:06:40 +0300 Subject: [PATCH 1/5] init --- package-lock.json | 6 +++--- package.json | 2 +- tests/compiler/std/math.optimized.wat | 12 +++++------- tests/compiler/std/string.optimized.wat | 3 ++- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 184f4f2e12..6aa5f48bea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1163,9 +1163,9 @@ "optional": true }, "binaryen": { - "version": "97.0.0-nightly.20200929", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-97.0.0-nightly.20200929.tgz", - "integrity": "sha512-HQ7VTISqwfVOylWJAE2jIyhuO5zrxTD2Vvc0cwtXTUqfmlbZdt/Z0vxUZD+uFYHRLM0p9ddJc7RPVGsvPI2oEQ==" + "version": "97.0.0-nightly.20200930", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-97.0.0-nightly.20200930.tgz", + "integrity": "sha512-9m7sRRh5trGcZvKS4EnCq1+CKbXvrHdUSJ2hIY5aPHCqxil7dEZCHTCUU9VzbkhrEXSHWfwxbHpnYTahjVCueQ==" }, "bluebird": { "version": "3.7.2", diff --git a/package.json b/package.json index ea2fdc2d33..fad1ccc927 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "url": "https://github.com/AssemblyScript/assemblyscript/issues" }, "dependencies": { - "binaryen": "97.0.0-nightly.20200929", + "binaryen": "97.0.0-nightly.20200930", "long": "^4.0.0", "source-map-support": "^0.5.19", "ts-node": "^6.2.0" diff --git a/tests/compiler/std/math.optimized.wat b/tests/compiler/std/math.optimized.wat index 9eaec6027b..a5df160a97 100644 --- a/tests/compiler/std/math.optimized.wat +++ b/tests/compiler/std/math.optimized.wat @@ -187,16 +187,14 @@ i64.reinterpret_f64 i64.const 63 i64.shr_u - i64.const 0 - i64.ne + i32.wrap_i64 i32.const 0 i32.ne local.get $1 i64.reinterpret_f64 i64.const 63 i64.shr_u - i64.const 0 - i64.ne + i32.wrap_i64 i32.const 0 i32.ne i32.eq @@ -5214,7 +5212,8 @@ local.get $3 i64.const 63 i64.shr_u - i64.eqz + i32.wrap_i64 + i32.eqz br_if $~lib/util/math/exp2_lut|inlined.0 drop f64.const 0 @@ -11085,8 +11084,7 @@ local.get $1 i64.const 1 i64.and - i64.const 0 - i64.ne + i32.wrap_i64 select local.set $2 local.get $1 diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index 9d5f4b26f1..e39ff58313 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -9246,7 +9246,8 @@ i64.reinterpret_f64 i64.const 63 i64.shr_u - i64.eqz + i32.wrap_i64 + i32.eqz if i32.const 0 i32.const 1088 From 88c5919c8c972425990a1daa189eb49af8a103bf Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Thu, 1 Oct 2020 03:48:55 +0300 Subject: [PATCH 2/5] update --- package-lock.json | 6 ++-- package.json | 2 +- tests/compiler/binary.optimized.wat | 24 ++++++++++++++++ tests/compiler/std/math.optimized.wat | 3 +- tests/compiler/std/string.optimized.wat | 3 +- tests/compiler/std/typedarray.optimized.wat | 32 ++++++++------------- 6 files changed, 42 insertions(+), 28 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6aa5f48bea..58aca3972d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1163,9 +1163,9 @@ "optional": true }, "binaryen": { - "version": "97.0.0-nightly.20200930", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-97.0.0-nightly.20200930.tgz", - "integrity": "sha512-9m7sRRh5trGcZvKS4EnCq1+CKbXvrHdUSJ2hIY5aPHCqxil7dEZCHTCUU9VzbkhrEXSHWfwxbHpnYTahjVCueQ==" + "version": "97.0.0-nightly.20201001", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-97.0.0-nightly.20201001.tgz", + "integrity": "sha512-aekeEQ9F/x/82kBs9woCxd+AlWY53GEOQVHWsfSp+vhuI3vnqLbrsgNeV/ldIH9GiDs/F6WXo8Pj3iBE15JO2Q==" }, "bluebird": { "version": "3.7.2", diff --git a/package.json b/package.json index fad1ccc927..efcf031a8e 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "url": "https://github.com/AssemblyScript/assemblyscript/issues" }, "dependencies": { - "binaryen": "97.0.0-nightly.20200930", + "binaryen": "97.0.0-nightly.20201001", "long": "^4.0.0", "source-map-support": "^0.5.19", "ts-node": "^6.2.0" diff --git a/tests/compiler/binary.optimized.wat b/tests/compiler/binary.optimized.wat index 818d1ff040..640da09506 100644 --- a/tests/compiler/binary.optimized.wat +++ b/tests/compiler/binary.optimized.wat @@ -185,6 +185,14 @@ f32.sub global.set $binary/f global.get $binary/f + f32.const 1 + f32.mul + global.set $binary/f + global.get $binary/f + f32.const 1 + f32.div + global.set $binary/f + global.get $binary/f call $~lib/math/NativeMathf.mod global.set $binary/f global.get $binary/f @@ -196,6 +204,10 @@ f32.sub global.set $binary/f global.get $binary/f + f32.const 1 + f32.mul + global.set $binary/f + global.get $binary/f call $~lib/math/NativeMathf.mod global.set $binary/f global.get $binary/F @@ -210,6 +222,14 @@ f64.sub global.set $binary/F global.get $binary/F + f64.const 1 + f64.mul + global.set $binary/F + global.get $binary/F + f64.const 1 + f64.div + global.set $binary/F + global.get $binary/F call $~lib/math/NativeMath.mod global.set $binary/F global.get $binary/F @@ -221,6 +241,10 @@ f64.sub global.set $binary/F global.get $binary/F + f64.const 1 + f64.mul + global.set $binary/F + global.get $binary/F call $~lib/math/NativeMath.mod global.set $binary/F ) diff --git a/tests/compiler/std/math.optimized.wat b/tests/compiler/std/math.optimized.wat index a5df160a97..b23e9028df 100644 --- a/tests/compiler/std/math.optimized.wat +++ b/tests/compiler/std/math.optimized.wat @@ -5212,8 +5212,7 @@ local.get $3 i64.const 63 i64.shr_u - i32.wrap_i64 - i32.eqz + i64.eqz br_if $~lib/util/math/exp2_lut|inlined.0 drop f64.const 0 diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index e39ff58313..9d5f4b26f1 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -9246,8 +9246,7 @@ i64.reinterpret_f64 i64.const 63 i64.shr_u - i32.wrap_i64 - i32.eqz + i64.eqz if i32.const 0 i32.const 1088 diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index dad96f2d68..e0c4b0199b 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -8985,17 +8985,15 @@ (func $std/typedarray/testArrayEvery<~lib/typedarray/Int8Array,i8>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $2 call $~lib/rt/pure/__retain + call $~lib/rt/pure/__release local.get $0 i32.const 24 i32.shl i32.const 24 i32.shr_s - i32.const 2 - i32.rem_s + i32.const 1 + i32.and i32.eqz - local.set $0 - call $~lib/rt/pure/__release - local.get $0 ) (func $~lib/typedarray/Int8Array#every (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -9132,17 +9130,15 @@ (func $std/typedarray/testArrayEvery<~lib/typedarray/Int16Array,i16>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $2 call $~lib/rt/pure/__retain + call $~lib/rt/pure/__release local.get $0 i32.const 16 i32.shl i32.const 16 i32.shr_s - i32.const 2 - i32.rem_s + i32.const 1 + i32.and i32.eqz - local.set $0 - call $~lib/rt/pure/__release - local.get $0 ) (func $~lib/typedarray/Int16Array#every (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -9281,13 +9277,11 @@ (func $std/typedarray/testArrayEvery<~lib/typedarray/Int32Array,i32>~anonymous|0 (param $0 i32) (param $1 i32) (param $2 i32) (result i32) local.get $2 call $~lib/rt/pure/__retain - local.get $0 - i32.const 2 - i32.rem_s - i32.eqz - local.set $0 call $~lib/rt/pure/__release local.get $0 + i32.const 1 + i32.and + i32.eqz ) (func $~lib/typedarray/Int32Array#every (param $0 i32) (param $1 i32) (result i32) (local $2 i32) @@ -9359,13 +9353,11 @@ (func $std/typedarray/testArrayEvery<~lib/typedarray/Int64Array,i64>~anonymous|0 (param $0 i64) (param $1 i32) (param $2 i32) (result i32) local.get $2 call $~lib/rt/pure/__retain + call $~lib/rt/pure/__release local.get $0 - i64.const 2 - i64.rem_s + i64.const 1 + i64.and i64.eqz - local.set $2 - call $~lib/rt/pure/__release - local.get $2 ) (func $~lib/typedarray/Int64Array#every (param $0 i32) (param $1 i32) (result i32) (local $2 i32) From 5d907c01b529d0e87c58690cfa488a09f095c93d Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Fri, 2 Oct 2020 03:56:37 +0300 Subject: [PATCH 3/5] update binaryen --- package-lock.json | 6 +++--- package.json | 2 +- tests/compiler/do.optimized.wat | 12 ++++-------- tests/compiler/extends-baseaggregate.optimized.wat | 12 ++++-------- tests/compiler/for.optimized.wat | 12 ++++-------- tests/compiler/implicit-getter-setter.optimized.wat | 12 ++++-------- tests/compiler/issues/1095.optimized.wat | 12 ++++-------- tests/compiler/issues/1225.optimized.wat | 12 ++++-------- tests/compiler/logical.optimized.wat | 12 ++++-------- tests/compiler/managed-cast.optimized.wat | 12 ++++-------- tests/compiler/object-literal.optimized.wat | 12 ++++-------- tests/compiler/rc/local-init.optimized.wat | 12 ++++-------- tests/compiler/rc/logical-and-mismatch.optimized.wat | 12 ++++-------- tests/compiler/rc/logical-or-mismatch.optimized.wat | 12 ++++-------- tests/compiler/rc/optimize.optimized.wat | 12 ++++-------- tests/compiler/rc/rereturn.optimized.wat | 12 ++++-------- tests/compiler/rc/ternary-mismatch.optimized.wat | 12 ++++-------- tests/compiler/resolve-ternary.optimized.wat | 12 ++++-------- tests/compiler/retain-release-sanity.optimized.wat | 12 ++++-------- tests/compiler/retain-return.optimized.wat | 12 ++++-------- tests/compiler/rt/finalize.optimized.wat | 12 ++++-------- tests/compiler/runtime-full.optimized.wat | 12 ++++-------- tests/compiler/std/array-literal.optimized.wat | 12 ++++-------- tests/compiler/std/array.optimized.wat | 12 ++++-------- tests/compiler/std/arraybuffer.optimized.wat | 12 ++++-------- tests/compiler/std/dataview.optimized.wat | 12 ++++-------- tests/compiler/std/map.optimized.wat | 12 ++++-------- tests/compiler/std/set.optimized.wat | 12 ++++-------- tests/compiler/std/staticarray.optimized.wat | 12 ++++-------- tests/compiler/std/string-casemapping.optimized.wat | 12 ++++-------- tests/compiler/std/string-encoding.optimized.wat | 12 ++++-------- tests/compiler/std/string.optimized.wat | 12 ++++-------- tests/compiler/std/typedarray.optimized.wat | 12 ++++-------- tests/compiler/while.optimized.wat | 12 ++++-------- 34 files changed, 132 insertions(+), 260 deletions(-) diff --git a/package-lock.json b/package-lock.json index 58aca3972d..7e45680e0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1163,9 +1163,9 @@ "optional": true }, "binaryen": { - "version": "97.0.0-nightly.20201001", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-97.0.0-nightly.20201001.tgz", - "integrity": "sha512-aekeEQ9F/x/82kBs9woCxd+AlWY53GEOQVHWsfSp+vhuI3vnqLbrsgNeV/ldIH9GiDs/F6WXo8Pj3iBE15JO2Q==" + "version": "97.0.0-nightly.20201002", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-97.0.0-nightly.20201002.tgz", + "integrity": "sha512-QZJ21TxsOHEufG75lZ3aMjQY0nAEHZ3qJJE2ZN4DLPsbcg1Ykq78MHm2NvLMhVq4QMr7YE4EJNoRG+M4k3SmPQ==" }, "bluebird": { "version": "3.7.2", diff --git a/package.json b/package.json index efcf031a8e..0e05aedbc2 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "url": "https://github.com/AssemblyScript/assemblyscript/issues" }, "dependencies": { - "binaryen": "97.0.0-nightly.20201001", + "binaryen": "97.0.0-nightly.20201002", "long": "^4.0.0", "source-map-support": "^0.5.19", "ts-node": "^6.2.0" diff --git a/tests/compiler/do.optimized.wat b/tests/compiler/do.optimized.wat index 565621a65f..9ce607790f 100644 --- a/tests/compiler/do.optimized.wat +++ b/tests/compiler/do.optimized.wat @@ -238,11 +238,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -254,11 +252,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/extends-baseaggregate.optimized.wat b/tests/compiler/extends-baseaggregate.optimized.wat index a67611b82c..1e44aeff87 100644 --- a/tests/compiler/extends-baseaggregate.optimized.wat +++ b/tests/compiler/extends-baseaggregate.optimized.wat @@ -163,11 +163,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -179,11 +177,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/for.optimized.wat b/tests/compiler/for.optimized.wat index 8680bc669c..39526bcc54 100644 --- a/tests/compiler/for.optimized.wat +++ b/tests/compiler/for.optimized.wat @@ -235,11 +235,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -251,11 +249,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/implicit-getter-setter.optimized.wat b/tests/compiler/implicit-getter-setter.optimized.wat index 9c33c3adf4..2a041ed9ba 100644 --- a/tests/compiler/implicit-getter-setter.optimized.wat +++ b/tests/compiler/implicit-getter-setter.optimized.wat @@ -170,11 +170,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -186,11 +184,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/issues/1095.optimized.wat b/tests/compiler/issues/1095.optimized.wat index 4913000374..dc9d165cbc 100644 --- a/tests/compiler/issues/1095.optimized.wat +++ b/tests/compiler/issues/1095.optimized.wat @@ -155,11 +155,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -171,11 +169,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/issues/1225.optimized.wat b/tests/compiler/issues/1225.optimized.wat index 717e09b3a0..fca8fc6fdd 100644 --- a/tests/compiler/issues/1225.optimized.wat +++ b/tests/compiler/issues/1225.optimized.wat @@ -156,11 +156,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -172,11 +170,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/logical.optimized.wat b/tests/compiler/logical.optimized.wat index ce3a0a2d5d..05199f8f24 100644 --- a/tests/compiler/logical.optimized.wat +++ b/tests/compiler/logical.optimized.wat @@ -153,11 +153,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -169,11 +167,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/managed-cast.optimized.wat b/tests/compiler/managed-cast.optimized.wat index ba0ca816f5..0653a40882 100644 --- a/tests/compiler/managed-cast.optimized.wat +++ b/tests/compiler/managed-cast.optimized.wat @@ -158,11 +158,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -174,11 +172,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/object-literal.optimized.wat b/tests/compiler/object-literal.optimized.wat index 42a5e9eaa8..576afcd3f7 100644 --- a/tests/compiler/object-literal.optimized.wat +++ b/tests/compiler/object-literal.optimized.wat @@ -162,11 +162,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -178,11 +176,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/rc/local-init.optimized.wat b/tests/compiler/rc/local-init.optimized.wat index a3e22c6a0e..9f089cdb6d 100644 --- a/tests/compiler/rc/local-init.optimized.wat +++ b/tests/compiler/rc/local-init.optimized.wat @@ -153,11 +153,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -169,11 +167,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/rc/logical-and-mismatch.optimized.wat b/tests/compiler/rc/logical-and-mismatch.optimized.wat index ed8cf871e1..436a592b73 100644 --- a/tests/compiler/rc/logical-and-mismatch.optimized.wat +++ b/tests/compiler/rc/logical-and-mismatch.optimized.wat @@ -153,11 +153,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -169,11 +167,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/rc/logical-or-mismatch.optimized.wat b/tests/compiler/rc/logical-or-mismatch.optimized.wat index 28dd6e3978..89c3ad7ac7 100644 --- a/tests/compiler/rc/logical-or-mismatch.optimized.wat +++ b/tests/compiler/rc/logical-or-mismatch.optimized.wat @@ -153,11 +153,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -169,11 +167,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/rc/optimize.optimized.wat b/tests/compiler/rc/optimize.optimized.wat index 995319d8fa..de0e4a8c39 100644 --- a/tests/compiler/rc/optimize.optimized.wat +++ b/tests/compiler/rc/optimize.optimized.wat @@ -243,11 +243,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -259,11 +257,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/rc/rereturn.optimized.wat b/tests/compiler/rc/rereturn.optimized.wat index 1082f8c402..bba71a6ad7 100644 --- a/tests/compiler/rc/rereturn.optimized.wat +++ b/tests/compiler/rc/rereturn.optimized.wat @@ -156,11 +156,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -172,11 +170,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/rc/ternary-mismatch.optimized.wat b/tests/compiler/rc/ternary-mismatch.optimized.wat index e2dcc99097..920591da7e 100644 --- a/tests/compiler/rc/ternary-mismatch.optimized.wat +++ b/tests/compiler/rc/ternary-mismatch.optimized.wat @@ -155,11 +155,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -171,11 +169,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/resolve-ternary.optimized.wat b/tests/compiler/resolve-ternary.optimized.wat index 86bb1d91ff..70b31956b7 100644 --- a/tests/compiler/resolve-ternary.optimized.wat +++ b/tests/compiler/resolve-ternary.optimized.wat @@ -182,11 +182,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -198,11 +196,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/retain-release-sanity.optimized.wat b/tests/compiler/retain-release-sanity.optimized.wat index 686f1bd9d3..d159108b58 100644 --- a/tests/compiler/retain-release-sanity.optimized.wat +++ b/tests/compiler/retain-release-sanity.optimized.wat @@ -180,11 +180,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -196,11 +194,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/retain-return.optimized.wat b/tests/compiler/retain-return.optimized.wat index 2265222389..71cd498d5a 100644 --- a/tests/compiler/retain-return.optimized.wat +++ b/tests/compiler/retain-return.optimized.wat @@ -158,11 +158,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -174,11 +172,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/rt/finalize.optimized.wat b/tests/compiler/rt/finalize.optimized.wat index cad0f1fc39..8ab51d3213 100644 --- a/tests/compiler/rt/finalize.optimized.wat +++ b/tests/compiler/rt/finalize.optimized.wat @@ -178,11 +178,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -194,11 +192,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/runtime-full.optimized.wat b/tests/compiler/runtime-full.optimized.wat index b1cfbd7047..a65a8a749a 100644 --- a/tests/compiler/runtime-full.optimized.wat +++ b/tests/compiler/runtime-full.optimized.wat @@ -156,11 +156,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -172,11 +170,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/std/array-literal.optimized.wat b/tests/compiler/std/array-literal.optimized.wat index 0360098a44..5f6c400c9a 100644 --- a/tests/compiler/std/array-literal.optimized.wat +++ b/tests/compiler/std/array-literal.optimized.wat @@ -208,11 +208,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -224,11 +222,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index feee7718d4..bac30e3e1e 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -539,11 +539,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -555,11 +553,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/std/arraybuffer.optimized.wat b/tests/compiler/std/arraybuffer.optimized.wat index 74e1c922e2..d760e617c4 100644 --- a/tests/compiler/std/arraybuffer.optimized.wat +++ b/tests/compiler/std/arraybuffer.optimized.wat @@ -170,11 +170,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -186,11 +184,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/std/dataview.optimized.wat b/tests/compiler/std/dataview.optimized.wat index f710a3aca4..bb449b2557 100644 --- a/tests/compiler/std/dataview.optimized.wat +++ b/tests/compiler/std/dataview.optimized.wat @@ -178,11 +178,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -194,11 +192,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/std/map.optimized.wat b/tests/compiler/std/map.optimized.wat index 117298a2c0..edf3789bad 100644 --- a/tests/compiler/std/map.optimized.wat +++ b/tests/compiler/std/map.optimized.wat @@ -177,11 +177,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -193,11 +191,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/std/set.optimized.wat b/tests/compiler/std/set.optimized.wat index efcadc7858..949c44df9b 100644 --- a/tests/compiler/std/set.optimized.wat +++ b/tests/compiler/std/set.optimized.wat @@ -174,11 +174,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -190,11 +188,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/std/staticarray.optimized.wat b/tests/compiler/std/staticarray.optimized.wat index 9e5adce441..36ac1dd593 100644 --- a/tests/compiler/std/staticarray.optimized.wat +++ b/tests/compiler/std/staticarray.optimized.wat @@ -208,11 +208,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -224,11 +222,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/std/string-casemapping.optimized.wat b/tests/compiler/std/string-casemapping.optimized.wat index 362ee9491f..1fec3cc790 100644 --- a/tests/compiler/std/string-casemapping.optimized.wat +++ b/tests/compiler/std/string-casemapping.optimized.wat @@ -500,11 +500,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -516,11 +514,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/std/string-encoding.optimized.wat b/tests/compiler/std/string-encoding.optimized.wat index 47d0c5f5b2..f31db14354 100644 --- a/tests/compiler/std/string-encoding.optimized.wat +++ b/tests/compiler/std/string-encoding.optimized.wat @@ -241,11 +241,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -257,11 +255,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/std/string.optimized.wat b/tests/compiler/std/string.optimized.wat index 9d5f4b26f1..2f254f57b9 100644 --- a/tests/compiler/std/string.optimized.wat +++ b/tests/compiler/std/string.optimized.wat @@ -828,11 +828,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -844,11 +842,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/std/typedarray.optimized.wat b/tests/compiler/std/typedarray.optimized.wat index e0c4b0199b..0ca0c1d2d2 100644 --- a/tests/compiler/std/typedarray.optimized.wat +++ b/tests/compiler/std/typedarray.optimized.wat @@ -473,11 +473,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -489,11 +487,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end diff --git a/tests/compiler/while.optimized.wat b/tests/compiler/while.optimized.wat index 2d68ddf8bf..971454d569 100644 --- a/tests/compiler/while.optimized.wat +++ b/tests/compiler/while.optimized.wat @@ -243,11 +243,9 @@ i32.add local.tee $4 i32.load offset=4 - i32.const 1 + i32.const -2 local.get $2 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and local.set $1 local.get $4 @@ -259,11 +257,9 @@ local.get $0 local.get $0 i32.load - i32.const 1 + i32.const -2 local.get $3 - i32.shl - i32.const -1 - i32.xor + i32.rotl i32.and i32.store end From 45b9350cd75d7ab11cd82475f3c0a0b28a695a24 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Fri, 2 Oct 2020 04:02:59 +0300 Subject: [PATCH 4/5] enable fast-math by default --- src/glue/binaryen.d.ts | 2 ++ src/module.ts | 9 +++++++++ tests/compiler/binary.optimized.wat | 24 ------------------------ 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/glue/binaryen.d.ts b/src/glue/binaryen.d.ts index 84db410bd1..69131c3a1d 100644 --- a/src/glue/binaryen.d.ts +++ b/src/glue/binaryen.d.ts @@ -970,6 +970,8 @@ export declare function _BinaryenGetDebugInfo(): bool; export declare function _BinaryenSetDebugInfo(on: bool): void; export declare function _BinaryenGetLowMemoryUnused(): bool; export declare function _BinaryenSetLowMemoryUnused(on: bool): void; +export declare function _BinaryenGetFastMath(): bool; +export declare function _BinaryenSetFastMath(on: bool): void; export declare function _BinaryenGetPassArgument(key: BinaryenString): BinaryenString; export declare function _BinaryenSetPassArgument(key: BinaryenString, value: BinaryenString): void; export declare function _BinaryenClearPassArguments(): void; diff --git a/src/module.ts b/src/module.ts index c2093b252c..e841e8c8f7 100644 --- a/src/module.ts +++ b/src/module.ts @@ -1386,6 +1386,14 @@ export class Module { binaryen._BinaryenSetLowMemoryUnused(on); } + getFastMath(): bool { + return binaryen._BinaryenGetFastMath(); + } + + setFastMath(on: bool): void { + binaryen._BinaryenSetFastMath(on); + } + getPassArgument(key: string): string | null { var cStr = this.allocStringCached(key); var ptr = binaryen._BinaryenGetPassArgument(cStr); @@ -1477,6 +1485,7 @@ export class Module { this.setOptimizeLevel(optimizeLevel); this.setShrinkLevel(shrinkLevel); this.setDebugInfo(debugInfo); + this.setFastMath(true); this.clearPassArguments(); // Tweak inlining limits based on optimization levels diff --git a/tests/compiler/binary.optimized.wat b/tests/compiler/binary.optimized.wat index 640da09506..818d1ff040 100644 --- a/tests/compiler/binary.optimized.wat +++ b/tests/compiler/binary.optimized.wat @@ -185,14 +185,6 @@ f32.sub global.set $binary/f global.get $binary/f - f32.const 1 - f32.mul - global.set $binary/f - global.get $binary/f - f32.const 1 - f32.div - global.set $binary/f - global.get $binary/f call $~lib/math/NativeMathf.mod global.set $binary/f global.get $binary/f @@ -204,10 +196,6 @@ f32.sub global.set $binary/f global.get $binary/f - f32.const 1 - f32.mul - global.set $binary/f - global.get $binary/f call $~lib/math/NativeMathf.mod global.set $binary/f global.get $binary/F @@ -222,14 +210,6 @@ f64.sub global.set $binary/F global.get $binary/F - f64.const 1 - f64.mul - global.set $binary/F - global.get $binary/F - f64.const 1 - f64.div - global.set $binary/F - global.get $binary/F call $~lib/math/NativeMath.mod global.set $binary/F global.get $binary/F @@ -241,10 +221,6 @@ f64.sub global.set $binary/F global.get $binary/F - f64.const 1 - f64.mul - global.set $binary/F - global.get $binary/F call $~lib/math/NativeMath.mod global.set $binary/F ) From fc581d61f8cb1ca68f8ab60476df6dc014a6967e Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Tue, 6 Oct 2020 08:18:18 +0300 Subject: [PATCH 5/5] update binaryen again --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7e45680e0c..1dea1f3aa5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1163,9 +1163,9 @@ "optional": true }, "binaryen": { - "version": "97.0.0-nightly.20201002", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-97.0.0-nightly.20201002.tgz", - "integrity": "sha512-QZJ21TxsOHEufG75lZ3aMjQY0nAEHZ3qJJE2ZN4DLPsbcg1Ykq78MHm2NvLMhVq4QMr7YE4EJNoRG+M4k3SmPQ==" + "version": "97.0.0-nightly.20201006", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-97.0.0-nightly.20201006.tgz", + "integrity": "sha512-/xZwg4pDUQYg8BIn1F6OypJGwADNTIEDm48O5KuSE250bPj1tGCvAinYmm2JAoiio7DovTkwb5I3w0G+CvG8Jg==" }, "bluebird": { "version": "3.7.2", diff --git a/package.json b/package.json index 0e05aedbc2..ae2e6c45e1 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "url": "https://github.com/AssemblyScript/assemblyscript/issues" }, "dependencies": { - "binaryen": "97.0.0-nightly.20201002", + "binaryen": "97.0.0-nightly.20201006", "long": "^4.0.0", "source-map-support": "^0.5.19", "ts-node": "^6.2.0"