summaryrefslogtreecommitdiff
path: root/test/spec/bulk-memory-operations/table_init.txt
Commit message (Collapse)AuthorAgeFilesLines
* Update testsuite (#1738)Sam Clegg2021-10-181-745/+0
| | | | | | | | | | | 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.
* Enable bulk memory by default (#1728)Sam Clegg2021-10-131-1/+0
| | | | | | | | | | | 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
* Remove validation from the BinaryReader (#1354)Ben Smith2020-03-111-2/+5
| | | | | | | 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.
* Fix TODOs in validator; only affects error outputBen Smith2020-02-291-3/+3
| | | | | | 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.
* Update testsuite (w/ reference-types changes) (#1351)Ben Smith2020-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Always check index before accessing vectors (#1347)Ben Smith2020-02-281-1/+1
| | | | | | | | 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.
* Share validator between IR + binary-reader-interp (#1346)Ben Smith2020-02-271-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* New interpreter (#1330)Ben Smith2020-02-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Omit the DataCount section unless it is required (#1312)Ben Smith2020-01-211-65/+65
| | | | | | | | | | | | | 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).
* Update testsuite (#1275)Sam Clegg2020-01-091-207/+208
| | | | | | | | | | | | | | | | | 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.
* Segment flags should be MVP-compat when possible (#1286)Ben Smith2020-01-081-63/+63
| | | | This should fix #1280, #1268, #1269.
* Update spec testsuite (#1237)Sam Clegg2019-11-221-3/+82
| | | | | | | 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.
* interpreter: Allow traps to include custom error strings (#1236)Sam Clegg2019-11-191-11/+11
| | | | | | | | | | | 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.
* spectest-interp: Report when assert_trap passes and include error string. ↵Sam Clegg2019-11-191-0/+450
| | | | NFC (#1235)
* Update spec testsuite (#1111)Ben Smith2019-07-161-68/+69
| | | | | * Remove passive keyword from bulk-memory * Fix rounding on hex floats * Allow underscores in NaN payloads
* Implement bulk memory in the interpreter (#1074)Ben Smith2019-05-071-0/+211
* 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