summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* SIMD load and extend instructions (#2353)Thomas Lively2019-09-2429-376/+1136
| | | | | | Adds support for the new load and extend instructions. Also updates from C++11 to C++17 in order to use generic lambdas in the interpreter implementation.
* v128.andnot instruction (#2355)Thomas Lively2019-09-2425-770/+928
| | | | | As specified at https://github.com/WebAssembly/simd/pull/102. Also fixes bugs in the JS API for other SIMD bitwise operators.
* vNxM.load_splat instructions (#2350)Thomas Lively2019-09-2337-398/+1041
| | | | | | | Introduces a new instruction class, `SIMDLoad`. Implements encoding, decoding, parsing, printing, and interpretation of the load and splat instructions, including in the C and JS APIs. `v128.load` remains in the `Load` instruction class for now because the interpreter code expects a `Load` to be able to load any memory value type.
* Show the unescaped name in Asyncify pattern warnings (#2351)Alon Zakai2019-09-231-3/+5
| | | | | | | | | This is part of the fix for https://logs.chromium.org/logs/emscripten-releases/buildbucket/cr-buildbucket.appspot.com/8901492015302662960/+/steps/Emscripten_testsuite__upstream__other_/0/stdout Specifically it fixes that the name shown there should not be escaped. Followup for #2344
* wasm-emscripten-finalize: Add more checking of __data_end global (#2352)Sam Clegg2019-09-231-0/+3
|
* asyncify: support *-matching in whitelist and blacklist (#2344)Beuc2019-09-233-38/+82
| | | See emscripten-core/emscripten#9381 for rationale.
* Revert part of #2281 to allow the possiblity of building under python2 (#2349)Sam Clegg2019-09-231-1/+1
| | | | | | | | Even though we do support python3 and if the python in your path happens to be python3 that will work just fine, we also want to continue to support those users who still only have python2 (i.e. mac users who are relying on the default system python). See https://github.com/emscripten-core/emsdk/issues/356
* Mark C API as dllexports on Windows (#2342)Michal Strehovský2019-09-212-905/+1023
| | | | | On Windows, symbols have to be explicitly exported to make them visible/accessible in a shared library. Binaryen.dll currently doesn't export any symbols as a result. Marking all exported methods as `BINARYEN_API` that is defined as `__declspec(dllexport)` on Windows, unless building a static library.
* Fix typo in Asyncify (#2346)Beuc2019-09-191-2/+2
|
* Avoid fuzzing with multiple --flatten operations, which causes exponential ↵Alon Zakai2019-09-181-1/+6
| | | | overhead (#2345)
* Add a --standalone-wasm flag to wasm-emscripten-finalize (#2333)Alon Zakai2019-09-1810-1/+367
| | | The flag indicates that we want to run the wasm by itself, without JS support. In that case we don't emit JS dynCalls etc., and we also emit a wasi _start if there is a main, i.e., we try to use the current conventions in the wasm-only space.
* SIMD narrowing and widening operations (#2341)Thomas Lively2019-09-1428-1263/+2874
|
* SimplifyGlobals: Apply known constant values in linear traces (#2340)Alon Zakai2019-09-1312-67/+550
| | | | | | | | | | | | | This optimizes stuff like (global.set $x (i32.const 123)) (global.get $x) into (global.set $x (i32.const 123)) (i32.const 123) This doesn't help much with LLVM output as it's rare to use globals (except for the stack pointer, and that's already well optimized), but it may help on general wasm. It can also help with Asyncify that does use globals extensively.
* Add asserts in Asyncify (#2338)Alon Zakai2019-09-133-7/+316
| | | | | With the optional asserts, we throw if we see an unwind begin in code that we thought could never unwind (say, because the user incorrectly blacklisted it). Helps with emscripten-core/emscripten#9389
* Replace python command with python3 (#2281)Markus Koschany2019-09-132-2/+2
|
* Fix bitselect operation in C/JS APIs (#2336)Daniel Wirtz2019-09-114-3/+7
| | | In #2328 the SIMDBitselect API has been replaced with SIMDTernary that now has Bitselect as one of multiple operations, which is currently not exposed, unlike the new QFMA/QFMS operations which are exposed. This PR adds it.
* More response file support in asyncify: whitelist/blacklist (#2335)Alon Zakai2019-09-081-2/+10
|
* Properly handle fastcomp *wasm* safe heap (#2334)Alon Zakai2019-09-063-1/+1921
| | | | | Properly handle fastcomp wasm safe heap: emscripten_get_sbrk_ptr is an asm.js library function, which means it is inside the wasm after asm2wasm, and exported. Find it via the export.
* Handle sbrk import by emscripten+upstream in SafeHeap (#2332)Alon Zakai2019-09-061-10/+20
| | | | | To allow #2331 to roll, I forgot that upstream and fastcomp handle sbrk differently. This fixes that, and handles the upstream case where we import sbrk itself from JS. We can simplify this after emscripten-core/emscripten#9397 lands, however, it may also be nice to keep the backwards compatibility for running on existing wasm files in the wild.
* Print custom section contents if printable (#2326)Ingvar Stepanyan2019-09-062-1/+20
| | | This helps with debugging human-readable sections like sourceMappingURL.
* SafeHeap: Prepare for emscripten_get_sbrk_ptr (#2331)Alon Zakai2019-09-055-670/+4506
| | | | | | | Currently emscripten links the wasm, then links the JS, then computes the final static allocations and in particular the location of the sbrk ptr (i.e. the location in memory of the brk location). Emscripten then imports that into the asm.js or wasm as env.DYNAMICTOP_PTR. However, this didn't work in the wasm backend where we didn't have support for importing globals from JS, so we implement sbrk in JS. I am proposing that we change this model to allow us to write sbrk in C and compile it to wasm. To do so, that C code can import an extern C function, emscripten_get_sbrk_ptr(), which basically just returns that location. The PostEmscripten pass can even apply that value at compile time, so we avoid the function call, and end up in the optimal place, see #2325 and emscripten PRs will be opened once other stuff lands. However, the SafeHeap pass must be updated to handle this, or our CI will break in the middle. This PR fixes that, basically making it check if env.DYNAMICTOP_PTR exists, or if not then looking for env.emscripten_get_sbrk_ptr, so that it can handle both.
* [wasm2js] Fix memory.size (#2330)Alon Zakai2019-09-0520-53/+93
| | | | | | | We emitted the __wasm_memory_size function only when memory growth was enabled, but it can be used without that too. In theory we could only emit it if either memory growth or memory.size is used, but I think we can expect JS minifiers to do that later. Also fix a test suite bug - the check/auto_update script didn't run all the wasm2js tests when you run it with argument wasm2js (it used that as the list of tests, instead of the list of files, which confused me here for a while...).
* Add an option for the PostEmscripten pass to set the sbrk ptr location ↵Alon Zakai2019-09-043-2/+42
| | | | | | | (which is called DYNAMICTOP_PTR in emscripten) (#2325) The assumption is that an import env.emscripten_get_sbrk_ptr exists, and we replace the value returned from there with a constant. (We can't do all this in wasm-emscripten-finalize, as it happens before the JS compiler runs, which can add more static allocations; we only know where the sbrk ptr is later in compilation.) This just replaces the import with a function returning the constant; inlining etc. can help more later. By setting this at compile time we can reduce code size and avoid importing it at runtime, which makes us more compatible with wasi (less special imports).
* Wasi followups to #2323 (#2329)Alon Zakai2019-09-033-6/+3
| | | | | Remove wasi, as only wasi_unstable makes sense. Also remove shared constant for wasi as we don't know yet if it'll be needed later.
* QFMA/QFMS instructions (#2328)Thomas Lively2019-09-0333-450/+923
| | | | | | | | | Renames the SIMDBitselect class to SIMDTernary and adds the new {f32x4,f64x2}.qfm{a,s} ternary instructions. Because the SIMDBitselect class is no more, this is a backwards-incompatible change to the C interface. The new instructions are not yet used in the fuzzer because they are not yet implemented in V8. The corresponding LLVM commit is https://reviews.llvm.org/rL370556.
* Ignore .manifest files in check.py (#2324)Ingvar Stepanyan2019-09-031-1/+1
| | | | | These files are produced alongside .exe when CMake is used on Windows. Subsequently, check.py finds, tries to execute them and fails since they're not excluded.
* Add mutable parameter to global imports in C/JS API (#2317)Daniel Wirtz2019-09-038-8/+22
|
* Minify wasi imports and exports, and not just "env" (#2323)Alon Zakai2019-09-015-15/+32
| | | This makes the minification pass aware of "wasi_unstable" and "wasi" as well.
* Support response files, and use that in Asyncify (#2319)Alon Zakai2019-08-305-2/+48
| | | See emscripten-core/emscripten#9206, the asyncify names can need complex escaping, so this provides an escape hatch.
* Workaround for current breakage on master, avoid ASSERTIONS. See ↵Alon Zakai2019-08-301-1/+1
| | | | https://github.com/emscripten-core/emscripten/pull/9360 (#2320)
* Followup to workaround for minification of wasm2js mem init (#2318)Brion Vibber2019-08-3010-30/+30
| | | | | | | | | | | | | Emscripten's minifier mis-minifies a couple bits in the memory init function that's used with wasm2js when not using an external memory init file: https://github.com/emscripten-core/emscripten/issues/8886 Previous fix worked around the bug in one place but failed to account for another. Have now confirmed that it works with this change in place. Updated test cases to match.
* Temporarily build with -Wno-implicit-int-float-conversion (#2315)Sam Clegg2019-08-291-0/+4
| | | | | See #2314
* Update AppVeyor to Visual Studio 2017 (#2316)Derek Schuff2019-08-291-3/+6
| | | Also don't do duplicate builds.
* Add missing new features to the C and JS APIs (#2312)Daniel Wirtz2019-08-288-0/+20
|
* Allow all features on wasm2js and add atomic tests (#2311)Heejin Ahn2019-08-286-15/+113
| | | | | | This adds `-all` argument to wasm2js testing and fixes wasm2js to actually take that argument (currently it doesn't, when it takes a wast file). This also adds a wasm2js test for `atomic.fence` instruction that was added in #2307.
* Add atomic.fence instruction (#2307)Heejin Ahn2019-08-2745-817/+1558
| | | | | | | This adds `atomic.fence` instruction: https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md#fence-operator This also fix bugs in `atomic.wait` and `atomic.notify` instructions in binaryen.js and adds tests for them.
* Do not hoist truncation of wasm2js divisions (#2305)Thomas Lively2019-08-264-2/+91
| | | | | | It is not valid to defer the truncation of divisions because accumulated non-integral results can produce different values when they are combined before truncation. This was causing a test failure in the Rust test suite.
* Fix auto_update_tests.py after #2114 (#2306)Sam Clegg2019-08-262-41/+41
|
* Remove test output from source tree (#2114)Sam Clegg2019-08-218-27/+22
|
* Support --version argument in command line tools (#2304)Sam Clegg2019-08-204-7/+52
|
* Add initial support for anyref as an opaque type (#2294)Jay Phelps2019-08-2041-48/+279
| | | | | | | | | | | | | Another round of trying to push upstream things from my fork. This PR only adds support for anyref itself as an opaque type. It does NOT implement the full [reference types proposal](https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md)--so no table.get/set/grow/etc or ref.null, ref.func, etc. Figured it was easier to review and merge as we go, especially if I did something fundamentally wrong. *** I did put it under the `--enable-reference-types` flag as I imagine that even though this PR doesn't complete the full feature set, it probably is the right home. Lmk if not. I'll also be adding a few github comments to places I want to point out/question.
* Fix infinite loop in AsmConstWalker::visitCall (#2303)Guanzhong Chen2019-08-163-1/+32
|
* Remove code to handle EM_ASM and setjmp/longjmp (#2302)Guanzhong Chen2019-08-163-187/+53
| | | | | | | | | This reverts commit 12add6f17c377de7ac334e8fa7885b61b98f3db4 (#2283). This is done due to the complexity of supporting EM_ASM and setjmp/longjmp, especially with dynamic linking thrown into the mix. In https://reviews.llvm.org/D66356, using EM_ASM and setjmp/longjmp in the same function is now an error.
* Switch python indentation from 2-space to 4-space (#2299)Sam Clegg2019-08-1627-2794/+2792
| | | | | | | | pep8 specifies 4 space indentation. The use of 2 spaces is, I believe a historical anomaly where certain large organizations such as google chose 2 over 4 and have yet to make the switch. Since there isn't too much code in binaryen today it seems reasonable to make the switch.
* wasm2js: Fix switch lowering, don't fall through after the hoisted parts (#2301)Alon Zakai2019-08-168-38/+137
| | | | | The switch lowering will "hoist" blocks of code into the JS switch when it can. If it can hoist some but not others, it must not fall through into those others (while it can fall through the hoisted ones - they began as nested blocks with falling-through between them). To fix this, after the hoisted ones issue a break out of the switch (which now contains all the hoisted code, so breaking out of it gets to the code right after the hoisted ones). fixes #2300
* Upgrade flake8 and run it on python 3 (#2297)Guanzhong Chen2019-08-1310-53/+60
|
* Add basic exception handling support (#2282)Heejin Ahn2019-08-1352-850/+5548
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds basic support for exception handling instructions, according to the spec: https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md This PR includes support for: - Binary reading/writing - Wast reading/writing - Stack IR - Validation - binaryen.js + C API - Few IR routines: branch-utils, type-updating, etc - Few passes: just enough to make `wasm-opt -O` pass - Tests This PR does not include support for many optimization passes, fuzzer, or interpreter. They will be follow-up PRs. Try-catch construct is modeled in Binaryen IR in a similar manner to that of if-else: each of try body and catch body will contain a block, which can be omitted if there is only a single instruction. This block will not be emitted in wast or binary, as in if-else. As in if-else, `class Try` contains two expressions each for try body and catch body, and `catch` is not modeled as an instruction. `exnref` value pushed by `catch` is get by `pop` instruction. `br_on_exn` is special: it returns different types of values when taken and not taken. We make `exnref`, the type `br_on_exn` pushes if not taken, as `br_on_exn`'s type.
* Add missing copy in Copier::visitPush (#2295)Heejin Ahn2019-08-111-1/+3
| | | It seems this was missing in #2289.
* Followups to #2292, code cleanups for opt-utils.h (#2293)Alon Zakai2019-08-091-24/+18
|
* Support empty export names in wasm2js and JS mangling in general (#2290)Alon Zakai2019-08-094-0/+81
|