summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* s-expr parsing: handle empty switchAlon Zakai (kripken)2017-06-011-0/+1
|
* harden parsing.hAlon Zakai (kripken)2017-06-011-46/+50
|
* harden s-expr parsingAlon Zakai (kripken)2017-06-011-25/+29
|
* fix call depth detection in wasm-opt interpretingAlon Zakai (kripken)2017-06-012-2/+2
|
* handle the wrong number of functions being provided in binary formatAlon Zakai (kripken)2017-06-011-0/+8
|
* in extra pass-debug validation, don't assume there is always a function, the ↵Alon Zakai (kripken)2017-06-011-1/+1
| | | | error may be in a global init
* Exporting/importing debug location information from .wast/.asm.js/.s formats ↵Yury Delendik2017-06-0115-27/+438
| | | | | | | | (#1017) * Extends wasm-as, wasm-dis and s2wasm to consume debug locations. * Exports source map from asm2wasm
* Refactor optimization opts (#1023)Alon Zakai2017-05-243-98/+129
| | | | * refactor optimization opts helper code to a class
* More fuzz fixes (#1021)Alon Zakai2017-05-221-4/+16
| | | | | | * validate that memory/table segment values fit in the initial range * validate that select condition should be i32
* 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
* relooper improvementsAlon Zakai (kripken)2017-05-202-1/+9
|
* use TypeUpdater in vacuumAlon Zakai (kripken)2017-05-202-36/+48
|
* afl-fuzz bug fixes (#1018)Alon Zakai2017-05-202-0/+7
| | | | | | | | * values cannot flow through an if without an else, they never return a value * check pass tests in pass-debug mode too * add missing finalization in binary reading
* Address review feedback for #1014 (#1016)Alon Zakai2017-05-188-35/+77
| | | | | | * address review feedback for #1014
* optimize dceing of blocks and known-to-exist children (#1015)Alon Zakai2017-05-181-57/+34
|
* Validate finalization (#1014)Alon Zakai2017-05-1827-142/+809
| | | | | | | * validate that types are properly finalized, when in pass-debug mode (BINARYEN_PASS_DEBUG env var): check after each pass is run that the type of each node is equal to the proper type (when finalizing it, i.e., fully recomputing the type). * fix many fuzz bugs found by that. * in particular, fix dce bugs with type changes not being fully updated during code removal. add a new TypeUpdater helper class that lets a pass update types efficiently, by the helper tracking deps between blocks and branches etc., and updating/propagating type changes only as necessary.
* optimize if and select in the case their values are identical (#1013)Alon Zakai2017-05-171-0/+39
|
* Re-reloop pass (#1009)Alon Zakai2017-05-167-14/+342
| | | | | This adds a pass that converts to a CFG, runs the relooper, and re-generates wasm from that. This depends on flatten-control-flow being run before. The main goal here is to help code generators other than asm2wasm (which already receives relooped code from fastcomp).
* Parallelize istring creation (#1008)Alon Zakai2017-05-162-42/+37
| | | | | | | | * parallelize istring creation, by having a thread-local set and a global set guarded by a mutex. each time a new string shows up in a thread, it will be added to that thread's set, after accessing the global set through the lock first, which means we lock at most once per new string per thread * don't leak strings in istring store * since we now create names in a parallel thread-safe manner, we don't need to pre-create names in RelooperJumpThreading
* merge blocks before and after remove-unused-brsAlon Zakai (kripken)2017-05-101-1/+2
|
* allow values to flow out of loops in RemoveUnneededBrs, and simplify some ↵Alon Zakai (kripken)2017-05-101-12/+4
| | | | unnecessary complexity in that pass as well
* Flatten control flow pass (#999)Alon Zakai2017-05-105-0/+479
| | | | | | | | | | | This pass flattens out control flow in order to achieve 2 properties: * Control flow structures (block, loop, if) and control flow operations (br, br_if, br_table, return, unreachable) may only be block children, a loop body, or an if-true or if-false. (I.e., they cannot be nested inside an i32.add, a drop, a call, an if-condition, etc.) * Disallow block, loop, and if return values, i.e., do not use control flow to pass around values. As a result, expressions cannot contain control flow, and overall control flow is simpler, more structured, and more "flat". This should make things like re-relooping wasm code much easier, as they can run after the cfg is flattened
* asm2wasm: properly infer return type of a call inside a sequence (#1006)Alon Zakai2017-05-091-2/+8
|
* fix autoDrop, now that we properly set block types, unreachable can easily ↵Alon Zakai2017-05-091-1/+1
| | | | happen, and autoDrop wasn't handling it (#1005)
* Unreachable typing fixes (#1004)Alon Zakai2017-05-096-5/+95
| | | | | | | | | | | | * fix type of drop, set_local, set_global, load, etc: when operand is unreachable, so is the node itself * support binary tests properly in test/passes * fix unreachable typing of blocks with no name and an unreachable child * fix continue emitting in asm2wasm * properly handle emitting of unreachable load
* text format parsing fixes (#1002)Alon Zakai2017-05-081-4/+5
|
* fix an afl-fuzz bug where precompute alters a br to remove its condition, ↵Alon Zakai2017-05-081-0/+1
| | | | but does not properly modify the type (#1000)
* ctor-eval fixes (#996)Alon Zakai2017-05-052-3/+74
| | | | | | | | * fix wasm-ctor-eval, we need to look for the STACKTOP etc. imports, they may not be named, if this build is not with -g * pack memory after ctor evalling, since we merge it up which is less efficient * do some useful opts after ctor-evalling, to clean things up
* Make header guards consistent (#997)Sam Clegg2017-05-049-26/+23
|
* optimize duplication checks in binary format reading (#995)Alon Zakai2017-05-041-7/+5
|
* make function name duplicate testing handle the case of just some functions ↵Alon Zakai2017-05-031-5/+8
| | | | being named, and colliding with others' original names (#994)
* fix unreachable typing: for all nodes, if they are not reached - e.g., a ↵Alon Zakai (kripken)2017-05-023-16/+29
| | | | binary with either side unreachable - then they are unreachable. this makes our usage of the unreachable type consistent
* when creating blocks during dce, make sure they have the same type as before ↵Alon Zakai (kripken)2017-05-021-9/+14
| | | | the transformation, as the outside might care about that
* disallow empty blocks with a type - if they return a type, they must have ↵Alon Zakai2017-05-022-0/+7
| | | | contents. make s2wasm avoid outputting that as well (#992)
* improve dce to handle more cases of nested unreachable code (#989)Alon Zakai2017-05-022-8/+47
| | | | | | | | | | * improve dce to handle more cases of nested unreachable code, in particular, when the child is unreachable in type but not an actual Unreachable node, e.g. if it's a br. in that case, we just need to verify that the br is not to us where we are a block or loop * handle unreachable switch conditions in dce * handle dce of br condition which is unreachable, and host arguments * handle dce of block i32 etc. which is actually unreachable
* Validation fixes for issues noticed by afl (#988)Alon Zakai2017-05-021-6/+109
| | | | | | | | | | | | * properly validate block endings * blocks with a value must not have a last element that is none * fully validate input types to binary expressions * validate i32.eqz/i64.eqz more carefully * if condition must be i32
* Parsing fixes (#990)Alon Zakai2017-05-025-53/+156
| | | | | | | | | | * 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
* --no-js-ffi opt to disable JS FFI mangling. (#984)Joel Martin2017-05-013-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Always use scripts.test.shared for bin paths. Update scripts/test/shared.py to add WASM_MERGE relative to build directory. Update auto_update_tests.py to use scripts.test.shared variables for all bin paths. Update check.py to use scripts.test.shared for wasm-merge path (this was missing). This allows check.py and auto_update_tests.py to be run from the source directory using built binaries in a different location. * --no-legalize-javascript-ffi disables JS FFI mangling. For JS/Web platform, calls to JS imports are wrapped to convert i64 to i32 and f32 to f64. Likewise calls from JS into exports do the inverse wrapping. This change provides an option to disable that wrapping and use the original types for the call. Includes tests test/noffi_f32.asm.js and test/noffi_i64.asm.js to make sure neither f32->f64 nor i64->i32 type mangling is happening when --no-legalize-javascript-ffi is specified. To fully disable JS FFI mangling when using emscripten, the fastcomp FFI mangling must also be disabled using the -emscripten-legalize-javascript-ffi=0 flag.
* handle a drop of an if with both arms unreachable, which is possible since ↵Alon Zakai2017-05-011-4/+2
| | | | wasm added if types, which mean the if can be i32 even if the arms are unreachable etc (#991)
* Add pass to instrument loads / stores. (#959)Michael Bebenita2017-04-296-0/+128
| | | | | | | | * Add pass to instrument loads / stores * Simplify instrumentation. * Document.
* ctor evaller (#982)Alon Zakai2017-04-286-83/+594
| | | | | Add wasm-ctor-eval, which evaluates functions at compile time - typically static constructor functions - and applies their effects into memory, saving work at startup. If we encounter something we can't evaluate at compile time in our interpreter, stop there. This is similar to ctor_evaller.py in emscripten (which was for asm.js).
* Preserve debug info through the optimizer (#981)Alon Zakai2017-04-287-68/+138
| | | | | | | | | | | | | | * add debugInfo option to passes, and use it to keep debug info alive through optimizations when we need it * add fib testcase for debug info * when preserving debug info, do not move code around call-imports, so debug info intrinsics remain stationary * improve wasm-module-building handling of the single-threaded case: don't create workers, which is more efficient and also nicer for debugging * process debug info in a more precise way, reordering it from being after the node (as it was a comment in JS) to before the node * remove unreachable hack for debug info, which is no longer needed since we reorder them, and make sure to finalize blocks in which we reorder
* Fix typo in --finalize-table-base short name to -ftb (#972)Wink Saville2017-04-191-1/+1
|
* handle unsigned float-to-int properly in asm2wasmAlon Zakai (kripken)2017-04-181-3/+17
|
* 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
* wasm-merge tool (#919)Alon Zakai2017-04-175-1/+653
| | | | wasm-merge tool: combines two wasm files into a larger one, handling collisions, and aware of the dynamic linking conventions. it does not do full static linking, but may eventually.
* Replace text annotations with explicit file/line for debug info (#967)Derek Schuff2017-04-133-10/+16
| | | Rather than storing debug info as text annotations, store explicit file and line information. This will make it easier to experiment with outputting other serializations or representations (e.g. source maps), and will allow outputting debug info for binaries as well.
* Extensible name section (#933)pipcet2017-04-132-20/+51
| | | | | | | | | | | | | See https://github.com/WebAssembly/binaryen/issues/914. * extensible name section support: read function names, too * c-api-unused-mem.txt: change expected size to match new name section * * check subsection size matches * print warning for unknown name subsections (including the local section)
* s2wasm: Add command line option for importing memory (#963)Max Klein2017-04-121-1/+7
| | | | | | This option allows to import the linear memory from JS code instead of exporting it. --emscripten-glue does this too but often the emscripten glue isn't needed, so this option only affects the memory. All the code necessary for importing the memory basically already exists, so nothing except for the command line option itself had to be added.
* Don't iterate over removed-but-not-erased functions (#961)jgravelle-google2017-04-071-1/+2
|