diff options
Diffstat (limited to 'test/lit')
-rw-r--r-- | test/lit/basic/shared-types.wast | 42 | ||||
-rw-r--r-- | test/lit/basic/typed_continuations.wast | 8 | ||||
-rw-r--r-- | test/lit/passes/type-merging-shared.wast | 22 | ||||
-rw-r--r-- | test/lit/wat-kitchen-sink.wast | 32 |
4 files changed, 81 insertions, 23 deletions
diff --git a/test/lit/basic/shared-types.wast b/test/lit/basic/shared-types.wast index d3720c2e9..0bba2f054 100644 --- a/test/lit/basic/shared-types.wast +++ b/test/lit/basic/shared-types.wast @@ -5,6 +5,8 @@ (module (rec + ;; CHECK: (type $0 (func)) + ;; CHECK: (rec ;; CHECK-NEXT: (type $final (shared (struct ))) (type $final (shared (struct))) @@ -23,9 +25,7 @@ (type $cont (shared (cont $func))) ) - ;; CHECK: (type $7 (func)) - - ;; CHECK: (func $use-types (type $7) + ;; CHECK: (func $use-types (type $0) ;; CHECK-NEXT: (local $0 (ref $final)) ;; CHECK-NEXT: (local $1 (ref $top)) ;; CHECK-NEXT: (local $2 (ref $mid)) @@ -44,4 +44,40 @@ (local (ref $array)) (local (ref $cont)) ) + + ;; CHECK: (func $use-basic-types (type $0) + ;; CHECK-NEXT: (local $0 (ref (shared extern))) + ;; CHECK-NEXT: (local $1 (ref (shared func))) + ;; CHECK-NEXT: (local $2 (ref (shared cont))) + ;; CHECK-NEXT: (local $3 (ref (shared any))) + ;; CHECK-NEXT: (local $4 (ref (shared eq))) + ;; CHECK-NEXT: (local $5 (ref (shared i31))) + ;; CHECK-NEXT: (local $6 (ref (shared struct))) + ;; CHECK-NEXT: (local $7 (ref (shared array))) + ;; CHECK-NEXT: (local $8 (ref (shared exn))) + ;; CHECK-NEXT: (local $9 (ref (shared string))) + ;; CHECK-NEXT: (local $10 (ref (shared none))) + ;; CHECK-NEXT: (local $11 (ref (shared noextern))) + ;; CHECK-NEXT: (local $12 (ref (shared nofunc))) + ;; CHECK-NEXT: (local $13 (ref (shared nocont))) + ;; CHECK-NEXT: (local $14 (ref (shared noexn))) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + (func $use-basic-types + (local (ref (shared extern))) + (local (ref (shared func))) + (local (ref (shared cont))) + (local (ref (shared any))) + (local (ref (shared eq))) + (local (ref (shared i31))) + (local (ref (shared struct))) + (local (ref (shared array))) + (local (ref (shared exn))) + (local (ref (shared string))) + (local (ref (shared none))) + (local (ref (shared noextern))) + (local (ref (shared nofunc))) + (local (ref (shared nocont))) + (local (ref (shared noexn))) + ) ) diff --git a/test/lit/basic/typed_continuations.wast b/test/lit/basic/typed_continuations.wast index 52258403f..1e024ca0b 100644 --- a/test/lit/basic/typed_continuations.wast +++ b/test/lit/basic/typed_continuations.wast @@ -26,7 +26,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (type $2 (func (param (ref $ct)) (result (ref $ct)))) - ;; CHECK-BIN: (type $3 (func (param contref nullcontref (ref func) (ref nocont)) (result contref))) + ;; CHECK-BIN: (type $3 (func (param contref nullcontref (ref cont) (ref nocont)) (result contref))) ;; CHECK-BIN: (func $id (type $2) (param $x (ref $ct)) (result (ref $ct)) ;; CHECK-BIN-NEXT: (local.get $x) @@ -38,7 +38,7 @@ ;; CHECK-TEXT: (func $id2 (type $3) (param $w contref) (param $x nullcontref) (param $y (ref cont)) (param $z (ref nocont)) (result contref) ;; CHECK-TEXT-NEXT: (local.get $z) ;; CHECK-TEXT-NEXT: ) - ;; CHECK-BIN: (func $id2 (type $3) (param $w contref) (param $x nullcontref) (param $y (ref func)) (param $z (ref nocont)) (result contref) + ;; CHECK-BIN: (func $id2 (type $3) (param $w contref) (param $x nullcontref) (param $y (ref cont)) (param $z (ref nocont)) (result contref) ;; CHECK-BIN-NEXT: (local.get $z) ;; CHECK-BIN-NEXT: ) (func $id2 @@ -57,12 +57,12 @@ ;; CHECK-BIN-NODEBUG: (type $2 (func (param (ref $1)) (result (ref $1)))) -;; CHECK-BIN-NODEBUG: (type $3 (func (param contref nullcontref (ref func) (ref nocont)) (result contref))) +;; CHECK-BIN-NODEBUG: (type $3 (func (param contref nullcontref (ref cont) (ref nocont)) (result contref))) ;; CHECK-BIN-NODEBUG: (func $0 (type $2) (param $0 (ref $1)) (result (ref $1)) ;; CHECK-BIN-NODEBUG-NEXT: (local.get $0) ;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG: (func $1 (type $3) (param $0 contref) (param $1 nullcontref) (param $2 (ref func)) (param $3 (ref nocont)) (result contref) +;; CHECK-BIN-NODEBUG: (func $1 (type $3) (param $0 contref) (param $1 nullcontref) (param $2 (ref cont)) (param $3 (ref nocont)) (result contref) ;; CHECK-BIN-NODEBUG-NEXT: (local.get $3) ;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/passes/type-merging-shared.wast b/test/lit/passes/type-merging-shared.wast index 2d3bcdc21..2457cd572 100644 --- a/test/lit/passes/type-merging-shared.wast +++ b/test/lit/passes/type-merging-shared.wast @@ -75,3 +75,25 @@ (local $c' (ref null $C')) ) ) + +(module + ;; Shared and unshared basic heap types similarly cannot be merged. + ;; CHECK: (rec + ;; CHECK-NEXT: (type $A' (shared (struct (field anyref)))) + + ;; CHECK: (type $A (shared (struct (field (ref null (shared any)))))) + (type $A (shared (struct (ref null (shared any))))) + (type $A' (shared (struct (ref null any)))) + + ;; CHECK: (type $2 (func)) + + ;; CHECK: (func $foo (type $2) + ;; CHECK-NEXT: (local $a (ref null $A)) + ;; CHECK-NEXT: (local $a' (ref null $A')) + ;; CHECK-NEXT: (nop) + ;; CHECK-NEXT: ) + (func $foo + (local $a (ref null $A)) + (local $a' (ref null $A')) + ) +) diff --git a/test/lit/wat-kitchen-sink.wast b/test/lit/wat-kitchen-sink.wast index 87778bd24..71484977a 100644 --- a/test/lit/wat-kitchen-sink.wast +++ b/test/lit/wat-kitchen-sink.wast @@ -234,22 +234,22 @@ (type $cont-bind-before-func (func (param i32) (param i64) (param i32) (param i64) (result f32))) (type $cont-bind-before (cont $cont-bind-before-func)) - ;; CHECK: (type $all-types (struct (field externref) (field (ref extern)) (field funcref) (field (ref func)) (field anyref) (field (ref any)) (field eqref) (field (ref eq)) (field i31ref) (field (ref i31)) (field structref) (field (ref struct)) (field arrayref) (field (ref array)) (field exnref) (field (ref exn)) (field stringref) (field (ref string)) (field contref) (field (ref cont)) (field nullref) (field (ref none)) (field nullexternref) (field (ref noextern)) (field nullfuncref) (field (ref nofunc)) (field nullexnref) (field (ref noexn)) (field nullcontref) (field (ref nocont)))) - (type $all-types (struct externref (ref extern) - funcref (ref func) - anyref (ref any) - eqref (ref eq) - i31ref (ref i31) - structref (ref struct) - arrayref (ref array) - exnref (ref exn) - stringref (ref string) - contref (ref cont) - nullref (ref none) - nullexternref (ref noextern) - nullfuncref (ref nofunc) - nullexnref (ref noexn) - nullcontref (ref nocont))) + ;; CHECK: (type $all-types (struct (field externref) (field (ref extern)) (field (ref null (shared extern))) (field (ref (shared extern))) (field funcref) (field (ref func)) (field (ref null (shared func))) (field (ref (shared func))) (field anyref) (field (ref any)) (field (ref null (shared any))) (field (ref (shared any))) (field eqref) (field (ref eq)) (field (ref null (shared eq))) (field (ref (shared eq))) (field i31ref) (field (ref i31)) (field (ref null (shared i31))) (field (ref (shared i31))) (field structref) (field (ref struct)) (field (ref null (shared struct))) (field (ref (shared struct))) (field arrayref) (field (ref array)) (field (ref null (shared array))) (field (ref (shared array))) (field exnref) (field (ref exn)) (field (ref null (shared exn))) (field (ref (shared exn))) (field stringref) (field (ref string)) (field (ref null (shared string))) (field (ref (shared string))) (field contref) (field (ref cont)) (field (ref null (shared cont))) (field (ref (shared cont))) (field nullref) (field (ref none)) (field (ref null (shared none))) (field (ref (shared none))) (field nullexternref) (field (ref noextern)) (field (ref null (shared noextern))) (field (ref (shared noextern))) (field nullfuncref) (field (ref nofunc)) (field (ref null (shared nofunc))) (field (ref (shared nofunc))) (field nullexnref) (field (ref noexn)) (field (ref null (shared noexn))) (field (ref (shared noexn))) (field nullcontref) (field (ref nocont)) (field (ref null (shared nocont))) (field (ref (shared nocont))))) + (type $all-types (struct externref (ref extern) (ref null (shared extern)) (ref (shared extern)) + funcref (ref func) (ref null (shared func)) (ref (shared func)) + anyref (ref any) (ref null (shared any)) (ref (shared any)) + eqref (ref eq) (ref null (shared eq)) (ref (shared eq)) + i31ref (ref i31) (ref null (shared i31)) (ref (shared i31)) + structref (ref struct) (ref null (shared struct)) (ref (shared struct)) + arrayref (ref array) (ref null (shared array)) (ref (shared array)) + exnref (ref exn) (ref null (shared exn)) (ref (shared exn)) + stringref (ref string) (ref null (shared string)) (ref (shared string)) + contref (ref cont) (ref null (shared cont)) (ref (shared cont)) + nullref (ref none) (ref null (shared none)) (ref (shared none)) + nullexternref (ref noextern) (ref null (shared noextern)) (ref (shared noextern)) + nullfuncref (ref nofunc) (ref null (shared nofunc)) (ref (shared nofunc)) + nullexnref (ref noexn) (ref null (shared noexn)) (ref (shared noexn)) + nullcontref (ref nocont) (ref null (shared nocont)) (ref (shared nocont)))) ;; imported memories (memory (export "mem") (export "mem2") (import "" "mem") 0) |