| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
| |
Also fix bug when parsing elem/data segment; the table/memory index is
stored as an LEB128, not a U8.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Running the multi-value spec tests found a few bugs:
* DropKeep needs to copy the kept values backward when the regions
overlap.
* Type names need to be resolved to indexes in block declarations
(e.g. `block (type $foo)`)
* `if` without an `else` is valid, it just behaves as though the `else`
is empty, which will pass the params through as results.
* When validating function signatures, we need to also check block
declaration signatures.
* Split `ResolveFuncType` into two functions:
`ResolveFuncTypeWithEmptySignature` and
`ResolveImplicitlyDefinedFunctionType`.
* When resolving implicitly defined function types, we only create an
implicit function type when the type is not inlinable; i.e. only for
block/loop/if with 0 or 1 result values and no params.
* Change `update-spec-tests` to include the `multi-value` proposal repo
from the testsuite.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use the `--enable-multi-value` flag to enable.
A lot of code already "worked" with multi-value, and just needed to
remove the restrictions. Most of the other changes are modifying the
callback APIs to be more general, e.g. taking more than 1 result type.
* Types are now stored as the negative values; this works nicely with
the encoding of inline function types (used for block signatures),
which are always positive values.
* Remove `BlockSignature` and use `BlockDeclaration` instead, which
is just a typedef to `FuncSignature`. This allows for explicit or
implicit type specifications on the block signatures.
* Allow for >1 "keep" values in the DropKeep interpreter instruction
|
|
|
|
|
|
|
|
|
|
| |
Each test should be run with its own directory of outputs, so the tests
can be run in parallel without clobbering results. Since I added wasm2c,
the spec `.wast` files were being used twice, but using the same output
directory. This would often work properly in a full run, but was flaky,
since they both write `.json` and `.wasm` files with the same names.
This fix gives them their own directories by always using the directory
name of the test.
|
|
|
| |
Fixes #668.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of printing errors on every failure, accumulate errors for each
operation. If any fails, then print a message. It changes errors such
as:
```
error: type mismatch in i64.store, expected i32 but got f32.
error: type mismatch in i64.store, expected i64 but got i32.
```
to:
```
error: type mismatch in i64.store, expected [i32, i64] but got [f32, i32]
```
|
|
|
|
|
|
|
| |
Since SourceErrorHandler can support binary locations, it doesn't make
much sense to have two different error handlers. There is now only an
ErrorHandler base class, and the first argument specifies whether the
error handler is expecting text or binary locations.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add support for quoted modules: `(module quote "...")`
* Binary modules must be annotated: `(module binary "...")`
* Multiple result blocks are no longer a parser error:
`(func (result i32) (result i32) ...)`
* Function types can specify unused bind variables:
`(type (func (param $foo)))`
* Rename `RawModule` -> `ScriptModule`. This encapsulates a module that
may not be parsed yet, whether binary or "quoted".
* Validate load/store offsets and alignment in the parser, not in the
validator. The spec tests assume that you can catch these errors with
`assert_malformed`.
* Parse wast files in `wasm-interp` when checking malformed/invalid/etc.
modules. This allows us to run all assertions at the same time, which
is nice. `wasm-interp` should probably be renamed, though.
* Two tests in `type.wast` fail because they use:
`(assert_invalid (module quote "..."))`. I'd prefer that we don't
support this, since it's unnecessary, and additional work. I'll fix in
a follow-up CL if we decide this is worth keeping.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Update testsuite; various lexing/parsing fixes
Lexer changes:
* Switch re2c parser to UTF-8 parser. This can almost be done "for
free" with a flag, but required a bit of work to allow us to catch
malformed UTF-8 as well.
* Change the re2c fill value to 0xff, since it's never a valid UTF-8 byte.
* Allow for more reserved tokens (basically any ascii aside from
parentheses, double-quote, and semi-colon)
* Remove "infinity" from lexer, only "inf" is allowed now.
* Change definition of EOF token, it was implemented incorrectly. The
correct way to handle it is to only return it from FILL when there is no
more data to fill.
* \r is a valid escape.
Parser changes:
* Changes to match the spec parser:
- block signatures use (result <type>) syntax
- func/global/table/memory can have multiple inline exports
- inline imports are handled in func definition instead of import
definition
- allow for inline modules (i.e. no "(module ...)" s-expr required)
* Remove FuncField. This was previously used for parsing
params/results/locals, but it's less code to just parse
right-recursive (i.e. backward) and insert everything at the front.
This requires reversing the indexes in the BindingHash too.
* Remove the nasty macros `APPEND_FIELD_TO_LIST`,
`APPEND_ITEM_TO_VECTOR`, `APPEND_INLINE_EXPORT`, and
`CHECK_IMPORT_ORDERING`. This behavior is all handled by
`append_module_fields` now.
* All inline imports/exports are handled by returning additional
ModuleFields in a list. This removes the need for `OptionalExport`,
`ExportedFunc`, `ExportedGlobal`, `ExportedTable`, and
`ExportedMemory`.
* Use "_opt" suffix instead of "non_empty_" prefix, e.g.:
- text_list => text_list_opt, non_empty_text_list => text_list
* The locations changed for some symbols, typically the use the name
following the LPAR now, e.g. (import
^^^^^^
* Add PPA for re2c 0.16
* add -y to skip confirmation on travis
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds a few new classes:
* BinaryReader: the abstract base class
* BinaryReaderNop: implements all of BinaryReader, but does nothing
* BinaryReaderLogging: logs calls through BinaryReader, and forwards to
another BinaryReader
Typically this means we can remove the Context structs from these
implementations, since that data can just move into the BinaryReader
subclasses.
I also took the opportunity to rename the new member functions to
MixedCase instead of snake_case, since that's more common in C++.
|
|
Fixed a few typechecker errors:
* br_table must have consistent type signature for all branch targets
* if without else cannot have a signature
|