diff options
author | Alon Zakai <azakai@google.com> | 2020-08-05 17:48:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-05 17:48:54 -0700 |
commit | e93fbc0c117bcfe645bab1b30d5802e619e68abc (patch) | |
tree | 3f11b6a9e189296988d9954b483f73a9aff5f2a1 /test | |
parent | 9c84d90712c1183f1d9ab3e5068d902eb7d627ea (diff) | |
download | binaryen-e93fbc0c117bcfe645bab1b30d5802e619e68abc.tar.gz binaryen-e93fbc0c117bcfe645bab1b30d5802e619e68abc.tar.bz2 binaryen-e93fbc0c117bcfe645bab1b30d5802e619e68abc.zip |
Add StubUnsupportedJSOps to remove operations that JS does not support (#3024)
This doesn't lower them - it just replaces the unsupported operation
with a drop. This will be useful for fuzzing, where to compare JS to the
correct semantics we must avoid operations where JS is not always
accurate.
Also fully document the i64 -> f32 conversion issue in JS.
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/stub-unsupported-js.txt | 24 | ||||
-rw-r--r-- | test/passes/stub-unsupported-js.wast | 14 |
2 files changed, 38 insertions, 0 deletions
diff --git a/test/passes/stub-unsupported-js.txt b/test/passes/stub-unsupported-js.txt new file mode 100644 index 000000000..531c767c0 --- /dev/null +++ b/test/passes/stub-unsupported-js.txt @@ -0,0 +1,24 @@ +(module + (type $none_=>_f32 (func (result f32))) + (type $i32_=>_f32 (func (param i32) (result f32))) + (type $i64_=>_f32 (func (param i64) (result f32))) + (func $yes (param $x i64) (result f32) + (drop + (local.get $x) + ) + (f32.const 0) + ) + (func $no (param $x i32) (result f32) + (f32.convert_i32_u + (local.get $x) + ) + ) + (func $yes-unreach (result f32) + (unreachable) + ) + (func $no-unreach (result f32) + (f32.convert_i32_u + (unreachable) + ) + ) +) diff --git a/test/passes/stub-unsupported-js.wast b/test/passes/stub-unsupported-js.wast new file mode 100644 index 000000000..6cfc7bef2 --- /dev/null +++ b/test/passes/stub-unsupported-js.wast @@ -0,0 +1,14 @@ +(module + (func $yes (param $x i64) (result f32) + (f32.convert_i64_u (local.get $x)) + ) + (func $no (param $x i32) (result f32) + (f32.convert_i32_u (local.get $x)) + ) + (func $yes-unreach (result f32) + (f32.convert_i64_u (unreachable)) + ) + (func $no-unreach (result f32) + (f32.convert_i32_u (unreachable)) + ) +) |