diff options
Diffstat (limited to 'test/example')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 35 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 34 | ||||
-rw-r--r-- | test/example/cpp-unit.cpp | 37 | ||||
-rw-r--r-- | test/example/cpp-unit.txt | 2 | ||||
-rw-r--r-- | test/example/typeinfo.txt | 2 |
5 files changed, 54 insertions, 56 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index bc6b4b873..251aa3b90 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -431,9 +431,9 @@ void test_core() { temp15 = makeInt32(module, 110), temp16 = makeInt64(module, 111); BinaryenExpressionRef externrefExpr = - BinaryenRefNull(module, BinaryenTypeExternref()); + BinaryenRefNull(module, BinaryenTypeNullExternref()); BinaryenExpressionRef funcrefExpr = - BinaryenRefNull(module, BinaryenTypeFuncref()); + BinaryenRefNull(module, BinaryenTypeNullFuncref()); funcrefExpr = BinaryenRefFunc(module, "kitchen()sinker", BinaryenTypeFuncref()); BinaryenExpressionRef i31refExpr = @@ -973,40 +973,40 @@ void test_core() { BinaryenSelect( module, temp10, - BinaryenRefNull(module, BinaryenTypeFuncref()), + BinaryenRefNull(module, BinaryenTypeNullFuncref()), BinaryenRefFunc(module, "kitchen()sinker", BinaryenTypeFuncref()), BinaryenTypeFuncref()), // GC BinaryenRefEq(module, - BinaryenRefNull(module, BinaryenTypeEqref()), - BinaryenRefNull(module, BinaryenTypeEqref())), + BinaryenRefNull(module, BinaryenTypeNullref()), + BinaryenRefNull(module, BinaryenTypeNullref())), BinaryenRefIs(module, BinaryenRefIsFunc(), - BinaryenRefNull(module, BinaryenTypeAnyref())), + BinaryenRefNull(module, BinaryenTypeNullref())), BinaryenRefIs(module, BinaryenRefIsData(), - BinaryenRefNull(module, BinaryenTypeAnyref())), + BinaryenRefNull(module, BinaryenTypeNullref())), BinaryenRefIs(module, BinaryenRefIsI31(), - BinaryenRefNull(module, BinaryenTypeAnyref())), + BinaryenRefNull(module, BinaryenTypeNullref())), BinaryenRefAs(module, BinaryenRefAsNonNull(), - BinaryenRefNull(module, BinaryenTypeAnyref())), + BinaryenRefNull(module, BinaryenTypeNullref())), BinaryenRefAs(module, BinaryenRefAsFunc(), - BinaryenRefNull(module, BinaryenTypeAnyref())), + BinaryenRefNull(module, BinaryenTypeNullref())), BinaryenRefAs(module, BinaryenRefAsData(), - BinaryenRefNull(module, BinaryenTypeAnyref())), + BinaryenRefNull(module, BinaryenTypeNullref())), BinaryenRefAs(module, BinaryenRefAsI31(), - BinaryenRefNull(module, BinaryenTypeAnyref())), + BinaryenRefNull(module, BinaryenTypeNullref())), BinaryenRefAs(module, BinaryenRefAsExternInternalize(), - BinaryenRefNull(module, BinaryenTypeExternref())), + BinaryenRefNull(module, BinaryenTypeNullExternref())), BinaryenRefAs(module, BinaryenRefAsExternExternalize(), - BinaryenRefNull(module, BinaryenTypeAnyref())), + BinaryenRefNull(module, BinaryenTypeNullref())), // Exception handling BinaryenTry(module, NULL, tryBody, catchTags, 1, catchBodies, 2, NULL), // (try $try_outer @@ -1103,11 +1103,8 @@ void test_core() { BinaryenArrayGet(module, BinaryenGlobalGet(module, "i8Array-global", i8Array), makeInt32(module, 0), + BinaryenTypeInt32(), true), - BinaryenArrayGet(module, - BinaryenGlobalGet(module, "i8Array-global", i8Array), - makeInt32(module, 0), - false), BinaryenArraySet(module, BinaryenGlobalGet(module, "i8Array-global", i8Array), makeInt32(module, 0), @@ -1420,7 +1417,7 @@ void test_core() { BinaryenTableSizeSetTable(tablesize, table); BinaryenExpressionRef valueExpr = - BinaryenRefNull(module, BinaryenTypeFuncref()); + BinaryenRefNull(module, BinaryenTypeNullFuncref()); BinaryenExpressionRef sizeExpr = makeInt32(module, 0); BinaryenExpressionRef growExpr = BinaryenTableGrow(module, "0", valueExpr, sizeExpr); diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index a8e4d200b..3d2b74938 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -58,7 +58,7 @@ BinaryenFeatureAll: 126975 ) (table.size $0) (table.grow $0 - (ref.null func) + (ref.null nofunc) (i32.const 0) ) (module @@ -1974,7 +1974,7 @@ BinaryenFeatureAll: 126975 ) (drop (ref.is_null - (ref.null extern) + (ref.null noextern) ) ) (drop @@ -1984,60 +1984,60 @@ BinaryenFeatureAll: 126975 ) (drop (select (result funcref) - (ref.null func) + (ref.null nofunc) (ref.func "$kitchen()sinker") (i32.const 1) ) ) (drop (ref.eq - (ref.null eq) - (ref.null eq) + (ref.null none) + (ref.null none) ) ) (drop (ref.is_func - (ref.null any) + (ref.null none) ) ) (drop (ref.is_data - (ref.null any) + (ref.null none) ) ) (drop (ref.is_i31 - (ref.null any) + (ref.null none) ) ) (drop (ref.as_non_null - (ref.null any) + (ref.null none) ) ) (drop (ref.as_func - (ref.null any) + (ref.null none) ) ) (drop (ref.as_data - (ref.null any) + (ref.null none) ) ) (drop (ref.as_i31 - (ref.null any) + (ref.null none) ) ) (drop (extern.internalize - (ref.null extern) + (ref.null noextern) ) ) (drop (extern.externalize - (ref.null any) + (ref.null none) ) ) (try @@ -2207,12 +2207,6 @@ BinaryenFeatureAll: 126975 (i32.const 0) ) ) - (drop - (array.get_u $[mut:i8] - (global.get $i8Array-global) - (i32.const 0) - ) - ) (array.set $[mut:i8] (global.get $i8Array-global) (i32.const 0) diff --git a/test/example/cpp-unit.cpp b/test/example/cpp-unit.cpp index b94530401..d2339f030 100644 --- a/test/example/cpp-unit.cpp +++ b/test/example/cpp-unit.cpp @@ -605,7 +605,30 @@ void test_effects() { // ArrayCopy can trap, reads arrays, and writes arrays (but not structs). { + Type arrayref = Type(HeapType(Array(Field(Type::i32, Mutable))), Nullable); + LocalGet dest; + dest.index = 0; + dest.type = arrayref; + LocalGet destIndex; + destIndex.index = 1; + destIndex.type = Type::i32; + LocalGet src; + src.index = 0; + src.type = arrayref; + LocalGet srcIndex; + srcIndex.index = 1; + srcIndex.type = Type::i32; + LocalGet length; + srcIndex.index = 2; + srcIndex.type = Type::i32; ArrayCopy arrayCopy(module.allocator); + arrayCopy.destRef = &dest; + arrayCopy.destIndex = &destIndex; + arrayCopy.srcRef = &src; + arrayCopy.srcIndex = &srcIndex; + arrayCopy.length = &length; + arrayCopy.finalize(); + EffectAnalyzer effects(options, module); effects.visit(&arrayCopy); assert_equal(effects.trap, true); @@ -616,19 +639,6 @@ void test_effects() { } } -void test_literals() { - // The i31 heap type may or may not be basic, depending on if it is nullable. - // Verify we handle both code paths. - { - Literal x(Type(HeapType::i31, Nullable)); - std::cout << x << '\n'; - } - { - Literal x(Type(HeapType::i31, NonNullable)); - std::cout << x << '\n'; - } -} - void test_field() { // Simple types assert_equal(Field(Type::i32, Immutable).getByteSize(), 4); @@ -681,7 +691,6 @@ int main() { test_bits(); test_cost(); test_effects(); - test_literals(); test_field(); test_queue(); diff --git a/test/example/cpp-unit.txt b/test/example/cpp-unit.txt index d1f1fc1fb..35821117c 100644 --- a/test/example/cpp-unit.txt +++ b/test/example/cpp-unit.txt @@ -1,3 +1 @@ -i31ref(null) -i31ref(0) Success diff --git a/test/example/typeinfo.txt b/test/example/typeinfo.txt index 2fbd8ec52..7015e6cfc 100644 --- a/test/example/typeinfo.txt +++ b/test/example/typeinfo.txt @@ -9,8 +9,8 @@ eq eqref (ref eq) i31 -(ref null i31) i31ref +(ref i31) (func) (struct) (array i32) |