summaryrefslogtreecommitdiff
path: root/src/tools/wasm-opt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* add --converge option to wasm-opt (#1524)Alon Zakai2018-04-301-6/+31
| | | | | The option keeps running the passes (that we were told to run) in cycles until we converge in terms of the binary size, that is, keep optimizing until we can't shrink any more. Also fix a --metrics bug this uncovered: we can't expect the Metrics object to still be around if running passes later in another PassRunner.
* Better binary error reporting (#1505)Alon Zakai2018-04-131-0/+1
| | | | | Report the offset with the error. Also fix a compiler warning about comparing signed/unsigned types in the LEB code.
* add a --no-validation option to the commandline tools. disabling validation ↵Alon Zakai2018-04-091-15/+23
| | | | makes loading large wasm files more than twice as fast (#1496)
* 'std::string &' => 'std::string& ' (#1403)Alon Zakai2018-02-051-9/+9
| | | The & on the type is the proper convention.
* merge-locals pass (#1334)Alon Zakai2017-12-171-23/+25
| | | | | | | | | This optimizes the situation described in #1331. Namely, when x is copied into y, then on subsequent gets of x we could use y instead, and vice versa, as their value is equal. Specifically, this seems to get rid of the definite overlap in the live ranges of x and y, as removing it allows coalesce-locals to merge them. The pass therefore does nothing if the live range of y ends there anyhow. The danger here is that we may extend the live range so that it causes more conflicts with other things, so this is a heuristic, but I've tested it on every codebase I can find and it always produces a net win, even on one I saw a 0.4% reduction of code size, which surprised me. This is a fairly slow pass, because it uses LocalGraph which isn't much optimized. This PR includes a minor optimization for it, but we should rewrite it. Meanwhile this is just enabled in -O3 and -Oz. This PR also includes some fuzzing improvements, to better test stuff like this.
* Fast pass fuzzing (#1258)Alon Zakai2017-11-131-3/+10
| | | | * add fuzz-pass option, which picks random passes to fuzz in each wasm-opt invocation
* Restrict validation output to just validation errors in the API (#1253)Daniel Wirtz2017-11-011-2/+12
| | | Do not print the entire and possibly very large module when validation fails. Leave printing to tools using the validator, instead of always doing it in the validator where it can't be overridden.
* Add Features enum to IR (#1250)Derek Schuff2017-10-271-4/+7
| | | | | | | | | | | | This enum describes which wasm features the IR is expected to include. The validator should reject operations which require excluded features, and passes should avoid producing IR which requires excluded features. This makes it easier to catch possible errors in Binaryen producers (e.g. emscripten). Asm2wasm has a flag to enable or disable atomics. Other tools currently just accept all features (as, dis and opt are just for inspecting or modifying existing modules, so it would be annoying to have to use flags with those tools and I expect the risk of accidentally introducing atomics to be low).
* Avoid returning a PassRunner just for OptimizationOptions (#1234)Alon Zakai2017-10-201-3/+1
| | | | | | | | * avoid returning a PassRunner just for OptimizationOptions, it would need a more careful design with a copy constructor. instead, just simplify the API to do the thing we need, which is run the passes * disallow copy constructor * delete copy operator too
* add an option to run an extra command when fuzzing in wasm-optAlon Zakai2017-08-251-13/+56
| | | | for now this is linux-only as it uses popen etc.
* New fuzzer (#1126)Alon Zakai2017-08-111-68/+64
| | | | | | This adds a new method of fuzzing, "translate to fuzz" which means we consider the input to be a stream of data that we translate into a valid wasm module. It's sort of like a random seed for a process that creates a random wasm module. By using the input that way, we can explore the space of valid wasm modules quickly, and it makes afl-fuzz integration easy. Also adds a "fuzz binary" option which is similar to "fuzz execution". It makes wasm-opt not only execute the code before and after opts, but also write to binary and read from it, helping to fuzz the binary format.
* fix fuzz-exec catching of traps, they can occur during init, not just callAlon Zakai (kripken)2017-06-011-6/+7
|
* fix call depth detection in wasm-opt interpretingAlon Zakai (kripken)2017-06-011-1/+1
|
* Refactor optimization opts (#1023)Alon Zakai2017-05-241-26/+4
| | | | * refactor optimization opts helper code to a class
* add --fuzz-exec option to wasm-opt, which (when possible) executes results ↵Alon Zakai (kripken)2017-05-201-0/+73
| | | | before and after optimizations are run, checking for changes. this can be used when fuzzing
* Parsing fixes (#990)Alon Zakai2017-05-021-0/+2
| | | | | | | | | | * properly catch a bunch of possible parse errors, found by afl-fuzz * clean up wasm-interpreter, use WASM_UNREACHABLE instead of abort * detect duplicate names in function names section * detect duplicate export names
* Fix bustage (#975)Alon Zakai2017-04-181-0/+5
| | | | | | * support -g in wasm-opt, which makes it easier to upgrade binaries for bustage * upgrade binaries in test/merge to new names section format
* Read/Write Abstraction (#889)Alon Zakai2017-01-261-11/+20
| | | | | * Added ModuleReader/Writer classes that support text and binary I/O * Use them in wasm-opt and asm2wasm
* Add -O0,-O1,etc. options (#790)Alon Zakai2016-10-191-18/+8
| | | | And use them in wasm-opt and asm2wasm consistently and uniformly.
* Pass options (#788)Alon Zakai2016-10-181-2/+16
| | | | * add PassOptions structure, and use it for new -Os param to wasm-opt
* validate properly in wasm-optAlon Zakai2016-07-131-1/+4
|
* separate wasm-opt out from wasm-shell: opt optimizes, shell runs wast shell ↵Alon Zakai2016-07-131-0/+102
tests