summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-02-01 22:44:40 +0000
committerGitHub <noreply@github.com>2021-02-01 14:44:40 -0800
commiteafb0a4ef25cd82317ac8fa84a9d7e58f9382fcc (patch)
tree7284b2c93d1416dd898f297792fc00a11dac0ed7 /test
parent02f8c56aad18a2715904d1d5e0951b25bf7749c3 (diff)
downloadbinaryen-eafb0a4ef25cd82317ac8fa84a9d7e58f9382fcc.tar.gz
binaryen-eafb0a4ef25cd82317ac8fa84a9d7e58f9382fcc.tar.bz2
binaryen-eafb0a4ef25cd82317ac8fa84a9d7e58f9382fcc.zip
[GC] br_on_null (#3528)
This is only partial support, as br_on_null also has an extra optional value in the spec. Implementing that is cumbersome in binaryen, and there is ongoing spec discussions about it (see https://github.com/WebAssembly/function-references/issues/45 ), so for now we only support the simple case without the default value. Also fix prefixed opcodes to be LEBs in RefAs, which was noticed here as the change here made it noticeable whether the values were int8 or LEBs.
Diffstat (limited to 'test')
-rw-r--r--test/heap-types.wast6
-rw-r--r--test/heap-types.wast.from-wast8
-rw-r--r--test/heap-types.wast.fromBinary20
-rw-r--r--test/heap-types.wast.fromBinary.noDebugInfo20
4 files changed, 42 insertions, 12 deletions
diff --git a/test/heap-types.wast b/test/heap-types.wast
index e06d1dff6..7558e1676 100644
--- a/test/heap-types.wast
+++ b/test/heap-types.wast
@@ -195,6 +195,12 @@
)
(func $br_on_X (param $x anyref)
(local $y anyref)
+ (local $z (ref any))
+ (block $null
+ (local.set $z
+ (br_on_null $null (local.get $x))
+ )
+ )
(drop
(block $func (result funcref)
(local.set $y
diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast
index f3e8d5ce6..a93bd0d90 100644
--- a/test/heap-types.wast.from-wast
+++ b/test/heap-types.wast.from-wast
@@ -243,6 +243,14 @@
)
(func $br_on_X (param $x anyref)
(local $y anyref)
+ (local $z anyref)
+ (block $null
+ (local.set $z
+ (br_on_null $null
+ (local.get $x)
+ )
+ )
+ )
(drop
(block $func (result funcref)
(local.set $y
diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary
index 80c91d2fe..d8ddb48ed 100644
--- a/test/heap-types.wast.fromBinary
+++ b/test/heap-types.wast.fromBinary
@@ -242,10 +242,18 @@
)
(func $br_on_X (param $x anyref)
(local $y anyref)
+ (local $z anyref)
+ (block $label$1
+ (local.set $z
+ (br_on_null $label$1
+ (local.get $x)
+ )
+ )
+ )
(drop
- (block $label$1 (result funcref)
+ (block $label$2 (result funcref)
(local.set $y
- (br_on_func $label$1
+ (br_on_func $label$2
(local.get $x)
)
)
@@ -253,9 +261,9 @@
)
)
(drop
- (block $label$2 (result (ref null data))
+ (block $label$3 (result (ref null data))
(local.set $y
- (br_on_data $label$2
+ (br_on_data $label$3
(local.get $x)
)
)
@@ -263,9 +271,9 @@
)
)
(drop
- (block $label$3 (result (ref null i31))
+ (block $label$4 (result (ref null i31))
(local.set $y
- (br_on_i31 $label$3
+ (br_on_i31 $label$4
(local.get $x)
)
)
diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo
index 2852b8bea..63f7e132e 100644
--- a/test/heap-types.wast.fromBinary.noDebugInfo
+++ b/test/heap-types.wast.fromBinary.noDebugInfo
@@ -242,10 +242,18 @@
)
(func $7 (param $0 anyref)
(local $1 anyref)
+ (local $2 anyref)
+ (block $label$1
+ (local.set $2
+ (br_on_null $label$1
+ (local.get $0)
+ )
+ )
+ )
(drop
- (block $label$1 (result funcref)
+ (block $label$2 (result funcref)
(local.set $1
- (br_on_func $label$1
+ (br_on_func $label$2
(local.get $0)
)
)
@@ -253,9 +261,9 @@
)
)
(drop
- (block $label$2 (result (ref null data))
+ (block $label$3 (result (ref null data))
(local.set $1
- (br_on_data $label$2
+ (br_on_data $label$3
(local.get $0)
)
)
@@ -263,9 +271,9 @@
)
)
(drop
- (block $label$3 (result (ref null i31))
+ (block $label$4 (result (ref null i31))
(local.set $1
- (br_on_i31 $label$3
+ (br_on_i31 $label$4
(local.get $0)
)
)