diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lit/isorecursive-good.wast | 53 | ||||
-rw-r--r-- | test/lit/isorecursive-output-ordering.wast | 77 | ||||
-rw-r--r-- | test/lit/isorecursive-singleton-group.wast | 6 | ||||
-rw-r--r-- | test/lit/isorecursive-whole-group.wast | 10 | ||||
-rw-r--r-- | test/lit/nominal-to-isorecursive.wast | 29 |
5 files changed, 101 insertions, 74 deletions
diff --git a/test/lit/isorecursive-good.wast b/test/lit/isorecursive-good.wast index 7ced0d8d3..da14b38c8 100644 --- a/test/lit/isorecursive-good.wast +++ b/test/lit/isorecursive-good.wast @@ -1,4 +1,4 @@ -;; TODO: Autogenerate these checks! The current script cannot handle `rec`. +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. ;; RUN: wasm-opt %s -all --hybrid -S -o - | filecheck %s --check-prefix HYBRID ;; RUN: wasm-opt %s -all --hybrid --roundtrip -S -o - | filecheck %s --check-prefix HYBRID @@ -6,46 +6,63 @@ (module -;; HYBRID: (rec -;; HYBRID-NEXT: (type $super-struct (struct_subtype (field i32) data)) -;; HYBRID-NEXT: (type $sub-struct (struct_subtype (field i32) (field i64) $super-struct)) -;; HYBRID-NEXT: ) - -;; HYBRID: (rec -;; HYBRID-NEXT: (type $super-array (array_subtype (ref $super-struct) data)) -;; HYBRID-NEXT: (type $sub-array (array_subtype (ref $sub-struct) $super-array)) -;; HYBRID-NEXT: ) - -;; NOMINAL-NOT: rec - -;; NOMINAL: (type $super-struct (struct_subtype (field i32) data)) -;; NOMINAL-NEXT: (type $sub-struct (struct_subtype (field i32) (field i64) $super-struct)) - -;; NOMINAL: (type $super-array (array_subtype (ref $super-struct) data)) -;; NOMINAL-NEXT: (type $sub-array (array_subtype (ref $sub-struct) $super-array)) (rec + ;; HYBRID: (rec + ;; HYBRID-NEXT: (type $super-struct (struct_subtype (field i32) data)) + ;; NOMINAL: (type $super-struct (struct_subtype (field i32) data)) (type $super-struct (struct i32)) + ;; HYBRID: (type $sub-struct (struct_subtype (field i32) (field i64) $super-struct)) + ;; NOMINAL: (type $sub-struct (struct_subtype (field i32) (field i64) $super-struct)) (type $sub-struct (struct_subtype i32 i64 $super-struct)) ) (rec + ;; HYBRID: (rec + ;; HYBRID-NEXT: (type $super-array (array_subtype (ref $super-struct) data)) + ;; NOMINAL: (type $super-array (array_subtype (ref $super-struct) data)) (type $super-array (array (ref $super-struct))) + ;; HYBRID: (type $sub-array (array_subtype (ref $sub-struct) $super-array)) + ;; NOMINAL: (type $sub-array (array_subtype (ref $sub-struct) $super-array)) (type $sub-array (array_subtype (ref $sub-struct) $super-array)) ) + ;; HYBRID: (func $make-super-struct (type $none_=>_ref|$super-struct|) (result (ref $super-struct)) + ;; HYBRID-NEXT: (call $make-sub-struct) + ;; HYBRID-NEXT: ) + ;; NOMINAL: (func $make-super-struct (type $none_=>_ref|$super-struct|) (result (ref $super-struct)) + ;; NOMINAL-NEXT: (call $make-sub-struct) + ;; NOMINAL-NEXT: ) (func $make-super-struct (result (ref $super-struct)) (call $make-sub-struct) ) + ;; HYBRID: (func $make-sub-struct (type $none_=>_ref|$sub-struct|) (result (ref $sub-struct)) + ;; HYBRID-NEXT: (unreachable) + ;; HYBRID-NEXT: ) + ;; NOMINAL: (func $make-sub-struct (type $none_=>_ref|$sub-struct|) (result (ref $sub-struct)) + ;; NOMINAL-NEXT: (unreachable) + ;; NOMINAL-NEXT: ) (func $make-sub-struct (result (ref $sub-struct)) (unreachable) ) + ;; HYBRID: (func $make-super-array (type $none_=>_ref|$super-array|) (result (ref $super-array)) + ;; HYBRID-NEXT: (call $make-sub-array) + ;; HYBRID-NEXT: ) + ;; NOMINAL: (func $make-super-array (type $none_=>_ref|$super-array|) (result (ref $super-array)) + ;; NOMINAL-NEXT: (call $make-sub-array) + ;; NOMINAL-NEXT: ) (func $make-super-array (result (ref $super-array)) (call $make-sub-array) ) + ;; HYBRID: (func $make-sub-array (type $none_=>_ref|$sub-array|) (result (ref $sub-array)) + ;; HYBRID-NEXT: (unreachable) + ;; HYBRID-NEXT: ) + ;; NOMINAL: (func $make-sub-array (type $none_=>_ref|$sub-array|) (result (ref $sub-array)) + ;; NOMINAL-NEXT: (unreachable) + ;; NOMINAL-NEXT: ) (func $make-sub-array (result (ref $sub-array)) (unreachable) ) diff --git a/test/lit/isorecursive-output-ordering.wast b/test/lit/isorecursive-output-ordering.wast index ae965123f..acca04969 100644 --- a/test/lit/isorecursive-output-ordering.wast +++ b/test/lit/isorecursive-output-ordering.wast @@ -1,4 +1,4 @@ -;; TODO: Autogenerate these checks! The current script cannot handle `rec`. +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. ;; RUN: foreach %s %t wasm-opt -all --hybrid -S -o - | filecheck %s ;; RUN: foreach %s %t wasm-opt -all --hybrid --roundtrip -S -o - | filecheck %s @@ -6,26 +6,25 @@ (module ;; Test that we order groups by average uses. - ;; CHECK: (rec - ;; CHECK-NEXT: (type $unused-6 (struct_subtype data)) - ;; CHECK-NEXT: (type $used-a-bit (struct_subtype data)) - ;; CHECK-NEXT: ) - - ;; CHECK-NEXT: (rec - ;; CHECK-NEXT: (type $unused-1 (struct_subtype data)) - ;; CHECK-NEXT: (type $unused-2 (struct_subtype data)) - ;; CHECK-NEXT: (type $unused-3 (struct_subtype data)) - ;; CHECK-NEXT: (type $unused-4 (struct_subtype data)) - ;; CHECK-NEXT: (type $used-a-lot (struct_subtype data)) - ;; CHECK-NEXT: (type $unused-5 (struct_subtype data)) - ;; CHECK-NEXT: ) (rec + ;; CHECK: (rec + ;; CHECK-NEXT: (type $unused-6 (struct_subtype data)) + + ;; CHECK: (type $used-a-bit (struct_subtype data)) + + ;; CHECK: (rec + ;; CHECK-NEXT: (type $unused-1 (struct_subtype data)) (type $unused-1 (struct_subtype data)) + ;; CHECK: (type $unused-2 (struct_subtype data)) (type $unused-2 (struct_subtype data)) + ;; CHECK: (type $unused-3 (struct_subtype data)) (type $unused-3 (struct_subtype data)) + ;; CHECK: (type $unused-4 (struct_subtype data)) (type $unused-4 (struct_subtype data)) + ;; CHECK: (type $used-a-lot (struct_subtype data)) (type $used-a-lot (struct_subtype data)) + ;; CHECK: (type $unused-5 (struct_subtype data)) (type $unused-5 (struct_subtype data)) ) @@ -34,6 +33,9 @@ (type $used-a-bit (struct_subtype data)) ) + ;; CHECK: (func $use (type $ref|$used-a-lot|_ref|$used-a-lot|_ref|$used-a-lot|_ref|$used-a-lot|_ref|$used-a-lot|_ref|$used-a-lot|_=>_ref|$used-a-bit|_ref|$used-a-bit|_ref|$used-a-bit|_ref|$used-a-bit|) (param $0 (ref $used-a-lot)) (param $1 (ref $used-a-lot)) (param $2 (ref $used-a-lot)) (param $3 (ref $used-a-lot)) (param $4 (ref $used-a-lot)) (param $5 (ref $used-a-lot)) (result (ref $used-a-bit) (ref $used-a-bit) (ref $used-a-bit) (ref $used-a-bit)) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) (func $use (param (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot)) (result (ref $used-a-bit) (ref $used-a-bit) (ref $used-a-bit) (ref $used-a-bit)) (unreachable) ) @@ -42,33 +44,25 @@ (module ;; Test that we respect dependencies between groups before considering counts. - ;; CHECK: (rec - ;; CHECK-NEXT: (type $leaf (struct_subtype data)) - ;; CHECK-NEXT: (type $unused (struct_subtype data)) - ;; CHECK-NEXT: ) - - ;; CHECK-NEXT: (rec - ;; CHECK-NEXT: (type $shrub (struct_subtype $leaf)) - ;; CHECK-NEXT: (type $used-a-ton (struct_subtype data)) - ;; CHECK-NEXT: ) - - ;; CHECK-NEXT: (rec - ;; CHECK-NEXT: (type $twig (struct_subtype data)) - ;; CHECK-NEXT: (type $used-a-bit (struct_subtype (field (ref $leaf)) data)) - ;; CHECK-NEXT: ) - - ;; CHECK-NEXT: (rec - ;; CHECK-NEXT: (type $root (struct_subtype data)) - ;; CHECK-NEXT: (type $used-a-lot (struct_subtype $twig)) - ;; CHECK-NEXT: ) (rec + ;; CHECK: (rec + ;; CHECK-NEXT: (type $leaf (struct_subtype data)) (type $leaf (struct_subtype data)) + ;; CHECK: (type $unused (struct_subtype data)) (type $unused (struct_subtype data)) ) (rec + ;; CHECK: (rec + ;; CHECK-NEXT: (type $shrub (struct_subtype $leaf)) + + ;; CHECK: (type $used-a-ton (struct_subtype data)) + + ;; CHECK: (rec + ;; CHECK-NEXT: (type $twig (struct_subtype data)) (type $twig (struct_subtype data)) + ;; CHECK: (type $used-a-bit (struct_subtype (field (ref $leaf)) data)) (type $used-a-bit (struct_subtype (ref $leaf) data)) ) @@ -78,10 +72,23 @@ ) (rec + ;; CHECK: (rec + ;; CHECK-NEXT: (type $root (struct_subtype data)) (type $root (struct_subtype data)) + ;; CHECK: (type $used-a-lot (struct_subtype $twig)) (type $used-a-lot (struct_subtype $twig)) ) + ;; CHECK: (func $use (type $ref|$used-a-lot|_ref|$used-a-lot|_ref|$used-a-lot|_ref|$used-a-lot|_ref|$used-a-lot|_ref|$used-a-lot|_=>_ref|$used-a-bit|_ref|$used-a-bit|_ref|$used-a-bit|) (param $0 (ref $used-a-lot)) (param $1 (ref $used-a-lot)) (param $2 (ref $used-a-lot)) (param $3 (ref $used-a-lot)) (param $4 (ref $used-a-lot)) (param $5 (ref $used-a-lot)) (result (ref $used-a-bit) (ref $used-a-bit) (ref $used-a-bit)) + ;; CHECK-NEXT: (local $6 (ref null $used-a-ton)) + ;; CHECK-NEXT: (local $7 (ref null $used-a-ton)) + ;; CHECK-NEXT: (local $8 (ref null $used-a-ton)) + ;; CHECK-NEXT: (local $9 (ref null $used-a-ton)) + ;; CHECK-NEXT: (local $10 (ref null $used-a-ton)) + ;; CHECK-NEXT: (local $11 (ref null $used-a-ton)) + ;; CHECK-NEXT: (local $12 (ref null $used-a-ton)) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) (func $use (param (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot) (ref $used-a-lot)) (result (ref $used-a-bit) (ref $used-a-bit) (ref $used-a-bit)) (local (ref null $used-a-ton) (ref null $used-a-ton) (ref null $used-a-ton) (ref null $used-a-ton) (ref null $used-a-ton) (ref null $used-a-ton) (ref null $used-a-ton)) (unreachable) @@ -92,9 +99,13 @@ ;; Test that basic heap type children do not trigger assertions. (rec + ;; CHECK: (type $contains-basic (struct_subtype (field (ref any)) data)) (type $contains-basic (struct_subtype (ref any) data)) ) + ;; CHECK: (func $use (type $ref|$contains-basic|_=>_none) (param $0 (ref $contains-basic)) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) (func $use (param (ref $contains-basic)) (unreachable) ) diff --git a/test/lit/isorecursive-singleton-group.wast b/test/lit/isorecursive-singleton-group.wast index eeb92ac09..c36717376 100644 --- a/test/lit/isorecursive-singleton-group.wast +++ b/test/lit/isorecursive-singleton-group.wast @@ -1,4 +1,4 @@ -;; TODO: Autogenerate these checks! The current script cannot handle `rec`. +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. ;; RUN: wasm-opt %s -all --hybrid -S -o - | filecheck %s ;; RUN: wasm-opt %s -all --hybrid --roundtrip -S -o - | filecheck %s @@ -8,13 +8,13 @@ (module -;; CHECK-NOT: rec -;; CHECK: (type $singleton (struct_subtype data)) (rec + ;; CHECK: (type $singleton (struct_subtype data)) (type $singleton (struct_subtype data)) ) ;; Use the type so it appears in the output. + ;; CHECK: (global $g (ref null $singleton) (ref.null $singleton)) (global $g (ref null $singleton) (ref.null $singleton)) ) diff --git a/test/lit/isorecursive-whole-group.wast b/test/lit/isorecursive-whole-group.wast index 4d349a3cb..f2a60deda 100644 --- a/test/lit/isorecursive-whole-group.wast +++ b/test/lit/isorecursive-whole-group.wast @@ -1,4 +1,4 @@ -;; TODO: Autogenerate these checks! The current script cannot handle `rec`. +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. ;; RUN: wasm-opt %s -all --hybrid -S -o - | filecheck %s ;; RUN: wasm-opt %s -all --hybrid --roundtrip -S -o - | filecheck %s @@ -8,15 +8,15 @@ (module -;; CHECK: (rec -;; CHECK-NEXT: (type $used (struct_subtype data)) -;; CHECK-NEXT: (type $unused (struct_subtype data)) -;; CHECK-NEXT: ) (rec + ;; CHECK: (rec + ;; CHECK-NEXT: (type $used (struct_subtype data)) (type $used (struct_subtype data)) + ;; CHECK: (type $unused (struct_subtype data)) (type $unused (struct_subtype data)) ) + ;; CHECK: (global $g (ref null $used) (ref.null $used)) (global $g (ref null $used) (ref.null $used)) ) diff --git a/test/lit/nominal-to-isorecursive.wast b/test/lit/nominal-to-isorecursive.wast index c1deadb54..beb0aaee9 100644 --- a/test/lit/nominal-to-isorecursive.wast +++ b/test/lit/nominal-to-isorecursive.wast @@ -1,4 +1,4 @@ -;; TODO: Autogenerate these checks! The current script cannot handle `rec`. +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. ;; RUN: wasm-as %s -all --nominal -g -o %t.wasm ;; RUN: wasm-dis %t.wasm -all --hybrid -o - | filecheck %s @@ -6,30 +6,29 @@ ;; Check that the nominal binary format is parseable as isorecursive with a ;; single recursion group. -;; CHECK: (module -;; CHECK-NEXT: (rec -;; CHECK-NEXT: (type $make-super-t (func_subtype (result (ref $super)) func)) -;; CHECK-NEXT: (type $make-sub-t (func_subtype (result (ref $sub)) func)) -;; CHECK-NEXT: (type $super (struct_subtype (field i32) data)) -;; CHECK-NEXT: (type $sub (struct_subtype (field i32) $super)) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (func $make-super (type $make-super-t) (result (ref $super)) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) -;; CHECK-NEXT: (func $make-sub (type $make-sub-t) (result (ref $sub)) -;; CHECK-NEXT: (unreachable) -;; CHECK-NEXT: ) -;; CHECK-NEXT: ) (module + ;; CHECK: (rec + ;; CHECK-NEXT: (type $make-super-t (func_subtype (result (ref $super)) func)) + + ;; CHECK: (type $make-sub-t (func_subtype (result (ref $sub)) func)) + + ;; CHECK: (type $super (struct_subtype (field i32) data)) (type $super (struct i32)) + ;; CHECK: (type $sub (struct_subtype (field i32) $super)) (type $sub (struct_subtype i32 $super)) (type $make-super-t (func (result (ref $super)))) (type $make-sub-t (func (result (ref $sub)))) + ;; CHECK: (func $make-super (type $make-super-t) (result (ref $super)) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) (func $make-super (type $make-super-t) (unreachable) ) + ;; CHECK: (func $make-sub (type $make-sub-t) (result (ref $sub)) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) (func $make-sub (type $make-sub-t) (unreachable) ) |