summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2020-08-26 09:56:17 -0700
committerGitHub <noreply@github.com>2020-08-26 09:56:17 -0700
commit9371352930ccfc1947dadb8130530db65608732b (patch)
treef413d5b9be810bc03dc76c5c243dbe7fa15ad134 /test
parent18d678043438937222101290988ff3260053edcd (diff)
downloadbinaryen-9371352930ccfc1947dadb8130530db65608732b.tar.gz
binaryen-9371352930ccfc1947dadb8130530db65608732b.tar.bz2
binaryen-9371352930ccfc1947dadb8130530db65608732b.zip
wasm-emscripten-finalize: Add flags to limit dynCall creation (#3070)
Two new flags here, one to completely removes dynCalls, and another to limit them to only signatures that contains i64. See #3043
Diffstat (limited to 'test')
-rw-r--r--test/passes/generate-i64-dyncalls.txt20
-rw-r--r--test/passes/generate-i64-dyncalls.wast10
2 files changed, 30 insertions, 0 deletions
diff --git a/test/passes/generate-i64-dyncalls.txt b/test/passes/generate-i64-dyncalls.txt
new file mode 100644
index 000000000..c9a282d84
--- /dev/null
+++ b/test/passes/generate-i64-dyncalls.txt
@@ -0,0 +1,20 @@
+(module
+ (type $i32_=>_i64 (func (param i32) (result i64)))
+ (type $none_=>_i32 (func (result i32)))
+ (type $i32_i32_=>_i64 (func (param i32 i32) (result i64)))
+ (table $0 2 2 funcref)
+ (elem (i32.const 0) $f1 $f2)
+ (export "dynCall_ji" (func $dynCall_ji))
+ (func $f1 (result i32)
+ (i32.const 1024)
+ )
+ (func $f2 (param $0 i32) (result i64)
+ (i64.const 42)
+ )
+ (func $dynCall_ji (param $fptr i32) (param $0 i32) (result i64)
+ (call_indirect (type $i32_=>_i64)
+ (local.get $0)
+ (local.get $fptr)
+ )
+ )
+)
diff --git a/test/passes/generate-i64-dyncalls.wast b/test/passes/generate-i64-dyncalls.wast
new file mode 100644
index 000000000..6fbfcc331
--- /dev/null
+++ b/test/passes/generate-i64-dyncalls.wast
@@ -0,0 +1,10 @@
+(module
+ (func $f1 (result i32)
+ (i32.const 1024)
+ )
+ (func $f2 (param i32) (result i64)
+ (i64.const 42)
+ )
+ (table 2 2 funcref)
+ (elem (i32.const 0) $f1 $f2)
+)