| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
bulk-memory-operations and reference-types were completely
removed from the upstream testsuite becuase there were
merged into the upstream spec:
https://github.com/WebAssembly/testsuite/pull/44
In order to land this I had to disable several spec tests
under wasm2c because it lacks support for mutli-table and
reference types. I filed #1737 to track this.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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/reference-types/issues/99.
This change also updates the testsuite, so the spec tests pass too.
In addition, the behavior of `br_table` is no longer different from MVP,
and has a text to confirm this. That is now fixed in `type-checker.cc`
too.
|
|
|
|
|
|
|
|
| |
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`
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
* Add i{8x16,16x8,32x4}.abs instructions
* Implement IntAbs in interp-math.h
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Always generate DataCount section, even if number of datas is 0
The bulk-memory spec requires that a DataCount section is always
present if a memory.init or data.drop instruction is present in
the following code section. This requirement remains even if the
number of datas is 0, so remove that condition.
Fixes #1368
* Fix tests
|
|
|
|
|
|
|
| |
Validation should only happen in ValidateModule, BinaryReader should
only check whether the binary is malformed.
This change also fixes a few places in BinaryReaderIR where an index is
assumed to be valid.
|
|
|
|
|
|
| |
The major change to the error output is showing the max value instead of
max value - 1. It's a bit weird to see "out of range: 0 (max 0)" but
seeing 4294967295 is strictly worse.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new table-sub test, checks whether the subtyping is handled
properly w/ table.init and table.copy instructions.
The BeginElemSegment callback can't pass the element type anymore, since
it's not known yet. The callback also can't be deferred, since the
BeginElemSegmentInitExpr callback has to happen after the
BeginElemSegment callback, but the reference type is not always known
until after the initializer expression is read. To work around this, I
added a new OnElemSegmentElemType callback.
Other element segment changes:
* The element type must be tracked in the SharedValidator
* A subtle fix: when writing out the segment flags, we need to take into
account whether the element type of the segment is not funcref, even
if there are no element expressions. In that case, we have to use flag
bit 0x4 (SegUseElemExprs).
In addition, the TableCopy and TableInit instructions weren't handling
table indexes fully.
* TableCopy variables are read in the parser (both optional)
* TableCopy names are now resolved + applied
* TableCopy indexes are now validated
* TableInit table variables are read in the parser; this is subtle,
since the text format has order $table $segment, but the $table is
optional.
|
|
|
|
|
|
|
|
| |
Since the validator tries to print as many errors as possible, it
shouldn't stop when the index is invalid (since this may produce future
errors). Instead it uses a default value.
This is encoded in a new function called CheckIndexWithValue, which
either accesses the vector, or uses a default value.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The TypeChecker was already shared, but the rest of the other validation
logic was duplicated. This change creates a SharedValidator which is
used by both the Validator and the BinaryReaderInterp classes.
The validator is structured similarly to TypeChecker as a collection of
functions. It's assumed that the functions will be called in the same
order as sections occur in the binary format. The IR valiator does this
too, even though it's possible to validate components out-of-order in
that case.
This change also splits Module validation and Script validation into two
different classes. It should have been written this way in the first
place, and it's nice to do as part of this change since the module
validator logic is mostly moved into the SharedValidator anyway.
Next steps:
* Remove all validation from BinaryReader and move it into the
SharedValidator.
* Move the TypeChecker into the SharedValidator (maybe not necessary)
* Ensure that validation occurs before creating IR from binary (use
SharedValidator in BinaryReaderIR? or maybe create
BinaryReaderValidator passthru that both BinaryReaderIR and
BinaryReaderInterp use?)
* Rename Validator -> IRValidator, SharedValidator -> Validator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's modeled closely on the wasm-c-api. All runtime objects are
garbage-collected. The GC'd objects are subclasses of `Object` and all
stored in the `Store`. GC roots can be created using a RefPtr<T> struct.
The `Module` stores no runtime objects, only description structs (named
`*Desc`, e.g. `FuncDesc`). Instantiation takes these descriptors and
turns them into runtime objects (e.g. `FuncDesc` is used to create a
`Func`). Only import-matching occurs during instantiation; all other
validation is assumed to have occurred during Module compilation.
As with the previous interpreter, the wasm instructions are not executed
directly, and instead compiled to an instruction stream that is easier
to interpret (e.g. all branches become gotos). It's still a stack
machine, though.
The previous interpreter would always compile and instantiate in one
step, which means that it was always known whether an imported function
is a host function or wasm function. As a result, calls between modules
that stayed in wasm could be very cheap (just update PC). Now that the
module is compiled before instantiation, an imported function call
always has to check first, which may be a slight performance hit.
One major difference to the structure of the interpreter is that
floating-point values are passed directly, instead of using their
equivalent bit pattern. This is more convenient in general, but requires
annotating all functions with WABT_VECTORCALL so Visual Studio x86 works
properly (otherwise floats are passed in the x87 FP stack).
Instruction stream decoding/tracing/disassembling is now all handled in
the `Istream` class. This reduces a lot of duplication between the
three, which makes the logging-all-opcodes and tracing-all-opcodes less
valuable, so I've removed them.
Here are the changes to files:
binary-reader-metadata.{h,cc} -> [removed]
interp-{disassemble.trace}.cc -> istream.{h,cc}
There are new helper files:
interp-util.{h,cc}: Primarily print debugging functions
interp-math.h: Templates used for handling wasm math
|
| |
|
|
|
|
|
| |
The main change here is the addition of declared elem sections.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
See #1189 and #1311. Even if bulk memory is enabled, it can be
convenient to omit the DataCount section for MVP compatibility.
This change only includes the DataCount section when an instruction
requires it; either `data.drop` or `memory.init`. It is also omitted if
there are no data segments.
Rather than doing a second pass on the instructions, this implementation
unconditionally writes the DataCount section, but removes it when it is
not needed. This required adding a function to truncate a stream
(Stream::Truncate).
|
|
|
|
|
|
| |
See #1176. This was working in the spec interpreter because of the way
the segment indexes are handled, but it's better to handle it earlier in
the binary reader.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The two primary changes involved are:
1. Removal of `assert_return_canonical_nan`/`arithetic nan` in favor of
special `nan:canonical`/`nan:arithmetic` constants that can only be
used in test expectations.
See: https://github.com/WebAssembly/spec/pull/1104
2. New trapping behaviour for bulk memory operations. Range checks are
now performed up front for opterations such as memory.fill and
memory.copy.
See: https://github.com/webassembly/bulk-memory-operations/issues/111
And: https://github.com/webassembly/bulk-memory-operations/pull/123
The old behaviour is still kept around to support table.fill which
is defined in reference-types proposal and has yet to be updated.
|
|
|
|
| |
This should fix #1280, #1268, #1269.
|
|
|
|
|
|
|
| |
- Allow `ref.func` for global initialization expressions
- Allow `nullref` as a full-fledged type, after
WebAssembly/reference-types#66
- Enable reference types when exnref is used (The reference types
proposal is a prerequisite of the EH proposal)
|
|
|
|
| |
This found one bug in the parsing of active elem segments with
uncref style elements.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
This means we can give more precise/useful errors for runtime failures.
Change interp::Result from an enum to struct so it can hold the
result enum plus an optional detailed error message.
Add TRAP_MSG and TRAP_IF_MSG macros that work just like TRAP and
TRAP_IF but contain a format string and printf-like arguments which
are formatted to produce the error message.
|
|
|
|
| |
NFC (#1235)
|
|
|
|
|
| |
* Remove passive keyword from bulk-memory
* Fix rounding on hex floats
* Allow underscores in NaN payloads
|
|
* Implement bulk memory in interpreter
* Read/Write elem_type in element segments
* Binary format
* Text format (`(elem passive funcref...)`)
* Add DataSegment runtime objects
* Only initialize active data segments when instantiating
|