summaryrefslogtreecommitdiff
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
...
* wasm2js: use scratch memory properly (#2033)Alon Zakai2019-04-222-3/+1
| | | | | | | This replaces all uses of __tempMemory__, the old scratch space location, with calls to function imports for scratch memory access. This lets us then implement those in a way that does not use the same heap as main memory. This avoids possible bugs with scratch memory overwriting something, or just in general that it has observable side effects, which can confuse fuzzing etc. The intrinsics are currently implemented in the glue. We could perhaps emit them inline instead (but that might limit asm.js optimizations, so I wanted to keep our options open for now - easy to change later). Also fixes some places where we used 0 as the scratch space address.
* wasm2js2 import fixes (#2031)Alon Zakai2019-04-191-0/+11
| | | | | | * Don't assume function types exist in legalize-js-interface. * Properly handle (ignore) imports in RemoveNonJSOps - do not try to recurse into them. * Run legalize-js-interface and remove-unused-module-elements in wasm2js, the first is necessary, the last is nice to have.
* Reland emitting of DataCount section (#2027)Thomas Lively2019-04-181-1/+1
| | | | | | This reverts commit cb2d63586c08a3dd194d2b733ceb3f5051c081f8. The issues with feature validation were mostly resolved in #1993, and this PR finishes the job by adding feature flags to wasm-as to avoid emitting the DataCount section when bulk-memory is not enabled.
* wasm2js2: more fuzzing improvements (#2028)Alon Zakai2019-04-182-48/+157
|
* Fuzz prep for wasm2js (#2022)Alon Zakai2019-04-172-2/+112
| | | Get fuzzing to a runnable state.
* Change default feature set to MVP (#1993)Thomas Lively2019-04-161-3/+3
| | | | | In the absence of the target features section or command line flags. When there are command line flags, it is an error if they do not exactly match the target features section, except if --detect-features has been provided. Also adds a --print-features pass to print the command line flags for all enabled options and uses it to make the feature tests more rigorous.
* Move features from passOptions to Module (#2001)Thomas Lively2019-04-121-7/+2
| | | | | This allows us to emit a (potentially modified) target features section and conditionally emit other sections such as the DataCount section based on the presence of features.
* Wasm2js memory fixes (#2003)Alon Zakai2019-04-123-33/+56
| | | | | | | | * I64ToI32Lowering - don't assume address 0 is a hardcoded location for scratch memory. Import __tempMemory__ for that. * RemoveNonJSOps - also use __tempMemory__. Oddly here the address was a hardcoded 1024 (perhaps where the rust program put a static global?). * Support imported ints in wasm2js, coercing them as needed. * Add "env" import support in the tests, since now we emit imports from there. * Make wasm2js tests split out multi-module tests using split_wast which is more robust and avoids emitting multiple outputs in one file (which makes no sense for ES6 modules)
* wasm2js: emscripten glue option (#2000)Alon Zakai2019-04-111-0/+4
| | | | | | Add a wasm2js option for the glue to be in emscripten-compatible format (as opposed to ES6). This does a few things so far: * Emit START_FUNCTIONS, END_FUNCTIONS markers in the code, for future use in the optimizer. * Emit the glue as a function to be called from emscripten.
* don't compare running before and after binaryen opts on non-binaryen vms if ↵Alon Zakai2019-04-101-5/+10
| | | | nans are allowed, as they are nondetermnistic (#1996)
* Handle relocatable code in AsmConstWalker (#1992)Sam Clegg2019-04-101-1/+2
| | | | | | In relocatable code the constant offset might be relative to __memory_base.
* Fuzz fixes (#1991)Alon Zakai2019-04-101-3/+15
| | | | | | | Get fuzzer to attempt to create almost all features. Pass v8 all the flags to allow that. Fix fuzz bugs where we read signed_ even when it was irrelevant for that type of load. Improve wasm-reduce on fuzz testcases, try to replace a node with drops of its children, not just the children themselves.
* Fuzz more carefully when using nans (#1956)Alon Zakai2019-04-031-4/+10
|\ | | | | They are nondeterministic between VMs, so disable VM comparisons in that case.
| * clenaupAlon Zakai2019-03-201-6/+0
| |
| * Merge remote-tracking branch 'origin/master' into nansAlon Zakai2019-03-202-1/+54
| |\
| * | don't compare vms if fuzzing nans, since they are nondeterministicAlon Zakai2019-03-111-4/+16
| | |
* | | wasm-emscripten-finalize: Improve shared library support (#1961)Sam Clegg2019-04-022-33/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert PIC code generated by llvm to work with the current emscripten ABI for dynamic linking: - Convert mutable global imports from GOT.mem and GOT.func into internal globals. - Initialize these globals on started up in g$foo and f$foo imported functions to calculate addresses at runtime. Also: - Add a test case for linking and finalizing a shared library - Allow __stack_pointer global to be non-existent as can be case for a shared library. - Allow __stack_pointer global to be an import, as can be the case for a shared library.
* | | Rename atomic wait/notify instructions (#1972)Heejin Ahn2019-03-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | This renames the following: - `i32.wait` -> `i32.atomic.wait` - `i64.wait` -> `i64.atomic.wait` - `wake` -> `atomic.notify` to match the spec.
* | | Warn about running gen-s-parser.py with Python 2 (#1971)Thomas Lively2019-03-291-0/+6
| | |
* | | Delete wasm-merge (#1969)Thomas Lively2019-03-291-1/+0
| | | | | | | | | It is not very useful.
* | | Improve test scripts (#1959)* Improve test scripts * feedback [skip ci]Sam Clegg2019-03-213-7/+73
| |/ |/| | | | | | | - Move auto_update_tests.py code into respective scripts - Use shared argument parsing in generate_lld_tests.py - Use wasm-ld rather than passing -flavor
* | Discover and run unit tests from check.py (#1948)Thomas Lively2019-03-191-0/+54
| | | | | | | | | | | | unittest is Python's standard testing framework, so this change allows arbitrary tests to be written without introducing any new dependencies or code in check.py. A new test that was not possible to write before is also included. It is the first of many.
* | wasm-emscripten-finalize: Remove JSCall thunk generation (#1938)Sam Clegg2019-03-121-1/+0
|/ | | | We now implement addFunction by creating a wasm module to wrap that JS function and simply adding it to the table.
* NaN fuzzing improvements (#1913)Alon Zakai2019-02-191-5/+7
| | | | | | | | | * make DE_NAN avoid creating nan literals in the first place * add a reducer option `--denan` to not introduce nans in destructive reduction * add a `Literal::isNaN()` method * also remove the default exception logging from the fuzzer js glue, which is a source of non-useful VM differences (like nan nondeterminism) * added an option `--no-fuzz-nans` to make it easy to avoid nans when fuzzing (without hacking the source and recompiling). Background: trying to get fuzzing on jsc working despite this open issue: https://bugs.webkit.org/show_bug.cgi?id=175691
* fix printing of unreachable atomics, and add print fuzzing (#1899)Alon Zakai2019-02-061-1/+2
|
* Bulk memory operations (#1892)Thomas Lively2019-02-051-0/+4
| | | | | | Bulk memory operations The only parts missing are the interpreter implementation and spec tests.
* Emscripten stack simplification (#1870)Alon Zakai2019-01-161-1/+1
| | | | | | This takes advantage of the recent memory simplification in emscripten, where JS static allocation is done at compile time. That means we know the stack's initial location at compile time, and can apply it. This is the binaryen side of that: * asm2wasm support for asm.js globals with an initial value var X = Y; where Y is not 0 (which is what the stack now is). * wasm-emscripten-finalize support for a flag --initial-stack-pointer=X, and remove the old code to import the stack's initial location.
* Compare binaryen fuzz-exec to JS VMs (#1856)Alon Zakai2019-01-101-72/+76
| | | | | | | | | | | The main fuzz_opt.py script compares JS VMs, and separately runs binaryen's fuzz-exec that compares the binaryen interpreter to itself (before and after opts). This PR lets us directly compare binaryen's interpreter output to JS VMs. This found a bunch of minor things we can do better on both sides, giving more fuzz coverage. To enable this, a bunch of tiny fixes were needed: * Add --fuzz-exec-before which is like --fuzz-exec but just runs the code before opts are run, instead of before and after. * Normalize double printing (so JS and C++ print comparable things). This includes negative zero in JS, which we never printed properly til now. * Various improvements to how we print fuzz-exec logging - remove unuseful things, and normalize the others across JS and C++. * Properly legalize the wasm when --emit-js-wrapper (i.e., we will run the code from JS), and use that in the JS wrapper code.
* Massive renaming (#1855)Thomas Lively2019-01-072-82/+82
| | | | | | Automated renaming according to https://github.com/WebAssembly/spec/issues/884#issuecomment-426433329.
* wasm-opt fuzz script improvements (#1851)Alon Zakai2019-01-031-19/+43
| | | | | | | * Allow fuzzing from other directories, by looking for wasm-opt relative to the script itself. * Ignore some VM debug assertions which are fuzz bugs that have already been filed. * Pick the random seed based on the process ID too, for better parallel fuzzing. * Remove commandline parsing stuff in fuzz_opt.py, which won't work with the other commandline parsing in test.shared - but we don't need it anyhow.
* Determinism fix for SSA pass (#1841)Alon Zakai2019-01-021-0/+4
| | | We iterated over a set. Instead, iterate over the relevant items in their order in the IR.
* SIMD (#1820)Thomas Lively2018-12-131-1/+142
| | | | | | | | | Implement and test the following functionality for SIMD. - Parsing and printing - Assembling and disassembling - Interpretation - C API - JS API
* Implement nontrapping float-to-int instructions (#1780)Thomas Lively2018-12-041-1/+10
|
* Check $NODE environment variable when looking for node (#1792)Sam Clegg2018-11-302-2/+3
| | | | This allows me to run tests on a system where the default installed node is not recent enough.
* Relooper CFG optimizations (#1759)Alon Zakai2018-11-211-44/+102
| | | | | | | | | | | | | | | | Previously the relooper would do some optimizations when deciding when to use an if vs a switch, how to group blocks, etc. This PR adds an additional pre-optimization phase with some basic but useful simplify-cfg style passes, * Skip empty blocks when they have just one exit. * Merge exiting branches when they are equivalent. * Canonicalize block contents to make such comparisons more useful. * Turn a trivial one-target switch into a simple branch. This can help in noticeable ways when running the rereloop pass, e.g. on LLVM wasm backend output. Also: * Binaryen C API changes to the relooper, which now gets a Module for its constructor. It needs it for the optimizations, as it may construct new nodes. * Many relooper-fuzzer improvements. * Clean up HashType usage.
* Reject all nonexistent instructions in sexp format (#1756)Thomas Lively2018-11-191-24/+11
|
* Generate sexp instruction parser (#1754)Thomas Lively2018-11-191-0/+408
| | | Also fix broken tests surfaced by the new parser.
* Add wasm-emscripten-finalize flag to separate data segments into a file (#1741)Derek Schuff2018-11-141-5/+11
| | | | This writes the data section into a file suitable for use with emscripten's --memory-init-file flag
* Support 4GB Memories (#1702)Alon Zakai2018-10-151-0/+2
| | | 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.
* Unify imported and non-imported things (#1678)Alon Zakai2018-09-191-3/+3
| | | | | | | | | | | | | | 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.
* Rename `wasm2asm` to `wasm2js`, emit ESM by default (#1642)Alex Crichton2018-08-305-40/+77
| | | | | | | | | | | | | | | | | | | | | | | | * Rename the `wasm2asm` tool to `wasm2js` This commit performs a relatively simple rename of the `wasm2asm` tool to `wasm2js`. The functionality of the tool doesn't change just yet but it's intended that we'll start generating an ES module instead of just an `asm.js` function soon. * wasm2js: Support `*.wasm` input files Previously `wasm2js` only supported `*.wast` files but to make it a bit easier to use in tooling pipelines this commit adds support for reading in a `*.wasm` file directly. Determining which parser to use depends on the input filename, where the binary parser is used with `*.wasm` files and the wast parser is used for all other files. * wasm2js: Emit ESM imports/exports by default This commit alters the default behavior of `wasm2js` to emit an ESM by default, either importing items from the environment or exporting. Items like initialization of memory are also handled here.
* Proper error handling in add* and get* methods (#1570)Alon Zakai2018-07-101-1/+1
| | | | | | | See #1479 (comment) Also a one-line readme update, remove an obsolete compiler (mir2wasm) and add a new one (asterius). Also improve warning and error reporting in binaryen.js - show a stack trace when relevant (instead of node.js process.exit), and avoid atexit warning spam in debug builds.
* Stop bundling binaryen.js builds (#1609)Alon Zakai2018-07-041-0/+1
| | | | | | | Instead, we point users to the bot @dcodeIO has, see #1571 This is useful because otherwise every change to binaryen.js requires bundling a build here, which is more work for contributors (and also grows the git repo over time). We still keep a bundled build of wasm.js. We use that for testing of the interpreter currently, and emscripten depends on it. Eventually wasm2asm may replace that. In any case, wasm.js builds are required far less frequently than binaryen.js.
* Remove s2wasm (#1607)Sam Clegg2018-06-282-136/+0
| | | | s2wasm is no longer used my emscripten and as far as I know now as no other users.
* Fix check.py on windows platform (#1605)Loppin Vincent2018-06-202-4/+5
| | | | Fix some file reading & endline issues on windows platform.
* Remove testing of s2wasm via the wasm waterfall scripts (#1604)Sam Clegg2018-06-191-66/+0
| | | | The wasm waterfall is moving away from testing with s2wasm and s2wasm hopefully going to be removed soon.
* Increase flake8 coverage (#1586)Sam Clegg2018-06-051-6/+2
|
* Cleanup scripts in scripts/test (#1566)Sam Clegg2018-05-2515-172/+208
| | | | | | | | | | Remove executable bit and #! from scripts that don't have entry point. Add missing licence test. Move arg parsing into a function. Remove legacy --only_prepare (with underscrore) argument.
* Fix embedwast.py for out-of-tree building (#1569)Sam Clegg2018-05-251-23/+37
|