summaryrefslogtreecommitdiff
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
...
* Handle passive segments in wasm-emscripten-finalize (#2217)Thomas Lively2019-07-111-3/+11
|
* Fix FuzzExec fuzzer, which forgot to run the opts (#2215) [ci skip]Alon Zakai2019-07-111-1/+1
|
* Ignore --initial-stack-pointer arg to wasm-emscripten-finalize (#2201)Sam Clegg2019-07-101-1/+1
| | | | | | | | | | | | | We were passing bad value in --initial-stack-pointer which did not include the STATIC_BUMP (since STATIC_BUMP is determinted by the output of finalize). If emscripten wants to set the stack pointer position it can do so by calling the stackRestore() function at startup. This argument will be removed completely once we stop passing it on the emscripten side. See https://github.com/emscripten-core/emscripten/issues/8905
* Support wasm files without exported memory in scripts/fuzz_shell.js (#2210)Alon Zakai2019-07-091-1/+3
|
* update fuzzer to use all features that pass fuzzing in all modes (which is ↵Alon Zakai2019-07-081-5/+10
| | | | currently just sign-ext...) (#2200)
* Initial tail call implementation (#2197)Thomas Lively2019-07-031-2/+4
| | | | | | | | | | | Including parsing, printing, assembling, disassembling. TODO: - interpreting - effects - finalization and typing - fuzzing - JS/C API
* Use v8 to test wasm binaries are valid in test suite binary checks (#2206)Alon Zakai2019-07-033-15/+68
|
* Minimal Push/Pop support (#2207)Alon Zakai2019-07-031-0/+5
| | | | | | | This is the first stage of adding support for stacky/multivaluey things. It adds new push/pop instructions, and so far just shows that they can be read and written, and that the optimizer doesn't do anything immediately wrong on them. No fuzzer support, since there isn't a "correct" way to use these yet. The current test shows some "incorrect" usages of them, which is nice to see that we can parse/emit them, but we should replace them with proper usages of push/pop once we actually have those (see comments in the tests). This should be enough to unblock exceptions (which needs a pop in try-catches). It is also a step towards multivalue (I added some docs about that), but most of multivalue is left to be done.
* Bysyncify: Fuzzing (#2192)Alon Zakai2019-07-012-17/+264
| | | | | | | | Gets fuzzing support for Bysyncify working. * Add the python to run the fuzzing on bysyncify. * Add a JS script to load and run a testcase with bysyncify support. The code has all the runtime support for sleep/resume etc., which it does on calls to imports at random in a deterministic manner. * Export memory from fuzzer so JS can access it. * Fix tiny builder bug with makeExport.
* Refactor python fuzz script (#2182)Alon Zakai2019-06-251-73/+134
| | | Create a class for handling the current fuzz testcase, and implement subclasses for the various fuzz things we do. This disentangles a lot of code.
* Split binaryenjs tests out from main check.py script (#2163)Sam Clegg2019-06-062-1/+77
|
* Show line/col for parsing exceptions in gen-s-parser (#2138)Heejin Ahn2019-05-241-1/+1
|
* Reflect instruction renaming in code (#2128)Heejin Ahn2019-05-212-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Reflected new renamed instruction names in code and tests: - `get_local` -> `local.get` - `set_local` -> `local.set` - `tee_local` -> `local.tee` - `get_global` -> `global.get` - `set_global` -> `global.set` - `current_memory` -> `memory.size` - `grow_memory` -> `memory.grow` - Removed APIs related to old instruction names in Binaryen.js and added APIs with new names if they are missing. - Renamed `typedef SortedVector LocalSet` to `SetsOfLocals` to prevent name clashes. - Resolved several TODO renaming items in wasm-binary.h: - `TableSwitch` -> `BrTable` - `I32ConvertI64` -> `I32WrapI64` - `I64STruncI32` -> `I64SExtendI32` - `I64UTruncI32` -> `I64UExtendI32` - `F32ConvertF64` -> `F32DemoteI64` - `F64ConvertF32` -> `F64PromoteF32` - Renamed `BinaryenGetFeatures` and `BinaryenSetFeatures` to `BinaryenModuleGetFeatures` and `BinaryenModuleSetFeatures` for consistency.
* Add a fuzzer option to not emit code with OOB loads/indirect calls (#2113)Alon Zakai2019-05-171-2/+14
| | | | | This is useful for wasm2js, as we don't emit traps for OOB loads etc. like wasm (like we don't trap on bad float-to-int, as it's too hard in JS, and it's undefined behavior in C anyhow). It may also help general fuzzing, as those traps may make other interesting patterns less likely. Also add more wasm2js support in the fuzzer, which includes using this no-OOB option.
* First stage of cleeanup in source tree pollution (#2105)Sam Clegg2019-05-161-5/+4
| | | | | | | | | | | Update build-js.sh to output to `out` directory. This is district from the `bin` directory which is used by the cmake build and may or may not live in the source tree. The `out` directory currently always lives in the source tree. As a followup change I hope to additionally move all test outout into this tree. See #2104
* wasm2js: remove unnecessary labels (#2108)Alon Zakai2019-05-151-9/+6
|
* wasm2js: optimize away unneeded load coercions (#2107)Alon Zakai2019-05-151-6/+9
|
* Make sexp instruction parser pass clang-tidy (#2088)Heejin Ahn2019-05-061-1/+1
| | | | | | Our current clang-tidy setting requires {} after ifs. Unlike clang-format, I couldn't find any directives or options that allow us to exclude the generated inc file from clang-tidy. Anyway adding a pair of braces is all it takes to make it pass.
* wasm2js: run full optimizations during the pipeline (#2071)Alon Zakai2019-04-301-70/+80
| | | | | We flatten for the i64 lowering etc. passes, and it is worth optimizing afterwards, to clean up stuff they created. That is run if the user ran wasm2js with an optimization level (like wasm2js -O3). Split the test files to check both optimized and unoptimized code.
* Add clang-format-diff hook (#2057)Heejin Ahn2019-04-261-0/+6
| | | | | | | This adds a commit hook to Travis CI that errors out if incoming PRs' diffs are not clang-formatted. Turns out clang-format is also capable of formatting JavaScript, but we haven't agreed on a style for JS yet, this PR disables JavaScript formatting for now. This also adds clang-format exempt header/footer to a generated source file.
* wasm2js2: optimize call_indirect and select operands (#2056)Alon Zakai2019-04-251-0/+3
| | | Don't use temp vars to reorder them unless we need to.
* wasm2js: support non-constant indexes for memory and table segments (#2055)Alon Zakai2019-04-251-0/+2
| | | Mostly what we need for dynamic linking, at least on the binaryen side.
* wasm2js: start to optionally optimize the JS (#2046)Alon Zakai2019-04-241-2/+2
| | | Removes redundant | 0s and similar things. (Apparently closure compiler doesn't do that, so makes sense to do here.)
* wasm2js: avoid non-ES5 stuff like "let" (#2041)Alon Zakai2019-04-231-10/+16
| | | Also fix the fuzzer's handling of feature flags so that wasm2js can work.
* Finish bulk memory support (#2030)Thomas Lively2019-04-221-7/+7
| | | | | | | Implement interpretation of remaining bulk memory ops, add bulk memory spec tests with light modifications, fix bugs preventing the fuzzer from running correctly with bulk memory, and fix bugs found by the fuzzer.
* wasm2js: unreachability fixes (#2037)Alon Zakai2019-04-222-1/+17
| | | Also test in pass-debug mode, for better coverage.
* 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