| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
It's legal in the wasm format to have a local type count of 0. I
originally made it illegal to fix a wabt bug, and didn't notice because
there were no spec tests for this behavior.
|
|
|
|
|
|
|
|
|
| |
Also:
* Add feature limits on using v128 and anyref types (requires
--enable-simd and --enable-reference-types respectively).
* Separate out ParseValueType (used for params, locals, global types)
from ParseRefType (used for table types).
|
|
|
|
|
|
| |
* Added except_ref to be legal in a block type signature
* Added more support for event symbols.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add support for the reference types proposal
This commit adds support for the reference types proposal to wabt.
Namely it adds new opcodes like `table.{get,set,grow}` as well as adds a
new `anyref` type. These are plumbed throughout for various operations
in relatively simple fashions, no support was added for a subtyping
relationship between `anyref` and `anyfunc` just yet.
This also raises the restriction that multiple tables are disallowed,
allowing multiple tables to exist when `--enable-reference-types` is
passed.
* Allow nonzero table indices in `call_indirect`
Plumb support throughout for the `call_indirect` instruction (and
`return_call_indirect`) to work with multi-table modules according to
the reference types proposal.
|
|
|
|
|
|
| |
It takes two u32 immediates: the branch depth and an exception index. The
stack signature is `[expect_ref] -> [except_ref]`, so the `except_ref`
can be tested easily against multiple exception types.
|
|
|
|
|
|
|
|
|
|
|
|
| |
An event has a type-section index, like a function definition. The
current proposal doesn't specify the text format, so I assumed that it
would match the format of the other sections that reference function
types. This means that the following declaration styles are allowed:
```
(type $t (func (param i32)))
(event $e1 (type $t))
(event $e2 (param f32))
```
|
| |
|
|
|
|
|
|
|
| |
The exception section is now a known section with code 13, and is known
as the "Event" section.
The structure of the section has changed too, but I'll fix that in
another PR.
|
|
|
|
| |
It is no longer part of the exception proposal.
|
|
|
| |
Carrying over renames from WebAssembly/bulk-memory-operations#46
|
|
|
|
|
|
| |
This commit updates wabt wrt to two recent PRs:
* WebAssembly/bulk-memory-operations#43
* WebAssembly/bulk-memory-operations#45
|
| |
|
|
|
|
|
| |
Also make explicit when are showing log2 alignment.
We could instead display actual byte alignment (1 << p2align)?
|
|
|
|
|
|
|
|
| |
This huge PR does all the renaming as described in issue #933. It also
updates to the latest testsuite so the new names are used.
The old names of the MVP instructions are still supported for
convenience (though we should remove those too at some point), but the
old simd and atomic instruction names are no longer supported.
|
|
|
| |
This is useful for finding large functions with wasm-objdump.
|
|
|
|
|
| |
This field was recently added:
https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md
|
|
|
|
|
|
| |
If the function section is present, and has a non-zero count, then if
the code section is absent the module should not validate.
If either section is missing, but the count is zero it is OK.
|
|
|
|
|
| |
See: https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md
|
|
|
|
| |
Also fix bug when parsing elem/data segment; the table/memory index is
stored as an LEB128, not a U8.
|
|
|
|
|
|
| |
It's easy to forget to add a check for unexpected opcodes, and it's
tedious to have to write additional tests in `test/binary/*`.
This way we can test all potentially disabled instructions at once.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix a few places where `call`/`call_indirect` are used instead of
`return_call`, `return_call_indirect`
* Fix `TypeChecker::CheckReturnSignature` to print a better error when
the signatures don't match.
* Don't allow `return_call`/`return_call_indirect` instructions in the
parser unless the tail-call feature is enabled.
* Support folding of `return_call`/`return_call_indirect`
Fixes #929.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Allow for names in data/elem segments:
```
(data $foo (i32.const 0) "abcdef")
```
* These names can be referenced by the memory/table instructions that
operate on segments:
```
memory.drop $foo
```
* Fix running wasm-objdump with bulk-memory instructions
* Check for valid data/elem segments in validation
* Check that bulk-memory is enabled when parsing text
Partial fix for #928; still needs interpreter checks too.
|
|
|
|
|
|
| |
return_call
return_call_indirect
with some simple tests thereof.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit starts to add support in wabt's various tools for the
upcoming [bulk memory proposal][1]. This is based off the current
proposal's overview, although these may get tweaked over time!
This is also the first time I've significantly contributed to wabt, and
what I thought would be a relatively simple addition ended up being much
larger than I imagined! I didn't add many negative tests yet but if more
tests are desired please let me know!
[1]: https://github.com/webassembly/bulk-memory-operations
|
|
|
|
|
| |
The spec requires that the reserved bytes in `call_indirect`,
`memory.grow`, and `memory.size` to be one zero byte. This means that we
cannot accept `0x80 0x00`, or other "long" LEB128 encodings of zero.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`ErrorHandler` complicated all error handling in wabt, since it was
callback-based. Callbacks would be useful if we ever wanted to change
behavior when an error occurred, but instead all that the handler ever
did was write the errors to stdout/stderr or to a buffer.
This change adds a new class `Error`, which contains an `ErrorLevel`, a
`Location` and an error message. It also replaces ErrorHandler with
`Errors` (a typedef for `std::vector<Error>`), and adds a couple of
functions that can format a list of `Errors` for output:
`FormatErrorsTo{String,File}`.
|
| |
|
|
|
| |
The maximum number of locals in a function is 2**32-1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
| |
`grow_memory` -> `memory.grow`
`current_memory` -> `memory.size`
This could have been a smaller change, but I took the opportunity to
rename the Token types, Expr types, and callback functions too. Many of
these are sorted alphabetically, so I resorted based on their new names.
|
| |
|
|
|
|
|
|
|
| |
The previous message said "error", which makes it look like the output
is not created, so change the message to "warning" instead.
The error handling code is pretty ugly and can use a refactor, but that
would be a much larger change.
|
| |
|
|
|
|
|
| |
If the `stop_on_first_error` flag was set, it would still stop
reading the wasm file, even if `--ignore-custom-section-errors` flag was
set.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a wasm engine fails to parse a custom section, it must not be an
error. In wabt we often won't want to continue if a custom section can't
be parsed, but it still may be useful to be able to continue.
This change adds a new flag `--ignore-custom-section-errors` to
`wasm2wat` and `wasm-validate`, which will partially parse a custom
section with errors. This could lead to some strange behavior (partially
completed data structures), but generally should be safe to do.
See issue #378 and the discussion on pull #830 for more info.
|
|
|
|
| |
Also add parsing of linking metadata version.
|
| |
|
|
|
|
|
|
| |
Also clean up `LocalTypes` a bit, so we can ensure that `decls_` never
has a count of 0.
Fixes issue #826. Thanks for finding @opticaliqlusion!
|
|
|
| |
See issue #823.
|
|
|
|
|
|
|
|
| |
See https://github.com/WebAssembly/wabt/issues/760 for more info.
We assume that a count precedes a list of items that are at least one
byte that are all contained in the same section. As a result, we can do
an up-front check to prevent over-allocation. This is the same technique
that the spec interpreter uses.
|
|
|
|
| |
I also fixed some for/if to use braces if I noticed it. This is a
non-functional change.
|
| |
|
|
|
|
|
|
|
|
|
| |
Including:
i8x16.replace_lane
i16x8.replace_lane
i32x4.replace_lane
i64x2.replace_lane
f32x4.replace_lane
f64x2.replace_lane
|
|
|
|
|
|
|
|
|
|
| |
Including:
i8x16.extract_lane_u
i16x8.extract_lane_s
i16x8.extract_lane_u
i32x4.extract_lane
i64x2.extract_lane
f32x4.extract_lane
f64x2.extract_lane
|
|
|
|
|
| |
Including:
1. All necessary code for SIMD lanes accessing.
2. i8x16.extract_lane_s implementation.
|
| |
|
|
|
|
|
|
|
| |
Including:
i32x4.trunc_s/f32x4:sat
i32x4.trunc_u/f32x4:sat
i64x2.trunc_s/f64x2:sat
i64x2.trunc_u/f64x2:sat
|
|
|
|
|
|
|
| |
Including:
f32x4.convert_s/i32x4
f32x4.convert_u/i32x4
f64x2.convert_s/i64x2
f64x2.convert_u/i64x2
|
| |
|