| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
This pull request implements EHv4. Binary is mostly untested until
interp is working.
|
|
|
|
| |
This adds support in the binary/text parsers and writers,
the validator and interpreter, and objdump (but not wasm2c).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Even when the result is to be printed rather than compared byte for byte
with the first version its still good to process the resulting wat
output file so that we know we can parse what we generate.
Case in point, this changed caused me to fix two latent bugs:
1. We were not correctly parsing events with inline import/export.
2. We were output element segment names even when bulk memory
was not enabled (See #1651)
The fix for (2) is a little more involved that we might like since for
the first time the wat writer needs to know what features are enabled.
Fixes: #1651
|
|
|
|
| |
Fixes #1687
|
| |
|
| |
|
|
|
|
|
| |
Support \u{hex} escape sequences for string literals.
These literals are converted to UTF-8 characters.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
blocks. (#1695)
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
* SIMD is now phase 5, enable it by default
* Update test flags, rebase test, and docs
|
|
|
|
| |
supported call_ref (#1691)
|
|
|
|
|
|
| |
Matches recent changes in the exception handling spec that allowed
this case to reduce special cases in the syntax:
https://github.com/WebAssembly/exception-handling/pull/157
|
|
|
| |
`unwind` was removed. See WebAssembly/exception-handling#156.
|
|
|
|
|
|
|
| |
This is similar to a previous bug (#1609) for other kinds of block labels.
The tests check that 2+ adjacent try-delegate blocks will have labels that print correctly.
(split from #1675)
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
| |
I noticed we lacked support here while debugging #1651.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 makes labels consistent with non-folded printing when
multiple blocks are in function or block body.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
These uncovered some things the previous tests didn't!
Also required the switching of the location of the index as discussed in https://github.com/WebAssembly/memory64/issues/5
Also one small .py change that ensures the new tests have consistent posix paths.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
| |
Fixes regressions in binary reader introduced by the implementation of
the memory64 extension: https://github.com/WebAssembly/wabt/pull/1500.
|
|
|
|
|
|
|
|
|
| |
* Fix bug when writing multi-value block type
The block type must be written as an SLEB, not an LEB. We also want it
to be relocatable, so I added a way to write a fixed-size SLEB too
(`WriteS32Leb128WithReloc` and `WriteFixedS32Leb128`).
* Fix ubsan issue
|
| |
|
| |
|
| |
|
|
|
|
| |
Also remove default case from `ir-util.cc` so we get compile warnings in
the future.
|
|
|
|
|
|
|
| |
* The `declare` keyword should be printed when using element expressions
or element indexes (i.e. flags == 3 or flags == 7).
* An imported table was not properly setting the element type in the IR
Fixes #1448 and #1449.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The main fix is in `wat-writer.cc`, where the type immediate was never
being printed. But I've also included a change to how `select` type
immediates are represented in wabt.
Previously, a bare `select` instruction would be stored with the type
`Type::Any`. This is not a real wasm type, and is primarily used for
type validation. The spec instead considers this form of `select` to
have an empty type immediate, which is closer to the `Type::Void` type.
This commit now uses `Type::Void` (or an empty `TypeVector`) to
represent the bare `select` instruction.
Fixes #1444.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* [wasm2wat] Write table index when non-zero
It was already being properly written to binary, and read from binary
into IR. It just wasn't been written out to wat.
Fixes #1443.
* Also write table indexes for table.{init,copy}
Fixes #1445
|
|
|
|
|
|
|
|
| |
Main changes:
* Rename `anyref` -> `externref`
* Remove `nullref`
* Rename `hostref` -> `externref`
* `ref.null` and `ref.is_null` now have "ref kind" parameter
* Add ref kind keywords: `func`, `extern`, `exn`
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For example:
```
(try $label (param ...) (result ...)
(do ...)
(catch ...)
)
```
See comment here:
https://github.com/WebAssembly/exception-handling/issues/52#issuecomment-626696720
|
|
|
|
|
|
|
|
|
|
| |
A named parameter (or local) must always be in its own `param` block, so
this syntax is not allowed:
`(param i32 $b i32)`
And must instead be converted to:
`(param i32) (param $b i32)`
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This enables three proposals by default since they've been merged into
the upstream specification:
* `saturating-float-to-int` - WebAssembly/spec#1143
* `sign-extension` - WebAssembly/spec#1144
* `multi-value` - WebAssembly/spec#1145
Most of the fallout from this is in the test suite with lots of
`--enable` flags getting removed and some tests which now
unconditionally pass also getting removed. Two spec tests explicitly
pass `--disable` until the spec test submodule is updated.
|
|
|
|
|
| |
See https://github.com/WebAssembly/threads/pull/141 for the binary
encoding. This patch does add a field to AtomicFenceExpr for the
consistency model, though without a type for the time being.
|
|
|
| |
Fixes #1227.
|
|
|
|
| |
Fixes #1226.
|
| |
|
|
|
|
|
|
|
| |
The only major change to the interpreter is to move segment
initialization out `ReadBinaryInterp` (in the binary reader) and into
interp.cc. This is because the test suite now expects out of bound
semgments to be reported during initialization rather than reported
as validation errors.
|
|
|
|
|
|
|
|
| |
format (#1219)
The overview document was incorrect until recently which I imagine is
why wabt got this wrong initially.
See https://github.com/WebAssembly/reference-types/issues/59
|
|
|
|
|
| |
* Remove passive keyword from bulk-memory
* Fix rounding on hex floats
* Allow underscores in NaN payloads
|