summaryrefslogtreecommitdiff
path: root/test/lit/passes
diff options
context:
space:
mode:
authorBrendan Dahl <brendan.dahl@gmail.com>2023-03-01 11:13:19 -0800
committerGitHub <noreply@github.com>2023-03-01 11:13:19 -0800
commit76fcc26e5ca62b6aa0f2d07859ff5dd95e8f57e0 (patch)
tree4a16e28615c0777250d3d9d03654679b394643b4 /test/lit/passes
parent5b98e1896f16fc41d6a7b0d0c4ef0b7e1d72f420 (diff)
downloadbinaryen-76fcc26e5ca62b6aa0f2d07859ff5dd95e8f57e0.tar.gz
binaryen-76fcc26e5ca62b6aa0f2d07859ff5dd95e8f57e0.tar.bz2
binaryen-76fcc26e5ca62b6aa0f2d07859ff5dd95e8f57e0.zip
JSPI - Replace function table references with JSPI'ed wrapper. (#5519)
This makes it possible to get the JSPI'ed version of the function from the function table.
Diffstat (limited to 'test/lit/passes')
-rw-r--r--test/lit/passes/jspi-table.wast34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/lit/passes/jspi-table.wast b/test/lit/passes/jspi-table.wast
new file mode 100644
index 000000000..1963d5cb0
--- /dev/null
+++ b/test/lit/passes/jspi-table.wast
@@ -0,0 +1,34 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
+
+;; RUN: wasm-opt %s --jspi -all -S -o - | filecheck %s
+
+(module
+ ;; CHECK: (type $f64_=>_i32 (func (param f64) (result i32)))
+
+ ;; CHECK: (type $externref_f64_=>_i32 (func (param externref f64) (result i32)))
+
+ ;; CHECK: (global $suspender (mut externref) (ref.null noextern))
+
+ ;; CHECK: (table $0 1 1 funcref)
+ (table $0 1 1 funcref)
+ (elem (i32.const 1) func $update_state)
+ ;; CHECK: (elem (i32.const 1) $export$update_state)
+
+ ;; CHECK: (export "update_state" (func $export$update_state))
+ (export "update_state" (func $update_state))
+
+ ;; CHECK: (func $update_state (type $f64_=>_i32) (param $param f64) (result i32)
+ ;; CHECK-NEXT: (i32.const 42)
+ ;; CHECK-NEXT: )
+ (func $update_state (param $param f64) (result i32)
+ (i32.const 42)
+ )
+)
+;; CHECK: (func $export$update_state (type $externref_f64_=>_i32) (param $susp externref) (param $param f64) (result i32)
+;; CHECK-NEXT: (global.set $suspender
+;; CHECK-NEXT: (local.get $susp)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (call $update_state
+;; CHECK-NEXT: (local.get $param)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )