summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Don't try to optimize away unused names in RemoveUnusedBrs (#1750)Alon Zakai2018-11-1516-248/+227
| | | | | Rely on the dedicated pass for that. It's not worth the extra complexity to try, as we can't easily handle all the cases anyhow. Add another run of the dedicated name-removing pass in the default passes.
* Avoid segfault when printing null nameThomas Lively2018-11-151-3/+3
| | | | `strpbrk` segfaults when `name.str` is nullptr, so check first.
* MergeBlocks: canonicalize loop exit block position on the inside (#1736)Alon Zakai2018-11-149-78/+127
| | | | * move a loop exit block (block with a name, and one child which is the loop) into the loop in MergeBlocks, as that is better for other passes
* Handle EM_ASM functions in Tables (#1739)Jacob Gravelle2018-11-143-7/+104
| | | | | Not at all sure why we're seeing any there, but it's easy enough to handle that we might as well.
* Restructure ifs with a value (#1743)Alon Zakai2018-11-143-20/+183
| | | We previously had code to recreate an if from a block+branch when possible, but not when the block had a return value. This PR adds support to restructure that too, into an if with a value.
* clean up unnecessary type setting in binary format loading - finalize() will ↵Alon Zakai2018-11-141-62/+61
| | | | do it properly later (#1744)
* ReFinalize fix (#1742)Alon Zakai2018-11-146-31/+114
| | | | | | | Handle a corner case in ReFinalize, which incrementally re-types code after changes. The problem is that if we need to figure out the type of a block, we look to the last element flowing out, or to breaks with values. If there is no such last element, and the breaks are not taken - they have unreachable values - then they don't tell us the block's proper type. We asserted that in such a case the block still had a type, and didn't handle this. To fix it, we could look on the parent to see what type would fit. However, it seem simpler to just remove untaken breaks/switches as part of ReFinalization - they carry no useful info anyhow. After removing them, if the block has no other signal of a concrete type, it can just be unreachable. This bug existed for at least 1.5 years - I didn't look back further. I think it was noticed by the fuzzer now due to recent fuzzing improvements and optimizer improvements, as I just saw this bug found a second time.
* Add wasm-emscripten-finalize flag to separate data segments into a file (#1741)Derek Schuff2018-11-147-5/+103
| | | | This writes the data section into a file suitable for use with emscripten's --memory-init-file flag
* Modernize relooper code (#1738)Alon Zakai2018-11-132-177/+176
| | | Use c++11 auto, iterators, etc.
* Fix alignment in MixedAllocator (#1740)Alon Zakai2018-11-133-21/+32
| | | Necessary for simd, as we add a type with alignment >8. We were just broken on that before this PR.
* Better fuzzing (#1735)Alon Zakai2018-11-133-1094/+967
| | | | | | * Recombine function pieces after randomly generating them, by creating copies and moving them around. This gives a realistic probability to seeing duplicate expressions, which some optimizations look for, which otherwise the fuzzer would have almost never reached. * Mutate function pieces after recombination, giving not only perfect duplicates but also near-duplicates. These operations take into account the type, but not the nesting and uniqueness of labels, so we fix that up afterwards (when something is broken, we replace it with something trivial).
* updated build (#1734)Alon Zakai2018-11-091-75/+81
|
* fix flipping in dataflow graph generation (#1732)Alon Zakai2018-11-084-115/+209
| | | For souper we need to flip some operations in DataFlow IR, since souper doesn't have any redundant ones. But we flipped not just left and right but also equal/not equal, which was wrong.
* Rename tableBase/memoryBase to __table_base/__memory_base (#1731)Sam Clegg2018-11-08155-422/+488
|
* Fix a merge-blocks fuzz bug (#1730)Alon Zakai2018-11-083-22/+152
| | | | | | | | | | | | | | | If a block has code after an unreachable element, it makes merging to an outer block tricky - the child block may be unreachable, but the parent have a return type, (block (result i32) .. (block (unreachable) (nop) ) ) It's ok to end an unreachable block with a nop, but not a typed one. To avoid this, if a child block has dce-able code, just ignore it.
* Fix a DataFlowOpts bug (#1729)Alon Zakai2018-11-074-8/+31
| | | | | | | We create some fake nodes for internal use, and were looking at one by mistake. This fixes that by * Creating a non-ambiguous fake node, a call (which represents an unknown value properly, unlike a zero which we had before). * Make DFO not rely on those values, if it knows a node is constant, apply those constant values. Found by the fuzzer.
* Fix a bug with (add (sub 0 X) Y) => (sub Y X) (#1727)Alon Zakai2018-11-075-3/+80
| | | | | We need to verify that the reordering is valid if there are side effects. Original bug report: https://groups.google.com/forum/?nomobile=true#!topic/emscripten-discuss/HIlGf8o2Ato
* wasm-ctor-eval: Hard error if requested ctor does not exist (#1728)Sam Clegg2018-11-061-1/+5
| | | | | Not being able to evaluate a ctor is different to that ctor being absent. This is masked a bug in emscripten where we were spelling the names of the ctors wrong on the command line.
* add support for new call_indirect syntax ; fixes #1724 (#1725)Alon Zakai2018-11-055-8/+98
|
* Suppress the 'has StackIR' comment when printing StackIR (#1726)Daniel Wirtz2018-11-047-59/+59
| | | Follow-up to #1717
* Fix asm2wasm handling of HEAP8[x >> 2] (#1720)Alon Zakai2018-11-028-10/+91
| | | | | | fixes kripken/emscripten#1718 The way fastcomp emits compareExchange is a little odd, we just need to ignore the shift.
* Don't call static desructors when Fatal() errors occur (#1722)Sam Clegg2018-11-022-3/+6
| | | | | This was causing a deadlock while destroying the thread pool.
* Add pass to minify import and export names (#1719)Alon Zakai2018-11-017-0/+15200
| | | | | | | | | This new pass minifies import and export names, for example, this may minify (import "env" "longname" (func $internal)) to (import "env" "a" (func $internal)) By updating the JS that provides those imports/calls those exports, we can use the minified names properly. This can save a useful amount of space in the wasm and JS, see kripken/emscripten#7414
* document that binaryen text is not valid wasm text, but stack IR is [ci ↵Alon Zakai2018-11-011-1/+4
| | | | skip] (#1716)
* Emit imports before defined things in text format (#1715)Alon Zakai2018-11-01188-260/+297
| | | | | That is the correct order in the text format, wabt errors otherwise. See AssemblyScript/assemblyscript#310
* Add Module#emitStackIR to the JS-API (#1717)Daniel Wirtz2018-10-313-0/+87
| | | Related to #1716 (comment)
* fix build on latest emscripten, where undefined symbols are now errors (#1714)Alon Zakai2018-10-301-2/+0
|
* Add missing include guard (#1713)Michał Janiszewski2018-10-291-0/+1
|
* Expand asmConsts metadata to fit the shape of proxying async EM_ASMs (no ↵Jacob Gravelle2018-10-252-1/+7
| | | | actual support) (#1711)
* Fix typo in README.mdSam Clegg2018-10-181-1/+1
|
* Cleanup formatting of README.md (#1708)Sam Clegg2018-10-191-54/+202
|
* comment on nondeterminism in precompute pass [ci skip] (#1704)Alon Zakai2018-10-161-0/+5
|
* Support 4GB Memories (#1702)Alon Zakai2018-10-1519-24/+67
| | | This fixes asm2wasm parsing of the max to allow 4GB, and also changes the internal Memory::kMaxValue values to reflect that. We used to use kMaxValue to also represent "no limit", so I split that out into kUnlimitedValue.
* properly handle unreachable atomic operations, fixes a regression from #1693 ↵Alon Zakai2018-10-111-2/+2
| | | | (#1696)
* update list of breaking changes [ci skip]Alon Zakai2018-10-111-3/+7
|
* Shared memory support for add memory import and set memory functions. (#1686)Nidin Vinayakan2018-10-1111-19/+26
|
* feat(ignore): add generated files to ignore (#1697)ashley williams2018-10-111-0/+6
|
* Add BinaryenRemoveGlobal / Module.removeGlobal to C/JS API (#1692)Daniel Wirtz2018-10-094-0/+15
|
* No atomic float operations (#1693)Alon Zakai2018-10-053-1109/+129
| | | | | SafeHeap was emitting them, but it looks like they are invalid according to the wasm-threads spec. Fixes kripken/emscripten#7208
* Add initial/maximum table size parameters to C/JS API (#1687)Daniel Wirtz2018-09-288-16/+18
|
* More #1678 fixes (#1685)Alon Zakai2018-09-2010-10/+115
| | | While debugging to fix the waterfall regressions I noticed that wasm-reduce regressed. We need to be more careful with visitFunction which now may visit an imported function - I found a few not-well-tested passes that also regressed that way.
* fix an iterator invalidation regression from #1678 (#1684)Alon Zakai2018-09-201-5/+24
| | | Fixes the 3 regressions mentioned in a comment on #1678
* Unify imported and non-imported things (#1678)Alon Zakai2018-09-19314-2534/+2141
| | | | | | | | | | | | | | Fixes #1649 This moves us to a single object for functions, which can be imported or nor, and likewise for globals (as a result, GetGlobals do not need to check if the global is imported or not, etc.). All imported things now inherit from Importable, which has the module and base of the import, and if they are set then it is an import. For convenient iteration, there are a few helpers like ModuleUtils::iterDefinedGlobals(wasm, [&](Global* global) { .. use global .. }); as often iteration only cares about imported or defined (non-imported) things.
* wasm-opt fuzz script (#1682) [ci skip]Alon Zakai2018-09-191-0/+226
| | | A small fuzz script I've been using locally. Runs wasm-opt on random inputs and random passes, looking for breakage or the passes changing something. Can also run VMs before and after the passes, and compare the VMs.
* Add debug information locations to the function prolog/epilog (#1674)Yury Delendik2018-09-1716-84/+233
| | | | | | | The current patch: * Preserves the debug locations from function prolog and epilog * Preserves the debug locations of the nested blocks
* fix sign detection of a floating-point mod ; fixes kripken/emscripten#7123 ↵Alon Zakai2018-09-158-31/+151
| | | | (#1681)
* Note that calls to imports are not lightweight in inlining pass (#1673)Alon Zakai2018-09-122-2581/+2542
| | | | * call_import is not lightweight for inlining purposes - we had call but not callimport, which is even less light
* Misc tiny fuzz fixes (#1668)Alon Zakai2018-09-1219-27/+20
| | | | | | | | | | | | * show a proper error for an empty asm2wasm input * handle end of input in processExpressions in binary reading * memory segment sizes should be unsigned * validate input in wasm-ctor-eval * update tests
* remove PageSize and HasFeature, which wasm removed a while back (#1667)Alon Zakai2018-09-129-34/+4
| | | From #1665 (a fuzz bug noticed they were not handled in stack.h).
* Fix parsing of memory attributes in s-expression parser (#1666)Alon Zakai2018-09-111-13/+21
| | | | | We need to check not to read past the length of the string. From #1665