summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/heap-types.wast16
-rw-r--r--test/heap-types.wast.from-wast20
-rw-r--r--test/heap-types.wast.fromBinary32
-rw-r--r--test/heap-types.wast.fromBinary.noDebugInfo32
-rw-r--r--test/lit/cast-to-basic.wast2
-rw-r--r--test/lit/passes/gufa-refs.wast48
-rw-r--r--test/passes/remove-unused-brs_all-features.txt43
-rw-r--r--test/passes/remove-unused-brs_all-features.wast53
8 files changed, 16 insertions, 230 deletions
diff --git a/test/heap-types.wast b/test/heap-types.wast
index 9366dca01..f75622142 100644
--- a/test/heap-types.wast
+++ b/test/heap-types.wast
@@ -203,14 +203,6 @@
)
)
(drop
- (block $func (result funcref)
- (local.set $y
- (br_on_func $func (local.get $x))
- )
- (ref.null func)
- )
- )
- (drop
(block $i31 (result (ref null i31))
(local.set $y
(br_on_i31 $i31 (local.get $x))
@@ -225,14 +217,6 @@
)
)
(drop
- (block $non-func (result anyref)
- (local.set $temp-func
- (br_on_non_func $non-func (local.get $x))
- )
- (ref.null any)
- )
- )
- (drop
(block $non-i31 (result anyref)
(local.set $temp-i31
(br_on_non_i31 $non-i31 (local.get $x))
diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast
index 9f1a28d13..9eafd633b 100644
--- a/test/heap-types.wast.from-wast
+++ b/test/heap-types.wast.from-wast
@@ -230,16 +230,6 @@
)
)
(drop
- (block $func (result funcref)
- (local.set $y
- (br_on_func $func
- (local.get $x)
- )
- )
- (ref.null nofunc)
- )
- )
- (drop
(block $i31 (result i31ref)
(local.set $y
(br_on_i31 $i31
@@ -258,16 +248,6 @@
)
)
(drop
- (block $non-func (result anyref)
- (local.set $temp-func
- (br_on_non_func $non-func
- (local.get $x)
- )
- )
- (ref.null none)
- )
- )
- (drop
(block $non-i31 (result anyref)
(local.set $temp-i31
(br_on_non_i31 $non-i31
diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary
index b217ebc2e..04e9bbe05 100644
--- a/test/heap-types.wast.fromBinary
+++ b/test/heap-types.wast.fromBinary
@@ -228,19 +228,9 @@
)
)
(drop
- (block $label$2 (result funcref)
+ (block $label$2 (result i31ref)
(local.set $y
- (br_on_func $label$2
- (local.get $x)
- )
- )
- (ref.null nofunc)
- )
- )
- (drop
- (block $label$3 (result i31ref)
- (local.set $y
- (br_on_i31 $label$3
+ (br_on_i31 $label$2
(local.get $x)
)
)
@@ -248,27 +238,17 @@
)
)
(drop
- (block $label$4 (result (ref any))
- (br_on_non_null $label$4
+ (block $label$3 (result (ref any))
+ (br_on_non_null $label$3
(local.get $x)
)
(unreachable)
)
)
(drop
- (block $label$5 (result anyref)
- (local.set $temp-func
- (br_on_non_func $label$5
- (local.get $x)
- )
- )
- (ref.null none)
- )
- )
- (drop
- (block $label$6 (result anyref)
+ (block $label$4 (result anyref)
(local.set $temp-i31
- (br_on_non_i31 $label$6
+ (br_on_non_i31 $label$4
(local.get $x)
)
)
diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo
index 89f0c676e..472c3288f 100644
--- a/test/heap-types.wast.fromBinary.noDebugInfo
+++ b/test/heap-types.wast.fromBinary.noDebugInfo
@@ -228,19 +228,9 @@
)
)
(drop
- (block $label$2 (result funcref)
+ (block $label$2 (result i31ref)
(local.set $1
- (br_on_func $label$2
- (local.get $0)
- )
- )
- (ref.null nofunc)
- )
- )
- (drop
- (block $label$3 (result i31ref)
- (local.set $1
- (br_on_i31 $label$3
+ (br_on_i31 $label$2
(local.get $0)
)
)
@@ -248,27 +238,17 @@
)
)
(drop
- (block $label$4 (result (ref any))
- (br_on_non_null $label$4
+ (block $label$3 (result (ref any))
+ (br_on_non_null $label$3
(local.get $0)
)
(unreachable)
)
)
(drop
- (block $label$5 (result anyref)
- (local.set $3
- (br_on_non_func $label$5
- (local.get $0)
- )
- )
- (ref.null none)
- )
- )
- (drop
- (block $label$6 (result anyref)
+ (block $label$4 (result anyref)
(local.set $4
- (br_on_non_i31 $label$6
+ (br_on_non_i31 $label$4
(local.get $0)
)
)
diff --git a/test/lit/cast-to-basic.wast b/test/lit/cast-to-basic.wast
index 1aa329bf5..239fd820c 100644
--- a/test/lit/cast-to-basic.wast
+++ b/test/lit/cast-to-basic.wast
@@ -35,7 +35,7 @@
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (block $label$1 (result dataref)
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (br_on_cast $label$1 data
+ ;; CHECK-NEXT: (br_on_data $label$1
;; CHECK-NEXT: (ref.null none)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
diff --git a/test/lit/passes/gufa-refs.wast b/test/lit/passes/gufa-refs.wast
index 9f45ab62a..f1ea265d7 100644
--- a/test/lit/passes/gufa-refs.wast
+++ b/test/lit/passes/gufa-refs.wast
@@ -14,8 +14,6 @@
;; CHECK: (type $none_=>_ref|any| (func (result (ref any))))
- ;; CHECK: (type $none_=>_funcref (func (result funcref)))
-
;; CHECK: (import "a" "b" (func $import (result i32)))
(import "a" "b" (func $import (result i32)))
@@ -58,7 +56,7 @@
(nop)
(ref.as_func
(ref.as_non_null
- (ref.null any)
+ (ref.null func)
)
)
)
@@ -360,50 +358,6 @@
(local.get $z)
)
)
-
- ;; CHECK: (func $nondeterminism (type $none_=>_funcref) (result funcref)
- ;; CHECK-NEXT: (block $label$1 (result funcref)
- ;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (br_on_func $label$1
- ;; CHECK-NEXT: (i31.new
- ;; CHECK-NEXT: (i32.const 1337)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (ref.null nofunc)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: )
- (func $nondeterminism (result funcref)
- ;; This block is sent an i31 and a null. The null is compatible with the
- ;; type and the i31 is not. The order in which we process this matters:
- ;;
- ;; * If the i31 arrives first, we'll filter it out as incompatible with the
- ;; type of the block. Then the null arrives and the final result is that
- ;; null, which we can then optimize the block to return.
- ;; * Or, if the null arrives first, then when the i31 arrives the
- ;; combination of nullfunc + i31 is Many (since the types are
- ;; incompatible). We then filter that to the block's type, ending up with
- ;; a cone of funcref. We cannot optimize in that case, unlike before.
- ;;
- ;; Ideally we'd optimize here, but atm we do not since the order in
- ;; practice is a less ideal one. At minimum we should be deterministic in
- ;; how we handle this, which this test enforces at least.
- ;;
- ;; TODO: Find a way to actually optimize such cases, perhaps by filtering
- ;; when sending as well and not just when receiving (the br_on_func
- ;; here should not send anything, as what it sends should be first
- ;; intersected with funcref).
- (block $label$1 (result funcref)
- (drop
- (br_on_func $label$1
- (i31.new
- (i32.const 1337)
- )
- )
- )
- (ref.null nofunc)
- )
- )
)
(module
diff --git a/test/passes/remove-unused-brs_all-features.txt b/test/passes/remove-unused-brs_all-features.txt
index d833e469e..253092e1c 100644
--- a/test/passes/remove-unused-brs_all-features.txt
+++ b/test/passes/remove-unused-brs_all-features.txt
@@ -7,9 +7,8 @@
(type $none_=>_f64 (func (result f64)))
(type $none_=>_i32 (func (result i32)))
(type $i32_=>_funcref (func (param i32) (result funcref)))
- (type $none_=>_none (func))
(import "out" "log" (func $log (param i32)))
- (elem declare func $br_on-to-br $br_on-to-flow $i32_=>_none $none_=>_i32)
+ (elem declare func $br_on-to-br $i32_=>_none $none_=>_i32)
(func $foo (type $none_=>_ref?|$struct|) (result (ref null $struct))
(if (result (ref null $struct))
(i32.const 1)
@@ -114,44 +113,4 @@
)
)
)
- (func $br_on-to-flow (type $none_=>_none)
- (drop
- (block $func (result nullfuncref)
- (drop
- (array.new_default $vector
- (i32.const 2)
- )
- )
- (ref.null nofunc)
- )
- )
- (drop
- (block $funcb (result nullfuncref)
- (drop
- (i31.new
- (i32.const 1337)
- )
- )
- (ref.null nofunc)
- )
- )
- (drop
- (block $i31 (result nullref)
- (drop
- (array.new_default $vector
- (i32.const 2)
- )
- )
- (ref.null none)
- )
- )
- (drop
- (block $i31b (result nullref)
- (drop
- (ref.func $br_on-to-flow)
- )
- (ref.null none)
- )
- )
- )
)
diff --git a/test/passes/remove-unused-brs_all-features.wast b/test/passes/remove-unused-brs_all-features.wast
index 356616b7b..5960e1029 100644
--- a/test/passes/remove-unused-brs_all-features.wast
+++ b/test/passes/remove-unused-brs_all-features.wast
@@ -96,55 +96,4 @@
)
)
)
-
- ;; a br_on of the obviously incorrect kind can just flow out the value as the
- ;; break is never taken
- (func $br_on-to-flow
- ;; brs to func
- (drop
- (block $func (result (ref null func))
- (drop
- (br_on_func $func
- (array.new_default $vector
- (i32.const 2)
- )
- )
- )
- (ref.null func)
- )
- )
- (drop
- (block $funcb (result (ref null func))
- (drop
- (br_on_func $funcb
- (i31.new (i32.const 1337))
- )
- )
- (ref.null func)
- )
- )
- ;; brs to i31
- (drop
- (block $i31 (result (ref null i31))
- (drop
- (br_on_i31 $i31
- (array.new_default $vector
- (i32.const 2)
- )
- )
- )
- (ref.null i31)
- )
- )
- (drop
- (block $i31b (result (ref null i31))
- (drop
- (br_on_i31 $i31b
- (ref.func $br_on-to-flow)
- )
- )
- (ref.null i31)
- )
- )
- )
-)
+) \ No newline at end of file