summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* [NominalFuzzing] Add typesystem flag to wasm-dis (#4645)Alon Zakai2022-05-051-2/+2
| | | | | wasm-dis does enable all features by default, so we don't need the feature flags, but we do need --nominal etc. since we emit such modules now.
* Fix fuzzer's choosing of reference types (#4642)Alon Zakai2022-05-052-39/+55
| | | | | | * Don't emit "i31" or "data" if GC is not enabled, as only the GC feature adds those. * Don't emit "any" without GC either. While it is allowed, fuzzer limitations prevent this atm (see details in comment - it's fixable).
* Parse the prototype nominal binary format (#4644)Thomas Lively2022-05-044-9/+71
| | | | | | In f124a11ca3 we removed support for the prototype nominal binary format entirely, but that means that we can no longer parse older binary modules that used that format. Fix this regression by restoring the ability to parse the prototype binary format.
* Setup git submodules so googletest is fetched, unbreaking alpine in releases ↵Alon Zakai2022-05-041-0/+2
| | | | | | | | | (#4640) Without this the CMake step fails on not finding googletest/googletest/src/gtest_main.cc Fixes #4639
* Reduce iterations required for DeadArgumentElimination convergence (#4629)arsnyder162022-05-041-44/+16
| | | | | | If we do not remove a param, we can try to remove the return value. We can do that on a per-function basis, and not only if we removed no params from anywhere. Also simplify tail call logic.
* Update StackCheck for memory64 (#4636)Sam Clegg2022-05-043-8/+105
|
* Remove externref (#4633)Thomas Lively2022-05-0454-591/+415
| | | | | | Remove `Type::externref` and `HeapType::ext` and replace them with uses of anyref and any, respectively, now that we have unified these types in the GC proposal. For backwards compatibility, continue to parse `extern` and `externref` and maintain their relevant C API functions.
* Replace 64K sparse matrix testcase with 8K (#4635)Alon Zakai2022-05-033-2/+2
| | | | Helps #4632: This makes it take 4 seconds instead of 5 minutes.
* Release 107 (#4634)Alon Zakai2022-05-032-1/+10
|
* Update nominal type ordering (#4631)Thomas Lively2022-05-0313-68/+119
| | | | | | V8 requires that supertypes come before subtypes when it parses isorecursive (i.e. standards-track) type definitions. Since 2268f2a we are emitting nominal types using the standard isorecursive format, so respect the ordering requirement.
* Add missing include for windows (#4627)martinRenou2022-05-021-0/+2
| | | | | Without this Windows fails with: 'isdigit': is not a member of 'std'
* [NominalFuzzing] Use feature flags in a missing place (#4628)Alon Zakai2022-05-021-1/+1
| | | | | | | Instead of a raw run command, use the helper function, which adds the feature flags. That adds --nominal which is needed more now after #4625 This fixes the fuzz failures mentioned in #4625 (comment)
* Handle call.without.effects in RemoveUnusedModuleElements (#4624)Alon Zakai2022-05-022-5/+151
| | | | | | | | | | | | | | | | | We assume a closed world atm in the GC space, but the call.without.effects intrinsic sort of breaks that: that intrinsic looks like an import, but we really need to care about what is sent to it even in a closed world: (call $call-without-effects (ref.func $target-keep) ) That reference cannot be ignored, as logically it is called just as if there were a call_ref there. This adds support for that, fixing the combination of #4621 and using call.without.effects. Also flip the vector of ref.func names to a set. I realized that in a very large program we might see the same name many times.
* Update the type section binary format (#4625)Thomas Lively2022-05-023-71/+103
| | | | | | | | | | Print subtype declarations using the standards-track format with a vector of supertypes followed by a normal type declaration rather than our interim nominal format that used alternative versions of the func, struct, and array forms. Desugar the nominal format to additionally emit all the types into a single large recursion group. Currently V8 is performing this desugaring, but after this change and a future change that fixes the order of nominal types to ensure supertypes precede subtypes, it will no longer need to.
* Lift the restriction in liveness-traversal.h that supported max 65535 locals ↵juj2022-04-289-60/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in a function. (#4567) * Lift the restriction in liveness-traversal.h that supported max 65535 locals in a function. * Lint * Fix typo * Fix static * Lint * Lint * Lint * Add needed canRun function * lint * Use either a sparse or a dense matrix for tracking liveness copies, depending on the locals count. * Lint * Fix lint * Lint * Implement sparse_square_matrix class and use that as a backing. * Lint * Lint * Lint #includes * Lint * Lint includes * Remove unnecessary code * Fix canonical accesses to copies matrix * Lint * Add missing variable update * Remove canRun() function * Address review * Update expected test results * Update test name * Add asserts to sparse_square_matrix set and get functions that they are not out of bound. * Lint includes * Update test expectation * Use .clear() + .resize() to reset totalCopies vector
* RemoveUnusedModuleElements: Track CallRef/RefFunc more precisely (#4621)Alon Zakai2022-04-284-25/+317
| | | | | | | | | | | | | | | | | | If we see (ref.func $foo) that does not mean that $foo is reachable - we must also see a (call_ref ..) of the proper type. Only after seeing both should we mark the function as reachable, which this PR does. This adds some complexity as we need to track intermediate state as we go, since we could see the RefFunc before the CallRef or vice versa. We also need to handle the case of a RefFunc without a CallRef properly: We cannot remove the function, as the RefFunc must refer to it, but at least we can empty out the body since we know it is never reached. This removes an old wasm-opt test which is now superseded by a new lit test. On J2Wasm output this removes 3% of all functions, which account for 2.5% of total code size.
* [NominalFuzzing] SignatureRefining can modify the IR while running a ↵Alon Zakai2022-04-283-7/+13
| | | | | | | | | parallel analysis (#4620) Normally ParallelFunctionAnalysis is just an analysis, and has no effects. However, in SignatureRefining we actually do have side effects, due to an internal limitation of the helper code it runs. This adds a template parameter to the class so users can note that they do modify the IR. The parameter is added in the middle as it is easier to add this param than to add the last one (the map).
* Fix some outdated comments (#4617)Alon Zakai2022-04-262-6/+2
| | | | * We implemented specialization of field types (the TypeRefining pass). * LUBFinder now handles nulls, so we need nothing extra for it in TypeRefining.
* Lit tests: print failing module index (#4614)Alon Zakai2022-04-261-0/+5
| | | | When a .wat file has lots of modules inside it, printing the index of the module is helpful to find which is erroring.
* wasm-reduce: Try to remove functions from a random place (#4612)Alon Zakai2022-04-251-7/+32
| | | | | | Previously we'd only try to remove functions from index 0, so we missed some opportunities. With this change we still go through all the functions if things go well, but we start from a deterministic random location in the vector.
* SmallSet: Mark iterator parent as const (#4613)Alon Zakai2022-04-251-2/+2
| | | | | | | | | | | | | | | | | | | We already assume the parent does not change, binaryen/src/support/small_set.h Lines 202 to 208 in 94d77ef // std::set allows changes while iterating. For us here, though, it would // be nontrivial to support that given we have two iterators that we // generalize over (switching "in the middle" would not be easy or fast), // so error on that. if (usingFixed != other.usingFixed) { Fatal() << "SmallSet does not support changes while iterating"; } This also marks the parent as const to reflect that. This fixed a weird C++ compilation error I had when working on something unrelated, but seems worth landing independently.
* OptimizeInstructions: Refinalize after a cast removal (#4611)Alon Zakai2022-04-252-3/+81
| | | | | | | | | Casts can replace a type with a subtype, which normally has no downsides, but in a corner case of struct types it can lead to us needing to refinalize higher up too, see details in the comment. We have avoided any Refinalize calls in OptimizeInstructions, but the case handled here requires it sadly. I considered moving it to another pass, but this is a peephole optimization so there isn't really a better place.
* [NominalFuzzing] Switch to nominal fuzzing by default (#4610)Alon Zakai2022-04-221-3/+13
| | | Add a flag to make it easy to pick which typesystem to test.
* [NominalFuzzing] SignatureRefining: Ignore exported functions (#4601)Alon Zakai2022-04-223-1/+91
| | | This hits the fuzzer when it tries to call reference exports with a null.
* [NominalFuzzing] Fix getHeapTypeCounts() on unreachable casts (#4609)Alon Zakai2022-04-222-53/+77
| | | | | | | | | | | The cast instruction may be unreachable but the intended type for the cast still needs to be collected. Otherwise we end up with problems both during optimizations that look at heap types and in printing (which will use the heap type in code but not declare it). Diff without whitespace is much smaller: this just moves code around so that we can use a template to avoid code duplication. The actual change is just to scan ->intendedType unconditionally, and not ignore it if the cast is unreachable.
* [NominalFuzzing] GTO: trap on null ref in removed struct.set (#4607)Alon Zakai2022-04-212-6/+14
| | | | | | | | | | | | | | When a field has no reads, we remove all its writes, but we did this: (struct.set $foo A B) => (drop A) (drop B) We also need to trap if A, the reference, is null, which this PR fixes, (struct.set $foo A B) => (drop (ref.as_non_null A)) (drop B)
* [NominalFuzzing] Add a validation error on ref.cast's etc. intended type (#4606)Alon Zakai2022-04-211-0/+7
|
* [NominalFuzzing] MergeSimilarFunctions: handle nominal types properly (#4602)Alon Zakai2022-04-212-2/+325
| | | | | | This fixes two bugs: First, we need to compare the nominal types of function constants when looking for constants to "merge", not just their structure. Second, when creating the new function we must use the proper type of those constants, and not just another type.
* [NominalFuzzing] Fix TranslateToFuzzReader::getSubType(Rtt) (#4604)Alon Zakai2022-04-211-0/+6
| | | | Randomly selecting a depth is ok for structural typing, but in nominal it must match the actual hierarchy of types.
* [NominalFuzzing] Don't compare nominal types in the fuzzer (#4603)Alon Zakai2022-04-211-3/+8
| | | | | The same module will have a different type after some transformations, even though that is not observable, like --roundtrip. Basically, we should not be comparing types between separate modules, which is what the fuzzer does.
* [NominalFuzzing] Fix replaceWithIdenticalType() on nondefaultable tuples (#4605)Alon Zakai2022-04-211-1/+1
|
* Rename asyncify-side-module to asyncify-relocatable (#4596)かめのこにょこにょこ2022-04-182-4/+4
| | | | | | | Related: emscripten-core/emscripten#15893 (comment) --pass-arg=asyncify-side-module option will be used not only from side modules, but also from main modules.
* Use LLD for LTO builds on Mac (#4594)Derek Schuff2022-04-141-3/+1
| | | Mac's LLD now supports ThinLTO and is much faster than ld with libLTO.
* Revert "Re-enable a previously flaky type test (#4582)" (#4591)Thomas Lively2022-04-111-1/+1
| | | This reverts commit 40a998c00eb42b65ddc1d42c1c009690bbd05cca.
* Implement relaxed SIMD dot product instructions (#4586)Thomas Lively2022-04-1113-13/+235
| | | As proposed in https://github.com/WebAssembly/relaxed-simd/issues/52.
* [Inlining] Preserve return_calls when possible (#4589)Thomas Lively2022-04-112-0/+72
| | | | | | | | | We can preserve return_calls in inlined functions when the inlined call site is itself a return_call, since the call result types must transitively match in that case. This solves a problem where the previous inlining logic could introduce stack exhaustion by downgrading recursive return_calls to normal calls. Fixes #4587.
* [SIMD] Make swizzle's opcode name consistent (NFC) (#4585)Heejin Ahn2022-04-0914-24/+24
| | | | Other opcode ends with `Inxm` or `Fnxm` (where n and m are integers), while `i8x16.swizzle`'s opcode name doesn't have an `I` in there.
* Implement i16x8.relaxed_q15mulr_s (#4583)Thomas Lively2022-04-0711-7/+58
| | | As proposed in https://github.com/WebAssembly/relaxed-simd/issues/40.
* Add .emsdk_version to .gitignore (#4584)juj2022-04-071-0/+3
|
* Re-enable a previously flaky type test (#4582)Thomas Lively2022-04-051-1/+1
| | | | | I don't know what exactly was causing this test to flake, but since it was disabled we added the type fuzzer and fixed a lot of bugs, so I hope it is no longer flaky. If that turns out to be wrong, I can dig deeper.
* Avoid a code pattern of vec.resize() followed by std::fill() as suboptimal. ↵juj2022-04-054-9/+8
| | | | Instead do a clear()+resize() (#4580)
* Fix MemoryPacking bug (#4579)Thomas Lively2022-04-052-2/+27
| | | | | | | | 247f4c20a1 introduced a bug that caused expressions that refer to data segments to be associated with the wrong segments in the presence of other segments that have no referring expressions at all. Fixes #4569. Fixes #4571.
* [Wasm GC] Fix unreachable local.gets of non-nullable locals in ↵Alon Zakai2022-04-053-2/+47
| | | | | | | | CoalesceLocals (#4574) Normally we just replace unreachable local.gets with a constant (0, or null), but if the local is non-nullable we can't do that. Fixes #4573
* Fix CMake builds on CI (#4578)Alon Zakai2022-04-041-5/+5
| | | | | | | | | | Add -DCMAKE_INSTALL_PREFIX=out/install to all builds. This is now needed on CI for some reason that I cannot figure out. Fixes #4576 Fixes #4575
* Add '-vv' verbosity to binaryen-lit tests (#4577)Thomas Lively2022-04-041-2/+2
| | | To help debug them when they go wrong, as seems to be happening on #4574.
* Use LiteralUtils::canMakeZero before calling makeZero (#4568)Alon Zakai2022-04-015-13/+101
| | | | | Fixes #4562 Fixes #4564
* Port memory-packing tests to lit (#4559)Thomas Lively2022-04-016-2146/+2286
|
* Fix typo (WASM -> Wasm) (#4565)Clemens Backes2022-04-011-1/+1
|
* [NFC] Refactor Feature::All to match FeatureSet.setAll() (#4557)Alon Zakai2022-03-314-11/+15
| | | | | | | | | | | As we recently noted in #4555, that Feature::All and FeatureSet.setAll() are different is potentially confusing... I think the best thing is to make them identical. This does that, and adds a new Feature::AllPossible which is everything possible and not just the set of all features that are enabled by -all. This undoes part of #4555 as now the old/simpler code works properly.
* [Wasm GC] Fix stacky non-nullable tuples (#4561)Alon Zakai2022-03-313-7/+120
| | | | | #4555 fixed validation for such tuples, but we also did not handle them in "stacky" code using pops etc., due to a logic bug in the binary reading code.