| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
Decode just enough of the component binary format to recognize when the
input is a component, and issue a dedicated error message for it.
Before:
0000008: error: bad wasm file version: 0x1000d (expected 0x1)
After:
0000008: error: wasm components are not yet supported in this tool
|
|
|
|
| |
This adds support in the binary/text parsers and writers,
the validator and interpreter, and objdump (but not wasm2c).
|
| |
|
|
|
|
|
| |
See https://github.com/WebAssembly/memory64/issues/51
Includes workaround for #2422
|
|
|
| |
See https://github.com/llvm/llvm-project/pull/81539
|
|
|
|
| |
Previously: local[0..4294967295]
Current: local[]
|
|
|
| |
See https://github.com/llvm/llvm-project/pull/67493
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* memory64: when enabled, offset range check is at validation-time
Before memory64, the "offset" in a load/store expression was
a u32, and we enforced this in the WastParser and BinaryReader.
After memory64, the "offset" becomes a u64 syntactically, and the
validator checks that it's <= UINT32_MAX for i32 memories.
We hadn't been correctly allowing these very large offsets
in the text format (even when memory64 was enabled and the memory
was i64).
(This change also eliminates the "memories" member in the
BinaryReader. The BinaryReader no longer needs to keep track
of the memories and their types to check well-formedness.)
|
| |
|
| |
|
|
|
|
|
| |
* binary-reader.cc: expand max local count and fix error message
Fixes #1593
|
|
|
|
|
| |
Fixes #1922, fixes #1924, fixes #1929
Co-authored-by: Keith Winstein <keithw@cs.stanford.edu>
|
| |
|
|
|
|
|
|
|
| |
This is purely a performance optimization for wasm-objdump since it
doesn't always need to decode function bodies.
For a very large wasm file that I was testing this takes the time taken
for `wasm-objdump -h` from 8.6s to 1.5s.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
See https://github.com/WebAssembly/tool-conventions/blob/main/CodeMetadata.md for the specification.
In particular this pr implements the following:
- Parsing code metadata sections in BinaryReader, providing appropriate callbacks that a BinaryReaderDelegate can implement:
- BinaryReaderObjdump: show the sections in a human-readable form
- BinaryReaderIr: add code metadata in the IR as expressions
- Parsing code metadata annotations in text format, adding them in the IR like the BinaryReaderIR does
- Writing the code metadata present in the IR in the proper sections when converting IR to binary
- Support in wasm-decompiler for showing code metadata as comments in the pseudo-code
All the features have corresponding tests.
Support for code metadata is gated through the --enable-code-metadata feature. For reading/writing in the text format, --enable-annotations is also required.
Missing features:
Support for function-level code metadata (offset 0)
Extensive validation in validator.cc (like making sure that all metadata instances are at the same code offset of an instruction)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When data of element segment init fails we were reporting the size, but
we were unconditionally calling `Drop` for active segments which meant
they always get reported as zero sized in the error message.
This mismatch was only showing up with bulk memory enabled (since
without this we do a two phase initialization). The only test we have
for this error message was using `--disable-bulk-memory`, but not for
any good reason (most likely because of this very bug).
Also restore the comment about why we sometimes need to do a two phase
initialization for element and data segments. This comment was lost in
PR #1330 but seem important since I don't think we have any tests for
this older behaviour.
|
|
|
|
| |
Remove test/binary/bad-function-missing-end.txt which is now
covered upstream: https://github.com/WebAssembly/spec/pull/1405
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This finishes #985. This
- replaces the old names in the tests with the new names
- drops support for the deprecated names
- renames test files to match new instruction names
I don't think dropping support for the old names will be a problem at
this point. #985 says the old names are supported for convenience but we
should remove those too at some point; that "some point" may have well
arrived given that three years have passed.
The lists of names updated are in #933, #1564, WebAssembly/spec#720.
|
|
|
|
|
|
|
|
|
|
| |
catches. NFC (#1784)
If you leave stuff on the stack at the end of an initializer
expression use the same mechanims to report the error as we
do for functions etc.
In addition, improve such errors so its more obvious what is
going on.
|
|
|
| |
I guess the spec tests don't include such a test.
|
|
|
|
| |
We already have EndFunctionBody, and this extra distinction
doesn't seem like it is needed.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
This features was finished earlier this year:
https://github.com/WebAssembly/proposals/blob/master/finished-proposals.md
One thing to note is that the version of the spec tests we currently
have in third_party/testsuite doesn't have ref types merged yet so
this change disables ref types when running some of those tests. This
can be removed in a followup when we update the testsuite.
|
|
|
|
|
|
|
|
|
|
|
| |
This features was finished earlier this year:
https://github.com/WebAssembly/proposals/blob/master/finished-proposals.md
One thing to note is that the version of the spec tests we currently
have in third_party/testsuite doesn't have bulk memory merged yet so
this change disables bulk memory when running some of those tests. This
will be removed in a followup when we update the testsuite.
Fixes: #1717
|
|
|
|
|
|
|
|
|
|
|
| |
Without this change, when bulk memory is enabled, the DataCount is
always written when then removed if it proves that its not needed by any
instruction.
However, if we know there are no data segments we can avoid writing it
altogether. This happens to be more compact but I'm hoping to land this
now in anticipation of enabled bulk memory by default. Once we do that
we don't want all the `dump` tests to include the writing and truncating
of the DataCount section in cases when there is no data.
|
|
|
|
| |
If the module has no memory, the we try to copy the passive data segment
to memories[0], and memories is a size 0 vector, which is UB.
|
|
|
|
|
| |
* SIMD is now phase 5, enable it by default
* Update test flags, rebase test, and docs
|
|
|
|
|
|
|
|
| |
This section is now based on sub-sections making it more
extensible.
See also:
llvm change: https://reviews.llvm.org/D109595
binaryen change: https://github.com/WebAssembly/binaryen/pull/4141
|
|
|
| |
See https://reviews.llvm.org/D109426
|
|
|
|
|
|
|
|
|
|
|
| |
We recently decided to change 'event' to 'tag', and 'event section' to
'tag section', out of the rationale that the section contains a
generalized tag that references a type, which may be used for something
other than exceptions, and the name 'event' can be confusing in the web
context.
See
- https://github.com/WebAssembly/exception-handling/issues/159#issuecomment-857910130
- https://github.com/WebAssembly/exception-handling/pull/161
|
|
|
| |
Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30792
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Give `catch_all` its own opcode:
Previously `catch_all` shared an opcode with `else`, but
the spec now allocates it the 0x19 opcode.
Adjust rethrow depth semantics:
Previously this had interpreted the rethrow depth argument
as counting only catch blocks, but the spec has clarified that
it should count all blocks (in a similar fashion as `br` and
related instructions).
|
|
|
|
|
|
|
|
|
|
| |
This PR updates the support of exception handling to the latest proposal (that is compatible with future 2-phase exception handling) described in https://github.com/WebAssembly/exception-handling/pull/137 and https://github.com/WebAssembly/exception-handling/pull/143.
* Adds back tagged `catch $e`, `catch_all`, and `rethrow N` from a previous version of wabt, but with updates to match the current spec (e.g., `catch_all` shares an opcode with `else`, `rethrow`'s depth indexes only catch blocks, etc).
* Adds `unwind` and `delegate` instructions.
* Removes `exnref` and `br_on_exn`.
* Updates relevant tests.
There are some details that could still change (e.g., maybe how `delegate`'s depth is validated), but I'd be happy to submit further PRs if the spec details change.
|
|
|
|
| |
I'm not sure why we were using stdout but the convention is normally to
write all logging and error message to stderr.
|
|
|
| |
Signed-off-by: Radu M <root@radu.sh>
|
|
|
|
| |
Fixes regressions in binary reader introduced by the implementation of
the memory64 extension: https://github.com/WebAssembly/wabt/pull/1500.
|
|
|
|
| |
If bulk memory extension is disabled, do not allow memory index in the
data segment other than zero.
|
|
|
|
| |
Fixes: #1520
|
| |
|
|
|
| |
Found by oss-fuzz.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Read memory/table limits flags as uint8_t
In the wasm spec the limits flag is a single byte, not a LEB128 encoded
value.
* Detect malformed memory/table limits flag
* Disallow shared memory when threads are disabled
This adds additional check to disallow "is_shared" (0x2) flag for
memory limits when threads extensions is not enabled. Previously this
flag was unconditionally accepted.
|
|
|
|
| |
The section code is just a single byte, not a LEB128-encoded value.
With this fix the section code is now read correctly with ReadU8().
|
| |
|
|
|
|
|
|
|
| |
Function types and struct types share an index space, but a function can
only be defined using a function type.
Since `Module::GetFuncType` already returns `nullptr` for an OOB index,
it makes sense to return `nullptr` for an invalid type too.
|
|
|
| |
Fixes issue #1453.
|