diff options
author | Alon Zakai <azakai@google.com> | 2024-11-19 15:26:09 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-19 15:26:09 -0800 |
commit | e13bf0fb72fca160f457570b930c4ba3c35ead3a (patch) | |
tree | d840d824a6da6213cb9e27051cda3afd138863ed /scripts | |
parent | 206ad2906c9e0af92ec4c4da223c96755243aa2e (diff) | |
download | binaryen-e13bf0fb72fca160f457570b930c4ba3c35ead3a.tar.gz binaryen-e13bf0fb72fca160f457570b930c4ba3c35ead3a.tar.bz2 binaryen-e13bf0fb72fca160f457570b930c4ba3c35ead3a.zip |
Improve fuzzing of both closed and open world styles of modules (#7090)
Before, we would simply not export a function that had an e.g. anyref
param. As a result, the modules were effectively "closed", which was
good for testing full closed-world mode, but not for testing degrees of
open world. To improve that, this PR allows the fuzzer to export such
functions, and an "enclose world" pass is added that "closes" the wasm
(makes it more compatible with closed-world) that is run 50% of the
time, giving us coverage of both styles.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/fuzz_opt.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/fuzz_opt.py b/scripts/fuzz_opt.py index cd583e026..4fc92f367 100755 --- a/scripts/fuzz_opt.py +++ b/scripts/fuzz_opt.py @@ -225,6 +225,11 @@ def randomize_fuzz_settings(): # optimizations we use to create any other wasm file. FUZZ_OPTS += ['--dce'] + # Enclose the world much of the time when fuzzing closed-world, so that many + # types are private and hence optimizable. + if CLOSED_WORLD and random.random() < 0.5: + GEN_ARGS += ['--enclose-world'] + print('randomized settings (NaNs, OOB, legalize):', NANS, OOB, LEGALIZE) @@ -1790,6 +1795,7 @@ opt_choices = [ ("--dce",), ("--directize",), ("--discard-global-effects",), + ("--enclose-world",), ("--flatten", "--dfo",), ("--duplicate-function-elimination",), ("--flatten",), |