diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 2 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 3 | ||||
-rw-r--r-- | test/example/type-builder-nominal.txt | 100 | ||||
-rw-r--r-- | test/example/type-builder.txt | 68 | ||||
-rw-r--r-- | test/example/typeinfo.txt | 40 | ||||
-rw-r--r-- | test/gtest/type-builder.cpp | 21 | ||||
-rw-r--r-- | test/gtest/type-test.h | 1 | ||||
-rw-r--r-- | test/lit/fuzz-types/isorecursive.test | 20 | ||||
-rw-r--r-- | test/lit/fuzz-types/nominal.test | 20 | ||||
-rw-r--r-- | test/lit/fuzz-types/structural.test | 22 | ||||
-rw-r--r-- | test/lit/help/wasm-as.test | 4 | ||||
-rw-r--r-- | test/lit/help/wasm-ctor-eval.test | 4 | ||||
-rw-r--r-- | test/lit/help/wasm-dis.test | 4 | ||||
-rw-r--r-- | test/lit/help/wasm-emscripten-finalize.test | 4 | ||||
-rw-r--r-- | test/lit/help/wasm-fuzz-types.test | 16 | ||||
-rw-r--r-- | test/lit/help/wasm-metadce.test | 4 | ||||
-rw-r--r-- | test/lit/help/wasm-opt.test | 5 | ||||
-rw-r--r-- | test/lit/help/wasm-reduce.test | 4 | ||||
-rw-r--r-- | test/lit/help/wasm-split.test | 4 | ||||
-rw-r--r-- | test/lit/help/wasm2js.test | 5 | ||||
-rw-r--r-- | test/lit/lub-bug-3843.wast | 53 | ||||
-rw-r--r-- | test/lit/nominal-good.wast | 60 | ||||
-rw-r--r-- | test/lit/recursive-type-sort.wast | 30 |
23 files changed, 161 insertions, 333 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 8dd9260d5..d20c76100 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -2090,8 +2090,6 @@ void test_func_opt() { void test_typesystem() { BinaryenTypeSystem defaultTypeSystem = BinaryenGetTypeSystem(); assert(defaultTypeSystem == BinaryenTypeSystemIsorecursive()); - printf("BinaryenTypeSystemEquirecursive: %d\n", - BinaryenTypeSystemEquirecursive()); BinaryenSetTypeSystem(BinaryenTypeSystemNominal()); assert(BinaryenGetTypeSystem() == BinaryenTypeSystemNominal()); printf("BinaryenTypeSystemNominal: %d\n", BinaryenTypeSystemNominal()); diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 857988419..c4dd09168 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -3028,9 +3028,8 @@ optimized: (i32.const 4) ) ) -BinaryenTypeSystemEquirecursive: 0 BinaryenTypeSystemNominal: 1 -BinaryenTypeSystemIsorecursive: 2 +BinaryenTypeSystemIsorecursive: 0 TypeBuilderErrorReasonSelfSupertype: 0 TypeBuilderErrorReasonInvalidSupertype: 1 TypeBuilderErrorReasonForwardSupertypeReference: 2 diff --git a/test/example/type-builder-nominal.txt b/test/example/type-builder-nominal.txt index 8d146cc1f..b542f212c 100644 --- a/test/example/type-builder-nominal.txt +++ b/test/example/type-builder-nominal.txt @@ -1,24 +1,24 @@ ;; Test TypeBuilder Before setting heap types: -$sig => (; temp ;) (func_subtype func) -$struct => (; temp ;) (func_subtype func) -$array => (; temp ;) (func_subtype func) +$sig => (; temp ;) (func) +$struct => (; temp ;) (func) +$array => (; temp ;) (func) (ref $sig) => (; temp ;) (ref $0) (ref $struct) => (; temp ;) (ref $1) (ref $array) => (; temp ;) (ref $2) (ref null $array) => (; temp ;) (ref null $2) After setting heap types: -$sig => (; temp ;) (func_subtype (param (; temp ;) (ref $1)) (result (; temp ;) (ref $2) i32) func) -$struct => (; temp ;) (struct_subtype (field (; temp ;) (ref null $2)) data) -$array => (; temp ;) (array_subtype (mut anyref) data) +$sig => (; temp ;) (func (param (; temp ;) (ref $1)) (result (; temp ;) (ref $2) i32)) +$struct => (; temp ;) (struct (field (; temp ;) (ref null $2))) +$array => (; temp ;) (array (mut anyref)) (ref $sig) => (; temp ;) (ref $0) (ref $struct) => (; temp ;) (ref $1) (ref $array) => (; temp ;) (ref $2) (ref null $array) => (; temp ;) (ref null $2) After building types: -$sig => (func_subtype (param (ref $1)) (result (ref $2) i32) func) -$struct => (struct_subtype (field (ref null $2)) data) -$array => (array_subtype (mut anyref) data) +$sig => (func (param (ref $1)) (result (ref $2) i32)) +$struct => (struct (field (ref null $2))) +$array => (array (mut anyref)) (ref $sig) => (ref $0) (ref $struct) => (ref $1) (ref $array) => (ref $2) @@ -27,49 +27,49 @@ $array => (array_subtype (mut anyref) data) ;; Test basic ;; Test canonical signatures ;; Test recursive types -(func_subtype (result (ref null $0)) func) +(func (result (ref null $0))) -(func_subtype (result (ref null $1)) func) -(func_subtype (result (ref null $0)) func) +(func (result (ref null $1))) +(func (result (ref null $0))) -(func_subtype (result (ref null $1)) func) -(func_subtype (result (ref null $2)) func) -(func_subtype (result (ref null $3)) func) -(func_subtype (result (ref null $4)) func) -(func_subtype (result (ref null $0)) func) +(func (result (ref null $1))) +(func (result (ref null $2))) +(func (result (ref null $3))) +(func (result (ref null $4))) +(func (result (ref null $0))) -(func_subtype (result (ref null $0) (ref null $2)) func) -(func_subtype (result (ref null $1) (ref null $3)) func) -(func_subtype func) -(func_subtype func) -(func_subtype (result (ref null $0)) func) -(func_subtype (result (ref null $1)) func) +(func (result (ref null $0) (ref null $2))) +(func (result (ref null $1) (ref null $3))) +(func) +(func) +(func (result (ref null $0))) +(func (result (ref null $1))) -(func_subtype (result (ref null $0)) func) -(func_subtype (result (ref null $0)) func) +(func (result (ref null $0))) +(func (result (ref null $0))) ;; Test subtyping ;; Test TypeBuilder Before setting heap types: -$sig => (; temp ;) (func_subtype func) -$struct => (; temp ;) (func_subtype func) -$array => (; temp ;) (func_subtype func) +$sig => (; temp ;) (func) +$struct => (; temp ;) (func) +$array => (; temp ;) (func) (ref $sig) => (; temp ;) (ref $0) (ref $struct) => (; temp ;) (ref $1) (ref $array) => (; temp ;) (ref $2) (ref null $array) => (; temp ;) (ref null $2) After setting heap types: -$sig => (; temp ;) (func_subtype (param (; temp ;) (ref $1)) (result (; temp ;) (ref $2) i32) func) -$struct => (; temp ;) (struct_subtype (field (; temp ;) (ref null $2)) data) -$array => (; temp ;) (array_subtype (mut anyref) data) +$sig => (; temp ;) (func (param (; temp ;) (ref $1)) (result (; temp ;) (ref $2) i32)) +$struct => (; temp ;) (struct (field (; temp ;) (ref null $2))) +$array => (; temp ;) (array (mut anyref)) (ref $sig) => (; temp ;) (ref $0) (ref $struct) => (; temp ;) (ref $1) (ref $array) => (; temp ;) (ref $2) (ref null $array) => (; temp ;) (ref null $2) After building types: -$sig => (func_subtype (param (ref $1)) (result (ref $2) i32) func) -$struct => (struct_subtype (field (ref null $2)) data) -$array => (array_subtype (mut anyref) data) +$sig => (func (param (ref $1)) (result (ref $2) i32)) +$struct => (struct (field (ref null $2))) +$array => (array (mut anyref)) (ref $sig) => (ref $0) (ref $struct) => (ref $1) (ref $array) => (ref $2) @@ -78,25 +78,25 @@ $array => (array_subtype (mut anyref) data) ;; Test basic ;; Test canonical signatures ;; Test recursive types -(func_subtype (result (ref null $0)) func) +(func (result (ref null $0))) -(func_subtype (result (ref null $1)) func) -(func_subtype (result (ref null $0)) func) +(func (result (ref null $1))) +(func (result (ref null $0))) -(func_subtype (result (ref null $1)) func) -(func_subtype (result (ref null $2)) func) -(func_subtype (result (ref null $3)) func) -(func_subtype (result (ref null $4)) func) -(func_subtype (result (ref null $0)) func) +(func (result (ref null $1))) +(func (result (ref null $2))) +(func (result (ref null $3))) +(func (result (ref null $4))) +(func (result (ref null $0))) -(func_subtype (result (ref null $0) (ref null $2)) func) -(func_subtype (result (ref null $1) (ref null $3)) func) -(func_subtype func) -(func_subtype func) -(func_subtype (result (ref null $0)) func) -(func_subtype (result (ref null $1)) func) +(func (result (ref null $0) (ref null $2))) +(func (result (ref null $1) (ref null $3))) +(func) +(func) +(func (result (ref null $0))) +(func (result (ref null $1))) -(func_subtype (result (ref null $0)) func) -(func_subtype (result (ref null $0)) func) +(func (result (ref null $0))) +(func (result (ref null $0))) ;; Test subtyping diff --git a/test/example/type-builder.txt b/test/example/type-builder.txt index af40fd5de..6d584e7be 100644 --- a/test/example/type-builder.txt +++ b/test/example/type-builder.txt @@ -1,54 +1,54 @@ ;; Test canonicalization ;; Test basic ;; Test recursive types -(func_subtype (result (ref null $0)) func) +(func (result (ref null $0))) -(func_subtype (result (ref null $1)) func) -(func_subtype (result (ref null $0)) func) +(func (result (ref null $1))) +(func (result (ref null $0))) -(func_subtype (result (ref null $1)) func) -(func_subtype (result (ref null $2)) func) -(func_subtype (result (ref null $3)) func) -(func_subtype (result (ref null $4)) func) -(func_subtype (result (ref null $0)) func) +(func (result (ref null $1))) +(func (result (ref null $2))) +(func (result (ref null $3))) +(func (result (ref null $4))) +(func (result (ref null $0))) -(func_subtype func) -(func_subtype func) -(func_subtype (result (ref null $0) (ref null $2)) func) -(func_subtype (result (ref null $0) (ref null $3)) func) -(func_subtype (result (ref null $2)) func) -(func_subtype (result (ref null $3)) func) +(func) +(func) +(func (result (ref null $0) (ref null $2))) +(func (result (ref null $0) (ref null $3))) +(func (result (ref null $2))) +(func (result (ref null $3))) -(func_subtype (result (ref null $0)) func) -(func_subtype (result (ref null $0)) func) +(func (result (ref null $0))) +(func (result (ref null $0))) any -(func_subtype (param anyref) (result (ref null $1)) func) +(func (param anyref) (result (ref null $1))) ;; Test canonicalization ;; Test basic ;; Test recursive types -(func_subtype (result (ref null $0)) func) +(func (result (ref null $0))) -(func_subtype (result (ref null $1)) func) -(func_subtype (result (ref null $0)) func) +(func (result (ref null $1))) +(func (result (ref null $0))) -(func_subtype (result (ref null $1)) func) -(func_subtype (result (ref null $2)) func) -(func_subtype (result (ref null $3)) func) -(func_subtype (result (ref null $4)) func) -(func_subtype (result (ref null $0)) func) +(func (result (ref null $1))) +(func (result (ref null $2))) +(func (result (ref null $3))) +(func (result (ref null $4))) +(func (result (ref null $0))) -(func_subtype func) -(func_subtype func) -(func_subtype (result (ref null $0) (ref null $2)) func) -(func_subtype (result (ref null $0) (ref null $3)) func) -(func_subtype (result (ref null $2)) func) -(func_subtype (result (ref null $3)) func) +(func) +(func) +(func (result (ref null $0) (ref null $2))) +(func (result (ref null $0) (ref null $3))) +(func (result (ref null $2))) +(func (result (ref null $3))) -(func_subtype (result (ref null $0)) func) -(func_subtype (result (ref null $0)) func) +(func (result (ref null $0))) +(func (result (ref null $0))) any -(func_subtype (param anyref) (result (ref null $1)) func) +(func (param anyref) (result (ref null $1))) diff --git a/test/example/typeinfo.txt b/test/example/typeinfo.txt index 67f9766d0..7015e6cfc 100644 --- a/test/example/typeinfo.txt +++ b/test/example/typeinfo.txt @@ -11,31 +11,31 @@ eqref i31 i31ref (ref i31) -(func_subtype func) -(struct_subtype data) -(array_subtype i32 data) +(func) +(struct) +(array i32) ;; Signature -(func_subtype func) +(func) (ref $func.0) (ref null $func.0) -(func_subtype (param i32) (result f64) func) +(func (param i32) (result f64)) (ref $func.0) (ref null $func.0) ;; Struct -(struct_subtype data) +(struct) (ref $struct.0) (ref null $struct.0) -(struct_subtype (field i32 i64 (mut f32) (mut f64)) data) +(struct (field i32 i64 (mut f32) (mut f64))) (ref $struct.0) (ref null $struct.0) ;; Array -(array_subtype i32 data) +(array i32) (ref $array.0) (ref null $array.0) -(array_subtype (mut i64) data) +(array (mut i64)) (ref $array.0) (ref null $array.0) @@ -46,33 +46,33 @@ none (i32 f64) ;; Signature of references (param/result) -(func_subtype (param (ref null $struct.0)) (result (ref $array.0)) func) +(func (param (ref null $struct.0)) (result (ref $array.0))) ;; Signature of references (params/results) -(func_subtype (param (ref null $struct.0) (ref $array.0)) (result (ref $struct.0) (ref null $array.1)) func) +(func (param (ref null $struct.0) (ref $array.0)) (result (ref $struct.0) (ref null $array.1))) ;; Struct of references -(struct_subtype (field (ref $func.0) (mut (ref $func.0)) (ref null $func.0) (mut (ref null $func.0))) data) +(struct (field (ref $func.0) (mut (ref $func.0)) (ref null $func.0) (mut (ref null $func.0)))) (ref $struct.0) (ref null $struct.0) -(struct_subtype (field (ref $struct.0) (mut (ref $struct.0)) (ref null $struct.0) (mut (ref null $struct.0))) data) +(struct (field (ref $struct.0) (mut (ref $struct.0)) (ref null $struct.0) (mut (ref null $struct.0)))) (ref $struct.0) (ref null $struct.0) -(struct_subtype (field (ref $array.0) (mut (ref $array.0)) (ref null $array.0) (mut (ref null $array.0))) data) +(struct (field (ref $array.0) (mut (ref $array.0)) (ref null $array.0) (mut (ref null $array.0)))) (ref $struct.0) (ref null $struct.0) -(struct_subtype (field (mut i32) (mut (ref null $func.0)) (mut (ref null $struct.0)) (mut (ref null $array.0))) data) +(struct (field (mut i32) (mut (ref null $func.0)) (mut (ref null $struct.0)) (mut (ref null $array.0)))) (ref $struct.0) (ref null $struct.0) ;; Array of references -(array_subtype (ref null $func.0) data) +(array (ref null $func.0)) (ref $array.0) (ref null $array.0) -(array_subtype (mut (ref null $struct.0)) data) +(array (mut (ref null $struct.0))) (ref $array.0) (ref null $array.0) -(array_subtype (ref null $array.0) data) +(array (ref null $array.0)) (ref $array.0) (ref null $array.0) @@ -81,7 +81,7 @@ none ((ref $func.0) (ref null $func.0) (ref $struct.0) (ref null $struct.0) (ref $array.0) (ref null $array.0)) ;; Recursive (not really) -(func_subtype (param (ref $func.0)) func) +(func (param (ref $func.0))) (ref $func.0) -(func_subtype (param (ref $array.0)) func) +(func (param (ref $array.0))) (ref $func.0) diff --git a/test/gtest/type-builder.cpp b/test/gtest/type-builder.cpp index fcf0e1a5a..0dba0a10c 100644 --- a/test/gtest/type-builder.cpp +++ b/test/gtest/type-builder.cpp @@ -103,22 +103,22 @@ TEST_F(TypeTest, IndexedTypePrinter) { std::stringstream stream; stream << print(built[0]); - EXPECT_EQ(stream.str(), "(struct_subtype (field (ref null $array1)) data)"); + EXPECT_EQ(stream.str(), "(struct (field (ref null $array1)))"); stream.str(""); stream << print(built[1]); - EXPECT_EQ(stream.str(), "(struct_subtype (field (ref null $struct0)) data)"); + EXPECT_EQ(stream.str(), "(struct (field (ref null $struct0)))"); stream.str(""); stream << print(built[2]); - EXPECT_EQ(stream.str(), "(array_subtype (ref null $struct1) data)"); + EXPECT_EQ(stream.str(), "(array (ref null $struct1))"); stream.str(""); stream << print(built[3]); - EXPECT_EQ(stream.str(), "(array_subtype (ref null $array0) data)"); + EXPECT_EQ(stream.str(), "(array (ref null $array0))"); } -TEST_F(EquirecursiveTest, Basics) { +TEST_F(IsorecursiveTest, Basics) { // (type $sig (func (param (ref $struct)) (result (ref $array) i32))) // (type $struct (struct (field (ref null $array)))) // (type $array (array (mut anyref))) @@ -139,6 +139,8 @@ TEST_F(EquirecursiveTest, Basics) { builder[1] = struct_; builder[2] = array; + builder.createRecGroup(0, 3); + auto result = builder.build(); ASSERT_TRUE(result); std::vector<HeapType> built = *result; @@ -470,7 +472,7 @@ TEST_F(IsorecursiveTest, CanonicalizeTypesBeforeSubtyping) { EXPECT_TRUE(result); } -static void testCanonicalizeBasicTypes() { +TEST_F(IsorecursiveTest, CanonicalizeBasicTypes) { TypeBuilder builder(5); Type anyref = builder.getTempRefType(builder[0], Nullable); @@ -492,13 +494,6 @@ static void testCanonicalizeBasicTypes() { EXPECT_EQ(built[3], built[4]); } -TEST_F(EquirecursiveTest, CanonicalizeBasicTypes) { - testCanonicalizeBasicTypes(); -} -TEST_F(IsorecursiveTest, CanonicalizeBasicTypes) { - testCanonicalizeBasicTypes(); -} - TEST_F(IsorecursiveTest, TestHeapTypeRelations) { HeapType ext = HeapType::ext; HeapType func = HeapType::func; diff --git a/test/gtest/type-test.h b/test/gtest/type-test.h index fffcbd3dd..49c6381fa 100644 --- a/test/gtest/type-test.h +++ b/test/gtest/type-test.h @@ -33,7 +33,6 @@ protected: }; using TypeTest = TypeSystemTest<wasm::TypeSystem::Isorecursive>; -using EquirecursiveTest = TypeSystemTest<wasm::TypeSystem::Equirecursive>; using NominalTest = TypeSystemTest<wasm::TypeSystem::Nominal>; using IsorecursiveTest = TypeSystemTest<wasm::TypeSystem::Isorecursive>; diff --git a/test/lit/fuzz-types/isorecursive.test b/test/lit/fuzz-types/isorecursive.test index ccbb63d5e..4a1725c07 100644 --- a/test/lit/fuzz-types/isorecursive.test +++ b/test/lit/fuzz-types/isorecursive.test @@ -1,26 +1,26 @@ ;; RUN: wasm-fuzz-types --hybrid -v --seed=0 | filecheck %s ;; CHECK: (rec -;; CHECK-NEXT: (type $0 (array_subtype (mut i64) data)) -;; CHECK-NEXT: (type $1 (func_subtype (param i32 (ref eq) (ref null $3)) (result v128) func)) -;; CHECK-NEXT: (type $2 (array_subtype (mut v128) data)) +;; CHECK-NEXT: (type $0 (array (mut i64))) +;; CHECK-NEXT: (type $1 (func (param i32 (ref eq) (ref null $3)) (result v128))) +;; CHECK-NEXT: (type $2 (array (mut v128))) ;; CHECK-NEXT: (type $3 (array_subtype (mut i64) $0)) -;; CHECK-NEXT: (type $4 (array_subtype i32 data)) +;; CHECK-NEXT: (type $4 (array i32)) ;; CHECK-NEXT: (type $5 none) ;; CHECK-NEXT: (type $6 extern) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (rec ;; CHECK-NEXT: (type $7 (array_subtype (mut i64) $3)) -;; CHECK-NEXT: (type $8 (func_subtype (result v128) func)) +;; CHECK-NEXT: (type $8 (func (result v128))) ;; CHECK-NEXT: (type $9 (array_subtype (mut v128) $2)) ;; CHECK-NEXT: (type $10 none) ;; CHECK-NEXT: (type $11 none) ;; CHECK-NEXT: (type $12 (array_subtype (mut v128) $2)) -;; CHECK-NEXT: (type $13 (func_subtype (param f32 (ref none) (ref null $3)) (result eqref) func)) +;; CHECK-NEXT: (type $13 (func (param f32 (ref none) (ref null $3)) (result eqref))) ;; CHECK-NEXT: (type $14 (array_subtype (mut i64) $7)) -;; CHECK-NEXT: (type $15 (func_subtype (param (ref null $17) v128 (ref i31)) func)) -;; CHECK-NEXT: (type $16 (array_subtype i32 data)) -;; CHECK-NEXT: (type $17 (func_subtype (param (ref i31)) (result v128) func)) -;; CHECK-NEXT: (type $18 (func_subtype (param f32) func)) +;; CHECK-NEXT: (type $15 (func (param (ref null $17) v128 (ref i31)))) +;; CHECK-NEXT: (type $16 (array i32)) +;; CHECK-NEXT: (type $17 (func (param (ref i31)) (result v128))) +;; CHECK-NEXT: (type $18 (func (param f32))) ;; CHECK-NEXT: (type $19 (array_subtype (mut i64) $3)) ;; CHECK-NEXT: ) diff --git a/test/lit/fuzz-types/nominal.test b/test/lit/fuzz-types/nominal.test index bb84f6991..26802a4ba 100644 --- a/test/lit/fuzz-types/nominal.test +++ b/test/lit/fuzz-types/nominal.test @@ -1,22 +1,22 @@ ;; RUN: wasm-fuzz-types --nominal -v --seed=0 | filecheck %s -;; CHECK: (type $0 (array_subtype (mut (ref null $8)) data)) -;; CHECK-NEXT: (type $1 (func_subtype (param nullref) (result v128) func)) -;; CHECK-NEXT: (type $2 (struct_subtype (field (mut i64) (mut i8) (mut (ref $12)) (mut f32)) data)) +;; CHECK: (type $0 (array (mut (ref null $8)))) +;; CHECK-NEXT: (type $1 (func (param nullref) (result v128))) +;; CHECK-NEXT: (type $2 (struct (field (mut i64) (mut i8) (mut (ref $12)) (mut f32)))) ;; CHECK-NEXT: (type $3 (array_subtype (mut (ref null $8)) $0)) -;; CHECK-NEXT: (type $4 (array_subtype (mut i64) data)) +;; CHECK-NEXT: (type $4 (array (mut i64))) ;; CHECK-NEXT: (type $5 none) ;; CHECK-NEXT: (type $6 extern) ;; CHECK-NEXT: (type $7 (array_subtype (mut (ref null $8)) $3)) -;; CHECK-NEXT: (type $8 (func_subtype (result (ref $9)) func)) +;; CHECK-NEXT: (type $8 (func (result (ref $9)))) ;; CHECK-NEXT: (type $9 (struct_subtype (field (mut i64) (mut i8) (mut (ref $12)) (mut f32) i16) $2)) ;; CHECK-NEXT: (type $10 none) ;; CHECK-NEXT: (type $11 none) ;; CHECK-NEXT: (type $12 (struct_subtype (field (mut i64) (mut i8) (mut (ref $12)) (mut f32) (mut f32) (mut (ref $4))) $2)) -;; CHECK-NEXT: (type $13 (func_subtype (param dataref) func)) +;; CHECK-NEXT: (type $13 (func (param dataref))) ;; CHECK-NEXT: (type $14 (array_subtype (mut (ref null $8)) $7)) -;; CHECK-NEXT: (type $15 (func_subtype (param externref) func)) -;; CHECK-NEXT: (type $16 (array_subtype v128 data)) -;; CHECK-NEXT: (type $17 (func_subtype (result (ref extern)) func)) -;; CHECK-NEXT: (type $18 (func_subtype (param v128 i64) func)) +;; CHECK-NEXT: (type $15 (func (param externref))) +;; CHECK-NEXT: (type $16 (array v128)) +;; CHECK-NEXT: (type $17 (func (result (ref extern)))) +;; CHECK-NEXT: (type $18 (func (param v128 i64))) ;; CHECK-NEXT: (type $19 (array_subtype (mut (ref null $8)) $3)) diff --git a/test/lit/fuzz-types/structural.test b/test/lit/fuzz-types/structural.test deleted file mode 100644 index 3dcec3179..000000000 --- a/test/lit/fuzz-types/structural.test +++ /dev/null @@ -1,22 +0,0 @@ -;; RUN: wasm-fuzz-types --structural -v --seed=0 | filecheck %s - -;; CHECK: (type $0 (array (mut (ref null $8)))) -;; CHECK-NEXT: (type $1 (func (param nullref) (result v128))) -;; CHECK-NEXT: (type $2 (struct (field (mut i64) (mut i8) (mut (ref $12)) (mut f32)))) -;; CHECK-NEXT: (type $3 identical to $0) -;; CHECK-NEXT: (type $4 (array (mut i64))) -;; CHECK-NEXT: (type $5 none) -;; CHECK-NEXT: (type $6 extern) -;; CHECK-NEXT: (type $7 identical to $0) -;; CHECK-NEXT: (type $8 (func (result (ref $9)))) -;; CHECK-NEXT: (type $9 (struct (field (mut i64) (mut i8) (mut (ref $12)) (mut f32) i16))) -;; CHECK-NEXT: (type $10 none) -;; CHECK-NEXT: (type $11 none) -;; CHECK-NEXT: (type $12 (struct (field (mut i64) (mut i8) (mut (ref $12)) (mut f32) (mut f32) (mut (ref $4))))) -;; CHECK-NEXT: (type $13 (func (param dataref))) -;; CHECK-NEXT: (type $14 identical to $0) -;; CHECK-NEXT: (type $15 (func (param externref))) -;; CHECK-NEXT: (type $16 (array v128)) -;; CHECK-NEXT: (type $17 (func (result (ref extern)))) -;; CHECK-NEXT: (type $18 (func (param v128 i64))) -;; CHECK-NEXT: (type $19 identical to $0) diff --git a/test/lit/help/wasm-as.test b/test/lit/help/wasm-as.test index bbce25015..c94dab310 100644 --- a/test/lit/help/wasm-as.test +++ b/test/lit/help/wasm-as.test @@ -122,10 +122,6 @@ ;; CHECK-NEXT: --nominal Force all GC type definitions to be ;; CHECK-NEXT: parsed as nominal. ;; CHECK-NEXT: -;; CHECK-NEXT: --structural Force all GC type definitions to be -;; CHECK-NEXT: parsed as structural (i.e. -;; CHECK-NEXT: equirecursive). This is the default. -;; CHECK-NEXT: ;; CHECK-NEXT: --hybrid Force all GC type definitions to be ;; CHECK-NEXT: parsed using the isorecursive hybrid type ;; CHECK-NEXT: system. diff --git a/test/lit/help/wasm-ctor-eval.test b/test/lit/help/wasm-ctor-eval.test index c20ccc8c8..9295fc9d1 100644 --- a/test/lit/help/wasm-ctor-eval.test +++ b/test/lit/help/wasm-ctor-eval.test @@ -126,10 +126,6 @@ ;; CHECK-NEXT: --nominal Force all GC type definitions to be ;; CHECK-NEXT: parsed as nominal. ;; CHECK-NEXT: -;; CHECK-NEXT: --structural Force all GC type definitions to be -;; CHECK-NEXT: parsed as structural (i.e. -;; CHECK-NEXT: equirecursive). This is the default. -;; CHECK-NEXT: ;; CHECK-NEXT: --hybrid Force all GC type definitions to be ;; CHECK-NEXT: parsed using the isorecursive hybrid type ;; CHECK-NEXT: system. diff --git a/test/lit/help/wasm-dis.test b/test/lit/help/wasm-dis.test index f6baf0467..c0f0b6f38 100644 --- a/test/lit/help/wasm-dis.test +++ b/test/lit/help/wasm-dis.test @@ -115,10 +115,6 @@ ;; CHECK-NEXT: --nominal Force all GC type definitions to be ;; CHECK-NEXT: parsed as nominal. ;; CHECK-NEXT: -;; CHECK-NEXT: --structural Force all GC type definitions to be -;; CHECK-NEXT: parsed as structural (i.e. -;; CHECK-NEXT: equirecursive). This is the default. -;; CHECK-NEXT: ;; CHECK-NEXT: --hybrid Force all GC type definitions to be ;; CHECK-NEXT: parsed using the isorecursive hybrid type ;; CHECK-NEXT: system. diff --git a/test/lit/help/wasm-emscripten-finalize.test b/test/lit/help/wasm-emscripten-finalize.test index 45d3a3eae..1600bb823 100644 --- a/test/lit/help/wasm-emscripten-finalize.test +++ b/test/lit/help/wasm-emscripten-finalize.test @@ -162,10 +162,6 @@ ;; CHECK-NEXT: --nominal Force all GC type definitions to be ;; CHECK-NEXT: parsed as nominal. ;; CHECK-NEXT: -;; CHECK-NEXT: --structural Force all GC type definitions to be -;; CHECK-NEXT: parsed as structural (i.e. -;; CHECK-NEXT: equirecursive). This is the default. -;; CHECK-NEXT: ;; CHECK-NEXT: --hybrid Force all GC type definitions to be ;; CHECK-NEXT: parsed using the isorecursive hybrid type ;; CHECK-NEXT: system. diff --git a/test/lit/help/wasm-fuzz-types.test b/test/lit/help/wasm-fuzz-types.test index a282aa4a6..49e491358 100644 --- a/test/lit/help/wasm-fuzz-types.test +++ b/test/lit/help/wasm-fuzz-types.test @@ -9,23 +9,21 @@ ;; CHECK-NEXT: wasm-fuzz-types options: ;; CHECK-NEXT: ------------------------ ;; CHECK-NEXT: -;; CHECK-NEXT: --seed Run a single workload generated by the given seed +;; CHECK-NEXT: --seed Run a single workload generated by the given seed ;; CHECK-NEXT: -;; CHECK-NEXT: --verbose,-v Print extra information +;; CHECK-NEXT: --verbose,-v Print extra information ;; CHECK-NEXT: -;; CHECK-NEXT: --nominal Use the nominal type system (default) +;; CHECK-NEXT: --nominal Use the nominal type system ;; CHECK-NEXT: -;; CHECK-NEXT: --structural Use the equirecursive type system -;; CHECK-NEXT: -;; CHECK-NEXT: --hybrid Use the isorecursive hybrid type system +;; CHECK-NEXT: --hybrid Use the isorecursive hybrid type system (default) ;; CHECK-NEXT: ;; CHECK-NEXT: ;; CHECK-NEXT: General options: ;; CHECK-NEXT: ---------------- ;; CHECK-NEXT: -;; CHECK-NEXT: --version Output version information and exit +;; CHECK-NEXT: --version Output version information and exit ;; CHECK-NEXT: -;; CHECK-NEXT: --help,-h Show this help message and exit +;; CHECK-NEXT: --help,-h Show this help message and exit ;; CHECK-NEXT: -;; CHECK-NEXT: --debug,-d Print debug information to stderr +;; CHECK-NEXT: --debug,-d Print debug information to stderr ;; CHECK-NEXT: diff --git a/test/lit/help/wasm-metadce.test b/test/lit/help/wasm-metadce.test index 10e67873a..a748d8198 100644 --- a/test/lit/help/wasm-metadce.test +++ b/test/lit/help/wasm-metadce.test @@ -163,10 +163,6 @@ ;; CHECK-NEXT: --nominal Force all GC type definitions to be ;; CHECK-NEXT: parsed as nominal. ;; CHECK-NEXT: -;; CHECK-NEXT: --structural Force all GC type definitions to be -;; CHECK-NEXT: parsed as structural (i.e. -;; CHECK-NEXT: equirecursive). This is the default. -;; CHECK-NEXT: ;; CHECK-NEXT: --hybrid Force all GC type definitions to be ;; CHECK-NEXT: parsed using the isorecursive hybrid type ;; CHECK-NEXT: system. diff --git a/test/lit/help/wasm-opt.test b/test/lit/help/wasm-opt.test index bc3d710ac..bdc4b9cd8 100644 --- a/test/lit/help/wasm-opt.test +++ b/test/lit/help/wasm-opt.test @@ -661,11 +661,6 @@ ;; CHECK-NEXT: --nominal Force all GC type definitions to ;; CHECK-NEXT: be parsed as nominal. ;; CHECK-NEXT: -;; CHECK-NEXT: --structural Force all GC type definitions to -;; CHECK-NEXT: be parsed as structural (i.e. -;; CHECK-NEXT: equirecursive). This is the -;; CHECK-NEXT: default. -;; CHECK-NEXT: ;; CHECK-NEXT: --hybrid Force all GC type definitions to ;; CHECK-NEXT: be parsed using the isorecursive ;; CHECK-NEXT: hybrid type system. diff --git a/test/lit/help/wasm-reduce.test b/test/lit/help/wasm-reduce.test index 9b394a7f7..c640cf5f7 100644 --- a/test/lit/help/wasm-reduce.test +++ b/test/lit/help/wasm-reduce.test @@ -151,10 +151,6 @@ ;; CHECK-NEXT: --nominal Force all GC type definitions to be ;; CHECK-NEXT: parsed as nominal. ;; CHECK-NEXT: -;; CHECK-NEXT: --structural Force all GC type definitions to be -;; CHECK-NEXT: parsed as structural (i.e. -;; CHECK-NEXT: equirecursive). This is the default. -;; CHECK-NEXT: ;; CHECK-NEXT: --hybrid Force all GC type definitions to be ;; CHECK-NEXT: parsed using the isorecursive hybrid type ;; CHECK-NEXT: system. diff --git a/test/lit/help/wasm-split.test b/test/lit/help/wasm-split.test index 8da75cca2..176ba1858 100644 --- a/test/lit/help/wasm-split.test +++ b/test/lit/help/wasm-split.test @@ -231,10 +231,6 @@ ;; CHECK-NEXT: --nominal Force all GC type definitions to be ;; CHECK-NEXT: parsed as nominal. ;; CHECK-NEXT: -;; CHECK-NEXT: --structural Force all GC type definitions to be -;; CHECK-NEXT: parsed as structural (i.e. -;; CHECK-NEXT: equirecursive). This is the default. -;; CHECK-NEXT: ;; CHECK-NEXT: --hybrid Force all GC type definitions to be ;; CHECK-NEXT: parsed using the isorecursive hybrid type ;; CHECK-NEXT: system. diff --git a/test/lit/help/wasm2js.test b/test/lit/help/wasm2js.test index ce2748343..16c6c45fc 100644 --- a/test/lit/help/wasm2js.test +++ b/test/lit/help/wasm2js.test @@ -620,11 +620,6 @@ ;; CHECK-NEXT: --nominal Force all GC type definitions to ;; CHECK-NEXT: be parsed as nominal. ;; CHECK-NEXT: -;; CHECK-NEXT: --structural Force all GC type definitions to -;; CHECK-NEXT: be parsed as structural (i.e. -;; CHECK-NEXT: equirecursive). This is the -;; CHECK-NEXT: default. -;; CHECK-NEXT: ;; CHECK-NEXT: --hybrid Force all GC type definitions to ;; CHECK-NEXT: be parsed using the isorecursive ;; CHECK-NEXT: hybrid type system. diff --git a/test/lit/lub-bug-3843.wast b/test/lit/lub-bug-3843.wast deleted file mode 100644 index 8bf384c71..000000000 --- a/test/lit/lub-bug-3843.wast +++ /dev/null @@ -1,53 +0,0 @@ -;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. -;; RUN: wasm-opt %s -all --precompute --structural -S -o - | filecheck %s -;; RUN: wasm-opt %s -all --precompute --nominal -S -o - | filecheck %s --check-prefix NOMNL - -;; Regression test for a bug (#3843) in which the LUB calculation done during -;; the refinalization of the select incorrectly produced a new type rather than -;; returning (ref null $A). - -(module - ;; CHECK: (type $A (struct (field (ref null $C)))) - ;; NOMNL: (type $A (struct (field (ref null $C)))) - (type $A (struct (field (ref null $C)))) - - ;; CHECK: (type $B (struct (field (ref null $D)))) - ;; NOMNL: (type $B (struct_subtype (field (ref null $D)) $A)) - (type $B (struct_subtype (field (ref null $D)) $A)) - - ;; CHECK: (type $C (struct (field (mut (ref $A))))) - - ;; CHECK: (type $D (struct (field (mut (ref $A))) (field (mut (ref $A))))) - ;; NOMNL: (type $C (struct (field (mut (ref $A))))) - - ;; NOMNL: (type $D (struct_subtype (field (mut (ref $A))) (field (mut (ref $A))) $C)) - (type $D (struct_subtype (field (mut (ref $A))) (field (mut (ref $A))) $C)) - - (type $C (struct (field (mut (ref $A))))) - - - ;; CHECK: (func $foo (param $a (ref null $A)) (param $b (ref null $B)) (result (ref null $A)) - ;; CHECK-NEXT: (select (result (ref null $A)) - ;; CHECK-NEXT: (local.get $a) - ;; CHECK-NEXT: (local.get $b) - ;; CHECK-NEXT: (i32.const 0) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; NOMNL: (func $foo (type $ref?|$A|_ref?|$B|_=>_ref?|$A|) (param $a (ref null $A)) (param $b (ref null $B)) (result (ref null $A)) - ;; NOMNL-NEXT: (select (result (ref null $A)) - ;; NOMNL-NEXT: (local.get $a) - ;; NOMNL-NEXT: (local.get $b) - ;; NOMNL-NEXT: (i32.const 0) - ;; NOMNL-NEXT: ) - ;; NOMNL-NEXT: ) - (func $foo (param $a (ref null $A)) (param $b (ref null $B)) (result (ref null $A)) - ;; the select should have type $A - (select (result (ref null $A)) - ;; one arm has type $A - (local.get $a) - ;; one arm has type $B (a subtype of $A) - (local.get $b) - (i32.const 0) - ) - ) -) diff --git a/test/lit/nominal-good.wast b/test/lit/nominal-good.wast index ec64b466c..76863d637 100644 --- a/test/lit/nominal-good.wast +++ b/test/lit/nominal-good.wast @@ -1,69 +1,51 @@ ;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. -;; RUN: wasm-opt %s -all --nominal -S -o - | filecheck %s --check-prefix NOMINAL -;; RUN: wasm-opt %s -all --nominal --roundtrip -S -o - | filecheck %s --check-prefix NOMINAL -;; RUN: wasm-opt %s -all --hybrid -S -o - | filecheck %s --check-prefix NOMINAL -;; RUN: wasm-opt %s -all --hybrid --roundtrip -S -o - | filecheck %s --check-prefix NOMINAL -;; RUN: wasm-opt %s -all --structural -S -o - | filecheck %s --check-prefix EQUIREC -;; RUN: wasm-opt %s -all --structural --roundtrip -S -o - | filecheck %s --check-prefix EQUIREC +;; RUN: wasm-opt %s -all --nominal -S -o - | filecheck %s --check-prefix CHECK +;; RUN: wasm-opt %s -all --nominal --roundtrip -S -o - | filecheck %s +;; RUN: wasm-opt %s -all --hybrid -S -o - | filecheck %s --check-prefix CHECK +;; RUN: wasm-opt %s -all --hybrid --roundtrip -S -o - | filecheck %s -;; Note that --hybrid and --nominal have the same output, so they share the NOMINAL prefix. +;; Note that --hybrid and --nominal have the same output, so they share the CHECK prefix. (module - ;; NOMINAL: (type $super-struct (struct (field i32))) - ;; EQUIREC: (type $super-struct (struct (field i32))) + ;; CHECK: (type $super-struct (struct (field i32))) (type $super-struct (struct i32)) - ;; NOMINAL: (type $sub-struct (struct_subtype (field i32) (field i64) $super-struct)) - ;; EQUIREC: (type $sub-struct (struct (field i32) (field i64))) + ;; CHECK: (type $sub-struct (struct_subtype (field i32) (field i64) $super-struct)) (type $sub-struct (struct_subtype i32 i64 $super-struct)) - ;; NOMINAL: (type $super-array (array (ref $super-struct))) - ;; EQUIREC: (type $super-array (array (ref $super-struct))) + ;; CHECK: (type $super-array (array (ref $super-struct))) (type $super-array (array (ref $super-struct))) - ;; NOMINAL: (type $sub-array (array_subtype (ref $sub-struct) $super-array)) - ;; EQUIREC: (type $sub-array (array (ref $sub-struct))) + ;; CHECK: (type $sub-array (array_subtype (ref $sub-struct) $super-array)) (type $sub-array (array_subtype (ref $sub-struct) $super-array)) ;; TODO: signature types as well, once functions store their HeapTypes. - ;; NOMINAL: (func $make-super-struct (type $none_=>_ref|$super-struct|) (result (ref $super-struct)) - ;; NOMINAL-NEXT: (call $make-sub-struct) - ;; NOMINAL-NEXT: ) - ;; EQUIREC: (func $make-super-struct (result (ref $super-struct)) - ;; EQUIREC-NEXT: (call $make-sub-struct) - ;; EQUIREC-NEXT: ) + ;; CHECK: (func $make-super-struct (type $none_=>_ref|$super-struct|) (result (ref $super-struct)) + ;; CHECK-NEXT: (call $make-sub-struct) + ;; CHECK-NEXT: ) (func $make-super-struct (result (ref $super-struct)) (call $make-sub-struct) ) - ;; NOMINAL: (func $make-sub-struct (type $none_=>_ref|$sub-struct|) (result (ref $sub-struct)) - ;; NOMINAL-NEXT: (unreachable) - ;; NOMINAL-NEXT: ) - ;; EQUIREC: (func $make-sub-struct (result (ref $sub-struct)) - ;; EQUIREC-NEXT: (unreachable) - ;; EQUIREC-NEXT: ) + ;; CHECK: (func $make-sub-struct (type $none_=>_ref|$sub-struct|) (result (ref $sub-struct)) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) (func $make-sub-struct (result (ref $sub-struct)) (unreachable) ) - ;; NOMINAL: (func $make-super-array (type $none_=>_ref|$super-array|) (result (ref $super-array)) - ;; NOMINAL-NEXT: (call $make-sub-array) - ;; NOMINAL-NEXT: ) - ;; EQUIREC: (func $make-super-array (result (ref $super-array)) - ;; EQUIREC-NEXT: (call $make-sub-array) - ;; EQUIREC-NEXT: ) + ;; CHECK: (func $make-super-array (type $none_=>_ref|$super-array|) (result (ref $super-array)) + ;; CHECK-NEXT: (call $make-sub-array) + ;; CHECK-NEXT: ) (func $make-super-array (result (ref $super-array)) (call $make-sub-array) ) - ;; NOMINAL: (func $make-sub-array (type $none_=>_ref|$sub-array|) (result (ref $sub-array)) - ;; NOMINAL-NEXT: (unreachable) - ;; NOMINAL-NEXT: ) - ;; EQUIREC: (func $make-sub-array (result (ref $sub-array)) - ;; EQUIREC-NEXT: (unreachable) - ;; EQUIREC-NEXT: ) + ;; CHECK: (func $make-sub-array (type $none_=>_ref|$sub-array|) (result (ref $sub-array)) + ;; CHECK-NEXT: (unreachable) + ;; CHECK-NEXT: ) (func $make-sub-array (result (ref $sub-array)) (unreachable) ) diff --git a/test/lit/recursive-type-sort.wast b/test/lit/recursive-type-sort.wast deleted file mode 100644 index 3b241fd96..000000000 --- a/test/lit/recursive-type-sort.wast +++ /dev/null @@ -1,30 +0,0 @@ -;; Test that multiple recursive types are sorted and emitted properly. -;; Regression test for a bug in TypeComparator that made it fail to properly -;; implement the C++ Compare requirements. See #3648. - -;; RUN: wasm-opt %s -all --roundtrip --structural -S -o - | filecheck %s -;; RUN: wasm-opt %s -all --roundtrip --nominal -S -o - | filecheck %s - -;; Check that there's no crash. -;; CHECK: module - -(module - (type $a (func (param (ref null $b)))) - (type $b (struct (field (ref null $i)))) - (type $c (struct (field (ref null $l)))) - (type $d (func (param (ref null $b)))) - (type $e (func (result (ref null $g)))) - (type $f (func (result (ref null $c)))) - (type $g (struct (field (ref null $j)))) - (type $h (struct (field (ref null $k)))) - (type $i (struct (field (mut (ref null $a))))) - (type $j (struct (field (mut (ref null $a))) (field (mut (ref null $a))))) - (type $k (struct (field (mut (ref null $a))) (field (mut (ref null $a))) (field (mut (ref null $e))))) - (type $l (struct (field (mut (ref null $a))) (field (mut (ref null $d))) (field (mut (ref null $f))))) - - (func $foo - (local $1 (ref null $h)) - (local $2 (ref null $b)) - (local $3 (ref null $c)) - ) -) |