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