summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
|
* Fix build with gcc 7 (#957)Morris Hafner2017-03-292-2/+2
| | | | 1. Add a missing <functional> include 2. Put the // fallthrough comment after the closing bracket so the compiler does not emit a implicit fallthrough warning.
* New binaryen.js (#922)Alon Zakai2017-03-249-175/+882
| | | New binaryen.js implementation, based on the C API underneath and with a JS-friendly API on top. See docs under docs/ for API details.
* Fix comparisons of sign-extends to weird constants (#956)Alon Zakai2017-03-211-6/+31
| | | | * fix eq/ne of sign-ext with a constant, when the constant can never be equal to it as it has the effective sign bit but not the upper bits above it set, which the sign-ext would emit
* add a pass to log execution traces via instrumenting the code (#950)Alon Zakai2017-03-164-1/+80
|
* Skip .size directives that follow .import_global directives (#949)jgravelle-google2017-03-161-1/+7
|
* fix emitting of unreachable ifs (#944)Alon Zakai2017-03-141-13/+11
|
* finalize interim ifs in relooper, and other if handling issues (#940)Alon Zakai2017-03-133-1/+14
|
* Wasm h to cpp (#926)jgravelle-google2017-03-1026-1035/+1410
| | | | | | | | | | | | | | | | | | | | | | | | * Move WasmType function implementations to wasm.cpp * Move Literal methods to wasm.cpp * Reorder wasm.cpp shared constants back to top * Move expression functions to wasm.cpp * Finish moving things to wasm.cpp * Split out Literal into its own .h/.cpp. Also factor out common wasm-type module * Remove unneeded/transitive includes from wasm.h * Add comment to try/check methods * Rename tryX/checkX methods to getXOrNull * Add missing include that should fix appveyor build breakage * More appveyor
* optimize pow (#934)Alon Zakai2017-03-104-0/+72
| | | | | | * optimize pow(x,2) => x*x * optimize pow(x, 0.5) => sqrt(x)
* fix sign-ext opt issues (#935)Alon Zakai2017-03-091-11/+15
| | | | | | * fix a bug where compared sign-exts of different sizes were turned into zero-exts * fix a bug where we consider an almost sign-ext as ok to change the sign of a load inside it, ignoring that the load has the extra shifting
* use a single space for pretty printing of wasts, so massive wasts are less ↵Alon Zakai2017-03-091-1/+1
| | | | unruly (#928)
* Local CSE (#930)Alon Zakai2017-03-085-0/+222
| | | Simple local common subexpression elimination. Useful mostly to reduce code size (as VMs do GVN etc.). Enabled by default in -Oz.
* Use 3 modes for potentially trapping ops in asm2wasm (#929)Alon Zakai2017-03-072-56/+132
| | | * use 3 modes for potentially trapping ops in asm2wasm: allow (just emit a potentially trapping op), js (do exactly what js does, even if it takes a slow ffi to do it), and clamp (avoid the trap by clamping as necessary)
* stop doing dce in -O0, which was just need temporarily while browsers figure ↵Alon Zakai2017-03-061-3/+0
| | | | out the spec (#932)
* do not merge a drop out of an if if the sides have different types, then the ↵Alon Zakai2017-02-281-5/+9
| | | | if would be invalid (#927)
* asm2wasm import overloading fix (#924)Alon Zakai2017-02-281-1/+2
| | | | * asm2wasm should not promote an overloaded import result to f64 if it is a single type and void
* Fixes compilation error on clang (#925)Kazuki Oikawa2017-02-271-1/+1
|
* fix BINARYEN_PASS_DEBUG option (#908)Alon Zakai2017-02-236-5/+25
| | | | | * fix BINARYEN_PASS_DEBUG option * Add isNested property to passRunner
* Refactor AsmConstWalker to use smaller subfunctions (#923)jgravelle-google2017-02-231-35/+61
| | | | | | * Refactor AsmConstWalker to use smaller subfunctions * Replace cashew::IStrings with Names
* Default Walker subclasses to using Visitor<SubType> (#921)jgravelle-google2017-02-2328-58/+58
| | | | Most module walkers use PostWalker<T, Visitor<T>>, let that pattern be expressed as simply PostWalker<T>
* Fully handle EM_ASM in s2wasm (#910)jgravelle-google2017-02-235-29/+83
| | | | | | | | | | | | * Fully handle EM_ASM in s2wasm * Iterate with size_ts, remember to erase from importsMap as well * Fix dot_s test EM_ASM signatures * Move Name out to its own file, support/name.h * Move removeImportsWithSubstring out of Module class
* fix asm2wasm import type setting - set the type of used calls based o… (#920)Alon Zakai2017-02-211-9/+16
| | | | * fix asm2wasm import type setting - set the type of used calls based on the context, early, so it's valid in the optimizer
* read unknown users sections as binary data stored on the Module (#918)Alon Zakai2017-02-214-4/+29
|
* allow traversing the inits of globals (#917)Alon Zakai2017-02-211-1/+6
|
* clean up raw pointer import->functionType, make it a Name like everything ↵Alon Zakai2017-02-1711-33/+36
| | | | else (#915)
* allow traversing the offset inits of table/memory segments (#916)Alon Zakai2017-02-171-2/+18
|
* fix a sign/unsigned compare compiler warningAlon Zakai2017-02-161-2/+2
|
* finish PickLoadSigns passAlon Zakai2017-02-162-8/+10
|
* refactor sign/zero extension code into nice headers, and prepare ↵Alon Zakai2017-02-167-97/+258
| | | | PickLoadSigns pass
* fix and clean up fallthrough logic in OptimizeInstructionsAlon Zakai (kripken)2017-02-161-22/+18
|
* optimize a compare of a load_s and a sign-extend into a load_u and a cheaper ↵Alon Zakai (kripken)2017-02-161-0/+18
| | | | zero-extend
* take into account loads into local info in OptimizeInstructionsAlon Zakai (kripken)2017-02-161-7/+10
|