diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-01-22 17:36:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-22 17:36:06 -0800 |
commit | 155d0b5f42b57100582649dfbdb81806b10579a2 (patch) | |
tree | 991421bf9fcd120aa0c4d6cad41df14de1fc7afd /src/tools/fuzzing.h | |
parent | 02729a12e1735f629d3066b51c96a056f712b080 (diff) | |
download | binaryen-155d0b5f42b57100582649dfbdb81806b10579a2.tar.gz binaryen-155d0b5f42b57100582649dfbdb81806b10579a2.tar.bz2 binaryen-155d0b5f42b57100582649dfbdb81806b10579a2.zip |
Atomic wait/wake fixes (#1383)
* fix wait and wake binary format support, they have alignments and offsets
* don't emit unreachable parts of atomic operations, for simplicity and to avoid special handling
* don't emit atomic waits by default in the fuzzer, they hang in native vm support
Diffstat (limited to 'src/tools/fuzzing.h')
-rw-r--r-- | src/tools/fuzzing.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/tools/fuzzing.h b/src/tools/fuzzing.h index 0b3dbf78e..19bff428e 100644 --- a/src/tools/fuzzing.h +++ b/src/tools/fuzzing.h @@ -174,6 +174,9 @@ private: // Whether to emit atomics static const bool ATOMICS = true; + // Whether to emit atomic waits (which in single-threaded mode, may hang...) + static const bool ATOMIC_WAITS = false; + // after we finish the input, we start going through it again, but xoring // so it's not identical int xorFactor = 0; @@ -1242,16 +1245,16 @@ private: if (!ATOMICS || (type != i32 && type != i64)) return makeTrivial(type); wasm.memory.shared = true; if (type == i32 && oneIn(2)) { - if (oneIn(2)) { + if (ATOMIC_WAITS && oneIn(2)) { auto* ptr = makePointer(); auto expectedType = pick(i32, i64); auto* expected = make(expectedType); auto* timeout = make(i64); - return builder.makeAtomicWait(ptr, expected, timeout, expectedType); + return builder.makeAtomicWait(ptr, expected, timeout, expectedType, logify(get())); } else { auto* ptr = makePointer(); auto* count = make(i32); - return builder.makeAtomicWake(ptr, count); + return builder.makeAtomicWake(ptr, count, logify(get())); } } Index bytes; |