summaryrefslogtreecommitdiff
path: root/src/binary-reader.cc
Commit message (Collapse)AuthorAgeFilesLines
...
* [simd] Update instructions (#1317)Ben Smith2020-01-271-11/+17
| | | | | | | | | * Add i64x2.mul * Add i{8x16,16x8,32x4}.{min,max}_{s,u} * Rename i{8x16,16x8,32x4,64x2}.load_splat -> v{8x16,16x8,32x4,64x2}.load_splat * Remove i8x16.mul * Remove f64x2.convert_i64x2_{s,u} * Remove i64x2.trunc_sat_f64x2_{s,u} * Remove i64x2.{any,all}_true
* [simd] Implement new SIMD instructions (#1303)Ben Smith2020-01-141-2/+10
| | | | | | | * i{16x8,32x4,64x2}.load{8x8,16x4,32x2}_{s,u} * v128.andnot * i{8x16,16x8}.avgr_u None are implemented in the interpreter yet.
* [simd] Add support for narrow/widen instructions (#1301)Ben Smith2020-01-131-0/+12
| | | | | | | | | | | * i{8x16,16x8}.narrow_i{16x8,32x4}_{s,u} * i{16x8,32x4}.widen_{low,high}_i{8x16,16x8}_{s,u} (though not all combinations are valid) These are not currently supported in the interpreter. TODO: Implement other new SIMD instructions too: load and extend, bitwise and-not, lanewise rounding average
* Error on memory.init|data.drop without DataCount (#1297)Ben Smith2020-01-101-0/+5
| | | | | | 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.
* Segment flags should be MVP-compat when possible (#1286)Ben Smith2020-01-081-7/+6
| | | | This should fix #1280, #1268, #1269.
* Several fixes for reference types (#1278)Heejin Ahn2020-01-081-12/+10
| | | | | | | - 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)
* binary-reader: Continue after unfinished section error if not ↵Sam Clegg2019-12-131-2/+6
| | | | | | | stop_on_first_error (#1266) Treat unfinished section just like any other section error and allow the reader to continue reading other section depending on value of stop_on_first_error.
* reference-types: add support for typed select (#1253)Sam Clegg2019-11-261-1/+15
|
* reference-types: add table.fill instruction (#1252)Sam Clegg2019-11-251-0/+8
|
* reference-types: Add reference-types spec tests (#1225)Sam Clegg2019-11-251-0/+7
| | | | | | | This change adds most of the tests from the reference-types proposal. There are two tests that require new instructions (`table.fill` and `select_t`) which will be followup changes. See: #1223
* Update spec testsuite (#1237)Sam Clegg2019-11-221-21/+47
| | | | | | | 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-27/+27
| | | | | | | | | | | 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: Add multi-table support to the interpreter (#1218)Sam Clegg2019-11-141-12/+19
| | | | | | | | | | 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.
* Initial implementation of reftype proposal in the interpreter. (#1206)Sam Clegg2019-11-071-0/+11
| | | | - Implement ref.func everywhere. - Implement table.get and table.set in the interpreter.
* Add ExternalKind to OnImport callback (#1182)Sam Clegg2019-10-101-5/+1
|
* wasm-objdump: Add more symbol flags (#1162)Sam Clegg2019-09-191-1/+1
|
* Rename except_ref type to exnref (#1142)Heejin Ahn2019-08-131-1/+1
| | | | In WebAssembly/exception-handling#79 we agreed to rename except_ref type to exnref.
* Add support for ref.null in global initializers (#1131)Andy Wingo2019-07-251-0/+4
| | | | | | | | | 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 :)
* Fix some fuzz bugs in wasm2wat (#1128)Ben Smith2019-07-231-1/+9
| | | | Also update the fuzz script to enable various features, so they get fuzz testing too.
* Add support for v8x16.swizzle and the load_splats. (#1116)nlewycky2019-07-191-0/+14
| | | | | | | | | | | | | | | | | | | * 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 gcc and clang warnings (#1123)Ben Smith2019-07-191-2/+4
|
* Match custom section names in wasm-objdump (#1097)Ben Smith2019-06-271-2/+3
| | | | | | | | | This way you can see the contents of just one custom section by using: ``` wasm-objdump -j section_name -x ``` Where `section_name` is the name of the custom section.
* Add support for comdat groups in the linking section (#1087)Sam Clegg2019-06-041-0/+21
|
* Implement bulk memory in the interpreter (#1074)Ben Smith2019-05-071-1/+12
| | | | | | | | | * 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/+25
| | | | | * 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 new relocation types for position independent code. (#1056)Sam Clegg2019-04-031-0/+1
| | | | See https://github.com/WebAssembly/tool-conventions/pull/106
* Allow a local type count of 0 (#1039)Ben Smith2019-03-081-1/+0
| | | | | It's legal in the wasm format to have a local type count of 0. I originally made it illegal to fix a wabt bug, and didn't notice because there were no spec tests for this behavior.
* Rename anyfunc -> funcref; parse reference types (#1026)Ben Smith2019-02-251-2/+3
| | | | | | | | | Also: * Add feature limits on using v128 and anyref types (requires --enable-simd and --enable-reference-types respectively). * Separate out ParseValueType (used for params, locals, global types) from ParseRefType (used for table types).
* Improve support for event symbols and except_ref types (#1025)Wouter van Oortmerssen2019-02-241-6/+19
| | | | | | * Added except_ref to be legal in a block type signature * Added more support for event symbols.
* Add support for the reference types proposal (#938)Alex Crichton2019-02-141-16/+79
| | | | | | | | | | | | | | | | | | | | * 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.
* Add br_on_exn instruction (#1016)Ben Smith2019-02-131-0/+10
| | | | | | It takes two u32 immediates: the branch depth and an exception index. The stack signature is `[expect_ref] -> [except_ref]`, so the `except_ref` can be tested easily against multiple exception types.
* Parse updated event text and binary format (#1014)Ben Smith2019-02-121-19/+13
| | | | | | | | | | | | An event has a type-section index, like a function definition. The current proposal doesn't specify the text format, so I assumed that it would match the format of the other sections that reference function types. This means that the following declaration styles are allowed: ``` (type $t (func (param i32))) (event $e1 (type $t)) (event $e2 (param f32)) ```
* Rename exception -> event (#1013)Ben Smith2019-02-111-27/+27
|
* Add `Event` known section; remove `exception` (#1012)Ben Smith2019-02-111-3/+6
| | | | | | | The exception section is now a known section with code 13, and is known as the "Event" section. The structure of the section has changed too, but I'll fix that in another PR.
* Remove the `if_except` instruction (#1009)Ben Smith2019-02-101-11/+0
| | | | It is no longer part of the exception proposal.
* Rename {memory,table}.drop to {data,elem}.drop (#1000)Alex Crichton2019-01-301-5/+5
| | | Carrying over renames from WebAssembly/bulk-memory-operations#46
* Update bulk memory instruction binary encodings (#999)Alex Crichton2019-01-291-11/+18
| | | | | | This commit updates wabt wrt to two recent PRs: * WebAssembly/bulk-memory-operations#43 * WebAssembly/bulk-memory-operations#45
* Implement parsing and writing of DataCount section (#998)Ben Smith2019-01-231-6/+27
|
* Update linking metadata version (#996)Sam Clegg2019-01-171-4/+4
| | | | | Also make explicit when are showing log2 alignment. We could instead display actual byte alignment (1 << p2align)?
* The great renaming (#985)Ben Smith2018-12-191-90/+90
| | | | | | | | 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-1/+1
| | | This is useful for finding large functions with wasm-objdump.
* Add needed_dynlibs to dylink section (#974)Sam Clegg2018-12-121-0/+9
| | | | | This field was recently added: https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md
* Handle mismatch in function/code section (#959)Ben Smith2018-11-281-0/+4
| | | | | | If the function section is present, and has a non-zero count, then if the code section is absent the module should not validate. If either section is missing, but the count is zero it is OK.
* Add support for dylink section (#955)Sam Clegg2018-11-141-0/+20
| | | | | See: https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md
* Update testsuite (#942)Ben Smith2018-11-051-6/+10
| | | | Also fix bug when parsing elem/data segment; the table/memory index is stored as an LEB128, not a U8.
* Add test for disabled opcodes in binary reader (#934)Ben Smith2018-10-181-34/+18
| | | | | | It's easy to forget to add a check for unexpected opcodes, and it's tedious to have to write additional tests in `test/binary/*`. This way we can test all potentially disabled instructions at once.
* Add more tests for tail_call feature (#931)Ben Smith2018-10-161-4/+6
| | | | | | | | | | | | | | * Fix a few places where `call`/`call_indirect` are used instead of `return_call`, `return_call_indirect` * Fix `TypeChecker::CheckReturnSignature` to print a better error when the signatures don't match. * Don't allow `return_call`/`return_call_indirect` instructions in the parser unless the tail-call feature is enabled. * Support folding of `return_call`/`return_call_indirect` Fixes #929.
* Add more bulk memory tests; use vars for segments (#930)Ben Smith2018-10-151-0/+5
| | | | | | | | | | | | | | | | | | | | * Allow for names in data/elem segments: ``` (data $foo (i32.const 0) "abcdef") ``` * These names can be referenced by the memory/table instructions that operate on segments: ``` memory.drop $foo ``` * Fix running wasm-objdump with bulk-memory instructions * Check for valid data/elem segments in validation * Check that bulk-memory is enabled when parsing text Partial fix for #928; still needs interpreter checks too.
* Implemented tail call instructions: (#926)Francis McCabe2018-10-121-0/+26
| | | | | | return_call return_call_indirect with some simple tests thereof.
* Add bulk memory opcode definitions (#927)Alex Crichton2018-10-121-12/+84
| | | | | | | | | | | | This commit starts to add support in wabt's various tools for the upcoming [bulk memory proposal][1]. This is based off the current proposal's overview, although these may get tweaked over time! This is also the first time I've significantly contributed to wabt, and what I thought would be a relatively simple addition ended up being much larger than I imagined! I didn't add many negative tests yet but if more tests are desired please let me know! [1]: https://github.com/webassembly/bulk-memory-operations