summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix #2430 properly (#2449)Alon Zakai2019-11-181-10/+10
|
* Document wasm-reduce in the readme (#2445)Alon Zakai2019-11-181-0/+6
|
* Warning improvements (#2438)Alon Zakai2019-11-154-5/+36
| | | | | | | | If wasm-opt is run with no passes, warn, as we've gotten reports that people assume a tool called "wasm-opt" should optimize automatically (but we follow llvm's opt convention of not doing so). Add a --quiet (-q) flag that suppresses this minor warning, and the other minor warning where there is no output file.
* Add a few more things to the instruction checklist (#2437)Heejin Ahn2019-11-131-2/+3
|
* Reuse BINARYEN_API for Emscripten builds (#2435)Daniel Wirtz2019-11-133-892/+106
| | | | | | | | | | | | This is an alternative to #2361 in that it only implements reusing BINARYEN_API so we don't have to list all the functions in build-js.sh. Differs in that it keeps the sh file relatively straight forward without going overboard with bash functionality. Also adds various quotes in case of whitespace in paths and makes it so that *.sh files always use LF line endings to ease Windows support. For instance, I am pulling the repository in Windows but compile in WSL, which, if Git isn't properly configured to check out line endings as-is, would otherwise break the sh files. Fixes #2361.
* [NFC] Make Type a class instead of enum (#2433)Thomas Lively2019-11-132-14/+52
| | | | | | | | | The plan is to extend `Type` to represent arbitrary multivalue types, and as a prerequisite for that it is necessary to make it a class instead of an enum. This PR bends over backwards to add all the automatic conversions and constants necessary to allow the rest of the code to compile unmodified, but in the future it should be possible to standardize usage across the code base and remove some of these utilities.
* uint32_t instead of int64_t as return type for GetMemorySegmentByteOffset ↵COFFEETALES2019-11-124-22/+21
| | | | | (#2432) `uint32_t` instead of `int64_t` as return type for `GetMemorySegmentByteOffset` and minor fixes on tests.
* Cast to bool after bitwise operations, to avoid an MSVC warning (#2431)Alon Zakai2019-11-121-10/+12
| | | | Fixes #2430
* Support --pass-arg in ToolOptions. (#2429)Alon Zakai2019-11-114-17/+19
| | | | | | This will allow us to pass pass args to wasm-emscripten-finalize, which runs legalize-js-interface internally, which recently added an optional argument.
* When legalizing, optionally export the original function too with orig$X (#2427)Alon Zakai2019-11-113-1/+62
| | | | | The original is necessary if we want to pass it to wasm, where it will be called directly, without JS legalization. For example the JS dynamic loader in emscripten needs this, emscripten-core/emscripten#9562
* Fix catch parsing (#2428)Heejin Ahn2019-11-118-41/+79
| | | | | | | - When a catch body is a block, call its `finalize` function with the correct type - Don't create a block when there's one instruction in a catch body - Remove `makeCatch` from gen-s-parser.py; it's not necessary - Fix a test case that has a `catch` without `try`
* Add Stack IR optimization support for EH (#2425)Heejin Ahn2019-11-073-3/+7
|
* Improve type selection in fuzzer (#2424)Heejin Ahn2019-11-065-1163/+1805
| | | | | | | | | - Adds `items` function for `FeatureOptions` so we can get a vector of eligible types - Replaces hardcoded enumeration of MVP types with `getConcreteTypes`, which also adds v128 type to the list if SIMD is enabled - Removes `getType()` function; this does not seem to be used anywhere - Renames `vectorPick` with `pick` - Use the absolute path for d8 in the fuzzer
* Don't attempt to de-duplicate asm consts (#2422)Sam Clegg2019-11-046-23/+21
| | | | | | | | | | | | Since we switched the using memory addresses for asm const indexes and stopping trying to modify the code we can no loner de-duplicate the asm const strings here. If we want to de-duplicate in the strings in emscripten we could do that but it seems like a marginal benefit. This fixes the test_html5_gamepad failures which is currently showing up on the emscripten waterfall.
* Add i32x4.dot_i16x8_s (#2420)Thomas Lively2019-11-0427-709/+845
| | | | | This experimental instruction is specified in https://github.com/WebAssembly/simd/pull/127 and is being implemented to enable further investigation of its performance impact.
* OptimizeInstructions: Eq64 of 0 => Eqz64 (#2421)Alon Zakai2019-11-044-7/+42
| | | Fixes #2417
* Fix PostWalker traversal of push instruction (#2419)Heejin Ahn2019-11-043-0/+23
| | | PostWalker traversal should visit its value.
* Add SIMD integer min and max instructions (#2416)Thomas Lively2019-11-0128-839/+2429
| | | As proposed in https://github.com/WebAssembly/simd/pull/27.
* Add EH support for DCE pass (#2415)Heejin Ahn2019-11-014-1/+110
| | | | Like an `If`, `Try` construct is reachable when either its try body or catch body is reachable. This adds support for that.
* Don't remove events used in instructions (#2412)Heejin Ahn2019-11-013-8/+60
| | | | | Previously RemoveUnusedModuleElements pass only preserved exported events and did not preserve events used in `throw` and `br_on_exn` instructions. This fixes it.
* Use absolute memory addresses for emasm string indexes. (#2408)Sam Clegg2019-10-316-54/+76
| | | | | | | | | | Before we used 0-based indexes which meant that we needed to modify the code calling the emasm function to replace the first argument. Now we use the string address itself as the index/code for the emasm constant. This allows use code to go unmodifed as the emscripten side will accept the memory address as the index/code. See: https://github.com/emscripten-core/emscripten/issues/9013
* Do not precompute SIMDLoad (#2409)Thomas Lively2019-10-304-1/+17
| | | This fixes a crash when programs containing load_splats are optimized.
* Fix BinaryenModuleAllocateAndWriteText parameter type (#2406)Irmen de Jong2019-10-282-3/+2
| | | This fixes a compiler error when trying to compile code calling this function with a C++ compiler.
* When renaming functions ensure the corresponding GOT.func entry is also ↵Sam Clegg2019-10-256-3/+383
| | | | | | renamed (#2382) Fixes https://github.com/WebAssembly/binaryen/issues/2180
* Upgrade the build container for linux releases (#2405)Alex Crichton2019-10-253-6/+6
| | | | | | | | This is a continued effort to try and track down #2273 which came up again and is still present in the current release binaries. Issues like crystal-lang/crystal#4276 may indicate that C++ exceptions are just somewhat broken with static linking when using alpine, but I've at least locally been able to verify that upgrading the container produces working binaries which previously segfaulted on some wasm files.
* Add ModAsyncify* passes (#2404)Alon Zakai2019-10-2311-1/+1483
| | | | | | | | | | | | | | | | | | | | | | | | | | | | These passes are meant to be run after Asyncify has been run, they modify the output. We can assume that we will always unwind if we reach an import, or that we will never unwind, etc. This is meant to help with lazy code loading, that is, the ability for an initially-downloaded wasm to not contain all the code, and if code not present there is called, we download all the rest and continue with that. That could work something like this: * The wasm is created. It contains calls to a special import for lazy code loading. * Asyncify is run on it. * The initially downloaded wasm is created by running --mod-asyncify-always-and-only-unwind: if the special import for lazy code loading is called, we will definitely unwind, and we won't rewind in this binary. * The lazily downloaded wasm is created by running --mod-asyncify-never-unwind: we will rewind into this binary, but no longer need support for unwinding. (Optionally, there could also be a third wasm, which has not had Asyncify run on it, and which we'd swap to for max speed.) These --mod-asyncify passes allow the optimizer to do a lot of work, especially for the initially downloaded wasm if we have lots of calls to the lazy code loading import. In that case the optimizer will see that those calls unwind, which means the code after them is not reached, potentially making lots of code dead and removable.
* Convert usage of Pointer_stringify to UTF8ToString (#2403)Brad Morris2019-10-233-1/+5
| | | | This fixes #2396. This converts the use of the old Pointer_stringify to the new UTF8ToString. Added a js test in kitchen-sink.js to cover this.
* Fix incorrect assert in BinaryenHostGetOperand (#2393)Brad Morris2019-10-223-1/+13
|
* Ability to list each item on Exports/Data Segments/Functions (#2386)COFFEETALES2019-10-218-1/+329
| | | Adds functionality to the C API for getting the number of items in a module and fetching them out by index.
* Move WASM_DEPRECATED so that binaryen-c.h is selfcontained. Fixes #2054 (#2399)Irmen de Jong2019-10-212-4/+7
|
* Fix autoreducing when not in the binaryen directory (#2390)Alon Zakai2019-10-173-9/+37
| | | | This uses argv[0] as the default way to find the location of the wasm binaries (wasm-reduce needs to call wasm-opt).
* Add --out-dir to allow setting the test output dir. (#2389)Alon Zakai2019-10-172-6/+13
| | | This allows fuzzing in parallel invocations.
* Use early return in wasm-opt.cpp. NFC (#2387)Sam Clegg2019-10-151-22/+23
|
* Don't add __wasm_call_ctors to startup function list in wasm standalone mode ↵Sam Clegg2019-10-141-2/+6
| | | | | (#2384) In this mode crt1 takes care of calling it.
* Add BinaryenAddCustomSection API (#2381)Daniel Wirtz2019-10-116-0/+86
| | | | This adds a new BinaryenAddCustomSection API so a generator can add arbitrary custom sections to a module.
* Add offset parameter to BinaryenSetFunctionTable (#2380)Daniel Wirtz2019-10-119-18/+63
| | | | | | This PR adds an offset parameter to BinaryenSetFunctionTable so table elements can start at the value of an (imported constant) global. Previously, the offset was fixed to zero. As usual this is a breaking change to the C-API but backwards compatible when using the JS-API.
* Enable exnref instrumentation when EH is enabled (#2379)Heejin Ahn2019-10-112-2/+4
| | | | `exnref` is enabled by not reference type feature but exception handling feature. Sorry that I missed this in #2377.
* Don't instrument pops in InstrumentLocals (#2378)Heejin Ahn2019-10-103-13/+46
| | | | | `pop` is not a real instruction and automatically generated when reading binary and deleted when writing binary, so this does not work with instrumentation.
* Only add instrumentation to reftypes when the featureset supports it (#2377)Jacob Gravelle2019-10-102-6/+9
|
* Add support for reftypes in InstrumentLocals pass (#2375)Heejin Ahn2019-10-104-14/+116
| | | This adds support for anyref and exnref types in InstrumentLocals pass.
* Add push/pop support for anyref (#2376)Heejin Ahn2019-10-1010-58/+168
| | | | This adds push/pop support for anyref. This also adds missing C API tests for push/pop.
* Make try body with multiple instructions roundtrip (#2374)Heejin Ahn2019-10-098-4/+77
| | | | | | | | | Previously we didn't print an additional block when there are multiple instructions within a `try` body, so those wast files cannot be parsed correctly, because the wast parser assumes there are two bodies within a `try` scope: a try body and a catch body. We don't need to print an additional block for a `catch` body because `(catch ...)` itself serves as a scope.
* Fix case of `windows.h` include (#2372)Mike J Innes2019-10-091-1/+1
| | | | The capitalisation causes issues on case-sensitive file systems, for example when cross-compiling binaryen for windows.
* MAIN_THREAD_EM_ASM support (#2367)Jacob Gravelle2019-10-073-71/+579
| | | | | | | | | | | | * Support for sync and async main-thread EM_ASM * Fix up import names as well * update test * fix whitespace * clang-format
* v8x16.swizzle (#2368)Thomas Lively2019-10-0327-506/+653
| | | | As specified at https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#swizzling-using-variable-indices.
* Apply the sbrk/brk value at compile time (#2366)Alon Zakai2019-09-304-2/+133
| | | | | We've had an option to set the location of the sbrk ptr, but not the value. Applying the value as well is necessary for standalone wasm, as otherwise we set it in JS.
* Add feature flags and validation to wasm-metadce (#2364)Thomas Lively2019-09-276-6/+30
| | | | | | Sometimes wasm-metadce is the last tool to run over a binary in Emscripten, and in that case it needs to know what features are enabled in order to emit a valid binary. For example it needs to know whether to emit a data count section.
* Only create `_start` if it doesn't already exist (#2363)Sam Clegg2019-09-273-0/+106
|
* Revert to C++14 in build-js.sh (#2360)Thomas Lively2019-09-261-1/+1
|
* Move back to C++14 (#2358)Thomas Lively2019-09-251-12/+12
| | | | | | Since the waterfall's CMake was too old to target C++17 and many LTS systems may not yet support C++17. Also updates the minimum required CMake version to one that mentions the CXX_STANDARD variable in its docs.