summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Handle multivalue returns in the interpreter (#2684)Thomas Lively2020-03-1013-104/+179
| | | | Updates the interpreter to properly flow vectors of values, including at function boundaries. Adds a small spec test for multivalue return.
* Use emcmake on CI (#2686)Alon Zakai2020-03-101-1/+1
| | | | Switch to emcmake from emconfigure, which emscripten has made a requirement meanwhile.
* Add a non-const iterator to SmallVector (#2685)Thomas Lively2020-03-101-15/+22
| | | Using CRTP, yay!
* Add 'warning:' to names section warning. Helps #2680 (#2683)Alon Zakai2020-03-091-1/+1
|
* Asyncify: Fix wasm-only instrumentation of unnamed imports (#2682)Alon Zakai2020-03-053-29/+54
| | | | | | | | | | | | | We assumed that the imports were already named (in their internal name) properly. When processing a binary file without names, or if the names don't match in general, that's not true. To fix this, use ModuleUtils::renameFunctions to do a proper renaming up front. Also fix renameFunctions to not assert on the case of renaming a function to the same name it already has. Helps #2680
* Initial multivalue support (#2675)Thomas Lively2020-03-0534-194/+1910
| | | | | | | | | Implements parsing and emitting of tuple creation and extraction and tuple-typed control flow for both the text and binary formats. TODO: - Extend Precompute/interpreter to handle tuple values - C and JS API support/testing - Figure out how to lower in stack IR - Fuzzing
* Update build instructions in README (#2667)Thomas Lively2020-03-051-4/+6
|
* DWARF: Ignore a compile unit with no abbreviations (#2678)Alon Zakai2020-03-045-1/+7
| | | | | | | | | | Such a module can't have valid DIEs, since we have no way to interpret them. Also check if DWARF sections from LLVM have contents - when they are empty the section may exist but have a null for its data. Fixes #2673
* Expose asyncify state via a getter (#2679)Alon Zakai2020-03-0413-4/+86
| | | | | | | | | | Normally, a wrapper has to track state separately to know when to unwind/rewind and when to actually call import functions. Exposing Asyncify state can help avoid this duplication and avoid subtle bugs when internal and wrapper state get out of sync. Since this is a tiny function and it's useful for any Asyncify embedder, I've decided to expose it by default rather than hide behind an option.
* Improve a comment on unreachability [ci skip] (#2672)Alon Zakai2020-03-031-2/+13
|
* Simplify binary block parsing (#2674)Thomas Lively2020-02-282-37/+24
|
* Generalize binary writing for tuples (#2670)Thomas Lively2020-02-272-91/+26
| | | | | | | | | Updates `BinaryInstWriter::mapLocalsAndEmitHeader` so it no longer hardcodes each possible local type. Also adds a new inner loop over the elements of any local tuple type in the IR. Updates the map from IR local indices to binary indices to be additionally keyed on the index within a tuple type. Since we do not generate tuple types yet, this additional index is hardcoded to zero everywhere it is used for now. A later PR adding tuple creation operations will extend this functionality and add tests.
* On OpenBSD (6.6) libc++ fileno is defined as a MACRO which doesn't work with ↵osen2020-02-271-1/+1
| | | | :: (#2669)
* Add multivalue feature (#2668)Thomas Lively2020-02-2713-36/+36
|
* Add EH support for CodeFolding (#2665)Heejin Ahn2020-02-264-0/+160
| | | | | | | | | | | This does two things: - Treats the target branch of `br_on_exn` as unoptimizables, because it is a conditional branch. - Makes sure we don't move expressions that contain `exnref.pop`, which should follow right after `catch`. - Adds `containsChild` utility function, which can search all children, optionally with limited depth. This was actually added to be used in CodeFolding but ended up not being used, but wasn't removed in case there will be uses later.
* Fix to https://github.com/WebAssembly/binaryen/issues/2170 (#2654)juj2020-02-251-0/+6
| | | | | | | | * Fix to https://github.com/WebAssembly/binaryen/issues/2170 * Adjust fix * clang-format
* Version 91 (#2642)Sam Clegg2020-02-212-1/+4
|
* Add AutoDrop support for Try (#2663)Heejin Ahn2020-02-202-0/+17
| | | | | This adds AutoDrop (+ ReFinalize) support for Try. We don't have `--autodrop` option so I can't add a separate test for this, but this is basically the same as what If does.
* Add the GetFunctionTable JS API (#2554)COFFEETALES2020-02-207-35/+156
|
* Add br_on_exn support for UniqueNameMapper (#2659)Heejin Ahn2020-02-193-4/+68
| | | | This adds support for UniqueNameMapper, and adds a test in Inlining pass, which uses UniqueNameMapper.
* Code pushing support for br_on_exn (#2660)Heejin Ahn2020-02-196-2/+38
| | | | | | | | | Like `br_if`, `br_on_exn` is a conditional branch and across which code can be pushed past when conditions are satisfied. Also adds a few lines of comments and NFC changes in a couple places. Changes in Vacuum are NFC because they were being handled in `default:` in the same way anyway, but I added them to be more explicit and consistent with existing code.
* Concise error output (#2652)Alon Zakai2020-02-185-32/+59
| | | | | | | | | | | Don't print the entire module on an error. Instead, just print the validation errors. However, if the user passed --print, then do print it, as otherwise nothing would get printed - the error would be before the pass to print happens. And in general a user passing in a request to print would expect a printed module anyhow. fixes #2634
* DWARF: Fix debug_range handling of invalid entries (#2662)Alon Zakai2020-02-186-20/+729
| | | | | | | | | | | | | | If an invalid entry appears - either it began as such, or became invalid after optimization - we should not emit (0, 0) which is an end marker. Instead, emit an invalid entry marker, something with (0, x) for x != 0. As a bonus, if a test/passes case has "noprint" in the name, don't print the wasm, which we do by default. In the testcase here for example we just care about the dwarf, and the printed module would be quite large. Thank you to @paolosevMSFT for identifying and suggesting the fix.
* Fix Ninja build on Travis archive configurations (#2658)Heejin Ahn2020-02-131-2/+3
| | | | On archive configs, cmake does not generate build.ninja but we try to use it. This is currently causing failures on Travis builds for commits.
* Add C-/JS-APIs for inlining options (#2655)Daniel Wirtz2020-02-135-0/+145
| | | | | | | | | | Allows a user to modify the inlining limits using the C- and JS-APIs. * binaryen.**getAlwaysInlineMaxSize**(): `number` * binaryen.**setAlwaysInlineMaxSize**(size: `number`): `void` * binaryen.**getFlexibleInlineMaxSize**(): `number` * binaryen.**setFlexibleInlineMaxSize**(size: `number`): `void` * binaryen.**getOneCallerInlineMaxSize**(): `number` * binaryen.**setOneCallerInlineMaxSize**(size: `number`): `void`
* Fix clang-tidy in Travis (#2656)Heejin Ahn2020-02-122-3/+5
| | | | | | | | - Run cmake before clang-tidy. clang-tidy requires the build database file `compile_commands.json`, which is created by cmake. - Change the error message for clang-tidy. Unlike clang-format, clang-tidy does not show diff to apply; it only prints error messages. Fixes #2653.
* Update node-esm-loader to work with latest node LTS (#2657)Daniel Wirtz2020-02-121-22/+29
| | | An attempt to fix the node-esm-loader related [issues](https://travis-ci.org/WebAssembly/binaryen/jobs/649056649#L22931) seen on CI currently, apparently due to CI automatically picking up a newer node LTS (12.16.0 released 2020/02/11) where the API changed.
* Convert remaining python scripts to run under python3 (#2643)Sam Clegg2020-02-1114-14/+17
|
* Fix missing newline after // EMSCRIPTEN_START_FUNCS and // ↵juj2020-02-107-14/+27
| | | | | | | | | | EMSCRIPTEN_END_FUNCS markers. (#2626) * Fix missing newline after // EMSCRIPTEN_START_FUNCS and // EMSCRIPTEN_END_FUNCS markers. * Flake * Update tests
* Optimize base64 decoding (#2623)juj2020-02-099-172/+208
| | | | | | | | | | | | | | * Optimize base64 decoding (about 7x-10x faster and temporary garbage-free compared to the original version) * new Uint8Array * Reuse Uint8Array view * Fix end handling * Code format * Update tests
* Switch to using ninja on travis (except on OSX) (#2645)Sam Clegg2020-02-071-7/+7
|
* Optimize Try in Vacuum (#2644)Heejin Ahn2020-02-073-0/+63
| | | | If try's body does not throw, the whole try-catch can be replaced with the try body.
* Add C-/JS-APIs for lowMemoryUnused and pass arguments (#2639)Daniel Wirtz2020-02-077-3/+270
| | | | | | | | | Allows a user to enable/disable the `lowMemoryUnused` option and to get/set/clear arbitrary pass arguments when using the C- or JS-APIs. * binaryen.**getLowMemoryUnused**(): `boolean` * binaryen.**setLowMemoryUnused**(on: `boolean`): `void` * binaryen.**getPassArgument**(key: `string`): `string | null` * binaryen.**setPassArgument**(key: `string`, value: `string | null`): `void` * binaryen.**clearPassArguments**(): `void`
* Properly order the actual and exepcted outputs in fail() and ↵Alon Zakai2020-02-071-1/+1
| | | | fail_if_not_identical_to_file() (#2649)
* Use .appveyor.yml rather than appveyor.yml (#2648)Sam Clegg2020-02-071-0/+0
| | | The convention is that these CI files are hidden by default.
* Cleanup travis configuration (#2641)Sam Clegg2020-02-071-35/+52
| | | | | | | | | - explicitly name each job so its clear in the UI. - split flake8 and other linkers into thier own job rather than doing these things N times. - rename the `build` phase to `archive` since build could mean any number of things (normally it means that thing you do before testing not after). - combine the gcc test with the out-of-tree test
* DWARF: Disable optimization passes not fully compatible with DWARF yet (#2640)Alon Zakai2020-02-062-1534/+2538
| | | | | | | | | | | Anything that merges/swaps/etc. locals, or inlines, or merges functions, must be disabled for now. However, that does still leave almost all passes, so this should not affect output sizes much (and the full LLVM optimizer can be run before too). Over time we can resolve each of those FIXMEs. The test output here shows how disabling those allows over twice as much debug_line info to be preserved.
* Fix LocalCSE's usable local selection (#2638)Heejin Ahn2020-02-054-27/+67
| | | | | | | | | | | | | | | | Now that we have subtypes, we cannot reuse any local that contains the same expression, because that local's type can be a supertype. For example: ``` (local $0 anyref) (local $1 nullref) ... (local.set $0 (ref.null)) (local.set $1 (ref.null)) ;; cannot be replaced with (local.get $0) ``` This extends `usables` map's key to contain both `HashedExpression` and the local's type, so we can get the right usable local in presence of subtypes.
* Add EH support for OptimizeInstructions (#2608)Heejin Ahn2020-02-059-55/+309
| | | | | | - Adds support for `Try` in `optimizeBoolean` function - Adds support for `Try` in `getFallThrough` function - Adds approximate cost values for instructions in EH and reference types proposals.
* Avoid an infinite loop in `-ttf` generation (#2637)Alex Crichton2020-02-041-1/+1
| | | | | | | | | | | | | | | We've been throwing some fuzzing at some wasm implementations recently and one of our strategies is to use `wasm-opt -ttf` with the fuzzer's input to generate a wasm module. Some of our tests, though, have been failing due to out-of-memory while `wasm-opt` is generating a module. This loop appears to be infinitely executing since the input just-so-happens that `oneIn(3)` returns true for every byte of the input file, or at least enough such that when the xor factor is merged in it at least generates very long sequence of `true`. It looks like elsewhere in the file when `while (oneIn(N))` is used it's also guarded by `!finishedInput`, so I've added a similar guard here as well.
* Trap when call_indirect's signatures mismatch (#2636)Heejin Ahn2020-02-039-3/+66
| | | | | | | | | | | This makes the interpreter trap when the signature in `call_indirect` instruction and that of the actual function in the table mismatch. This also makes the `wasm-ctor-eval` not evaluate `call_indirect` in case the signatures mismatch. Before we only compared the arguments' signature and the function signature, which was sufficient before we had subtypes, but now the signature in `call_indirect` and that of the actual function can be different even if the argument's signature is OK.
* Add EH support for EffectAnalyzer (#2631)Heejin Ahn2020-02-0328-237/+4125
| | | | | | | | | | | | | | | | | | | | This adds EH support to `EffectAnalyzer`. Before `throw` and `rethrow` conservatively set property. Now `EffectAnalyzer` has a new property `throws` to represent an expression that can throw, and expression that can throw sets `throws` correctly. When EH is enabled, any calls can throw too, so we cannot reorder them with another expression with any side effects, meaning all calls should be treated in the same way as branches when evaluating `invalidate`. This prevents many reorderings, so this patch sets `throws` for calls only when the exception handling features is enabled. This is also why I passed `--disable-exception-handling` to `wasm2js` tests. Most of code changes outside of `EffectAnalyzer` class was made in order to pass `FeatureSet` to it. `throws` isn't always set whenever an expression contains a throwable instruction. When an throwable instruction is within an inner try, it will be caught by the corresponding inner catch, so it does not set `throws`.
* Fix for cmake 3.10 (eg on Ubuntu LTS) (#2632)Brion Vibber2020-01-303-3/+3
| | | | | | | | | CMAKE_PROJECT_VERSION is only predefined on cmake 3.12 and later, so the previous code produced an empty version number which leads to parsing errors when emcc checks the version. Use of the older PROJECT_VERSION variable as the source of the original version works here, as there's only one toplevel project defined.
* DWARF: Fix debug_abbrev section (#2630)Alon Zakai2020-01-287-14/+75
| | | | | | | | | Each compilation unit's abbreviations must be terminated by a zero, so that we use the right abbreviations. This adds that support to the YAML layer, both adding the zeros and parsing them to look in the right abbreviation section at the right time. Also add two large testcases, zlib and cubescript, which crash without this and the last PR.
* DWARF: Update DW_AT_stmt_list which are offsets into the debug_line section ↵Alon Zakai2020-01-283-23/+77
| | | | | | | | (#2628) The debug_line section is the only one in which we change sizes and so must update offsets. It turns out that there are such offsets, DW_AT_stmt_list, so without updating them we can't handle multi-unit dwarf files.
* Optionally minify imported module names (#2620)Alon Zakai2020-01-275-8/+74
| | | | | | | | | | | | | | | | This replaces imports like env.foo with a.foo, which can save a bunch of bytes when there are many imported functions. Note that by changing all the import names to a it ends up requiring a single merged import module. Note also that when doing this we modify all the imports, minifying their modules and names (since it makes no sense to be careful about minifying only modules known to us - env/wasi - if we are minifyin the names of all modules). This will require an emscripten PR to benefit from it.
* Fix warning (treated as error) when building with Emscripten (#2605)Daniel Wirtz2020-01-272-2/+3
|
* DWARF: Fix emitting of DW_FORM_sdata (#2627)Alon Zakai2020-01-272-1/+19
|
* DWARF: Properly emit signed 32 bit values for advance_line (#2625)Alon Zakai2020-01-245-2334/+2337
| | | | | | | | | The LLVM SData field is 64-bit (to support 64-bit addresses I suppose) so when we assigned to it we actually led it to emit an LEB for a signed 64-bit value that is an unsigned 32-bit one. This worked in LLVM (where I guess it forces the value to 32-bit anyhow?) but failed in gimli (where I guess it doesn't?).
* Reland "Fix renaming in FixInvokeFunctionNamesWalker (#2513)" (#2622)Sam Clegg2020-01-248-72/+462
| | | | | This reverts commit 132daae1e9154782bb1afa5df80dfe7ea35f0369. This change is the same as before but the fix in #2619 should now make it safe.