diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-02-27 14:04:45 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-27 14:04:45 -0800 |
commit | 89daa028fec6b627f1cbad3285b3176361f36e3d (patch) | |
tree | 7b3d4a596c6ce38a60f7617302439e23de40dc0e /test | |
parent | de999c4673688e1b6f29a9a3023e1295fca33446 (diff) | |
download | binaryen-89daa028fec6b627f1cbad3285b3176361f36e3d.tar.gz binaryen-89daa028fec6b627f1cbad3285b3176361f36e3d.tar.bz2 binaryen-89daa028fec6b627f1cbad3285b3176361f36e3d.zip |
Flexible param numbers in asm2wasm (#1439)
* refactor BINARYEN_PASS_DEBUG code for writing byn-* files, make it easy to emit binaries instead of text
* fix up bad argument numbers in asm2wasm. This can be caused by undefined behavior on the LLVM side, which happens to work natively. it's nicer to fix it up like it would be in a native build, and give a warning, instead of failing to compile
* update build-js.sh
* updated builds
Diffstat (limited to 'test')
-rw-r--r-- | test/bad_params.asm.js | 30 | ||||
-rw-r--r-- | test/bad_params.fromasm | 9 | ||||
-rw-r--r-- | test/bad_params.fromasm.clamp | 9 | ||||
-rw-r--r-- | test/bad_params.fromasm.clamp.no-opts | 43 | ||||
-rw-r--r-- | test/bad_params.fromasm.imprecise | 6 | ||||
-rw-r--r-- | test/bad_params.fromasm.imprecise.no-opts | 43 | ||||
-rw-r--r-- | test/bad_params.fromasm.no-opts | 43 |
7 files changed, 183 insertions, 0 deletions
diff --git a/test/bad_params.asm.js b/test/bad_params.asm.js new file mode 100644 index 000000000..cc5e7ccf8 --- /dev/null +++ b/test/bad_params.asm.js @@ -0,0 +1,30 @@ +function asm(global, env, buffer) { + "use asm"; + + function missing(x, y) { + x = x | 0; + y = +y; + } + + function extra(x, y) { + x = x | 0; + y = +y; + } + + function mix(a) { + a = a | 0; + } + + function ex() { + missing(); + missing(1); + extra(1, +2, 3); + extra(1, +2, 3, 4); + mix(); + mix(1); + mix(1, 2); + } + + return { ex: ex }; +} + diff --git a/test/bad_params.fromasm b/test/bad_params.fromasm new file mode 100644 index 000000000..52f804340 --- /dev/null +++ b/test/bad_params.fromasm @@ -0,0 +1,9 @@ +(module + (import "env" "memory" (memory $0 256 256)) + (import "env" "memoryBase" (global $memoryBase i32)) + (data (get_global $memoryBase) "bad_params.asm.js") + (export "ex" (func $ex)) + (func $ex (; 0 ;) + (nop) + ) +) diff --git a/test/bad_params.fromasm.clamp b/test/bad_params.fromasm.clamp new file mode 100644 index 000000000..52f804340 --- /dev/null +++ b/test/bad_params.fromasm.clamp @@ -0,0 +1,9 @@ +(module + (import "env" "memory" (memory $0 256 256)) + (import "env" "memoryBase" (global $memoryBase i32)) + (data (get_global $memoryBase) "bad_params.asm.js") + (export "ex" (func $ex)) + (func $ex (; 0 ;) + (nop) + ) +) diff --git a/test/bad_params.fromasm.clamp.no-opts b/test/bad_params.fromasm.clamp.no-opts new file mode 100644 index 000000000..07440e82d --- /dev/null +++ b/test/bad_params.fromasm.clamp.no-opts @@ -0,0 +1,43 @@ +(module + (import "env" "memory" (memory $0 256 256)) + (import "env" "table" (table 0 0 anyfunc)) + (import "env" "memoryBase" (global $memoryBase i32)) + (import "env" "tableBase" (global $tableBase i32)) + (export "ex" (func $ex)) + (func $missing (; 0 ;) (param $x i32) (param $y f64) + (nop) + ) + (func $extra (; 1 ;) (param $x i32) (param $y f64) + (nop) + ) + (func $mix (; 2 ;) (param $a i32) + (nop) + ) + (func $ex (; 3 ;) + (call $missing + (i32.const 0) + (f64.const 0) + ) + (call $missing + (i32.const 1) + (f64.const 0) + ) + (call $extra + (i32.const 1) + (f64.const 2) + ) + (call $extra + (i32.const 1) + (f64.const 2) + ) + (call $mix + (i32.const 0) + ) + (call $mix + (i32.const 1) + ) + (call $mix + (i32.const 1) + ) + ) +) diff --git a/test/bad_params.fromasm.imprecise b/test/bad_params.fromasm.imprecise new file mode 100644 index 000000000..ae5256c57 --- /dev/null +++ b/test/bad_params.fromasm.imprecise @@ -0,0 +1,6 @@ +(module + (export "ex" (func $ex)) + (func $ex (; 0 ;) + (nop) + ) +) diff --git a/test/bad_params.fromasm.imprecise.no-opts b/test/bad_params.fromasm.imprecise.no-opts new file mode 100644 index 000000000..07440e82d --- /dev/null +++ b/test/bad_params.fromasm.imprecise.no-opts @@ -0,0 +1,43 @@ +(module + (import "env" "memory" (memory $0 256 256)) + (import "env" "table" (table 0 0 anyfunc)) + (import "env" "memoryBase" (global $memoryBase i32)) + (import "env" "tableBase" (global $tableBase i32)) + (export "ex" (func $ex)) + (func $missing (; 0 ;) (param $x i32) (param $y f64) + (nop) + ) + (func $extra (; 1 ;) (param $x i32) (param $y f64) + (nop) + ) + (func $mix (; 2 ;) (param $a i32) + (nop) + ) + (func $ex (; 3 ;) + (call $missing + (i32.const 0) + (f64.const 0) + ) + (call $missing + (i32.const 1) + (f64.const 0) + ) + (call $extra + (i32.const 1) + (f64.const 2) + ) + (call $extra + (i32.const 1) + (f64.const 2) + ) + (call $mix + (i32.const 0) + ) + (call $mix + (i32.const 1) + ) + (call $mix + (i32.const 1) + ) + ) +) diff --git a/test/bad_params.fromasm.no-opts b/test/bad_params.fromasm.no-opts new file mode 100644 index 000000000..07440e82d --- /dev/null +++ b/test/bad_params.fromasm.no-opts @@ -0,0 +1,43 @@ +(module + (import "env" "memory" (memory $0 256 256)) + (import "env" "table" (table 0 0 anyfunc)) + (import "env" "memoryBase" (global $memoryBase i32)) + (import "env" "tableBase" (global $tableBase i32)) + (export "ex" (func $ex)) + (func $missing (; 0 ;) (param $x i32) (param $y f64) + (nop) + ) + (func $extra (; 1 ;) (param $x i32) (param $y f64) + (nop) + ) + (func $mix (; 2 ;) (param $a i32) + (nop) + ) + (func $ex (; 3 ;) + (call $missing + (i32.const 0) + (f64.const 0) + ) + (call $missing + (i32.const 1) + (f64.const 0) + ) + (call $extra + (i32.const 1) + (f64.const 2) + ) + (call $extra + (i32.const 1) + (f64.const 2) + ) + (call $mix + (i32.const 0) + ) + (call $mix + (i32.const 1) + ) + (call $mix + (i32.const 1) + ) + ) +) |