diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-08-27 08:18:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-27 08:18:32 -0700 |
commit | 8c89a7baae740013b038865fc4e290439b91eb6f (patch) | |
tree | 5fe7c1b6d559040740ee8387efed0dbb6c0264b7 /src/tools/translate-to-fuzz.h | |
parent | e60fcd0ba97ed75440c6f838619455be7a5e90a3 (diff) | |
parent | 9592b881bd1d17dfa24cfee5aea31f6f9d8312d5 (diff) | |
download | binaryen-8c89a7baae740013b038865fc4e290439b91eb6f.tar.gz binaryen-8c89a7baae740013b038865fc4e290439b91eb6f.tar.bz2 binaryen-8c89a7baae740013b038865fc4e290439b91eb6f.zip |
Merge pull request #1147 from WebAssembly/betterfuzz
Fuzzer improvements and some small fixes
Diffstat (limited to 'src/tools/translate-to-fuzz.h')
-rw-r--r-- | src/tools/translate-to-fuzz.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/tools/translate-to-fuzz.h b/src/tools/translate-to-fuzz.h index a7f86af13..307604af6 100644 --- a/src/tools/translate-to-fuzz.h +++ b/src/tools/translate-to-fuzz.h @@ -87,7 +87,7 @@ private: // the number of runtime iterations (function calls, loop backbranches) we // allow before we stop execution with a trap, to prevent hangs. 0 means // no hang protection. - static const int HANG_LIMIT = 25; + static const int HANG_LIMIT = 100; // Optionally remove NaNs, which are a source of nondeterminism (which makes // cross-VM comparisons harder) @@ -452,14 +452,20 @@ private: // make something with no chance of infinite recursion Expression* makeTrivial(WasmType type) { if (isConcreteWasmType(type)) { - return makeConst(type); + if (oneIn(2)) { + return makeGetLocal(type); + } else { + return makeConst(type); + } } else if (type == none) { return makeNop(type); } assert(type == unreachable); - return builder.makeReturn( - isConcreteWasmType(func->result) ? makeConst(func->result) : nullptr - ); + Expression* ret = nullptr; + if (isConcreteWasmType(func->result)) { + ret = makeTrivial(func->result); + } + return builder.makeReturn(ret); } // specific expression creators @@ -650,7 +656,7 @@ private: Expression* makeGetLocal(WasmType type) { auto& locals = typeLocals[type]; - if (locals.empty()) return makeTrivial(type); + if (locals.empty()) return makeConst(type); return builder.makeGetLocal(vectorPick(locals), type); } |