diff options
Diffstat (limited to 'test/example')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 22 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 24 |
2 files changed, 15 insertions, 31 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index b1dbae7d5..b0a3ad302 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -205,12 +205,6 @@ void test_types() { BinaryenTypeExpand(externref, &valueType); assert(valueType == externref); - BinaryenType nullref = BinaryenTypeNullref(); - printf(" // BinaryenTypeNullref: %d\n", nullref); - assert(BinaryenTypeArity(nullref) == 1); - BinaryenTypeExpand(nullref, &valueType); - assert(valueType == nullref); - BinaryenType exnref = BinaryenTypeExnref(); printf(" // BinaryenTypeExnref: %d\n", exnref); assert(BinaryenTypeArity(exnref) == 1); @@ -294,9 +288,10 @@ void test_core() { temp10 = makeInt32(module, 1), temp11 = makeInt32(module, 3), temp12 = makeInt32(module, 5), temp13 = makeInt32(module, 10), temp14 = makeInt32(module, 11), temp15 = makeInt32(module, 110), temp16 = makeInt64(module, 111); - BinaryenExpressionRef nullrefExpr = BinaryenRefNull(module); - BinaryenExpressionRef funcrefExpr = - BinaryenRefFunc(module, "kitchen()sinker"); + BinaryenExpressionRef externrefExpr = BinaryenRefNull(module, BinaryenTypeExternref()); + BinaryenExpressionRef funcrefExpr = BinaryenRefNull(module, BinaryenTypeFuncref()); + funcrefExpr = BinaryenRefFunc(module, "kitchen()sinker"); + BinaryenExpressionRef exnrefExpr = BinaryenRefNull(module, BinaryenTypeExnref()); // Events BinaryenAddEvent( @@ -718,10 +713,11 @@ void test_core() { iIfF, BinaryenTypeInt32()), // Reference types - BinaryenRefIsNull(module, nullrefExpr), + BinaryenRefIsNull(module, externrefExpr), BinaryenRefIsNull(module, funcrefExpr), + BinaryenRefIsNull(module, exnrefExpr), BinaryenSelect( - module, temp10, nullrefExpr, funcrefExpr, BinaryenTypeFuncref()), + module, temp10, BinaryenRefNull(module, BinaryenTypeFuncref()), BinaryenRefFunc(module, "kitchen()sinker"), BinaryenTypeFuncref()), // Exception handling BinaryenTry(module, tryBody, catchBody), // Atomics @@ -748,10 +744,6 @@ void test_core() { BinaryenPop(module, BinaryenTypeFloat64()), BinaryenPop(module, BinaryenTypeFuncref()), BinaryenPop(module, BinaryenTypeExternref()), - BinaryenPop(module, BinaryenTypeNullref()), - BinaryenPop(module, BinaryenTypeExnref()), - BinaryenPop(module, BinaryenTypeFuncref()), - BinaryenPop(module, BinaryenTypeNullref()), BinaryenPop(module, BinaryenTypeExnref()), // TODO: Host diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index b0aae7f3b..288174b99 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -7,8 +7,7 @@ // BinaryenTypeVec128: 6 // BinaryenTypeFuncref: 7 // BinaryenTypeExternref: 8 - // BinaryenTypeNullref: 9 - // BinaryenTypeExnref: 10 + // BinaryenTypeExnref: 9 // BinaryenTypeAuto: -1 BinaryenFeatureMVP: 0 BinaryenFeatureAtomics: 1 @@ -1753,7 +1752,7 @@ BinaryenFeatureAll: 1023 ) (drop (ref.is_null - (ref.null) + (ref.null extern) ) ) (drop @@ -1762,8 +1761,13 @@ BinaryenFeatureAll: 1023 ) ) (drop + (ref.is_null + (ref.null exn) + ) + ) + (drop (select (result funcref) - (ref.null) + (ref.null func) (ref.func "$kitchen()sinker") (i32.const 1) ) @@ -1846,18 +1850,6 @@ BinaryenFeatureAll: 1023 (externref.pop) ) (drop - (nullref.pop) - ) - (drop - (exnref.pop) - ) - (drop - (funcref.pop) - ) - (drop - (nullref.pop) - ) - (drop (exnref.pop) ) (nop) |