summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
21 files changed, 35 insertions, 158 deletions
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)");
}
}