| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
| |
Now that we have C++17 we don't need our own string_view class anymore.
Depends on #1825
|
|
|
|
| |
Remove test/binary/bad-function-missing-end.txt which is now
covered upstream: https://github.com/WebAssembly/spec/pull/1405
|
|
|
|
|
|
|
|
| |
This requires `Type::GetName` to return to be dynamicllay created and
return `std::string` rather then a `const char*`
As this diff shows this type name is only used in textual output and
error messages so should this change should not have a effect of binary
parse time or the interpreter.
|
|
|
|
| |
Use `LogOpcodeType` rather than LogOpcodeBare` when the select
instruction has a type.
|
|
|
|
|
|
|
|
|
| |
Tag names are not officially part of the extended-name-section proposal
(because it only deals with naming things that are in the spec already).
However, I think its reasonable (and useful) to include these names
under a speculative subsection ID, on the basis that tags can only exist
when exceptions are enabled and that engines should ignore unknown name
types.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rather than spocial casing them in the reader we now use the same
instruction callbacks for instruction that appear in init expressions as
instructions that appear in normal functions.
The result of this change is the validation of init expressions is pushed
further up the stack. For example, objdump will now quite happily dump
modules that use arbitrary instructions in thier init expressions even
though they are not valid. To me, this makes sense since objdump does
not do instruction validation elsewhere.
The change is pre-cursor to allowing a wider variety of instruction
to be present in init expressions.
See https://github.com/WebAssembly/extended-const
|
| |
|
|
|
|
| |
blocks. (#1695)
|
|
|
|
| |
We already have EndFunctionBody, and this extra distinction
doesn't seem like it is needed.
|
| |
|
| |
|
| |
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
We have the more specific OnFunctionSymbol, OnGlobalSymbol family
of callbacks that is used by objdump.
|
|
|
|
| |
supported call_ref (#1691)
|
|
|
| |
`unwind` was removed. See WebAssembly/exception-handling#156.
|
|
|
|
|
|
|
|
|
|
|
| |
This changes the encoding of the `attribute` field, which currently only
contains the value `0` denoting this tag is for an exception, from
`varuint32` to `uint8`. This field is effectively unused at the moment
and reserved for future use, and it is not likely to need `varuint32`
even in future.
See https://github.com/WebAssembly/exception-handling/pull/162.
This does not change any encoded binaries because `0` is encoded in the
same way both in `varuint32` and `uint8`.
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
This is a new kind of ir/ast node/instruction. It has 3 immediates:
memarg align, memarg offset, and lane index. This required new visitor
functions in all the places.
Drive-by cleanup to share the simd lane parsing logic between shuffle,
lane op and this new load lane instructions. This requires rebasing some
tests because the error messages are slightly different now.
|
|
|
|
| |
This requires a new ir type, and the relevant implementation of virtual
mthods in the various visitors.
|
|
|
| |
Unskip and rebase simd_int_to_int_extend.
|
|
|
| |
Rebase and unskip simd_i64x2_cmp.
|
|
|
| |
Rebase and unskip simd_i32x4_dot_i16x8.
|
|
|
| |
Rebase and unskip simd_i16x8_q15mulr_sat_s.
|
|
|
|
|
|
|
| |
Renumber floating point rounding instructions since they overlap with
these new extmul instructions. Rebase simd_f32x4_rounding and
simd_f64x2_rounding.
Rebase and unskip simd extmul tests.
|
|
|
|
| |
Rebase and unskip simd_i16x8_extadd_pairwise_i8x16.txt and
simd_i32x4_extadd_pairwise_i16x8.
|
|
|
| |
Rebase and unskip simd_i64x2_arith2.txt.
|
|
|
|
| |
Rebase simd_i32x4_trunc_sat_f64x2.txt and
simd_i32x4_trunc_sat_f32x4.txt.
|
|
|
|
|
|
|
|
|
|
|
|
| |
4 double precision conversion instructions are implemented:
- f32x4.demote_f64x2_zero
- f64x2.demote_low_f32x4
- f64x2.convert_low_i32x4_s
- f64x2.convert_low_i32x4_u
This is now sufficient to unskip simd_conversions.txt.
Rebase a bunch of tests due to the rename from widen to extend.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Rename all any_true to v128.any_true
* Add i64x2.bitmask and i64x2.all_true, rebase simd_boolean
* Unskip spec/simd/simd_i16x8_arith2.txt since i64x2.abs is now implemented
* Unskip spec/simd/simd_lane.txt
* Update dump interp tests, rebase
|
|
|
|
|
|
|
|
|
| |
This is an incremental bump of testsuite, the TOT has SIMD tests
which won't work yet.
The main fix is for a test added to the spec repo that has an invalid
functype in the type section. Based on the spec, the functype should be
a single byte 0x60. The leb encoding only comes into effect with the GC
proposal.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Initial attempt at s390x port
* Second attempt at s390x port
* Fix big-endian memory fill
* Fix more memory location calculations
* Improve SIMD
* Implement big-endian memory grow
* Fill relocation with 0x00, as per spec
* Make wasm2c endianness work
* Fix shuffle
* Fix load endianness in wasm2c
* Refactor into shared code
* Clean up SwapBytesSized
* Clean up MemcpyEndianAware
* Clean up
* "Fix" opcodecnt basic test
|
|
|
|
|
|
| |
The reference-types proposal adds a select instruction with a type
vector, but any number greater than 1 is invalid.
Fixes #1577.
|
|
|
| |
See https://reviews.llvm.org/D91276
|
|
|
|
|
|
|
|
| |
atomic.notify -> memory.atomic.notify
i32.atomic.wait -> memory.atomic.wait32
i64.atomic.wait -> memory.atomic.wait64
These were renamed upstream a while ago, but the new names were not
added to wabt.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Update testsuite
* Update test results
* Disallow lane nums with optional + for simd ops
* Update simd support
* Mark `test/spec/func.txt` as failing
Co-authored-by: Darin Morrison <darinmorrison@users.noreply.github.com>
|
|
|
|
|
|
|
|
| |
See: https://github.com/WebAssembly/extended-name-section
Although this is only a phase 1 proposal its seems pretty
straight forward, and is already being implemented in
binaryen.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We add relocations for table numbers on each place where we reify a
table number (call_indirect, table.get, table.set...), but only if
reference types are enabled.
Also, fix symbol table generation with unnamed definitions, to allow for
relocating references to anonymous functions or tables.
As tests, add variants of the relocations and symbol-tables dump tests,
with and without all features enabled. Enabling reference types causes
relocs to be emitted. We also add --details to the relocations dump
tests, so that we can see the target symbols for the relocations.
|
|
|
|
| |
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.
|
| |
|