diff options
Diffstat (limited to 'src/tools/fuzzing.h')
-rw-r--r-- | src/tools/fuzzing.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index 0783588cd..7ef24bbac 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -892,6 +892,8 @@ private: } if (type == Type::i32) { options.add(FeatureSet::ReferenceTypes, &Self::makeRefIsNull); + options.add(FeatureSet::ReferenceTypes | FeatureSet::GC, + &Self::makeRefEq); } if (type.isTuple()) { options.add(FeatureSet::Multivalue, &Self::makeTupleMake); @@ -2640,6 +2642,14 @@ private: return builder.makeRefIsNull(make(getReferenceType())); } + Expression* makeRefEq(Type type) { + assert(type == Type::i32); + assert(wasm.features.hasReferenceTypes() && wasm.features.hasGC()); + auto* left = make(getEqReferenceType()); + auto* right = make(getEqReferenceType()); + return builder.makeRefEq(left, right); + } + Expression* makeMemoryInit() { if (!allowMemory) { return makeTrivial(Type::none); @@ -2723,6 +2733,14 @@ private: Type getReferenceType() { return pick(getReferenceTypes()); } + std::vector<Type> getEqReferenceTypes() { + return items( + FeatureOptions<Type>().add(FeatureSet::ReferenceTypes | FeatureSet::GC, + Type::eqref)); // TODO: i31ref + } + + Type getEqReferenceType() { return pick(getEqReferenceTypes()); } + Type getTupleType() { std::vector<Type> elements; size_t numElements = 2 + upTo(MAX_TUPLE_SIZE - 1); |