summaryrefslogtreecommitdiff
path: root/test/spec/bulk-memory-operations
Commit message (Collapse)AuthorAgeFilesLines
* Update testsuite (#1738)Sam Clegg2021-10-1812-2612/+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 reference types by default (#1729)Sam Clegg2021-10-132-0/+2
| | | | | | | | | 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.
* Enable bulk memory by default (#1728)Sam Clegg2021-10-1312-12/+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
* Avoid writing DataCount section when it is not needed. (#1727)Sam Clegg2021-10-131-5/+2
| | | | | | | | | | | 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.
* [EH] Replace event with tag (#1678)Heejin Ahn2021-06-221-2/+2
| | | | | | | | | | | 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 SIMD support (#1553)Darin Morrison2020-10-261-75/+81
| | | | | | | | | | | | | * 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>
* Remove ref.is_null type parameter (#1474)Ben Smith2020-07-151-5/+2
| | | | | | | | | 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.
* Reference types changes to remove subtyping (#1407)Ben Smith2020-05-282-3/+4
| | | | | | | | 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`
* Enabled merged proposals by default (#1405)Alex Crichton2020-05-061-1/+2
| | | | | | | | | | | | | 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.
* Update testsuite (#1381)Ben Smith2020-03-271-8/+8
| | | | * Add i{8x16,16x8,32x4}.abs instructions * Implement IntAbs in interp-math.h
* Always generate DataCount section, even if number of datas is 0 (#1369)Rian Hunter2020-03-231-2/+5
| | | | | | | | | | | | * 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
* Remove validation from the BinaryReader (#1354)Ben Smith2020-03-115-11/+21
| | | | | | | 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-294-7/+7
| | | | | | 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-273-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-213-83/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix memory/table check to include imported+defined (#1336)Ben Smith2020-02-191-1/+1
|
* Update testsuite (#1327)Sam Clegg2020-02-051-9/+9
| | | | | The main change here is the addition of declared elem sections.
* Omit the DataCount section unless it is required (#1312)Ben Smith2020-01-215-203/+201
| | | | | | | | | | | | | 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).
* Error on memory.init|data.drop without DataCount (#1297)Ben Smith2020-01-101-4/+2
| | | | | | 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.
* Update testsuite (#1275)Sam Clegg2020-01-098-588/+593
| | | | | | | | | | | | | | | | | 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.
* Several fixes for reference types (#1278)Heejin Ahn2020-01-081-1/+1
| | | | | | | - 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)
* Run update-spec-tests.py and add resulting missing tests (#1263)Sam Clegg2019-12-123-0/+317
| | | | This found one bug in the parsing of active elem segments with uncref style elements.
* Update spec testsuite (#1237)Sam Clegg2019-11-228-168/+363
| | | | | | | 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-195-62/+62
| | | | | | | | | | | 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-197-0/+1086
| | | | NFC (#1235)
* Update spec testsuite (#1111)Ben Smith2019-07-166-287/+239
| | | | | * 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-079-0/+1120
* 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