Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/asmjs/asm_v_wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions src/binaryen-c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -140,7 +138,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; } // Deprecate?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BinaryenType BinaryenTypeExternref(void) { return Type::anyref; } // Deprecate?
BinaryenType BinaryenTypeExternref(void) { return Type::anyref; } // TODO Deprecate?

BinaryenType BinaryenTypeAnyref(void) { return Type::anyref; }
BinaryenType BinaryenTypeEqref(void) { return Type::eqref; }
BinaryenType BinaryenTypeI31ref(void) { return Type::i31ref; }
Expand Down
2 changes: 0 additions & 2 deletions src/ir/abstract.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion src/literal.h
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,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:
Expand Down
1 change: 0 additions & 1 deletion src/passes/ConstHoisting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ struct ConstHoisting : public WalkerPass<PostWalker<ConstHoisting>> {
// not implemented yet
case Type::v128:
case Type::funcref:
case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
Expand Down
2 changes: 0 additions & 2 deletions src/passes/FuncCastEmulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
23 changes: 4 additions & 19 deletions src/passes/InstrumentLocals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -98,9 +97,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;
Expand Down Expand Up @@ -158,9 +154,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;
Expand Down Expand Up @@ -204,19 +197,11 @@ 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(
Expand Down
26 changes: 3 additions & 23 deletions src/tools/fuzzing/fuzzing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 0 additions & 6 deletions src/tools/fuzzing/heap-types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ struct HeapTypeGeneratorImpl {

HeapType::BasicHeapType generateBasicHeapType() {
return rand.pick(HeapType::func,
HeapType::ext,
HeapType::any,
HeapType::eq,
HeapType::i31,
Expand All @@ -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,
Expand Down Expand Up @@ -294,7 +292,6 @@ struct HeapTypeGeneratorImpl {
return type;
} else {
switch (type) {
case HeapType::ext:
case HeapType::i31:
// No other subtypes.
return type;
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -496,7 +491,6 @@ struct HeapTypeGeneratorImpl {
switch (*basic) {
case HeapType::func:
return SignatureKind{};
case HeapType::ext:
case HeapType::i31:
return super;
case HeapType::any:
Expand Down
3 changes: 0 additions & 3 deletions src/tools/spec-wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions src/tools/wasm-reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -726,7 +722,6 @@ struct Reducer
}
case Type::v128:
case Type::funcref:
case Type::externref:
case Type::anyref:
case Type::eqref:
case Type::i31ref:
Expand Down
17 changes: 7 additions & 10 deletions src/wasm-binary.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down
Loading