summaryrefslogtreecommitdiff
path: root/src/prebuilt
Commit message (Collapse)AuthorAgeFilesLines
...
* [simd] Implement store lane (#1647)Ng Zhi An2021-03-221-1136/+1160
|
* [simd] Implement load lane (#1646)Ng Zhi An2021-03-221-1093/+1121
| | | | | | | | | 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.
* [simd] Implement v128.load{32,64}_zero (#1644)Ng Zhi An2021-03-171-54/+57
| | | | This requires a new ir type, and the relevant implementation of virtual mthods in the various visitors.
* [simd] Implement i64x2.extend_{low,high}_i32x4_{s,u} (#1643)Ng Zhi An2021-03-161-257/+267
| | | Unskip and rebase simd_int_to_int_extend.
* [simd] Implement i64x2 comparisons (#1642)Ng Zhi An2021-03-161-1242/+1253
| | | Rebase and unskip simd_i64x2_cmp.
* [simd] Implement i32x4.dot_i16x8_s (#1640)Ng Zhi An2021-03-161-331/+336
| | | Rebase and unskip simd_i32x4_dot_i16x8.
* [simd] Implement q15mulrsat_s (#1639)Ng Zhi An2021-03-161-407/+410
| | | Rebase and unskip simd_i16x8_q15mulr_sat_s.
* [simd] Implement extmul instructions (#1638)Ng Zhi An2021-03-121-443/+477
| | | | | | | 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.
* [simd] Implement extadd instructions (#1637)Ng Zhi An2021-03-121-387/+396
| | | | Rebase and unskip simd_i16x8_extadd_pairwise_i8x16.txt and simd_i32x4_extadd_pairwise_i16x8.
* [simd] Implement i64x2.abs (#1636)Ng Zhi An2021-03-121-164/+166
| | | Rebase and unskip simd_i64x2_arith2.txt.
* [simd] Implement i32x4.trunc_sat_f64x2_[su]_zero (#1635)Ng Zhi An2021-03-121-874/+880
| | | | Rebase simd_i32x4_trunc_sat_f64x2.txt and simd_i32x4_trunc_sat_f32x4.txt.
* [simd] Rename widen to extend, implement some double precision ops (#1633)Ng Zhi An2021-03-111-1223/+1201
| | | | | | | | | | | | 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.
* Implement i8x16.popcnt and rebase simd_i8x16_arith2.txt (#1625)Ng Zhi An2021-03-111-128/+130
|
* [simd] Rename any_true, implement i64x2 bitmask and all_true (#1624)Ng Zhi An2021-03-041-386/+388
| | | | | | | | | | | * 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
* Update exception handling support to current proposal (#1596)Asumu Takikawa2021-02-101-1250/+1250
| | | | | | | | | | 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.
* Port to big-endian platforms (s390x but others can be trivially added) (#1557)Soni L2020-12-071-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Rename atomic.notify, *.atomic.wait (#1564)Ben Smith2020-11-031-504/+510
| | | | | | | | 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 SIMD support (#1553)Darin Morrison2020-10-261-1185/+1285
| | | | | | | | | | | | | * 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>
* Implement simd bitmask instructions (#1530)Ben Smith2020-08-311-409/+418
|
* Update testsuite; fix conversion errors (#1502)Ben Smith2020-07-291-19/+19
| | | | | | | | | | | | 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.
* Better error when parsing input/output command (#1460)Ben Smith2020-06-101-1033/+1015
| | | Fixes #1459.
* [wasm2c] Implement trap handler for linux/macos (#1442)Ben Smith2020-06-041-9/+13
| | | | | | | * 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
* Reference types changes to remove subtyping (#1407)Ben Smith2020-05-281-1188/+1182
| | | | | | | | 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`
* Require `do` in folded `try` statement (#1425)Ben Smith2020-05-141-1149/+1166
| | | | | | | | | | | | | For example: ``` (try $label (param ...) (result ...) (do ...) (catch ...) ) ``` See comment here: https://github.com/WebAssembly/exception-handling/issues/52#issuecomment-626696720
* Add support for atomic.fence from the threads proposal (#1231)Andy Wingo2020-04-201-569/+568
| | | | | 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.
* [wasm2c] Add rot13 example (#1384)Ben Smith2020-04-142-0/+2
| | | | | | | | | | 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.)
* Add exnref value type to parser (#1389)Ben Smith2020-04-141-1163/+1154
| | | | | | | | | | | | 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.
* Update testsuite (#1381)Ben Smith2020-03-271-1086/+1123
| | | | * Add i{8x16,16x8,32x4}.abs instructions * Implement IntAbs in interp-math.h
* Parse ArrayTypes (#1364)Ben Smith2020-03-231-538/+539
| | | | | | | | | | 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-1040/+1043
| | | | | | | | | | | 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-945/+968
| | | | | | | | | | | | | | | | | | 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 (#1327)Sam Clegg2020-02-051-1141/+1124
| | | | | The main change here is the addition of declared elem sections.
* [simd] Update instructions (#1317)Ben Smith2020-01-271-1101/+1099
| | | | | | | | | * 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
* Update testsuite (#1308)Ben Smith2020-01-161-526/+524
| | | | | | | | | | * 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.
* [simd] Implement new SIMD instructions (#1303)Ben Smith2020-01-141-1048/+1090
| | | | | | | * 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-995/+1066
| | | | | | | | | | | * 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
* Update testsuite (#1275)Sam Clegg2020-01-091-429/+430
| | | | | | | | | | | | | | | | | 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.
* Several fixes for reference types (#1278)Heejin Ahn2020-01-081-984/+971
| | | | | | | - 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)
* reference-types: add table.fill instruction (#1252)Sam Clegg2019-11-251-58/+61
|
* wast2json: add new `assert_return_func` assertion type (#1224)Sam Clegg2019-11-151-1059/+1058
| | | | | This is needed for running the reference-types tests. See: #1223
* Add ref.* to the (invoke) (#1156)Yury Delendik2019-09-121-930/+922
|
* Add support for v8x16.swizzle and the load_splats. (#1116)nlewycky2019-07-191-353/+364
| | | | | | | | | | | | | | | | | | | * 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.
* Update spec testsuite (#1111)Ben Smith2019-07-161-125/+120
| | | | | * Remove passive keyword from bulk-memory * Fix rounding on hex floats * Allow underscores in NaN payloads
* Proper encoding of passive element segments (#1066)Ben Smith2019-04-181-877/+903
| | | | | * 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
* Rewrite the lexer manually, instead of re2c (#1058)Ben Smith2019-04-032-13742/+1477
| | | | | 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.
* Remove LexerSourceFile (#1054)Ben Smith2019-04-011-9524/+9655
| | | | | | 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.
* Make v128.const i32x4 op conform to the SIMD draft (#1037)gnzlbg2019-03-281-4489/+4597
| | | | | | | | | | | | | | * 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.
* Rename anyfunc -> funcref; parse reference types (#1026)Ben Smith2019-02-251-1060/+1060
| | | | | | | | | 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 (#938)Alex Crichton2019-02-141-9432/+9441
| | | | | | | | | | | | | | | | | | | | * 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-8986/+9160
| | | | | | 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.