| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
| |
This should really have been part of #1554
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Fixes: #1520
|
| |
|
|
|
|
|
|
|
|
| |
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`
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
* Add lane getters: u{8,16,32,64}, f{32,64}_bits
* Add lane setters: set_u{8,16,32,64}, set_f{32,64}_bits
* Add set_zero, is_zero
* Add To<Type>() and From<Type>()
These changes will make it easier to build v128 values in the
spectest-interp (which needs to be updated to support SIMD spec tests)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is similar to the way Opcode is structured, which allows us to hang
member functions off of the enumeration.
The primary motivator for this change is the GC proposal (and the
function-references proposal) where a Type can be parameterized:
(type $T (struct ...))
(func
(local (ref $T)
...
)
In this case the type is ref, with a parameter of the type index. Making
Type a class will make it easier to store this additional information.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Use _POSIX_C_SOURCE where applicable
Use _POSIX_C_SOURCE=200809L everywhere except MSVC.
For MinGW, it should have same effect in regard of
`__USE_MINGW_ANSI_STDIO`.
For Cygwin, it will allow to use POSIX APIs under `-std=c++11`
environment.
* binary-reader-objdump.cc: #include <strings.h>
Include `strings.h` because it depends POSIX strcasecmp.
* Disable `CMAKE_CXX_EXTENSIONS` explicitly
Explicitly disable `CMAKE_CXX_EXTENSIONS` which is ON by default in
recent CMake(>= 3.1) which will read implicit `-std=gnu++11` injection.
* test-hexfloat: Use <thread> instead of sysconf
Use <thread> instead of sysconf which is a bit more "standard" way to do
this.
* Guard <strings.h> with HAVE_STRCASECMP
Guard `strings.h` with `HAVE_STRCASECMP` because non-POSIX platform may
not have it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Workaround for Cygwin build
On cygwin, `__STRICT_ANSI__` does not show POSIX definitions. Use
gnu++11 language instead.
* wasm-decompile: Silence -Wsign-compare
Silence -Wsign-compare warning, by using unsigned literal one.
* wasm-objdump: Fix 4294967296 output on disasm
Use `%u` instead of `%lu` as we use `uint32_t` here.
|
|
|
|
|
|
|
|
| |
This allows tools that read input files to use the special `-` filename
to read from stdin.
Also, improve the error reported in general in ReadFile.
See: #386
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
| |
Split out from #1206
|
|
|
|
|
|
| |
Adjusts the output of table imports to the output of table declarations
and other elements:
- `type` instead of `elem_type`
- limits: `initial` instead of `init`, check `has_max`
|
|
|
| |
Print missing `br_table` immediates
|
|
|
|
|
|
|
|
|
|
| |
Previously only the first result type was printed, even for
multiple results.
This change prints multiple result types in parenthesized form
whereas single result types are printed as before.
The `func-result-multi.txt` test case is modified to cover the
Type section as well.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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 :)
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
| |
* 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
|
|
|
|
| |
These names were already displayed on the function section, and when
disassembling a function.
|
|
|
| |
These currently can only come from the export of a global.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Update v128.const WAT parsing to conform to the SIMD draft
* manually fix indentation
* rename no_lanes to lane_count
* Fix parsing of OOB integers
* Update simd shuffle tests to new syntax
* Add the v128.const type tokens to the lexer.
|
| |
|
| |
|
|
|
|
| |
Use `ObjdumpNames` struct to share similar code for mapping indexes to
names.
|
| |
|
|
|
|
|
|
|
| |
The `PrintInitExpr` function falsely treated f64 as a float instead of
a double.
The test case `global.txt` also contained the wrong output, namely
`0x0p+0` instead of `0x1p+2` for `(f64.const 4)`.
|
| |
|
|
|
|
|
|
| |
* Added except_ref to be legal in a block type signature
* Added more support for event symbols.
|
| |
|
|
|
| |
Also fixed 2 asserts that could trigger on user data.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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))
```
|
| |
|
|
|
|
| |
It is no longer part of the exception proposal.
|
|
|
| |
Since names are not always unique.
|
| |
|
|
|
|
|
| |
Also make explicit when are showing log2 alignment.
We could instead display actual byte alignment (1 << p2align)?
|
|
|
|
|
|
|
|
| |
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.
|