summaryrefslogtreecommitdiff
path: root/src/interp/binary-reader-interp.cc
Commit message (Collapse)AuthorAgeFilesLines
...
* Update spec testsuite (#1237)Sam Clegg2019-11-221-106/+14
| | | | | | | 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.
* Switch to treating segment flags as a bitfield. NFC (#1232)Sam Clegg2019-11-181-12/+12
| | | | | | | | | | | This is in preparation for updating to latest version reference-types proposal where there is an additional flag and they can be combined. See: https://github.com/WebAssembly/bulk-memory-operations/issues/98 Also, add ERROR_IF to binary-reader.cc as logical corollary to the existing ERROR_UNLESS.
* reference-types: implement type checking for table.get/table.set (#1221)Sam Clegg2019-11-151-4/+10
| | | | | | Tests will follow in the form of the spec tests from the reference-types repo. See: #1223
* reference-types: Add multi-table support to the interpreter (#1218)Sam Clegg2019-11-141-28/+42
| | | | | | | | | | This involved plumbing the table argument for `table.init` and `table.copy` all the way through rather than assuming they were always zero. Update the rather complex logic for assigning names to elem segments to handle active elem segments which both name themselves and the table they apply too.
* reference-types: Improve reftype support (#1220)Sam Clegg2019-11-141-1/+1
| | | | | | | | | | | | | | | Add Hostref type which is an internal subtype of anyref used to refer to host objects. Since anyref is an abstract base type it should be be stored directly on the value stack. The value stack instead must contain refs of the concrete RefType enumeration (currently Null, Func, or Foreign). These changes are needed for the implementation of the C API but are separately useful for improving conformance with the reftype proposal. Implement sub-typing rules for parameters and results when using CallFunction in the interpreter.
* Rename v128_bits to simply vec128 since this is stored natively (#1207)Sam Clegg2019-11-111-1/+1
| | | | | | | The _bits suffix is used the floating point types where we use types that differ from the native C types. For v128 we have a native struct type that we store and manipulate directly. Also remove the unneeded bitcast operations.
* Allow anyref globals to store ref subtypes (#1214)Sam Clegg2019-11-081-5/+4
| | | | This requires the type of a global to be distinct from its current TypedValue contents.
* interpreter: Move `env` member up to Module base class. (#1215)Sam Clegg2019-11-081-1/+1
| | | | | | | | | This is needed as part of implementing the C API on top of the interpreter. Also remove the trailing `_` to match other struct members in this file. Also remove unneeded forward decls.
* Initial implementation of reftype proposal in the interpreter. (#1206)Sam Clegg2019-11-071-10/+49
| | | | - Implement ref.func everywhere. - Implement table.get and table.set in the interpreter.
* Remove some used classes/members from the interpreter (#1204)Sam Clegg2019-11-071-36/+27
| | | | This change also makes it easier to add an alternative import resolver that is needed for implementing the C API.
* Add support for ref.null in global initializers (#1131)Andy Wingo2019-07-251-0/+6
| | | | | | | | | As per the reference-types spec, ref.null is a constant expression. I did try to add support for ref.func at the same time, but I didn't really understand the strategy of wabt and reference types; there seems to be strong intertwingliness between func.ref and the element section, whereas it does seem possible for a func.ref to be global. Oh well, I didn't need it :)
* Add support for v8x16.swizzle and the load_splats. (#1116)nlewycky2019-07-191-0/+15
| | | | | | | | | | | | | | | | | | | * Add support for v8x16.shuffle1 and v8x16.shuffle2_imm. v8x16.shuffle2_imm is a rename of the previous v8x16.shuffle, but I add a copy of the code as if it were a new instruction in case the spec proposal makes further changes. The tests for old v8x16.shuffle remain in place and while there are new tests for the new v8x16.shuffle1, there are not for v8x16.shuffle2_imm. The behaviour and implementation are the same as for v8x16.shuffle, so we should simply search and replace the existing tests at some point, leaving one of them untested, probably the deprecated v8x16.shuffle. I did test v8x16.shuffle1 against the SIMD spec test from WAVM and it passes. The WAVM spec tests for v8x16.shuffle2_imm parse but it has no invocations of the instruction. * Rename v8x16.shuffle1 and x8v16.shuffle2_imm to v8x16.swizzle and v8x16.shuffle_imm. * Update SIMD operands. * Swizzle is just a binary operator. * Shuffle is named "v8x16.shuffle". * Add 4 new opcodes for load_splat. * Remove legacy 0xfd 0x03 opcode for shuffle. * Test all four load splats.
* Fix value dropping bug in return_call (#1112)Ben Smith2019-07-151-21/+50
| | | | | | | | | | The previous implementation was not properly dropping values on the stack when performing a return_call or return_call_indirect. In particular, the "keep count" (i.e. the number of values to keep that are on the top of the stack) was set properly, but the "drop count" (the number of values to drop below the keep count), was not. This fixes issue #1108.
* Fix wasm-interp assertions (#1092)Ben Smith2019-06-071-2/+39
| | | | | | | | * i32 init expression in data/elem segments * Instructions after the last "end" instruction of the function (the function label has been popped) Fixes #1089, #1090, #1091
* Implement bulk memory in the interpreter (#1074)Ben Smith2019-05-071-48/+272
| | | | | | | | | * 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
* Proper encoding of passive element segments (#1066)Ben Smith2019-04-181-8/+15
| | | | | * Store element segments as a vector of `ElemExpr`, instead of func index * Read/write binary format for each element expression * Read/write text format for each element expression
* Add support for the reference types proposal (#938)Alex Crichton2019-02-141-5/+5
| | | | | | | | | | | | | | | | | | | | * Add support for the reference types proposal This commit adds support for the reference types proposal to wabt. Namely it adds new opcodes like `table.{get,set,grow}` as well as adds a new `anyref` type. These are plumbed throughout for various operations in relatively simple fashions, no support was added for a subtyping relationship between `anyref` and `anyfunc` just yet. This also raises the restriction that multiple tables are disallowed, allowing multiple tables to exist when `--enable-reference-types` is passed. * Allow nonzero table indices in `call_indirect` Plumb support throughout for the `call_indirect` instruction (and `return_call_indirect`) to work with multi-table modules according to the reference types proposal.
* Rename exception -> event (#1013)Ben Smith2019-02-111-2/+2
|
* The great renaming (#985)Ben Smith2018-12-191-29/+29
| | | | | | | | This huge PR does all the renaming as described in issue #933. It also updates to the latest testsuite so the new names are used. The old names of the MVP instructions are still supported for convenience (though we should remove those too at some point), but the old simd and atomic instruction names are no longer supported.
* Pass function body size in BinaryReader callback (#975)Ben Smith2018-12-121-2/+2
| | | This is useful for finding large functions with wasm-objdump.
* Implemented tail call instructions: (#926)Francis McCabe2018-10-121-0/+48
| | | | | | return_call return_call_indirect with some simple tests thereof.
* Refactor interpreter a bit (#919)Ben Smith2018-10-021-0/+1584
* Create src/interp/ directory * Move Thread::Trace into src/interp/interp-trace.cc * Move Environment::Disassemble into src/interp/interp-disassemble.cc * Move shared code into src/interp/interp-internal.h