summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* [EH] Export tags (#4691)Heejin Ahn2022-05-266-1/+17
| | | | | | | | | | | | | | | | | This adds exported tags to `exports` section in wasm-emscripten-finalize metadata so Emscripten can use it. Also fixes a bug in the parser. We have only recognized the export format of ```wasm (tag $e2 (param f32)) (export "e2" (tag $e2)) ``` and ignored this format: ```wasm (tag $e1 (export "e1") (param i32)) ``` Companion patch: https://github.com/emscripten-core/emscripten/pull/17064
* [Parser][NFC] Clarify escaped string lexing (#4694)Thomas Lively2022-05-261-24/+27
| | | | Improve comments and variable names to make it clear that we allocate and build a separate string only when necessary to handle escape sequences.
* [Parser] Lex floating point values (#4693)Thomas Lively2022-05-262-29/+721
| | | | | | | | | | | | | | | Rather than trying to actually implement the parsing of float values, which cannot be done naively due to precision concerns, just parse the float grammar then postprocess the parsed text into a form we can pass to `strtod` to do the actual parsing of the value. Since the float grammar reuses `num` and `hexnum` from the integer grammar but does not care about overflow, add a mode to `LexIntCtx`, `num`, and `hexnum` to allow parsing overflowing numbers. For NaNs, store the payload as a separate value rather than as part of the parsed double. The payload will be injected into the NaN at a higher level of the parser once we know whether we are parsing an f64 or an f32 and therefore know what the allowable payload values are.
* [Parser] Lex keywords (#4688)Thomas Lively2022-05-252-1/+65
| | | | | Also include reserved words that look like keywords to avoid having to find and enumerate all the valid keywords. Invalid keywords will be rejected at a higher level in the parser instead.
* [Parser] Lex strings (#4687)Thomas Lively2022-05-252-1/+266
|
* [Parser] Lex idchar and identifiers (#4686)Thomas Lively2022-05-252-3/+103
|
* [Wasm GC] Fix CFG traversal of call_ref and add missing validation check (#4690)Alon Zakai2022-05-255-1/+94
| | | | | | | | We were missing CallRef in the CFG traversal code in a place where we note possible exceptions. As a result we thought CallRef cannot throw, and were missing some control flow edges. To actually detect the problem, we need to validate non-nullable locals properly, which we were not doing. This adds that as well.
* [Parser] Start a new text format parser (#4680)Thomas Lively2022-05-243-0/+907
| | | | | | | | | | | | | | | | | | | | | | | | | Begin implementing a new text format parser that will accept the standard text format. Start with a lexer that can iterate over tokens in an underlying text buffer. The initial supported tokens are integers, parentheses, and whitespace including comments. The implementation is in a new private internal header so it can be included into a gtest source file even though it is not meant to be a public API. Once the parser is more complete, there will be an additional public header exposing a more concise public API and the private header will be included into a source file that implements that public API. The new parser will improve on the existing text format parser not only because it will accept the full standard text format, but also because its code will be simpler and easier to maintain and because it will hopefully be faster as well. The new parser will be built out of small functions that closely mirror the grammar productions given in the spec and will heavily use C++17 features like string_view, optional, and variant to provide more self-documenting and efficient code. Future PRs will add support for lexing other kinds of tokens followed by support for parsing more complex constructs.
* [Fuzzer] Ignore relaxed-simd test for initial contents (#4683)Alon Zakai2022-05-241-0/+8
| | | | If we use it as initial contents, we will try to execute it, and hit the TODOs in the interpreter for unimplemented parts.
* Updating wasm-opt example to an available pass (#4684)Ashley Nelson2022-05-241-7/+6
| | | The wasm-opt example was using a test pass that was deleted. Updating to use one of the test passes in test/lit/passes.
* Add C and JS API functions for accessing memory info (#4682) Jackson Gardner2022-05-245-2/+101
| | | Based on #3573 plus minor fixes
* [Nominal Fuzzing] Fix SignatureRefining by updating types fully at once (#4665)Alon Zakai2022-05-234-20/+112
| | | | | | | | | | Optionally avoid updating types in TypeUpdating::updateParamTypes(). That update is incomplete if the function signature is also changing, which is the case in SignatureRefining (but not DeadArgumentElimination). "Incomplete" means that we updated the local.get type, but the function signature does not match yet. That incomplete state can hit an internal error in GlobalTypeRewriter::updateSignatures where it updates types. To avoid that, do the entire full update only there (in GlobalTypeRewriter::updateSignatures).
* Fix binary parsing of the prototype nominal format (#4679)Thomas Lively2022-05-192-16/+13
| | | | | | We were checking that nominal modules only had a single element in their type sections, but that's not correct for the prototype nominal binary format we still want to support. The test for this missed catching the bug because it wasn't actually parsing in nominal mode.
* [NFC] Deduplicate imported global parsing (#4678)Thomas Lively2022-05-191-23/+7
| | | | | | | | | | Share the logic for parsing imported and non-imported globals of the formats: (import "module" "base" (global $name? type)) (global $name? type init) This fixes #4676, since the deleted logic for parsing imported globals did not handle parsing GC types correctly.
* Validator: Check features for ref.null's type (#4677)Alon Zakai2022-05-183-0/+26
|
* [GC Fuzzing] Avoid non-nullable eqref without GC (#4675)Alon Zakai2022-05-182-30/+56
| | | | | | With only reference types but not GC, we cannot easily create a constant for eqref for example. Only GC adds i31.new etc. To avoid assertions in the fuzzer, avoid randomly picking (ref eq) etc., that is, keep it nullable so that we can emit a (ref.null eq) if we need a constant value of that type.
* Update README.md (#4674)Ashley Nelson2022-05-181-1/+1
| | | Removing the command prompt so copy/paste is easier.
* wasm-reduce: Fix order in shrinkByReduction call (#4673)Alon Zakai2022-05-171-1/+4
| | | | | | The old code would short-circuit and not do anything after we managed any reduction in the loop here. That would end up doing entire iterations of the whole pipeline before removing another element segment, which could be slow.
* Fuzzer: Show a clear error if a given wasm fails to run (#4672)Alon Zakai2022-05-171-1/+5
| | | | | | Without this the error from a bad given wasm file - either by the user, or during a reduction where smaller wasms are given - could be very confusing. A bad given wasm file during reduction, in particular, indicates a bug in the reducer most likely.
* [NFC] Remove unneeded include (#4670)Alon Zakai2022-05-171-1/+0
|
* [NFC] Make InsertOrderedMap::insert's param const (#4669)Alon Zakai2022-05-171-1/+1
| | | | | Being a const reference allows writing insert({a, b}), which will be useful in a future PR, and there is no reason to actually update the reference.
* [NFC] Make PossibleConstantValues::dump() a const function (#4671)Alon Zakai2022-05-171-1/+1
|
* [Fuzzer] Reduce trap probability in function ref fallback code (#4653)Alon Zakai2022-05-161-10/+15
| | | | | | Also improve comments. As suggested in #4647
* Allow TypeBuilder::grow to take 0 as an argument (#4668)Thomas Lively2022-05-162-1/+3
| | | | | | | There's no reason not to allow growing by zero slots, but previously doing so would trigger an assertion. This caused a crash when roundtripping a trivial module. Fixes #4667.
* Ensure symmetric results in PossibleConstantValues (#4662)Alon Zakai2022-05-132-20/+27
| | | | | | | | | | | | | | | | | | | | | | | Previously we could return different results depending on the order we noted things: note(anyref.null); note(funcref.null); get() => anyref.null note(funcref.null); note(anyref.null); get() => funcref.null This is correct, as nulls are equal anyhow, and any could be used in the location we are optimizing. However, it can lead to nondeterminism if the caller's order of notes is nondeterministic. That is the case in DeadArgumentElimination, where we scan functions in parallel, then merge them without special ordering. To fix this, make the note operation symmetric. That seems simplest and least likely to be confusing. We can use the LUB to do that. To avoid duplicating the null logic, refactor note() to use combine().
* Followups to #3841 (#3842)Alon Zakai2022-05-131-6/+0
| | | | | If we don't think that preventing copies in assignment makes sense by itself (since we allow them on construction) then I think we can just remove the restriction and also the implicit copy constructor.
* Add SubTypes::getAllSubTypes variant which includes the type itself (#4649)Alon Zakai2022-05-135-17/+46
| | | | This also includes the type itself in the returned vector. This will be useful in a future PR.
* [NFC] Make Literal::makeNull take a HeapType (#4664)Alon Zakai2022-05-134-8/+7
| | | | | | | | Taking a Type is redundant as we only care about the heap type - the nullability must be Nullable. This avoids needing an assertion in the function, that is, it makes the API more type-safe.
* Make RefCast safe by default (#4663)Thomas Lively2022-05-121-1/+1
| | | | This prevents new `RefCast` expressions that don't explicitly have their safety set from getting an unitialized safety value.
* Costs: Increase cost of casts (#4661)Alon Zakai2022-05-123-13/+136
| | | | | Casts involve branches in the VM, so adding a cast in return for removing a branch (like If=>Select) is not beneficial. We don't want to ever do any more casts than we already are.
* Release 108 (#4658)Alon Zakai2022-05-112-1/+8
|
* Add ref.cast_nop_static (#4656)Thomas Lively2022-05-1111-9/+63
| | | | | | This unsafe experimental instruction is semantically equivalent to ref.cast_static, but V8 will unsafely turn it into a nop. This is meant to help us measure cast overhead more precisely than we can by globally turning all casts into nops.
* [NominalFuzzing] Fix SignaturePruning on types with a super (#4657)Alon Zakai2022-05-112-0/+27
| | | | | | | Do not prune parameters if there is a supertype that is a signature. Without this we crash on an assertion in TypeBuilder when we try to recreate the types (as we try to make a a subtype with fewer fields than the super).
* Fix setting of stack size when building with clang for windows (#4654)TheGreatRambler2022-05-101-1/+5
|
* Add option to disable building tools (#4655)TheGreatRambler2022-05-101-1/+9
|
* [Fuzzer] Fix another reference types vs gc types issue (#4647)Alon Zakai2022-05-062-75/+64
| | | | | | | | | | Diff without whitespace is smaller. We can't emit HeapType::data without GC. Fixing that by switching to func, another problem was uncovered: makeRefFuncConst had a TODO to handle the case where we need a function to refer to but have created none yet. In fact that TODO was done at the end of the function. Fix up the logic in between to actually get there.
* [Fuzzer] Add typesystem flag to reduction script (#4651)Alon Zakai2022-05-061-2/+3
| | | | | Without this the reduction will fail on not being able to parse the input file, if the input file depends on nominal typing.
* [NFC] Avoid scanning code in hasBranchTarget if the target is null (#4648)Alon Zakai2022-05-061-0/+4
| | | | | | | | A null target is not a valid name so nothing can branch to there. This just saves the wasted work. No existing code in the codebase benefits from this atm, but a later PR will. In particular this lets callers call this without checking if the name is non-null, which is more concise.
* Add CMake flag JS_OF_OCAML for js_of_ocaml (#4637)Blaine Bublitz2022-05-062-4/+35
|
* Revert "Reduce iterations required for DeadArgumentElimination convergence ↵arsnyder162022-05-051-16/+44
| | | | | (#4629)" (#4646) This reverts commit 4bcfba261cb8ee182261d26064453cab787d0df4.
* [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.