diff options
Diffstat (limited to 'src/tools/fuzzing.h')
-rw-r--r-- | src/tools/fuzzing.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index 7954229c7..8f7123a78 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -123,8 +123,8 @@ public: std::cout << "shrink level: " << options.passOptions.shrinkLevel << '\n'; } - void build(bool initEmitAtomics = true) { - emitAtomics = initEmitAtomics; + void build(FeatureSet features_) { + features = features_; setupMemory(); setupTable(); setupGlobals(); @@ -179,8 +179,8 @@ private: // cross-VM comparisons harder) static const bool DE_NAN = true; - // Whether to emit atomics - bool emitAtomics = true; + // Features allowed to be emitted + FeatureSet features = FeatureSet::All; // Whether to emit atomic waits (which in single-threaded mode, may hang...) static const bool ATOMIC_WAITS = false; @@ -1118,7 +1118,7 @@ private: Expression* makeLoad(Type type) { auto* ret = makeNonAtomicLoad(type); if (type != i32 && type != i64) return ret; - if (!emitAtomics || oneIn(2)) return ret; + if (!features.hasAtomics() || oneIn(2)) return ret; // make it atomic wasm.memory.shared = true; ret->isAtomic = true; @@ -1181,7 +1181,7 @@ private: Store* makeStore(Type type) { auto* ret = makeNonAtomicStore(type); if (ret->value->type != i32 && ret->value->type != i64) return ret; - if (!emitAtomics || oneIn(2)) return ret; + if (!features.hasAtomics() || oneIn(2)) return ret; // make it atomic wasm.memory.shared = true; ret->isAtomic = true; @@ -1314,7 +1314,7 @@ private: case i32: { switch (upTo(4)) { case 0: { - if (emitAtomics) { + if (features.hasAtomics()) { return makeUnary({ pick(EqZInt32, ClzInt32, CtzInt32, PopcntInt32, ExtendS8Int32, ExtendS16Int32), make(i32) }); } else { return makeUnary({ pick(EqZInt32, ClzInt32, CtzInt32, PopcntInt32), make(i32) }); @@ -1330,7 +1330,7 @@ private: case i64: { switch (upTo(4)) { case 0: { - if (emitAtomics) { + if (features.hasAtomics()) { return makeUnary({ pick(ClzInt64, CtzInt64, PopcntInt64, ExtendS8Int64, ExtendS16Int64, ExtendS32Int64), make(i64) }); } else { return makeUnary({ pick(ClzInt64, CtzInt64, PopcntInt64), make(i64) }); @@ -1465,7 +1465,7 @@ private: } Expression* makeAtomic(Type type) { - if (!emitAtomics || (type != i32 && type != i64)) return makeTrivial(type); + if (!features.hasAtomics() || (type != i32 && type != i64)) return makeTrivial(type); wasm.memory.shared = true; if (type == i32 && oneIn(2)) { if (ATOMIC_WAITS && oneIn(2)) { |