summaryrefslogtreecommitdiff
path: root/test/typed-function-references.wast
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2020-11-24 12:36:11 -0800
committerGitHub <noreply@github.com>2020-11-24 12:36:11 -0800
commit78ccc1976bac069ae65b2ec227e8c2c515a02801 (patch)
treeb875343fa47a62a44db4370811080dc963a91233 /test/typed-function-references.wast
parentcecff82aff317c3132f80a764dba163bcd852a78 (diff)
downloadbinaryen-78ccc1976bac069ae65b2ec227e8c2c515a02801.tar.gz
binaryen-78ccc1976bac069ae65b2ec227e8c2c515a02801.tar.bz2
binaryen-78ccc1976bac069ae65b2ec227e8c2c515a02801.zip
[TypedFunctionReferences] Implement call_ref (#3396)
Includes minimal support in various passes. Also includes actual optimization work in Directize, which was easy to add. Almost has fuzzer support, but the actual makeCallRef is just a stub so far. Includes s-parser support for parsing typed function references types.
Diffstat (limited to 'test/typed-function-references.wast')
-rw-r--r--test/typed-function-references.wast24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/typed-function-references.wast b/test/typed-function-references.wast
new file mode 100644
index 000000000..59346f615
--- /dev/null
+++ b/test/typed-function-references.wast
@@ -0,0 +1,24 @@
+(module
+ (type $i32-i32 (func (param i32) (result i32)))
+
+ (func $call-ref
+ (call_ref (ref.func $call-ref))
+ )
+ (func $return-call-ref
+ (return_call_ref (ref.func $call-ref))
+ )
+ (func $call-ref-more (param i32) (result i32)
+ (call_ref (i32.const 42) (ref.func $call-ref-more))
+ )
+ (func $call_from-param (param $f (ref $i32-i32)) (result i32)
+ (call_ref (i32.const 42) (local.get $f))
+ )
+ (func $call_from-param-null (param $f (ref null $i32-i32)) (result i32)
+ (call_ref (i32.const 42) (local.get $f))
+ )
+ (func $call_from-local-null (result i32)
+ (local $f (ref null $i32-i32))
+ (local.set $f (ref.func $call-ref-more))
+ (call_ref (i32.const 42) (local.get $f))
+ )
+)