summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* wasm2c: harmonize bulk mem ops re: i32/i64 (#2506) + parametrize memchecks ↵HEADmainKeith Winstein2024-12-1717-631/+1142
| | | | | | | | | | | | | | | | | per-memory (#2507) The PR updates the bulk memory operations (memory.fill, memory.copy, table.fill, etc.) to support 64-bit addresses and counts. Previously these functions only took u32's, even with memory64 enabled. (#2506) This PR also allows "software-bounds-checked" memories and "guard-page-checked" memories to coexist in the same module. It creates two versions of every memory operation: an unrestricted version (that works with any memory) and a _default32 version (for memories with default page size and i32 indexing). (#2507) #2506 and #2507 have been squashed together to avoid a performance regression. This is a stepping stone to supporting custom-page-sizes (which will need to be software-bounds-checked) (#2508).
* Issue a nicer error message on wasm components. (#2515)Dan Gohman2024-12-068-31/+70
| | | | | | | | | | | | Decode just enough of the component binary format to recognize when the input is a component, and issue a dedicated error message for it. Before: 0000008: error: bad wasm file version: 0x1000d (expected 0x1) After: 0000008: error: wasm components are not yet supported in this tool
* CI: Use latest macOS images (#2517)Soni L.2024-12-051-2/+2
| | | | | | macos-12 is no longer available, this changes it to macos-13 (latest available x64 macos) macos-14 is changed to macos-latest (arm64)
* README.md: Add notes on installing prebuilt packages (#2514)Andrew2024-11-241-0/+16
| | | Add `Installation` section to readme to help the next person ❤️
* interp: Implement EHv4 (#2512)Soni L.2024-11-206-4/+167
| | | Continuation of #2470
* binary/wat: Implement EHv4 (#2470)Soni L.2024-11-2043-1321/+2011
| | | | 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-122-2/+12
|
* wasm2c: minor code cleanup for OS checks for segueShravan Narayan2024-11-111-1/+5
| | | | | | Define the fsgabase capability lookup to HWCAP2_FSGSBASE as per https://www.kernel.org/doc/html/latest/arch/x86/x86_64/fsgs.html#fsgsbase-instructions-enablement
* wasm2c: disable segue in clang8 due to missing fsgsbase supportShravan Narayan2024-11-111-5/+5
|
* 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-0844-132/+602
| | | | 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-072-1/+9
|
* wasm-decompile: Fix unescaped characters in data output. (#2500)fedosgad2024-11-041-1/+1
| | | | | | | Characters `"` and `\` which have special meaning in data representations are not escaped by wasm-decompile and are passed to output as is. This PR fixes such incorrect behavior. All tests still pass (although no cases are added).
* test: Move legacy exception handling tests (NFC) (#2498)Soni L.2024-10-3117-734/+119
|
* Update testsuite (#2495)Keith Winstein2024-10-3051-677/+1635
| | | | | 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.
* Fix label 'for' attributes to match input 'id's in demo (#2499)Leo Toneff2024-10-302-2/+2
|
* interp: Handle ref.null exn (#2497)Soni L.2024-10-296-1/+44
|
* binary-reader-ir: Track usage of exception handling in features_used (#2496)Soni L.2024-10-291-0/+15
|
* wasm2c: Cleanup TLS: check for __thread and declare TLS vars only when neededShravan Narayan2024-10-283-3/+10
|
* lexer-keywords.txt: Recognize exn and exnref (#2493)Soni L.2024-10-242-828/+846
| | | (`TokenType::Exn` already exists for some reason)
* [EH] Fix exnref's opcode (#2492)Heejin Ahn2024-10-211-1/+1
| | | | | `exnref`'s opcode is -0x17: https://github.com/WebAssembly/exception-handling/blob/main/proposals/exception-handling/Exceptions.md#exnref
* wasm2c: Reset the segment register after call_indirect as the register may ↵Shravan Narayan2024-10-183-0/+9
| | | | have changed
* type.h: Introduce ExnRef (#2489)Soni L.2024-10-172-1/+8
|
* wasm2c: Cleanup of handling of WASM_RT_USE_SEGUE macroShravan Narayan2024-10-1412-287/+117
|
* wasm-interp: Fix off-by-one in DoThrow (#2486)Soni L.2024-10-082-1/+21
|
* wasm-decompile: add function index comments (#2482)Kirill R.2024-10-089-20/+20
|
* Raise parse error on NaN in i32 and i64 literals (#2485)James Ring2024-10-083-2/+20
| | | | 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-078-16/+40
| | | local decl count != local count
* wasm2c: Fix handling of locals in setjmp targets (#2479)Soni L.2024-10-012-14/+60
| | | | | | | 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-012-8/+36
| | | | | | | | | | | | | | | | | 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-244-13/+20
| | | | | 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-232-6/+25
| | | | | | Closes #2436 Fixes #2310 Fixes #2311 Fixes #2431
* Fix error message for ref.is_null (#2471)Soni L.2024-09-232-13/+13
| | | | 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-237-10/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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] Fix alternate stack deallocation (#2466)Christian Nieves2024-09-201-0/+1
| | | | | | | | This makes `wasm_rt_init()` properly reentrant. By setting `g_alt_stack = NULL`, we allow execution to continue beyond [wasm-rt-impl.c L171 ](https://github.com/WebAssembly/wabt/blob/main/wasm2c/wasm-rt-impl.c#L171) in `os_allocate_and_install_altstack`. Applies to debug builds only due to `assert`.
* Use intrinsic for Popcount on arm64 msvc (#2468)Changqing Jing2024-09-191-15/+2
|
* wasm2c: Add segue option to make exclusive use of the segment registerShravan Narayan2024-09-1814-31/+154
|
* [wasm-interp] Fix memory corruption with recursive call_indirect (#2464)Soni L.2024-09-183-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0612-102/+334
|
* Add missing relocation types (and delete a non-existent one) (#2457)SingleAccretion2024-08-294-16/+45
|
* Install wasm-rt-impl include files (#2452)Remko Tronçon2024-08-111-1/+1
| | | Fixes #2451
* Harden against invalid alignment (#2411)Soni L.2024-08-094-20/+61
|
* Bump version to 1.0.36 (#2449)Alex Reinking2024-07-311-1/+1
|
* Fix OpenSSL dependency in CMake (#2447)Steven Johnson2024-07-314-3/+47
|
* Fix macro redefinition error when building wasm_rt w/ Android NDK (#2437)Christian Nieves2024-07-162-7/+7
|
* Fix parsing of malformed element section in text format (#2439)Changqing Jing2024-07-122-1/+10
|
* Fix deprecated FetchContent_Populate warning third_party/uvwasi cmake build ↵Changqing Jing2024-07-111-0/+4
| | | | (#2440)
* Upgrade SIMDe submodule to 0.8.2 (#2438)Michael R. Crusoe2024-07-091-0/+0
|
* wasm2c: Segue optimization for modules with a single unshared memory (#2395)Shravan Narayan2024-06-2621-135/+2105
|
* Avoid creating temporary vector copies when checking signature (#2435)Michael Bradshaw2024-06-242-1/+5
|