summaryrefslogtreecommitdiff
path: root/src/binary-reader-logging.h
Commit message (Collapse)AuthorAgeFilesLines
* Select instr. with multiple results is invalid (#1582)Ben Smith2020-12-031-1/+1
| | | | | | The reference-types proposal adds a select instruction with a type vector, but any number greater than 1 is invalid. Fixes #1577.
* Add initial support for extended names sections (#1554)Sam Clegg2020-10-021-0/+7
| | | | | | | | See: https://github.com/WebAssembly/extended-name-section Although this is only a phase 1 proposal its seems pretty straight forward, and is already being implemented in binaryen.
* Add --relocatable support for tables (#1549) (#1549)Andy Wingo2020-10-011-0/+4
| | | | | | | | | | | | | We add relocations for table numbers on each place where we reify a table number (call_indirect, table.get, table.set...), but only if reference types are enabled. Also, fix symbol table generation with unnamed definitions, to allow for relocating references to anonymous functions or tables. As tests, add variants of the relocations and symbol-tables dump tests, with and without all features enabled. Enabling reference types causes relocs to be emitted. We also add --details to the relocations dump tests, so that we can see the target symbols for the relocations.
* Fix integer overflow in objdump name tracking (#1524)Sam Clegg2020-08-191-1/+3
| | | | Fixes: #1520
* Added initial "memory64" proposal support (#1500)Wouter van Oortmerssen2020-08-071-10/+10
|
* Remove ref.is_null type parameter (#1474)Ben Smith2020-07-151-1/+1
| | | | | | | | | 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-281-4/+5
| | | | | | | | 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`
* Add support for atomic.fence from the threads proposal (#1231)Andy Wingo2020-04-201-0/+1
| | | | | See https://github.com/WebAssembly/threads/pull/141 for the binary encoding. This patch does add a field to AtomicFenceExpr for the consistency model, though without a type for the time being.
* Parse ArrayTypes (#1364)Ben Smith2020-03-231-0/+2
| | | | | | | | | | The following formats are supported: * (type (array i32)) * (type (array (field i32))) * (type (array (field (mut i32)))) This PR adds support for reading/writing binary and text, but no interpreter support yet.
* Parse struct fields (#1355)Ben Smith2020-03-161-1/+1
| | | | | | | | | | | This allows the following field formats: * `(struct (field $name i32))` * `(struct (field $name (mut i32)))` * `(struct (field i32))` * `(struct (field (mut i32)))` * `(struct (mut i32))` * `(struct i32)`
* Initial pass parsing/reading struct (#1352)Ben Smith2020-03-091-5/+6
| | | | | | | | | | | | | | | | | | This parses just the format `(struct)` as a new type. I added a test for this using `wat2wasm`, but that requires a rudimentary binary format. The test runner automatically attempts to rountrip all wat2wasm tests, so this required implementing the wat writing and binary reading too. Here's a summary of the changes: * binary-reader:h: Rename `BinaryReader::OnType` callbacks to `OnFuncType` * binary-reader.h: Add `BinaryReader::OnStructType` * binary-reader.cc: Use a switch after reading the type form to determine whether we're reading a function or struct. * tokens.def: Add new `TokenType::Struct` * lexer-keywords.txt: Add new `struct` keyword * type.h: Add `Type::Struct` type form * wast-parser.cc: Parse `(struct)` in text format * wat-writer.cc: Write Func or Struct type forms
* Update testsuite (w/ reference-types changes) (#1351)Ben Smith2020-02-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* reference-types: add support for typed select (#1253)Sam Clegg2019-11-261-1/+1
|
* reference-types: add table.fill instruction (#1252)Sam Clegg2019-11-251-0/+1
|
* reference-types: Add reference-types spec tests (#1225)Sam Clegg2019-11-251-0/+1
| | | | | | | 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
* Switch to treating segment flags as a bitfield. NFC (#1232)Sam Clegg2019-11-181-2/+4
| | | | | | | | | | | 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-2/+2
| | | | | | | | | | 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/+1
| | | | - Implement ref.func everywhere. - Implement table.get and table.set in the interpreter.
* Add ExternalKind to OnImport callback (#1182)Sam Clegg2019-10-101-0/+1
|
* Add support for ref.null in global initializers (#1131)Andy Wingo2019-07-251-0/+1
| | | | | | | | | 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/+3
| | | | | | | | | | | | | | | | | | | * 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.
* Match custom section names in wasm-objdump (#1097)Ben Smith2019-06-271-1/+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/+3
|
* Implement bulk memory in the interpreter (#1074)Ben Smith2019-05-071-1/+4
| | | | | | | | | * 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-2/+4
| | | | | * 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
* Improve support for event symbols and except_ref types (#1025)Wouter van Oortmerssen2019-02-241-0/+4
| | | | | | * 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-2/+8
| | | | | | | | | | | | | | | | | | | | * 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/+2
| | | | | | 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-2/+2
| | | | | | | | | | | | 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-10/+10
|
* Remove the `if_except` instruction (#1009)Ben Smith2019-02-101-1/+0
| | | | It is no longer part of the exception proposal.
* Rename {memory,table}.drop to {data,elem}.drop (#1000)Alex Crichton2019-01-301-2/+2
| | | Carrying over renames from WebAssembly/bulk-memory-operations#46
* Implement parsing and writing of DataCount section (#998)Ben Smith2019-01-231-0/+4
|
* The great renaming (#985)Ben Smith2018-12-191-9/+9
| | | | | | | | 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/+2
| | | | | This field was recently added: https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md
* Add support for dylink section (#955)Sam Clegg2018-11-141-0/+7
| | | | | See: https://github.com/WebAssembly/tool-conventions/blob/master/DynamicLinking.md
* Implemented tail call instructions: (#926)Francis McCabe2018-10-121-0/+2
| | | | | | return_call return_call_indirect with some simple tests thereof.
* Add bulk memory opcode definitions (#927)Alex Crichton2018-10-121-2/+9
| | | | | | | | | | | | 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
* Replace ErrorHandler with Errors and FormatErrors*Ben Smith2018-09-041-1/+1
| | | | | | | | | | | | | `ErrorHandler` complicated all error handling in wabt, since it was callback-based. Callbacks would be useful if we ever wanted to change behavior when an error occurred, but instead all that the handler ever did was write the errors to stdout/stderr or to a buffer. This change adds a new class `Error`, which contains an `ErrorLevel`, a `Location` and an error message. It also replaces ErrorHandler with `Errors` (a typedef for `std::vector<Error>`), and adds a couple of functions that can format a list of `Errors` for output: `FormatErrorsTo{String,File}`.
* Add support for multi-value proposal (#861)Ben Smith2018-06-141-8/+7
| | | | | | | | | | | | | | | Use the `--enable-multi-value` flag to enable. A lot of code already "worked" with multi-value, and just needed to remove the restrictions. Most of the other changes are modifying the callback APIs to be more general, e.g. taking more than 1 result type. * Types are now stored as the negative values; this works nicely with the encoding of inline function types (used for block signatures), which are always positive values. * Remove `BlockSignature` and use `BlockDeclaration` instead, which is just a typedef to `FuncSignature`. This allows for explicit or implicit type specifications on the block signatures. * Allow for >1 "keep" values in the DropKeep interpreter instruction
* Add support for new relocation types used in DWARF sections (#846)Sam Clegg2018-05-291-0/+3
|
* Update spec tests; rename {grow,current}_memory (#849)Ben Smith2018-05-271-2/+2
| | | | | | | | | `grow_memory` -> `memory.grow` `current_memory` -> `memory.size` This could have been a smaller change, but I took the opportunity to rename the Token types, Expr types, and callback functions too. Many of these are sorted alphabetically, so I resorted based on their new names.
* Remove old sub-sections types from linking section (#840)Sam Clegg2018-05-171-2/+0
|
* Print "warning" for ignored custom section errors (#843)Ben Smith2018-05-161-1/+1
| | | | | | | The previous message said "error", which makes it look like the output is not created, so change the message to "warning" instead. The error handling code is pretty ugly and can use a refactor, but that would be a much larger change.
* Refer to target section by index in relocation section (#830)Sam Clegg2018-05-031-3/+1
| | | | Also add parsing of linking metadata version.
* Read and write module names in the names section (#831)Ben Smith2018-05-011-0/+4
|
* Run clang-format over all the files (#814)Ben Smith2018-03-161-8/+4
| | | | I also fixed some for/if to use braces if I noticed it. This is a non-functional change.
* SIMD v8x16.shuffle implementation. (#811)lizhengxing2018-03-151-0/+1
|
* Simd i8x16.extract_lane_s instruction implementation. (#802)lizhengxing2018-03-131-0/+1
| | | | | Including: 1. All necessary code for SIMD lanes accessing. 2. i8x16.extract_lane_s implementation.