summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/binaryen.js/kitchen-sink.js2
-rw-r--r--test/binaryen.js/kitchen-sink.js.txt2
-rw-r--r--test/heap-types.wast27
-rw-r--r--test/heap-types.wast.from-wast35
-rw-r--r--test/heap-types.wast.fromBinary35
-rw-r--r--test/heap-types.wast.fromBinary.noDebugInfo35
6 files changed, 131 insertions, 5 deletions
diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js
index 43a1a67c2..39154ef7d 100644
--- a/test/binaryen.js/kitchen-sink.js
+++ b/test/binaryen.js/kitchen-sink.js
@@ -171,7 +171,7 @@ function test_ids() {
console.log("CallRefId: " + binaryen.CallRefId);
console.log("RefTestId: " + binaryen.RefTestId);
console.log("RefCastId: " + binaryen.RefCastId);
- console.log("BrOnCastId: " + binaryen.BrOnCastId);
+ console.log("BrOnId: " + binaryen.BrOnId);
console.log("RttCanonId: " + binaryen.RttCanonId);
console.log("RttSubId: " + binaryen.RttSubId);
console.log("StructNewId: " + binaryen.StructNewId);
diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt
index b42bdbb18..5ad60b286 100644
--- a/test/binaryen.js/kitchen-sink.js.txt
+++ b/test/binaryen.js/kitchen-sink.js.txt
@@ -95,7 +95,7 @@ I31GetId: 52
CallRefId: 53
RefTestId: 54
RefCastId: 55
-BrOnCastId: 56
+BrOnId: 56
RttCanonId: 57
RttSubId: 58
StructNewId: 59
diff --git a/test/heap-types.wast b/test/heap-types.wast
index 26283da7a..94138276a 100644
--- a/test/heap-types.wast
+++ b/test/heap-types.wast
@@ -192,4 +192,31 @@
(drop (ref.as_data (local.get $x)))
(drop (ref.as_i31 (local.get $x)))
)
+ (func $br_on_X (param $x anyref)
+ (local $y anyref)
+ (drop
+ (block $func (result funcref)
+ (local.set $y
+ (br_on_func $func (local.get $x))
+ )
+ (ref.null func)
+ )
+ )
+ (drop
+ (block $data (result dataref)
+ (local.set $y
+ (br_on_data $data (local.get $x))
+ )
+ (ref.null data)
+ )
+ )
+ (drop
+ (block $i31 (result i31ref)
+ (local.set $y
+ (br_on_i31 $i31 (local.get $x))
+ )
+ (ref.null i31)
+ )
+ )
+ )
)
diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast
index c498e8fd5..a737a50ab 100644
--- a/test/heap-types.wast.from-wast
+++ b/test/heap-types.wast.from-wast
@@ -1,9 +1,9 @@
(module
(type ${i32_f32_f64} (struct (field i32) (field f32) (field f64)))
(type $[mut:f64] (array (mut f64)))
+ (type $anyref_=>_none (func (param anyref)))
(type ${} (struct ))
(type ${mut:f32} (struct (field (mut f32))))
- (type $anyref_=>_none (func (param anyref)))
(type $none_=>_none (func))
(type ${i32} (struct (field i32)))
(type ${i32_i64} (struct (field i32) (field i64)))
@@ -236,4 +236,37 @@
)
)
)
+ (func $br_on_X (param $x anyref)
+ (local $y anyref)
+ (drop
+ (block $func (result funcref)
+ (local.set $y
+ (br_on_func $func
+ (local.get $x)
+ )
+ )
+ (ref.null func)
+ )
+ )
+ (drop
+ (block $data (result (ref null data))
+ (local.set $y
+ (br_on_data $data
+ (local.get $x)
+ )
+ )
+ (ref.null data)
+ )
+ )
+ (drop
+ (block $i31 (result (ref null i31))
+ (local.set $y
+ (br_on_i31 $i31
+ (local.get $x)
+ )
+ )
+ (ref.null i31)
+ )
+ )
+ )
)
diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary
index d1003a685..b1256ac4f 100644
--- a/test/heap-types.wast.fromBinary
+++ b/test/heap-types.wast.fromBinary
@@ -1,9 +1,9 @@
(module
(type ${i32_f32_f64} (struct (field i32) (field f32) (field f64)))
(type $[mut:f64] (array (mut f64)))
+ (type $anyref_=>_none (func (param anyref)))
(type ${} (struct ))
(type ${mut:f32} (struct (field (mut f32))))
- (type $anyref_=>_none (func (param anyref)))
(type $none_=>_none (func))
(type ${i32} (struct (field i32)))
(type ${i32_i64} (struct (field i32) (field i64)))
@@ -235,5 +235,38 @@
)
)
)
+ (func $br_on_X (param $x anyref)
+ (local $y anyref)
+ (drop
+ (block $label$1 (result funcref)
+ (local.set $y
+ (br_on_func $label$1
+ (local.get $x)
+ )
+ )
+ (ref.null func)
+ )
+ )
+ (drop
+ (block $label$2 (result (ref null data))
+ (local.set $y
+ (br_on_data $label$2
+ (local.get $x)
+ )
+ )
+ (ref.null data)
+ )
+ )
+ (drop
+ (block $label$3 (result (ref null i31))
+ (local.set $y
+ (br_on_i31 $label$3
+ (local.get $x)
+ )
+ )
+ (ref.null i31)
+ )
+ )
+ )
)
diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo
index 61fffe7a3..5febb58a3 100644
--- a/test/heap-types.wast.fromBinary.noDebugInfo
+++ b/test/heap-types.wast.fromBinary.noDebugInfo
@@ -1,9 +1,9 @@
(module
(type ${i32_f32_f64} (struct (field i32) (field f32) (field f64)))
(type $[mut:f64] (array (mut f64)))
+ (type $anyref_=>_none (func (param anyref)))
(type ${} (struct ))
(type ${mut:f32} (struct (field (mut f32))))
- (type $anyref_=>_none (func (param anyref)))
(type $none_=>_none (func))
(type ${i32} (struct (field i32)))
(type ${i32_i64} (struct (field i32) (field i64)))
@@ -235,5 +235,38 @@
)
)
)
+ (func $7 (param $0 anyref)
+ (local $1 anyref)
+ (drop
+ (block $label$1 (result funcref)
+ (local.set $1
+ (br_on_func $label$1
+ (local.get $0)
+ )
+ )
+ (ref.null func)
+ )
+ )
+ (drop
+ (block $label$2 (result (ref null data))
+ (local.set $1
+ (br_on_data $label$2
+ (local.get $0)
+ )
+ )
+ (ref.null data)
+ )
+ )
+ (drop
+ (block $label$3 (result (ref null i31))
+ (local.set $1
+ (br_on_i31 $label$3
+ (local.get $0)
+ )
+ )
+ (ref.null i31)
+ )
+ )
+ )
)