summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* interp: Implement EHv4 (#2512)Soni L.2024-11-202-0/+60
| | | Continuation of #2470
* binary/wat: Implement EHv4 (#2470)Soni L.2024-11-2010-9/+112
| | | | This pull request implements EHv4. Binary is mostly untested until interp is working.
* wast-parser.cc: Fix a crash from failing (module quote ...) (#2509)Keith Winstein2024-11-121-0/+8
|
* test/run-roundtrip.py: test roundtrip even with --stdout (#2505)Keith Winstein2024-11-112-8/+19
|
* Add support for the custom-page-sizes proposal (#2502)Keith Winstein2024-11-0815-5/+310
| | | | This adds support in the binary/text parsers and writers, the validator and interpreter, and objdump (but not wasm2c).
* wat-writer.cc: update text serialization of data memuse (#2501)Keith Winstein2024-11-071-0/+4
|
* test: Move legacy exception handling tests (NFC) (#2498)Soni L.2024-10-3112-119/+119
|
* Update testsuite (#2495)Keith Winstein2024-10-3046-674/+1609
| | | | | The memory64 `table.wast` test has started to depend on function-references and gc (which WABT doesn't support yet), so vendor an older version of the test.
* interp: Handle ref.null exn (#2497)Soni L.2024-10-291-0/+6
|
* wasm2c: Reset the segment register after call_indirect as the register may ↵Shravan Narayan2024-10-182-0/+6
| | | | have changed
* wasm2c: Cleanup of handling of WASM_RT_USE_SEGUE macroShravan Narayan2024-10-146-180/+60
|
* wasm-interp: Fix off-by-one in DoThrow (#2486)Soni L.2024-10-081-0/+19
|
* wasm-decompile: add function index comments (#2482)Kirill R.2024-10-088-18/+18
|
* Raise parse error on NaN in i32 and i64 literals (#2485)James Ring2024-10-082-0/+16
| | | | Previously, the parser would return result::Error, but would not populate an error message.
* wasm-interp: Fix catch handlers correctly (#2483)Soni L.2024-10-072-3/+16
| | | local decl count != local count
* wasm2c: Fix handling of locals in setjmp targets (#2479)Soni L.2024-10-011-0/+25
| | | | | | | It is UB to read local variables after a call to `setjmp` returns, if those variables have been modified between `setjmp` and `longjmp`, unless they're marked as `volatile`. This marks them as `volatile`. Closes #2469
* wasm-interp: Fix catch handlers' value stack sizes (#2478)Soni L.2024-10-011-0/+22
| | | | | | | | | | | | | | | | | Fixes the value stack size of the catch handler. There were two (related) issues here: - The previous code used `func_->locals.size()` as soon as the function was available, but it hadn't processed the function's locals yet, so it was always empty. (This might not matter in practice, as it's only used by the "function-wide catch handler", which just rethrows.) - The previous code didn't take the function's locals into account when computing the value stack height (relative to the function frame) for a try-catch block. So, it would drop the locals when catching an exception. Closes #2476 (Split from #2470 )
* Fix call_ref on empty stack (#2472)Soni L.2024-09-243-2/+16
| | | | | Same issue as #2471 but for `call_ref`. We don't believe there's a prior issue for this.
* Fix handling of data count without data section (#2432)Soni L.2024-09-231-0/+14
| | | | | | Closes #2436 Fixes #2310 Fixes #2311 Fixes #2431
* Fix error message for ref.is_null (#2471)Soni L.2024-09-231-1/+2
| | | | Fixes #2453 in a bit of a silly way. (Conveniently, we already have tests for this, but nobody noticed they were broken.)
* wasm2c: Use wrappers for function references (#2465)Soni L.2024-09-233-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clang 17(?) tightened UBSAN checks, so that you now get this: ``` - test/wasm2c/spec/call_indirect.txt expected error code 0, got 1. STDERR MISMATCH: --- expected +++ actual @@ -0,0 +1,3 @@ +out/test/wasm2c/spec/call_indirect/call_indirect.0.c:2144:12: runtime error: call to function w2c_call__indirect__0__wasm_f0 through pointer to incorrect function type 'unsigned int (*)(void *)' +/home/runner/work/wabt/wabt/out/test/wasm2c/spec/call_indirect/call_indirect.0.c:1925: note: w2c_call__indirect__0__wasm_f0 defined here +SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior out/test/wasm2c/spec/call_indirect/call_indirect.0.c:2144:12 STDOUT MISMATCH: --- expected +++ actual @@ -1 +0,0 @@ -134/134 tests passed. ``` This happens because emitted functions use a typed module instance, while function references use a `void*` instance. It is UB in C to call the former with the latter, so clang is correct here. We had to pick one of two ways to fix this: either emit `void*` wrapper functions that do the appropriate downcasting for any module functions that go into a table (potentially including imported functions), or the approach that takes significantly less effort of changing everything to `void*` and downcasting internally. ~~We obviously chose the latter.~~ We eventually started emitting wrapper functions.
* wasm2c: Add segue option to make exclusive use of the segment registerShravan Narayan2024-09-186-9/+75
|
* [wasm-interp] Fix memory corruption with recursive call_indirect (#2464)Soni L.2024-09-181-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The interpreter could overflow the stack without trapping properly in `call_indirect` situations. While it would set the `out_trap` to the trap reason, it would return `RunResult::Ok` and the interpreter code would only check `RunResult::Ok` to decide whether or not to keep running. In other words, while the stack overflow meant the interpreter wouldn't push a frame onto the call stack, the interpreter loop would continue advancing instructions, resulting in instructions after the runaway `call_indirect` running. If the offending `call_indirect` didn't have return values, it would be as if the call returned normally. If it did have return values, nothing would be pushed onto the value stack, yet the return types would be pushed onto the type stack. With careful manipulation of the following instructions, this could be used to cause all sorts of memory corruption. As it turns out, the function exit code, as well as a handful of other instructions, do check the state of the value and type stacks and can safely reproduce the bug without the memory corruption, so that's what we made the test do. The obvious fix was to make `call_indirect` propagate `RunResult::Trap` properly. Additionally, we made it so `assert_exhaustion` checks both the `RunResult` *and* the `out_trap`, and asserts if they don't match. This should help catch similar bugs in the future. Closes #2462 Fixes #2398
* wasm2c: Segue support for CPUs without wrgsbase instructionsShravan Narayan2024-09-066-63/+159
|
* Harden against invalid alignment (#2411)Soni L.2024-08-092-2/+24
|
* Fix parsing of malformed element section in text format (#2439)Changqing Jing2024-07-121-0/+9
|
* wasm2c: Segue optimization for modules with a single unshared memory (#2395)Shravan Narayan2024-06-266-89/+444
|
* [wasm-objdump] Fix reporting of imported 64-bit tables (#2425)Sam Clegg2024-05-221-6/+13
|
* wasm2c: Use wabt::StripExtension (#2424)Soni L2024-05-201-0/+3
| | | Fixes #2423
* Update testsuite and implement table64 (#2418)Sam Clegg2024-05-1531-109/+3986
| | | | | See https://github.com/WebAssembly/memory64/issues/51 Includes workaround for #2422
* Fix bug in wasm2c's tail-call optimization code generation (#2420)Christian Nieves2024-05-141-1/+1
|
* Update testsuite and corresponding update to comment parser (#2416)Sam Clegg2024-05-1335-612/+826
| | | | | | | The main change here is because `comments.wast` was updated to include a "quoted" module at the top level. Previously quoted modules had only been used as part of invalid or malformed assertion expressions.
* Suppress pass-failed warnings (#2404)Soni L2024-03-251-0/+3
|
* Add support for new WASM_SEGMENT_FLAG_RETAIN segment flag (#2399)Yuta Saito2024-03-111-2/+6
| | | See https://github.com/llvm/llvm-project/pull/81539
* wasm2c: Implement big-endian SIMD (#2340)Soni L2024-02-063-2/+39
|
* wasm2c: atomic and shared mem operations using c11Shravan Narayan2024-01-302-32/+52
|
* Handle zero local count in disassembly (#2359)Rod Vagg2024-01-031-0/+27
| | | | Previously: local[0..4294967295] Current: local[]
* wasm2c: Cleanup/separate code for heap and stack signal handlersShravan Narayan2023-12-146-6/+6
|
* [wasm-objdump] set function types for correct params+locals indexing (#2353)Rod Vagg2023-12-131-1/+1
|
* wasm2c runtime: fix mis-nesting of def'n of os_has_altstack_installed (#2346)Keith Winstein2023-12-052-2/+63
| | | | | Also adds an RLBox-like CI test where the embedder takes responsibility for signal handling Co-authored-by: wrv <wrv@utexas.edu>
* WastParser: tighten parsing of folded `if` (#2349)Keith Winstein2023-12-053-33/+5
| | | | | This makes the `then` block mandatory per the spec, and parses multiple foldedinstrs in the `if` predicate (exercised by the new if.wast test).
* [wasm-objdump] Print i64 values as unsigned (#2344)Rod Vagg2023-12-011-4/+4
| | | | | This matches the behaviour of i32 printing. Ref: https://github.com/WebAssembly/wabt/pull/2342
* wasm2c: Test STDIN_FILE error output line numbers (#2341)Soni L2023-11-292-0/+14
|
* Add support for new WASM_SYMBOL_ABS symbol flag (#2305)Sam Clegg2023-11-281-4/+12
| | | See https://github.com/llvm/llvm-project/pull/67493
* Make run-spec-wasm2c platform-consistent (#2335)Soni L2023-11-286-69/+8
|
* Update ID for tag name subsection (#2336)Michael Williamson2023-11-271-1/+1
| | | | | | | The tag name subsection currently has the speculative ID of 10. However, the extended-name-section proposal has now been updated to use an ID of 11 for the tag name section. This updates the NameSectionSubsection enum accordingly, as well as adding a field name section with the ID of 10.
* wasm2c: Fix f64 harness (#2331)Soni L2023-11-203-1/+49
|
* decompiler.cc: fix vector oob when if has empty then (#2334)Hyxogen2023-11-201-0/+5
|
* wasm2c: Improve address abstraction for BE support (#2328)Soni L2023-11-146-312/+270
|
* wasm2c: Fix test harness UB with SIMD (#2327)Soni L2023-11-126-4/+63
|