summaryrefslogtreecommitdiff
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* wasm2asm: Finish i64 lowering operations (#1563)Alex Crichton2018-05-251-0/+31
| | | | | | | | | | | | | | | | | * wasm2asm: Finish i64 lowering operations This commit finishes out lowering i64 operations to JS with implementations of division and remainder for JS. The primary change here is to have these compiled from Rust to wasm and then have them "linked in" via intrinsics. The `RemoveNonJSOps` pass has been updated to include some of what `I64ToI32Lowering` was previously doing, basically replacing some instructions with calls to intrinsics. The intrinsics are now all tracked in one location. Hopefully the intrinsics don't need to be regenerated too much, but for posterity the source currently [lives in a gist][gist], although I suspect that gist won't continue to compile and work as-is for all of time. [gist]: https://gist.github.com/alexcrichton/e7ea67bcdd17ce4b6254e66f77165690
* Clean up wasm2asm testing (#1546)Alon Zakai2018-05-131-5/+5
| | | | | * Move wasm2asm test outputs into their natural location, test/wasm2asm/ * Let people create new tests in there that ./auto_update_tests.py will auto-generate outputs for, just like all the other tests.
* include the filename in erroneous diff output where possible (#1452)Nathan Froyd2018-03-195-31/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Failing test cases often start out with: ``` incorrect output, diff: --- expected +++ actual ``` which makes it difficult to figure out where the expected output might live. That information can be derived from examining the tests, of course, but it'd be much nicer if it were provided in the diff to see straightaway. We do this by introducing a new check, one which takes a filename of expected output, which then enables us to display the failing file, e.g.: ``` incorrect output, diff: --- /home/froydnj/src/binaryen.git/test/passes/code-folding.txt +++ actual ``` which is arguably nicer. Having this new check also enables reducing some boilerplate `open(...).read()` calls in various places. There are still a few places using `fail_if_not_identical`, usually because `.strip()` is used on the expected output.
* use jsvu to get spidermonkey (#1443)Alon Zakai2018-03-161-1/+1
| | | jsvu is an easy way to get JS VMs. This uses it to get SpiderMonkey, which is then used to check asm.js validation in the wasm2asm tests.
* wasm2asm fixes (#1436)Alon Zakai2018-02-201-8/+10
| | | | | | * don't look for asm.js compilation message if almost asm * fix wasm2asm f32 operations
* adjust test scripts to cope with out-of-tree builds (#1420)Nathan Froyd2018-02-141-11/+15
| | | | | | Many places assume that test/blah is valid, but that's only valid if you're executing scripts from the binaryen source directory. The binaryen_test option is more general, and enables out-of-tree testing, so that's what we should be using instead.
* Fix flake8 (#1426)Jacob Gravelle2018-02-141-1/+0
|
* Fold wasm-link-metadata into wasm-emscripten-finalize (#1408)Jacob Gravelle2018-02-143-70/+39
| | | | | | | * wasm-link-metadata: Use `__data_end` symbol. * Add --global-base param to emscripten-wasm-finalize to compute staticBump properly * Let ModuleWriter write to a provided Output object