summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix a call to make_unique without std (#5615)Alon Zakai2023-04-031-1/+1
| | | Followup to #5613
* [Wasm GC] Stop emitted deprecated cast etc. instructions (#5614)Alon Zakai2023-03-311-46/+0
| | | | | | | | | This is necessary to start fuzzing RefCast etc., as otherwise the fuzzer errors on V8 which has already removed support for the deprecated ones apparently. Do not remove read support for them yet, as perhaps some users still need that.
* [NFC] Remove our bespoke `make_unique` implementation (#5613)Thomas Lively2023-03-3120-65/+61
| | | | This code predates our adoption of C++14 and can now be removed in favor of `std::make_unique`, which should be more efficient.
* Adjust fuzzer frequencies (#5612)Alon Zakai2023-03-311-6/+5
| | | | | | | | | | I ran CheckDeterminism at full throttle overnight (set to 1, and disabled all other things) and it found a bug, so we should focus on that more. Also ctor-eval as there is ongoing work there. I reduced a few other priorities of things that haven't seen bugs in a very long time and are not high priority.
* Add a TODO in SignaturePruning (#5611)Alon Zakai2023-03-311-0/+8
|
* Fix Emscripten build for latest tot changes (#5610)Alon Zakai2023-03-312-3/+3
|
* Switch fuzzer to hybrid typing (#5609)Alon Zakai2023-03-311-1/+1
| | | This is the default, and also used by J2Wasm.
* [Wasm GC] Fix nondeterminism in SignaturePruning (#5608)Alon Zakai2023-03-311-3/+8
| | | | | | | The order of iteration on sigFuncs there can matter, as each time we prune we end up changing things that can affect other prunings (specifically, ParamUtils::removeParameter can decide that it can't remove a parameter based on the effects on arguments, and current limitations in how we handle that; and pruning can affect effects).
* Do not treat `atomic.fence` as using a memory (#5603)Thomas Lively2023-03-294-37/+13
| | | | | | | | | * Do not treat `atomic.fence` as using a memory Update RemoveUnusedModuleElements so that it no longer keeps the memory alive due to an `atomic.fence` instruction and update validation to allow modules to use `atomic.fence` without a memory. * update wasm2js tests
* [NFC] Port remove-unused-module-elements_all-features.wast to lit (#5602)Thomas Lively2023-03-293-585/+572
| | | | | | | | | * [NFC] Simplify initialization in RemoveUnusedModuleElements.cpp Use copy-list-initialization to shorten the code and reduce visual redundancy. * [NFC] Port remove-unused-module-elements_all-features.wast to lit Port the test automatically using scripts/port_passes_tests_to_lit.py.
* [NFC] Simplify initialization in RemoveUnusedModuleElements.cpp (#5601)Thomas Lively2023-03-291-25/+21
| | | Use copy-list-initialization to shorten the code and reduce visual redundancy.
* Support memory64 in MemoryPacking (#5605)Thomas Lively2023-03-292-2/+52
| | | | | | Fix the relevant pointer and size expressions produced by MemoryPacking to be i64s when working with 64-bit memories. Fixes #5578.
* Fuzz partial-inlining-ifs (#5600)Alon Zakai2023-03-291-0/+4
|
* Use more than a single wasm page in Asyncify fuzzing (#5597)Alon Zakai2023-03-221-1/+3
| | | | | I saw a testcase fail on the internal assertion of the buffer being too small. Enlarge it to use as much of the memory we have anyhow to reduce that risk (we can use 15 pages instead of 1, without changing anything else).
* Fuzzer: Ignore infinite recursion in Asyncify handler (#5596)Alon Zakai2023-03-221-0/+17
|
* Use a SmallVector in MergeBlocks [NFC] (#5594)Alon Zakai2023-03-211-4/+9
| | | | | | | | This makes the pass 2-3% faster in some measurements I did locally. Noticed when profiling for #5561 (comment) Helps #4165
* Properly error on multivalue returns in GenerateDynCalls (#5588)Alon Zakai2023-03-211-0/+10
| | | | Fixes #5586
* [Wasm GC] Fix detection of externalize/internalize as constant (#5592)Alon Zakai2023-03-203-3/+103
| | | | | | | | | | | | Both isValidInConstantExpression and isSingleConstantExpression must look recursively at the internals of a RefAs that externalizes and internalizes, or else we might do something like externalize a local.get, which is not constant. getLiteral must handle externalize/internalize as well, and return a properly- modified literal. Without these fixes the testcase hits different internal assertions, and we either fail to recognize something is constant or not, or think that it is but fail to produce a literal for it.
* Ensure a deterministic order in the type names section (#5590)Alon Zakai2023-03-203-33/+44
| | | | | | | | | Before this PR we iterated over an unordered set. Replace that with an iteration on a vector. (Also, the value in the set was not even used, so this should even be faster.) Add random names in the fuzzer to types, the lack of which is I believe the reason this was not detected before.
* [Exceptions] Fix error on bad delegate index (#5587)Alon Zakai2023-03-173-1/+23
| | | | Fixes #5584
* [Wasm GC] Allow extern.externalize in globals (#5585)Alon Zakai2023-03-173-2/+39
| | | | | | | | | | This fixes wasm-ctor-eval on evalling a GC data structure that contains a field initialized with an externalized value. Per the spec this is a constant instruction and I verified that V8 allows this. Also add missing validation in wasm-ctor-eval of the output (which makes debugging this kind of thing a little easier).
* [Wasm GC] wasm-ctor-eval: Handle externalized data (#5582)Alon Zakai2023-03-163-4/+88
|
* [NFC] Templatize `makeBlock` so it can be used with any iterable (#5583)Thomas Lively2023-03-162-30/+25
| | | | | | | | Replace the different overloads we previously had for different kinds of containers with generic templates. We still need dedicated overloads for `std::initializer_list` because it is never inferred in a template context, though. Also, since `std::initializer_list` does not allow subscripting, update the arena vector implementation to use iterators instead now that initializer lists can be passed down to that layer without being reified as vectors.
* Handle ReturnCall in MergeSimilarFunctions (#5581)Alon Zakai2023-03-162-2/+83
| | | | Fixes #5580
* [Wasm GC] Fuzz ref.test (#5577)Alon Zakai2023-03-163-33/+68
|
* Add bulk-array.wast spec test outline (#5568)Thomas Lively2023-03-165-33/+238
| | | | | | | | | Add spec/bulk-array.wast, which contains an outline of the tests that will be necessary for the upcoming bulk array instructions: array.copy (already implemented), array.fill, array.init_data, and array.init_elem. Although the test file does not actually contain any tests yet, it contains some setup code defining types, globals, and element segments that the tests will use. Fix miscellaneous bugs in parsing, validation, and printing to allow this setup code to run without issues.
* Support interpretation of extern.externalize and extern.internalize (#5576)Thomas Lively2023-03-165-49/+92
| | | | | | | To allow the external and internal reference values to be differentiated yet round-trippable, set the `Literal` type to externref on external references, but keep the gcData the same for both. The only exception is for i31 references, for which the externalized version gets a `gcData` that contains a copy of the original i31 literal.
* Fuzzer: Generate both immutable and mutable globals (#5575)Alon Zakai2023-03-154-66/+68
|
* Fuzzer: Pick interesting subtypes in getSubType(HeapType) (#5573)Alon Zakai2023-03-153-38/+73
|
* [Wasm GC] Remove RefIsFunc and RefIsI31 from the binary format (#5574)Alon Zakai2023-03-153-39/+0
| | | | We still support ref.is_func/i31 in the text format for now. After we verify that no users depend on that we can remove it as well.
* Fix misoptimization in TypeMerging (#5572)Thomas Lively2023-03-143-89/+309
| | | | | | | | | | | | TypeMerging previously tried to merge types with their supertypes and siblings in a single step, but this could cause a misoptimization in which a type was merged with its parent's sibling without being merged with its parent, breaking subtyping. Fix the bug by merging with supertypes and siblings separately. Since we now have multiple merging steps, also take the opportunity to run the sibling merging step multiple times to exploit more merging opportunities. Fixes #5556.
* Fuzzer: CompareVMs: Do not compare when hitting a host limitation (#5562)Alon Zakai2023-03-141-2/+18
| | | | | | | For example, we might hit an allocation limit in the wasm, but the optimized wasm might optimize that allocation out. So we need to ignore comparisons in such cases, as we cannot expect the output to be identical. We already do similar things for FuzzExec and #5560 adds it for TrapsNeverHappen; this adds it to CompareVMs.
* [Wasm GC] Properly handle packed field truncation in StructNew (#5570)Alon Zakai2023-03-132-2/+21
|
* Fix fuzzer emitting invalid constant expressions (#5571)Thomas Lively2023-03-131-19/+21
| | | | | | | | | | The fuzzer had code to avoid emitting `global.get` of locally defined (i.e. non-imported) globals in global initializers and data segment offsets, but that code only handled top-level `global.get` because it predated the extended-const proposal. Unfortunately this bug went undetected until #5557, which fixed the validator to make it reject invalid uses of `global.get` in constant expressions. Fix the bug so the validator no longer produces invalid modules.
* Fuzzer: Avoid emitting massive nested structs (#5564)Alon Zakai2023-03-132-41/+59
| | | | | | | | | | | The nesting limit of around 20 was enough to cause exponential blowup. A 20K input file lead to a 2GB wasm in one case I saw (!) which takes many seconds to fuzz. Instead, reduce the limit, and also check if random tells us that the random input is done; when that's done we should stop, which limits us to O(input size). Also do this for non-nullable types, and handle that in globals (we cannot emit a RefAsNulNull there, so switch the global type if necessary).
* Fuzzer: Limit array sizes (#5569)Alon Zakai2023-03-133-42/+38
| | | | | | Even with a 1% chance of a huge array, there is a second problem aside from hitting an allocation failure, which is DoS - building such a huge array of Literals takes noticeable time in the fuzzer. Instead, just limit array max sizes, which is consistent with what we do for struct sizes etc.
* Fix ambiguous operators under C++20 (#5567)Thomas Lively2023-03-101-2/+4
| | | | | | | | | | | | When resolving `operator!=`, C++20 also considers `operator==` implementations when the types on `operator!=` do not match exactly. This caused the modified code to have no most-specific overload to choose, resulting in an error. This is actually a bug in the language that is being fixed, but there exist compilers without the fix applied. Work around the problem by updating the types in the declaration of `operator==` and `operator!=` to be more exact. This is a copy of #5029 with formatting fixes.
* Make constant expression validation stricter (#5557)Thomas Lively2023-03-1022-206/+196
| | | | | | | | | | Previously we treated global.get as a constant expression and only additionally verified that the target globals were immutable in some cases. But global.get of a mutable global is never a constant expression, and further, only imported globals are available in constant expressions unless GC is enabled. Fix constant expression validation to only allow global.get of immutable, imported globals, and fix all the invalid tests.
* Fuzzer: Emit fewer uninhabitable types in getSubType (#5563)Alon Zakai2023-03-102-31/+38
| | | | Only rarely return an uninhabitable subtype of an inhabitable one. This avoids a major source of uninhabitability and immediate traps.
* [NFC] Add missing parts of `ChildIterator` (#5566)Thomas Lively2023-03-101-6/+12
| | | | | The missing associated types will become necessary if we ever use these iterators in a nontrivial manner. Make the parent reference into a pointer so that the copy constructor and assignment operator are not implicitly deleted.
* Fuzzer: Emit nulls with low probability in makeConstCompoundRef (#5559)Alon Zakai2023-03-103-50/+64
| | | | In particular, the removed code path here that did a RefAsNonNull of a null was causing a lot of code to just trap.
* TrapsNeverHappen fuzzing: Handle a trap vs a host limitation (#5560)Alon Zakai2023-03-101-0/+8
| | | | | | | | | | If the program tries to allocate an infinite number of objects, but is prevented from doing that by a null pointer trap, then after we run with trapsNeverHappen the trap may fail to occur, and we'll hit the host limitation on allocations. As a result, we'd be comparing one run with a trap and one run that is meant to be ignored (as we ignore runs with host limitations), and before this PR we'd error as we would expect to find the normal output and not the "ignore this host limitation" marker.
* Emit the fuzzer hashMemory function after modifications (#5558)Alon Zakai2023-03-094-111/+113
| | | | | | | | | | Previously we emitted it early, and would then modify it in random ways like other initial content. But this function is called frequently during execution, so if we were unlucky and modded that function to trap then basically all other functions would trap as well. After fixing this, some places assert on not having any functions or types to pick a random one from, so fix those places too.
* Integrate the heap type fuzzer into the main fuzzer (#5555)Alon Zakai2023-03-095-39/+78
| | | | | | | | | | | | | With this we generate random GC types that may be used in creating instructions later. We don't create many instructions yet, which will be the next step after this. Also add some trivial assertions in some places, that have helped debugging in the past. Stop fuzzing TypeMerging for now due to #5556 , which this PR uncovers.
* Fuzzer: Pick from existing heap types in the module (#5539)Alon Zakai2023-03-083-38/+77
|
* Refactor type fuzzer to expose `getInhabitable` API (#5552)Thomas Lively2023-03-083-76/+88
| | | | | The main fuzzer needs to be able to filter out uninhabitable types and the type fuzzer has code for finding uninhabitable types. Move and refactor the code to expose a `getInhabitable` function that can be used for both purposes.
* CodePushing: Pushing into an if may require non-nullable fixups (#5551)Alon Zakai2023-03-072-34/+76
| | | | | | | | | | | | | | | This became an issue because the timeline was this: * We added non-nullable locals support. At the time, obviously CodePushing did not require any fixups for that, since it just moved code forward in a single block (and not past any uses). So we marked the pass as not needing such fixups. * We added pushing of code into ifs. But moving code into an if can affect non-nullable validation since it is based on block scoping. So we need to remove the mark on the pass, which will make it check and apply fixups as necessary. See the testcase for an example.
* Fuzzer: Skip testcases that hit V8's array size limit (#5550)Alon Zakai2023-03-071-2/+8
|
* SignatureRefining: Skip types with supertypes for now (#5548)Alon Zakai2023-03-062-0/+36
| | | We'd need to handle contravariance to optimize them.
* Skip function references when detecting uninhabitable types (#5545)Thomas Lively2023-03-032-25/+28
| | | | | | Function references are always inhabitable because functions can be created with any function type, even types that refer to uninhabitable types. Take advantage of this by skipping function references when finding non-nullable reference cycles that cause uninhabitability.