summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Clean up WABT_BIG_ENDIAN handling in tests (#2326)Soni L2023-11-121-6/+1
|
* Update testsuite (#2287)Keith Winstein2023-10-2418-607/+364
|
* wasm2c: implement the tail-call proposal (#2272)Keith Winstein2023-10-2410-22/+1120
|
* feat: treat non-seekable files as pipes (#2309)sethp2023-10-023-1/+11
| | | | | | | | | | | | | | | Previously, attempting to read from a pipe would result in an error: 'not a regular file', disallowing use of files like /dev/stdin or /dev/fd/3, named fifos, sockets, etc. The tools already understand how to (try to) read from non-regular files, so this change attempts to do so when the input is not seek-able (the "regular file" capability that's in use here). Additionally, this adds a test for the new behavior using a bash herestring and process substitution (the latter of which shows up in argv as something like `/dev/fd/NN`). Since bash isn't commonly installed on Windows, this change also introduces a new capability to filter tests to specific platforms (sorry).
* Rename wasm-opcodecnt to wasm-stats (#2298)Soni L2023-09-197-18/+17
|
* Implement custom section reading/writing (#2284)Diego Frias2023-09-155-3/+40
|
* [wasm2c] Use wasm_rt_memcpy everywhere in generated code (#2292)Sam Clegg2023-09-095-75/+75
|
* [wasm2c] Add '-Wno-array-bounds' when building wasm2c output (#2293)Sam Clegg2023-09-081-0/+1
| | | | | | We are seeing some (spurious?) warning from gcc 12.2. I've been seeing them locally, but they started to show up in CI as part of #2292.
* Share reading/validation code between elem exprs & other const exprs (#2288)Keith Winstein2023-09-0622-73/+164
| | | | | | This continues the work from #1783 and reduces special handling of elem exprs, by treating them the same as other const expressions (init expressions).