|
Revision tags: dev, v36.0.9, v44.0.1, v43.0.2, v36.0.8, v24.0.8, v44.0.0, v43.0.1, v42.0.2, v36.0.7, v24.0.7, v43.0.0 |
|
| #
25e3bd12 |
| 25-Feb-2026 |
Nick Fitzgerald <[email protected]> |
Handle OOM in `wasmtime_environ::types::WasmFuncType` (#12670)
* Handle OOM in `wasmtime_environ::types::WasmFuncType`
It should also not `#[derive(Clone)]` anymore, just `TryClone`, which propagat
Handle OOM in `wasmtime_environ::types::WasmFuncType` (#12670)
* Handle OOM in `wasmtime_environ::types::WasmFuncType`
It should also not `#[derive(Clone)]` anymore, just `TryClone`, which propagates out to a bunch of other types as well.
And while we are here:
* Rename its "returns" to "results" to match Wasmtime's public API and also the Wasm text format. * Store both its params and results in a single allocation. * Shrink its size on 64-bit architectures by storing its param- and result-GC-type counts as `u32`s rather than `usize`s.
* fix clippy
* fix winch unit tests
show more ...
|
|
Revision tags: v42.0.1, v41.0.4, v42.0.0, v40.0.4, v36.0.6, v24.0.6, v41.0.3, v41.0.2, v41.0.1, v36.0.5, v40.0.3, v41.0.0, v36.0.4, v39.0.2, v40.0.2 |
|
| #
b112bb85 |
| 09-Jan-2026 |
Nick Fitzgerald <[email protected]> |
Migrate winch-codegen to `wasmtime_environ::error` (#12297)
|
|
Revision tags: v40.0.1, v40.0.0, v39.0.1, v39.0.0, v38.0.4, v37.0.3, v36.0.3, v24.0.5, v38.0.3, v38.0.2, v38.0.1, v37.0.2, v37.0.1, v37.0.0, v36.0.2, v36.0.1, v36.0.0, v35.0.0, v24.0.4, v33.0.2, v34.0.2, v34.0.1, v33.0.1, v24.0.3, v32.0.1, v34.0.0 |
|
| #
ffef1ed1 |
| 10-Jun-2025 |
Saúl Cabrera <[email protected]> |
winch: Use `Masm::with_scratch` in ISA-agnostic code (#10998)
* winch: Use `Masm::with_scratch` in ISA-agnostic code
This commit is a follow-up to https://github.com/bytecodealliance/wasmtime/pull/
winch: Use `Masm::with_scratch` in ISA-agnostic code (#10998)
* winch: Use `Masm::with_scratch` in ISA-agnostic code
This commit is a follow-up to https://github.com/bytecodealliance/wasmtime/pull/10989; it migrates all the uses of the scratch register to use `Masm::with_scratch`. This commit also updates the tests that can fail / are ignored, since many of the bugs were introduced by accidental clobbers to scratch registers.
Even though this change doesn't introduce any functional changes, the disassembly changes in aarch64 are due to the usage of x17 as an extra scratch registers. The updates in x64 dissembly are related to offset changes.
* Use `with_scratch!` in `pop_to_addr`
* Remove dead code
* Apply cargo fmt
* Remove `imports.wast` from ignore list
* Use the new version of `Masm::with_scratch`
* Introduce `Masm::with_scratch_for`
Helper to derive the register class needed for a particular Wasm value type
* Format
show more ...
|
|
Revision tags: v33.0.0 |
|
| #
90ac295e |
| 19-May-2025 |
Alex Crichton <[email protected]> |
Update Wasmtime to the 2024 Rust Edition (#10806)
* Update Wasmtime to the 2024 Rust Edition
Now that our MSRV supports the 2024 edition it's possible to make this switch. This commit moves Wasmtim
Update Wasmtime to the 2024 Rust Edition (#10806)
* Update Wasmtime to the 2024 Rust Edition
Now that our MSRV supports the 2024 edition it's possible to make this switch. This commit moves Wasmtime to the 2024 Edition to keep up-to-date with Rust idioms and access many of the edition features exclusive to the 2024 edition.
prtest:full
* Reformat with the 2024 edition
show more ...
|
| #
7a66c39a |
| 23-Apr-2025 |
Alex Crichton <[email protected]> |
Remove some `#![expect(clippy::allow_attributes_without_reason)]` (#10661)
Clean up some crates by migrating from `#[allow]` to `#[expect]` (ideally) or `#[allow]`-with-reason
|
|
Revision tags: v32.0.0, v31.0.0 |
|
| #
d463cf4e |
| 03-Mar-2025 |
Saúl Cabrera <[email protected]> |
winch(aarch64): ABI integration (#10312)
* winch(aarch64): ABI integration
This commit finalizes the ABI integration between Winch and Cranelift, notably:
* Updates the Cranelift ABI to ensure tha
winch(aarch64): ABI integration (#10312)
* winch(aarch64): ABI integration
This commit finalizes the ABI integration between Winch and Cranelift, notably:
* Updates the Cranelift ABI to ensure that all the Winch register clobbers are taken into account. * Updates the Winch ABI to treat x28 as callee-saved, since it's used as the shadow stack pointer.
The alternative to treating x28 as callee-saved is to treat it as caller-saved and save it when required e.g., at call-sites, even though this approach works, it's probably more efficient to perform a store/pop once per function, to minimize the number of move instructions required.
There are still some changes needed in order to fully enable running spec tests for aarch64, however, this change is one step further. If interested, you can run the call.wast test via:
cargo run -- wast -Ccompiler=winch tests/spec_testsuite/call_indirect.wast
* Update disas tests
show more ...
|
|
Revision tags: v30.0.2, v30.0.1, v30.0.0, v29.0.1, v29.0.0, v28.0.1 |
|
| #
8bc01990 |
| 13-Jan-2025 |
Saúl Cabrera <[email protected]> |
winch: Gracefully handle unsupported Wasm types (#9949)
* winch: Gracefully handle unsuppported Wasm types
Follow-up to https://github.com/bytecodealliance/wasmtime/pull/9851
Prior to this commit,
winch: Gracefully handle unsupported Wasm types (#9949)
* winch: Gracefully handle unsuppported Wasm types
Follow-up to https://github.com/bytecodealliance/wasmtime/pull/9851
Prior to this commit, Winch's ABI layer would panic on unsupported Wasm types, i.e., `v128`, `externref`.
This commit ensures that a recoverable error is returned in case an unsupported type is found in a function signature.
This change is particularly helpful to start running spec tests for aarch64.
* Fix unit tests for x64/aarch64 abi
show more ...
|
|
Revision tags: v28.0.0 |
|
| #
792cccce |
| 06-Dec-2024 |
Saúl Cabrera <[email protected]> |
winch: Track the callee calling convention (#9757)
* winch: Track the callee calling convention
This commit aims to improve the consistency of call emission in Winch.
Prior to this commit, the cal
winch: Track the callee calling convention (#9757)
* winch: Track the callee calling convention
This commit aims to improve the consistency of call emission in Winch.
Prior to this commit, the calling convention at Winch's assembler layer was hardcoded. Even though the calling convention invariants are correctly handled early on in the code generation process and this has no effect on the generated code, it could lead to subtle bugs if Cranelift's emission infrastructure changes. It could also be confusing when trying to implement call instrutions for other backends.
This change is motivated by some of the questions in https://github.com/bytecodealliance/wasmtime/pull/9751
* Clippy fixes
show more ...
|
| #
7ef8f2e2 |
| 04-Dec-2024 |
Saúl Cabrera <[email protected]> |
winch: Improve frame handling (#9708)
This commit addresses issues identified while working on issue #8091. It improves the frame handling in Winch to prevent subtle bugs and enhance the robustness
winch: Improve frame handling (#9708)
This commit addresses issues identified while working on issue #8091. It improves the frame handling in Winch to prevent subtle bugs and enhance the robustness of the code generation process.
Previously, there was no clear mechanism to verify when the frame was fully set up and safe to access the local slots allocated for register arguments, including the special slots used for the `VMContext`. As a result, it was possible to inadvertently read from uninitialized memory if calls were made before the frame was properly set up and sealed.
This commit introduces two main changes with the objective to help reduce the risk of introducing bugs related to the above:
* A `CodeGenPhase` trait, used via the type state pattern to clearly gate the operations allowed during each phase of the code generation process.
* Improve the semantics of locals, by clearly separating the notion of Wasm locals and special locals used by the compiler. This specialization allows a more accurate representation of the semantics of Wasm locals and their index space.
show more ...
|
|
Revision tags: v27.0.0, v26.0.1, v25.0.3, v24.0.2, v26.0.0, v21.0.2, v22.0.1, v23.0.3, v25.0.2, v24.0.1, v25.0.1 |
|
| #
b19a3389 |
| 20-Sep-2024 |
bjorn3 <[email protected]> |
Make the Tail call conv follow the system call conv for the return area ptr (#9287)
* Make the Tail call conv follow the system call conv for the return area ptr
And for Winch make it follow the sy
Make the Tail call conv follow the system call conv for the return area ptr (#9287)
* Make the Tail call conv follow the system call conv for the return area ptr
And for Winch make it follow the system call conv on all targets except aarch64 where the first regular argument register is used instead of the designated register.
* Fix review comments
show more ...
|
|
Revision tags: v25.0.0, v24.0.0, v23.0.2 |
|
| #
e2664e55 |
| 12-Aug-2024 |
Bruce Mitchener <[email protected]> |
Reduce typo count (#9106)
|
| #
5a821db2 |
| 23-Jul-2024 |
Jeffrey Charles <[email protected]> |
Winch: Remove specific scratch registers from ABI trait (#8999)
|
| #
c879eafc |
| 22-Jul-2024 |
Saúl Cabrera <[email protected]> |
winch: Improve scratch register handling (#8971)
* winch: Improve scratch register handling
This commit doesn't introduce any new behavior. It's mostly a follow-up to https://github.com/bytecodeall
winch: Improve scratch register handling (#8971)
* winch: Improve scratch register handling
This commit doesn't introduce any new behavior. It's mostly a follow-up to https://github.com/bytecodealliance/wasmtime/pull/7977.
This commit tries to reduce the repetitive pattern used to obtain the scrtach register by introducing a macro similar to the existing `vmctx!` macro.
This commit also improves the macro definition by using fully qualified paths.
* Fix unused imports
show more ...
|
|
Revision tags: v23.0.1, v23.0.0 |
|
| #
5393c2bf |
| 15-Jul-2024 |
Bruce Mitchener <[email protected]> |
Reduce typo count (#8951)
|
|
Revision tags: v22.0.0, v21.0.1, v21.0.0 |
|
| #
0e9121da |
| 16-May-2024 |
FrankReh <[email protected]> |
Fix some typos (#8641)
* occurred
* winch typos
* tests typos
* cli typos
* fuzz typos
* examples typos
* docs typos
* crates/wasmtime typos
* crates/environ typos
* crates/cranelift typos
Fix some typos (#8641)
* occurred
* winch typos
* tests typos
* cli typos
* fuzz typos
* examples typos
* docs typos
* crates/wasmtime typos
* crates/environ typos
* crates/cranelift typos
* crates/test-programs typos
* crates/c-api typos
* crates/cache typos
* crates other typos
* cranelift/codegen/src/isa typos
* cranelift/codegen/src other typos
* cranelift/codegen other typos
* cranelift other typos
* ci js typo
* .github workflows typo
* RELEASES typo
* Fix clang-format documentation line
---------
Co-authored-by: Andrew Brown <[email protected]>
show more ...
|
|
Revision tags: v20.0.2, v20.0.1, v20.0.0, v17.0.3, v19.0.2, v18.0.4, v19.0.1 |
|
| #
450b791f |
| 21-Mar-2024 |
Trevor Elliott <[email protected]> |
winch: Remove unused functions after trampoline refactoring (#8213)
* Remove callee saves from Winch's MacroAssembler trait
prtest:mingw-x64
* Remove the unused callee_saved_regs function
* Remov
winch: Remove unused functions after trampoline refactoring (#8213)
* Remove callee saves from Winch's MacroAssembler trait
prtest:mingw-x64
* Remove the unused callee_saved_regs function
* Removed the unused callee_saved function from Winch's aarch64 backend
* Remove additional unused functions from the Winch ABI trait
show more ...
|
| #
d69ba34e |
| 21-Mar-2024 |
Trevor Elliott <[email protected]> |
winch: Switch to using cranelift for all trampolines (#8109)
* Switch winch over to using cranelift for all trampolines
* Fix unused code warnings
* Fix unused code warnings
prtest:full
|
|
Revision tags: v19.0.0, v18.0.3, v18.0.2, v17.0.2 |
|
| #
9ce3ffe1 |
| 22-Feb-2024 |
Alex Crichton <[email protected]> |
Update some CI dependencies (#7983)
* Update some CI dependencies
* Update to the latest nightly toolchain * Update mdbook * Update QEMU for cross-compiled testing * Update `cargo nextest` for usag
Update some CI dependencies (#7983)
* Update some CI dependencies
* Update to the latest nightly toolchain * Update mdbook * Update QEMU for cross-compiled testing * Update `cargo nextest` for usage with MIRI
prtest:full
* Remove lots of unnecessary imports
* Downgrade qemu as 8.2.1 seems to segfault
* Remove more imports
* Remove unused winch trait method
* Fix warnings about unused trait methods
* More unused imports
* More unused imports
show more ...
|
| #
0e98a8d5 |
| 21-Feb-2024 |
Saúl Cabrera <[email protected]> |
winch: Overhaul the internal ABI (#7974)
* winch: Overhaul the internal ABI
This change overhauls Winch's ABI. This means that as part of this change, the default ABI now closely resembles Craneli
winch: Overhaul the internal ABI (#7974)
* winch: Overhaul the internal ABI
This change overhauls Winch's ABI. This means that as part of this change, the default ABI now closely resembles Cranelift's ABI, particularly on the treatment of the VMContext. This change also fixes many wrong assumptions about trampolines, which are tied to how the previous ABI operated.
The main motivation behind this change is:
* To make it easier to integrate Winch-generated functions with Wasmtime * Fix fuzz bugs related to imports * Solidify the implementation regarding the usage of a pinned register to hold the VMContext value throughout the lifetime of a function.
The previous implementation had the following characteristics, and wrong assumptions):
* Assumed that nternal functions don't receive a caller or callee VMContexts as parameters. * Worked correctly in the following scenarios: * `Wasm -> Native`: since we can explicitly load the caller and callee `VMContext`, because we're calling a native import. * `(Native, Array) -> Wasm`: because the native signatures define a tuple of `VMContext` as arguments.
* It didn't work in the following scenario: * `Wasm->Wasm`: When calling imports from another WebAssembly instance (via direct call or `call_indirect`. The previous implementation wrongly assumes that there should be a trampoline in this case, but there isn't. The code was generated by the same compiler, so the same ABI should be used in both functions, but it doesn't.
This change introduces the following changes, which fix the previous assumptions and bugs:
* All internal functions declare a two extra pointer-sized parameters, which will hold the callee and caller `VMContext`s * Use a pinned register that will be considered live through the lifetime of the function instead of pinning it at the trampoline level. The pinning explicitlly happens when entering the function body and no other assumptions are made from there on. * Introduce the concept of special `ContextArgs` for function calls. This enum holds metadata about which context arguments are needed depending on the callee. The previous implementation of introducing register values at arbitrary locations in the value stack conflicts with the stack ordering principle which states that older values must *always* precede newer values. So we can't insert a register, because if a spill happens the order of the values will be wrong.
Finally, given that this change also enables the `imports.wast` test suite, it also includes a fix to `global.{get, set}` instructions which didn't account entirely for imported globals.
Resolved conflicts Update Winch filetests
* Fix typos
* Use `get_wasm_local` and `get_frame_local` instead of `get_local` and `get_local_unchecked`
* Introduce `MAX_CONTEXT_ARGS` and use it in the trampoline to skip context arguments.
show more ...
|
|
Revision tags: v18.0.1, v18.0.0 |
|
| #
83cf7438 |
| 09-Feb-2024 |
Saúl Cabrera <[email protected]> |
winch: Add support for WebAssembly loads/stores (#7894)
* winch: Add support for WebAssembly loads/stores
Closes https://github.com/bytecodealliance/wasmtime/issues/6529
This patch adds support fo
winch: Add support for WebAssembly loads/stores (#7894)
* winch: Add support for WebAssembly loads/stores
Closes https://github.com/bytecodealliance/wasmtime/issues/6529
This patch adds support for all the instructions involving WebAssembly loads and stores for 32-bit memories. Given that the `memory64` proposal is not enabled by default, this patch doesn't include an implementation/tests for it; in theory minimal tweaks to the currrent implementation will be needed in order to support 64-bit memories.
Implemenation-wise, this change, follows a similar pattern as Cranelift in order to calculate addresses for dynamic/static heaps, the main difference being that in some cases, doing less work at compile time is preferred; the current implemenation only checks for the general case of out-of-bounds access for dynamic heaps for example.
Another important detail regarding the implementation, is the introduction of `MacroAssembler::wasm_load` and `MacroAssembler::wasm_store`, which internally use a common implemenation for loads and stores, with the only difference that the `wasm_*` variants set the right flags in order to signal that these operations are not trusted and might trap.
Finally, given that this change introduces support for the last set of instructions missing for a Wasm MVP, it removes most of Winch's copy of the spectest suite, and switches over to using the official test suite where possible (for tests that don't use SIMD or Reference Types).
Follow-up items:
* Before doing any deep benchmarking I'm planning on landing a couple of improvements regarding compile times that I've identified in parallel to this change. * The `imports.wast` tests are disabled because I've identified a bug with `call_indirect`, which is not related to this change and exists in main. * Find a way to run the `tests/all/memory.rs` (or perhaps most of integration tests) with Winch.
-- prtest:full
* Review comments
show more ...
|
|
Revision tags: v17.0.1 |
|
| #
496237c2 |
| 29-Jan-2024 |
Nick Fitzgerald <[email protected]> |
Rename `WasmType` to `WasmValType` (#7838)
Purely mechanical, no functional changes.
This is to help differentiate between value types (i32, i64, reference types, etc...) and defined types (functio
Rename `WasmType` to `WasmValType` (#7838)
Purely mechanical, no functional changes.
This is to help differentiate between value types (i32, i64, reference types, etc...) and defined types (function signatures, struct definitions, array definitions).
show more ...
|
|
Revision tags: v17.0.0 |
|
| #
446a7f5e |
| 08-Jan-2024 |
Saúl Cabrera <[email protected]> |
winch: Multi-Value Part 2: Blocks (#7707)
* winch: Multi-Value Part 2: Blocks
This commit adds support for the Multi-Value proposal for blocks.
In general, this change, introduces multiple buildin
winch: Multi-Value Part 2: Blocks (#7707)
* winch: Multi-Value Part 2: Blocks
This commit adds support for the Multi-Value proposal for blocks.
In general, this change, introduces multiple building blocks to enable supporting arbitrary params and results in blocks:
* `BlockType`: Introduce a block type, to categorize the type of each block, this makes it easier to categorize blocks per type and also makes it possible to defer the calculation of the `ABIResults` until they are actually needed rather than calculating everyghing upfront even though they might not be needed (when in an unreachable state). * Push/pop operations are now frame aware. Given that each `ControlStackFrame` contains all the information needed regarding params and results, this change moves the the implementation of the push and pop operations to the `ControlStackFrame` struct. * `StackState`: this struct holds the entry and exit invariants of each block; these invariants are pre-computed when entering the block and used throughout the code generation, to handle params, results and assert the respective invariants.
In terms of the mechanics of the implementation: when entering each block, if there are results on the stack, the expected stack pointer offsets will be calculated via the `StackState`, and the `target_offset` will be used to create the block's `RetArea`. Note that when entering the block and calculating the `StackState` no space is actually reserved for the results, any space increase in the stack is deffered until the results are popped from the value stack via `ControlStackFrame::pop_abi_results`.
The trickiest bit of the implementation is handling constant values that need to be placed on the right location on the machine stack. Given that constants are generally not spilled, this means that in order to keep the machine and value stack in sync (spilled-values-wise), values must be shuffled to ensure that constants are placed in the expected location results wise. See the comment in `ControlStackFrame::adjust_stack_results` for more details.
* Review fixes
show more ...
|
|
Revision tags: v16.0.0, v15.0.1 |
|
| #
55f9a4bd |
| 23-Nov-2023 |
Jeffrey Charles <[email protected]> |
Winch: fix bug by spilling when emitting func call (#7573)
* Winch: fix bug by spilling when calling a func
* Forgot to commit new filetest
* Only support WasmHeapType::Func
* Elaborate on call_i
Winch: fix bug by spilling when emitting func call (#7573)
* Winch: fix bug by spilling when calling a func
* Forgot to commit new filetest
* Only support WasmHeapType::Func
* Elaborate on call_indirect jump details
* Update docs for call
* Verify stack is only consts and memory entries
show more ...
|
|
Revision tags: v15.0.0 |
|
| #
f0162a40 |
| 14-Nov-2023 |
Saúl Cabrera <[email protected]> |
winch: Multi-Value Part 1 (#7535)
* winch: Introduce `ABIParams` and `ABIResults`
This commit prepares Winch to support WebAssembly Multi-Value.
The most notorious piece of this change is the int
winch: Multi-Value Part 1 (#7535)
* winch: Introduce `ABIParams` and `ABIResults`
This commit prepares Winch to support WebAssembly Multi-Value.
The most notorious piece of this change is the introduction of the `ABIParams` and `ABIResults` structs which are type wrappers around the concept of an `ABIOperand`, which is the underlying main representation of a param or result.
This change also consolidates how the size for WebAssembly types is derived by introducing `ABI::sizeof`, as well as introducing `ABI::stack_slot_size` to concretely indicate the stack slot size in bytes for stack params, which is ABI dependent.
* winch: Add the necessary ABI building blocks for multi-value
This change adds the necessary changes at the ABI level in order to handle multi-value.
The most notable modifications in this change are:
* Modifying Winch's default ABI to reverse the order of results, ensuring that results that go in the stack should always come first; this makes it easier to respect the following two stack invariants:
* Spilled memory values always precede register values * Spilled values are stored from oldest to newest, matching their respective locations on the machine stack.
* Modify all calling conventions supported by Winch so that only one result, the first one is stored in registers. This differs from their vanilla counterparts in that these ABIs can handle multiple results in registers. Given that Winch is not a generic code generator, keeping the ABI close to what Wasmtime expects makes it easier to pass multiple results at trampolines.
* Add more multi-value tests
This commit adds more tests for multi-value and improves documentation.
prtest:full
* Address review feedback
show more ...
|
| #
b7451323 |
| 08-Nov-2023 |
Saúl Cabrera <[email protected]> |
winch: Properly derive a scratch register for arg assignment (#7501)
This commit properly derives a scratch register for a particular WebAssembly type. The included spec test uncovered that the prev
winch: Properly derive a scratch register for arg assignment (#7501)
This commit properly derives a scratch register for a particular WebAssembly type. The included spec test uncovered that the previous implementation used a int scratch register to assign float stack arguments, which resulted in a panic.
show more ...
|