diff options
Diffstat (limited to 'test')
37 files changed, 213 insertions, 312 deletions
diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js index 0de23883a..1a4b2452d 100644 --- a/test/binaryen.js/kitchen-sink.js +++ b/test/binaryen.js/kitchen-sink.js @@ -658,7 +658,7 @@ function test_core() { module.anyref.pop(), module.eqref.pop(), module.i31ref.pop(), - module.dataref.pop(), + module.structref.pop(), module.stringref.pop(), module.stringview_wtf8.pop(), module.stringview_wtf16.pop(), diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index 4798c8592..0605ef4cc 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -2179,7 +2179,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (pop i31ref) ) (drop - (pop dataref) + (pop structref) ) (drop (pop stringref) @@ -4283,7 +4283,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (pop i31ref) ) (drop - (pop dataref) + (pop structref) ) (drop (pop stringref) diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 45af52e21..b2b35da16 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -263,12 +263,12 @@ void test_types() { BinaryenTypeExpand(i31ref, &valueType); assert(valueType == i31ref); - BinaryenType dataref = BinaryenTypeDataref(); - printf("BinaryenTypeDataref: (ptr)\n"); - assert(dataref == BinaryenTypeDataref()); - assert(BinaryenTypeArity(dataref) == 1); - BinaryenTypeExpand(dataref, &valueType); - assert(valueType == dataref); + BinaryenType structref = BinaryenTypeStructref(); + printf("BinaryenTypeStructref: (ptr)\n"); + assert(structref == BinaryenTypeStructref()); + assert(BinaryenTypeArity(structref) == 1); + BinaryenTypeExpand(structref, &valueType); + assert(valueType == structref); BinaryenType arrayref = BinaryenTypeArrayref(); printf("BinaryenTypeArrayref: (ptr)\n"); @@ -348,7 +348,7 @@ void test_types() { printf("BinaryenHeapTypeAny: %zd\n", BinaryenHeapTypeAny()); printf("BinaryenHeapTypeEq: %zd\n", BinaryenHeapTypeEq()); printf("BinaryenHeapTypeI31: %zd\n", BinaryenHeapTypeI31()); - printf("BinaryenHeapTypeData: %zd\n", BinaryenHeapTypeData()); + printf("BinaryenHeapTypeStruct: %zd\n", BinaryenHeapTypeStruct()); printf("BinaryenHeapTypeArray: %zd\n", BinaryenHeapTypeArray()); printf("BinaryenHeapTypeString: %zd\n", BinaryenHeapTypeString()); printf("BinaryenHeapTypeStringviewWTF8: %zd\n", @@ -2201,7 +2201,7 @@ void test_typebuilder() { assert(BinaryenHeapTypeIsStruct(structHeapType)); assert(!BinaryenHeapTypeIsArray(structHeapType)); assert(!BinaryenHeapTypeIsBottom(structHeapType)); - assert(BinaryenHeapTypeIsSubType(structHeapType, BinaryenHeapTypeData())); + assert(BinaryenHeapTypeIsSubType(structHeapType, BinaryenHeapTypeStruct())); BinaryenType structType = BinaryenTypeFromHeapType(structHeapType, true); assert(BinaryenStructTypeGetNumFields(structHeapType) == 1); assert(BinaryenStructTypeGetFieldType(structHeapType, 0) == structType); @@ -2245,7 +2245,8 @@ void test_typebuilder() { assert(BinaryenHeapTypeIsStruct(subStructHeapType)); assert(!BinaryenHeapTypeIsArray(subStructHeapType)); assert(!BinaryenHeapTypeIsBottom(subStructHeapType)); - assert(BinaryenHeapTypeIsSubType(subStructHeapType, BinaryenHeapTypeData())); + assert( + BinaryenHeapTypeIsSubType(subStructHeapType, BinaryenHeapTypeStruct())); assert(BinaryenHeapTypeIsSubType(subStructHeapType, structHeapType)); BinaryenType subStructType = BinaryenTypeFromHeapType(subStructHeapType, true); diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 6e4af6cf0..510060317 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -10,7 +10,7 @@ BinaryenTypeExternref: (ptr) BinaryenTypeAnyref: (ptr) BinaryenTypeEqref: (ptr) BinaryenTypeI31ref: (ptr) -BinaryenTypeDataref: (ptr) +BinaryenTypeStructref: (ptr) BinaryenTypeArrayref: (ptr) BinaryenTypeStringref: (ptr) BinaryenTypeStringviewWTF8: (ptr) @@ -28,7 +28,7 @@ BinaryenHeapTypeFunc: 1 BinaryenHeapTypeAny: 2 BinaryenHeapTypeEq: 3 BinaryenHeapTypeI31: 4 -BinaryenHeapTypeData: 5 +BinaryenHeapTypeStruct: 5 BinaryenHeapTypeArray: 6 BinaryenHeapTypeString: 7 BinaryenHeapTypeStringviewWTF8: 8 diff --git a/test/example/type-builder-nominal.cpp b/test/example/type-builder-nominal.cpp index 66dccead3..a3e8695ac 100644 --- a/test/example/type-builder-nominal.cpp +++ b/test/example/type-builder-nominal.cpp @@ -329,52 +329,6 @@ void test_subtypes() { }; { - // Basic Types - for (auto other : {HeapType::eq, - HeapType::any, - HeapType::eq, - HeapType::i31, - HeapType::data}) { - assert(LUB(HeapType::any, other) == HeapType::any); - } - assert(LUB(HeapType::i31, HeapType::data) == HeapType::eq); - } - - { - // Identity - std::vector<HeapType> built; - { - TypeBuilder builder(3); - builder[0] = Signature(Type::none, Type::none); - builder[1] = Struct{}; - builder[2] = Array(Field(Type::i32, Mutable)); - built = *builder.build(); - } - assert(LUB(built[0], built[0]) == built[0]); - assert(LUB(built[1], built[1]) == built[1]); - assert(LUB(built[2], built[2]) == built[2]); - } - - { - // No subtype declarations mean no subtypes - std::vector<HeapType> built; - { - TypeBuilder builder(5); - Type structRef0 = builder.getTempRefType(builder[0], Nullable); - Type structRef1 = builder.getTempRefType(builder[1], Nullable); - builder[0] = Struct{}; - builder[1] = Struct{}; - builder[2] = Signature(Type::none, anyref); - builder[3] = Signature(Type::none, structRef0); - builder[4] = Signature(Type::none, structRef1); - built = *builder.build(); - } - assert(LUB(built[0], built[1]) == HeapType::data); - assert(LUB(built[2], built[3]) == HeapType::func); - assert(LUB(built[2], built[4]) == HeapType::func); - } - - { // Subtype declarations, but still no subtypes std::vector<HeapType> built; { @@ -385,7 +339,7 @@ void test_subtypes() { builder[2] = Struct{}; built = *builder.build(); } - assert(LUB(built[0], built[2]) == HeapType::data); + assert(LUB(built[0], built[2]) == HeapType::struct_); } { diff --git a/test/gc.wast.from-wast b/test/gc.wast.from-wast index 1cf0bca7c..40b870dca 100644 --- a/test/gc.wast.from-wast +++ b/test/gc.wast.from-wast @@ -1,6 +1,6 @@ (module - (type $i31ref_dataref_=>_none (func (param i31ref dataref))) - (type $i31ref_ref|i31|_dataref_ref|data|_=>_none (func (param i31ref (ref i31) dataref (ref data)))) + (type $i31ref_structref_=>_none (func (param i31ref structref))) + (type $i31ref_ref|i31|_structref_ref|struct|_=>_none (func (param i31ref (ref i31) structref (ref struct)))) (global $global_anyref (mut anyref) (ref.null none)) (global $global_eqref (mut eqref) (ref.null none)) (global $global_i31ref (mut i31ref) (i31.new @@ -13,7 +13,7 @@ (global $global_eqref2 (mut eqref) (i31.new (i32.const 0) )) - (func $test (type $i31ref_dataref_=>_none) (param $local_i31ref i31ref) (param $local_structref dataref) + (func $test (type $i31ref_structref_=>_none) (param $local_i31ref i31ref) (param $local_structref structref) (local $local_i32 i32) (local $local_anyref anyref) (local $local_eqref eqref) @@ -148,7 +148,7 @@ ) ) ) - (func $test-variants (type $i31ref_ref|i31|_dataref_ref|data|_=>_none) (param $local_i31refnull i31ref) (param $local_i31refnonnull (ref i31)) (param $local_structrefnull dataref) (param $local_structrefnonnull (ref data)) + (func $test-variants (type $i31ref_ref|i31|_structref_ref|struct|_=>_none) (param $local_i31refnull i31ref) (param $local_i31refnonnull (ref i31)) (param $local_structrefnull structref) (param $local_structrefnonnull (ref struct)) (nop) ) ) diff --git a/test/gc.wast.fromBinary b/test/gc.wast.fromBinary index ca56f5538..d37e4b741 100644 --- a/test/gc.wast.fromBinary +++ b/test/gc.wast.fromBinary @@ -1,6 +1,6 @@ (module - (type $i31ref_dataref_=>_none (func (param i31ref dataref))) - (type $i31ref_ref|i31|_dataref_ref|data|_=>_none (func (param i31ref (ref i31) dataref (ref data)))) + (type $i31ref_structref_=>_none (func (param i31ref structref))) + (type $i31ref_ref|i31|_structref_ref|struct|_=>_none (func (param i31ref (ref i31) structref (ref struct)))) (global $global_anyref (mut anyref) (ref.null none)) (global $global_eqref (mut eqref) (ref.null none)) (global $global_i31ref (mut i31ref) (i31.new @@ -13,7 +13,7 @@ (global $global_eqref2 (mut eqref) (i31.new (i32.const 0) )) - (func $test (type $i31ref_dataref_=>_none) (param $local_i31ref i31ref) (param $local_structref dataref) + (func $test (type $i31ref_structref_=>_none) (param $local_i31ref i31ref) (param $local_structref structref) (local $local_i32 i32) (local $local_anyref anyref) (local $local_eqref eqref) @@ -148,7 +148,7 @@ ) ) ) - (func $test-variants (type $i31ref_ref|i31|_dataref_ref|data|_=>_none) (param $local_i31refnull i31ref) (param $local_i31refnonnull (ref i31)) (param $local_structrefnull dataref) (param $local_structrefnonnull (ref data)) + (func $test-variants (type $i31ref_ref|i31|_structref_ref|struct|_=>_none) (param $local_i31refnull i31ref) (param $local_i31refnonnull (ref i31)) (param $local_structrefnull structref) (param $local_structrefnonnull (ref struct)) (nop) ) ) diff --git a/test/gc.wast.fromBinary.noDebugInfo b/test/gc.wast.fromBinary.noDebugInfo index e51c6c4c1..b9cc6b04a 100644 --- a/test/gc.wast.fromBinary.noDebugInfo +++ b/test/gc.wast.fromBinary.noDebugInfo @@ -1,6 +1,6 @@ (module - (type $i31ref_dataref_=>_none (func (param i31ref dataref))) - (type $i31ref_ref|i31|_dataref_ref|data|_=>_none (func (param i31ref (ref i31) dataref (ref data)))) + (type $i31ref_structref_=>_none (func (param i31ref structref))) + (type $i31ref_ref|i31|_structref_ref|struct|_=>_none (func (param i31ref (ref i31) structref (ref struct)))) (global $global$0 (mut anyref) (ref.null none)) (global $global$1 (mut eqref) (ref.null none)) (global $global$2 (mut i31ref) (i31.new @@ -13,7 +13,7 @@ (global $global$5 (mut eqref) (i31.new (i32.const 0) )) - (func $0 (type $i31ref_dataref_=>_none) (param $0 i31ref) (param $1 dataref) + (func $0 (type $i31ref_structref_=>_none) (param $0 i31ref) (param $1 structref) (local $2 i32) (local $3 anyref) (local $4 eqref) @@ -148,7 +148,7 @@ ) ) ) - (func $1 (type $i31ref_ref|i31|_dataref_ref|data|_=>_none) (param $0 i31ref) (param $1 (ref i31)) (param $2 dataref) (param $3 (ref data)) + (func $1 (type $i31ref_ref|i31|_structref_ref|struct|_=>_none) (param $0 i31ref) (param $1 (ref i31)) (param $2 structref) (param $3 (ref struct)) (nop) ) ) diff --git a/test/gtest/possible-contents.cpp b/test/gtest/possible-contents.cpp index ea2a0c0f0..c6b7d000c 100644 --- a/test/gtest/possible-contents.cpp +++ b/test/gtest/possible-contents.cpp @@ -74,7 +74,7 @@ protected: Type anyref = Type(HeapType::any, Nullable); Type funcref = Type(HeapType::func, Nullable); Type i31ref = Type(HeapType::i31, Nullable); - Type dataref = Type(HeapType::data, Nullable); + Type structref = Type(HeapType::struct_, Nullable); PossibleContents none = PossibleContents::none(); @@ -104,7 +104,7 @@ protected: PossibleContents exactI32 = PossibleContents::exactType(Type::i32); PossibleContents exactAnyref = PossibleContents::exactType(anyref); PossibleContents exactFuncref = PossibleContents::exactType(funcref); - PossibleContents exactDataref = PossibleContents::exactType(dataref); + PossibleContents exactStructref = PossibleContents::exactType(structref); PossibleContents exactI31ref = PossibleContents::exactType(i31ref); PossibleContents exactNonNullAnyref = PossibleContents::exactType(Type(HeapType::any, NonNullable)); @@ -494,7 +494,7 @@ TEST_F(PossibleContentsTest, TestIntersectWithCombinations) { exactI32, exactAnyref, exactFuncref, - exactDataref, + exactStructref, exactI31ref, exactNonNullAnyref, exactNonNullFuncref, @@ -591,36 +591,36 @@ TEST_F(PossibleContentsTest, TestStructCones) { assertCombination(exactA, exactB, PossibleContents::coneType(nullA, 1)); assertCombination(exactA, exactC, PossibleContents::coneType(nullA, 1)); assertCombination(exactA, exactD, PossibleContents::coneType(nullA, 2)); - assertCombination(exactA, exactE, PossibleContents::coneType(dataref, 1)); + assertCombination(exactA, exactE, PossibleContents::coneType(structref, 1)); assertCombination( - exactA, exactDataref, PossibleContents::coneType(dataref, 1)); + exactA, exactStructref, PossibleContents::coneType(structref, 1)); assertCombination(exactB, exactB, exactB); assertCombination(exactB, exactC, PossibleContents::coneType(nullA, 1)); assertCombination(exactB, exactD, PossibleContents::coneType(nullA, 2)); - assertCombination(exactB, exactE, PossibleContents::coneType(dataref, 2)); + assertCombination(exactB, exactE, PossibleContents::coneType(structref, 2)); assertCombination( - exactB, exactDataref, PossibleContents::coneType(dataref, 2)); + exactB, exactStructref, PossibleContents::coneType(structref, 2)); assertCombination(exactC, exactC, exactC); assertCombination(exactC, exactD, PossibleContents::coneType(nullC, 1)); - assertCombination(exactC, exactE, PossibleContents::coneType(dataref, 2)); + assertCombination(exactC, exactE, PossibleContents::coneType(structref, 2)); assertCombination( - exactC, exactDataref, PossibleContents::coneType(dataref, 2)); + exactC, exactStructref, PossibleContents::coneType(structref, 2)); assertCombination(exactD, exactD, exactD); - assertCombination(exactD, exactE, PossibleContents::coneType(dataref, 3)); + assertCombination(exactD, exactE, PossibleContents::coneType(structref, 3)); assertCombination( - exactD, exactDataref, PossibleContents::coneType(dataref, 3)); + exactD, exactStructref, PossibleContents::coneType(structref, 3)); assertCombination(exactE, exactE, exactE); assertCombination( - exactE, exactDataref, PossibleContents::coneType(dataref, 1)); + exactE, exactStructref, PossibleContents::coneType(structref, 1)); - assertCombination(exactDataref, exactDataref, exactDataref); + assertCombination(exactStructref, exactStructref, exactStructref); assertCombination( - exactDataref, exactAnyref, PossibleContents::coneType(anyref, 2)); + exactStructref, exactAnyref, PossibleContents::coneType(anyref, 2)); // Combinations of cones. assertCombination(PossibleContents::coneType(nullA, 5), @@ -640,11 +640,11 @@ TEST_F(PossibleContentsTest, TestStructCones) { assertCombination(PossibleContents::coneType(nullA, 5), PossibleContents::coneType(nullE, 7), - PossibleContents::coneType(dataref, 8)); + PossibleContents::coneType(structref, 8)); assertCombination(PossibleContents::coneType(nullB, 4), - PossibleContents::coneType(dataref, 1), - PossibleContents::coneType(dataref, 6)); + PossibleContents::coneType(structref, 1), + PossibleContents::coneType(structref, 6)); // Combinations of cones and exact types. assertCombination(exactA, @@ -658,18 +658,18 @@ TEST_F(PossibleContentsTest, TestStructCones) { PossibleContents::coneType(nullA, 3)); assertCombination(exactA, PossibleContents::coneType(nullE, 2), - PossibleContents::coneType(dataref, 3)); + PossibleContents::coneType(structref, 3)); assertCombination(exactA, - PossibleContents::coneType(dataref, 1), - PossibleContents::coneType(dataref, 1)); + PossibleContents::coneType(structref, 1), + PossibleContents::coneType(structref, 1)); assertCombination(exactA, - PossibleContents::coneType(dataref, 2), - PossibleContents::coneType(dataref, 2)); + PossibleContents::coneType(structref, 2), + PossibleContents::coneType(structref, 2)); - assertCombination(exactDataref, + assertCombination(exactStructref, PossibleContents::coneType(nullB, 3), - PossibleContents::coneType(dataref, 5)); + PossibleContents::coneType(structref, 5)); // Full cones. assertCombination(PossibleContents::fullConeType(nullA), @@ -694,7 +694,7 @@ TEST_F(PossibleContentsTest, TestStructCones) { PossibleContents::fullConeType(nullA)); assertCombination(PossibleContents::fullConeType(nullA), PossibleContents::fullConeType(nullE), - PossibleContents::fullConeType(dataref)); + PossibleContents::fullConeType(structref)); // Intersections. Test with non-nullable types to avoid the null being a // possible intersection. @@ -902,7 +902,7 @@ TEST_F(PossibleContentsTest, TestOracleManyTypes) { auto bodyContents = oracle.getContents(ResultLocation{wasm->getFunction("foo"), 0}); ASSERT_TRUE(bodyContents.isConeType()); - EXPECT_EQ(bodyContents.getType().getHeapType(), HeapType::data); + EXPECT_EQ(bodyContents.getType().getHeapType(), HeapType::struct_); EXPECT_EQ(bodyContents.getCone().depth, Index(1)); } diff --git a/test/gtest/type-builder.cpp b/test/gtest/type-builder.cpp index 0dba0a10c..d26b8bb97 100644 --- a/test/gtest/type-builder.cpp +++ b/test/gtest/type-builder.cpp @@ -500,7 +500,7 @@ TEST_F(IsorecursiveTest, TestHeapTypeRelations) { HeapType any = HeapType::any; HeapType eq = HeapType::eq; HeapType i31 = HeapType::i31; - HeapType data = HeapType::data; + HeapType struct_ = HeapType::struct_; HeapType array = HeapType::array; HeapType string = HeapType::string; HeapType stringview_wtf8 = HeapType::stringview_wtf8; @@ -546,7 +546,7 @@ TEST_F(IsorecursiveTest, TestHeapTypeRelations) { assertLUB(ext, any, {}); assertLUB(ext, eq, {}); assertLUB(ext, i31, {}); - assertLUB(ext, data, {}); + assertLUB(ext, struct_, {}); assertLUB(ext, array, {}); assertLUB(ext, string, {}); assertLUB(ext, stringview_wtf8, {}); @@ -563,7 +563,7 @@ TEST_F(IsorecursiveTest, TestHeapTypeRelations) { assertLUB(func, any, {}); assertLUB(func, eq, {}); assertLUB(func, i31, {}); - assertLUB(func, data, {}); + assertLUB(func, struct_, {}); assertLUB(func, array, {}); assertLUB(func, string, {}); assertLUB(func, stringview_wtf8, {}); @@ -579,7 +579,7 @@ TEST_F(IsorecursiveTest, TestHeapTypeRelations) { assertLUB(any, any, any); assertLUB(any, eq, any); assertLUB(any, i31, any); - assertLUB(any, data, any); + assertLUB(any, struct_, any); assertLUB(any, array, any); assertLUB(any, string, any); assertLUB(any, stringview_wtf8, any); @@ -594,7 +594,7 @@ TEST_F(IsorecursiveTest, TestHeapTypeRelations) { assertLUB(eq, eq, eq); assertLUB(eq, i31, eq); - assertLUB(eq, data, eq); + assertLUB(eq, struct_, eq); assertLUB(eq, array, eq); assertLUB(eq, string, any); assertLUB(eq, stringview_wtf8, any); @@ -608,7 +608,7 @@ TEST_F(IsorecursiveTest, TestHeapTypeRelations) { assertLUB(eq, defArray, eq); assertLUB(i31, i31, i31); - assertLUB(i31, data, eq); + assertLUB(i31, struct_, eq); assertLUB(i31, array, eq); assertLUB(i31, string, any); assertLUB(i31, stringview_wtf8, any); @@ -621,18 +621,18 @@ TEST_F(IsorecursiveTest, TestHeapTypeRelations) { assertLUB(i31, defStruct, eq); assertLUB(i31, defArray, eq); - assertLUB(data, data, data); - assertLUB(data, array, data); - assertLUB(data, string, any); - assertLUB(data, stringview_wtf8, any); - assertLUB(data, stringview_wtf16, any); - assertLUB(data, stringview_iter, any); - assertLUB(data, none, data); - assertLUB(data, noext, {}); - assertLUB(data, nofunc, {}); - assertLUB(data, defFunc, {}); - assertLUB(data, defStruct, data); - assertLUB(data, defArray, data); + assertLUB(struct_, struct_, struct_); + assertLUB(struct_, array, eq); + assertLUB(struct_, string, any); + assertLUB(struct_, stringview_wtf8, any); + assertLUB(struct_, stringview_wtf16, any); + assertLUB(struct_, stringview_iter, any); + assertLUB(struct_, none, struct_); + assertLUB(struct_, noext, {}); + assertLUB(struct_, nofunc, {}); + assertLUB(struct_, defFunc, {}); + assertLUB(struct_, defStruct, struct_); + assertLUB(struct_, defArray, eq); assertLUB(array, array, array); assertLUB(array, string, any); @@ -643,7 +643,7 @@ TEST_F(IsorecursiveTest, TestHeapTypeRelations) { assertLUB(array, noext, {}); assertLUB(array, nofunc, {}); assertLUB(array, defFunc, {}); - assertLUB(array, defStruct, data); + assertLUB(array, defStruct, eq); assertLUB(array, defArray, array); assertLUB(string, string, string); @@ -707,7 +707,7 @@ TEST_F(IsorecursiveTest, TestHeapTypeRelations) { assertLUB(defFunc, defArray, {}); assertLUB(defStruct, defStruct, defStruct); - assertLUB(defStruct, defArray, data); + assertLUB(defStruct, defArray, eq); assertLUB(defArray, defArray, defArray); @@ -979,8 +979,9 @@ TEST_F(NominalTest, TestMaxStructDepths) { EXPECT_EQ(maxDepths[B], Index(0)); EXPECT_EQ(maxDepths[A], Index(1)); - EXPECT_EQ(maxDepths[HeapType::data], Index(2)); + EXPECT_EQ(maxDepths[HeapType::struct_], Index(2)); EXPECT_EQ(maxDepths[HeapType::eq], Index(3)); + EXPECT_EQ(maxDepths[HeapType::any], Index(4)); } TEST_F(NominalTest, TestMaxArrayDepths) { @@ -999,8 +1000,8 @@ TEST_F(NominalTest, TestMaxArrayDepths) { EXPECT_EQ(maxDepths[A], Index(0)); EXPECT_EQ(maxDepths[HeapType::array], Index(1)); - EXPECT_EQ(maxDepths[HeapType::data], Index(2)); - EXPECT_EQ(maxDepths[HeapType::eq], Index(3)); + EXPECT_EQ(maxDepths[HeapType::eq], Index(2)); + EXPECT_EQ(maxDepths[HeapType::any], Index(3)); } // Test .depth() helper. @@ -1020,14 +1021,14 @@ TEST_F(NominalTest, TestDepth) { C = built[2]; } - // any :> eq :> data :> array :> specific array types + // any :> eq :> array :> specific array types EXPECT_EQ(HeapType(HeapType::any).getDepth(), 0U); EXPECT_EQ(HeapType(HeapType::eq).getDepth(), 1U); - EXPECT_EQ(HeapType(HeapType::data).getDepth(), 2U); - EXPECT_EQ(HeapType(HeapType::array).getDepth(), 3U); + EXPECT_EQ(HeapType(HeapType::array).getDepth(), 2U); + EXPECT_EQ(HeapType(HeapType::struct_).getDepth(), 2U); EXPECT_EQ(A.getDepth(), 3U); EXPECT_EQ(B.getDepth(), 4U); - EXPECT_EQ(C.getDepth(), 4U); + EXPECT_EQ(C.getDepth(), 3U); // Signature types are subtypes of func. EXPECT_EQ(HeapType(HeapType::func).getDepth(), 0U); diff --git a/test/heap-types.wast b/test/heap-types.wast index f64dd8814..243863946 100644 --- a/test/heap-types.wast +++ b/test/heap-types.wast @@ -182,13 +182,12 @@ (unreachable) ) (func $ref.is_X (param $x anyref) - (if (ref.is_data (local.get $x)) (unreachable)) + (if (ref.is_null (local.get $x)) (unreachable)) (if (ref.is_i31 (local.get $x)) (unreachable)) ) (func $ref.as_X (param $x anyref) (param $f funcref) (drop (ref.as_non_null (local.get $x))) (drop (ref.as_func (local.get $f))) - (drop (ref.as_data (local.get $x))) (drop (ref.as_i31 (local.get $x))) ) (func $br_on_X (param $x anyref) diff --git a/test/heap-types.wast.from-wast b/test/heap-types.wast.from-wast index 703759720..213a45b5a 100644 --- a/test/heap-types.wast.from-wast +++ b/test/heap-types.wast.from-wast @@ -178,7 +178,7 @@ ) (func $ref.is_X (type $anyref_=>_none) (param $x anyref) (if - (ref.is_data + (ref.is_null (local.get $x) ) (unreachable) @@ -202,11 +202,6 @@ ) ) (drop - (ref.as_data - (local.get $x) - ) - ) - (drop (ref.as_i31 (local.get $x) ) diff --git a/test/heap-types.wast.fromBinary b/test/heap-types.wast.fromBinary index 8e42051bc..80981535c 100644 --- a/test/heap-types.wast.fromBinary +++ b/test/heap-types.wast.fromBinary @@ -176,7 +176,7 @@ ) (func $ref.is_X (type $anyref_=>_none) (param $x anyref) (if - (ref.is_data + (ref.is_null (local.get $x) ) (unreachable) @@ -200,11 +200,6 @@ ) ) (drop - (ref.as_data - (local.get $x) - ) - ) - (drop (ref.as_i31 (local.get $x) ) diff --git a/test/heap-types.wast.fromBinary.noDebugInfo b/test/heap-types.wast.fromBinary.noDebugInfo index 3c7203066..6c37eba77 100644 --- a/test/heap-types.wast.fromBinary.noDebugInfo +++ b/test/heap-types.wast.fromBinary.noDebugInfo @@ -176,7 +176,7 @@ ) (func $2 (type $anyref_=>_none) (param $0 anyref) (if - (ref.is_data + (ref.is_null (local.get $0) ) (unreachable) @@ -200,11 +200,6 @@ ) ) (drop - (ref.as_data - (local.get $0) - ) - ) - (drop (ref.as_i31 (local.get $0) ) diff --git a/test/lit/cast-to-basic.wast b/test/lit/cast-to-basic.wast index 9433c3ba1..23adb3968 100644 --- a/test/lit/cast-to-basic.wast +++ b/test/lit/cast-to-basic.wast @@ -6,7 +6,7 @@ (module ;; CHECK: (func $test (type $none_=>_i32) (result i32) - ;; CHECK-NEXT: (ref.is_data + ;; CHECK-NEXT: (ref.test struct ;; CHECK-NEXT: (ref.null none) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -18,7 +18,7 @@ ;; CHECK: (func $cast (type $none_=>_none) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (ref.cast null data + ;; CHECK-NEXT: (ref.cast null struct ;; CHECK-NEXT: (ref.null none) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -33,9 +33,9 @@ ;; CHECK: (func $br (type $none_=>_none) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $label$1 (result dataref) + ;; CHECK-NEXT: (block $label$1 (result structref) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (br_on_data $label$1 + ;; CHECK-NEXT: (br_on_cast $label$1 struct ;; CHECK-NEXT: (ref.null none) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -58,9 +58,9 @@ ;; CHECK: (func $br-null (type $none_=>_none) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $label$1 (result dataref) + ;; CHECK-NEXT: (block $label$1 (result structref) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (br_on_cast $label$1 null data + ;; CHECK-NEXT: (br_on_cast $label$1 null struct ;; CHECK-NEXT: (ref.null none) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -83,9 +83,9 @@ ;; CHECK: (func $br-fail-null (type $none_=>_none) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block $label$1 (result dataref) + ;; CHECK-NEXT: (block $label$1 (result structref) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (br_on_cast_fail $label$1 null data + ;; CHECK-NEXT: (br_on_cast_fail $label$1 null struct ;; CHECK-NEXT: (ref.null none) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/coalesce-locals-gc.wast b/test/lit/passes/coalesce-locals-gc.wast index 8cc585d7b..29dffb5bd 100644 --- a/test/lit/passes/coalesce-locals-gc.wast +++ b/test/lit/passes/coalesce-locals-gc.wast @@ -8,23 +8,23 @@ ;; testcases. (module - ;; CHECK: (type $A (struct (field dataref))) + ;; CHECK: (type $A (struct (field structref))) ;; CHECK: (type $array (array (mut i8))) (type $array (array (mut i8))) (type $A (struct_subtype (field (ref null struct)) data)) - ;; CHECK: (type $B (struct_subtype (field (ref data)) $A)) + ;; CHECK: (type $B (struct_subtype (field (ref struct)) $A)) (type $B (struct_subtype (field (ref struct)) $A)) ;; CHECK: (global $global (ref null $array) (ref.null none)) (global $global (ref null $array) (ref.null $array)) - ;; CHECK: (func $test-dead-get-non-nullable (type $ref|data|_=>_none) (param $0 (ref data)) + ;; CHECK: (func $test-dead-get-non-nullable (type $ref|struct|_=>_none) (param $0 (ref struct)) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (block (result (ref data)) + ;; CHECK-NEXT: (block (result (ref struct)) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -174,7 +174,7 @@ ) ) - ;; CHECK: (func $remove-tee-refinalize (type $ref?|$A|_ref?|$B|_=>_dataref) (param $0 (ref null $A)) (param $1 (ref null $B)) (result dataref) + ;; CHECK: (func $remove-tee-refinalize (type $ref?|$A|_ref?|$B|_=>_structref) (param $0 (ref null $A)) (param $1 (ref null $B)) (result structref) ;; CHECK-NEXT: (struct.get $A 0 ;; CHECK-NEXT: (block (result (ref null $A)) ;; CHECK-NEXT: (local.get $1) @@ -195,7 +195,7 @@ ) ) - ;; CHECK: (func $remove-tee-refinalize-2 (type $ref?|$A|_ref?|$B|_=>_dataref) (param $0 (ref null $A)) (param $1 (ref null $B)) (result dataref) + ;; CHECK: (func $remove-tee-refinalize-2 (type $ref?|$A|_ref?|$B|_=>_structref) (param $0 (ref null $A)) (param $1 (ref null $B)) (result structref) ;; CHECK-NEXT: (struct.get $A 0 ;; CHECK-NEXT: (block (result (ref null $A)) ;; CHECK-NEXT: (local.get $1) diff --git a/test/lit/passes/dae-gc-refine-params.wast b/test/lit/passes/dae-gc-refine-params.wast index c41feb4ac..29a666196 100644 --- a/test/lit/passes/dae-gc-refine-params.wast +++ b/test/lit/passes/dae-gc-refine-params.wast @@ -468,11 +468,11 @@ ) ;; CHECK: (func $unused-and-refinable (type $none_=>_none) - ;; CHECK-NEXT: (local $0 dataref) + ;; CHECK-NEXT: (local $0 structref) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) ;; NOMNL: (func $unused-and-refinable (type $none_=>_none) - ;; NOMNL-NEXT: (local $0 dataref) + ;; NOMNL-NEXT: (local $0 structref) ;; NOMNL-NEXT: (nop) ;; NOMNL-NEXT: ) (func $unused-and-refinable (param $0 structref) @@ -500,7 +500,7 @@ ) ;; CHECK: (func $non-nullable-fixup (type $ref|${}|_=>_none) (param $0 (ref ${})) - ;; CHECK-NEXT: (local $1 dataref) + ;; CHECK-NEXT: (local $1 structref) ;; CHECK-NEXT: (local.set $1 ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: ) @@ -509,7 +509,7 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; NOMNL: (func $non-nullable-fixup (type $ref|${}|_=>_none) (param $0 (ref ${})) - ;; NOMNL-NEXT: (local $1 dataref) + ;; NOMNL-NEXT: (local $1 structref) ;; NOMNL-NEXT: (local.set $1 ;; NOMNL-NEXT: (local.get $0) ;; NOMNL-NEXT: ) diff --git a/test/lit/passes/dae-gc-refine-return.wast b/test/lit/passes/dae-gc-refine-return.wast index a2e858a17..0db6ab551 100644 --- a/test/lit/passes/dae-gc-refine-return.wast +++ b/test/lit/passes/dae-gc-refine-return.wast @@ -230,7 +230,7 @@ ;; CHECK: (func $refine-return-many-lub (type $none_=>_eqref) (result eqref) ;; CHECK-NEXT: (local $temp anyref) ;; CHECK-NEXT: (local $i31 i31ref) - ;; CHECK-NEXT: (local $struct dataref) + ;; CHECK-NEXT: (local $struct structref) ;; CHECK-NEXT: (local.set $temp ;; CHECK-NEXT: (call $refine-return-many-lub) ;; CHECK-NEXT: ) @@ -251,7 +251,7 @@ ;; NOMNL: (func $refine-return-many-lub (type $none_=>_eqref) (result eqref) ;; NOMNL-NEXT: (local $temp anyref) ;; NOMNL-NEXT: (local $i31 i31ref) - ;; NOMNL-NEXT: (local $struct dataref) + ;; NOMNL-NEXT: (local $struct structref) ;; NOMNL-NEXT: (local.set $temp ;; NOMNL-NEXT: (call $refine-return-many-lub) ;; NOMNL-NEXT: ) @@ -291,7 +291,7 @@ ;; CHECK: (func $refine-return-many-lub-2 (type $none_=>_eqref) (result eqref) ;; CHECK-NEXT: (local $temp anyref) ;; CHECK-NEXT: (local $i31 i31ref) - ;; CHECK-NEXT: (local $struct dataref) + ;; CHECK-NEXT: (local $struct structref) ;; CHECK-NEXT: (local.set $temp ;; CHECK-NEXT: (call $refine-return-many-lub-2) ;; CHECK-NEXT: ) @@ -312,7 +312,7 @@ ;; NOMNL: (func $refine-return-many-lub-2 (type $none_=>_eqref) (result eqref) ;; NOMNL-NEXT: (local $temp anyref) ;; NOMNL-NEXT: (local $i31 i31ref) - ;; NOMNL-NEXT: (local $struct dataref) + ;; NOMNL-NEXT: (local $struct structref) ;; NOMNL-NEXT: (local.set $temp ;; NOMNL-NEXT: (call $refine-return-many-lub-2) ;; NOMNL-NEXT: ) diff --git a/test/lit/passes/gufa-extern.wast b/test/lit/passes/gufa-extern.wast index 9d71357aa..c8b593e4b 100644 --- a/test/lit/passes/gufa-extern.wast +++ b/test/lit/passes/gufa-extern.wast @@ -8,7 +8,7 @@ ;; CHECK: (func $externals (type $externref_anyref_=>_none) (param $ext externref) (param $any anyref) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (ref.as_data + ;; CHECK-NEXT: (ref.cast struct ;; CHECK-NEXT: (extern.internalize ;; CHECK-NEXT: (local.get $ext) ;; CHECK-NEXT: ) @@ -24,7 +24,7 @@ ;; We must not turn these into unreachable code, as the function is ;; exported. (drop - (ref.as_data + (ref.cast struct (extern.internalize (local.get $ext) ) @@ -58,7 +58,7 @@ ;; This is not exported, so the params are dead code, and can be turned ;; unreachable. (drop - (ref.as_data + (ref.cast struct (extern.internalize (local.get $ext) ) diff --git a/test/lit/passes/local-subtyping.wast b/test/lit/passes/local-subtyping.wast index 987758fe5..2ae05fb90 100644 --- a/test/lit/passes/local-subtyping.wast +++ b/test/lit/passes/local-subtyping.wast @@ -88,10 +88,10 @@ ) ) - ;; CHECK: (func $locals-with-multiple-assignments (type $dataref_=>_none) (param $struct dataref) + ;; CHECK: (func $locals-with-multiple-assignments (type $structref_=>_none) (param $struct structref) ;; CHECK-NEXT: (local $x eqref) ;; CHECK-NEXT: (local $y (ref i31)) - ;; CHECK-NEXT: (local $z dataref) + ;; CHECK-NEXT: (local $z structref) ;; CHECK-NEXT: (local $w (ref func)) ;; CHECK-NEXT: (local.set $x ;; CHECK-NEXT: (i31.new diff --git a/test/lit/passes/optimize-casts.wast b/test/lit/passes/optimize-casts.wast index 21a173fad..6faca88d7 100644 --- a/test/lit/passes/optimize-casts.wast +++ b/test/lit/passes/optimize-casts.wast @@ -92,7 +92,7 @@ ) ) - ;; CHECK: (func $ref.cast (type $ref|data|_=>_none) (param $x (ref data)) + ;; CHECK: (func $ref.cast (type $ref|struct|_=>_none) (param $x (ref struct)) ;; CHECK-NEXT: (local $1 (ref $A)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.tee $1 @@ -124,7 +124,7 @@ ) ) - ;; CHECK: (func $not-past-set (type $ref|data|_=>_none) (param $x (ref data)) + ;; CHECK: (func $not-past-set (type $ref|struct|_=>_none) (param $x (ref struct)) ;; CHECK-NEXT: (local $1 (ref $A)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.tee $1 @@ -161,7 +161,7 @@ ) ) - ;; CHECK: (func $best (type $ref|data|_=>_none) (param $x (ref data)) + ;; CHECK: (func $best (type $ref|struct|_=>_none) (param $x (ref struct)) ;; CHECK-NEXT: (local $1 (ref $A)) ;; CHECK-NEXT: (local $2 (ref $B)) ;; CHECK-NEXT: (drop @@ -206,7 +206,7 @@ ) ) - ;; CHECK: (func $best-2 (type $ref|data|_=>_none) (param $x (ref data)) + ;; CHECK: (func $best-2 (type $ref|struct|_=>_none) (param $x (ref struct)) ;; CHECK-NEXT: (local $1 (ref $B)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.tee $1 @@ -248,12 +248,12 @@ ) ) - ;; CHECK: (func $fallthrough (type $ref|data|_=>_none) (param $x (ref data)) + ;; CHECK: (func $fallthrough (type $ref|struct|_=>_none) (param $x (ref struct)) ;; CHECK-NEXT: (local $1 (ref $A)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (local.tee $1 ;; CHECK-NEXT: (ref.cast $A - ;; CHECK-NEXT: (block (result (ref data)) + ;; CHECK-NEXT: (block (result (ref struct)) ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) @@ -277,7 +277,7 @@ ) ) - ;; CHECK: (func $past-basic-block (type $ref|data|_=>_none) (param $x (ref data)) + ;; CHECK: (func $past-basic-block (type $ref|struct|_=>_none) (param $x (ref struct)) ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.cast $A ;; CHECK-NEXT: (local.get $x) @@ -308,9 +308,9 @@ ) ) - ;; CHECK: (func $multiple (type $ref|data|_ref|data|_=>_none) (param $x (ref data)) (param $y (ref data)) - ;; CHECK-NEXT: (local $a (ref data)) - ;; CHECK-NEXT: (local $b (ref data)) + ;; CHECK: (func $multiple (type $ref|struct|_ref|struct|_=>_none) (param $x (ref struct)) (param $y (ref struct)) + ;; CHECK-NEXT: (local $a (ref struct)) + ;; CHECK-NEXT: (local $b (ref struct)) ;; CHECK-NEXT: (local $4 (ref $A)) ;; CHECK-NEXT: (local $5 (ref $A)) ;; CHECK-NEXT: (local.set $a @@ -388,7 +388,7 @@ ) ) - ;; CHECK: (func $get (type $none_=>_ref|data|) (result (ref data)) + ;; CHECK: (func $get (type $none_=>_ref|struct|) (result (ref struct)) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) (func $get (result (ref struct)) diff --git a/test/lit/passes/optimize-instructions-call_ref.wast b/test/lit/passes/optimize-instructions-call_ref.wast index ed308ca3a..ed849c7d8 100644 --- a/test/lit/passes/optimize-instructions-call_ref.wast +++ b/test/lit/passes/optimize-instructions-call_ref.wast @@ -16,7 +16,7 @@ ;; CHECK: (type $i32_=>_none (func (param i32))) - ;; CHECK: (type $struct_=>_none (func (param (ref data)))) + ;; CHECK: (type $struct_=>_none (func (param (ref struct)))) (type $struct_=>_none (func (param (ref struct)))) ;; CHECK: (type $i32_i32_i32_ref|$i32_i32_=>_none|_=>_none (func (param i32 i32 i32 (ref $i32_i32_=>_none)))) @@ -124,10 +124,10 @@ ) ) - ;; CHECK: (func $fallthrough-non-nullable (type $struct_=>_none) (param $x (ref data)) - ;; CHECK-NEXT: (local $1 dataref) + ;; CHECK: (func $fallthrough-non-nullable (type $struct_=>_none) (param $x (ref struct)) + ;; CHECK-NEXT: (local $1 structref) ;; CHECK-NEXT: (call $fallthrough-non-nullable - ;; CHECK-NEXT: (block (result (ref data)) + ;; CHECK-NEXT: (block (result (ref struct)) ;; CHECK-NEXT: (local.set $1 ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) diff --git a/test/lit/passes/optimize-instructions-gc-tnh.wast b/test/lit/passes/optimize-instructions-gc-tnh.wast index 502590cde..2e9479ff5 100644 --- a/test/lit/passes/optimize-instructions-gc-tnh.wast +++ b/test/lit/passes/optimize-instructions-gc-tnh.wast @@ -18,7 +18,7 @@ ;; NO_TNH-NEXT: (ref.cast $struct ;; NO_TNH-NEXT: (local.get $a) ;; NO_TNH-NEXT: ) - ;; NO_TNH-NEXT: (ref.as_data + ;; NO_TNH-NEXT: (ref.cast struct ;; NO_TNH-NEXT: (local.get $b) ;; NO_TNH-NEXT: ) ;; NO_TNH-NEXT: ) @@ -29,7 +29,7 @@ (ref.eq ;; When traps can happen we can still improve this by removing and ;; combining redundant casts. - (ref.as_data + (ref.cast struct (ref.as_non_null (ref.cast null $struct (local.get $a) @@ -37,8 +37,8 @@ ) ) ;; Note that we can remove the non-null casts here in both modes, as the - ;; ref.as_data also checks for null. - (ref.as_data + ;; ref.cast struct also checks for null. + (ref.cast struct (ref.as_non_null (ref.as_non_null (local.get $b) @@ -59,7 +59,7 @@ ;; NO_TNH-NEXT: (ref.cast null $struct ;; NO_TNH-NEXT: (local.get $any) ;; NO_TNH-NEXT: ) - ;; NO_TNH-NEXT: (ref.as_data + ;; NO_TNH-NEXT: (ref.cast struct ;; NO_TNH-NEXT: (local.get $any) ;; NO_TNH-NEXT: ) ;; NO_TNH-NEXT: ) @@ -73,7 +73,7 @@ (local.get $any) ;; *Not* an eqref! ) (ref.as_non_null - (ref.as_data + (ref.cast struct (ref.as_non_null (local.get $any) ;; *Not* an eqref! ) @@ -105,7 +105,7 @@ (ref.is_null (ref.cast $struct (ref.as_non_null - (ref.as_data + (ref.cast struct (local.get $a) ) ) @@ -417,7 +417,7 @@ ) ) - ;; TNH: (func $set-get-cast (type $dataref_=>_none) (param $ref dataref) + ;; TNH: (func $set-get-cast (type $structref_=>_none) (param $ref structref) ;; TNH-NEXT: (drop ;; TNH-NEXT: (struct.get $struct 0 ;; TNH-NEXT: (ref.cast $struct @@ -441,7 +441,7 @@ ;; TNH-NEXT: ) ;; TNH-NEXT: ) ;; TNH-NEXT: ) - ;; NO_TNH: (func $set-get-cast (type $dataref_=>_none) (param $ref dataref) + ;; NO_TNH: (func $set-get-cast (type $structref_=>_none) (param $ref structref) ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (struct.get $struct 0 ;; NO_TNH-NEXT: (ref.cast $struct @@ -465,7 +465,7 @@ ;; NO_TNH-NEXT: ) ;; NO_TNH-NEXT: ) ;; NO_TNH-NEXT: ) - (func $set-get-cast (param $ref (ref null data)) + (func $set-get-cast (param $ref (ref null struct)) ;; A nullable cast flowing into a place that traps on null can become a ;; non-nullable cast. (drop diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast index 631697e27..3ecd83d03 100644 --- a/test/lit/passes/optimize-instructions-gc.wast +++ b/test/lit/passes/optimize-instructions-gc.wast @@ -14,14 +14,12 @@ (field $i64 (mut i64)) )) - ;; CHECK: (type $array (array (mut i8))) - ;; CHECK: (type $A (struct (field i32))) - ;; NOMNL: (type $array (array (mut i8))) - ;; NOMNL: (type $A (struct (field i32))) (type $A (struct (field i32))) + ;; CHECK: (type $array (array (mut i8))) + ;; NOMNL: (type $array (array (mut i8))) (type $array (array (mut i8))) ;; CHECK: (type $B (struct_subtype (field i32) (field i32) (field f32) $A)) @@ -3045,27 +3043,17 @@ ) ) - ;; CHECK: (func $as_of_unreachable (type $none_=>_ref|data|) (result (ref data)) - ;; CHECK-NEXT: (block ;; (replaces something unreachable we can't emit) - ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (unreachable) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (unreachable) - ;; CHECK-NEXT: ) + ;; CHECK: (func $as_of_unreachable (type $none_=>_ref|$A|) (result (ref $A)) + ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) - ;; NOMNL: (func $as_of_unreachable (type $none_=>_ref|data|) (result (ref data)) - ;; NOMNL-NEXT: (block ;; (replaces something unreachable we can't emit) - ;; NOMNL-NEXT: (drop - ;; NOMNL-NEXT: (unreachable) - ;; NOMNL-NEXT: ) - ;; NOMNL-NEXT: (unreachable) - ;; NOMNL-NEXT: ) + ;; NOMNL: (func $as_of_unreachable (type $none_=>_ref|$A|) (result (ref $A)) + ;; NOMNL-NEXT: (unreachable) ;; NOMNL-NEXT: ) - (func $as_of_unreachable (result (ref data)) + (func $as_of_unreachable (result (ref $A)) ;; The cast will definitely fail, so we can turn it into an unreachable. The ;; ref.as must then ignore the unreachable input and not error on trying to ;; infer anything about it. - (ref.as_data + (ref.as_non_null (ref.cast $A (ref.null none) ) diff --git a/test/lit/passes/precompute-gc-immutable.wast b/test/lit/passes/precompute-gc-immutable.wast index 5b0d4dffd..2c03bfa7a 100644 --- a/test/lit/passes/precompute-gc-immutable.wast +++ b/test/lit/passes/precompute-gc-immutable.wast @@ -739,7 +739,7 @@ ;; data that is filled with vtables of different types. On usage, we do a ;; cast of the vtable type. - ;; CHECK: (type $itable (array dataref)) + ;; CHECK: (type $itable (array structref)) (type $itable (array (ref null struct))) ;; CHECK: (type $object (struct (field (ref $itable)))) diff --git a/test/lit/passes/remove-unused-brs-gc.wast b/test/lit/passes/remove-unused-brs-gc.wast index b4c529f74..02dc55cbd 100644 --- a/test/lit/passes/remove-unused-brs-gc.wast +++ b/test/lit/passes/remove-unused-brs-gc.wast @@ -62,10 +62,10 @@ ) ) - ;; CHECK: (func $br_on-if (type $ref|data|_=>_none) (param $0 (ref data)) + ;; CHECK: (func $br_on-if (type $ref|struct|_=>_none) (param $0 (ref struct)) ;; CHECK-NEXT: (block $label ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (select (result (ref data)) + ;; CHECK-NEXT: (select (result (ref struct)) ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: (local.get $0) ;; CHECK-NEXT: (i32.const 0) diff --git a/test/lit/passes/rse-gc.wast b/test/lit/passes/rse-gc.wast index 2455ced7d..66b8ee677 100644 --- a/test/lit/passes/rse-gc.wast +++ b/test/lit/passes/rse-gc.wast @@ -2,12 +2,12 @@ ;; RUN: wasm-opt %s --rse -all -S -o - | filecheck %s (module - ;; CHECK: (type $A (struct (field dataref))) + ;; CHECK: (type $A (struct (field structref))) (type $A (struct (field (ref null struct)))) ;; $B is a subtype of $A, and its field has a more refined type (it is non- ;; nullable). - ;; CHECK: (type $B (struct_subtype (field (ref data)) $A)) + ;; CHECK: (type $B (struct_subtype (field (ref struct)) $A)) (type $B (struct_subtype (field (ref struct)) $A)) ;; CHECK: (func $test (type $none_=>_none) diff --git a/test/lit/passes/signature-refining.wast b/test/lit/passes/signature-refining.wast index 1d631881c..d814e8194 100644 --- a/test/lit/passes/signature-refining.wast +++ b/test/lit/passes/signature-refining.wast @@ -359,7 +359,7 @@ ;; CHECK: (type $sig-2 (func (param eqref (ref $struct)))) - ;; CHECK: (type $sig-1 (func (param dataref anyref))) + ;; CHECK: (type $sig-1 (func (param structref anyref))) (type $sig-1 (func_subtype (param anyref) (param anyref) func)) (type $sig-2 (func_subtype (param anyref) (param anyref) func)) @@ -367,7 +367,7 @@ ;; CHECK: (elem declare func $func-2) - ;; CHECK: (func $func-1 (type $sig-1) (param $x dataref) (param $y anyref) + ;; CHECK: (func $func-1 (type $sig-1) (param $x structref) (param $y anyref) ;; CHECK-NEXT: (nop) ;; CHECK-NEXT: ) (func $func-1 (type $sig-1) (param $x anyref) (param $y anyref) @@ -381,7 +381,7 @@ ;; CHECK: (func $caller (type $none_=>_none) ;; CHECK-NEXT: (local $any anyref) - ;; CHECK-NEXT: (local $struct dataref) + ;; CHECK-NEXT: (local $struct structref) ;; CHECK-NEXT: (local $i31 i31ref) ;; CHECK-NEXT: (call $func-1 ;; CHECK-NEXT: (struct.new_default $struct) @@ -737,14 +737,14 @@ ;; Do not modify the types used on imported functions (until the spec and VM ;; support becomes stable). (module - ;; CHECK: (type $dataref_=>_none (func (param dataref))) + ;; CHECK: (type $structref_=>_none (func (param structref))) ;; CHECK: (type $none_=>_none (func)) ;; CHECK: (type $struct (struct )) (type $struct (struct)) - ;; CHECK: (import "a" "b" (func $import (param dataref))) + ;; CHECK: (import "a" "b" (func $import (param structref))) (import "a" "b" (func $import (param (ref null struct)))) ;; CHECK: (func $test (type $none_=>_none) diff --git a/test/lit/passes/simplify-locals-gc.wast b/test/lit/passes/simplify-locals-gc.wast index 001074b69..38a7d79d8 100644 --- a/test/lit/passes/simplify-locals-gc.wast +++ b/test/lit/passes/simplify-locals-gc.wast @@ -5,14 +5,14 @@ ;; RUN: | filecheck %s --check-prefix=NOMNL (module - ;; CHECK: (type $A (struct (field dataref))) + ;; CHECK: (type $A (struct (field structref))) - ;; CHECK: (type $B (struct_subtype (field (ref data)) $A)) + ;; CHECK: (type $B (struct_subtype (field (ref struct)) $A)) ;; CHECK: (type $struct (struct (field (mut i32)))) - ;; NOMNL: (type $A (struct (field dataref))) + ;; NOMNL: (type $A (struct (field structref))) - ;; NOMNL: (type $B (struct_subtype (field (ref data)) $A)) + ;; NOMNL: (type $B (struct_subtype (field (ref struct)) $A)) ;; NOMNL: (type $struct (struct (field (mut i32)))) (type $struct (struct (field (mut i32)))) @@ -703,12 +703,12 @@ ;; Helper function for the above. ) - ;; CHECK: (func $remove-tee-refinalize (type $ref?|$A|_ref?|$B|_=>_dataref) (param $a (ref null $A)) (param $b (ref null $B)) (result dataref) + ;; CHECK: (func $remove-tee-refinalize (type $ref?|$A|_ref?|$B|_=>_structref) (param $a (ref null $A)) (param $b (ref null $B)) (result structref) ;; CHECK-NEXT: (struct.get $B 0 ;; CHECK-NEXT: (local.get $b) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - ;; NOMNL: (func $remove-tee-refinalize (type $ref?|$A|_ref?|$B|_=>_dataref) (param $a (ref null $A)) (param $b (ref null $B)) (result dataref) + ;; NOMNL: (func $remove-tee-refinalize (type $ref?|$A|_ref?|$B|_=>_structref) (param $a (ref null $A)) (param $b (ref null $B)) (result structref) ;; NOMNL-NEXT: (struct.get $B 0 ;; NOMNL-NEXT: (local.get $b) ;; NOMNL-NEXT: ) diff --git a/test/lit/passes/vacuum-gc.wast b/test/lit/passes/vacuum-gc.wast index c131bef20..6e70425a2 100644 --- a/test/lit/passes/vacuum-gc.wast +++ b/test/lit/passes/vacuum-gc.wast @@ -12,11 +12,6 @@ ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) ;; CHECK-NEXT: (drop - ;; CHECK-NEXT: (ref.as_data - ;; CHECK-NEXT: (local.get $x) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: ) - ;; CHECK-NEXT: (drop ;; CHECK-NEXT: (ref.as_i31 ;; CHECK-NEXT: (local.get $x) ;; CHECK-NEXT: ) @@ -31,11 +26,6 @@ ) ) (drop - (ref.as_data - (local.get $x) - ) - ) - (drop (ref.as_i31 (local.get $x) ) @@ -84,12 +74,12 @@ ) ) - ;; CHECK: (func $ref.cast.null.block (type $ref|${}|_=>_dataref) (param $ref (ref ${})) (result dataref) + ;; CHECK: (func $ref.cast.null.block (type $ref|${}|_=>_structref) (param $ref (ref ${})) (result structref) ;; CHECK-NEXT: (ref.cast ${} ;; CHECK-NEXT: (local.get $ref) ;; CHECK-NEXT: ) ;; CHECK-NEXT: ) - (func $ref.cast.null.block (param $ref (ref ${})) (result (ref null data)) + (func $ref.cast.null.block (param $ref (ref ${})) (result (ref null struct)) ;; We can vacuum away the block, which will make this ref.cast null operate ;; on a non-nullable input. That is, we are refining the input to the cast. ;; The cast must be updated properly following that, to be a non-nullable diff --git a/test/lit/passes/vacuum-tnh.wast b/test/lit/passes/vacuum-tnh.wast index 40aac16c1..6b0907989 100644 --- a/test/lit/passes/vacuum-tnh.wast +++ b/test/lit/passes/vacuum-tnh.wast @@ -27,11 +27,6 @@ ;; NO_TNH-NEXT: ) ;; NO_TNH-NEXT: ) ;; NO_TNH-NEXT: (drop - ;; NO_TNH-NEXT: (ref.as_data - ;; NO_TNH-NEXT: (local.get $y) - ;; NO_TNH-NEXT: ) - ;; NO_TNH-NEXT: ) - ;; NO_TNH-NEXT: (drop ;; NO_TNH-NEXT: (ref.as_i31 ;; NO_TNH-NEXT: (local.get $y) ;; NO_TNH-NEXT: ) @@ -56,11 +51,6 @@ ;; Other ref.as* as well. (drop - (ref.as_data - (local.get $y) - ) - ) - (drop (ref.as_i31 (local.get $y) ) diff --git a/test/lit/structref.wast b/test/lit/structref.wast index f4f2fb281..6edf5f86e 100644 --- a/test/lit/structref.wast +++ b/test/lit/structref.wast @@ -4,7 +4,7 @@ ;; Check that `struct` is correctly parsed as an alias for `data`. (module - ;; CHECK: (func $foo (type $dataref_ref|data|_=>_none) (param $x dataref) (param $y (ref data)) + ;; CHECK: (func $foo (type $structref_ref|struct|_=>_none) (param $x structref) (param $y (ref struct)) ;; CHECK-NEXT: (unreachable) ;; CHECK-NEXT: ) (func $foo (param $x structref) (param $y (ref struct)) diff --git a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt index fb11af060..97d1b637d 100644 --- a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt +++ b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt @@ -1,49 +1,42 @@ total - [exports] : 8 - [funcs] : 11 + [exports] : 10 + [funcs] : 14 [globals] : 6 [imports] : 5 [memories] : 1 [memory-data] : 22 - [table-data] : 7 + [table-data] : 6 [tables] : 1 [tags] : 0 - [total] : 748 - [vars] : 19 + [total] : 610 + [vars] : 52 ArrayInit : 5 - AtomicFence : 1 - AtomicRMW : 1 - Binary : 84 - Block : 90 - Break : 14 - Call : 19 - CallIndirect : 2 - CallRef : 2 - Const : 176 - Drop : 5 - GlobalGet : 58 - GlobalSet : 25 - I31Get : 2 - I31New : 4 - If : 39 - Load : 22 - LocalGet : 31 - LocalSet : 21 - Loop : 14 - MemoryCopy : 1 - MemoryFill : 1 - Nop : 17 - RefAs : 4 - RefEq : 2 - RefFunc : 9 - RefIsNull : 1 + AtomicFence : 4 + AtomicRMW : 2 + Binary : 66 + Block : 78 + Break : 9 + Call : 21 + CallRef : 1 + Const : 146 + Drop : 9 + GlobalGet : 46 + GlobalSet : 22 + I31New : 3 + If : 28 + Load : 13 + LocalGet : 20 + LocalSet : 17 + Loop : 8 + Nop : 16 + RefFunc : 8 + RefIsNull : 2 RefNull : 5 - Return : 29 - SIMDExtract : 3 - SIMDReplace : 1 - Select : 3 - Store : 5 - StructNew : 2 + Return : 28 + SIMDExtract : 1 + Select : 1 + Store : 4 + StructNew : 6 TupleExtract : 1 - TupleMake : 6 - Unary : 43 + TupleMake : 7 + Unary : 33 diff --git a/test/spec/array.wast b/test/spec/array.wast index c30365030..6e7b8cddb 100644 --- a/test/spec/array.wast +++ b/test/spec/array.wast @@ -8,7 +8,7 @@ (type (array f32)) (type (array f64)) (type (array anyref)) - (type (array (ref data))) + (type (array (ref struct))) (type (array (ref 0))) (type (array (ref null 1))) (type (array (mut i8))) @@ -18,7 +18,7 @@ (type (array (mut i32))) (type (array (mut i64))) (type (array (mut anyref))) - (type (array (mut (ref data)))) + (type (array (mut (ref struct)))) (type (array (mut (ref 0)))) (type (array (mut (ref null i31)))) ) diff --git a/test/spec/ref_cast.wast b/test/spec/ref_cast.wast index b81671e30..f1cfbe24b 100644 --- a/test/spec/ref_cast.wast +++ b/test/spec/ref_cast.wast @@ -6,14 +6,14 @@ (type $t2' (struct_subtype (field i32) (field i32) $t2)) (type $t3 (struct_subtype (field i32) (field i32) $t2)) - (global $tab.0 (mut (ref null data)) (ref.null data)) - (global $tab.1 (mut (ref null data)) (ref.null data)) - (global $tab.2 (mut (ref null data)) (ref.null data)) - (global $tab.3 (mut (ref null data)) (ref.null data)) - (global $tab.4 (mut (ref null data)) (ref.null data)) - (global $tab.10 (mut (ref null data)) (ref.null data)) - (global $tab.11 (mut (ref null data)) (ref.null data)) - (global $tab.12 (mut (ref null data)) (ref.null data)) + (global $tab.0 (mut (ref null struct)) (ref.null struct)) + (global $tab.1 (mut (ref null struct)) (ref.null struct)) + (global $tab.2 (mut (ref null struct)) (ref.null struct)) + (global $tab.3 (mut (ref null struct)) (ref.null struct)) + (global $tab.4 (mut (ref null struct)) (ref.null struct)) + (global $tab.10 (mut (ref null struct)) (ref.null struct)) + (global $tab.11 (mut (ref null struct)) (ref.null struct)) + (global $tab.12 (mut (ref null struct)) (ref.null struct)) (func $init (global.set $tab.0 (struct.new_default $t0)) @@ -29,7 +29,7 @@ (func (export "test-sub") (call $init) - (drop (ref.cast null $t0 (ref.null data))) + (drop (ref.cast null $t0 (ref.null struct))) (drop (ref.cast null $t0 (struct.new_default $t0))) (drop (ref.cast null $t0 (global.get $tab.0))) (drop (ref.cast null $t0 (global.get $tab.1))) @@ -42,19 +42,19 @@ (drop (ref.cast $t0 (global.get $tab.3))) (drop (ref.cast $t0 (global.get $tab.4))) - (drop (ref.cast null $t1 (ref.null data))) + (drop (ref.cast null $t1 (ref.null struct))) (drop (ref.cast null $t1 (struct.new_default $t1))) (drop (ref.cast null $t1 (global.get $tab.1))) (drop (ref.cast null $t1 (global.get $tab.2))) (drop (ref.cast $t1 (global.get $tab.1))) (drop (ref.cast $t1 (global.get $tab.2))) - (drop (ref.cast null $t2 (ref.null data))) + (drop (ref.cast null $t2 (ref.null struct))) (drop (ref.cast null $t2 (struct.new_default $t2))) (drop (ref.cast null $t2 (global.get $tab.2))) (drop (ref.cast $t2 (global.get $tab.2))) - (drop (ref.cast null $t3 (ref.null data))) + (drop (ref.cast null $t3 (ref.null struct))) (drop (ref.cast null $t3 (struct.new_default $t3))) (drop (ref.cast null $t3 (global.get $tab.3))) (drop (ref.cast $t3 (global.get $tab.3))) diff --git a/test/spec/ref_eq.wast b/test/spec/ref_eq.wast index f170bcc06..a5224834c 100644 --- a/test/spec/ref_eq.wast +++ b/test/spec/ref_eq.wast @@ -8,4 +8,4 @@ ) ;; All nulls compare equal, regardless of their type. -(assert_return (invoke "compare" (ref.null data) (ref.null eq)) (i32.const 1)) +(assert_return (invoke "compare" (ref.null none) (ref.null eq)) (i32.const 1)) diff --git a/test/spec/ref_test.wast b/test/spec/ref_test.wast index bb6479548..b0bb1df3d 100644 --- a/test/spec/ref_test.wast +++ b/test/spec/ref_test.wast @@ -141,7 +141,7 @@ (assert_return (invoke "ref_test_struct" (i32.const 2)) (i32.const 1)) (assert_return (invoke "ref_test_struct" (i32.const 3)) (i32.const 0)) (assert_return (invoke "ref_test_struct" (i32.const 4)) (i32.const 2)) -(assert_return (invoke "ref_test_struct" (i32.const 5)) (i32.const 2)) ;; TOOD: expect 0 once struct is not an alias for data +(assert_return (invoke "ref_test_struct" (i32.const 5)) (i32.const 0)) ;; (assert_return (invoke "ref_test_struct" (i32.const 6)) (i32.const 0)) ;; (assert_return (invoke "ref_test_struct" (i32.const 7)) (i32.const 1)) |