diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-07-27 16:29:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-27 16:29:12 -0700 |
commit | 4d46a7e2c37299d5a9b9d9d6323ce9fca3a1cf3a (patch) | |
tree | 278f1da3868901fa8282651ac589c6acc534d535 /test | |
parent | 203b7f758c34bf38357ec770659713647585538e (diff) | |
download | binaryen-4d46a7e2c37299d5a9b9d9d6323ce9fca3a1cf3a.tar.gz binaryen-4d46a7e2c37299d5a9b9d9d6323ce9fca3a1cf3a.tar.bz2 binaryen-4d46a7e2c37299d5a9b9d9d6323ce9fca3a1cf3a.zip |
fix import type detection of calls in comma operators; when the parent is a comma, it can't be a coersion (or that would have been the parent), so there is no coercion, so the result type is none (#1115)
Diffstat (limited to 'test')
-rw-r--r-- | test/unit.asm.js | 7 | ||||
-rw-r--r-- | test/unit.fromasm | 12 | ||||
-rw-r--r-- | test/unit.fromasm.clamp | 12 | ||||
-rw-r--r-- | test/unit.fromasm.clamp.no-opts | 18 | ||||
-rw-r--r-- | test/unit.fromasm.imprecise | 12 | ||||
-rw-r--r-- | test/unit.fromasm.imprecise.no-opts | 18 | ||||
-rw-r--r-- | test/unit.fromasm.no-opts | 18 | ||||
-rw-r--r-- | test/use-import-and-drop.fromasm.clamp.no-opts | 36 | ||||
-rw-r--r-- | test/use-import-and-drop.fromasm.imprecise.no-opts | 36 | ||||
-rw-r--r-- | test/use-import-and-drop.fromasm.no-opts | 36 |
10 files changed, 145 insertions, 60 deletions
diff --git a/test/unit.asm.js b/test/unit.asm.js index 065512011..22e2cf9b4 100644 --- a/test/unit.asm.js +++ b/test/unit.asm.js @@ -19,6 +19,7 @@ function asm(global, env, buffer) { var print = env.print; var h = env.h; var return_int = env.return_int; + var emscripten_log = env.emscripten_log; var HEAP8 = new global.Int8Array(buffer); var HEAP16 = new global.Int16Array(buffer); @@ -718,6 +719,11 @@ function asm(global, env, buffer) { FUNCTION_TABLE_vi[(Int = 1) & 7](i1 | 0); } + function call_emscripten_log() { + // emscripten_log has no return value, don't let the conditional after the comma confuse you + emscripten_log(), 2 ? abort() | 0 : 3; + } + function keepAlive() { sqrts(3.14159); f2u(100.0); @@ -725,6 +731,7 @@ function asm(global, env, buffer) { autoDrop(52) | 0; indirectInSequence(); emterpretify_assertions_safeHeap(); + call_emscripten_log(); } function v() { diff --git a/test/unit.fromasm b/test/unit.fromasm index 020ded163..8e6cd5956 100644 --- a/test/unit.fromasm +++ b/test/unit.fromasm @@ -14,6 +14,7 @@ (import "env" "print" (func $print (param i32))) (import "env" "h" (func $h (param i32))) (import "env" "return_int" (func $return_int (result i32))) + (import "env" "emscripten_log" (func $emscripten_log)) (import "asm2wasm" "f64-to-int" (func $f64-to-int (param f64) (result i32))) (import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64))) (import "env" "memory" (memory $0 256 256)) @@ -1196,6 +1197,16 @@ ) ) ) + (func $call_emscripten_log + (call $emscripten_log) + (drop + (call $f64-to-int + (call $abort + (f64.const 0) + ) + ) + ) + ) (func $keepAlive (drop (call $sqrts @@ -1219,6 +1230,7 @@ ) (call $indirectInSequence) (call $emterpretify_assertions_safeHeap) + (call $call_emscripten_log) ) (func $vi (param $0 i32) (nop) diff --git a/test/unit.fromasm.clamp b/test/unit.fromasm.clamp index 06c577753..9ab53f183 100644 --- a/test/unit.fromasm.clamp +++ b/test/unit.fromasm.clamp @@ -13,6 +13,7 @@ (import "env" "print" (func $print (param i32))) (import "env" "h" (func $h (param i32))) (import "env" "return_int" (func $return_int (result i32))) + (import "env" "emscripten_log" (func $emscripten_log)) (import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64))) (import "env" "memory" (memory $0 256 256)) (import "env" "table" (table 25 25 anyfunc)) @@ -1220,6 +1221,16 @@ ) ) ) + (func $call_emscripten_log + (call $emscripten_log) + (drop + (call $f64-to-int + (call $abort + (f64.const 0) + ) + ) + ) + ) (func $keepAlive (drop (call $sqrts @@ -1243,6 +1254,7 @@ ) (call $indirectInSequence) (call $emterpretify_assertions_safeHeap) + (call $call_emscripten_log) ) (func $vi (param $0 i32) (nop) diff --git a/test/unit.fromasm.clamp.no-opts b/test/unit.fromasm.clamp.no-opts index 393147603..9055bda68 100644 --- a/test/unit.fromasm.clamp.no-opts +++ b/test/unit.fromasm.clamp.no-opts @@ -17,6 +17,7 @@ (import "env" "print" (func $print (param i32))) (import "env" "h" (func $h (param i32))) (import "env" "return_int" (func $return_int (result i32))) + (import "env" "emscripten_log" (func $emscripten_log)) (import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64))) (import "env" "memory" (memory $0 256 256)) (import "env" "table" (table 25 25 anyfunc)) @@ -2010,6 +2011,22 @@ ) ) ) + (func $call_emscripten_log + (call $emscripten_log) + (if + (i32.const 2) + (drop + (call $f64-to-int + (call $abort + (f64.const 0) + ) + ) + ) + (drop + (i32.const 3) + ) + ) + ) (func $keepAlive (drop (call $sqrts @@ -2033,6 +2050,7 @@ ) (call $indirectInSequence) (call $emterpretify_assertions_safeHeap) + (call $call_emscripten_log) ) (func $v (nop) diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise index 8ee0b073f..f57931d20 100644 --- a/test/unit.fromasm.imprecise +++ b/test/unit.fromasm.imprecise @@ -13,6 +13,7 @@ (import "env" "print" (func $print (param i32))) (import "env" "h" (func $h (param i32))) (import "env" "return_int" (func $return_int (result i32))) + (import "env" "emscripten_log" (func $emscripten_log)) (import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64))) (import "env" "memory" (memory $0 256 256)) (import "env" "table" (table 25 25 anyfunc)) @@ -1169,6 +1170,16 @@ ) ) ) + (func $call_emscripten_log + (call $emscripten_log) + (drop + (i32.trunc_s/f64 + (call $abort + (f64.const 0) + ) + ) + ) + ) (func $keepAlive (drop (call $sqrts @@ -1192,6 +1203,7 @@ ) (call $indirectInSequence) (call $emterpretify_assertions_safeHeap) + (call $call_emscripten_log) ) (func $vi (param $0 i32) (nop) diff --git a/test/unit.fromasm.imprecise.no-opts b/test/unit.fromasm.imprecise.no-opts index 70eece97d..b66c69cf7 100644 --- a/test/unit.fromasm.imprecise.no-opts +++ b/test/unit.fromasm.imprecise.no-opts @@ -17,6 +17,7 @@ (import "env" "print" (func $print (param i32))) (import "env" "h" (func $h (param i32))) (import "env" "return_int" (func $return_int (result i32))) + (import "env" "emscripten_log" (func $emscripten_log)) (import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64))) (import "env" "memory" (memory $0 256 256)) (import "env" "table" (table 25 25 anyfunc)) @@ -1970,6 +1971,22 @@ ) ) ) + (func $call_emscripten_log + (call $emscripten_log) + (if + (i32.const 2) + (drop + (i32.trunc_s/f64 + (call $abort + (f64.const 0) + ) + ) + ) + (drop + (i32.const 3) + ) + ) + ) (func $keepAlive (drop (call $sqrts @@ -1993,6 +2010,7 @@ ) (call $indirectInSequence) (call $emterpretify_assertions_safeHeap) + (call $call_emscripten_log) ) (func $v (nop) diff --git a/test/unit.fromasm.no-opts b/test/unit.fromasm.no-opts index 511e310a3..074a44bfe 100644 --- a/test/unit.fromasm.no-opts +++ b/test/unit.fromasm.no-opts @@ -18,6 +18,7 @@ (import "env" "print" (func $print (param i32))) (import "env" "h" (func $h (param i32))) (import "env" "return_int" (func $return_int (result i32))) + (import "env" "emscripten_log" (func $emscripten_log)) (import "asm2wasm" "f64-to-int" (func $f64-to-int (param f64) (result i32))) (import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64))) (import "env" "memory" (memory $0 256 256)) @@ -1986,6 +1987,22 @@ ) ) ) + (func $call_emscripten_log + (call $emscripten_log) + (if + (i32.const 2) + (drop + (call $f64-to-int + (call $abort + (f64.const 0) + ) + ) + ) + (drop + (i32.const 3) + ) + ) + ) (func $keepAlive (drop (call $sqrts @@ -2009,6 +2026,7 @@ ) (call $indirectInSequence) (call $emterpretify_assertions_safeHeap) + (call $call_emscripten_log) ) (func $v (nop) diff --git a/test/use-import-and-drop.fromasm.clamp.no-opts b/test/use-import-and-drop.fromasm.clamp.no-opts index 332851f61..5ce22091a 100644 --- a/test/use-import-and-drop.fromasm.clamp.no-opts +++ b/test/use-import-and-drop.fromasm.clamp.no-opts @@ -1,6 +1,6 @@ (module - (type $FUNCSIG$ii (func (param i32) (result i32))) - (import "env" "setTempRet0" (func $setTempRet0 (param i32) (result i32))) + (type $FUNCSIG$vi (func (param i32))) + (import "env" "setTempRet0" (func $setTempRet0 (param i32))) (import "env" "memory" (memory $0 256 256)) (import "env" "table" (table 0 0 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) @@ -13,23 +13,21 @@ (local $$1$0 i32) (return (block (result i32) - (drop - (call $setTempRet0 - (i32.or + (call $setTempRet0 + (i32.or + (i32.add (i32.add - (i32.add - (i32.mul - (get_local $$b$1) - (get_local $$x_sroa_0_0_extract_trunc) - ) - (get_local $$2) + (i32.mul + (get_local $$b$1) + (get_local $$x_sroa_0_0_extract_trunc) ) - (get_local $$1$1) - ) - (i32.and - (get_local $$1$1) - (i32.const 0) + (get_local $$2) ) + (get_local $$1$1) + ) + (i32.and + (get_local $$1$1) + (i32.const 0) ) ) ) @@ -44,10 +42,8 @@ ) ) (func $test2 - (drop - (call $setTempRet0 - (i32.const 10) - ) + (call $setTempRet0 + (i32.const 10) ) ) ) diff --git a/test/use-import-and-drop.fromasm.imprecise.no-opts b/test/use-import-and-drop.fromasm.imprecise.no-opts index 332851f61..5ce22091a 100644 --- a/test/use-import-and-drop.fromasm.imprecise.no-opts +++ b/test/use-import-and-drop.fromasm.imprecise.no-opts @@ -1,6 +1,6 @@ (module - (type $FUNCSIG$ii (func (param i32) (result i32))) - (import "env" "setTempRet0" (func $setTempRet0 (param i32) (result i32))) + (type $FUNCSIG$vi (func (param i32))) + (import "env" "setTempRet0" (func $setTempRet0 (param i32))) (import "env" "memory" (memory $0 256 256)) (import "env" "table" (table 0 0 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) @@ -13,23 +13,21 @@ (local $$1$0 i32) (return (block (result i32) - (drop - (call $setTempRet0 - (i32.or + (call $setTempRet0 + (i32.or + (i32.add (i32.add - (i32.add - (i32.mul - (get_local $$b$1) - (get_local $$x_sroa_0_0_extract_trunc) - ) - (get_local $$2) + (i32.mul + (get_local $$b$1) + (get_local $$x_sroa_0_0_extract_trunc) ) - (get_local $$1$1) - ) - (i32.and - (get_local $$1$1) - (i32.const 0) + (get_local $$2) ) + (get_local $$1$1) + ) + (i32.and + (get_local $$1$1) + (i32.const 0) ) ) ) @@ -44,10 +42,8 @@ ) ) (func $test2 - (drop - (call $setTempRet0 - (i32.const 10) - ) + (call $setTempRet0 + (i32.const 10) ) ) ) diff --git a/test/use-import-and-drop.fromasm.no-opts b/test/use-import-and-drop.fromasm.no-opts index 332851f61..5ce22091a 100644 --- a/test/use-import-and-drop.fromasm.no-opts +++ b/test/use-import-and-drop.fromasm.no-opts @@ -1,6 +1,6 @@ (module - (type $FUNCSIG$ii (func (param i32) (result i32))) - (import "env" "setTempRet0" (func $setTempRet0 (param i32) (result i32))) + (type $FUNCSIG$vi (func (param i32))) + (import "env" "setTempRet0" (func $setTempRet0 (param i32))) (import "env" "memory" (memory $0 256 256)) (import "env" "table" (table 0 0 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) @@ -13,23 +13,21 @@ (local $$1$0 i32) (return (block (result i32) - (drop - (call $setTempRet0 - (i32.or + (call $setTempRet0 + (i32.or + (i32.add (i32.add - (i32.add - (i32.mul - (get_local $$b$1) - (get_local $$x_sroa_0_0_extract_trunc) - ) - (get_local $$2) + (i32.mul + (get_local $$b$1) + (get_local $$x_sroa_0_0_extract_trunc) ) - (get_local $$1$1) - ) - (i32.and - (get_local $$1$1) - (i32.const 0) + (get_local $$2) ) + (get_local $$1$1) + ) + (i32.and + (get_local $$1$1) + (i32.const 0) ) ) ) @@ -44,10 +42,8 @@ ) ) (func $test2 - (drop - (call $setTempRet0 - (i32.const 10) - ) + (call $setTempRet0 + (i32.const 10) ) ) ) |