From 2fd74642c677aeb2454bfefd2405611d3585eb4e Mon Sep 17 00:00:00 2001 From: Jay Phelps Date: Tue, 9 Jun 2020 15:07:46 -0400 Subject: [PATCH] Rename anyref to externref to match proposal change WebAssembly/reference-types#87 --- scripts/gen-s-parser.py | 2 +- scripts/test/shared.py | 2 +- scripts/wasm2js.js | 8 +- src/asmjs/asm_v_wasm.cpp | 4 +- src/binaryen-c.cpp | 6 +- src/binaryen-c.h | 2 +- src/gen-s-parser.inc | 2 +- src/ir/abstract.h | 4 +- src/js/binaryen.js-post.js | 6 +- src/literal.h | 4 +- src/parsing.h | 2 +- src/passes/ConstHoisting.cpp | 2 +- src/passes/Flatten.cpp | 4 +- src/passes/FuncCastEmulation.cpp | 4 +- src/passes/InstrumentLocals.cpp | 24 ++-- src/shell-interface.h | 2 +- src/tools/fuzzing.h | 31 ++-- src/tools/spec-wrapper.h | 2 +- src/tools/wasm-reduce.cpp | 10 +- src/wasm-binary.h | 8 +- src/wasm-builder.h | 2 +- src/wasm-interpreter.h | 4 +- src/wasm-type.h | 2 +- src/wasm/literal.cpp | 22 +-- src/wasm/wasm-binary.cpp | 4 +- src/wasm/wasm-s-parser.cpp | 4 +- src/wasm/wasm-stack.cpp | 6 +- src/wasm/wasm-type.cpp | 18 +-- src/wasm/wasm-validator.cpp | 4 +- test/anyref.wast.from-wast | 19 --- test/anyref.wast.fromBinary | 20 --- test/anyref.wast.fromBinary.noDebugInfo | 20 --- test/binaryen.js/kitchen-sink.js | 6 +- test/binaryen.js/kitchen-sink.js.txt | 8 +- test/example/c-api-kitchen-sink.c | 12 +- test/example/c-api-kitchen-sink.txt | 4 +- test/example/c-api-kitchen-sink.txt.txt | 2 +- test/exception-handling.wast | 2 +- test/exception-handling.wast.from-wast | 4 +- test/exception-handling.wast.fromBinary | 4 +- ...ption-handling.wast.fromBinary.noDebugInfo | 4 +- test/externref.wast.from-wast | 19 +++ test/externref.wast.fromBinary | 20 +++ test/externref.wast.fromBinary.noDebugInfo | 20 +++ test/multivalue.wast | 2 +- test/multivalue.wast.from-wast | 4 +- test/multivalue.wast.fromBinary | 4 +- test/multivalue.wast.fromBinary.noDebugInfo | 4 +- test/passes/flatten_all-features.txt | 8 +- test/passes/flatten_all-features.wast | 4 +- .../passes/flatten_local-cse_all-features.txt | 2 +- .../flatten_local-cse_all-features.wast | 4 +- .../passes/instrument-locals_all-features.txt | 22 +-- .../instrument-locals_all-features.wast | 4 +- test/passes/merge-locals_all-features.txt | 2 +- test/passes/merge-locals_all-features.wast | 2 +- .../optimize-instructions_all-features.txt | 4 +- .../optimize-instructions_all-features.wast | 4 +- test/passes/simplify-globals_all-features.txt | 6 +- .../passes/simplify-globals_all-features.wast | 6 +- ..._roundtrip_print-features_all-features.txt | 6 +- ...roundtrip_print-features_all-features.wast | 4 +- .../passes/translate-to-fuzz_all-features.txt | 18 +-- test/reference-types.wast | 126 ++++++++-------- test/reference-types.wast.from-wast | 134 +++++++++--------- test/reference-types.wast.fromBinary | 82 +++++------ ...eference-types.wast.fromBinary.noDebugInfo | 72 +++++----- test/spec/old_select.wast | 24 ++-- test/spec/ref_func.wast | 4 +- test/spec/ref_is_null.wast | 4 +- test/spec/ref_null.wast | 6 +- test/unit/test_features.py | 12 +- 72 files changed, 469 insertions(+), 464 deletions(-) delete mode 100644 test/anyref.wast.from-wast delete mode 100644 test/anyref.wast.fromBinary delete mode 100644 test/anyref.wast.fromBinary.noDebugInfo create mode 100644 test/externref.wast.from-wast create mode 100644 test/externref.wast.fromBinary create mode 100644 test/externref.wast.fromBinary.noDebugInfo diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py index 80f6911b4bd..7c4fc6e561d 100755 --- a/scripts/gen-s-parser.py +++ b/scripts/gen-s-parser.py @@ -49,7 +49,7 @@ ("f64.pop", "makePop(Type::f64)"), ("v128.pop", "makePop(Type::v128)"), ("funcref.pop", "makePop(Type::funcref)"), - ("anyref.pop", "makePop(Type::anyref)"), + ("externref.pop", "makePop(Type::externref)"), ("nullref.pop", "makePop(Type::nullref)"), ("exnref.pop", "makePop(Type::exnref)"), ("i32.load", "makeLoad(s, Type::i32, /*isAtomic=*/false)"), diff --git a/scripts/test/shared.py b/scripts/test/shared.py index 681694e49d9..62fc6af0b4e 100644 --- a/scripts/test/shared.py +++ b/scripts/test/shared.py @@ -229,7 +229,7 @@ def has_shell_timeout(): '--wasm-staging', '--experimental-wasm-eh', '--experimental-wasm-simd', - '--experimental-wasm-anyref', + '--experimental-wasm-externref', '--experimental-wasm-compilation-hints', '--experimental-wasm-return-call' ] diff --git a/scripts/wasm2js.js b/scripts/wasm2js.js index 1d09c193ab0..bc9ac6cbdbe 100644 --- a/scripts/wasm2js.js +++ b/scripts/wasm2js.js @@ -130,8 +130,8 @@ var asmLibraryArg = { console.log('get_f64 ' + [loc, index, value]); return value; }, - get_anyref: function(loc, index, value) { - console.log('get_anyref ' + [loc, index, value]); + get_externref: function(loc, index, value) { + console.log('get_externref ' + [loc, index, value]); return value; }, get_exnref: function(loc, index, value) { @@ -155,8 +155,8 @@ var asmLibraryArg = { console.log('set_f64 ' + [loc, index, value]); return value; }, - set_anyref: function(loc, index, value) { - console.log('set_anyref ' + [loc, index, value]); + set_externref: function(loc, index, value) { + console.log('set_externref ' + [loc, index, value]); return value; }, set_exnref: function(loc, index, value) { diff --git a/src/asmjs/asm_v_wasm.cpp b/src/asmjs/asm_v_wasm.cpp index 2f86370c1cb..4962a43d8b2 100644 --- a/src/asmjs/asm_v_wasm.cpp +++ b/src/asmjs/asm_v_wasm.cpp @@ -54,7 +54,7 @@ AsmType wasmToAsmType(Type type) { case Type::v128: assert(false && "v128 not implemented yet"); case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: assert(false && "reference types are not supported by asm2wasm"); @@ -80,7 +80,7 @@ char getSig(Type type) { return 'V'; case Type::funcref: return 'F'; - case Type::anyref: + case Type::externref: return 'A'; case Type::nullref: return 'N'; diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index e6155bad353..f4df69737cc 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -72,7 +72,7 @@ BinaryenLiteral toBinaryenLiteral(Literal x) { break; case Type::nullref: break; - case Type::anyref: + case Type::externref: case Type::exnref: case Type::none: case Type::unreachable: @@ -97,7 +97,7 @@ Literal fromBinaryenLiteral(BinaryenLiteral x) { return Literal::makeFuncref(x.func); case Type::nullref: return Literal::makeNullref(); - case Type::anyref: + case Type::externref: case Type::exnref: case Type::none: case Type::unreachable: @@ -131,7 +131,7 @@ BinaryenType BinaryenTypeFloat32(void) { return Type::f32; } BinaryenType BinaryenTypeFloat64(void) { return Type::f64; } BinaryenType BinaryenTypeVec128(void) { return Type::v128; } BinaryenType BinaryenTypeFuncref(void) { return Type::funcref; } -BinaryenType BinaryenTypeAnyref(void) { return Type::anyref; } +BinaryenType BinaryenTypeExternref(void) { return Type::externref; } BinaryenType BinaryenTypeNullref(void) { return Type::nullref; } BinaryenType BinaryenTypeExnref(void) { return Type::exnref; } BinaryenType BinaryenTypeUnreachable(void) { return Type::unreachable; } diff --git a/src/binaryen-c.h b/src/binaryen-c.h index e52d5f46a30..b153a28e98d 100644 --- a/src/binaryen-c.h +++ b/src/binaryen-c.h @@ -99,7 +99,7 @@ BINARYEN_API BinaryenType BinaryenTypeFloat32(void); BINARYEN_API BinaryenType BinaryenTypeFloat64(void); BINARYEN_API BinaryenType BinaryenTypeVec128(void); BINARYEN_API BinaryenType BinaryenTypeFuncref(void); -BINARYEN_API BinaryenType BinaryenTypeAnyref(void); +BINARYEN_API BinaryenType BinaryenTypeExternref(void); BINARYEN_API BinaryenType BinaryenTypeNullref(void); BINARYEN_API BinaryenType BinaryenTypeExnref(void); BINARYEN_API BinaryenType BinaryenTypeUnreachable(void); diff --git a/src/gen-s-parser.inc b/src/gen-s-parser.inc index c7a703aea1c..b501186e4ea 100644 --- a/src/gen-s-parser.inc +++ b/src/gen-s-parser.inc @@ -10,7 +10,7 @@ switch (op[0]) { case 'a': { switch (op[1]) { case 'n': - if (strcmp(op, "anyref.pop") == 0) { return makePop(Type::anyref); } + if (strcmp(op, "externref.pop") == 0) { return makePop(Type::externref); } goto parse_error; case 't': { switch (op[7]) { diff --git a/src/ir/abstract.h b/src/ir/abstract.h index f7bc664dd29..e23ffad17ec 100644 --- a/src/ir/abstract.h +++ b/src/ir/abstract.h @@ -81,7 +81,7 @@ inline UnaryOp getUnary(Type type, Op op) { WASM_UNREACHABLE("v128 not implemented yet"); } case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -214,7 +214,7 @@ inline BinaryOp getBinary(Type type, Op op) { WASM_UNREACHABLE("v128 not implemented yet"); } case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js index dfdb0545737..99fb54350ac 100644 --- a/src/js/binaryen.js-post.js +++ b/src/js/binaryen.js-post.js @@ -39,7 +39,7 @@ function initializeConstants() { ['f64', 'Float64'], ['v128', 'Vec128'], ['funcref', 'Funcref'], - ['anyref', 'Anyref'], + ['externref', 'Externref'], ['nullref', 'Nullref'], ['exnref', 'Exnref'], ['unreachable', 'Unreachable'], @@ -2071,9 +2071,9 @@ function wrapModule(module, self) { } }; - self['anyref'] = { + self['externref'] = { 'pop': function() { - return Module['_BinaryenPop'](module, Module['anyref']); + return Module['_BinaryenPop'](module, Module['externref']); } }; diff --git a/src/literal.h b/src/literal.h index 8bfee38c12d..4f936153de8 100644 --- a/src/literal.h +++ b/src/literal.h @@ -100,7 +100,7 @@ class Literal { Literal(int32_t(0)), Literal(int32_t(0))}}); case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -562,7 +562,7 @@ template<> struct less { case wasm::Type::v128: return memcmp(a.getv128Ptr(), b.getv128Ptr(), 16) < 0; case wasm::Type::funcref: - case wasm::Type::anyref: + case wasm::Type::externref: case wasm::Type::nullref: case wasm::Type::exnref: case wasm::Type::none: diff --git a/src/parsing.h b/src/parsing.h index e9b422b9008..fe2889a26ca 100644 --- a/src/parsing.h +++ b/src/parsing.h @@ -264,7 +264,7 @@ parseConst(cashew::IString s, Type type, MixedArena& allocator) { } case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: WASM_UNREACHABLE("unexpected const type"); diff --git a/src/passes/ConstHoisting.cpp b/src/passes/ConstHoisting.cpp index 43c8ccaa7b8..5009cd36451 100644 --- a/src/passes/ConstHoisting.cpp +++ b/src/passes/ConstHoisting.cpp @@ -94,7 +94,7 @@ struct ConstHoisting : public WalkerPass> { // not implemented yet case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: { return false; diff --git a/src/passes/Flatten.cpp b/src/passes/Flatten.cpp index 55ee00936d9..54da8a86e41 100644 --- a/src/passes/Flatten.cpp +++ b/src/passes/Flatten.cpp @@ -211,7 +211,7 @@ struct Flatten // the return type of the block this branch is targetting, which may // not be the same with the innermost block's return type. For // example, - // (block $any (result anyref) + // (block $any (result externref) // (block (result nullref) // (local.tee $0 // (br_if $any @@ -222,7 +222,7 @@ struct Flatten // ) // ) // In this case we need two locals to store (ref.null); one with - // anyref type that's for the target block ($label0) and one more + // externref type that's for the target block ($label0) and one more // with nullref type in case for flowing out. Here we create the // second 'flowing out' local in case two block's types are // different. diff --git a/src/passes/FuncCastEmulation.cpp b/src/passes/FuncCastEmulation.cpp index 1fdf97c7bea..93106b5efd8 100644 --- a/src/passes/FuncCastEmulation.cpp +++ b/src/passes/FuncCastEmulation.cpp @@ -66,7 +66,7 @@ static Expression* toABI(Expression* value, Module* module) { WASM_UNREACHABLE("v128 not implemented yet"); } case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: { WASM_UNREACHABLE("reference types cannot be converted to i64"); @@ -110,7 +110,7 @@ static Expression* fromABI(Expression* value, Type type, Module* module) { WASM_UNREACHABLE("v128 not implemented yet"); } case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: { WASM_UNREACHABLE("reference types cannot be converted from i64"); diff --git a/src/passes/InstrumentLocals.cpp b/src/passes/InstrumentLocals.cpp index 256ade4bc7b..aa3df95adc0 100644 --- a/src/passes/InstrumentLocals.cpp +++ b/src/passes/InstrumentLocals.cpp @@ -57,7 +57,7 @@ Name get_i64("get_i64"); Name get_f32("get_f32"); Name get_f64("get_f64"); Name get_funcref("get_funcref"); -Name get_anyref("get_anyref"); +Name get_externref("get_externref"); Name get_nullref("get_nullref"); Name get_exnref("get_exnref"); @@ -66,7 +66,7 @@ Name set_i64("set_i64"); Name set_f32("set_f32"); Name set_f64("set_f64"); Name set_funcref("set_funcref"); -Name set_anyref("set_anyref"); +Name set_externref("set_externref"); Name set_nullref("set_nullref"); Name set_exnref("set_exnref"); @@ -91,8 +91,8 @@ struct InstrumentLocals : public WalkerPass> { case Type::funcref: import = get_funcref; break; - case Type::anyref: - import = get_anyref; + case Type::externref: + import = get_externref; break; case Type::nullref: import = get_nullref; @@ -139,8 +139,8 @@ struct InstrumentLocals : public WalkerPass> { case Type::funcref: import = set_funcref; break; - case Type::anyref: - import = set_anyref; + case Type::externref: + import = set_externref; break; case Type::nullref: import = set_nullref; @@ -180,10 +180,14 @@ struct InstrumentLocals : public WalkerPass> { set_funcref, {Type::i32, Type::i32, Type::funcref}, Type::funcref); - addImport( - curr, get_anyref, {Type::i32, Type::i32, Type::anyref}, Type::anyref); - addImport( - curr, set_anyref, {Type::i32, Type::i32, Type::anyref}, Type::anyref); + addImport(curr, + get_externref, + {Type::i32, Type::i32, Type::externref}, + Type::externref); + addImport(curr, + set_externref, + {Type::i32, Type::i32, Type::externref}, + Type::externref); addImport(curr, get_nullref, {Type::i32, Type::i32, Type::nullref}, diff --git a/src/shell-interface.h b/src/shell-interface.h index 8c5793bfccc..b4de73c6fc3 100644 --- a/src/shell-interface.h +++ b/src/shell-interface.h @@ -115,7 +115,7 @@ struct ShellExternalInterface : ModuleInstance::ExternalInterface { case Type::v128: assert(false && "v128 not implemented yet"); case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: globals[import->name] = {Literal::makeNullref()}; diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index 9788d9f11a1..63f4b5a85a5 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -316,7 +316,7 @@ class TranslateToFuzzReader { SmallVector options; options.push_back(type); // includes itself switch (type.getSingle()) { - case Type::anyref: + case Type::externref: if (wasm.features.hasExceptionHandling()) { options.push_back(Type::exnref); } @@ -1364,7 +1364,7 @@ class TranslateToFuzzReader { 16, false, offset, pick(1, 2, 4, 8, 16), ptr, type); } case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -1468,7 +1468,7 @@ class TranslateToFuzzReader { 16, offset, pick(1, 2, 4, 8, 16), ptr, value, type); } case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -1565,7 +1565,7 @@ class TranslateToFuzzReader { return Literal(getDouble()); case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -1610,7 +1610,7 @@ class TranslateToFuzzReader { return Literal(double(small)); case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -1678,7 +1678,7 @@ class TranslateToFuzzReader { break; case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -1712,7 +1712,7 @@ class TranslateToFuzzReader { break; case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -1824,7 +1824,7 @@ class TranslateToFuzzReader { make(Type::v128)}); } case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: return makeTrivial(type); @@ -1969,7 +1969,7 @@ class TranslateToFuzzReader { WASM_UNREACHABLE("invalid value"); } case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -2206,7 +2206,7 @@ class TranslateToFuzzReader { make(Type::v128)}); } case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -2413,7 +2413,7 @@ class TranslateToFuzzReader { break; case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -2588,9 +2588,10 @@ class TranslateToFuzzReader { assert(wasm.features.hasReferenceTypes()); Type refType; if (wasm.features.hasExceptionHandling()) { - refType = pick(Type::funcref, Type::anyref, Type::nullref, Type::exnref); + refType = + pick(Type::funcref, Type::externref, Type::nullref, Type::exnref); } else { - refType = pick(Type::funcref, Type::anyref, Type::nullref); + refType = pick(Type::funcref, Type::externref, Type::nullref); } return builder.makeRefIsNull(make(refType)); } @@ -2657,7 +2658,7 @@ class TranslateToFuzzReader { .add(FeatureSet::SIMD, Type::v128) .add(FeatureSet::ReferenceTypes, Type::funcref, - Type::anyref, + Type::externref, Type::nullref) .add(FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling, Type::exnref)); @@ -2700,7 +2701,7 @@ class TranslateToFuzzReader { // - funcref cannot be logged because referenced functions can be inlined or // removed during optimization - // - there's no point in logging anyref because it is opaque + // - there's no point in logging externref because it is opaque // - don't bother logging tuples std::vector getLoggableTypes() { return items( diff --git a/src/tools/spec-wrapper.h b/src/tools/spec-wrapper.h index c6b6cc9c93f..a77dfc43f21 100644 --- a/src/tools/spec-wrapper.h +++ b/src/tools/spec-wrapper.h @@ -49,7 +49,7 @@ static std::string generateSpecWrapper(Module& wasm) { ret += "(v128.const i32x4 0 0 0 0)"; break; case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: ret += "(ref.null)"; diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp index d55dab893be..ab593c76c0f 100644 --- a/src/tools/wasm-reduce.cpp +++ b/src/tools/wasm-reduce.cpp @@ -594,7 +594,7 @@ struct Reducer break; case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: continue; // not implemented yet @@ -619,7 +619,7 @@ struct Reducer break; case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: continue; // not implemented yet @@ -644,7 +644,7 @@ struct Reducer break; case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: continue; // not implemented yet @@ -669,7 +669,7 @@ struct Reducer WASM_UNREACHABLE("unexpected type"); case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: continue; // not implemented yet @@ -681,7 +681,7 @@ struct Reducer } case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: continue; // not implemented yet diff --git a/src/wasm-binary.h b/src/wasm-binary.h index b8d14377d13..db93c86de10 100644 --- a/src/wasm-binary.h +++ b/src/wasm-binary.h @@ -345,8 +345,8 @@ enum EncodedType { v128 = -0x5, // 0x7b // function reference type funcref = -0x10, // 0x70 - // opaque reference type - anyref = -0x11, // 0x6f + // opaque host reference type + externref = -0x11, // 0x6f // null reference type nullref = -0x12, // 0x6e // exception reference type @@ -961,8 +961,8 @@ inline S32LEB binaryType(Type type) { case Type::funcref: ret = BinaryConsts::EncodedType::funcref; break; - case Type::anyref: - ret = BinaryConsts::EncodedType::anyref; + case Type::externref: + ret = BinaryConsts::EncodedType::externref; break; case Type::nullref: ret = BinaryConsts::EncodedType::nullref; diff --git a/src/wasm-builder.h b/src/wasm-builder.h index 5df512745f0..5c6792a82b2 100644 --- a/src/wasm-builder.h +++ b/src/wasm-builder.h @@ -818,7 +818,7 @@ class Builder { break; } case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: return ExpressionManipulator::refNull(curr); diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h index 86ea7e146ea..124ba9aae6f 100644 --- a/src/wasm-interpreter.h +++ b/src/wasm-interpreter.h @@ -1642,7 +1642,7 @@ template class ModuleInstanceBase { case Type::v128: return Literal(load128(addr).data()); case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -1699,7 +1699,7 @@ template class ModuleInstanceBase { store128(addr, value.getv128()); break; case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: diff --git a/src/wasm-type.h b/src/wasm-type.h index cfd47a8e0bf..b0cfa40941a 100644 --- a/src/wasm-type.h +++ b/src/wasm-type.h @@ -41,7 +41,7 @@ class Type { f64, v128, funcref, - anyref, + externref, nullref, exnref, _last_value_type = exnref diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp index 5aebf30a337..29d0477232e 100644 --- a/src/wasm/literal.cpp +++ b/src/wasm/literal.cpp @@ -59,7 +59,7 @@ Literal& Literal::operator=(const Literal& other) { case Type::none: case Type::nullref: break; - case Type::anyref: + case Type::externref: case Type::unreachable: WASM_UNREACHABLE("unexpected type"); } @@ -191,7 +191,7 @@ void Literal::getBits(uint8_t (&buf)[16]) const { case Type::funcref: case Type::nullref: break; - case Type::anyref: + case Type::externref: case Type::exnref: case Type::none: case Type::unreachable: @@ -346,7 +346,7 @@ std::ostream& operator<<(std::ostream& o, Literal literal) { case Type::exnref: o << "exnref(" << literal.getExceptionPackage() << ")"; break; - case Type::anyref: + case Type::externref: case Type::unreachable: WASM_UNREACHABLE("invalid type"); } @@ -569,7 +569,7 @@ Literal Literal::eqz() const { return eq(Literal(double(0))); case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -591,7 +591,7 @@ Literal Literal::neg() const { return Literal(int64_t(i64 ^ 0x8000000000000000ULL)).castToF64(); case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -613,7 +613,7 @@ Literal Literal::abs() const { return Literal(int64_t(i64 & 0x7fffffffffffffffULL)).castToF64(); case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -718,7 +718,7 @@ Literal Literal::add(const Literal& other) const { return Literal(getf64() + other.getf64()); case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -740,7 +740,7 @@ Literal Literal::sub(const Literal& other) const { return Literal(getf64() - other.getf64()); case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -833,7 +833,7 @@ Literal Literal::mul(const Literal& other) const { return Literal(getf64() * other.getf64()); case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -1071,7 +1071,7 @@ Literal Literal::eq(const Literal& other) const { return Literal(getf64() == other.getf64()); case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -1093,7 +1093,7 @@ Literal Literal::ne(const Literal& other) const { return Literal(getf64() != other.getf64()); case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index a766e9b6330..8a7f0d744f5 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -1132,8 +1132,8 @@ Type WasmBinaryBuilder::getType() { return Type::v128; case BinaryConsts::EncodedType::funcref: return Type::funcref; - case BinaryConsts::EncodedType::anyref: - return Type::anyref; + case BinaryConsts::EncodedType::externref: + return Type::externref; case BinaryConsts::EncodedType::nullref: return Type::nullref; case BinaryConsts::EncodedType::exnref: diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index 7ca8dd131ba..429cac27343 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -866,8 +866,8 @@ Type SExpressionWasmBuilder::stringToType(const char* str, if (strncmp(str, "funcref", 7) == 0 && (prefix || str[7] == 0)) { return Type::funcref; } - if (strncmp(str, "anyref", 6) == 0 && (prefix || str[6] == 0)) { - return Type::anyref; + if (strncmp(str, "externref", 9) == 0 && (prefix || str[9] == 0)) { + return Type::externref; } if (strncmp(str, "nullref", 7) == 0 && (prefix || str[7] == 0)) { return Type::nullref; diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp index 9ebf39fb894..c6c450cfba0 100644 --- a/src/wasm/wasm-stack.cpp +++ b/src/wasm/wasm-stack.cpp @@ -188,7 +188,7 @@ void BinaryInstWriter::visitLoad(Load* curr) { // a load return; case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -290,7 +290,7 @@ void BinaryInstWriter::visitStore(Store* curr) { << U32LEB(BinaryConsts::V128Store); break; case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -687,7 +687,7 @@ void BinaryInstWriter::visitConst(Const* curr) { break; } case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp index 8467e217677..b49f0338f38 100644 --- a/src/wasm/wasm-type.cpp +++ b/src/wasm/wasm-type.cpp @@ -64,7 +64,7 @@ std::array, Type::_last_value_type + 1> basicTypes = { {Type::f64}, {Type::v128}, {Type::funcref}, - {Type::anyref}, + {Type::externref}, {Type::nullref}, {Type::exnref}}}; @@ -81,7 +81,7 @@ std::unordered_map, uintptr_t> indices = { {{Type::f64}, Type::f64}, {{Type::v128}, Type::v128}, {{Type::funcref}, Type::funcref}, - {{Type::anyref}, Type::anyref}, + {{Type::externref}, Type::externref}, {{Type::nullref}, Type::nullref}, {{Type::exnref}, Type::exnref}, }; @@ -156,7 +156,7 @@ unsigned Type::getByteSize() const { case Type::v128: return 16; case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -191,7 +191,7 @@ Type Type::reinterpret() const { return i64; case Type::v128: case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -207,7 +207,7 @@ FeatureSet Type::getFeatures() const { case Type::v128: return FeatureSet::SIMD; case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: return FeatureSet::ReferenceTypes; case Type::exnref: @@ -249,7 +249,7 @@ bool Type::isSubType(Type left, Type right) { return true; } if (left.isRef() && right.isRef() && - (right == Type::anyref || left == Type::nullref)) { + (right == Type::externref || left == Type::nullref)) { return true; } if (left.isMulti() && right.isMulti()) { @@ -303,7 +303,7 @@ Type Type::getLeastUpperBound(Type a, Type b) { if (b == Type::nullref) { return a; } - return Type::anyref; + return Type::externref; } namespace { @@ -379,8 +379,8 @@ std::ostream& operator<<(std::ostream& os, Type type) { case Type::funcref: os << "funcref"; break; - case Type::anyref: - os << "anyref"; + case Type::externref: + os << "externref"; break; case Type::nullref: os << "nullref"; diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 97e45d47101..2c2aac1c862 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -1260,7 +1260,7 @@ void FunctionValidator::validateMemBytes(uint8_t bytes, case Type::unreachable: break; case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: @@ -2068,7 +2068,7 @@ void FunctionValidator::validateAlignment( case Type::unreachable: break; case Type::funcref: - case Type::anyref: + case Type::externref: case Type::nullref: case Type::exnref: case Type::none: diff --git a/test/anyref.wast.from-wast b/test/anyref.wast.from-wast deleted file mode 100644 index 121a4616a51..00000000000 --- a/test/anyref.wast.from-wast +++ /dev/null @@ -1,19 +0,0 @@ -(module - (type $anyref_=>_anyref (func (param anyref) (result anyref))) - (import "env" "test2" (global $test2 anyref)) - (import "env" "test1" (func $test1 (param anyref) (result anyref))) - (memory $0 1 1) - (export "test1" (func $test1)) - (export "test2" (global $test2)) - (func $anyref_test (; 1 ;) (param $0 anyref) (result anyref) - (local $1 anyref) - (local.set $1 - (call $test1 - (local.get $0) - ) - ) - (return - (local.get $1) - ) - ) -) diff --git a/test/anyref.wast.fromBinary b/test/anyref.wast.fromBinary deleted file mode 100644 index 374a308e721..00000000000 --- a/test/anyref.wast.fromBinary +++ /dev/null @@ -1,20 +0,0 @@ -(module - (type $anyref_=>_anyref (func (param anyref) (result anyref))) - (import "env" "test2" (global $gimport$1 anyref)) - (import "env" "test1" (func $test1 (param anyref) (result anyref))) - (memory $0 1 1) - (export "test1" (func $test1)) - (export "test2" (global $gimport$1)) - (func $anyref_test (; 1 ;) (param $0 anyref) (result anyref) - (local $1 anyref) - (local.set $1 - (call $test1 - (local.get $0) - ) - ) - (return - (local.get $1) - ) - ) -) - diff --git a/test/anyref.wast.fromBinary.noDebugInfo b/test/anyref.wast.fromBinary.noDebugInfo deleted file mode 100644 index 2f532e6f17f..00000000000 --- a/test/anyref.wast.fromBinary.noDebugInfo +++ /dev/null @@ -1,20 +0,0 @@ -(module - (type $anyref_=>_anyref (func (param anyref) (result anyref))) - (import "env" "test2" (global $gimport$1 anyref)) - (import "env" "test1" (func $fimport$0 (param anyref) (result anyref))) - (memory $0 1 1) - (export "test1" (func $fimport$0)) - (export "test2" (global $gimport$1)) - (func $0 (; 1 ;) (param $0 anyref) (result anyref) - (local $1 anyref) - (local.set $1 - (call $fimport$0 - (local.get $0) - ) - ) - (return - (local.get $1) - ) - ) -) - diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js index cd3af675023..93ed273340b 100644 --- a/test/binaryen.js/kitchen-sink.js +++ b/test/binaryen.js/kitchen-sink.js @@ -68,8 +68,8 @@ function test_types() { console.log(" // BinaryenTypeVec128: " + binaryen.v128); console.log(" //", binaryen.expandType(binaryen.v128)); - console.log(" // BinaryenTypeAnyref: " + binaryen.anyref); - console.log(" //", binaryen.expandType(binaryen.anyref)); + console.log(" // BinaryenTypeExternref: " + binaryen.externref); + console.log(" //", binaryen.expandType(binaryen.externref)); console.log(" // BinaryenTypeExnref: " + binaryen.exnref); console.log(" //", binaryen.expandType(binaryen.exnref)); @@ -561,7 +561,7 @@ function test_core() { module.f32.pop(), module.f64.pop(), module.v128.pop(), - module.anyref.pop(), + module.externref.pop(), module.funcref.pop(), module.nullref.pop(), module.exnref.pop(), diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index d81ea53125a..9f8ac58783e 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -12,7 +12,7 @@ // [ 5 ] // BinaryenTypeVec128: 6 // [ 6 ] - // BinaryenTypeAnyref: 8 + // BinaryenTypeExternref: 8 // [ 8 ] // BinaryenTypeExnref: 10 // [ 10 ] @@ -1901,7 +1901,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (v128.pop) ) (drop - (anyref.pop) + (externref.pop) ) (drop (funcref.pop) @@ -3739,7 +3739,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (v128.pop) ) (drop - (anyref.pop) + (externref.pop) ) (drop (funcref.pop) @@ -4270,7 +4270,7 @@ module loaded from binary form: ) ) -[wasm-validator error in function func] local.set's value type must be correct, on +[wasm-validator error in function func] local.set's value type must be correct, on [none] (local.set $0 [i64] (i64.const 1234) ) diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 1f6ffc9fc00..b1dbae7d53b 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -199,11 +199,11 @@ void test_types() { BinaryenTypeExpand(funcref, &valueType); assert(valueType == funcref); - BinaryenType anyref = BinaryenTypeAnyref(); - printf(" // BinaryenTypeAnyref: %d\n", anyref); - assert(BinaryenTypeArity(anyref) == 1); - BinaryenTypeExpand(anyref, &valueType); - assert(valueType == anyref); + BinaryenType externref = BinaryenTypeExternref(); + printf(" // BinaryenTypeExternref: %d\n", externref); + assert(BinaryenTypeArity(externref) == 1); + BinaryenTypeExpand(externref, &valueType); + assert(valueType == externref); BinaryenType nullref = BinaryenTypeNullref(); printf(" // BinaryenTypeNullref: %d\n", nullref); @@ -747,7 +747,7 @@ void test_core() { BinaryenPop(module, BinaryenTypeFloat32()), BinaryenPop(module, BinaryenTypeFloat64()), BinaryenPop(module, BinaryenTypeFuncref()), - BinaryenPop(module, BinaryenTypeAnyref()), + BinaryenPop(module, BinaryenTypeExternref()), BinaryenPop(module, BinaryenTypeNullref()), BinaryenPop(module, BinaryenTypeExnref()), BinaryenPop(module, BinaryenTypeFuncref()), diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index ff9256fda81..b0aae7f3b30 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -6,7 +6,7 @@ // BinaryenTypeFloat64: 5 // BinaryenTypeVec128: 6 // BinaryenTypeFuncref: 7 - // BinaryenTypeAnyref: 8 + // BinaryenTypeExternref: 8 // BinaryenTypeNullref: 9 // BinaryenTypeExnref: 10 // BinaryenTypeAuto: -1 @@ -1843,7 +1843,7 @@ BinaryenFeatureAll: 1023 (funcref.pop) ) (drop - (anyref.pop) + (externref.pop) ) (drop (nullref.pop) diff --git a/test/example/c-api-kitchen-sink.txt.txt b/test/example/c-api-kitchen-sink.txt.txt index 44ac3320a04..d3cc32e8da8 100644 --- a/test/example/c-api-kitchen-sink.txt.txt +++ b/test/example/c-api-kitchen-sink.txt.txt @@ -1739,7 +1739,7 @@ (funcref.pop) ) (push - (anyref.pop) + (externref.pop) ) (push (nullref.pop) diff --git a/test/exception-handling.wast b/test/exception-handling.wast index 57766c2d300..7f16a237b02 100644 --- a/test/exception-handling.wast +++ b/test/exception-handling.wast @@ -1,6 +1,6 @@ (module (event $e0 (attr 0) (param i32)) - (event $e1 (attr 0) (param anyref)) + (event $e1 (attr 0) (param externref)) (func $exnref_test (param $0 exnref) (result exnref) (local.get $0) diff --git a/test/exception-handling.wast.from-wast b/test/exception-handling.wast.from-wast index 05993022c36..4430bf0f0af 100644 --- a/test/exception-handling.wast.from-wast +++ b/test/exception-handling.wast.from-wast @@ -1,10 +1,10 @@ (module (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) - (type $anyref_=>_none (func (param anyref))) + (type $externref_=>_none (func (param externref))) (type $exnref_=>_exnref (func (param exnref) (result exnref))) (event $e0 (attr 0) (param i32)) - (event $e1 (attr 0) (param anyref)) + (event $e1 (attr 0) (param externref)) (func $exnref_test (param $0 exnref) (result exnref) (local.get $0) ) diff --git a/test/exception-handling.wast.fromBinary b/test/exception-handling.wast.fromBinary index 9c4ebad3b1c..fc3dc38041d 100644 --- a/test/exception-handling.wast.fromBinary +++ b/test/exception-handling.wast.fromBinary @@ -1,10 +1,10 @@ (module (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) - (type $anyref_=>_none (func (param anyref))) + (type $externref_=>_none (func (param externref))) (type $exnref_=>_exnref (func (param exnref) (result exnref))) (event $event$0 (attr 0) (param i32)) - (event $event$1 (attr 0) (param anyref)) + (event $event$1 (attr 0) (param externref)) (func $exnref_test (param $0 exnref) (result exnref) (local.get $0) ) diff --git a/test/exception-handling.wast.fromBinary.noDebugInfo b/test/exception-handling.wast.fromBinary.noDebugInfo index 97bda57c4da..96cc9c4c6ea 100644 --- a/test/exception-handling.wast.fromBinary.noDebugInfo +++ b/test/exception-handling.wast.fromBinary.noDebugInfo @@ -1,10 +1,10 @@ (module (type $none_=>_none (func)) (type $i32_=>_none (func (param i32))) - (type $anyref_=>_none (func (param anyref))) + (type $externref_=>_none (func (param externref))) (type $exnref_=>_exnref (func (param exnref) (result exnref))) (event $event$0 (attr 0) (param i32)) - (event $event$1 (attr 0) (param anyref)) + (event $event$1 (attr 0) (param externref)) (func $0 (param $0 exnref) (result exnref) (local.get $0) ) diff --git a/test/externref.wast.from-wast b/test/externref.wast.from-wast new file mode 100644 index 00000000000..514123aabb1 --- /dev/null +++ b/test/externref.wast.from-wast @@ -0,0 +1,19 @@ +(module + (type $externref_=>_externref (func (param externref) (result externref))) + (import "env" "test2" (global $test2 externref)) + (import "env" "test1" (func $test1 (param externref) (result externref))) + (memory $0 1 1) + (export "test1" (func $test1)) + (export "test2" (global $test2)) + (func $externref_test (; 1 ;) (param $0 externref) (result externref) + (local $1 externref) + (local.set $1 + (call $test1 + (local.get $0) + ) + ) + (return + (local.get $1) + ) + ) +) diff --git a/test/externref.wast.fromBinary b/test/externref.wast.fromBinary new file mode 100644 index 00000000000..ab2d2f96398 --- /dev/null +++ b/test/externref.wast.fromBinary @@ -0,0 +1,20 @@ +(module + (type $externref_=>_externref (func (param externref) (result externref))) + (import "env" "test2" (global $gimport$1 externref)) + (import "env" "test1" (func $test1 (param externref) (result externref))) + (memory $0 1 1) + (export "test1" (func $test1)) + (export "test2" (global $gimport$1)) + (func $externref_test (; 1 ;) (param $0 externref) (result externref) + (local $1 externref) + (local.set $1 + (call $test1 + (local.get $0) + ) + ) + (return + (local.get $1) + ) + ) +) + diff --git a/test/externref.wast.fromBinary.noDebugInfo b/test/externref.wast.fromBinary.noDebugInfo new file mode 100644 index 00000000000..44d9029bef7 --- /dev/null +++ b/test/externref.wast.fromBinary.noDebugInfo @@ -0,0 +1,20 @@ +(module + (type $externref_=>_externref (func (param externref) (result externref))) + (import "env" "test2" (global $gimport$1 externref)) + (import "env" "test1" (func $fimport$0 (param externref) (result externref))) + (memory $0 1 1) + (export "test1" (func $fimport$0)) + (export "test2" (global $gimport$1)) + (func $0 (; 1 ;) (param $0 externref) (result externref) + (local $1 externref) + (local.set $1 + (call $fimport$0 + (local.get $0) + ) + ) + (return + (local.get $1) + ) + ) +) + diff --git a/test/multivalue.wast b/test/multivalue.wast index d740d384f45..01e1237f37f 100644 --- a/test/multivalue.wast +++ b/test/multivalue.wast @@ -128,7 +128,7 @@ ) ) ) - (func $mv-if (result i32 i64 anyref) + (func $mv-if (result i32 i64 externref) (if (result i32 i64 nullref) (i32.const 1) (tuple.make diff --git a/test/multivalue.wast.from-wast b/test/multivalue.wast.from-wast index 480bf775f9a..db0a4b2d0ab 100644 --- a/test/multivalue.wast.from-wast +++ b/test/multivalue.wast.from-wast @@ -5,7 +5,7 @@ (type $none_=>_f32_i64_i32 (func (result f32 i64 i32))) (type $none_=>_i32 (func (result i32))) (type $none_=>_i32_i64_f32 (func (result i32 i64 f32))) - (type $none_=>_i32_i64_anyref (func (result i32 i64 anyref))) + (type $none_=>_i32_i64_externref (func (result i32 i64 externref))) (type $none_=>_i32_i64_nullref (func (result i32 i64 nullref))) (type $none_=>_f32 (func (result f32))) (import "env" "pair" (func $pair (result i32 i64))) @@ -136,7 +136,7 @@ ) ) ) - (func $mv-if (result i32 i64 anyref) + (func $mv-if (result i32 i64 externref) (if (result i32 i64 nullref) (i32.const 1) (tuple.make diff --git a/test/multivalue.wast.fromBinary b/test/multivalue.wast.fromBinary index b18c403c8b6..190194fcf2c 100644 --- a/test/multivalue.wast.fromBinary +++ b/test/multivalue.wast.fromBinary @@ -1,7 +1,7 @@ (module (type $none_=>_i32_i64 (func (result i32 i64))) (type $none_=>_none (func)) - (type $none_=>_i32_i64_anyref (func (result i32 i64 anyref))) + (type $none_=>_i32_i64_externref (func (result i32 i64 externref))) (type $none_=>_i64 (func (result i64))) (type $none_=>_f32_i64_i32 (func (result f32 i64 i32))) (type $none_=>_i32 (func (result i32))) @@ -390,7 +390,7 @@ ) ) ) - (func $mv-if (result i32 i64 anyref) + (func $mv-if (result i32 i64 externref) (local $0 (i32 i64 nullref)) (local.set $0 (if (result i32 i64 nullref) diff --git a/test/multivalue.wast.fromBinary.noDebugInfo b/test/multivalue.wast.fromBinary.noDebugInfo index 3b696393db7..226490f2689 100644 --- a/test/multivalue.wast.fromBinary.noDebugInfo +++ b/test/multivalue.wast.fromBinary.noDebugInfo @@ -1,7 +1,7 @@ (module (type $none_=>_i32_i64 (func (result i32 i64))) (type $none_=>_none (func)) - (type $none_=>_i32_i64_anyref (func (result i32 i64 anyref))) + (type $none_=>_i32_i64_externref (func (result i32 i64 externref))) (type $none_=>_i64 (func (result i64))) (type $none_=>_f32_i64_i32 (func (result f32 i64 i32))) (type $none_=>_i32 (func (result i32))) @@ -390,7 +390,7 @@ ) ) ) - (func $14 (result i32 i64 anyref) + (func $14 (result i32 i64 externref) (local $0 (i32 i64 nullref)) (local.set $0 (if (result i32 i64 nullref) diff --git a/test/passes/flatten_all-features.txt b/test/passes/flatten_all-features.txt index c633eccc8d7..e52f9e82612 100644 --- a/test/passes/flatten_all-features.txt +++ b/test/passes/flatten_all-features.txt @@ -5,7 +5,7 @@ (type $i32_=>_i32 (func (param i32) (result i32))) (type $none_=>_f32 (func (result f32))) (type $i64_i64_=>_i64 (func (param i64 i64) (result i64))) - (type $none_=>_anyref (func (result anyref))) + (type $none_=>_externref (func (result externref))) (memory $0 10) (table $0 1 1 funcref) (elem (i32.const 0) $call-me) @@ -2376,15 +2376,15 @@ ) (unreachable) ) - (func $subtype (result anyref) + (func $subtype (result externref) (local $0 nullref) - (local $1 anyref) + (local $1 externref) (local $2 nullref) (local $3 nullref) (local $4 nullref) (local $5 nullref) (local $6 nullref) - (local $7 anyref) + (local $7 externref) (block $label0 (block $block (local.set $1 diff --git a/test/passes/flatten_all-features.wast b/test/passes/flatten_all-features.wast index 461ce61706d..f07175bd2d2 100644 --- a/test/passes/flatten_all-features.wast +++ b/test/passes/flatten_all-features.wast @@ -1027,8 +1027,8 @@ ;; targets an outer branch whose return type is a supertype of the br_if's ;; value type, we need the value to be set into two locals: one with the outer ;; block's type, and one with its value type. - (func $subtype (result anyref) (local $0 nullref) - (block $label0 (result anyref) + (func $subtype (result externref) (local $0 nullref) + (block $label0 (result externref) (block (result nullref) (local.tee $0 (br_if $label0 diff --git a/test/passes/flatten_local-cse_all-features.txt b/test/passes/flatten_local-cse_all-features.txt index c80611abe69..5f3adace77c 100644 --- a/test/passes/flatten_local-cse_all-features.txt +++ b/test/passes/flatten_local-cse_all-features.txt @@ -794,7 +794,7 @@ ) ) (func $test - (local $0 anyref) + (local $0 externref) (local $1 nullref) (local $2 nullref) (block $label$1 diff --git a/test/passes/flatten_local-cse_all-features.wast b/test/passes/flatten_local-cse_all-features.wast index 112dfe64738..1b4dc37c2e0 100644 --- a/test/passes/flatten_local-cse_all-features.wast +++ b/test/passes/flatten_local-cse_all-features.wast @@ -300,7 +300,7 @@ ) (func $test - (local $0 anyref) + (local $0 externref) (drop (block $label$1 (result nullref) (local.set $0 @@ -308,7 +308,7 @@ ) ;; After --flatten, this will be assigned to a local of nullref type. After ;; --local-cse, even if we set (ref.null) to local $0 above, this should not - ;; be replaced with $0, because it is of type anyref. + ;; be replaced with $0, because it is of type externref. (ref.null) ) ) diff --git a/test/passes/instrument-locals_all-features.txt b/test/passes/instrument-locals_all-features.txt index 2627c9cdeb7..be07240ac93 100644 --- a/test/passes/instrument-locals_all-features.txt +++ b/test/passes/instrument-locals_all-features.txt @@ -4,7 +4,7 @@ (type $i32_i32_f32_=>_f32 (func (param i32 i32 f32) (result f32))) (type $i32_i32_f64_=>_f64 (func (param i32 i32 f64) (result f64))) (type $i32_i32_funcref_=>_funcref (func (param i32 i32 funcref) (result funcref))) - (type $i32_i32_anyref_=>_anyref (func (param i32 i32 anyref) (result anyref))) + (type $i32_i32_externref_=>_externref (func (param i32 i32 externref) (result externref))) (type $i32_i32_nullref_=>_nullref (func (param i32 i32 nullref) (result nullref))) (type $i32_i32_exnref_=>_exnref (func (param i32 i32 exnref) (result exnref))) (type $none_=>_none (func)) @@ -18,8 +18,8 @@ (import "env" "set_f64" (func $set_f64 (param i32 i32 f64) (result f64))) (import "env" "get_funcref" (func $get_funcref (param i32 i32 funcref) (result funcref))) (import "env" "set_funcref" (func $set_funcref (param i32 i32 funcref) (result funcref))) - (import "env" "get_anyref" (func $get_anyref (param i32 i32 anyref) (result anyref))) - (import "env" "set_anyref" (func $set_anyref (param i32 i32 anyref) (result anyref))) + (import "env" "get_externref" (func $get_externref (param i32 i32 externref) (result externref))) + (import "env" "set_externref" (func $set_externref (param i32 i32 externref) (result externref))) (import "env" "get_nullref" (func $get_nullref (param i32 i32 nullref) (result nullref))) (import "env" "set_nullref" (func $set_nullref (param i32 i32 nullref) (result nullref))) (import "env" "get_exnref" (func $get_exnref (param i32 i32 exnref) (result exnref))) @@ -30,7 +30,7 @@ (local $z f32) (local $w f64) (local $F funcref) - (local $A anyref) + (local $A externref) (local $N nullref) (local $E exnref) (drop @@ -65,7 +65,7 @@ ) ) (drop - (call $get_anyref + (call $get_externref (i32.const 4) (i32.const 5) (local.get $A) @@ -117,7 +117,7 @@ ) ) (drop - (call $get_anyref + (call $get_externref (i32.const 11) (i32.const 5) (local.get $A) @@ -169,10 +169,10 @@ ) ) (local.set $A - (call $set_anyref + (call $set_externref (i32.const 19) (i32.const 5) - (call $get_anyref + (call $get_externref (i32.const 18) (i32.const 5) (local.get $A) @@ -233,10 +233,10 @@ ) ) (local.set $A - (call $set_anyref + (call $set_externref (i32.const 29) (i32.const 5) - (call $get_anyref + (call $get_externref (i32.const 28) (i32.const 5) (local.get $A) @@ -269,7 +269,7 @@ (funcref.pop) ) (local.set $A - (anyref.pop) + (externref.pop) ) (local.set $N (nullref.pop) diff --git a/test/passes/instrument-locals_all-features.wast b/test/passes/instrument-locals_all-features.wast index ccf64d5a277..b73cda965ec 100644 --- a/test/passes/instrument-locals_all-features.wast +++ b/test/passes/instrument-locals_all-features.wast @@ -5,7 +5,7 @@ (local $z f32) (local $w f64) (local $F funcref) - (local $A anyref) + (local $A externref) (local $N nullref) (local $E exnref) @@ -47,7 +47,7 @@ ;; Pop instructions should not be instrumented (local.set $F (funcref.pop)) - (local.set $A (anyref.pop)) + (local.set $A (externref.pop)) (local.set $N (nullref.pop)) (local.set $E (exnref.pop)) ) diff --git a/test/passes/merge-locals_all-features.txt b/test/passes/merge-locals_all-features.txt index c87a952d54e..e4d3256953d 100644 --- a/test/passes/merge-locals_all-features.txt +++ b/test/passes/merge-locals_all-features.txt @@ -458,7 +458,7 @@ ) ) (func $subtype-test - (local $0 anyref) + (local $0 externref) (local $1 nullref) (local $2 nullref) (local.set $0 diff --git a/test/passes/merge-locals_all-features.wast b/test/passes/merge-locals_all-features.wast index a7f61796a3f..2a0a3d2922d 100644 --- a/test/passes/merge-locals_all-features.wast +++ b/test/passes/merge-locals_all-features.wast @@ -376,7 +376,7 @@ ) ) (func $subtype-test - (local $0 anyref) + (local $0 externref) (local $1 nullref) (local $2 nullref) (local.set $0 diff --git a/test/passes/optimize-instructions_all-features.txt b/test/passes/optimize-instructions_all-features.txt index d84095b89b7..e04bc4eb42c 100644 --- a/test/passes/optimize-instructions_all-features.txt +++ b/test/passes/optimize-instructions_all-features.txt @@ -13,7 +13,7 @@ (type $i32_i64_f32_f64_=>_none (func (param i32 i64 f32 f64))) (type $i32_i64_f64_i32_=>_none (func (param i32 i64 f64 i32))) (type $none_=>_f64 (func (result f64))) - (type $none_=>_anyref (func (result anyref))) + (type $none_=>_externref (func (result externref))) (memory $0 0) (export "load-off-2" (func $load-off-2)) (func $f (param $i1 i32) (param $i2 i64) @@ -3334,7 +3334,7 @@ (unreachable) ) ) - (func $if-arms-subtype (result anyref) + (func $if-arms-subtype (result externref) (ref.null) ) ) diff --git a/test/passes/optimize-instructions_all-features.wast b/test/passes/optimize-instructions_all-features.wast index 9694d9b2871..8de7d481998 100644 --- a/test/passes/optimize-instructions_all-features.wast +++ b/test/passes/optimize-instructions_all-features.wast @@ -3789,8 +3789,8 @@ ) ) ;; Tests when if arms are subtype of if's type - (func $if-arms-subtype (result anyref) - (if (result anyref) + (func $if-arms-subtype (result externref) + (if (result externref) (i32.const 0) (ref.null) (ref.null) diff --git a/test/passes/simplify-globals_all-features.txt b/test/passes/simplify-globals_all-features.txt index 9c1663b0a67..dc766683ece 100644 --- a/test/passes/simplify-globals_all-features.txt +++ b/test/passes/simplify-globals_all-features.txt @@ -213,9 +213,9 @@ ) (module (type $none_=>_none (func)) - (import "env" "global-1" (global $g1 anyref)) - (global $g2 anyref (global.get $g1)) - (global $g3 anyref (ref.null)) + (import "env" "global-1" (global $g1 externref)) + (global $g2 externref (global.get $g1)) + (global $g3 externref (ref.null)) (func $test1 (drop (global.get $g1) diff --git a/test/passes/simplify-globals_all-features.wast b/test/passes/simplify-globals_all-features.wast index 8c93d1390c4..3c7c61a9f57 100644 --- a/test/passes/simplify-globals_all-features.wast +++ b/test/passes/simplify-globals_all-features.wast @@ -128,9 +128,9 @@ ) ;; Reference type tests (module - (import "env" "global-1" (global $g1 anyref)) - (global $g2 (mut anyref) (global.get $g1)) - (global $g3 anyref (ref.null)) + (import "env" "global-1" (global $g1 externref)) + (global $g2 (mut externref) (global.get $g1)) + (global $g3 externref (ref.null)) (func $test1 (drop (global.get $g1)) (drop (global.get $g2)) diff --git a/test/passes/strip-target-features_roundtrip_print-features_all-features.txt b/test/passes/strip-target-features_roundtrip_print-features_all-features.txt index c8d989c936a..e6ff57ce191 100644 --- a/test/passes/strip-target-features_roundtrip_print-features_all-features.txt +++ b/test/passes/strip-target-features_roundtrip_print-features_all-features.txt @@ -9,14 +9,14 @@ --enable-reference-types --enable-multivalue (module - (type $none_=>_v128_anyref (func (result v128 anyref))) - (func $foo (result v128 anyref) + (type $none_=>_v128_externref (func (result v128 externref))) + (func $foo (result v128 externref) (tuple.make (v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000) (ref.null) ) ) - (func $bar (result v128 anyref) + (func $bar (result v128 externref) (return_call $foo) ) ) diff --git a/test/passes/strip-target-features_roundtrip_print-features_all-features.wast b/test/passes/strip-target-features_roundtrip_print-features_all-features.wast index 214289904f6..614804f9df5 100644 --- a/test/passes/strip-target-features_roundtrip_print-features_all-features.wast +++ b/test/passes/strip-target-features_roundtrip_print-features_all-features.wast @@ -2,13 +2,13 @@ ;; even if the target features section is stripped first (module - (func $foo (result v128 anyref ) + (func $foo (result v128 externref ) (tuple.make (v128.const i32x4 0 0 0 0) (ref.null) ) ) - (func $bar (result v128 anyref) + (func $bar (result v128 externref) (return_call $foo) ) ) diff --git a/test/passes/translate-to-fuzz_all-features.txt b/test/passes/translate-to-fuzz_all-features.txt index 9662c118a73..2167983755d 100644 --- a/test/passes/translate-to-fuzz_all-features.txt +++ b/test/passes/translate-to-fuzz_all-features.txt @@ -11,7 +11,7 @@ (type $none_=>_i32 (func (result i32))) (type $i64_v128_=>_f32 (func (param i64 v128) (result f32))) (type $f32_=>_f64 (func (param f32) (result f64))) - (type $none_=>_anyref (func (result anyref))) + (type $none_=>_externref (func (result externref))) (type $f64_=>_nullref (func (param f64) (result nullref))) (import "fuzzing-support" "log-i32" (func $log-i32 (param i32))) (import "fuzzing-support" "log-i64" (func $log-i64 (param i64))) @@ -271,12 +271,12 @@ ) (local.get $0) ) - (func $func_8 (result anyref) + (func $func_8 (result externref) (local $0 i64) (local $1 exnref) (local $2 nullref) (local $3 i32) - (local $4 anyref) + (local $4 externref) (local $5 nullref) (local $6 f32) (block @@ -295,7 +295,7 @@ ) ) ) - (block $label$0 (result anyref) + (block $label$0 (result externref) (loop $label$1 (block (if @@ -389,7 +389,7 @@ ) (local.tee $3 (ref.is_null - (loop $label$13 (result anyref) + (loop $label$13 (result externref) (block (if (i32.eqz @@ -407,7 +407,7 @@ ) ) (local.tee $4 - (loop $label$14 (result anyref) + (loop $label$14 (result externref) (block (if (i32.eqz @@ -595,7 +595,7 @@ (func $func_9 (param $0 f64) (result nullref) (local $1 nullref) (local $2 f32) - (local $3 anyref) + (local $3 externref) (local $4 exnref) (block (if @@ -616,7 +616,7 @@ (local.get $1) ) (func $func_10 (param $0 f32) (result f64) - (local $1 anyref) + (local $1 externref) (local $2 v128) (local $3 i32) (local $4 v128) @@ -627,7 +627,7 @@ (local $9 nullref) (local $10 exnref) (local $11 exnref) - (local $12 anyref) + (local $12 externref) (local $13 nullref) (local $14 (v128 i32 exnref v128)) (local $15 i64) diff --git a/test/reference-types.wast b/test/reference-types.wast index b5c1f9c41ef..3fc2b5ada91 100644 --- a/test/reference-types.wast +++ b/test/reference-types.wast @@ -1,44 +1,44 @@ -;; reftype :: anyref | funcref | exnref | nullref +;; reftype :: externref | funcref | exnref | nullref -;; t <: anyref for all reftypes t -;; nullref <: anyref, nullref <: funcref and nullref <: exnref +;; t <: externref for all reftypes t +;; nullref <: externref, nullref <: funcref and nullref <: exnref (module - (type $sig_anyref (func (param anyref))) + (type $sig_externref (func (param externref))) (type $sig_funcref (func (param funcref))) (type $sig_exnref (func (param exnref))) (type $sig_nullref (func (param nullref))) - (func $take_anyref (param anyref)) + (func $take_externref (param externref)) (func $take_funcref (param funcref)) (func $take_exnref (param exnref)) (func $take_nullref (param nullref)) (func $foo) - (table funcref (elem $take_anyref $take_funcref $take_exnref $take_nullref)) + (table funcref (elem $take_externref $take_funcref $take_exnref $take_nullref)) - (import "env" "import_func" (func $import_func (param anyref) (result funcref))) - (import "env" "import_global" (global $import_global anyref)) - (export "export_func" (func $import_func (param anyref) (result funcref))) + (import "env" "import_func" (func $import_func (param externref) (result funcref))) + (import "env" "import_global" (global $import_global externref)) + (export "export_func" (func $import_func (param externref) (result funcref))) (export "export_global" (global $import_global)) ;; Test subtype relationship in global initializer expressions - (global $global_anyref (mut anyref) (ref.null)) + (global $global_externref (mut externref) (ref.null)) (global $global_funcref (mut funcref) (ref.null)) (global $global_exnref (mut exnref) (ref.null)) (global $global_nullref (mut nullref) (ref.null)) - (global $global_anyref2 (mut anyref) (ref.func $foo)) + (global $global_externref2 (mut externref) (ref.func $foo)) (global $global_funcref2 (mut funcref) (ref.func $foo)) - (func $test (local $local_anyref anyref) (local $local_funcref funcref) + (func $test (local $local_externref externref) (local $local_funcref funcref) (local $local_exnref exnref) (local $local_nullref nullref) ;; Test subtype relationship for local.set & Test types for local.get - (local.set $local_anyref (local.get $local_anyref)) - (local.set $local_anyref (local.get $local_funcref)) - (local.set $local_anyref (local.get $local_exnref)) - (local.set $local_anyref (local.get $local_nullref)) - (local.set $local_anyref (ref.null)) - (local.set $local_anyref (ref.func $foo)) + (local.set $local_externref (local.get $local_externref)) + (local.set $local_externref (local.get $local_funcref)) + (local.set $local_externref (local.get $local_exnref)) + (local.set $local_externref (local.get $local_nullref)) + (local.set $local_externref (ref.null)) + (local.set $local_externref (ref.func $foo)) (local.set $local_funcref (local.get $local_funcref)) (local.set $local_funcref (ref.null)) (local.set $local_funcref (ref.func $foo)) @@ -48,12 +48,12 @@ (local.set $local_nullref (ref.null)) ;; Test subtype relationship for global.set & Test types for global.get - (global.set $global_anyref (global.get $global_anyref)) - (global.set $global_anyref (global.get $global_funcref)) - (global.set $global_anyref (global.get $global_exnref)) - (global.set $global_anyref (global.get $global_nullref)) - (global.set $global_anyref (ref.null)) - (global.set $global_anyref (ref.func $foo)) + (global.set $global_externref (global.get $global_externref)) + (global.set $global_externref (global.get $global_funcref)) + (global.set $global_externref (global.get $global_exnref)) + (global.set $global_externref (global.get $global_nullref)) + (global.set $global_externref (ref.null)) + (global.set $global_externref (ref.func $foo)) (global.set $global_funcref (global.get $global_funcref)) (global.set $global_funcref (ref.null)) (global.set $global_funcref (ref.func $foo)) @@ -63,14 +63,14 @@ (global.set $global_nullref (ref.null)) ;; Test subtype relationship for function call / call_indirect params - (call $take_anyref (local.get $local_anyref)) - (call $take_anyref (local.get $local_funcref)) - (call $take_anyref (local.get $local_exnref)) - (call $take_anyref (ref.null)) - (call_indirect (type $sig_anyref) (local.get $local_anyref) (i32.const 0)) - (call_indirect (type $sig_anyref) (local.get $local_funcref) (i32.const 0)) - (call_indirect (type $sig_anyref) (local.get $local_exnref) (i32.const 0)) - (call_indirect (type $sig_anyref) (ref.null) (i32.const 0)) + (call $take_externref (local.get $local_externref)) + (call $take_externref (local.get $local_funcref)) + (call $take_externref (local.get $local_exnref)) + (call $take_externref (ref.null)) + (call_indirect (type $sig_externref) (local.get $local_externref) (i32.const 0)) + (call_indirect (type $sig_externref) (local.get $local_funcref) (i32.const 0)) + (call_indirect (type $sig_externref) (local.get $local_exnref) (i32.const 0)) + (call_indirect (type $sig_externref) (ref.null) (i32.const 0)) (call_indirect (type $sig_funcref) (local.get $local_funcref) (i32.const 1)) (call_indirect (type $sig_funcref) (ref.null) (i32.const 1)) (call_indirect (type $sig_exnref) (local.get $local_exnref) (i32.const 2)) @@ -80,22 +80,22 @@ ;; Test subtype relationship for block return type (drop - (block (result anyref) - (br_if 0 (local.get $local_anyref) (i32.const 1)) + (block (result externref) + (br_if 0 (local.get $local_externref) (i32.const 1)) ) ) (drop - (block (result anyref) + (block (result externref) (br_if 0 (local.get $local_funcref) (i32.const 1)) ) ) (drop - (block (result anyref) + (block (result externref) (br_if 0 (local.get $local_exnref) (i32.const 1)) ) ) (drop - (block (result anyref) + (block (result externref) (br_if 0 (ref.null) (i32.const 1)) ) ) @@ -117,22 +117,22 @@ ;; Test subtype relationship for loop return type (drop - (loop (result anyref) - (local.get $local_anyref) + (loop (result externref) + (local.get $local_externref) ) ) (drop - (loop (result anyref) + (loop (result externref) (local.get $local_funcref) ) ) (drop - (loop (result anyref) + (loop (result externref) (local.get $local_exnref) ) ) (drop - (loop (result anyref) + (loop (result externref) (ref.null) ) ) @@ -164,14 +164,14 @@ ;; Test subtype relationship for if return type (drop - (if (result anyref) + (if (result externref) (i32.const 1) - (local.get $local_anyref) + (local.get $local_externref) (local.get $local_exnref) ) ) (drop - (if (result anyref) + (if (result externref) (i32.const 1) (ref.func $foo) (ref.null) @@ -201,9 +201,9 @@ ;; Test subtype relationship for try return type (drop - (try (result anyref) + (try (result externref) (do - (local.get $local_anyref) + (local.get $local_externref) ) (catch (exnref.pop) @@ -211,7 +211,7 @@ ) ) (drop - (try (result anyref) + (try (result externref) (do (ref.func $foo) ) @@ -256,28 +256,28 @@ ;; Test subtype relationship for typed select (drop - (select (result anyref) - (local.get $local_anyref) + (select (result externref) + (local.get $local_externref) (ref.func $foo) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (local.get $local_exnref) - (local.get $local_anyref) + (local.get $local_externref) (i32.const 1) ) ) (drop - (select (result anyref) - (local.get $local_anyref) + (select (result externref) + (local.get $local_externref) (ref.null) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (ref.null) (ref.func $foo) (i32.const 1) @@ -313,23 +313,23 @@ ) ;; ref.is_null takes any reference types - (drop (ref.is_null (local.get $local_anyref))) + (drop (ref.is_null (local.get $local_externref))) (drop (ref.is_null (local.get $local_exnref))) (drop (ref.is_null (ref.func $foo))) (drop (ref.is_null (ref.null))) ) ;; Test subtype relationship in function return type - (func $return_anyref (result anyref) (local $local_anyref anyref) - (local.get $local_anyref) + (func $return_externref (result externref) (local $local_externref externref) + (local.get $local_externref) ) - (func $return_anyref2 (result anyref) + (func $return_externref2 (result externref) (ref.func $foo) ) - (func $return_anyref3 (result anyref) (local $local_exnref exnref) + (func $return_externref3 (result externref) (local $local_exnref exnref) (local.get $local_exnref) ) - (func $return_anyref4 (result anyref) + (func $return_externref4 (result externref) (ref.null) ) (func $return_funcref (result funcref) @@ -349,9 +349,9 @@ ) ;; Test subtype relationship in returns - (func $return_anyref_returns (result anyref) (local $local_anyref anyref) + (func $return_externref_returns (result externref) (local $local_externref externref) (local $local_exnref exnref) - (return (local.get $local_anyref)) + (return (local.get $local_externref)) (return (local.get $local_exnref)) (return (ref.func $foo)) (return (ref.null)) diff --git a/test/reference-types.wast.from-wast b/test/reference-types.wast.from-wast index db33afb1707..3916606c028 100644 --- a/test/reference-types.wast.from-wast +++ b/test/reference-types.wast.from-wast @@ -1,6 +1,6 @@ (module - (type $anyref_=>_none (func (param anyref))) - (type $none_=>_anyref (func (result anyref))) + (type $externref_=>_none (func (param externref))) + (type $none_=>_externref (func (result externref))) (type $funcref_=>_none (func (param funcref))) (type $nullref_=>_none (func (param nullref))) (type $exnref_=>_none (func (param exnref))) @@ -8,20 +8,20 @@ (type $none_=>_exnref (func (result exnref))) (type $none_=>_none (func)) (type $none_=>_nullref (func (result nullref))) - (type $anyref_=>_funcref (func (param anyref) (result funcref))) - (import "env" "import_global" (global $import_global anyref)) - (import "env" "import_func" (func $import_func (param anyref) (result funcref))) + (type $externref_=>_funcref (func (param externref) (result funcref))) + (import "env" "import_global" (global $import_global externref)) + (import "env" "import_func" (func $import_func (param externref) (result funcref))) (table $0 4 4 funcref) - (elem (i32.const 0) $take_anyref $take_funcref $take_exnref $take_nullref) - (global $global_anyref (mut anyref) (ref.null)) + (elem (i32.const 0) $take_externref $take_funcref $take_exnref $take_nullref) + (global $global_externref (mut externref) (ref.null)) (global $global_funcref (mut funcref) (ref.null)) (global $global_exnref (mut exnref) (ref.null)) (global $global_nullref (mut nullref) (ref.null)) - (global $global_anyref2 (mut anyref) (ref.func $foo)) + (global $global_externref2 (mut externref) (ref.func $foo)) (global $global_funcref2 (mut funcref) (ref.func $foo)) (export "export_func" (func $import_func)) (export "export_global" (global $import_global)) - (func $take_anyref (param $0 anyref) + (func $take_externref (param $0 externref) (nop) ) (func $take_funcref (param $0 funcref) @@ -37,26 +37,26 @@ (nop) ) (func $test - (local $local_anyref anyref) + (local $local_externref externref) (local $local_funcref funcref) (local $local_exnref exnref) (local $local_nullref nullref) - (local.set $local_anyref - (local.get $local_anyref) + (local.set $local_externref + (local.get $local_externref) ) - (local.set $local_anyref + (local.set $local_externref (local.get $local_funcref) ) - (local.set $local_anyref + (local.set $local_externref (local.get $local_exnref) ) - (local.set $local_anyref + (local.set $local_externref (local.get $local_nullref) ) - (local.set $local_anyref + (local.set $local_externref (ref.null) ) - (local.set $local_anyref + (local.set $local_externref (ref.func $foo) ) (local.set $local_funcref @@ -80,22 +80,22 @@ (local.set $local_nullref (ref.null) ) - (global.set $global_anyref - (global.get $global_anyref) + (global.set $global_externref + (global.get $global_externref) ) - (global.set $global_anyref + (global.set $global_externref (global.get $global_funcref) ) - (global.set $global_anyref + (global.set $global_externref (global.get $global_exnref) ) - (global.set $global_anyref + (global.set $global_externref (global.get $global_nullref) ) - (global.set $global_anyref + (global.set $global_externref (ref.null) ) - (global.set $global_anyref + (global.set $global_externref (ref.func $foo) ) (global.set $global_funcref @@ -119,31 +119,31 @@ (global.set $global_nullref (ref.null) ) - (call $take_anyref - (local.get $local_anyref) + (call $take_externref + (local.get $local_externref) ) - (call $take_anyref + (call $take_externref (local.get $local_funcref) ) - (call $take_anyref + (call $take_externref (local.get $local_exnref) ) - (call $take_anyref + (call $take_externref (ref.null) ) - (call_indirect (type $anyref_=>_none) - (local.get $local_anyref) + (call_indirect (type $externref_=>_none) + (local.get $local_externref) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $local_funcref) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $local_exnref) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (ref.null) (i32.const 0) ) @@ -172,15 +172,15 @@ (i32.const 3) ) (drop - (block $block (result anyref) + (block $block (result externref) (br_if $block - (local.get $local_anyref) + (local.get $local_externref) (i32.const 1) ) ) ) (drop - (block $block0 (result anyref) + (block $block0 (result externref) (br_if $block0 (local.get $local_funcref) (i32.const 1) @@ -188,7 +188,7 @@ ) ) (drop - (block $block1 (result anyref) + (block $block1 (result externref) (br_if $block1 (local.get $local_exnref) (i32.const 1) @@ -196,7 +196,7 @@ ) ) (drop - (block $block2 (result anyref) + (block $block2 (result externref) (br_if $block2 (ref.null) (i32.const 1) @@ -228,22 +228,22 @@ ) ) (drop - (loop $loop-in (result anyref) - (local.get $local_anyref) + (loop $loop-in (result externref) + (local.get $local_externref) ) ) (drop - (loop $loop-in6 (result anyref) + (loop $loop-in6 (result externref) (local.get $local_funcref) ) ) (drop - (loop $loop-in7 (result anyref) + (loop $loop-in7 (result externref) (local.get $local_exnref) ) ) (drop - (loop $loop-in8 (result anyref) + (loop $loop-in8 (result externref) (ref.null) ) ) @@ -273,14 +273,14 @@ ) ) (drop - (if (result anyref) + (if (result externref) (i32.const 1) - (local.get $local_anyref) + (local.get $local_externref) (local.get $local_exnref) ) ) (drop - (if (result anyref) + (if (result externref) (i32.const 1) (ref.func $foo) (ref.null) @@ -308,9 +308,9 @@ ) ) (drop - (try (result anyref) + (try (result externref) (do - (local.get $local_anyref) + (local.get $local_externref) ) (catch (exnref.pop) @@ -318,7 +318,7 @@ ) ) (drop - (try (result anyref) + (try (result externref) (do (ref.func $foo) ) @@ -367,28 +367,28 @@ ) ) (drop - (select (result anyref) - (local.get $local_anyref) + (select (result externref) + (local.get $local_externref) (ref.func $foo) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (local.get $local_exnref) - (local.get $local_anyref) + (local.get $local_externref) (i32.const 1) ) ) (drop - (select (result anyref) - (local.get $local_anyref) + (select (result externref) + (local.get $local_externref) (ref.null) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (ref.null) (ref.func $foo) (i32.const 1) @@ -424,7 +424,7 @@ ) (drop (ref.is_null - (local.get $local_anyref) + (local.get $local_externref) ) ) (drop @@ -443,18 +443,18 @@ ) ) ) - (func $return_anyref (result anyref) - (local $local_anyref anyref) - (local.get $local_anyref) + (func $return_externref (result externref) + (local $local_externref externref) + (local.get $local_externref) ) - (func $return_anyref2 (result anyref) + (func $return_externref2 (result externref) (ref.func $foo) ) - (func $return_anyref3 (result anyref) + (func $return_externref3 (result externref) (local $local_exnref exnref) (local.get $local_exnref) ) - (func $return_anyref4 (result anyref) + (func $return_externref4 (result externref) (ref.null) ) (func $return_funcref (result funcref) @@ -474,11 +474,11 @@ (local $local_nullref nullref) (local.get $local_nullref) ) - (func $return_anyref_returns (result anyref) - (local $local_anyref anyref) + (func $return_externref_returns (result externref) + (local $local_externref externref) (local $local_exnref exnref) (return - (local.get $local_anyref) + (local.get $local_externref) ) (return (local.get $local_exnref) diff --git a/test/reference-types.wast.fromBinary b/test/reference-types.wast.fromBinary index 82ade2c15c6..ae36b920998 100644 --- a/test/reference-types.wast.fromBinary +++ b/test/reference-types.wast.fromBinary @@ -1,6 +1,6 @@ (module - (type $anyref_=>_none (func (param anyref))) - (type $none_=>_anyref (func (result anyref))) + (type $externref_=>_none (func (param externref))) + (type $none_=>_externref (func (result externref))) (type $funcref_=>_none (func (param funcref))) (type $nullref_=>_none (func (param nullref))) (type $exnref_=>_none (func (param exnref))) @@ -8,20 +8,20 @@ (type $none_=>_exnref (func (result exnref))) (type $none_=>_none (func)) (type $none_=>_nullref (func (result nullref))) - (type $anyref_=>_funcref (func (param anyref) (result funcref))) - (import "env" "import_global" (global $gimport$1 anyref)) - (import "env" "import_func" (func $import_func (param anyref) (result funcref))) + (type $externref_=>_funcref (func (param externref) (result funcref))) + (import "env" "import_global" (global $gimport$1 externref)) + (import "env" "import_func" (func $import_func (param externref) (result funcref))) (table $0 4 4 funcref) - (elem (i32.const 0) $take_anyref $take_funcref $take_exnref $take_nullref) - (global $global$0 (mut anyref) (ref.null)) + (elem (i32.const 0) $take_externref $take_funcref $take_exnref $take_nullref) + (global $global$0 (mut externref) (ref.null)) (global $global$1 (mut funcref) (ref.null)) (global $global$2 (mut exnref) (ref.null)) (global $global$3 (mut nullref) (ref.null)) - (global $global$4 (mut anyref) (ref.func $foo)) + (global $global$4 (mut externref) (ref.func $foo)) (global $global$5 (mut funcref) (ref.func $foo)) (export "export_func" (func $import_func)) (export "export_global" (global $gimport$1)) - (func $take_anyref (param $0 anyref) + (func $take_externref (param $0 externref) (nop) ) (func $take_funcref (param $0 funcref) @@ -38,7 +38,7 @@ ) (func $test (local $0 funcref) - (local $1 anyref) + (local $1 externref) (local $2 nullref) (local $3 exnref) (local.set $1 @@ -119,31 +119,31 @@ (global.set $global$3 (ref.null) ) - (call $take_anyref + (call $take_externref (local.get $1) ) - (call $take_anyref + (call $take_externref (local.get $0) ) - (call $take_anyref + (call $take_externref (local.get $3) ) - (call $take_anyref + (call $take_externref (ref.null) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $1) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $0) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $3) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (ref.null) (i32.const 0) ) @@ -172,7 +172,7 @@ (i32.const 3) ) (drop - (block $label$1 (result anyref) + (block $label$1 (result externref) (br_if $label$1 (local.get $1) (i32.const 1) @@ -180,7 +180,7 @@ ) ) (drop - (block $label$2 (result anyref) + (block $label$2 (result externref) (br_if $label$2 (local.get $0) (i32.const 1) @@ -188,7 +188,7 @@ ) ) (drop - (block $label$3 (result anyref) + (block $label$3 (result externref) (br_if $label$3 (local.get $3) (i32.const 1) @@ -196,7 +196,7 @@ ) ) (drop - (block $label$4 (result anyref) + (block $label$4 (result externref) (br_if $label$4 (ref.null) (i32.const 1) @@ -228,22 +228,22 @@ ) ) (drop - (loop $label$8 (result anyref) + (loop $label$8 (result externref) (local.get $1) ) ) (drop - (loop $label$9 (result anyref) + (loop $label$9 (result externref) (local.get $0) ) ) (drop - (loop $label$10 (result anyref) + (loop $label$10 (result externref) (local.get $3) ) ) (drop - (loop $label$11 (result anyref) + (loop $label$11 (result externref) (ref.null) ) ) @@ -273,14 +273,14 @@ ) ) (drop - (if (result anyref) + (if (result externref) (i32.const 1) (local.get $1) (local.get $3) ) ) (drop - (if (result anyref) + (if (result externref) (i32.const 1) (ref.func $foo) (ref.null) @@ -308,7 +308,7 @@ ) ) (drop - (try (result anyref) + (try (result externref) (do (local.get $1) ) @@ -318,7 +318,7 @@ ) ) (drop - (try (result anyref) + (try (result externref) (do (ref.func $foo) ) @@ -367,28 +367,28 @@ ) ) (drop - (select (result anyref) + (select (result externref) (local.get $1) (ref.func $foo) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (local.get $3) (local.get $1) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (local.get $1) (ref.null) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (ref.null) (ref.func $foo) (i32.const 1) @@ -443,18 +443,18 @@ ) ) ) - (func $return_anyref (result anyref) - (local $0 anyref) + (func $return_externref (result externref) + (local $0 externref) (local.get $0) ) - (func $return_anyref2 (result anyref) + (func $return_externref2 (result externref) (ref.func $foo) ) - (func $return_anyref3 (result anyref) + (func $return_externref3 (result externref) (local $0 exnref) (local.get $0) ) - (func $return_anyref4 (result anyref) + (func $return_externref4 (result externref) (ref.null) ) (func $return_funcref (result funcref) @@ -474,8 +474,8 @@ (local $0 nullref) (local.get $0) ) - (func $return_anyref_returns (result anyref) - (local $0 anyref) + (func $return_externref_returns (result externref) + (local $0 externref) (local $1 exnref) (return (local.get $0) diff --git a/test/reference-types.wast.fromBinary.noDebugInfo b/test/reference-types.wast.fromBinary.noDebugInfo index a89f3a3a3c4..9e8dac3a354 100644 --- a/test/reference-types.wast.fromBinary.noDebugInfo +++ b/test/reference-types.wast.fromBinary.noDebugInfo @@ -1,6 +1,6 @@ (module - (type $anyref_=>_none (func (param anyref))) - (type $none_=>_anyref (func (result anyref))) + (type $externref_=>_none (func (param externref))) + (type $none_=>_externref (func (result externref))) (type $funcref_=>_none (func (param funcref))) (type $nullref_=>_none (func (param nullref))) (type $exnref_=>_none (func (param exnref))) @@ -8,20 +8,20 @@ (type $none_=>_exnref (func (result exnref))) (type $none_=>_none (func)) (type $none_=>_nullref (func (result nullref))) - (type $anyref_=>_funcref (func (param anyref) (result funcref))) - (import "env" "import_global" (global $gimport$1 anyref)) - (import "env" "import_func" (func $fimport$0 (param anyref) (result funcref))) + (type $externref_=>_funcref (func (param externref) (result funcref))) + (import "env" "import_global" (global $gimport$1 externref)) + (import "env" "import_func" (func $fimport$0 (param externref) (result funcref))) (table $0 4 4 funcref) (elem (i32.const 0) $0 $1 $2 $3) - (global $global$0 (mut anyref) (ref.null)) + (global $global$0 (mut externref) (ref.null)) (global $global$1 (mut funcref) (ref.null)) (global $global$2 (mut exnref) (ref.null)) (global $global$3 (mut nullref) (ref.null)) - (global $global$4 (mut anyref) (ref.func $4)) + (global $global$4 (mut externref) (ref.func $4)) (global $global$5 (mut funcref) (ref.func $4)) (export "export_func" (func $fimport$0)) (export "export_global" (global $gimport$1)) - (func $0 (param $0 anyref) + (func $0 (param $0 externref) (nop) ) (func $1 (param $0 funcref) @@ -38,7 +38,7 @@ ) (func $5 (local $0 funcref) - (local $1 anyref) + (local $1 externref) (local $2 nullref) (local $3 exnref) (local.set $1 @@ -131,19 +131,19 @@ (call $0 (ref.null) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $1) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $0) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (local.get $3) (i32.const 0) ) - (call_indirect (type $anyref_=>_none) + (call_indirect (type $externref_=>_none) (ref.null) (i32.const 0) ) @@ -172,7 +172,7 @@ (i32.const 3) ) (drop - (block $label$1 (result anyref) + (block $label$1 (result externref) (br_if $label$1 (local.get $1) (i32.const 1) @@ -180,7 +180,7 @@ ) ) (drop - (block $label$2 (result anyref) + (block $label$2 (result externref) (br_if $label$2 (local.get $0) (i32.const 1) @@ -188,7 +188,7 @@ ) ) (drop - (block $label$3 (result anyref) + (block $label$3 (result externref) (br_if $label$3 (local.get $3) (i32.const 1) @@ -196,7 +196,7 @@ ) ) (drop - (block $label$4 (result anyref) + (block $label$4 (result externref) (br_if $label$4 (ref.null) (i32.const 1) @@ -228,22 +228,22 @@ ) ) (drop - (loop $label$8 (result anyref) + (loop $label$8 (result externref) (local.get $1) ) ) (drop - (loop $label$9 (result anyref) + (loop $label$9 (result externref) (local.get $0) ) ) (drop - (loop $label$10 (result anyref) + (loop $label$10 (result externref) (local.get $3) ) ) (drop - (loop $label$11 (result anyref) + (loop $label$11 (result externref) (ref.null) ) ) @@ -273,14 +273,14 @@ ) ) (drop - (if (result anyref) + (if (result externref) (i32.const 1) (local.get $1) (local.get $3) ) ) (drop - (if (result anyref) + (if (result externref) (i32.const 1) (ref.func $4) (ref.null) @@ -308,7 +308,7 @@ ) ) (drop - (try (result anyref) + (try (result externref) (do (local.get $1) ) @@ -318,7 +318,7 @@ ) ) (drop - (try (result anyref) + (try (result externref) (do (ref.func $4) ) @@ -367,28 +367,28 @@ ) ) (drop - (select (result anyref) + (select (result externref) (local.get $1) (ref.func $4) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (local.get $3) (local.get $1) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (local.get $1) (ref.null) (i32.const 1) ) ) (drop - (select (result anyref) + (select (result externref) (ref.null) (ref.func $4) (i32.const 1) @@ -443,18 +443,18 @@ ) ) ) - (func $6 (result anyref) - (local $0 anyref) + (func $6 (result externref) + (local $0 externref) (local.get $0) ) - (func $7 (result anyref) + (func $7 (result externref) (ref.func $4) ) - (func $8 (result anyref) + (func $8 (result externref) (local $0 exnref) (local.get $0) ) - (func $9 (result anyref) + (func $9 (result externref) (ref.null) ) (func $10 (result funcref) @@ -474,8 +474,8 @@ (local $0 nullref) (local.get $0) ) - (func $15 (result anyref) - (local $0 anyref) + (func $15 (result externref) + (local $0 externref) (local $1 exnref) (return (local.get $0) diff --git a/test/spec/old_select.wast b/test/spec/old_select.wast index bb9c7c5878f..e1dd40654d3 100644 --- a/test/spec/old_select.wast +++ b/test/spec/old_select.wast @@ -29,8 +29,8 @@ (func (export "select-funcref") (param funcref funcref i32) (result funcref) (select (result funcref) (local.get 0) (local.get 1) (local.get 2)) ) - (func (export "select-anyref") (param anyref anyref i32) (result anyref) - (select (result anyref) (local.get 0) (local.get 1) (local.get 2)) + (func (export "select-externref") (param externref externref i32) (result externref) + (select (result externref) (local.get 0) (local.get 1) (local.get 2)) ) ;; Check that both sides of the select are evaluated @@ -39,18 +39,18 @@ (func (export "select_trap_r") (param $cond i32) (result i32) (select (i32.const 0) (unreachable) (local.get $cond))) - (func (export "join-nullref") (param i32) (result anyref) - (select (result anyref) (ref.null) (ref.null) (local.get 0)) + (func (export "join-nullref") (param i32) (result externref) + (select (result externref) (ref.null) (ref.null) (local.get 0)) ) - (func (export "join-funcref") (param i32) (result anyref) - (select (result anyref) + (func (export "join-funcref") (param i32) (result externref) + (select (result externref) (ref.func $dummy) (ref.null) (local.get 0) ) ) - (func (export "join-anyref") (param i32) (param anyref) (result anyref) - (select (result anyref) + (func (export "join-externref") (param i32) (param externref) (result externref) + (select (result externref) (ref.func $dummy) (local.get 1) (local.get 0) @@ -92,13 +92,13 @@ (assert_return (invoke "select-f64-t" (f64.const 1) (f64.const 2) (i32.const 1)) (f64.const 1)) (assert_return (invoke "select-nullref" (ref.null) (ref.null) (i32.const 1)) (ref.null)) (assert_return (invoke "select-funcref" (ref.func "dummy") (ref.null) (i32.const 1)) (ref.func "dummy")) -(assert_return (invoke "select-anyref" (ref.null) (ref.func "dummy") (i32.const 1)) (ref.null)) +(assert_return (invoke "select-externref" (ref.null) (ref.func "dummy") (i32.const 1)) (ref.null)) (assert_return (invoke "select-i32-t" (i32.const 1) (i32.const 2) (i32.const 0)) (i32.const 2)) (assert_return (invoke "select-i32-t" (i32.const 2) (i32.const 1) (i32.const 0)) (i32.const 1)) (assert_return (invoke "select-i64-t" (i64.const 2) (i64.const 1) (i32.const -1)) (i64.const 2)) (assert_return (invoke "select-i64-t" (i64.const 2) (i64.const 1) (i32.const 0xf0f0f0f0)) (i64.const 2)) -(assert_return (invoke "select-anyref" (ref.null) (ref.func "dummy") (i32.const 0)) (ref.func "dummy")) +(assert_return (invoke "select-externref" (ref.null) (ref.func "dummy") (i32.const 0)) (ref.func "dummy")) (assert_return (invoke "select-f32-t" (f32.const nan) (f32.const 1) (i32.const 1)) (f32.const nan)) (assert_return (invoke "select-f32-t" (f32.const nan:0x20304) (f32.const 1) (i32.const 1)) (f32.const nan:0x20304)) @@ -124,8 +124,8 @@ (assert_return_func (invoke "join-funcref" (i32.const 1))) (assert_return (invoke "join-funcref" (i32.const 0)) (ref.null)) -(assert_return_func (invoke "join-anyref" (i32.const 1) (ref.null))) -(assert_return (invoke "join-anyref" (i32.const 0) (ref.null)) (ref.null)) +(assert_return_func (invoke "join-externref" (i32.const 1) (ref.null))) +(assert_return (invoke "join-externref" (i32.const 0) (ref.null)) (ref.null)) (assert_trap (invoke "select_trap_l" (i32.const 1)) "unreachable executed") (assert_trap (invoke "select_trap_l" (i32.const 0)) "unreachable executed") diff --git a/test/spec/ref_func.wast b/test/spec/ref_func.wast index 0f0ecf6a30b..79bf584befb 100644 --- a/test/spec/ref_func.wast +++ b/test/spec/ref_func.wast @@ -5,8 +5,8 @@ (func $f (import "M" "f") (param i32) (result i32)) (func $g (param $x i32) (result i32) (i32.add (local.get $x) (i32.const 1))) - (global anyref (ref.func $f)) - (global anyref (ref.func $g)) + (global externref (ref.func $f)) + (global externref (ref.func $g)) (global funcref (ref.func $f)) (global funcref (ref.func $g)) (global $v (mut funcref) (ref.func $f)) diff --git a/test/spec/ref_is_null.wast b/test/spec/ref_is_null.wast index dbf4651496d..e44fcf496d8 100644 --- a/test/spec/ref_is_null.wast +++ b/test/spec/ref_is_null.wast @@ -2,7 +2,7 @@ (func $f1 (export "nullref") (param $x nullref) (result i32) (ref.is_null (local.get $x)) ) - (func $f2 (export "anyref") (param $x anyref) (result i32) + (func $f2 (export "externref") (param $x externref) (result i32) (ref.is_null (local.get $x)) ) (func $f3 (export "funcref") (param $x funcref) (result i32) @@ -11,5 +11,5 @@ ) (assert_return (invoke "nullref" (ref.null)) (i32.const 1)) -(assert_return (invoke "anyref" (ref.null)) (i32.const 1)) +(assert_return (invoke "externref" (ref.null)) (i32.const 1)) (assert_return (invoke "funcref" (ref.null)) (i32.const 1)) diff --git a/test/spec/ref_null.wast b/test/spec/ref_null.wast index 96cac314adc..93e6acbd22e 100644 --- a/test/spec/ref_null.wast +++ b/test/spec/ref_null.wast @@ -1,13 +1,13 @@ (module - (func (export "anyref") (result anyref) (ref.null)) + (func (export "externref") (result externref) (ref.null)) (func (export "funcref") (result funcref) (ref.null)) (func (export "nullref") (result nullref) (ref.null)) - (global anyref (ref.null)) + (global externref (ref.null)) (global funcref (ref.null)) (global nullref (ref.null)) ) -(assert_return (invoke "anyref") (ref.null)) +(assert_return (invoke "externref") (ref.null)) (assert_return (invoke "funcref") (ref.null)) (assert_return (invoke "nullref") (ref.null)) diff --git a/test/unit/test_features.py b/test/unit/test_features.py index 4a79a6dd561..3b30595d6a9 100644 --- a/test/unit/test_features.py +++ b/test/unit/test_features.py @@ -160,14 +160,14 @@ def test_tail_call_indirect(self): ''' self.check_tail_call(module, 'return_call_indirect requires tail calls to be enabled') - def test_reference_types_anyref(self): + def test_reference_types_externref(self): module = ''' (module - (import "env" "test1" (func $test1 (param anyref) (result anyref))) - (import "env" "test2" (global $test2 anyref)) - (export "test1" (func $test1 (param anyref) (result anyref))) + (import "env" "test1" (func $test1 (param externref) (result externref))) + (import "env" "test2" (global $test2 externref)) + (export "test1" (func $test1 (param externref) (result externref))) (export "test2" (global $test2)) - (func $anyref_test (param $0 anyref) (result anyref) + (func $externref_test (param $0 externref) (result externref) (return (call $test1 (local.get $0) @@ -298,7 +298,7 @@ def test_reference_types(self): filename = 'reference_types_target_feature.wasm' self.roundtrip(filename) self.check_features(filename, ['reference-types']) - self.assertIn('anyref', self.disassemble(filename)) + self.assertIn('externref', self.disassemble(filename)) def test_exception_handling(self): filename = 'exception_handling_target_feature.wasm'