diff options
Diffstat (limited to 'src/tools/fuzzing.h')
-rw-r--r-- | src/tools/fuzzing.h | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index ef7844c60..9768b63c4 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -315,7 +315,20 @@ private: } SmallVector<Type, 2> options; options.push_back(type); // includes itself - // TODO (GC): subtyping + TODO_SINGLE_COMPOUND(type); + switch (type.getBasic()) { + case Type::anyref: + if (wasm.features.hasReferenceTypes()) { + options.push_back(Type::funcref); + options.push_back(Type::externref); + if (wasm.features.hasExceptionHandling()) { + options.push_back(Type::exnref); + } + } + break; + default: + break; + } return pick(options); } @@ -1349,6 +1362,7 @@ private: case Type::funcref: case Type::externref: case Type::exnref: + case Type::anyref: case Type::none: case Type::unreachable: WASM_UNREACHABLE("invalid type"); @@ -1452,6 +1466,7 @@ private: case Type::funcref: case Type::externref: case Type::exnref: + case Type::anyref: case Type::none: case Type::unreachable: WASM_UNREACHABLE("invalid type"); @@ -1580,6 +1595,7 @@ private: case Type::funcref: case Type::externref: case Type::exnref: + case Type::anyref: case Type::none: case Type::unreachable: WASM_UNREACHABLE("invalid type"); @@ -1624,6 +1640,7 @@ private: case Type::funcref: case Type::externref: case Type::exnref: + case Type::anyref: case Type::none: case Type::unreachable: WASM_UNREACHABLE("unexpected type"); @@ -1691,6 +1708,7 @@ private: case Type::funcref: case Type::externref: case Type::exnref: + case Type::anyref: case Type::none: case Type::unreachable: WASM_UNREACHABLE("unexpected type"); @@ -1717,6 +1735,7 @@ private: case Type::funcref: case Type::externref: case Type::exnref: + case Type::anyref: case Type::none: case Type::unreachable: WASM_UNREACHABLE("unexpected type"); @@ -1826,6 +1845,7 @@ private: case Type::funcref: case Type::externref: case Type::exnref: + case Type::anyref: return makeTrivial(type); case Type::none: case Type::unreachable: @@ -1970,6 +1990,7 @@ private: case Type::funcref: case Type::externref: case Type::exnref: + case Type::anyref: case Type::none: case Type::unreachable: WASM_UNREACHABLE("unexpected type"); @@ -2206,6 +2227,7 @@ private: case Type::funcref: case Type::externref: case Type::exnref: + case Type::anyref: case Type::none: case Type::unreachable: WASM_UNREACHABLE("unexpected type"); @@ -2412,6 +2434,7 @@ private: case Type::funcref: case Type::externref: case Type::exnref: + case Type::anyref: case Type::none: case Type::unreachable: WASM_UNREACHABLE("unexpected type"); @@ -2592,6 +2615,9 @@ private: if (wasm.features.hasExceptionHandling()) { options.push_back(Type::exnref); } + if (wasm.features.hasAnyref()) { + options.push_back(Type::anyref); + } return builder.makeRefIsNull(make(pick(options))); } @@ -2657,7 +2683,8 @@ private: .add(FeatureSet::SIMD, Type::v128) .add(FeatureSet::ReferenceTypes, Type::funcref, Type::externref) .add(FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling, - Type::exnref)); + Type::exnref) + .add(FeatureSet::ReferenceTypes | FeatureSet::Anyref, Type::anyref)); } Type getSingleConcreteType() { return pick(getSingleConcreteTypes()); } @@ -2697,7 +2724,7 @@ private: // - funcref cannot be logged because referenced functions can be inlined or // removed during optimization - // - there's no point in logging externref because it is opaque + // - there's no point in logging externref or anyref because these are opaque // - don't bother logging tuples std::vector<Type> getLoggableTypes() { return items( |