diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/fuzzing.h | 27 | ||||
-rw-r--r-- | src/tools/tool-options.h | 2 |
2 files changed, 15 insertions, 14 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index 9768b63c4..e6cc4e444 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -848,8 +848,7 @@ private: } Expression* _makeConcrete(Type type) { - bool canMakeControlFlow = - !type.isTuple() || wasm.features.has(FeatureSet::Multivalue); + bool canMakeControlFlow = !type.isTuple() || wasm.features.hasMultivalue(); using Self = TranslateToFuzzReader; FeatureOptions<Expression* (Self::*)(Type)> options; using WeightedOption = decltype(options)::WeightedOption; @@ -2609,16 +2608,7 @@ private: Expression* makeRefIsNull(Type type) { assert(type == Type::i32); assert(wasm.features.hasReferenceTypes()); - SmallVector<Type, 2> options; - options.push_back(Type::externref); - options.push_back(Type::funcref); - if (wasm.features.hasExceptionHandling()) { - options.push_back(Type::exnref); - } - if (wasm.features.hasAnyref()) { - options.push_back(Type::anyref); - } - return builder.makeRefIsNull(make(pick(options))); + return builder.makeRefIsNull(make(getReferenceType())); } Expression* makeMemoryInit() { @@ -2684,11 +2674,22 @@ private: .add(FeatureSet::ReferenceTypes, Type::funcref, Type::externref) .add(FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling, Type::exnref) - .add(FeatureSet::ReferenceTypes | FeatureSet::Anyref, Type::anyref)); + .add(FeatureSet::ReferenceTypes | FeatureSet::GC, Type::anyref)); } Type getSingleConcreteType() { return pick(getSingleConcreteTypes()); } + std::vector<Type> getReferenceTypes() { + return items( + FeatureOptions<Type>() + .add(FeatureSet::ReferenceTypes, Type::funcref, Type::externref) + .add(FeatureSet::ReferenceTypes | FeatureSet::ExceptionHandling, + Type::exnref) + .add(FeatureSet::ReferenceTypes | FeatureSet::GC, Type::anyref)); + } + + Type getReferenceType() { return pick(getReferenceTypes()); } + Type getTupleType() { std::vector<Type> elements; size_t numElements = 2 + upTo(MAX_TUPLE_SIZE - 1); diff --git a/src/tools/tool-options.h b/src/tools/tool-options.h index 082e95549..2e7158b34 100644 --- a/src/tools/tool-options.h +++ b/src/tools/tool-options.h @@ -87,7 +87,7 @@ struct ToolOptions : public Options { .addFeature(FeatureSet::TailCall, "tail call operations") .addFeature(FeatureSet::ReferenceTypes, "reference types") .addFeature(FeatureSet::Multivalue, "multivalue functions") - .addFeature(FeatureSet::Anyref, "anyref type (without GC)") + .addFeature(FeatureSet::GC, "garbage collection") .add("--no-validation", "-n", "Disables validation, assumes inputs are correct", |