diff options
author | Jonathan Foote <jmfoote@loyola.edu> | 2018-04-30 14:38:32 -0400 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2018-04-30 11:38:32 -0700 |
commit | ec426c6b8ba87c5c5107ed30497ad13252dd3258 (patch) | |
tree | f5f023d858137be1e81602c75f004f8eab90746b /src/tools/fuzzing.h | |
parent | b38d9bc6c0d382aedd4c769093139a49ee69afdc (diff) | |
download | binaryen-ec426c6b8ba87c5c5107ed30497ad13252dd3258.tar.gz binaryen-ec426c6b8ba87c5c5107ed30497ad13252dd3258.tar.bz2 binaryen-ec426c6b8ba87c5c5107ed30497ad13252dd3258.zip |
Make generating atomics optional in translate-to-fuzz (#1513)
Diffstat (limited to 'src/tools/fuzzing.h')
-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)) { |