diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/fuzzing.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index 88785beb4..c433a81d8 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -120,7 +120,8 @@ public: std::cout << "shrink level: " << options.passOptions.shrinkLevel << '\n'; } - void build() { + void build(bool initEmitAtomics = true) { + emitAtomics = initEmitAtomics; setupMemory(); setupTable(); setupGlobals(); @@ -175,7 +176,7 @@ private: static const bool DE_NAN = true; // Whether to emit atomics - static const bool ATOMICS = true; + bool emitAtomics = true; // Whether to emit atomic waits (which in single-threaded mode, may hang...) static const bool ATOMIC_WAITS = false; @@ -915,7 +916,7 @@ private: Expression* makeLoad(Type type) { auto* ret = makeNonAtomicLoad(type); if (type != i32 && type != i64) return ret; - if (!ATOMICS || oneIn(2)) return ret; + if (!emitAtomics || oneIn(2)) return ret; // make it atomic wasm.memory.shared = true; ret->isAtomic = true; @@ -975,7 +976,7 @@ private: Store* makeStore(Type type) { auto* ret = makeNonAtomicStore(type); if (ret->value->type != i32 && ret->value->type != i64) return ret; - if (!ATOMICS || oneIn(2)) return ret; + if (!emitAtomics || oneIn(2)) return ret; // make it atomic wasm.memory.shared = true; ret->isAtomic = true; @@ -1098,7 +1099,7 @@ private: case i32: { switch (upTo(4)) { case 0: { - if (ATOMICS) { + if (emitAtomics) { return makeUnary({ pick(EqZInt32, ClzInt32, CtzInt32, PopcntInt32, ExtendS8Int32, ExtendS16Int32), make(i32) }); } else { return makeUnary({ pick(EqZInt32, ClzInt32, CtzInt32, PopcntInt32), make(i32) }); @@ -1114,7 +1115,7 @@ private: case i64: { switch (upTo(4)) { case 0: { - if (ATOMICS) { + if (emitAtomics) { return makeUnary({ pick(ClzInt64, CtzInt64, PopcntInt64, ExtendS8Int64, ExtendS16Int64, ExtendS32Int64), make(i64) }); } else { return makeUnary({ pick(ClzInt64, CtzInt64, PopcntInt64), make(i64) }); @@ -1243,7 +1244,7 @@ private: } Expression* makeAtomic(Type type) { - if (!ATOMICS || (type != i32 && type != i64)) return makeTrivial(type); + if (!emitAtomics || (type != i32 && type != i64)) return makeTrivial(type); wasm.memory.shared = true; if (type == i32 && oneIn(2)) { if (ATOMIC_WAITS && oneIn(2)) { |