summaryrefslogtreecommitdiff
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
* Run spec test all at once after binary transform (#3817)Abbas Mashayekh2021-04-202-2/+1
| | | | | | | | | | | | | | | | | | #3792 added support for module linking and (register command to wasm-shell, but forgot about three problems: - Splitting spec tests prevents linking test modules together. - Registered modules may still be used in assertions or an invoke - Modules may re-export imported objects This PR appends transformed modules after binary checks to a spec.wast file, plus assertion tests and register commands. Then runs wasm-shell on the whole file. It also keeps both the module name and its registered name available in wasm-shell for use in shell commands and linked modules. Furthermore, it correctly finds the module where an object is defined even if it is imported and re-exported several times. The updated version of imports.wast spec test is enabled to verify the fixes.
* Fuzzer: Do not fuzz multivalue testcases in initial contents (#3809)Alon Zakai2021-04-151-0/+21
| | | | | | | | | | There is a conflict between multivalue and GC, see the details in the comment. There isn't a good way to get the fuzzer to avoid the combination of them, and GC is more urgent, so disable multivalue in that area for now. (This does not disable all multivalue fuzzing - the fuzzer can still emit stuff. This just disables initial content from test suite having multivalue, which is enough for now, until the fuzzer can emit more GC things, and then we'll need to do more.)
* Fuzzer: Distinguish traps from host limitations (#3801)Alon Zakai2021-04-121-1/+7
| | | | | | | | | Host limitations are arbitrary and can be modified by optimizations, so ignore them. For example, if the optimizer removes allocations then a host limit on an allocation error may vanish. Or, an optimization that removes recursion and replaces it with a loop may avoid a host limit on call depth (that is not done currently, but might some day). This removes a class of annoying false positives in the fuzzer.
* Rename SIMD extending load instructions (#3798)Daniel Wirtz2021-04-121-6/+6
| | | | | | | | | Renames the SIMD instructions * LoadExtSVec8x8ToVecI16x8 -> Load8x8SVec128 * LoadExtUVec8x8ToVecI16x8 -> Load8x8UVec128 * LoadExtSVec16x4ToVecI32x4 -> Load16x4SVec128 * LoadExtUVec16x4ToVecI32x4 -> Load16x4UVec128 * LoadExtSVec32x2ToVecI64x2 -> Load32x2SVec128 * LoadExtUVec32x2ToVecI64x2 -> Load32x2UVec128
* Rename various SIMD load instructions (#3795)Daniel Wirtz2021-04-111-6/+6
| | | | | | | | | Renames the SIMD instructions * LoadSplatVec8x16 -> Load8SplatVec128 * LoadSplatVec16x8 -> Load16SplatVec128 * LoadSplatVec32x4 -> Load32SplatVec128 * LoadSplatVec64x2 -> Load64SplatVec128 * Load32Zero -> Load32ZeroVec128 * Load64Zero -> Load64ZeroVec128
* [Wasm GC] Enable more GC fuzzing (#3788)Alon Zakai2021-04-081-6/+7
| | | | | | The fuzzer doesn't generate much GC code yet, but it does fuzz things in the test suite and adds fuzz to them. This PR allows GC when using initial content, and also in CompareVMs, both of which have been fuzzed for days locally for me with no issues.
* Fuzz --converge (#3789)Alon Zakai2021-04-081-0/+3
|
* Add v128.load/storeN_lane SIMD instructions to C/JS API (#3784)Daniel Wirtz2021-04-081-8/+8
| | | | | | | | | | | Adds C/JS APIs for the SIMD instructions * Load8LaneVec128 (was LoadLaneVec8x16) * Load16LaneVec128 (was LoadLaneVec16x8) * Load32LaneVec128 (was LoadLaneVec32x4) * Load64LaneVec128 (was LoadLaneVec64x2) * Store8LaneVec128 (was StoreLaneVec8x16) * Store16LaneVec128 (was StoreLaneVec16x8) * Store32LaneVec128 (was StoreLaneVec32x4) * Store64LaneVec128 (was StoreLaneVec64x2)
* Fuzzer: Ignore our current bug with the type of br_if (#3775)Alon Zakai2021-04-061-1/+6
| | | | | | We give br_if a too specific type: #3767 This is only noticeable with GC, and in rare cases where the type of br_if is actually used - which realistically it never is, so really just fuzzer testcases.
* Update SIMD names and opcodes (#3771)Thomas Lively2021-04-051-55/+42
| | | | Also removes experimental SIMD instructions that were not included in the final spec proposal.
* Disallow flatten + GC in the fuzzer due to RTTs (#3768)Alon Zakai2021-04-011-0/+3
| | | RTTs are not defaultable, and we cannot spill them to locals.
* Avoid flatten + multivalue + reference types in the fuzzer (#3760)Alon Zakai2021-03-311-0/+3
| | | | | | | | | The problem is that a tuple with a non-nullable element cannot be stored to a local. We'd need to split up the tuple, but that raises questions about what should be allowed in flat IR (we'd need to allow nested tuple ops in more places). That combination doesn't seem urgent, so add a clear error for now, and avoid it in the fuzzer. Avoids #3759 in the fuzzer
* Allow clang-format-diff/clang-tidy-diff to take branch as argument (#3711)Sam Clegg2021-03-222-11/+8
| | | | | Also update clang-format-diff.sh to match recent changes to branch name and CI system (these changes mirror those already made to clang-tidy-diff.sh).
* Add `-o pipefail` to shell scripts (#3706)Sam Clegg2021-03-193-1/+4
| | | | This means that if any command in a pipelines fails the whole pipeline will also fail.
* Regenerate lld tests (#3684)Sam Clegg2021-03-121-0/+2
| | | | | | | | | | | This change as automatically generated by: $ ./scripts/test/generate_lld_tests.py $ ./auto_update_tests.py --binaryen-bin=../binaryen-out/bin lld The changes here are mostly due to: - llvm now emits names for globals and segments - emscripten now packs EM_ASM consts into a single contiguous segment
* Stop emitting features section in fuzzer (#3652)Alon Zakai2021-03-041-1/+1
|
* Make the reduction script more robust, and document text reduction (#3640)Alon Zakai2021-03-031-5/+17
| | | | | The check for a valid wasm file must be different if the wasm has a feature section or not, so just try both ways, with --detect-features and --all-features. If the wasm is valid, at least one will work.
* Update clang-tidy-diff.sh for GH Actions (#3619)Thomas Lively2021-02-261-10/+3
|
* Update V8 feature flags for the fuzzer (#3569)Heejin Ahn2021-02-181-3/+3
| | | | | | This removes feature flags that are now included in `--wasm-staging` and adds new experimental flags. Does not change the fuzzer's behavior at the moment because the fuzzer does not seem to be currently enabled for GC or typed funcref yet.
* Add feature options to wasm-dis (#3548)Abbas Mashayekh2021-02-082-2/+2
| | | | | | This will allow .fromBinary tests be executed with the desired featurs so there will be no difference between those tests and .from-wast tests. Fixes #3545
* Prototype i32x4.widen_i8x16_{s,u} (#3535)Thomas Lively2021-02-011-0/+2
| | | | | | | | As proposed in https://github.com/WebAssembly/simd/pull/395. Note that the other instructions in the proposal have not been implemented in LLVM or in V8, so there is no need to implement them in Binaryen right now either. This PR introduces a new expression class for the new instructions because they uniquely take an immediate argument identifying which portion of the input vector to widen.
* [GC] br_on_null (#3528)Alon Zakai2021-02-011-0/+1
| | | | | | | | | | | This is only partial support, as br_on_null also has an extra optional value in the spec. Implementing that is cumbersome in binaryen, and there is ongoing spec discussions about it (see https://github.com/WebAssembly/function-references/issues/45 ), so for now we only support the simple case without the default value. Also fix prefixed opcodes to be LEBs in RefAs, which was noticed here as the change here made it noticeable whether the values were int8 or LEBs.
* [GC] ref.as_non_null (#3527)Alon Zakai2021-01-281-0/+1
| | | | | | This is different than the other RefAs variants in that it is part of the typed functions proposal, and not GC. But it is part of GC prototype 3. Note: This is not useful to us yet as we don't support non-nullable types.
* [GC] Add br_on_func/data/i31 (#3525)Alon Zakai2021-01-281-1/+4
| | | | | | | | This expands the existing BrOnCast into BrOn that can also handle the func/data/i31 variants. This is not as elegant as RefIs / RefAs in that BrOnCast has an extra rtt field, but I think it is still the best option. We already have optional fields on Break (the value and condition), so making rtt optional is not odd. And it allows us to share all the behavior of br_on_* which aside from the cast or the check itself, is identical - returning the value if the branch is not taken, etc.
* Remove test suite's assumption of minify_check roundtripping perfectly (#3524)Alon Zakai2021-01-271-13/+2
| | | | | | | | | | | | minify_check checks that we can print and read minified wast. The test also, however, assumed that we round-trip such things perfectly. That's never been true, and only by chance did this go unnoticed until now, in #3523 The specific issue happening there is that we create a block without a name. Then we write that as text, then read it. When we read it, we give all such blocks a name (and we rely on optimizations to remove it later when possible - this avoids optimizing in the parser). The extra name looks like a bug to minify_check.
* [GC] ref.as_* (#3520)Alon Zakai2021-01-271-0/+3
| | | | | | | | These are similar to is, but instead of returning an i32 answer, they trap on an invalid value, and return it otherwise. These could in theory be in a single RefDoThing, with opcodes for both As and Is, but as the return values are different, that would be a little odd, and the name would be less clear.
* [GC] ref.is_func/data/i31 (#3519)Alon Zakai2021-01-261-2/+5
|
* [GC] RefIsNull => RefIs. (#3516)Alon Zakai2021-01-261-1/+1
| | | | | | | | This internal refactoring prepares us for ref.is_func/data/i31, by renaming the node and adding an "op" field. For now that field must always be "Null" which means it is a ref.is_null. This adjusts the C API to match the new IR shape. The high-level JS API is unchanged.
* Warn when running a pass not compatible with DWARF (#3506)Alon Zakai2021-01-261-1/+2
| | | | | | | | | | | | Previously the addDefault* methods would avoid adding opt passes that we know are incompatible with DWARF. However, that didn't handle the case of passes that are added in other ways. For example, when running Asyncify, emcc will run --flatten before, and that pass is not compatible with DWARF. This PR lets us warn on that by annotating the passes themselves. Then we use those annotation to either not run a pass at all (matching the previous behavior) or to show a warning when necessary. Fixes emscripten-core/emscripten#13288 . That is, concretely after this PR running asyncify + DWARF will show a warning to the user.
* Remove exnref and br_on_exn (#3505)Heejin Ahn2021-01-222-9/+0
| | | This removes `exnref` type and `br_on_exn` instruction.
* Introduce a script for updating lit tests (#3503)Thomas Lively2021-01-213-5/+186
| | | | And demonstrate its capabilities by porting all tests of the optimize-instructions pass to use lit and FileCheck.
* Prototype additional f64x2 conversions (#3501)Thomas Lively2021-01-191-0/+7
| | | | As proposed in https://github.com/WebAssembly/simd/pull/383, with opcodes coordinated with the WIP V8 prototype.
* Replace "master" with "main" in scripts and docs (#3502)Thomas Lively2021-01-192-2/+2
| | | | We have updated the default branch name from "master" to "main." This PR updates scripts, configurations, and docs to reflect this change.
* Prototype prefetch instructions (#3467)Thomas Lively2021-01-061-0/+3
| | | | As proposed in https://github.com/WebAssembly/simd/pull/352, using the opcodes used in the LLVM and V8 implementations.
* Prototype SIMD extending pairwise add instructions (#3466)Thomas Lively2021-01-051-2/+4
| | | | | | As proposed in https://github.com/WebAssembly/simd/pull/380, using the opcodes used in LLVM and V8. Since these opcodes overlap with the opcodes of i64x2.all_true and i64x2.any_true, which have long since been removed from the SIMD proposal, this PR also removes those instructions.
* When looking for node binary, search for 'node' before 'nodejs' (#3164)Sam Clegg2020-12-301-1/+1
| | | | | | | `node` is he name used by the upstream project. `nodejs` is a legacy name used on older debian/ubunru systems. Searching for `nodejs` first meant it was finding my local (old) `nodejs` package even those I have a more recent `node` in my $PATH.
* Fixed wasm-emscripten-finalize AsmConstWalker not handling 64-bit pointers ↵Wouter van Oortmerssen2020-12-142-4/+16
| | | | | (#3431) Also improved the LLD test scripts to accomodate 64-bit tests.
* Prototype SIMD instructions implemented in LLVM (#3440)Thomas Lively2020-12-111-0/+10
| | | | | | - i64x2.eq (https://github.com/WebAssembly/simd/pull/381) - i64x2 widens (https://github.com/WebAssembly/simd/pull/290) - i64x2.bitmask (https://github.com/WebAssembly/simd/pull/368) - signselect ops (https://github.com/WebAssembly/simd/pull/124)
* Improve lit support (#3426)Sam Clegg2020-12-091-3/+14
| | | | | | | | This uses the same technique used in llvm-lit to enable running on in-tree tests with out-of-tree builds. So you can run something like this: ../binaryen-out/bin/binaryen-lit test/lit/
* [GC] Add basic RTT support (#3432)Alon Zakai2020-12-081-0/+2
| | | | | | | | | | | | | | | | This adds rtt.canon and rtt.sub together with RTT type support that is necessary for them. Together this lets us test roundtripping the instructions and types. Also fixes a missing traversal over globals in collectHeapTypes, which the example from the GC docs requires, as the RTTs are in globals there. This does not yet add full interpreter support and other things. It disables initial contents on GC in the fuzzer, to avoid the fuzzer breaking. Renames the binary ID for exnref, which is being removed from the spec, and which overlaps with the binary ID for rtt.
* [Fuzzer] Use liftoff when running d8, to avoid nondeterminism (#3402)Alon Zakai2020-12-011-5/+18
| | | | | | | When running d8, run it in liftoff, to avoid tiering up causing nondeterminism in the results. When we do want to compare the tiers, we already do so in CompareVMs. This fixes others places where we just wanted to run some JS in some VM.
* [TypedFunctionReferences] Enable call_ref in fuzzer, and fix minor misc fuzz ↵Alon Zakai2020-11-252-2/+14
| | | | | | | | | | | | | | | | | | | | bugs (#3401) * Count signatures in tuple locals. * Count nested signature types (confirming @aheejin was right, that was missing). * Inlining was using the wrong type. * OptimizeInstructions should return -1 for unhandled types, not error. * The fuzzer should check for ref types as well, not just typed function references, similar to what GC does. * The fuzzer now creates a function if it has no other option for creating a constant expression of a function type, then does a ref.func of that. * Handle unreachability in call_ref binary reading. * S-expression parsing fixes in more places, and add a tiny fuzzer for it. * Switch fuzzer test to just have the metrics, and not print all the fuzz output which changes a lot. Also fix noprint handling which only worked on binaries before. * Fix Properties::getLiteral() to use the specific function type properly, and make Literal's function constructor require that, to prevent future bugs. * Turn all input types into nullable types, for now.
* [TypedFunctionReferences] Implement call_ref (#3396)Alon Zakai2020-11-241-0/+3
| | | | | | | | Includes minimal support in various passes. Also includes actual optimization work in Directize, which was easy to add. Almost has fuzzer support, but the actual makeCallRef is just a stub so far. Includes s-parser support for parsing typed function references types.
* Introduce lit/FileCheck tests (#3367)Thomas Lively2020-11-184-4/+57
| | | | | | | | | | | | | | | lit and FileCheck are the tools used to run the majority of tests in LLVM. Each lit test file contains the commands to be run for that test, so lit tests are much more flexible and can be more precise than our current ad hoc testing system. FileCheck reads expected test output from comments, so it allows test output to be written alongside and interspersed with test input, making tests more readable and precise than in our current system. This PR adds a new suite to check.py that runs lit tests in the test/lit directory. A few tests have been ported to demonstrate the features of the new test runner. This change is motivated by a need for greater flexibility in testing wasm-split. See #3359.
* Rename atomic.notify and *.atomic.wait (#3353)Heejin Ahn2020-11-131-3/+3
| | | | | | | | | | | | | | - atomic.notify -> memory.atomic.notify - i32.atomic.wait -> memory.atomic.wait32 - i64.atomic.wait -> memory.atomic.wait64 See WebAssembly/threads#149. This renames instruction name printing but not the internal data structure names, such as `AtomicNotify`, which are not always the same as printed instruction names anyway. This also does not modify C API. But this fixes interface functions in binaryen.js because it seems binaryen.js's interface functions all follow the corresponding instruction names.
* [Fuzzer] Compare D8 on Liftoff and TurboFan (#3342)Alon Zakai2020-11-121-23/+18
| | | | | | | | | Previously we picked one of the two compilers at the top level. But that doesn't actually compare between them directly - each entire run used one of the two. Instead, add separate "VMs" for each of them, and keep the existing D8 VM as well (which tests tiering up). The code also seems nicer this way.
* [Fuzzer] Add a chance to pick particularly important initial contents (#3343)Alon Zakai2020-11-121-1/+13
| | | | | | | | | | | | OptimizeInstructions is seeing the most work these days, so it's good for the fuzzer to focus on that some more. Also move some code around in the main test wast: it's useful to put each feature in its own module to maximize the chance of getting them to be used. That is, if a module has a single use of atomics, then if atomics are disabled in the current run, we can't use any of the module and we skip initial contents entirely. Moving each feature to it's own module reduces that risk. (We do pick randomly between the modules, and atm a small module has the same chance as a big one, but this still seems worth it.)
* Allow setting the path to libbinaryen.so shared library (#3025)rathann2020-11-101-0/+9
| | | | This makes it easier to install libbinaryen.so into an alternative locations. Fixes part of issue #2999 for me.
* wasm2js: Remove global dict arguments to asmFunc (#3325)Sam Clegg2020-11-051-1/+1
|
* Remove remaining bits of C API tracing, which has been removed (#3322)Alon Zakai2020-11-051-37/+0
| | | It was removed in #2841