diff options
author | Daniel Wirtz <dcode@dcode.io> | 2020-09-17 07:46:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-17 07:46:40 +0200 |
commit | e1d74ef2acdd88f06b9e58f91f30bb56b9a26fe8 (patch) | |
tree | 3b52301afd147617cf14e32fd487378394bc709b /src/tools/fuzzing.h | |
parent | a96e8310e1a58c0a43b2d0e2ff4f9db24dd9a18a (diff) | |
download | binaryen-e1d74ef2acdd88f06b9e58f91f30bb56b9a26fe8.tar.gz binaryen-e1d74ef2acdd88f06b9e58f91f30bb56b9a26fe8.tar.bz2 binaryen-e1d74ef2acdd88f06b9e58f91f30bb56b9a26fe8.zip |
Add GC feature flag (#3135)
Adds the `--enable-gc` feature flag, so far enabling the `anyref` type incl. subtyping, and removes the temporary `--enable-anyref` feature flag that it replaces.
Diffstat (limited to 'src/tools/fuzzing.h')
-rw-r--r-- | src/tools/fuzzing.h | 27 |
1 files changed, 14 insertions, 13 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); |