summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* Rename `idx` to `index` in SIMD code for consistency (#1836)Thomas Lively2018-12-1817-159/+159
|
* Do not attempt to optimize v128s yet (#1834)Thomas Lively2018-12-181-12/+15
| | | Until the `Abstract` interface gains a notion of SIMD lanes, these optimizations will crash on v128 types.
* Partial legalization (#1824) review followup (#1832)Alon Zakai2018-12-174-6/+8
|
* Fix i64 select lowering. (#1773)Yury Delendik2018-12-171-8/+31
|
* Consistent spacing around the namespace keyword (#1829)Alon Zakai2018-12-153-0/+6
|
* Fuzzing v128 and associated bug fixes (#1827)Thomas Lively2018-12-1411-198/+362
| | | | * Fuzzing v128 and associated bug fixes
* wasm-emscripten-finalize: Delay function creation until after module walk ↵Sam Clegg2018-12-141-2/+11
| | | | | | | (#1828) This fixes a crash where startSave/stackRestore could be created while iterating through `module.functions`.
* Minimal JS legalization (#1824)Alon Zakai2018-12-147-52/+121
| | | | | Even when we don't want to fully legalize code for JS, we should still legalize things that only JS cares about. In particular, dynCall_* methods are used from JS to call into the wasm table, and if they exist they are only for JS, so we should only legalize them. The use case motivating this is that in dynamic linking you may want to disable legalization, so that wasm=>wasm module calls are fast even with i64s, but you do still need dynCalls to be legalized even in that case, otherwise an invoke with an i64 parameter would fail.
* wasm-emscripten-finalize: Add tableSize to metadata (#1826)Sam Clegg2018-12-141-0/+1
| | | | This allows emscripten to generate table of the correct size. Right now is simply defaults to creating a table to size 1024.
* wasm-emscripten-finalize: Don't add a table max if none is present in the ↵Sam Clegg2018-12-141-3/+6
| | | | | | input (#1825)
* SIMD (#1820)Thomas Lively2018-12-1334-1140/+5819
| | | | | | | | | Implement and test the following functionality for SIMD. - Parsing and printing - Assembling and disassembling - Interpretation - C API - JS API
* No exit runtime pass (#1816)Alon Zakai2018-12-137-5/+68
| | | When emscripten knows that the runtime will not be exited, it can tell codegen to not emit atexit() calls (since those callbacks will never be run). This saves both code size and startup time. In asm2wasm the JSBackend does it directly. For the wasm backend, this pass does the same on the output wasm.
* Don't error on too many locals - just oom (#1822)Alon Zakai2018-12-131-8/+0
| | | I think I added this error for fuzzing, but it is harmful as it prevents a module with too many locals from being loaded - if we could load it, we might be able to optimize it to have fewer locals...
* Create API for feature dependent picking in fuzzer (#1821)Thomas Lively2018-12-122-48/+69
|
* Update wrap and demote literal op names (#1817)Thomas Lively2018-12-123-22/+16
| | | | | | * Update literal op names * Remove `demoteToF32` in favor of `demote`
* wasm-emscripten-finalize: import env.STACKTOP, like asm2wasm doesAlon Zakai2018-12-113-5/+25
|
* wasm-ctor-eval: handle the stack going either up or downAlon Zakai2018-12-111-10/+15
|
* constant refactoring for STACKTOP and STACK_MAXAlon Zakai2018-12-113-8/+12
|
* Use template magic for tracing expressions (#1815)Thomas Lively2018-12-101-89/+106
|
* Fix comment in src/ir/module-utils.h (#1810)Sam Clegg2018-12-071-2/+4
| | | | | Followup from #1808
* wasm-emscripten-finalize: Fix type in JSON output (#1812)Sam Clegg2018-12-071-1/+1
|
* Wasm2js error handling improvement (#1807)Alon Zakai2018-12-061-22/+24
| | | Move the code around so the assertions are not caught in the big try-catch that reports errors as parsing errors.
* Handle missing function in renameFunctions (#1808)Sam Clegg2018-12-061-2/+6
| | | | | In this case simple update all the uses of the missing function. This fixed the current emscripten failures.
* Add function rename utility (#1805)Alon Zakai2018-12-052-21/+48
| | | And use it in wasm-emscripten
* Format metadata json using mutliple lines for readability (#1804)Sam Clegg2018-12-052-57/+63
|
* Fix initializerFunctions output by wasm-emscripten-finalize (#1803)Sam Clegg2018-12-051-1/+2
| | | I broke this to be alwasy empty in #1795.
* Properly optimize loop values (#1800)Alon Zakai2018-12-051-30/+42
| | | Remove the existing hack, and optimize them just like we do for ifs and blocks. This is now able to handle a few more cases than before.
* remove unnecessary constraint on remove-unused-br optimization of if-br-* ↵Alon Zakai2018-12-041-1/+1
| | | | into br_if,* - we can handle a concretely typed if as well, which can happen at the end of a block (#1799)
* Warn if linking section is present, as we cannot handle it yet (#1798)Alon Zakai2018-12-043-2/+5
|
* Implement nontrapping float-to-int instructions (#1780)Thomas Lively2018-12-0416-70/+434
|
* Run coalesce-locals after the final simplify-locals.Alon Zakai (kripken)2018-12-041-1/+4
| | | | | | We now emit more sets and tees of if-elses from simplify-locals, and coalesce-locals is necessary to remove them if they are ineffectual, that is, if no get will read them.
* Improve selectification in remove-unused-brsAlon Zakai (kripken)2018-12-041-19/+37
| | | | | | | | We turned an if into a select when optimizing for size (and if side effects etc. allow so). This patch improves that, doing it not just when optimizing for size, but also when it looks beneficial given the amount of work on both sides of the if. As a result we can create selects in -O3 etc.
* Speculate in simplify-locals that it is worth turning an if intoAlon Zakai (kripken)2018-12-042-29/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | an if-else. If an if sets a local, (if (..condition..) (set_local $x (..value..)) ) we can turn it into (set_local $x (if (..condition..) (..value..) (get_local $x) ) ) This increases code size and adds a branch in the if, but allows the set to be optimized into a tee or optimized out entirely. In the worst case, other optimizations can break up an if with a copy in one of its arms later. Includes a determinism fix for EquivalentSets, which this patch triggered.
* Move if copy logic from coalesce-locals to remove-unused-brs.Alon Zakai (kripken)2018-12-042-64/+128
| | | | | | | | | | | | | | | | | | | | | | | If copies is the case where an if arm is a get that feeds into a set of the same local: (set_local $x (if (result i32) (..condition..) (..result) (get_local $x) ) ) We can rework this so that the if-else is only an if, which executes the code path not going to the get. This was done in coalesce-locals only because it is likely to work there as after coalescing there are more copies. However, the logic is of removing a branch, and so belongs in remove-unused-brs, and fits alongside existing logic there for handling ifs with an arm that is a br. Also refactor that code so that the two optimizations can feed into each other.
* Feature options (#1797)Thomas Lively2018-12-0314-59/+154
| | | | Add feature flags and struct interface. Default feature set has all feature enabled.
* wasm-emscripten-finalize: ensure table/memory imports use emscripten's ↵Sam Clegg2018-12-031-8/+17
| | | | | | | | expected names (#1795) This means lld can emscripten can disagree about the naming of these imports and emscripten-wasm-finalize will take care of paper over the differences.
* Add --strip that removes debug info (#1787)Alon Zakai2018-12-037-0/+84
| | | | This is sort of like --strip on a native binary. The more specific use case for us is e.g. you link with a library that has -g in its CFLAGS, but you don't want debug info in your final executable (I hit this with poppler now). We can make emcc pass this to binaryen if emcc is not building an output with intended debug info.
* Use `= default` rather than {} for empty destructors (#1794)Sam Clegg2018-12-032-2/+2
|
* Add virtual destructor to fix build warning/error (#1793)Sam Clegg2018-11-301-0/+1
| | | | | | | | This error started showing up after: #1779 error: delete called on non-final 'wasm::ShellExternalInterface' that has virtual functions but non-virtual destructor
* wasm-emscripten-finalize: Remove stack pointer global from shared libs (#1791)Sam Clegg2018-11-303-14/+82
| | | | | | | | | | | | | The wasm backend uses a wasm global (__stack_pointer) for the shadow stack location. In order to make this work with shared libraries the main module would have to export this global and shared libraries would need to import it. This means we'd be relying of mutable globals which are not yet implemented in all browsers. This change allows is to move forward with shared libraries without mutable global support by replacing all stack pointer access in shared libraries with functions calls.
* Fuzzing: log values during execution (#1779)Alon Zakai2018-11-307-14/+65
| | | | | | | | Before we just looked at function return values when looking for differences before and after running some passes, while fuzzing. This adds logging of values during execution, which can represent control flow, monitor locals, etc., giving a lot more opportunities for the fuzzer to find problems. Also: * Clean up the sigToFunctionType function, which allocated a struct and returned it. This makes it safer by returning the struct by value, which is also easier to use in this PR. * Fix printing of imported function calls without a function type - turns out we always generate function types in loading, so we didn't notice this was broken, but this new fuzzer feature hit it.
* Add support for a mutable globals as a Feature (#1785)Sam Clegg2018-11-305-4/+17
| | | | | This picks up from #1644 and indeed borrows the test case from there.
* Cleanup shared constants (#1784)Sam Clegg2018-11-297-12/+10
|
* Add v128 type (#1777)Thomas Lively2018-11-2924-5/+84
|
* standardize on 'template<' over 'template <' (i.e., remove a space) (#1782)Alon Zakai2018-11-2917-32/+32
|
* LocalCSE fuzz fix: invalidate the set operations too (#1778)Alon Zakai2018-11-281-2/+23
| | | | | We invalidated based on effects of set values, but not of the sets themselves. Without that, a set could be overridden by something irrelevant and we thought we could still reuse the old value. Before this PR, the testcase would have the last set's value be optimized into a get, incorrectly.
* Start to implement #1764 (#1776)Alon Zakai2018-11-281-0/+34
| | | | | | This adds a first instance of the rules discussed in #1764 , specifically, x == y || x > y => x >= y
* Remove default cases (#1757)Thomas Lively2018-11-2727-107/+176
| | | | | | Where reasonable from a readability perspective, remove default cases in switches over types and instructions. This makes future feature additions easier by making the compiler complain about each location where new types and instructions are not yet handled.
* Stricter Canonicalization (#1774)Alon Zakai2018-11-271-18/+69
| | | In OptimizeInstructions we canonicalized a const on the right side. This PR adds further canonicalization, of a get to the right, and of sorting by binary and unary op ids. This guarantees fixed orders for small combinations of instructions that can then be pattern-matched in a simple way in future PRs.
* ReFinalize fuzz fix (#1771)Alon Zakai2018-11-274-125/+242
| | | | | | If we refinalize after adding a value that flows out of a block, we need to fix up any branches that might exist without a value, which is possible if the branches were not taken in practice Also refactor ReFinalize into a separate file.