| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
|
|
|
|
|
|
|
|
| |
This is a new kind of ir/ast node/instruction. It has 3 immediates:
memarg align, memarg offset, and lane index. This required new visitor
functions in all the places.
Drive-by cleanup to share the simd lane parsing logic between shuffle,
lane op and this new load lane instructions. This requires rebasing some
tests because the error messages are slightly different now.
|
|
|
|
| |
This requires a new ir type, and the relevant implementation of virtual
mthods in the various visitors.
|
|
|
| |
Unskip and rebase simd_int_to_int_extend.
|
|
|
| |
Rebase and unskip simd_i64x2_cmp.
|
|
|
| |
Rebase and unskip simd_i32x4_dot_i16x8.
|
|
|
| |
Rebase and unskip simd_i16x8_q15mulr_sat_s.
|
|
|
|
|
|
|
| |
Renumber floating point rounding instructions since they overlap with
these new extmul instructions. Rebase simd_f32x4_rounding and
simd_f64x2_rounding.
Rebase and unskip simd extmul tests.
|
|
|
|
| |
Rebase and unskip simd_i16x8_extadd_pairwise_i8x16.txt and
simd_i32x4_extadd_pairwise_i16x8.
|
|
|
| |
Rebase and unskip simd_i64x2_arith2.txt.
|
|
|
|
| |
Rebase simd_i32x4_trunc_sat_f64x2.txt and
simd_i32x4_trunc_sat_f32x4.txt.
|
|
|
|
|
|
|
|
|
|
|
|
| |
4 double precision conversion instructions are implemented:
- f32x4.demote_f64x2_zero
- f64x2.demote_low_f32x4
- f64x2.convert_low_i32x4_s
- f64x2.convert_low_i32x4_u
This is now sufficient to unskip simd_conversions.txt.
Rebase a bunch of tests due to the rename from widen to extend.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Rename all any_true to v128.any_true
* Add i64x2.bitmask and i64x2.all_true, rebase simd_boolean
* Unskip spec/simd/simd_i16x8_arith2.txt since i64x2.abs is now implemented
* Unskip spec/simd/simd_lane.txt
* Update dump interp tests, rebase
|
|
|
|
|
|
|
|
|
|
| |
This PR updates the support of exception handling to the latest proposal (that is compatible with future 2-phase exception handling) described in https://github.com/WebAssembly/exception-handling/pull/137 and https://github.com/WebAssembly/exception-handling/pull/143.
* Adds back tagged `catch $e`, `catch_all`, and `rethrow N` from a previous version of wabt, but with updates to match the current spec (e.g., `catch_all` shares an opcode with `else`, `rethrow`'s depth indexes only catch blocks, etc).
* Adds `unwind` and `delegate` instructions.
* Removes `exnref` and `br_on_exn`.
* Updates relevant tests.
There are some details that could still change (e.g., maybe how `delegate`'s depth is validated), but I'd be happy to submit further PRs if the spec details change.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Initial attempt at s390x port
* Second attempt at s390x port
* Fix big-endian memory fill
* Fix more memory location calculations
* Improve SIMD
* Implement big-endian memory grow
* Fill relocation with 0x00, as per spec
* Make wasm2c endianness work
* Fix shuffle
* Fix load endianness in wasm2c
* Refactor into shared code
* Clean up SwapBytesSized
* Clean up MemcpyEndianAware
* Clean up
* "Fix" opcodecnt basic test
|
|
|
|
|
|
|
|
| |
atomic.notify -> memory.atomic.notify
i32.atomic.wait -> memory.atomic.wait32
i64.atomic.wait -> memory.atomic.wait64
These were renamed upstream a while ago, but the new names were not
added to wabt.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The interpreter and wasm2c were incorrectly handling some float-to-int
conversions. For clarity, the wasm2c implementations of these
conversions now matches the implementation in interp-math.h more closely
(e.g. the numeric ranges are written as `x >= min && x <= max` in both
cases).
Quite a few wasm2c tests were previously being skipped, since wasm2c
doesn't currently support multi-value; it's better instead to duplicate
the tests here and disable the parts that are not supported so we don't
lose test coverage.
|
|
|
| |
Fixes #1459.
|
|
|
|
|
|
|
| |
* Test whether this works for macOS
* Use __builtin_memcpy (fixes bug on macOS)
* Use #if instead of #ifdef (so 0 and 1 values work properly)
* Add `WASM_RT_SETJMP` and `WASM_RT_LONGJMP` macros
|
|
|
|
|
|
|
|
| |
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`
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For example:
```
(try $label (param ...) (result ...)
(do ...)
(catch ...)
)
```
See comment here:
https://github.com/WebAssembly/exception-handling/issues/52#issuecomment-626696720
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
This example demonstrates how to use imported functions. The `rot13`
program takes each command line argument, and rot13-encodes it.
The exported `rot13` function has no arguments, and instead calls back
into the program (via `fill_buf`) with a buffer to fill in. When the
function finishes it calls `buf_done`.
(rot13.wat is the same as in src/test-interp.cc.)
|
|
|
|
|
|
|
|
|
|
|
|
| |
The exnref type was already supported in the type checker, and other
parts of the code, but there was no way to name the type in the text
format.
This PR also fixes makes binary-reader.cc check for just the
exceptions_enabled flag to enable exnref. The exception-handling
proposal depends on the reference types proposal, but that is now
handled at a higher level, in the `UpdateDependencies` function.
Fixes issue #1388.
|
|
|
|
| |
* Add i{8x16,16x8,32x4}.abs instructions
* Implement IntAbs in interp-math.h
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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)`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
The main change here is the addition of declared elem sections.
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
|
| |
* Remove `assert_return_func`. This is now handled by using
`assert_return` with `(ref.func)`.
* The reference types proposal depends on the bulk memory proposal, so
using `--enable-reference-types` automatically includes
`--enable-bulk-memory`.
* `table.fill` no longer clamps to the valid range, and instead checks
before writing anything. This matches the other bulk instructions.
|
|
|
|
|
|
|
| |
* i{16x8,32x4,64x2}.load{8x8,16x4,32x2}_{s,u}
* v128.andnot
* i{8x16,16x8}.avgr_u
None are implemented in the interpreter yet.
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
- 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)
|
| |
|
|
|
|
|
| |
This is needed for running the reference-types tests.
See: #1223
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
| |
* Remove passive keyword from bulk-memory
* Fix rounding on hex floats
* Allow underscores in NaN payloads
|
|
|
|
|
| |
* 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
|
|
|
|
|
| |
The current lexer uses re2c. It easy to change, but it generates a huge amount of code, and it's easy to forgot to update it.
This PR rewrites the lexer manually, and uses gperf instead to match keywords. The generated source is much smaller.
|
|
|
|
|
|
| |
The only benefit to LexerSourceFile is to read files that are larger
than can be loaded into memory. That probably is only a valuable feature
when loading GB-sized files on a 32-bit machine. I'm not certain that
it's worth the extra complexity.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
| |
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.
|