summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/wasm2js.js8
-rw-r--r--src/asmjs/asm_v_wasm.cpp3
-rw-r--r--src/binaryen-c.cpp5
-rw-r--r--src/ir/abstract.h2
-rw-r--r--src/literal.h8
-rw-r--r--src/passes/ConstHoisting.cpp1
-rw-r--r--src/passes/FuncCastEmulation.cpp2
-rw-r--r--src/passes/InstrumentLocals.cpp24
-rw-r--r--src/tools/fuzzing/fuzzing.cpp28
-rw-r--r--src/tools/fuzzing/heap-types.cpp6
-rw-r--r--src/tools/spec-wrapper.h3
-rw-r--r--src/tools/wasm-reduce.cpp5
-rw-r--r--src/wasm-binary.h17
-rw-r--r--src/wasm-builder.h2
-rw-r--r--src/wasm-interpreter.h4
-rw-r--r--src/wasm-type.h11
-rw-r--r--src/wasm/literal.cpp20
-rw-r--r--src/wasm/wasm-binary.cpp12
-rw-r--r--src/wasm/wasm-s-parser.cpp9
-rw-r--r--src/wasm/wasm-stack.cpp3
-rw-r--r--src/wasm/wasm-type.cpp17
-rw-r--r--src/wasm/wasm-validator.cpp11
-rw-r--r--test/binaryen.js/kitchen-sink.js.txt18
-rw-r--r--test/ctor-eval/bad-indirect-call3.wast.out4
-rw-r--r--test/example/c-api-kitchen-sink.txt14
-rw-r--r--test/example/stack-utils.cpp4
-rw-r--r--test/example/type-builder-nominal.cpp7
-rw-r--r--test/example/type-builder-nominal.txt8
-rw-r--r--test/example/type-builder.cpp1
-rw-r--r--test/example/typeinfo.cpp23
-rw-r--r--test/example/typeinfo.txt13
-rw-r--r--test/gtest/type-builder.cpp22
-rw-r--r--test/lit/fuzz-types/isorecursive.test36
-rw-r--r--test/lit/fuzz-types/nominal.test28
-rw-r--r--test/lit/fuzz-types/structural.test30
-rw-r--r--test/lit/passes/flatten_all-features.wast40
-rw-r--r--test/lit/passes/instrument-locals_all-features_disable-typed-function-references.wast20
-rw-r--r--test/lit/passes/optimize-instructions-gc.wast8
-rw-r--r--test/multi-table.wast.from-wast2
-rw-r--r--test/multi-table.wast.fromBinary2
-rw-r--r--test/multi-table.wast.fromBinary.noDebugInfo2
-rw-r--r--test/multivalue.wast.from-wast10
-rw-r--r--test/multivalue.wast.fromBinary12
-rw-r--r--test/multivalue.wast.fromBinary.noDebugInfo12
-rw-r--r--test/passes/precompute_all-features.txt12
-rw-r--r--test/passes/simplify-globals_all-features.txt8
-rw-r--r--test/passes/simplify-locals_all-features.txt2
-rw-r--r--test/passes/strip-target-features_roundtrip_print-features_all-features.txt8
-rw-r--r--test/passes/translate-to-fuzz_all-features_metrics_noprint.txt71
-rw-r--r--test/reference-types.wast.from-wast100
-rw-r--r--test/reference-types.wast.fromBinary98
-rw-r--r--test/reference-types.wast.fromBinary.noDebugInfo180
-rw-r--r--test/unit/input/gc_target_feature.wasmbin94 -> 94 bytes
-rw-r--r--test/unit/test_features.py10
54 files changed, 415 insertions, 591 deletions
diff --git a/scripts/wasm2js.js b/scripts/wasm2js.js
index a72ccfbfb..4a16184d0 100644
--- a/scripts/wasm2js.js
+++ b/scripts/wasm2js.js
@@ -124,10 +124,6 @@ var asmLibraryArg = {
console.log('get_f64 ' + [loc, index, value]);
return value;
},
- get_externref: function(loc, index, value) {
- console.log('get_externref ' + [loc, index, value]);
- return value;
- },
set_i32: function(loc, index, value) {
console.log('set_i32 ' + [loc, index, value]);
return value;
@@ -145,10 +141,6 @@ var asmLibraryArg = {
console.log('set_f64 ' + [loc, index, value]);
return value;
},
- set_externref: function(loc, index, value) {
- console.log('set_externref ' + [loc, index, value]);
- return value;
- },
load_ptr: function(loc, bytes, offset, ptr) {
console.log('load_ptr ' + [loc, bytes, offset, ptr]);
return ptr;
diff --git a/src/asmjs/asm_v_wasm.cpp b/src/asmjs/asm_v_wasm.cpp
index 9e05d8722..38eb029f4 100644
--- a/src/asmjs/asm_v_wasm.cpp
+++ b/src/asmjs/asm_v_wasm.cpp
@@ -34,7 +34,6 @@ JsType wasmToJsType(Type type) {
case Type::v128:
WASM_UNREACHABLE("v128 not implemented yet");
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -63,8 +62,6 @@ char getSig(Type type) {
return 'V';
case Type::funcref:
return 'F';
- case Type::externref:
- return 'X';
case Type::anyref:
return 'A';
case Type::eqref:
diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp
index ecdbadefd..aa9f7e641 100644
--- a/src/binaryen-c.cpp
+++ b/src/binaryen-c.cpp
@@ -70,7 +70,6 @@ BinaryenLiteral toBinaryenLiteral(Literal x) {
case Type::funcref:
ret.func = x.isNull() ? nullptr : x.getFunc().c_str();
break;
- case Type::externref:
case Type::anyref:
case Type::eqref:
assert(x.isNull() && "unexpected non-null reference type literal");
@@ -100,7 +99,6 @@ Literal fromBinaryenLiteral(BinaryenLiteral x) {
return Literal(x.v128);
case Type::funcref:
return Literal::makeFunc(x.func);
- case Type::externref:
case Type::anyref:
case Type::eqref:
return Literal::makeNull(Type(x.type));
@@ -132,6 +130,7 @@ extern "C" {
//
// Core types
+// TODO: Deprecate BinaryenTypeExternref?
BinaryenType BinaryenTypeNone(void) { return Type::none; }
BinaryenType BinaryenTypeInt32(void) { return Type::i32; }
@@ -140,7 +139,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 BinaryenTypeExternref(void) { return Type::externref; }
+BinaryenType BinaryenTypeExternref(void) { return Type::anyref; }
BinaryenType BinaryenTypeAnyref(void) { return Type::anyref; }
BinaryenType BinaryenTypeEqref(void) { return Type::eqref; }
BinaryenType BinaryenTypeI31ref(void) { return Type::i31ref; }
diff --git a/src/ir/abstract.h b/src/ir/abstract.h
index 3975386da..63057a975 100644
--- a/src/ir/abstract.h
+++ b/src/ir/abstract.h
@@ -122,7 +122,6 @@ inline UnaryOp getUnary(Type type, Op op) {
}
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -295,7 +294,6 @@ inline BinaryOp getBinary(Type type, Op op) {
}
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
diff --git a/src/literal.h b/src/literal.h
index 0438e0686..555f89e5c 100644
--- a/src/literal.h
+++ b/src/literal.h
@@ -63,8 +63,8 @@ class Literal {
// To support the experimental RttFreshSub instruction, we not only store
// the type, but also a reference to an allocation.
std::unique_ptr<RttSupers> rttSupers;
- // TODO: Literals of type `externref` can only be `null` currently but we
- // will need to represent extern values eventually, to
+ // TODO: Literals of type `anyref` can only be `null` currently but we
+ // will need to represent external values eventually, to
// 1) run the spec tests and fuzzer with reference types enabled and
// 2) avoid bailing out when seeing a reference typed value in precompute
};
@@ -765,8 +765,7 @@ template<> struct hash<wasm::Literal> {
return digest;
}
// other non-null reference type literals cannot represent concrete
- // values, i.e. there is no concrete externref, anyref or eqref other than
- // null.
+ // values, i.e. there is no concrete anyref or eqref other than null.
WASM_UNREACHABLE("unexpected type");
};
if (a.type.isBasic()) {
@@ -790,7 +789,6 @@ template<> struct hash<wasm::Literal> {
wasm::rehash(digest, chunks[1]);
return digest;
case wasm::Type::funcref:
- case wasm::Type::externref:
case wasm::Type::anyref:
case wasm::Type::eqref:
case wasm::Type::dataref:
diff --git a/src/passes/ConstHoisting.cpp b/src/passes/ConstHoisting.cpp
index a85b9cdf2..3320c129b 100644
--- a/src/passes/ConstHoisting.cpp
+++ b/src/passes/ConstHoisting.cpp
@@ -92,7 +92,6 @@ private:
// not implemented yet
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
diff --git a/src/passes/FuncCastEmulation.cpp b/src/passes/FuncCastEmulation.cpp
index 2d7bdad54..704f44e03 100644
--- a/src/passes/FuncCastEmulation.cpp
+++ b/src/passes/FuncCastEmulation.cpp
@@ -63,7 +63,6 @@ static Expression* toABI(Expression* value, Module* module) {
WASM_UNREACHABLE("v128 not implemented yet");
}
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -109,7 +108,6 @@ static Expression* fromABI(Expression* value, Type type, Module* module) {
WASM_UNREACHABLE("v128 not implemented yet");
}
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
diff --git a/src/passes/InstrumentLocals.cpp b/src/passes/InstrumentLocals.cpp
index aab0ee3fe..3bf23b61c 100644
--- a/src/passes/InstrumentLocals.cpp
+++ b/src/passes/InstrumentLocals.cpp
@@ -57,7 +57,6 @@ Name get_f32("get_f32");
Name get_f64("get_f64");
Name get_v128("get_v128");
Name get_funcref("get_funcref");
-Name get_externref("get_externref");
Name get_anyref("get_anyref");
Name get_eqref("get_eqref");
Name get_i31ref("get_i31ref");
@@ -69,7 +68,6 @@ Name set_f32("set_f32");
Name set_f64("set_f64");
Name set_v128("set_v128");
Name set_funcref("set_funcref");
-Name set_externref("set_externref");
Name set_anyref("set_anyref");
Name set_eqref("set_eqref");
Name set_i31ref("set_i31ref");
@@ -98,9 +96,6 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> {
case Type::funcref:
import = get_funcref;
break;
- case Type::externref:
- import = get_externref;
- break;
case Type::anyref:
import = get_anyref;
break;
@@ -158,9 +153,6 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> {
case Type::funcref:
import = set_funcref;
break;
- case Type::externref:
- import = set_externref;
- break;
case Type::anyref:
import = set_anyref;
break;
@@ -204,20 +196,12 @@ struct InstrumentLocals : public WalkerPass<PostWalker<InstrumentLocals>> {
set_funcref,
{Type::i32, Type::i32, Type::funcref},
Type::funcref);
- 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_anyref, {Type::i32, Type::i32, Type::anyref}, Type::anyref);
+ addImport(
+ curr, set_anyref, {Type::i32, Type::i32, Type::anyref}, Type::anyref);
if (curr->features.hasGC()) {
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_eqref, {Type::i32, Type::i32, Type::eqref}, Type::eqref);
addImport(
curr, set_eqref, {Type::i32, Type::i32, Type::eqref}, Type::eqref);
diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp
index 467d7f724..8721753a1 100644
--- a/src/tools/fuzzing/fuzzing.cpp
+++ b/src/tools/fuzzing/fuzzing.cpp
@@ -32,7 +32,7 @@ TranslateToFuzzReader::TranslateToFuzzReader(Module& wasm,
: wasm(wasm), builder(wasm), random(std::move(input), wasm.features) {
// - funcref cannot be logged because referenced functions can be inlined or
// removed during optimization
- // - there's no point in logging externref or anyref because these are opaque
+ // - there's no point in logging anyref because it is opaque
// - don't bother logging tuples
loggableTypes = {Type::i32, Type::i64, Type::f32, Type::f64};
if (wasm.features.hasSIMD()) {
@@ -1460,7 +1460,6 @@ Expression* TranslateToFuzzReader::makeNonAtomicLoad(Type type) {
16, false, offset, pick(1, 2, 4, 8, 16), ptr, type);
}
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -1564,7 +1563,6 @@ Expression* TranslateToFuzzReader::makeNonAtomicStore(Type type) {
16, offset, pick(1, 2, 4, 8, 16), ptr, value, type);
}
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -1700,7 +1698,6 @@ Literal TranslateToFuzzReader::makeLiteral(Type type) {
return Literal(getDouble());
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -1747,7 +1744,6 @@ Literal TranslateToFuzzReader::makeLiteral(Type type) {
return Literal(double(small));
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -1817,7 +1813,6 @@ Literal TranslateToFuzzReader::makeLiteral(Type type) {
break;
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -1846,7 +1841,6 @@ Literal TranslateToFuzzReader::makeLiteral(Type type) {
break;
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -1919,9 +1913,6 @@ Expression* TranslateToFuzzReader::makeConst(Type type) {
switch (heapType.getBasic()) {
case HeapType::func:
return makeRefFuncConst(type);
- case HeapType::ext:
- // No trivial way to create an externref.
- break;
case HeapType::any: {
// Choose a subtype we can materialize a constant for. We cannot
// materialize non-nullable refs to func or i31 in global contexts.
@@ -2067,7 +2058,6 @@ Expression* TranslateToFuzzReader::makeUnary(Type type) {
make(Type::v128)});
}
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -2208,7 +2198,6 @@ Expression* TranslateToFuzzReader::makeUnary(Type type) {
WASM_UNREACHABLE("invalid value");
}
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -2447,7 +2436,6 @@ Expression* TranslateToFuzzReader::makeBinary(Type type) {
make(Type::v128)});
}
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -2655,7 +2643,6 @@ Expression* TranslateToFuzzReader::makeSIMDExtract(Type type) {
break;
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -2913,12 +2900,10 @@ Type TranslateToFuzzReader::getSingleConcreteType() {
WeightedOption{Type::f32, VeryImportant},
WeightedOption{Type::f64, VeryImportant})
.add(FeatureSet::SIMD, WeightedOption{Type::v128, Important})
- .add(FeatureSet::ReferenceTypes, Type::funcref, Type::externref)
+ .add(FeatureSet::ReferenceTypes, Type::funcref, Type::anyref)
.add(FeatureSet::ReferenceTypes | FeatureSet::GC,
// Type(HeapType::func, NonNullable),
- // Type(HeapType::ext, NonNullable),
- Type(HeapType::any, Nullable),
- Type(HeapType::any, NonNullable),
+ // Type(HeapType::any, NonNullable),
Type(HeapType::eq, Nullable),
Type(HeapType::eq, NonNullable),
Type(HeapType::i31, Nullable),
@@ -2929,11 +2914,9 @@ Type TranslateToFuzzReader::getSingleConcreteType() {
Type TranslateToFuzzReader::getReferenceType() {
return pick(FeatureOptions<Type>()
- .add(FeatureSet::ReferenceTypes, Type::funcref, Type::externref)
+ .add(FeatureSet::ReferenceTypes, Type::funcref, Type::anyref)
.add(FeatureSet::ReferenceTypes | FeatureSet::GC,
Type(HeapType::func, NonNullable),
- Type(HeapType::ext, NonNullable),
- Type(HeapType::any, Nullable),
Type(HeapType::any, NonNullable),
Type(HeapType::eq, Nullable),
Type(HeapType::eq, NonNullable),
@@ -3016,12 +2999,9 @@ HeapType TranslateToFuzzReader::getSubType(HeapType type) {
case HeapType::func:
// TODO: Typed function references.
return HeapType::func;
- case HeapType::ext:
- return HeapType::ext;
case HeapType::any:
// TODO: nontrivial types as well.
return pick(HeapType::func,
- HeapType::ext,
HeapType::any,
HeapType::eq,
HeapType::i31,
diff --git a/src/tools/fuzzing/heap-types.cpp b/src/tools/fuzzing/heap-types.cpp
index e918aa8b5..2e96087d7 100644
--- a/src/tools/fuzzing/heap-types.cpp
+++ b/src/tools/fuzzing/heap-types.cpp
@@ -153,7 +153,6 @@ struct HeapTypeGeneratorImpl {
HeapType::BasicHeapType generateBasicHeapType() {
return rand.pick(HeapType::func,
- HeapType::ext,
HeapType::any,
HeapType::eq,
HeapType::i31,
@@ -167,7 +166,6 @@ struct HeapTypeGeneratorImpl {
.add(FeatureSet::SIMD, Type::v128)
.add(FeatureSet::ReferenceTypes | FeatureSet::GC,
Type::funcref,
- Type::externref,
Type::anyref,
Type::eqref,
Type::i31ref,
@@ -294,7 +292,6 @@ struct HeapTypeGeneratorImpl {
return type;
} else {
switch (type) {
- case HeapType::ext:
case HeapType::i31:
// No other subtypes.
return type;
@@ -385,8 +382,6 @@ struct HeapTypeGeneratorImpl {
switch (type.getBasic()) {
case HeapType::func:
return pickSubFunc();
- case HeapType::ext:
- return HeapType::ext;
case HeapType::any:
return pickSubAny();
case HeapType::eq:
@@ -496,7 +491,6 @@ struct HeapTypeGeneratorImpl {
switch (*basic) {
case HeapType::func:
return SignatureKind{};
- case HeapType::ext:
case HeapType::i31:
return super;
case HeapType::any:
diff --git a/src/tools/spec-wrapper.h b/src/tools/spec-wrapper.h
index 3a490c954..43c0e9353 100644
--- a/src/tools/spec-wrapper.h
+++ b/src/tools/spec-wrapper.h
@@ -55,9 +55,6 @@ inline std::string generateSpecWrapper(Module& wasm) {
case Type::funcref:
ret += "(ref.null func)";
break;
- case Type::externref:
- ret += "(ref.null extern)";
- break;
case Type::anyref:
ret += "(ref.null any)";
break;
diff --git a/src/tools/wasm-reduce.cpp b/src/tools/wasm-reduce.cpp
index 4d7b8f494..c6f9be0de 100644
--- a/src/tools/wasm-reduce.cpp
+++ b/src/tools/wasm-reduce.cpp
@@ -628,7 +628,6 @@ struct Reducer
break;
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -656,7 +655,6 @@ struct Reducer
break;
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -684,7 +682,6 @@ struct Reducer
break;
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -712,7 +709,6 @@ struct Reducer
WASM_UNREACHABLE("unexpected type");
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -726,7 +722,6 @@ struct Reducer
}
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index d8225ce0f..62c2f7af2 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -362,10 +362,8 @@ enum EncodedType {
i16 = -0x7, // 0x79
// function reference type
funcref = -0x10, // 0x70
- // opaque host reference type
- externref = -0x11, // 0x6f
- // any reference type
- anyref = -0x12, // 0x6e
+ // top type of references, including host references
+ anyref = -0x11, // 0x6f
// comparable reference type
eqref = -0x13, // 0x6d
// nullable typed function reference type, with parameter
@@ -391,12 +389,11 @@ enum EncodedType {
};
enum EncodedHeapType {
- func = -0x10, // 0x70
- extern_ = -0x11, // 0x6f
- any = -0x12, // 0x6e
- eq = -0x13, // 0x6d
- i31 = -0x16, // 0x6a
- data = -0x19, // 0x67
+ func = -0x10, // 0x70
+ any = -0x11, // 0x6f
+ eq = -0x13, // 0x6d
+ i31 = -0x16, // 0x6a
+ data = -0x19, // 0x67
};
namespace UserSections {
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index 7bd2eecfc..de26886a4 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -999,7 +999,6 @@ public:
}
TODO_SINGLE_COMPOUND(type);
switch (type.getBasic()) {
- case Type::externref:
case Type::anyref:
case Type::eqref:
assert(value.isNull() && "unexpected non-null reference type literal");
@@ -1181,7 +1180,6 @@ public:
}
case Type::funcref:
WASM_UNREACHABLE("handled above");
- case Type::externref:
case Type::anyref:
case Type::eqref:
return ExpressionManipulator::refNull(curr, curr->type);
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index 3b0ceea99..641684fe9 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -1483,7 +1483,7 @@ public:
return typename Cast::Null{original};
}
// The input may not be GC data or a function; for example it could be an
- // externref or an i31. The cast definitely fails in these cases.
+ // anyref or an i31. The cast definitely fails in these cases.
if (!original.isData() && !original.isFunction()) {
return typename Cast::Failure{original};
}
@@ -2360,7 +2360,6 @@ public:
case Type::v128:
return Literal(load128(addr).data());
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -2419,7 +2418,6 @@ public:
store128(addr, value.getv128());
break;
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
diff --git a/src/wasm-type.h b/src/wasm-type.h
index 4d908fe05..a75466882 100644
--- a/src/wasm-type.h
+++ b/src/wasm-type.h
@@ -107,7 +107,6 @@ public:
f64,
v128,
funcref,
- externref,
anyref,
eqref,
i31ref,
@@ -151,11 +150,10 @@ public:
// │ v128 ║ x │ │ x │ x │ V │ ┘
// ├─ Aliases ───╫───┼───┼───┼───┤───────┤
// │ funcref ║ x │ │ x │ x │ f n │ ┐ Ref
- // │ externref ║ x │ │ x │ x │ f? n │ │ f_unc
- // │ anyref ║ x │ │ x │ x │ f? n │ │ n_ullable
- // │ eqref ║ x │ │ x │ x │ n │ │ ┐ TODO (GC)
- // │ i31ref ║ x │ │ x │ x │ │ │ │
- // │ dataref ║ x │ │ x │ x │ │ │ ┘
+ // │ anyref ║ x │ │ x │ x │ f? n │ │ f_unc
+ // │ eqref ║ x │ │ x │ x │ n │ │ n_ullable
+ // │ i31ref ║ x │ │ x │ x │ │ │
+ // │ dataref ║ x │ │ x │ x │ │ │
// ├─ Compound ──╫───┼───┼───┼───┤───────┤ │
// │ Ref ║ │ x │ x │ x │ f? n? │◄┘
// │ Tuple ║ │ x │ │ x │ │
@@ -340,7 +338,6 @@ class HeapType {
public:
enum BasicHeapType : uint32_t {
func,
- ext,
any,
eq,
i31,
diff --git a/src/wasm/literal.cpp b/src/wasm/literal.cpp
index fe763680e..b7bb83155 100644
--- a/src/wasm/literal.cpp
+++ b/src/wasm/literal.cpp
@@ -47,7 +47,6 @@ Literal::Literal(Type type) : type(type) {
return;
case Type::unreachable:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -102,7 +101,6 @@ Literal::Literal(const Literal& other) : type(other.type) {
return;
case Type::unreachable:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -128,7 +126,6 @@ Literal::Literal(const Literal& other) : type(other.type) {
if (heapType.isBasic()) {
switch (heapType.getBasic()) {
case HeapType::any:
- case HeapType::ext:
case HeapType::eq:
return; // null
case HeapType::i31:
@@ -355,7 +352,6 @@ void Literal::getBits(uint8_t (&buf)[16]) const {
case Type::none:
case Type::unreachable:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -384,7 +380,7 @@ bool Literal::operator==(const Literal& other) const {
return gcData == other.gcData;
}
// other non-null reference type literals cannot represent concrete values,
- // i.e. there is no concrete externref, anyref or eqref other than null.
+ // i.e. there is no concrete anyref or eqref other than null.
WASM_UNREACHABLE("unexpected type");
};
if (type.isBasic()) {
@@ -401,7 +397,6 @@ bool Literal::operator==(const Literal& other) const {
case Type::v128:
return memcmp(v128, other.v128, 16) == 0;
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::dataref:
@@ -528,10 +523,6 @@ std::ostream& operator<<(std::ostream& o, Literal literal) {
}
} else {
switch (literal.type.getHeapType().getBasic()) {
- case HeapType::ext:
- assert(literal.isNull() && "unexpected non-null externref literal");
- o << "externref(null)";
- break;
case HeapType::any:
assert(literal.isNull() && "unexpected non-null anyref literal");
o << "anyref(null)";
@@ -580,7 +571,6 @@ std::ostream& operator<<(std::ostream& o, Literal literal) {
literal.printVec128(o, literal.getv128());
break;
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -804,7 +794,6 @@ Literal Literal::eqz() const {
return eq(Literal(double(0)));
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -828,7 +817,6 @@ Literal Literal::neg() const {
return Literal(int64_t(i64 ^ 0x8000000000000000ULL)).castToF64();
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -852,7 +840,6 @@ Literal Literal::abs() const {
return Literal(int64_t(i64 & 0x7fffffffffffffffULL)).castToF64();
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -993,7 +980,6 @@ Literal Literal::add(const Literal& other) const {
return standardizeNaN(getf64() + other.getf64());
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -1017,7 +1003,6 @@ Literal Literal::sub(const Literal& other) const {
return standardizeNaN(getf64() - other.getf64());
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -1120,7 +1105,6 @@ Literal Literal::mul(const Literal& other) const {
return standardizeNaN(getf64() * other.getf64());
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -1356,7 +1340,6 @@ Literal Literal::eq(const Literal& other) const {
return Literal(getf64() == other.getf64());
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -1380,7 +1363,6 @@ Literal Literal::ne(const Literal& other) const {
return Literal(getf64() != other.getf64());
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index b21ab1209..9dcdbb73d 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -1304,9 +1304,6 @@ void WasmBinaryWriter::writeType(Type type) {
case Type::funcref:
ret = BinaryConsts::EncodedType::funcref;
break;
- case Type::externref:
- ret = BinaryConsts::EncodedType::externref;
- break;
case Type::anyref:
ret = BinaryConsts::EncodedType::anyref;
break;
@@ -1336,9 +1333,6 @@ void WasmBinaryWriter::writeHeapType(HeapType type) {
case HeapType::func:
ret = BinaryConsts::EncodedHeapType::func;
break;
- case HeapType::ext:
- ret = BinaryConsts::EncodedHeapType::extern_;
- break;
case HeapType::any:
ret = BinaryConsts::EncodedHeapType::any;
break;
@@ -1687,9 +1681,6 @@ bool WasmBinaryBuilder::getBasicType(int32_t code, Type& out) {
case BinaryConsts::EncodedType::funcref:
out = Type::funcref;
return true;
- case BinaryConsts::EncodedType::externref:
- out = Type::externref;
- return true;
case BinaryConsts::EncodedType::anyref:
out = Type::anyref;
return true;
@@ -1712,9 +1703,6 @@ bool WasmBinaryBuilder::getBasicHeapType(int64_t code, HeapType& out) {
case BinaryConsts::EncodedHeapType::func:
out = HeapType::func;
return true;
- case BinaryConsts::EncodedHeapType::extern_:
- out = HeapType::ext;
- return true;
case BinaryConsts::EncodedHeapType::any:
out = HeapType::any;
return true;
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index 6da0316c8..02da4f909 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -1171,10 +1171,8 @@ Type SExpressionWasmBuilder::stringToType(const char* str,
if (strncmp(str, "funcref", 7) == 0 && (prefix || str[7] == 0)) {
return Type::funcref;
}
- if (strncmp(str, "externref", 9) == 0 && (prefix || str[9] == 0)) {
- return Type::externref;
- }
- if (strncmp(str, "anyref", 6) == 0 && (prefix || str[6] == 0)) {
+ if ((strncmp(str, "externref", 9) == 0 && (prefix || str[9] == 0)) ||
+ (strncmp(str, "anyref", 6) == 0 && (prefix || str[6] == 0))) {
return Type::anyref;
}
if (strncmp(str, "eqref", 5) == 0 && (prefix || str[5] == 0)) {
@@ -1206,7 +1204,7 @@ HeapType SExpressionWasmBuilder::stringToHeapType(const char* str,
}
if (str[1] == 'x' && str[2] == 't' && str[3] == 'e' && str[4] == 'r' &&
str[5] == 'n' && (prefix || str[6] == 0)) {
- return HeapType::ext;
+ return HeapType::any;
}
}
if (str[0] == 'a') {
@@ -1740,7 +1738,6 @@ parseConst(cashew::IString s, Type type, MixedArena& allocator) {
}
case Type::v128:
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp
index 176f2f53f..8afeb6779 100644
--- a/src/wasm/wasm-stack.cpp
+++ b/src/wasm/wasm-stack.cpp
@@ -188,7 +188,6 @@ void BinaryInstWriter::visitLoad(Load* curr) {
// a load
return;
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -292,7 +291,6 @@ void BinaryInstWriter::visitStore(Store* curr) {
<< U32LEB(BinaryConsts::V128Store);
break;
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -748,7 +746,6 @@ void BinaryInstWriter::visitConst(Const* curr) {
break;
}
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp
index ce823aae0..a9ce30e15 100644
--- a/src/wasm/wasm-type.cpp
+++ b/src/wasm/wasm-type.cpp
@@ -629,8 +629,6 @@ std::optional<Type> TypeInfo::getCanonical() const {
switch (basic.getBasic()) {
case HeapType::func:
return Type::funcref;
- case HeapType::ext:
- return Type::externref;
case HeapType::any:
return Type::anyref;
case HeapType::eq:
@@ -1050,7 +1048,6 @@ unsigned Type::getByteSize() const {
case Type::v128:
return 16;
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -1112,7 +1109,6 @@ FeatureSet Type::getFeatures() const {
}
if (heapType.isBasic()) {
switch (heapType.getBasic()) {
- case HeapType::BasicHeapType::any:
case HeapType::BasicHeapType::eq:
case HeapType::BasicHeapType::i31:
case HeapType::BasicHeapType::data:
@@ -1166,8 +1162,6 @@ HeapType Type::getHeapType() const {
break;
case Type::funcref:
return HeapType::func;
- case Type::externref:
- return HeapType::ext;
case Type::anyref:
return HeapType::any;
case Type::eqref:
@@ -1599,8 +1593,6 @@ bool SubTyper::isSubType(HeapType a, HeapType b) {
switch (b.getBasic()) {
case HeapType::func:
return a.isSignature();
- case HeapType::ext:
- return false;
case HeapType::any:
return true;
case HeapType::eq:
@@ -1884,7 +1876,6 @@ HeapType::BasicHeapType TypeBounder::lub(HeapType::BasicHeapType a,
}
switch (a) {
case HeapType::func:
- case HeapType::ext:
case HeapType::any:
return HeapType::any;
case HeapType::eq:
@@ -2020,8 +2011,6 @@ std::ostream& TypePrinter::print(Type type) {
return os << "v128";
case Type::funcref:
return os << "funcref";
- case Type::externref:
- return os << "externref";
case Type::anyref:
return os << "anyref";
case Type::eqref:
@@ -2061,8 +2050,6 @@ std::ostream& TypePrinter::print(HeapType type) {
switch (type.getBasic()) {
case HeapType::func:
return os << "func";
- case HeapType::ext:
- return os << "extern";
case HeapType::any:
return os << "any";
case HeapType::eq:
@@ -3823,8 +3810,8 @@ void canonicalizeBasicTypes(CanonicalizationState& state) {
if (replacements.size()) {
// Canonicalizing basic heap types may cause their parent types to become
- // canonicalizable as well, for example after creating `(ref null extern)`
- // we can futher canonicalize to `externref`.
+ // canonicalizable as well, for example after creating `(ref null any)` we
+ // can futher canonicalize to `anyref`.
struct TypeCanonicalizer : TypeGraphWalkerBase<TypeCanonicalizer> {
void scanType(Type* type) {
if (type->isTuple()) {
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp
index c0b3e9292..39eb996ea 100644
--- a/src/wasm/wasm-validator.cpp
+++ b/src/wasm/wasm-validator.cpp
@@ -1399,7 +1399,6 @@ void FunctionValidator::validateMemBytes(uint8_t bytes,
case Type::unreachable:
break;
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -2842,7 +2841,6 @@ void FunctionValidator::validateAlignment(
case Type::unreachable:
break;
case Type::funcref:
- case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
@@ -3148,17 +3146,16 @@ static void validateTables(Module& module, ValidationInfo& info) {
"table",
"Non-nullable reference types are not yet supported for tables");
if (!module.features.hasGC()) {
- info.shouldBeTrue(table->type.isFunction() ||
- table->type == Type::externref,
+ info.shouldBeTrue(table->type.isFunction() || table->type == Type::anyref,
"table",
- "Only function reference types or externref are valid "
+ "Only function reference types or anyref are valid "
"for table type (when GC is disabled)");
}
if (!module.features.hasTypedFunctionReferences()) {
info.shouldBeTrue(table->type == Type::funcref ||
- table->type == Type::externref,
+ table->type == Type::anyref,
"table",
- "Only funcref and externref are valid for table type "
+ "Only funcref and anyref are valid for table type "
"(when typed-function references are disabled)");
}
}
diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt
index 3ea3f11a9..70be70e61 100644
--- a/test/binaryen.js/kitchen-sink.js.txt
+++ b/test/binaryen.js/kitchen-sink.js.txt
@@ -16,14 +16,14 @@
// 7
// BinaryenTypeExternref: 8
// 8
- // BinaryenTypeAnyref: 9
+ // BinaryenTypeAnyref: 8
+ // 8
+ // BinaryenTypeEqref: 9
// 9
- // BinaryenTypeEqref: 10
+ // BinaryenTypeI31ref: 10
// 10
- // BinaryenTypeI31ref: 11
+ // BinaryenTypeDataref: 11
// 11
- // BinaryenTypeDataref: 12
- // 12
// BinaryenTypeAuto: -1
// 2,2
// 2,2
@@ -2070,7 +2070,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
)
(drop
(ref.is_null
- (ref.null extern)
+ (ref.null any)
)
)
(drop
@@ -2165,7 +2165,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
(pop funcref)
)
(drop
- (pop externref)
+ (pop anyref)
)
(drop
(pop anyref)
@@ -4162,7 +4162,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
)
(drop
(ref.is_null
- (ref.null extern)
+ (ref.null any)
)
)
(drop
@@ -4257,7 +4257,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7}
(pop funcref)
)
(drop
- (pop externref)
+ (pop anyref)
)
(drop
(pop anyref)
diff --git a/test/ctor-eval/bad-indirect-call3.wast.out b/test/ctor-eval/bad-indirect-call3.wast.out
index 4b470e10a..257bf3168 100644
--- a/test/ctor-eval/bad-indirect-call3.wast.out
+++ b/test/ctor-eval/bad-indirect-call3.wast.out
@@ -1,5 +1,5 @@
(module
- (type $externref_=>_none (func (param externref)))
+ (type $anyref_=>_none (func (param anyref)))
(type $none_=>_none (func))
(type $funcref_=>_none (func (param funcref)))
(memory $0 256 256)
@@ -7,7 +7,7 @@
(table $0 1 1 funcref)
(elem (i32.const 0) $callee)
(export "sig_mismatch" (func $sig_mismatch))
- (func $callee (param $0 externref)
+ (func $callee (param $0 anyref)
(i32.store8
(i32.const 40)
(i32.const 67)
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index 95d1a1ed6..49a3d74b1 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -7,10 +7,10 @@
// BinaryenTypeVec128: 6
// BinaryenTypeFuncref: 7
// BinaryenTypeExternref: 8
- // BinaryenTypeAnyref: 9
- // BinaryenTypeEqref: 10
- // BinaryenTypeI31ref: 11
- // BinaryenTypeDataref: 12
+ // BinaryenTypeAnyref: 8
+ // BinaryenTypeEqref: 9
+ // BinaryenTypeI31ref: 10
+ // BinaryenTypeDataref: 11
// BinaryenTypeAuto: -1
BinaryenFeatureMVP: 0
BinaryenFeatureAtomics: 1
@@ -65,7 +65,7 @@ BinaryenFeatureAll: 57343
(start $starter)
(func "$kitchen()sinker" (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32)
(local $4 i32)
- (local $5 externref)
+ (local $5 anyref)
(block $the-body (result i32)
(block $the-nothing
(drop
@@ -1946,7 +1946,7 @@ BinaryenFeatureAll: 57343
)
(drop
(ref.is_null
- (ref.null extern)
+ (ref.null any)
)
)
(drop
@@ -2086,7 +2086,7 @@ BinaryenFeatureAll: 57343
(pop funcref)
)
(drop
- (pop externref)
+ (pop anyref)
)
(drop
(pop i32 i64 f32 f64)
diff --git a/test/example/stack-utils.cpp b/test/example/stack-utils.cpp
index b5ac496ca..8709396f9 100644
--- a/test/example/stack-utils.cpp
+++ b/test/example/stack-utils.cpp
@@ -392,7 +392,7 @@ void test_signature_lub() {
(StackSignature{Type::i32, Type::i32, StackSignature::Polymorphic}));
}
{
- StackSignature a{Type::none, Type::externref, StackSignature::Polymorphic};
+ StackSignature a{Type::none, Type::anyref, StackSignature::Polymorphic};
StackSignature b{Type::none, Type::funcref, StackSignature::Polymorphic};
assert(StackSignature::haveLeastUpperBound(a, b));
assert(
@@ -411,7 +411,7 @@ void test_signature_lub() {
StackSignature a{
{Type::i32, Type::funcref}, Type::funcref, StackSignature::Polymorphic};
StackSignature b{
- Type::funcref, {Type::f32, Type::externref}, StackSignature::Polymorphic};
+ Type::funcref, {Type::f32, Type::anyref}, StackSignature::Polymorphic};
assert(StackSignature::haveLeastUpperBound(a, b));
assert(StackSignature::getLeastUpperBound(a, b) ==
(StackSignature{{Type::i32, Type::funcref},
diff --git a/test/example/type-builder-nominal.cpp b/test/example/type-builder-nominal.cpp
index 5bfefadc3..34571c48e 100644
--- a/test/example/type-builder-nominal.cpp
+++ b/test/example/type-builder-nominal.cpp
@@ -12,7 +12,7 @@ void test_builder() {
// (type $sig (func (param (ref $struct)) (result (ref $array) i32)))
// (type $struct (struct (field (ref null $array) (mut rtt 0 $array))))
- // (type $array (array (mut externref)))
+ // (type $array (array (mut anyref)))
TypeBuilder builder;
assert(builder.size() == 0);
@@ -24,11 +24,11 @@ void test_builder() {
Type refArray = builder.getTempRefType(builder[2], NonNullable);
Type refNullArray = builder.getTempRefType(builder[2], Nullable);
Type rttArray = builder.getTempRttType(Rtt(0, builder[2]));
- Type refNullExt(HeapType::ext, Nullable);
+ Type refNullAny(HeapType::any, Nullable);
Signature sig(refStruct, builder.getTempTupleType({refArray, Type::i32}));
Struct struct_({Field(refNullArray, Immutable), Field(rttArray, Mutable)});
- Array array(Field(refNullExt, Mutable));
+ Array array(Field(refNullAny, Mutable));
{
IndexedTypeNameGenerator print(builder);
@@ -327,7 +327,6 @@ void test_subtypes() {
{
// Basic Types
for (auto other : {HeapType::func,
- HeapType::ext,
HeapType::any,
HeapType::eq,
HeapType::i31,
diff --git a/test/example/type-builder-nominal.txt b/test/example/type-builder-nominal.txt
index 8d1fe67e4..745f63df2 100644
--- a/test/example/type-builder-nominal.txt
+++ b/test/example/type-builder-nominal.txt
@@ -12,7 +12,7 @@ $array => (; temp ;) (func_subtype func)
After setting heap types:
$sig => (; temp ;) (func_subtype (param (; temp ;) (ref $1)) (result (; temp ;) (ref $2) i32) func)
$struct => (; temp ;) (struct_subtype (field (; temp ;) (ref null $2) (mut (; temp ;) (rtt 0 $2))) data)
-$array => (; temp ;) (array_subtype (mut externref) data)
+$array => (; temp ;) (array_subtype (mut anyref) data)
(ref $sig) => (; temp ;) (ref $0)
(ref $struct) => (; temp ;) (ref $1)
(ref $array) => (; temp ;) (ref $2)
@@ -22,7 +22,7 @@ $array => (; temp ;) (array_subtype (mut externref) data)
After building types:
$sig => (func_subtype (param (ref $1)) (result (ref $2) i32) func)
$struct => (struct_subtype (field (ref null $2) (mut (rtt 0 $2))) data)
-$array => (array_subtype (mut externref) data)
+$array => (array_subtype (mut anyref) data)
(ref $sig) => (ref $0)
(ref $struct) => (ref $1)
(ref $array) => (ref $2)
@@ -69,7 +69,7 @@ $array => (; temp ;) (func_subtype func)
After setting heap types:
$sig => (; temp ;) (func_subtype (param (; temp ;) (ref $1)) (result (; temp ;) (ref $2) i32) func)
$struct => (; temp ;) (struct_subtype (field (; temp ;) (ref null $2) (mut (; temp ;) (rtt 0 $2))) data)
-$array => (; temp ;) (array_subtype (mut externref) data)
+$array => (; temp ;) (array_subtype (mut anyref) data)
(ref $sig) => (; temp ;) (ref $0)
(ref $struct) => (; temp ;) (ref $1)
(ref $array) => (; temp ;) (ref $2)
@@ -79,7 +79,7 @@ $array => (; temp ;) (array_subtype (mut externref) data)
After building types:
$sig => (func_subtype (param (ref $1)) (result (ref $2) i32) func)
$struct => (struct_subtype (field (ref null $2) (mut (rtt 0 $2))) data)
-$array => (array_subtype (mut externref) data)
+$array => (array_subtype (mut anyref) data)
(ref $sig) => (ref $0)
(ref $struct) => (ref $1)
(ref $array) => (ref $2)
diff --git a/test/example/type-builder.cpp b/test/example/type-builder.cpp
index 318e48f2e..ce7b74841 100644
--- a/test/example/type-builder.cpp
+++ b/test/example/type-builder.cpp
@@ -239,7 +239,6 @@ void test_lub() {
{
// Basic Types
for (auto other : {Type::funcref,
- Type::externref,
Type::anyref,
Type::eqref,
Type::i31ref,
diff --git a/test/example/typeinfo.cpp b/test/example/typeinfo.cpp
index dd8e13d43..ed5637bd9 100644
--- a/test/example/typeinfo.cpp
+++ b/test/example/typeinfo.cpp
@@ -15,16 +15,6 @@ void test_compound() {
assert(Type(func, NonNullable).getID() ==
Type(sameFunc, NonNullable).getID());
- HeapType extern_(HeapType::ext);
- assert(Type(extern_, Nullable).getID() == Type::externref);
- assert(Type(extern_, NonNullable).getID() ==
- Type(extern_, NonNullable).getID());
- assert(Type(extern_, NonNullable).getID() !=
- Type(extern_, Nullable).getID());
- HeapType sameExtern(HeapType::ext);
- assert(Type(extern_, NonNullable).getID() ==
- Type(sameExtern, NonNullable).getID());
-
HeapType any(HeapType::any);
assert(Type(any, Nullable).getID() == Type::anyref);
assert(Type(any, NonNullable).getID() == Type(any, NonNullable).getID());
@@ -102,7 +92,7 @@ void test_compound() {
Tuple sameTuple({Type::i32, Type::f64});
assert(Type(tuple).getID() == Type(sameTuple).getID());
- Tuple otherTuple({Type::f64, Type::externref});
+ Tuple otherTuple({Type::f64, Type::anyref});
assert(Type(tuple).getID() != Type(otherTuple).getID());
}
{
@@ -140,9 +130,6 @@ void test_printing() {
std::cout << HeapType(HeapType::func) << "\n";
std::cout << Type(HeapType::func, Nullable) << "\n";
std::cout << Type(HeapType::func, NonNullable) << "\n";
- std::cout << HeapType(HeapType::ext) << "\n";
- std::cout << Type(HeapType::ext, Nullable) << "\n";
- std::cout << Type(HeapType::ext, NonNullable) << "\n";
std::cout << HeapType(HeapType::any) << "\n";
std::cout << Type(HeapType::any, Nullable) << "\n";
std::cout << Type(HeapType::any, NonNullable) << "\n";
@@ -178,7 +165,7 @@ void test_printing() {
{Type::i64, Immutable},
{Type::f32, Mutable},
{Type::f64, Mutable},
- {Type::externref, Immutable},
+ {Type::anyref, Immutable},
});
std::cout << struct_ << "\n";
std::cout << Type(struct_, NonNullable) << "\n";
@@ -190,7 +177,7 @@ void test_printing() {
std::cout << array << "\n";
std::cout << Type(array, NonNullable) << "\n";
std::cout << Type(array, Nullable) << "\n";
- Array arrayMut({Type::externref, Mutable});
+ Array arrayMut({Type::anyref, Mutable});
std::cout << arrayMut << "\n";
std::cout << Type(arrayMut, NonNullable) << "\n";
std::cout << Type(arrayMut, Nullable) << "\n";
@@ -203,7 +190,7 @@ void test_printing() {
Tuple tuple({
Type::i32,
Type::f64,
- Type::externref,
+ Type::anyref,
});
std::cout << tuple << "\n";
std::cout << Type(tuple) << "\n";
@@ -212,8 +199,6 @@ void test_printing() {
std::cout << "\n;; Rtt\n";
std::cout << Rtt(0, HeapType::func) << "\n";
std::cout << Type(Rtt(0, HeapType::func)) << "\n";
- std::cout << Rtt(1, HeapType::ext) << "\n";
- std::cout << Type(Rtt(1, HeapType::ext)) << "\n";
std::cout << Rtt(2, HeapType::any) << "\n";
std::cout << Type(Rtt(2, HeapType::any)) << "\n";
std::cout << Rtt(3, HeapType::eq) << "\n";
diff --git a/test/example/typeinfo.txt b/test/example/typeinfo.txt
index 552e59e58..924fcb3ec 100644
--- a/test/example/typeinfo.txt
+++ b/test/example/typeinfo.txt
@@ -2,9 +2,6 @@
func
funcref
(ref func)
-extern
-externref
-(ref extern)
any
anyref
(ref any)
@@ -30,7 +27,7 @@ i31ref
(struct)
(ref $struct.0)
(ref null $struct.0)
-(struct (field i32 i64 (mut f32) (mut f64) externref))
+(struct (field i32 i64 (mut f32) (mut f64) anyref))
(ref $struct.0)
(ref null $struct.0)
@@ -38,21 +35,19 @@ i31ref
(array i32)
(ref $array.0)
(ref null $array.0)
-(array (mut externref))
+(array (mut anyref))
(ref $array.0)
(ref null $array.0)
;; Tuple
()
none
-(i32 f64 externref)
-(i32 f64 externref)
+(i32 f64 anyref)
+(i32 f64 anyref)
;; Rtt
(rtt 0 func)
(rtt 0 func)
-(rtt 1 extern)
-(rtt 1 extern)
(rtt 2 any)
(rtt 2 any)
(rtt 3 eq)
diff --git a/test/gtest/type-builder.cpp b/test/gtest/type-builder.cpp
index 7817939ce..42b388532 100644
--- a/test/gtest/type-builder.cpp
+++ b/test/gtest/type-builder.cpp
@@ -118,7 +118,7 @@ TEST_F(TypeTest, IndexedTypePrinter) {
TEST_F(EquirecursiveTest, Basics) {
// (type $sig (func (param (ref $struct)) (result (ref $array) i32)))
// (type $struct (struct (field (ref null $array) (mut rtt 0 $array))))
- // (type $array (array (mut externref)))
+ // (type $array (array (mut anyref)))
TypeBuilder builder(3);
ASSERT_EQ(builder.size(), size_t{3});
@@ -127,11 +127,11 @@ TEST_F(EquirecursiveTest, Basics) {
Type refArray = builder.getTempRefType(builder[2], NonNullable);
Type refNullArray = builder.getTempRefType(builder[2], Nullable);
Type rttArray = builder.getTempRttType(Rtt(0, builder[2]));
- Type refNullExt(HeapType::ext, Nullable);
+ Type refNullAny(HeapType::any, Nullable);
Signature sig(refStruct, builder.getTempTupleType({refArray, Type::i32}));
Struct struct_({Field(refNullArray, Immutable), Field(rttArray, Mutable)});
- Array array(Field(refNullExt, Mutable));
+ Array array(Field(refNullAny, Mutable));
builder[0] = sig;
builder[1] = struct_;
@@ -159,7 +159,7 @@ TEST_F(EquirecursiveTest, Basics) {
EXPECT_EQ(
built[1].getStruct(),
Struct({Field(newRefNullArray, Immutable), Field(newRttArray, Mutable)}));
- EXPECT_EQ(built[2].getArray(), Array(Field(refNullExt, Mutable)));
+ EXPECT_EQ(built[2].getArray(), Array(Field(refNullAny, Mutable)));
// The built types should be different from the temporary types.
EXPECT_NE(newRefSig, refSig);
@@ -475,14 +475,14 @@ TEST_F(IsorecursiveTest, CanonicalizeTypesBeforeSubtyping) {
static void testCanonicalizeBasicTypes() {
TypeBuilder builder(5);
- Type externref = builder.getTempRefType(builder[0], Nullable);
- Type externrefs = builder.getTempTupleType({externref, externref});
+ Type anyref = builder.getTempRefType(builder[0], Nullable);
+ Type anyrefs = builder.getTempTupleType({anyref, anyref});
- builder[0] = HeapType::ext;
- builder[1] = Struct({Field(externref, Immutable)});
- builder[2] = Struct({Field(Type::externref, Immutable)});
- builder[3] = Signature(externrefs, Type::none);
- builder[4] = Signature({Type::externref, Type::externref}, Type::none);
+ builder[0] = HeapType::any;
+ builder[1] = Struct({Field(anyref, Immutable)});
+ builder[2] = Struct({Field(Type::anyref, Immutable)});
+ builder[3] = Signature(anyrefs, Type::none);
+ builder[4] = Signature({Type::anyref, Type::anyref}, Type::none);
auto result = builder.build();
ASSERT_TRUE(result);
diff --git a/test/lit/fuzz-types/isorecursive.test b/test/lit/fuzz-types/isorecursive.test
index 33b7974b3..9165d9265 100644
--- a/test/lit/fuzz-types/isorecursive.test
+++ b/test/lit/fuzz-types/isorecursive.test
@@ -2,25 +2,25 @@
;; CHECK: (rec
;; CHECK-NEXT: (type $0 (struct_subtype data))
-;; CHECK-NEXT: (type $1 (func_subtype (param i31ref) (result (ref extern)) func))
-;; CHECK-NEXT: (type $2 (array_subtype (mut (rtt 0 extern)) data))
-;; CHECK-NEXT: (type $3 (array_subtype (mut (rtt 0 extern)) $2))
-;; CHECK-NEXT: (type $4 (array_subtype (mut (rtt 0 extern)) $2))
-;; CHECK-NEXT: (type $5 (array_subtype (mut (rtt 0 extern)) $3))
-;; CHECK-NEXT: (type $6 (array_subtype (mut (rtt 0 extern)) $3))
-;; CHECK-NEXT: (type $7 (struct_subtype (field (mut (ref $8))) $0))
-;; CHECK-NEXT: (type $8 (struct_subtype (field i16 (mut i32) (mut i16)) $0))
-;; CHECK-NEXT: (type $9 (array_subtype (mut (rtt 0 extern)) $6))
+;; CHECK-NEXT: (type $1 (func_subtype (param i31ref) (result dataref) func))
+;; CHECK-NEXT: (type $2 (array_subtype i32 data))
+;; CHECK-NEXT: (type $3 (array_subtype i32 $2))
+;; CHECK-NEXT: (type $4 (array_subtype i32 $2))
+;; CHECK-NEXT: (type $5 (array_subtype i32 $3))
+;; CHECK-NEXT: (type $6 (array_subtype i32 $3))
+;; CHECK-NEXT: (type $7 (struct_subtype $0))
+;; CHECK-NEXT: (type $8 (struct_subtype $0))
+;; CHECK-NEXT: (type $9 (array_subtype i32 $6))
;; CHECK-NEXT: (type $10 (struct_subtype $0))
-;; CHECK-NEXT: (type $11 (array_subtype (mut (rtt 0 extern)) $2))
-;; CHECK-NEXT: (type $12 (struct_subtype (field (mut i8) (rtt $0)) $0))
-;; CHECK-NEXT: (type $13 (array_subtype (mut (rtt 0 extern)) $6))
+;; CHECK-NEXT: (type $11 (array_subtype i32 $2))
+;; CHECK-NEXT: (type $12 (struct_subtype $0))
+;; CHECK-NEXT: (type $13 (array_subtype i32 $6))
;; CHECK-NEXT: )
;; CHECK-NEXT: (rec
-;; CHECK-NEXT: (type $14 (struct_subtype (field funcref f64 (mut (rtt $10)) (ref null $15) i8 (ref null $7)) $10))
-;; CHECK-NEXT: (type $15 (func_subtype (param i31ref) (result (ref extern)) $1))
-;; CHECK-NEXT: (type $16 (array_subtype (mut (rtt 0 extern)) $2))
-;; CHECK-NEXT: (type $17 (struct_subtype (field funcref f64 (mut (rtt $10)) (ref null $15) i8 (ref null $7)) $14))
-;; CHECK-NEXT: (type $18 (struct_subtype (field (mut i8) (rtt $0)) $12))
-;; CHECK-NEXT: (type $19 (func_subtype (param i31ref) (result (ref extern)) $15))
+;; CHECK-NEXT: (type $14 (struct_subtype $10))
+;; CHECK-NEXT: (type $15 (func_subtype (param i31ref) (result dataref) $1))
+;; CHECK-NEXT: (type $16 (array_subtype i32 $2))
+;; CHECK-NEXT: (type $17 (struct_subtype $14))
+;; CHECK-NEXT: (type $18 (struct_subtype (field (mut funcref) (mut (ref null $7)) funcref) $12))
+;; CHECK-NEXT: (type $19 (func_subtype (param i31ref) (result dataref) $15))
;; CHECK-NEXT: )
diff --git a/test/lit/fuzz-types/nominal.test b/test/lit/fuzz-types/nominal.test
index 8ca330adf..248ce6539 100644
--- a/test/lit/fuzz-types/nominal.test
+++ b/test/lit/fuzz-types/nominal.test
@@ -1,24 +1,22 @@
;; RUN: wasm-fuzz-types --nominal -v --seed=0 | filecheck %s
-;; CHECK: Running with seed 0
-;; CHECK-NEXT: Built 20 types:
-;; CHECK-NEXT: (type $0 (struct_subtype (field (ref null $9) (ref $5)) data))
+;; CHECK: (type $0 (struct_subtype (field (ref null $9) (ref $5)) data))
;; CHECK-NEXT: (type $1 (func_subtype (param (rtt 0 $8)) func))
;; CHECK-NEXT: (type $2 (struct_subtype (field (mut (rtt $19)) (ref $4)) data))
-;; CHECK-NEXT: (type $3 (struct_subtype (field (mut (rtt $19)) (ref $4) i32 (mut (ref null $2)) (mut f64)) $2))
-;; CHECK-NEXT: (type $4 (struct_subtype (field (mut (rtt $19)) (ref $4)) $2))
-;; CHECK-NEXT: (type $5 (struct_subtype (field (mut (rtt $19)) (ref $4) i32 (mut (ref null $2)) (mut f64) (mut (ref null $11))) $3))
-;; CHECK-NEXT: (type $6 (struct_subtype (field (mut (rtt $19)) (ref $4) i32 (mut (ref null $2)) (mut f64)) $3))
-;; CHECK-NEXT: (type $7 (struct_subtype (field (ref null $9) (ref $5)) $0))
-;; CHECK-NEXT: (type $8 (struct_subtype (field (ref null $9) (ref $5)) $0))
-;; CHECK-NEXT: (type $9 (struct_subtype (field (mut (rtt $19)) (ref $4) i32 (mut (ref null $2)) (mut f64)) $6))
-;; CHECK-NEXT: (type $10 (struct_subtype (field (ref $9) (ref $5) (mut i31ref)) $0))
+;; CHECK-NEXT: (type $3 (struct_subtype (field (mut (rtt $19)) (ref $4) i64 (mut (ref null $2)) (mut i64)) $2))
+;; CHECK-NEXT: (type $4 (struct_subtype (field (mut (rtt $19)) (ref $4) (mut (ref $13))) $2))
+;; CHECK-NEXT: (type $5 (struct_subtype (field (mut (rtt $19)) (ref $4) i64 (mut (ref null $2)) (mut i64)) $3))
+;; CHECK-NEXT: (type $6 (struct_subtype (field (mut (rtt $19)) (ref $4) i64 (mut (ref null $2)) (mut i64)) $3))
+;; CHECK-NEXT: (type $7 (struct_subtype (field (ref null $9) (ref $5) eqref (mut (ref null $3)) (mut (rtt $18)) dataref) $0))
+;; CHECK-NEXT: (type $8 (struct_subtype (field (ref $9) (ref $5) (rtt 2 $1) (mut (rtt $17)) (mut (rtt i31)) (rtt $8)) $0))
+;; CHECK-NEXT: (type $9 (struct_subtype (field (mut (rtt $19)) (ref $4) i64 (mut (ref null $2)) (mut i64) (rtt 2 $15)) $6))
+;; CHECK-NEXT: (type $10 (struct_subtype (field (ref null $9) (ref $5)) $0))
;; CHECK-NEXT: (type $11 (struct_subtype (field (mut (rtt $19)) (ref $4)) $2))
;; CHECK-NEXT: (type $12 (struct_subtype (field (ref null $9) (ref $5)) $0))
-;; CHECK-NEXT: (type $13 (struct_subtype (field (mut (rtt $19)) (ref $4) i32 (mut (ref null $2)) (mut f64) (ref null i31)) $6))
-;; CHECK-NEXT: (type $14 (struct_subtype (field (ref $9) (ref $5) (mut i31ref) i8) $10))
+;; CHECK-NEXT: (type $13 (struct_subtype (field (mut (rtt $19)) (ref $4) i64 (mut (ref null $2)) (mut i64)) $6))
+;; CHECK-NEXT: (type $14 (struct_subtype (field (ref null $9) (ref $5)) $10))
;; CHECK-NEXT: (type $15 (func_subtype (param (rtt 0 $8)) $1))
-;; CHECK-NEXT: (type $16 (struct_subtype (field (mut (rtt $19)) (ref $4)) $2))
-;; CHECK-NEXT: (type $17 (struct_subtype (field (ref $9) (ref $5) (mut i31ref) i8 (mut dataref) (mut i16)) $14))
+;; CHECK-NEXT: (type $16 (struct_subtype (field (mut (rtt $19)) (ref $4) v128) $2))
+;; CHECK-NEXT: (type $17 (struct_subtype (field (ref null $9) (ref $5)) $14))
;; CHECK-NEXT: (type $18 (struct_subtype (field (ref null $9) (ref $5)) $12))
;; CHECK-NEXT: (type $19 (func_subtype (param (rtt 0 $8)) $15))
diff --git a/test/lit/fuzz-types/structural.test b/test/lit/fuzz-types/structural.test
index 0d81491af..a7b38edb4 100644
--- a/test/lit/fuzz-types/structural.test
+++ b/test/lit/fuzz-types/structural.test
@@ -1,24 +1,22 @@
;; RUN: wasm-fuzz-types --structural -v --seed=0 | filecheck %s
-;; CHECK: Running with seed 0
-;; CHECK-NEXT: Built 20 types:
-;; CHECK-NEXT: (type $0 (struct (field (ref null $3) (ref $5))))
-;; CHECK-NEXT: (type $1 (func (param (rtt 0 $0))))
-;; CHECK-NEXT: (type $2 (struct (field (mut (rtt $1)) (ref $2))))
-;; CHECK-NEXT: (type $3 (struct (field (mut (rtt $1)) (ref $2) i32 (mut (ref null $2)) (mut f64))))
-;; CHECK-NEXT: (type $4 identical to $2)
-;; CHECK-NEXT: (type $5 (struct (field (mut (rtt $1)) (ref $2) i32 (mut (ref null $2)) (mut f64) (mut (ref null $2)))))
+;; CHECK: (type $0 (struct (field (ref null $9) (ref $3))))
+;; CHECK-NEXT: (type $1 (func (param (rtt 0 $8))))
+;; CHECK-NEXT: (type $2 (struct (field (mut (rtt $1)) (ref $4))))
+;; CHECK-NEXT: (type $3 (struct (field (mut (rtt $1)) (ref $4) i64 (mut (ref null $2)) (mut i64))))
+;; CHECK-NEXT: (type $4 (struct (field (mut (rtt $1)) (ref $4) (mut (ref $3)))))
+;; CHECK-NEXT: (type $5 identical to $3)
;; CHECK-NEXT: (type $6 identical to $3)
-;; CHECK-NEXT: (type $7 identical to $0)
-;; CHECK-NEXT: (type $8 identical to $0)
-;; CHECK-NEXT: (type $9 identical to $3)
-;; CHECK-NEXT: (type $10 (struct (field (ref $3) (ref $5) (mut i31ref))))
+;; CHECK-NEXT: (type $7 (struct (field (ref null $9) (ref $3) eqref (mut (ref null $3)) (mut (rtt $0)) dataref)))
+;; CHECK-NEXT: (type $8 (struct (field (ref $9) (ref $3) (rtt 2 $1) (mut (rtt $0)) (mut (rtt i31)) (rtt $8))))
+;; CHECK-NEXT: (type $9 (struct (field (mut (rtt $1)) (ref $4) i64 (mut (ref null $2)) (mut i64) (rtt 2 $1))))
+;; CHECK-NEXT: (type $10 identical to $0)
;; CHECK-NEXT: (type $11 identical to $2)
;; CHECK-NEXT: (type $12 identical to $0)
-;; CHECK-NEXT: (type $13 (struct (field (mut (rtt $1)) (ref $2) i32 (mut (ref null $2)) (mut f64) (ref null i31))))
-;; CHECK-NEXT: (type $14 (struct (field (ref $3) (ref $5) (mut i31ref) i8)))
+;; CHECK-NEXT: (type $13 identical to $3)
+;; CHECK-NEXT: (type $14 identical to $0)
;; CHECK-NEXT: (type $15 identical to $1)
-;; CHECK-NEXT: (type $16 identical to $2)
-;; CHECK-NEXT: (type $17 (struct (field (ref $3) (ref $5) (mut i31ref) i8 (mut dataref) (mut i16))))
+;; CHECK-NEXT: (type $16 (struct (field (mut (rtt $1)) (ref $4) v128)))
+;; CHECK-NEXT: (type $17 identical to $0)
;; CHECK-NEXT: (type $18 identical to $0)
;; CHECK-NEXT: (type $19 identical to $1)
diff --git a/test/lit/passes/flatten_all-features.wast b/test/lit/passes/flatten_all-features.wast
index 5e8cfe25c..cafd78a04 100644
--- a/test/lit/passes/flatten_all-features.wast
+++ b/test/lit/passes/flatten_all-features.wast
@@ -3416,50 +3416,46 @@
;; 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.
;; CHECK: (func $subtype (result anyref)
- ;; CHECK-NEXT: (local $0 externref)
+ ;; CHECK-NEXT: (local $0 anyref)
;; CHECK-NEXT: (local $1 anyref)
- ;; CHECK-NEXT: (local $2 externref)
- ;; CHECK-NEXT: (local $3 externref)
- ;; CHECK-NEXT: (local $4 externref)
- ;; CHECK-NEXT: (local $5 externref)
- ;; CHECK-NEXT: (local $6 externref)
- ;; CHECK-NEXT: (local $7 anyref)
+ ;; CHECK-NEXT: (local $2 anyref)
+ ;; CHECK-NEXT: (local $3 anyref)
+ ;; CHECK-NEXT: (local $4 anyref)
+ ;; CHECK-NEXT: (local $5 anyref)
+ ;; CHECK-NEXT: (local $6 anyref)
;; CHECK-NEXT: (block $label0
;; CHECK-NEXT: (block $block
;; CHECK-NEXT: (local.set $1
- ;; CHECK-NEXT: (ref.null extern)
- ;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $2
- ;; CHECK-NEXT: (ref.null extern)
+ ;; CHECK-NEXT: (ref.null any)
;; CHECK-NEXT: )
;; CHECK-NEXT: (br_if $label0
;; CHECK-NEXT: (i32.const 0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $3
- ;; CHECK-NEXT: (local.get $2)
+ ;; CHECK-NEXT: (local.set $2
+ ;; CHECK-NEXT: (local.get $1)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $0
- ;; CHECK-NEXT: (local.get $3)
+ ;; CHECK-NEXT: (local.get $2)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $4
+ ;; CHECK-NEXT: (local.set $3
;; CHECK-NEXT: (local.get $0)
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $5
- ;; CHECK-NEXT: (local.get $4)
+ ;; CHECK-NEXT: (local.set $4
+ ;; CHECK-NEXT: (local.get $3)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $6
- ;; CHECK-NEXT: (local.get $5)
+ ;; CHECK-NEXT: (local.set $5
+ ;; CHECK-NEXT: (local.get $4)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $1
- ;; CHECK-NEXT: (local.get $6)
+ ;; CHECK-NEXT: (local.get $5)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
- ;; CHECK-NEXT: (local.set $7
+ ;; CHECK-NEXT: (local.set $6
;; CHECK-NEXT: (local.get $1)
;; CHECK-NEXT: )
;; CHECK-NEXT: (return
- ;; CHECK-NEXT: (local.get $7)
+ ;; CHECK-NEXT: (local.get $6)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
(func $subtype (result anyref)
diff --git a/test/lit/passes/instrument-locals_all-features_disable-typed-function-references.wast b/test/lit/passes/instrument-locals_all-features_disable-typed-function-references.wast
index 8b971cdb8..e736253f6 100644
--- a/test/lit/passes/instrument-locals_all-features_disable-typed-function-references.wast
+++ b/test/lit/passes/instrument-locals_all-features_disable-typed-function-references.wast
@@ -14,8 +14,6 @@
;; CHECK: (type $i32_i32_funcref_=>_funcref (func (param i32 i32 funcref) (result funcref)))
- ;; CHECK: (type $i32_i32_externref_=>_externref (func (param i32 i32 externref) (result externref)))
-
;; CHECK: (type $i32_i32_anyref_=>_anyref (func (param i32 i32 anyref) (result anyref)))
;; CHECK: (type $i32_i32_eqref_=>_eqref (func (param i32 i32 eqref) (result eqref)))
@@ -48,10 +46,6 @@
;; CHECK: (import "env" "set_funcref" (func $set_funcref (param i32 i32 funcref) (result funcref)))
- ;; CHECK: (import "env" "get_externref" (func $get_externref (param i32 i32 externref) (result externref)))
-
- ;; CHECK: (import "env" "set_externref" (func $set_externref (param i32 i32 externref) (result externref)))
-
;; CHECK: (import "env" "get_anyref" (func $get_anyref (param i32 i32 anyref) (result anyref)))
;; CHECK: (import "env" "set_anyref" (func $set_anyref (param i32 i32 anyref) (result anyref)))
@@ -80,7 +74,7 @@
;; CHECK-NEXT: (local $z f32)
;; CHECK-NEXT: (local $w f64)
;; CHECK-NEXT: (local $F funcref)
- ;; CHECK-NEXT: (local $X externref)
+ ;; CHECK-NEXT: (local $X anyref)
;; CHECK-NEXT: (local $S v128)
;; CHECK-NEXT: (drop
;; CHECK-NEXT: (call $get_i32
@@ -114,7 +108,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (call $get_externref
+ ;; CHECK-NEXT: (call $get_anyref
;; CHECK-NEXT: (i32.const 4)
;; CHECK-NEXT: (i32.const 5)
;; CHECK-NEXT: (local.get $X)
@@ -152,7 +146,7 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (drop
- ;; CHECK-NEXT: (call $get_externref
+ ;; CHECK-NEXT: (call $get_anyref
;; CHECK-NEXT: (i32.const 9)
;; CHECK-NEXT: (i32.const 5)
;; CHECK-NEXT: (local.get $X)
@@ -186,10 +180,10 @@
;; CHECK-NEXT: (ref.func $test)
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $X
- ;; CHECK-NEXT: (call $set_externref
+ ;; CHECK-NEXT: (call $set_anyref
;; CHECK-NEXT: (i32.const 14)
;; CHECK-NEXT: (i32.const 5)
- ;; CHECK-NEXT: (call $get_externref
+ ;; CHECK-NEXT: (call $get_anyref
;; CHECK-NEXT: (i32.const 13)
;; CHECK-NEXT: (i32.const 5)
;; CHECK-NEXT: (local.get $X)
@@ -232,10 +226,10 @@
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; CHECK-NEXT: (local.set $X
- ;; CHECK-NEXT: (call $set_externref
+ ;; CHECK-NEXT: (call $set_anyref
;; CHECK-NEXT: (i32.const 21)
;; CHECK-NEXT: (i32.const 5)
- ;; CHECK-NEXT: (call $get_externref
+ ;; CHECK-NEXT: (call $get_anyref
;; CHECK-NEXT: (i32.const 20)
;; CHECK-NEXT: (i32.const 5)
;; CHECK-NEXT: (local.get $X)
diff --git a/test/lit/passes/optimize-instructions-gc.wast b/test/lit/passes/optimize-instructions-gc.wast
index 5f2c25c5d..64213d930 100644
--- a/test/lit/passes/optimize-instructions-gc.wast
+++ b/test/lit/passes/optimize-instructions-gc.wast
@@ -47,10 +47,10 @@
;; These functions test if an `if` with subtyped arms is correctly folded
;; 1. if its `ifTrue` and `ifFalse` arms are identical (can fold)
;; CHECK: (func $if-arms-subtype-fold (result anyref)
- ;; CHECK-NEXT: (ref.null extern)
+ ;; CHECK-NEXT: (ref.null any)
;; CHECK-NEXT: )
;; NOMNL: (func $if-arms-subtype-fold (type $none_=>_anyref) (result anyref)
- ;; NOMNL-NEXT: (ref.null extern)
+ ;; NOMNL-NEXT: (ref.null any)
;; NOMNL-NEXT: )
(func $if-arms-subtype-fold (result anyref)
(if (result anyref)
@@ -63,14 +63,14 @@
;; CHECK: (func $if-arms-subtype-nofold (result anyref)
;; CHECK-NEXT: (if (result anyref)
;; CHECK-NEXT: (i32.const 0)
- ;; CHECK-NEXT: (ref.null extern)
+ ;; CHECK-NEXT: (ref.null any)
;; CHECK-NEXT: (ref.null func)
;; CHECK-NEXT: )
;; CHECK-NEXT: )
;; NOMNL: (func $if-arms-subtype-nofold (type $none_=>_anyref) (result anyref)
;; NOMNL-NEXT: (if (result anyref)
;; NOMNL-NEXT: (i32.const 0)
- ;; NOMNL-NEXT: (ref.null extern)
+ ;; NOMNL-NEXT: (ref.null any)
;; NOMNL-NEXT: (ref.null func)
;; NOMNL-NEXT: )
;; NOMNL-NEXT: )
diff --git a/test/multi-table.wast.from-wast b/test/multi-table.wast.from-wast
index 73a9abea3..545bb9c56 100644
--- a/test/multi-table.wast.from-wast
+++ b/test/multi-table.wast.from-wast
@@ -5,7 +5,7 @@
(global $g2 i32 (i32.const 0))
(table $t2 3 3 funcref)
(table $t3 4 4 funcref)
- (table $textern 0 externref)
+ (table $textern 0 anyref)
(table $tspecial 5 5 (ref null $none_=>_none))
(elem $0 (table $t1) (i32.const 0) func $f)
(elem $1 (table $t2) (i32.const 0) func $f)
diff --git a/test/multi-table.wast.fromBinary b/test/multi-table.wast.fromBinary
index 427fb44f3..105706621 100644
--- a/test/multi-table.wast.fromBinary
+++ b/test/multi-table.wast.fromBinary
@@ -5,7 +5,7 @@
(global $g2 i32 (i32.const 0))
(table $t2 3 3 funcref)
(table $t3 4 4 funcref)
- (table $textern 0 externref)
+ (table $textern 0 anyref)
(table $tspecial 5 5 (ref null $none_=>_none))
(elem $0 (table $t1) (i32.const 0) func $f)
(elem $1 (table $t2) (i32.const 0) func $f)
diff --git a/test/multi-table.wast.fromBinary.noDebugInfo b/test/multi-table.wast.fromBinary.noDebugInfo
index 7fc667087..174d2a912 100644
--- a/test/multi-table.wast.fromBinary.noDebugInfo
+++ b/test/multi-table.wast.fromBinary.noDebugInfo
@@ -5,7 +5,7 @@
(global $global$1 i32 (i32.const 0))
(table $0 3 3 funcref)
(table $1 4 4 funcref)
- (table $2 0 externref)
+ (table $2 0 anyref)
(table $3 5 5 (ref null $none_=>_none))
(elem $0 (table $timport$0) (i32.const 0) func $0)
(elem $1 (table $0) (i32.const 0) func $0)
diff --git a/test/multivalue.wast.from-wast b/test/multivalue.wast.from-wast
index 9340c183a..c6aa020dd 100644
--- a/test/multivalue.wast.from-wast
+++ b/test/multivalue.wast.from-wast
@@ -3,7 +3,7 @@
(type $none_=>_none (func))
(type $none_=>_i64 (func (result i64)))
(type $none_=>_f32_i64_i32 (func (result f32 i64 i32)))
- (type $none_=>_i32_i64_externref (func (result i32 i64 externref)))
+ (type $none_=>_i32_i64_anyref (func (result i32 i64 anyref)))
(type $none_=>_i32_i64_f32 (func (result i32 i64 f32)))
(type $none_=>_i32 (func (result i32)))
(type $none_=>_f32 (func (result f32)))
@@ -135,18 +135,18 @@
)
)
)
- (func $mv-if (result i32 i64 externref)
- (if (result i32 i64 externref)
+ (func $mv-if (result i32 i64 anyref)
+ (if (result i32 i64 anyref)
(i32.const 1)
(tuple.make
(i32.const 42)
(i64.const 42)
- (ref.null extern)
+ (ref.null any)
)
(tuple.make
(i32.const 42)
(i64.const 42)
- (ref.null extern)
+ (ref.null any)
)
)
)
diff --git a/test/multivalue.wast.fromBinary b/test/multivalue.wast.fromBinary
index dd39d4b34..cc900e024 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_externref (func (result i32 i64 externref)))
+ (type $none_=>_i32_i64_anyref (func (result i32 i64 anyref)))
(type $none_=>_i64 (func (result i64)))
(type $none_=>_f32_i64_i32 (func (result f32 i64 i32)))
(type $none_=>_i32_i64_f32 (func (result i32 i64 f32)))
@@ -389,20 +389,20 @@
)
)
)
- (func $mv-if (result i32 i64 externref)
- (local $0 (i32 i64 externref))
+ (func $mv-if (result i32 i64 anyref)
+ (local $0 (i32 i64 anyref))
(local.set $0
- (if (result i32 i64 externref)
+ (if (result i32 i64 anyref)
(i32.const 1)
(tuple.make
(i32.const 42)
(i64.const 42)
- (ref.null extern)
+ (ref.null any)
)
(tuple.make
(i32.const 42)
(i64.const 42)
- (ref.null extern)
+ (ref.null any)
)
)
)
diff --git a/test/multivalue.wast.fromBinary.noDebugInfo b/test/multivalue.wast.fromBinary.noDebugInfo
index 66c0f52c5..daf0a743e 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_externref (func (result i32 i64 externref)))
+ (type $none_=>_i32_i64_anyref (func (result i32 i64 anyref)))
(type $none_=>_i64 (func (result i64)))
(type $none_=>_f32_i64_i32 (func (result f32 i64 i32)))
(type $none_=>_i32_i64_f32 (func (result i32 i64 f32)))
@@ -389,20 +389,20 @@
)
)
)
- (func $14 (result i32 i64 externref)
- (local $0 (i32 i64 externref))
+ (func $14 (result i32 i64 anyref)
+ (local $0 (i32 i64 anyref))
(local.set $0
- (if (result i32 i64 externref)
+ (if (result i32 i64 anyref)
(i32.const 1)
(tuple.make
(i32.const 42)
(i64.const 42)
- (ref.null extern)
+ (ref.null any)
)
(tuple.make
(i32.const 42)
(i64.const 42)
- (ref.null extern)
+ (ref.null any)
)
)
)
diff --git a/test/passes/precompute_all-features.txt b/test/passes/precompute_all-features.txt
index 89d334a93..70c790484 100644
--- a/test/passes/precompute_all-features.txt
+++ b/test/passes/precompute_all-features.txt
@@ -5,7 +5,7 @@
(type $0 (func (param i32)))
(type $none_=>_v128 (func (result v128)))
(type $none_=>_i32_i64 (func (result i32 i64)))
- (type $none_=>_externref (func (result externref)))
+ (type $none_=>_anyref (func (result anyref)))
(global $global i32 (i32.const 1))
(global $global-mut (mut i32) (i32.const 2))
(memory $0 512 512)
@@ -253,8 +253,8 @@
(func $loop-precompute (result i32)
(i32.const 1)
)
- (func $reftype-test (result externref)
- (ref.null extern)
+ (func $reftype-test (result anyref)
+ (ref.null any)
)
(func $dummy
(nop)
@@ -276,18 +276,18 @@
)
)
(drop
- (block $l2 (result externref)
+ (block $l2 (result anyref)
(drop
(block $l3
(global.set $global-mut
(i32.const 1)
)
(br $l2
- (ref.null extern)
+ (ref.null any)
)
)
)
- (ref.null extern)
+ (ref.null any)
)
)
(drop
diff --git a/test/passes/simplify-globals_all-features.txt b/test/passes/simplify-globals_all-features.txt
index ace056aac..5ad54b0a8 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 externref))
- (global $g2 externref (global.get $g1))
- (global $g3 externref (ref.null extern))
+ (import "env" "global-1" (global $g1 anyref))
+ (global $g2 anyref (global.get $g1))
+ (global $g3 anyref (ref.null any))
(func $test1
(drop
(global.get $g1)
@@ -226,7 +226,7 @@
)
(func $test2
(drop
- (ref.null extern)
+ (ref.null any)
)
)
)
diff --git a/test/passes/simplify-locals_all-features.txt b/test/passes/simplify-locals_all-features.txt
index de387c27b..0c25ea54b 100644
--- a/test/passes/simplify-locals_all-features.txt
+++ b/test/passes/simplify-locals_all-features.txt
@@ -1884,7 +1884,7 @@
(module
(type $none_=>_anyref (func (result anyref)))
(func $subtype-test (result anyref)
- (local $0 externref)
+ (local $0 anyref)
(local $1 anyref)
(local $2 anyref)
(block $block
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 53fd2b237..e93805cf5 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
@@ -14,14 +14,14 @@
--enable-relaxed-simd
--enable-extended-const
(module
- (type $none_=>_v128_externref (func (result v128 externref)))
- (func $foo (result v128 externref)
+ (type $none_=>_v128_anyref (func (result v128 anyref)))
+ (func $foo (result v128 anyref)
(tuple.make
(v128.const i32x4 0x00000000 0x00000000 0x00000000 0x00000000)
- (ref.null extern)
+ (ref.null any)
)
)
- (func $bar (result v128 externref)
+ (func $bar (result v128 anyref)
(return_call $foo)
)
)
diff --git a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt
index a172095ef..f264b4e63 100644
--- a/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt
+++ b/test/passes/translate-to-fuzz_all-features_metrics_noprint.txt
@@ -1,46 +1,43 @@
total
- [exports] : 13
- [funcs] : 18
+ [exports] : 3
+ [funcs] : 3
[globals] : 6
[imports] : 5
[memory-data] : 22
- [table-data] : 14
+ [table-data] : 0
[tables] : 1
[tags] : 1
- [total] : 728
- [vars] : 41
- ArrayInit : 6
- AtomicFence : 1
- AtomicNotify : 1
- AtomicRMW : 1
- Binary : 80
- Block : 83
- Break : 13
- Call : 33
- CallIndirect : 1
- CallRef : 1
- Const : 162
- Drop : 10
- GlobalGet : 50
- GlobalSet : 27
- I31Get : 3
- I31New : 5
- If : 32
- Load : 20
- LocalGet : 35
- LocalSet : 21
- Loop : 8
+ [total] : 813
+ [vars] : 2
+ ArrayInit : 1
+ AtomicFence : 2
+ Binary : 96
+ Block : 104
+ Break : 25
+ Call : 25
+ CallRef : 4
+ Const : 173
+ Drop : 1
+ GlobalGet : 54
+ GlobalSet : 28
+ I31New : 4
+ If : 38
+ Load : 23
+ LocalGet : 56
+ LocalSet : 39
+ Loop : 24
MemoryFill : 1
MemoryInit : 1
- Nop : 14
- RefAs : 1
- RefFunc : 16
- RefIs : 2
- RefNull : 6
- Return : 27
- SIMDExtract : 1
- Select : 8
- Store : 2
- StructNew : 7
+ Nop : 8
+ RefEq : 1
+ RefFunc : 6
+ RefIs : 3
+ RefNull : 2
+ Return : 26
+ SIMDExtract : 6
+ Select : 2
+ Store : 5
+ StructNew : 2
+ TupleExtract : 5
TupleMake : 5
- Unary : 44
+ Unary : 43
diff --git a/test/reference-types.wast.from-wast b/test/reference-types.wast.from-wast
index d6f0ca7d0..5afb74eda 100644
--- a/test/reference-types.wast.from-wast
+++ b/test/reference-types.wast.from-wast
@@ -3,18 +3,16 @@
(type $sig_anyref (func (param anyref)))
(type $sig_funcref (func (param funcref)))
(type $none_=>_funcref (func (result funcref)))
- (type $sig_externref (func (param externref)))
(type $none_=>_none (func))
- (type $none_=>_externref (func (result externref)))
(type $i32_=>_none (func (param i32)))
- (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)))
- (global $global_externref (mut externref) (ref.null extern))
+ (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)))
+ (global $global_externref (mut anyref) (ref.null any))
(global $global_funcref (mut funcref) (ref.null func))
(global $global_funcref_func (mut funcref) (ref.func $foo))
(global $global_anyref (mut anyref) (ref.null any))
- (global $global_anyref2 (mut anyref) (ref.null extern))
+ (global $global_anyref2 (mut anyref) (ref.null any))
(global $global_anyref3 (mut anyref) (ref.null func))
(global $global_anyref4 (mut anyref) (ref.func $foo))
(table $0 3 3 funcref)
@@ -23,7 +21,7 @@
(tag $e-i32 (param i32))
(export "export_func" (func $import_func))
(export "export_global" (global $import_global))
- (func $take_externref (param $0 externref)
+ (func $take_externref (param $0 anyref)
(nop)
)
(func $take_funcref (param $0 funcref)
@@ -36,7 +34,7 @@
(nop)
)
(func $test
- (local $local_externref externref)
+ (local $local_externref anyref)
(local $local_funcref funcref)
(local $local_anyref anyref)
(local.set $local_externref
@@ -46,7 +44,7 @@
(global.get $global_externref)
)
(local.set $local_externref
- (ref.null extern)
+ (ref.null any)
)
(local.set $local_funcref
(local.get $local_funcref)
@@ -76,7 +74,7 @@
(global.get $global_externref)
)
(local.set $local_anyref
- (ref.null extern)
+ (ref.null any)
)
(local.set $local_anyref
(local.get $local_funcref)
@@ -97,7 +95,7 @@
(local.get $local_externref)
)
(global.set $global_externref
- (ref.null extern)
+ (ref.null any)
)
(global.set $global_funcref
(global.get $global_funcref)
@@ -127,7 +125,7 @@
(local.get $local_externref)
)
(global.set $global_anyref
- (ref.null extern)
+ (ref.null any)
)
(global.set $global_anyref
(global.get $global_funcref)
@@ -148,7 +146,7 @@
(global.get $global_externref)
)
(call $take_externref
- (ref.null extern)
+ (ref.null any)
)
(call $take_funcref
(local.get $local_funcref)
@@ -178,7 +176,7 @@
(global.get $global_externref)
)
(call $take_anyref
- (ref.null extern)
+ (ref.null any)
)
(call $take_anyref
(local.get $local_funcref)
@@ -192,16 +190,16 @@
(call $take_anyref
(ref.func $foo)
)
- (call_indirect $0 (type $sig_externref)
+ (call_indirect $0 (type $sig_anyref)
(local.get $local_externref)
(i32.const 0)
)
- (call_indirect $0 (type $sig_externref)
+ (call_indirect $0 (type $sig_anyref)
(global.get $global_externref)
(i32.const 0)
)
- (call_indirect $0 (type $sig_externref)
- (ref.null extern)
+ (call_indirect $0 (type $sig_anyref)
+ (ref.null any)
(i32.const 0)
)
(call_indirect $0 (type $sig_funcref)
@@ -241,7 +239,7 @@
(i32.const 3)
)
(call_indirect $0 (type $sig_anyref)
- (ref.null extern)
+ (ref.null any)
(i32.const 3)
)
(call_indirect $0 (type $sig_anyref)
@@ -261,7 +259,7 @@
(i32.const 3)
)
(drop
- (block $block (result externref)
+ (block $block (result anyref)
(br_if $block
(local.get $local_externref)
(i32.const 1)
@@ -269,7 +267,7 @@
)
)
(drop
- (block $block0 (result externref)
+ (block $block0 (result anyref)
(br_if $block0
(global.get $global_externref)
(i32.const 1)
@@ -277,9 +275,9 @@
)
)
(drop
- (block $block1 (result externref)
+ (block $block1 (result anyref)
(br_if $block1
- (ref.null extern)
+ (ref.null any)
(i32.const 1)
)
)
@@ -359,7 +357,7 @@
(drop
(block $block11 (result anyref)
(br_if $block11
- (ref.null extern)
+ (ref.null any)
(i32.const 1)
)
)
@@ -381,18 +379,18 @@
)
)
(drop
- (loop $loop-in (result externref)
+ (loop $loop-in (result anyref)
(local.get $local_externref)
)
)
(drop
- (loop $loop-in14 (result externref)
+ (loop $loop-in14 (result anyref)
(global.get $global_externref)
)
)
(drop
- (loop $loop-in15 (result externref)
- (ref.null extern)
+ (loop $loop-in15 (result anyref)
+ (ref.null any)
)
)
(drop
@@ -442,7 +440,7 @@
)
(drop
(loop $loop-in25 (result anyref)
- (ref.null extern)
+ (ref.null any)
)
)
(drop
@@ -466,10 +464,10 @@
)
)
(drop
- (if (result externref)
+ (if (result anyref)
(i32.const 1)
(local.get $local_externref)
- (ref.null extern)
+ (ref.null any)
)
)
(drop
@@ -496,7 +494,7 @@
(drop
(if (result anyref)
(i32.const 1)
- (ref.null extern)
+ (ref.null any)
(ref.null func)
)
)
@@ -504,11 +502,11 @@
(if (result anyref)
(i32.const 1)
(ref.func $foo)
- (ref.null extern)
+ (ref.null any)
)
)
(drop
- (try $try (result externref)
+ (try $try (result anyref)
(do
(local.get $local_externref)
)
@@ -516,7 +514,7 @@
(drop
(pop i32)
)
- (ref.null extern)
+ (ref.null any)
)
)
)
@@ -560,9 +558,9 @@
)
)
(drop
- (select (result externref)
+ (select (result anyref)
(local.get $local_externref)
- (ref.null extern)
+ (ref.null any)
(i32.const 1)
)
)
@@ -606,7 +604,7 @@
)
(drop
(ref.is_null
- (ref.null extern)
+ (ref.null any)
)
)
(drop
@@ -645,15 +643,15 @@
)
)
)
- (func $return_externref_local (result externref)
- (local $local_externref externref)
+ (func $return_externref_local (result anyref)
+ (local $local_externref anyref)
(local.get $local_externref)
)
- (func $return_externref_global (result externref)
+ (func $return_externref_global (result anyref)
(global.get $global_externref)
)
- (func $return_externref_null (result externref)
- (ref.null extern)
+ (func $return_externref_null (result anyref)
+ (ref.null any)
)
(func $return_funcref_local (result funcref)
(local $local_funcref funcref)
@@ -679,14 +677,14 @@
(ref.null any)
)
(func $return_anyref2 (result anyref)
- (local $local_externref externref)
+ (local $local_externref anyref)
(local.get $local_externref)
)
(func $return_anyref3 (result anyref)
(global.get $global_externref)
)
(func $return_anyref4 (result anyref)
- (ref.null extern)
+ (ref.null any)
)
(func $return_anyref5 (result anyref)
(local $local_funcref funcref)
@@ -701,8 +699,8 @@
(func $return_anyref8 (result anyref)
(ref.func $foo)
)
- (func $returns_externref (result externref)
- (local $local_externref externref)
+ (func $returns_externref (result anyref)
+ (local $local_externref anyref)
(return
(local.get $local_externref)
)
@@ -710,7 +708,7 @@
(global.get $global_externref)
)
(return
- (ref.null extern)
+ (ref.null any)
)
)
(func $returns_funcref (result funcref)
@@ -741,7 +739,7 @@
)
)
(func $returns_anyref2 (result anyref)
- (local $local_externref externref)
+ (local $local_externref anyref)
(local $local_funcref funcref)
(return
(local.get $local_externref)
@@ -750,7 +748,7 @@
(global.get $global_externref)
)
(return
- (ref.null extern)
+ (ref.null any)
)
(return
(local.get $local_funcref)
diff --git a/test/reference-types.wast.fromBinary b/test/reference-types.wast.fromBinary
index ad2d8862f..37a57ac78 100644
--- a/test/reference-types.wast.fromBinary
+++ b/test/reference-types.wast.fromBinary
@@ -3,18 +3,16 @@
(type $sig_anyref (func (param anyref)))
(type $sig_funcref (func (param funcref)))
(type $none_=>_funcref (func (result funcref)))
- (type $sig_externref (func (param externref)))
(type $none_=>_none (func))
- (type $none_=>_externref (func (result externref)))
(type $i32_=>_none (func (param i32)))
- (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)))
- (global $global_externref (mut externref) (ref.null extern))
+ (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)))
+ (global $global_externref (mut anyref) (ref.null any))
(global $global_funcref (mut funcref) (ref.null func))
(global $global_funcref_func (mut funcref) (ref.func $foo))
(global $global_anyref (mut anyref) (ref.null any))
- (global $global_anyref2 (mut anyref) (ref.null extern))
+ (global $global_anyref2 (mut anyref) (ref.null any))
(global $global_anyref3 (mut anyref) (ref.null func))
(global $global_anyref4 (mut anyref) (ref.func $foo))
(table $0 3 3 funcref)
@@ -23,7 +21,7 @@
(tag $tag$0 (param i32))
(export "export_func" (func $import_func))
(export "export_global" (global $import_global))
- (func $take_externref (param $0 externref)
+ (func $take_externref (param $0 anyref)
(nop)
)
(func $take_funcref (param $0 funcref)
@@ -36,9 +34,9 @@
(nop)
)
(func $test
- (local $local_externref externref)
- (local $local_funcref funcref)
+ (local $local_externref anyref)
(local $local_anyref anyref)
+ (local $local_funcref funcref)
(local.set $local_externref
(local.get $local_externref)
)
@@ -46,7 +44,7 @@
(global.get $global_externref)
)
(local.set $local_externref
- (ref.null extern)
+ (ref.null any)
)
(local.set $local_funcref
(local.get $local_funcref)
@@ -76,7 +74,7 @@
(global.get $global_externref)
)
(local.set $local_anyref
- (ref.null extern)
+ (ref.null any)
)
(local.set $local_anyref
(local.get $local_funcref)
@@ -97,7 +95,7 @@
(local.get $local_externref)
)
(global.set $global_externref
- (ref.null extern)
+ (ref.null any)
)
(global.set $global_funcref
(global.get $global_funcref)
@@ -127,7 +125,7 @@
(local.get $local_externref)
)
(global.set $global_anyref
- (ref.null extern)
+ (ref.null any)
)
(global.set $global_anyref
(global.get $global_funcref)
@@ -148,7 +146,7 @@
(global.get $global_externref)
)
(call $take_externref
- (ref.null extern)
+ (ref.null any)
)
(call $take_funcref
(local.get $local_funcref)
@@ -178,7 +176,7 @@
(global.get $global_externref)
)
(call $take_anyref
- (ref.null extern)
+ (ref.null any)
)
(call $take_anyref
(local.get $local_funcref)
@@ -192,16 +190,16 @@
(call $take_anyref
(ref.func $foo)
)
- (call_indirect $0 (type $sig_externref)
+ (call_indirect $0 (type $sig_anyref)
(local.get $local_externref)
(i32.const 0)
)
- (call_indirect $0 (type $sig_externref)
+ (call_indirect $0 (type $sig_anyref)
(global.get $global_externref)
(i32.const 0)
)
- (call_indirect $0 (type $sig_externref)
- (ref.null extern)
+ (call_indirect $0 (type $sig_anyref)
+ (ref.null any)
(i32.const 0)
)
(call_indirect $0 (type $sig_funcref)
@@ -241,7 +239,7 @@
(i32.const 3)
)
(call_indirect $0 (type $sig_anyref)
- (ref.null extern)
+ (ref.null any)
(i32.const 3)
)
(call_indirect $0 (type $sig_anyref)
@@ -261,7 +259,7 @@
(i32.const 3)
)
(drop
- (block $label$1 (result externref)
+ (block $label$1 (result anyref)
(br_if $label$1
(local.get $local_externref)
(i32.const 1)
@@ -269,7 +267,7 @@
)
)
(drop
- (block $label$2 (result externref)
+ (block $label$2 (result anyref)
(br_if $label$2
(global.get $global_externref)
(i32.const 1)
@@ -277,9 +275,9 @@
)
)
(drop
- (block $label$3 (result externref)
+ (block $label$3 (result anyref)
(br_if $label$3
- (ref.null extern)
+ (ref.null any)
(i32.const 1)
)
)
@@ -359,7 +357,7 @@
(drop
(block $label$13 (result anyref)
(br_if $label$13
- (ref.null extern)
+ (ref.null any)
(i32.const 1)
)
)
@@ -381,18 +379,18 @@
)
)
(drop
- (loop $label$16 (result externref)
+ (loop $label$16 (result anyref)
(local.get $local_externref)
)
)
(drop
- (loop $label$17 (result externref)
+ (loop $label$17 (result anyref)
(global.get $global_externref)
)
)
(drop
- (loop $label$18 (result externref)
- (ref.null extern)
+ (loop $label$18 (result anyref)
+ (ref.null any)
)
)
(drop
@@ -442,7 +440,7 @@
)
(drop
(loop $label$28 (result anyref)
- (ref.null extern)
+ (ref.null any)
)
)
(drop
@@ -466,10 +464,10 @@
)
)
(drop
- (if (result externref)
+ (if (result anyref)
(i32.const 1)
(local.get $local_externref)
- (ref.null extern)
+ (ref.null any)
)
)
(drop
@@ -496,7 +494,7 @@
(drop
(if (result anyref)
(i32.const 1)
- (ref.null extern)
+ (ref.null any)
(ref.null func)
)
)
@@ -504,11 +502,11 @@
(if (result anyref)
(i32.const 1)
(ref.func $foo)
- (ref.null extern)
+ (ref.null any)
)
)
(drop
- (try $label$47 (result externref)
+ (try $label$47 (result anyref)
(do
(local.get $local_externref)
)
@@ -516,7 +514,7 @@
(drop
(pop i32)
)
- (ref.null extern)
+ (ref.null any)
)
)
)
@@ -560,9 +558,9 @@
)
)
(drop
- (select (result externref)
+ (select (result anyref)
(local.get $local_externref)
- (ref.null extern)
+ (ref.null any)
(i32.const 1)
)
)
@@ -606,7 +604,7 @@
)
(drop
(ref.is_null
- (ref.null extern)
+ (ref.null any)
)
)
(drop
@@ -645,15 +643,15 @@
)
)
)
- (func $return_externref_local (result externref)
- (local $local_externref externref)
+ (func $return_externref_local (result anyref)
+ (local $local_externref anyref)
(local.get $local_externref)
)
- (func $return_externref_global (result externref)
+ (func $return_externref_global (result anyref)
(global.get $global_externref)
)
- (func $return_externref_null (result externref)
- (ref.null extern)
+ (func $return_externref_null (result anyref)
+ (ref.null any)
)
(func $return_funcref_local (result funcref)
(local $local_funcref funcref)
@@ -679,14 +677,14 @@
(ref.null any)
)
(func $return_anyref2 (result anyref)
- (local $local_externref externref)
+ (local $local_externref anyref)
(local.get $local_externref)
)
(func $return_anyref3 (result anyref)
(global.get $global_externref)
)
(func $return_anyref4 (result anyref)
- (ref.null extern)
+ (ref.null any)
)
(func $return_anyref5 (result anyref)
(local $local_funcref funcref)
@@ -701,8 +699,8 @@
(func $return_anyref8 (result anyref)
(ref.func $foo)
)
- (func $returns_externref (result externref)
- (local $local_externref externref)
+ (func $returns_externref (result anyref)
+ (local $local_externref anyref)
(return
(local.get $local_externref)
)
@@ -720,7 +718,7 @@
)
)
(func $returns_anyref2 (result anyref)
- (local $local_externref externref)
+ (local $local_externref anyref)
(local $local_funcref funcref)
(return
(local.get $local_externref)
diff --git a/test/reference-types.wast.fromBinary.noDebugInfo b/test/reference-types.wast.fromBinary.noDebugInfo
index 264539142..42ad4026a 100644
--- a/test/reference-types.wast.fromBinary.noDebugInfo
+++ b/test/reference-types.wast.fromBinary.noDebugInfo
@@ -3,18 +3,16 @@
(type $anyref_=>_none (func (param anyref)))
(type $funcref_=>_none (func (param funcref)))
(type $none_=>_funcref (func (result funcref)))
- (type $externref_=>_none (func (param externref)))
(type $none_=>_none (func))
- (type $none_=>_externref (func (result externref)))
(type $i32_=>_none (func (param i32)))
- (type $externref_=>_funcref (func (param externref) (result funcref)))
- (import "env" "import_global" (global $gimport$0 externref))
- (import "env" "import_func" (func $fimport$0 (param externref) (result funcref)))
- (global $global$0 (mut externref) (ref.null extern))
+ (type $anyref_=>_funcref (func (param anyref) (result funcref)))
+ (import "env" "import_global" (global $gimport$0 anyref))
+ (import "env" "import_func" (func $fimport$0 (param anyref) (result funcref)))
+ (global $global$0 (mut anyref) (ref.null any))
(global $global$1 (mut funcref) (ref.null func))
(global $global$2 (mut funcref) (ref.func $3))
(global $global$3 (mut anyref) (ref.null any))
- (global $global$4 (mut anyref) (ref.null extern))
+ (global $global$4 (mut anyref) (ref.null any))
(global $global$5 (mut anyref) (ref.null func))
(global $global$6 (mut anyref) (ref.func $3))
(table $0 3 3 funcref)
@@ -23,7 +21,7 @@
(tag $tag$0 (param i32))
(export "export_func" (func $fimport$0))
(export "export_global" (global $gimport$0))
- (func $0 (param $0 externref)
+ (func $0 (param $0 anyref)
(nop)
)
(func $1 (param $0 funcref)
@@ -36,9 +34,9 @@
(nop)
)
(func $4
- (local $0 externref)
- (local $1 funcref)
- (local $2 anyref)
+ (local $0 anyref)
+ (local $1 anyref)
+ (local $2 funcref)
(local.set $0
(local.get $0)
)
@@ -46,48 +44,48 @@
(global.get $global$0)
)
(local.set $0
- (ref.null extern)
+ (ref.null any)
)
- (local.set $1
- (local.get $1)
+ (local.set $2
+ (local.get $2)
)
- (local.set $1
+ (local.set $2
(global.get $global$1)
)
- (local.set $1
+ (local.set $2
(ref.null func)
)
- (local.set $1
+ (local.set $2
(ref.func $3)
)
- (local.set $2
- (local.get $2)
+ (local.set $1
+ (local.get $1)
)
- (local.set $2
+ (local.set $1
(global.get $global$3)
)
- (local.set $2
+ (local.set $1
(ref.null any)
)
- (local.set $2
+ (local.set $1
(local.get $0)
)
- (local.set $2
+ (local.set $1
(global.get $global$0)
)
- (local.set $2
- (ref.null extern)
+ (local.set $1
+ (ref.null any)
)
- (local.set $2
- (local.get $1)
+ (local.set $1
+ (local.get $2)
)
- (local.set $2
+ (local.set $1
(global.get $global$1)
)
- (local.set $2
+ (local.set $1
(ref.null func)
)
- (local.set $2
+ (local.set $1
(ref.func $3)
)
(global.set $global$0
@@ -97,13 +95,13 @@
(local.get $0)
)
(global.set $global$0
- (ref.null extern)
+ (ref.null any)
)
(global.set $global$1
(global.get $global$1)
)
(global.set $global$1
- (local.get $1)
+ (local.get $2)
)
(global.set $global$1
(ref.null func)
@@ -115,7 +113,7 @@
(global.get $global$3)
)
(global.set $global$3
- (local.get $2)
+ (local.get $1)
)
(global.set $global$3
(ref.null any)
@@ -127,13 +125,13 @@
(local.get $0)
)
(global.set $global$3
- (ref.null extern)
+ (ref.null any)
)
(global.set $global$3
(global.get $global$1)
)
(global.set $global$3
- (local.get $1)
+ (local.get $2)
)
(global.set $global$3
(ref.null func)
@@ -148,10 +146,10 @@
(global.get $global$0)
)
(call $0
- (ref.null extern)
+ (ref.null any)
)
(call $1
- (local.get $1)
+ (local.get $2)
)
(call $1
(global.get $global$1)
@@ -163,7 +161,7 @@
(ref.func $3)
)
(call $2
- (local.get $2)
+ (local.get $1)
)
(call $2
(global.get $global$3)
@@ -178,10 +176,10 @@
(global.get $global$0)
)
(call $2
- (ref.null extern)
+ (ref.null any)
)
(call $2
- (local.get $1)
+ (local.get $2)
)
(call $2
(global.get $global$1)
@@ -192,20 +190,20 @@
(call $2
(ref.func $3)
)
- (call_indirect $0 (type $externref_=>_none)
+ (call_indirect $0 (type $anyref_=>_none)
(local.get $0)
(i32.const 0)
)
- (call_indirect $0 (type $externref_=>_none)
+ (call_indirect $0 (type $anyref_=>_none)
(global.get $global$0)
(i32.const 0)
)
- (call_indirect $0 (type $externref_=>_none)
- (ref.null extern)
+ (call_indirect $0 (type $anyref_=>_none)
+ (ref.null any)
(i32.const 0)
)
(call_indirect $0 (type $funcref_=>_none)
- (local.get $1)
+ (local.get $2)
(i32.const 1)
)
(call_indirect $0 (type $funcref_=>_none)
@@ -221,7 +219,7 @@
(i32.const 1)
)
(call_indirect $0 (type $anyref_=>_none)
- (local.get $2)
+ (local.get $1)
(i32.const 3)
)
(call_indirect $0 (type $anyref_=>_none)
@@ -241,11 +239,11 @@
(i32.const 3)
)
(call_indirect $0 (type $anyref_=>_none)
- (ref.null extern)
+ (ref.null any)
(i32.const 3)
)
(call_indirect $0 (type $anyref_=>_none)
- (local.get $1)
+ (local.get $2)
(i32.const 3)
)
(call_indirect $0 (type $anyref_=>_none)
@@ -261,7 +259,7 @@
(i32.const 3)
)
(drop
- (block $label$1 (result externref)
+ (block $label$1 (result anyref)
(br_if $label$1
(local.get $0)
(i32.const 1)
@@ -269,7 +267,7 @@
)
)
(drop
- (block $label$2 (result externref)
+ (block $label$2 (result anyref)
(br_if $label$2
(global.get $global$0)
(i32.const 1)
@@ -277,9 +275,9 @@
)
)
(drop
- (block $label$3 (result externref)
+ (block $label$3 (result anyref)
(br_if $label$3
- (ref.null extern)
+ (ref.null any)
(i32.const 1)
)
)
@@ -287,7 +285,7 @@
(drop
(block $label$4 (result funcref)
(br_if $label$4
- (local.get $1)
+ (local.get $2)
(i32.const 1)
)
)
@@ -319,7 +317,7 @@
(drop
(block $label$8 (result anyref)
(br_if $label$8
- (local.get $2)
+ (local.get $1)
(i32.const 1)
)
)
@@ -351,7 +349,7 @@
(drop
(block $label$12 (result anyref)
(br_if $label$12
- (local.get $1)
+ (local.get $2)
(i32.const 1)
)
)
@@ -359,7 +357,7 @@
(drop
(block $label$13 (result anyref)
(br_if $label$13
- (ref.null extern)
+ (ref.null any)
(i32.const 1)
)
)
@@ -381,23 +379,23 @@
)
)
(drop
- (loop $label$16 (result externref)
+ (loop $label$16 (result anyref)
(local.get $0)
)
)
(drop
- (loop $label$17 (result externref)
+ (loop $label$17 (result anyref)
(global.get $global$0)
)
)
(drop
- (loop $label$18 (result externref)
- (ref.null extern)
+ (loop $label$18 (result anyref)
+ (ref.null any)
)
)
(drop
(loop $label$19 (result funcref)
- (local.get $1)
+ (local.get $2)
)
)
(drop
@@ -417,7 +415,7 @@
)
(drop
(loop $label$23 (result anyref)
- (local.get $2)
+ (local.get $1)
)
)
(drop
@@ -442,12 +440,12 @@
)
(drop
(loop $label$28 (result anyref)
- (ref.null extern)
+ (ref.null any)
)
)
(drop
(loop $label$29 (result anyref)
- (local.get $1)
+ (local.get $2)
)
)
(drop
@@ -466,23 +464,23 @@
)
)
(drop
- (if (result externref)
+ (if (result anyref)
(i32.const 1)
(local.get $0)
- (ref.null extern)
+ (ref.null any)
)
)
(drop
(if (result funcref)
(i32.const 1)
- (local.get $1)
+ (local.get $2)
(ref.null func)
)
)
(drop
(if (result anyref)
(i32.const 1)
- (local.get $2)
+ (local.get $1)
(ref.null any)
)
)
@@ -490,13 +488,13 @@
(if (result anyref)
(i32.const 1)
(local.get $0)
- (local.get $1)
+ (local.get $2)
)
)
(drop
(if (result anyref)
(i32.const 1)
- (ref.null extern)
+ (ref.null any)
(ref.null func)
)
)
@@ -504,11 +502,11 @@
(if (result anyref)
(i32.const 1)
(ref.func $3)
- (ref.null extern)
+ (ref.null any)
)
)
(drop
- (try $label$47 (result externref)
+ (try $label$47 (result anyref)
(do
(local.get $0)
)
@@ -516,7 +514,7 @@
(drop
(pop i32)
)
- (ref.null extern)
+ (ref.null any)
)
)
)
@@ -560,15 +558,15 @@
)
)
(drop
- (select (result externref)
+ (select (result anyref)
(local.get $0)
- (ref.null extern)
+ (ref.null any)
(i32.const 1)
)
)
(drop
(select (result funcref)
- (local.get $1)
+ (local.get $2)
(ref.null func)
(i32.const 1)
)
@@ -583,13 +581,13 @@
(drop
(select (result anyref)
(local.get $0)
- (local.get $1)
+ (local.get $2)
(i32.const 1)
)
)
(drop
(select (result anyref)
- (local.get $1)
+ (local.get $2)
(local.get $0)
(i32.const 1)
)
@@ -606,12 +604,12 @@
)
(drop
(ref.is_null
- (ref.null extern)
+ (ref.null any)
)
)
(drop
(ref.is_null
- (local.get $1)
+ (local.get $2)
)
)
(drop
@@ -631,7 +629,7 @@
)
(drop
(ref.is_null
- (local.get $2)
+ (local.get $1)
)
)
(drop
@@ -645,15 +643,15 @@
)
)
)
- (func $5 (result externref)
- (local $0 externref)
+ (func $5 (result anyref)
+ (local $0 anyref)
(local.get $0)
)
- (func $6 (result externref)
+ (func $6 (result anyref)
(global.get $global$0)
)
- (func $7 (result externref)
- (ref.null extern)
+ (func $7 (result anyref)
+ (ref.null any)
)
(func $8 (result funcref)
(local $0 funcref)
@@ -679,14 +677,14 @@
(ref.null any)
)
(func $15 (result anyref)
- (local $0 externref)
+ (local $0 anyref)
(local.get $0)
)
(func $16 (result anyref)
(global.get $global$0)
)
(func $17 (result anyref)
- (ref.null extern)
+ (ref.null any)
)
(func $18 (result anyref)
(local $0 funcref)
@@ -701,8 +699,8 @@
(func $21 (result anyref)
(ref.func $3)
)
- (func $22 (result externref)
- (local $0 externref)
+ (func $22 (result anyref)
+ (local $0 anyref)
(return
(local.get $0)
)
@@ -720,7 +718,7 @@
)
)
(func $25 (result anyref)
- (local $0 externref)
+ (local $0 anyref)
(local $1 funcref)
(return
(local.get $0)
diff --git a/test/unit/input/gc_target_feature.wasm b/test/unit/input/gc_target_feature.wasm
index fce4e1412..df5ab9cc0 100644
--- a/test/unit/input/gc_target_feature.wasm
+++ b/test/unit/input/gc_target_feature.wasm
Binary files differ
diff --git a/test/unit/test_features.py b/test/unit/test_features.py
index 408084086..53c2263f3 100644
--- a/test/unit/test_features.py
+++ b/test/unit/test_features.py
@@ -245,19 +245,19 @@ class FeatureValidationTest(utils.BinaryenTestCase):
self.check_multivalue(module, 'Multivalue block type ' +
'(multivalue is not enabled)')
- def test_anyref_global(self):
+ def test_i31_global(self):
module = '''
(module
- (global $foo anyref (ref.null any))
+ (global $foo (ref null i31) (ref.null i31))
)
'''
self.check_gc(module, 'all used types should be allowed')
- def test_anyref_local(self):
+ def test_i31_local(self):
module = '''
(module
(func $foo
- (local $0 anyref)
+ (local $0 (ref null i31))
)
)
'''
@@ -330,7 +330,7 @@ class TargetFeaturesSectionTest(utils.BinaryenTestCase):
filename = 'reference_types_target_feature.wasm'
self.roundtrip(filename)
self.check_features(filename, ['reference-types'])
- self.assertIn('externref', self.disassemble(filename))
+ self.assertIn('anyref', self.disassemble(filename))
def test_exception_handling(self):
filename = 'exception_handling_target_feature.wasm'