summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2020-08-04 14:16:01 -0700
committerGitHub <noreply@github.com>2020-08-04 14:16:01 -0700
commita82ad5d060f29b68affefa2ca7a47bf2d9451af1 (patch)
treeaff848f362f250fb8498a4e3e16b9cd97c2baead /test
parentd78c794ffd61946bf2035042cbda082f042272db (diff)
downloadbinaryen-a82ad5d060f29b68affefa2ca7a47bf2d9451af1.tar.gz
binaryen-a82ad5d060f29b68affefa2ca7a47bf2d9451af1.tar.bz2
binaryen-a82ad5d060f29b68affefa2ca7a47bf2d9451af1.zip
Move generateDynCallThunks into its own pass. NFC. (#3000)
The core logic is still living in EmscriptenGlueGenerator because its used also by fixInvokeFunctionNames. As a followup we can figure out how to make these more independent.
Diffstat (limited to 'test')
-rw-r--r--test/passes/generate-dyncalls.txt27
-rw-r--r--test/passes/generate-dyncalls.wast10
2 files changed, 37 insertions, 0 deletions
diff --git a/test/passes/generate-dyncalls.txt b/test/passes/generate-dyncalls.txt
new file mode 100644
index 000000000..413733ea8
--- /dev/null
+++ b/test/passes/generate-dyncalls.txt
@@ -0,0 +1,27 @@
+(module
+ (type $none_=>_i32 (func (result i32)))
+ (type $i32_=>_i64 (func (param i32) (result i64)))
+ (type $i32_=>_i32 (func (param i32) (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_i" (func $dynCall_i))
+ (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_i (param $fptr i32) (result i32)
+ (call_indirect (type $none_=>_i32)
+ (local.get $fptr)
+ )
+ )
+ (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-dyncalls.wast b/test/passes/generate-dyncalls.wast
new file mode 100644
index 000000000..6fbfcc331
--- /dev/null
+++ b/test/passes/generate-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)
+)