|
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 |
|
| #
2f7dbd61 |
| 31-Mar-2026 |
Chris Fallin <[email protected]> |
PCC: remove proof-carrying code (for now?). (#12800)
In late 2023, we built out an experimental feature called Proof-Carrying Code (PCC), where we attached "facts" to values in the CLIF IR and built
PCC: remove proof-carrying code (for now?). (#12800)
In late 2023, we built out an experimental feature called Proof-Carrying Code (PCC), where we attached "facts" to values in the CLIF IR and built verification of these facts after lowering to machine instructions. We also added "memory types" describing layout of memory and a "checked" flag on memory operations such that we could verify that any checked memory operation accessed valid memory (as defined by memory types attached to pointer values via facts). Wasmtime's Cranelift backend then put appropriate memory types and facts in its IR such that all accesses to memory (aspirationally) could be checked, taking the whole mid-end and lowering backend of Cranelift out of the trusted core that enforces SFI.
This basically worked, at the time, for static memories; but never for dynamic memories, and then work on the feature lost prioritization (aka I had to work on other things) and I wasn't able to complete it and put it in fuzzing/enable it as a production option.
Unfortunately since then it has bit-rotted significantly -- as we add new backend optimizations and instruction lowerings we haven't kept the PCC framework up to date.
Inspired by the discussion in #12497 I think it's time to delete it (hopefully just "for now"?) unless/until we can build it again. And when we do that, we should probably get it to the point of validating robust operation on all combinations of memory configurations before merging. (That implies a big experiment branch rather than a bunch of eager PRs in-tree, but so it goes.) I still believe it is possible to build this (and I have ideas on how to do it!) but not right now.
show more ...
|
| #
ab78bd82 |
| 22-Mar-2026 |
Ho Kim <[email protected]> |
fix: correct various typos (#12807)
Signed-off-by: Ho Kim <[email protected]>
|
|
Revision tags: v43.0.0 |
|
| #
133a0ef4 |
| 13-Mar-2026 |
Chris Fallin <[email protected]> |
Debugging: add the debug-main world. (#12756)
* Debugging: add the debug-main world.
This PR "draws the rest of the owl" for the debug-main world (bytecodealliance/rfcs#45). This includes a WIT wor
Debugging: add the debug-main world. (#12756)
* Debugging: add the debug-main world.
This PR "draws the rest of the owl" for the debug-main world (bytecodealliance/rfcs#45). This includes a WIT world that hosts debug components that have access to "host debug powers" via a debugging API, and the ability to load such a debug-component and give it control of the main program as a debuggee when using `wasmtime run`.
The WIT is namespaced to `bytecodealliance:wasmtime` and is slightly aspirational in places: for example, the host does not yet implement injection of early return values or exception-throws. I intend to fill out a series of TODO issues once this all lands to track followup ("post-MVP") work.
This PR does not include any debug components. I separately have a gdbstub component, with which I tested and co-developed this host-side implementation. My plan is to land it in a followup PR as a component that will be embedded in/shipped with the Wasmtime CLI and available under an easy-to-use CLI option. Once we have that gdbstub component, we can also implement end-to-end integration tests that boot up LLDB and run through an expected interaction. (Separately, those integration tests will require a release of wasi-sdk to ship an LLDB binary that we can use.) As such, there are no real tests in this PR: interesting behaviors only really occur with a full end-to-end flow.
The integration with the CLI is a little awkward (we internally build another `wasmtime run` command that invokes the debug component, and tie it together with the debuggee via a special `invoke_debugger` API; this seemed less bad than reworking all of the WASI setup to be more reusable). Happy to take more ideas here.
* Review feedback.
* Review feedback.
* Review feedback: update vendor-wit.sh.
* Review feedback: -Ddebugger-arg= -> -Darg=.
* Review feedback.
* Review feedback.
* Review feedback: factor host.rs into several submodules.
* Review feedback: rename Debugger to Debuggee on host side.
* Review feedback: split inherit_stdin_stdout, and add corresponding options for the debug component.
* Review feedback.
* Review feedback.
* Add simple debug-component tests.
* Add wasm32-wasip2 target in a few places in CI
* Cargo vets for wstd dependency.
* Add wasm32-wasip2 in more places
* fix debug-component test dependence on componentization byte offsets
* Review feedback.
* Fix cancel-safety of EventFuture.
* Fix: Interrupted events should only occur after interrupt(), not on every epoch yield.
* Review feedback.
* Review feedback: strip down WASI imports in debugger world.
* fold debugger test component back into wasip1 + adapter test artifact compilation flow
show more ...
|
| #
1b59b579 |
| 09-Mar-2026 |
Yordis Prieto <[email protected]> |
Add support for map type (#12216)
* Add support for map type
Signed-off-by: Yordis Prieto <[email protected]>
* Add Map and MapEntry classes to support key/value pairs in component model
Th
Add support for map type (#12216)
* Add support for map type
Signed-off-by: Yordis Prieto <[email protected]>
* Add Map and MapEntry classes to support key/value pairs in component model
This commit introduces the Map and MapEntry classes, enabling the representation of map values in the component model. The Map class allows for the creation and iteration of key/value pairs, enhancing the functionality of the wasmtime component API. Additionally, the .gitignore file is updated to exclude build artifacts from the crates/c-api directory.
* Add wasm_component_model_map configuration support
* Format code
* Format C code
* Enhance component model to support HashMap<K, V> type
This commit introduces support for HashMap<K, V> in the component model, allowing maps to be represented as list<tuple<K, V>> in the canonical ABI. It includes implementations for the ComponentType, Lower, and Lift traits for HashMap, enabling type checking, lowering to flat representations, and lifting from memory. Additionally, the maximum depth for type generation in the fuzzing utility is updated to accommodate the new map type.
* Refactor component configuration to introduce map support
This commit removes the previous wasm features configuration and adds new functions for creating a map-configured engine. The `map_config` and `map_engine` functions are introduced to facilitate the use of the component model with maps in tests, ensuring that the engine is properly configured for map types in the component model.
* Add new WAST test for map types and remove map type definitions from existing tests
This commit introduces a new WAST test file specifically for testing various map types in the component model. Additionally, it removes the redundant map type definitions from the existing types.wast file to streamline the test suite.
* Update component fuzzing and dynamic tests to replace call_and_post_return with call
* Format code
* Refactor HashMap usage in typed.rs to use wasmtime_environ collections
* Fix HashMap initialization and insertion to handle potential errors in typed.rs
* Refactor HashMap handling in typed.rs to use lower_map_iter for improved iteration and memory management. Introduce new implementations for ComponentType, Lower, and Lift traits for std::collections::HashMap, enhancing support for map types in the component model.
* Fix map adapter trampoline compilation and alignment bugs
The translate_map function had two categories of bugs preventing map adapter trampolines from working:
1. Wasm stack discipline: local_set_new_tmp emits LocalSet which pops from the stack, but was called when the stack was empty (to "pre-allocate" locals). Fixed by computing values first, then calling local_set_new_tmp to consume them—matching translate_list's pattern. Also removed an erroneous LocalTee that left an orphan value on the stack. Affected: src_byte_len, dst_byte_len, cur_src_ptr, cur_dst_ptr.
2. Pointer advancement: after value translation, the pointer still points at the value start. The code only advanced by trailing padding instead of value_size + trailing_padding, causing every loop iteration to re-read the same memory.
Also fixes entry layout to use proper record alignment rules (entry align = max(key_align, value_align), value at aligned offset).
* Refactor map entry layout calculations to use canonical ABI
* Remove unnecessary clone of map pairs during lowering
Val::Map already holds Vec<(Val, Val)> which derefs to &[(Val, Val)], matching lower_map's signature directly. The intermediate Vec allocation and deep clone of every key/value pair was redundant.
* Deduplicate map lift logic between HashMap implementations
* Deduplicate list and map sequence translation scaffolding
* Fix cargo fmt formatting issues
* Deduplicate map typecheck logic
* Deduplicate map lowering with linear_lower_map_to_flat and linear_lower_map_to_memory helpers
* Clean up lift_try_map: use drop, move TryHashMap import to module scope
* Fix CI: arbtest overflow and no-std HashMap lift_map
- component_fuzz: use saturating_sub in generate_hashable_key to prevent underflow when fuel is 0 and Enum variant is chosen - typed: remove incorrect ? operators in lift_map for hashbrown::HashMap (with_capacity and insert don't return Result)
* Store map tuple layout in TypeMap
Compute map entry ABI and value offsets once during type building, and reuse that metadata in runtime map lift/lower paths instead of recalculating tuple layout at each call site.
* Refactor map ABI argument passing
Bundle map lift/lower layout and type metadata into a small MapAbi32 helper so map helper calls stay concise without changing behavior.
* Fix CI: enable component_model_map in fuzzing and handle map in arbitrary_val
The fuzzer's component_api oracle was generating map types but the engine didn't have the map feature enabled, and arbitrary_val had no arm for Type::Map. Enable component_model_map in the store helper (matching how component_model_async is forced on) and implement arbitrary value generation for map types.
---------
Signed-off-by: Yordis Prieto <[email protected]>
show more ...
|
|
Revision tags: v42.0.1 |
|
| #
301dc716 |
| 24-Feb-2026 |
Alex Crichton <[email protected]> |
Fix two security advisories. (#12652)
* Fix two security advisories.
This commit contains merged fixes for two security advisories in Wasmtime:
* GHSA-852m-cvvp-9p4w * GHSA-243v-98vx-264h
This in
Fix two security advisories. (#12652)
* Fix two security advisories.
This commit contains merged fixes for two security advisories in Wasmtime:
* GHSA-852m-cvvp-9p4w * GHSA-243v-98vx-264h
This introduces new knobs to Wasmtime to limit the scope of resources that WASI implementations will allocate on behalf of guests. Unlike backports to 41.0.x-and-prior these knobs all have default values which are considered reasonable for hosts if they don't further tune them. The following CLI knobs have been added:
* `-Smax-resources` - limits the total component-model resources a guest can allocate in a table * `-Shostcall-fuel` - a broad limit which enforces that at most this amount of data will be copied from the guest to the host in any one API call (e.g. `string` values can't be too big, `list<string>` can't be quadratic, etc). This fuel is reset on each host function call. * `-Smax-random-size` - the maximal size of the return value of the `get-random-bytes` and `get-insecure-random-bytes` WASI functions. * `-Smax-http-fields-size` - a limit on the size of `wasi:http` `fields` values to avoid infinitely buffering data within the host.
The `http` crate has additionally been updated to avoid a panic when adding too many headers to a `fields` object.
Co-authored-by: Mark Bundschuh <[email protected]> Co-authored-by: Pat Hickey <[email protected]> Co-authored-by: Joel Dice <[email protected]>
* CI fixes
* Run rustfmt * Fix wasi-common build
* Fix tests on 32-bit
* Fix nightly test expectations
prtest:full
---------
Co-authored-by: Mark Bundschuh <[email protected]> Co-authored-by: Pat Hickey <[email protected]> Co-authored-by: Joel Dice <[email protected]>
show more ...
|
|
Revision tags: v41.0.4, v42.0.0, v40.0.4, v36.0.6, v24.0.6, v41.0.3, v41.0.2 |
|
| #
f248b5c0 |
| 02-Feb-2026 |
Arjun Ramesh <[email protected]> |
Config knobs and validation for record-replay (#12375)
|
|
Revision tags: v41.0.1, v36.0.5, v40.0.3 |
|
| #
21797bb5 |
| 23-Jan-2026 |
Alex Crichton <[email protected]> |
Refactor how concurrency support is enabled in a `Store` (#12416)
* Document panics from using CM async machinery when CM async is not enabled
* Refactor how concurrency support is enabled in a `St
Refactor how concurrency support is enabled in a `Store` (#12416)
* Document panics from using CM async machinery when CM async is not enabled
* Refactor how concurrency support is enabled in a `Store`
This commit is an extension/refactor of #12377 and #12379. Notably this decouples the runtime behavior of Wasmtime from enabled/disabled WebAssembly proposals. This enables the `wasmtime serve` subcommand, for example, to continue to disallow component-model-async by default but continue to use `*_concurrent` under the hood.
Specifically a new `Config::concurrency_support` knob is added. This is plumbed directly through to `Tunables` and takes over the preexisting `component_model_concurrency` field. This field configures whether tasks/etc are enabled at runtime for component-y things. The default value of this configuration option is the same as `cfg!(feature = "component-model-async")`, and this field is required if component-model-async wasm proposals are enabled. It's intended that eventually this'll affect on-by-default wasm features in Wasmtime depending if the support is compiled in.
This results in a subtle shift in behavior where component-model-async concurrency is used by default now because the feature is turned on by default, even though the wasm features are off-by-default. This required adjusting a few indices expected in runtime tests due to tasks/threads being allocated in index spaces.
Finally, this additionally denies access at runtime to `Linker::*_concurrent` when concurrent support is disabled as otherwise the various runtime data structures won't be initialized and panics will happen.
Closes #12393
* Add a `-Wconcurrency-support` CLI flag
Used to update disas tests to show that, when disabled, old codegen quality is preserved
* Ungate `Config` flag
* Review comments
---------
Co-authored-by: Nick Fitzgerald <[email protected]>
show more ...
|
|
Revision tags: v41.0.0, v36.0.4, v39.0.2, v40.0.2 |
|
| #
caf0f752 |
| 14-Jan-2026 |
Christof Petig <[email protected]> |
Minimal implementation of fixed-length lists to enable wit-bindgen runtime tests (#10619)
* necessary parts to make the wit-bindgen test pass
* post-merge fixes
* fix clippy
* inline type computa
Minimal implementation of fixed-length lists to enable wit-bindgen runtime tests (#10619)
* necessary parts to make the wit-bindgen test pass
* post-merge fixes
* fix clippy
* inline type computations
* link missing functionality to an issue
* undo unintended removal of blank line
* fix logic mistake, enable feature in wasmtime
* optimized conversion
* add offset
* unify on name and implement wast option
* cargo fmt and beautify fixed_size_list_type
* add multi memory as it is needed by the test runner
* standardize on the official name (component model standard) "fixed-length lists"
changing wasm-tools (parser etc. is a different task)
* More instances of fixed size corrected to fixed length
show more ...
|
|
Revision tags: v40.0.1 |
|
| #
b11f8675 |
| 07-Jan-2026 |
Nick Fitzgerald <[email protected]> |
Migrate CLI flags to `wasmtime::error` (#12260)
|
|
Revision tags: v40.0.0, v39.0.1 |
|
| #
0a55f804 |
| 24-Nov-2025 |
Alex Crichton <[email protected]> |
"Downgrade" threads support to tier 2, disable fuzzing (#12036)
* "Downgrade" threads support to tier 2, disable fuzzing
This commit is borne out of a fuzz bug that was opened recently. The fuzz bu
"Downgrade" threads support to tier 2, disable fuzzing (#12036)
* "Downgrade" threads support to tier 2, disable fuzzing
This commit is borne out of a fuzz bug that was opened recently. The fuzz bug specifically has to do with fallout from #12022, specifically `SharedMemory` being used to allocated instead of `Memory`. In this situation the resource limiter is no longer consulted meaning that shared memories bypass this and aren't caught by OOM checks. This is currently by design because `SharedMemory` instances don't know which resource limiter to hook into per-store.
More generally though the implementation of wasm threads, while workable in Wasmtime, has a number of known relatively large deficiencies. These were not resolved prior to ungating the wasm proposal (that's on me) but nevertheless the quality of implementation is not quite up to "tier 1 par" with the rest of what Wasmtime offers. Given this the threads proposal is now downgraded to tier 2. To help minimize the impact of this the wasm proposal is left enabled-by-default, but creation of a `SharedMemory` in the Rust API requires opting-in via a new `Config::shared_memory` method.
This commit shuffles around some documentation of wasm proposals to split it into tier 1/2/3 instead of on/off-by-default and then adds a column for whether the proposal is on-by-default.
* clangformat
* Fix tests
* Add tests for failed creation
Fix an issue where defined shared memories weren't gated
* Sync disabled threads stub
* Fix another test
prtest:full
* Fix fuzzing tests
* Fix dwarf tests
show more ...
|
|
Revision tags: v39.0.0, v38.0.4, v37.0.3, v36.0.3, v24.0.5 |
|
| #
e06fbf70 |
| 27-Oct-2025 |
Sy Brand <[email protected]> |
Cooperative Multithreading (#11751)
* Initial work
* Almost compiling
* Partially working
* Cleanup
* Fix merge
* Cancellation and suspension refactoring
* Remove printlns
* Test with several
Cooperative Multithreading (#11751)
* Initial work
* Almost compiling
* Partially working
* Cleanup
* Fix merge
* Cancellation and suspension refactoring
* Remove printlns
* Test with several threads
* More testing
* Cancellation
* Fix cancellation for explicit suspends
* Finish cancellation test
* Store threads in the instance table
* Deletion almost there
* Tests all pass
* Tighten up task deletion
* Set thread state correctly
* Store pairs of thread and task ids
* Remove lift abi members
* Cleanup unnecessary change
* More cleanup
* Cleanup
* Revert cargo changes
* Revert cargo changes
* Comments
* Comments on test
* Update comments
* Update comments
* Add space that was removed in an earlier commit
* Cleanup
* Delete threads from the instance table
* Revert cargo file
* Remove dead code
* Clippy changes
* Clippy
* Revert unnecessary changes
* Revert unnecessary changes
* Revert unnecessary changes
* Revert unnecessary changes
* Revert unnecessary changes
* Review comments
* Review feedback
* Make thread IDs per-component-instance
* Fix config
* Tighten up completion
* Clippy
* Trigger full PR test
* Move funcref table reading
* Remove unused import
* Formatting
* Rename RemoveOnDrop
* Review feedback
* Review feedback
* Move start thread closure
* Review feedback
* Review feedback
* Correct feature for import
* Review feedback
* Disable failing tests
* Enable fixed tests
* Review feedback
* Readd tests
* Ignore task deletion test with Miri
show more ...
|
|
Revision tags: v38.0.3, v38.0.2, v38.0.1 |
|
| #
02155232 |
| 15-Oct-2025 |
Chris Fallin <[email protected]> |
Wasmtime: implement debug instrumentation and basic host API to examine runtime state. (#11769)
* Wasmtime: implement debug instrumentation and basic host API to examine runtime state.
This PR impl
Wasmtime: implement debug instrumentation and basic host API to examine runtime state. (#11769)
* Wasmtime: implement debug instrumentation and basic host API to examine runtime state.
This PR implements ideas from the [recent RFC] to serve as the basis for Wasm (guest) debugging: it adds a stackslot to each function translated from Wasm, stores to replicate Wasm VM state in the stackslot as the program runs, and metadata to describe the format of that state and allow reading it out at runtime.
As an initial user of this state, this PR adds a basic "stack view" API that, from host code that has been called from Wasm, can examine Wasm frames currently on the stack and read out all of their locals and stack slots.
Note in particular that this PR does not include breakpoints, watchpoints, stepped execution, or any sort of user interface for any of this; it is only a foundation.
This PR still has a few unsatisfying bits that I intend to address:
- The "stack view" performs some O(n) work when the view is initially taken, computing some internal data per frame. This is forced by the current design of `Backtrace`, which takes a closure and walks that closure over stack frames eagerly (rather than work as an iterator). It's got some impressive iterator-chain stuff going on internally, so refactoring it to the latter approach might not be *too* bad, but I haven't tackled it yet.
A O(1) stack view, that is, one that does work only for frames as the host API is used to walk up the stack, is desirable because some use-cases may want to quickly examine e.g. only the deepest frame (say, running with a breakpoint condition that needs to read a particular local's value after each step).
- It includes a new `Config::compiler_force_inlining()` option that is used only for testing that we get the correct frames after inlining. I couldn't get the existing flags to work on a Wasmtime config level and suspect there may be an existing bug there; I will try to split out a fix for it.
This PR renames the existing `debug` option to `native_debug`, to distinguish it from the new approach.
[recent RFC]: https://github.com/bytecodealliance/rfcs/pull/44
* Update to new APIs on Cranelift side.
* Test update.
* Adjust objdump printing of InstPos on frame progpoints; and adjust progpoint collapsing.
* Convert to iterator form.
* Fix path in native-debug tests (debug -> native_debug rename).
* Enforce that `debug_instrumentation` can only be enabled when feature is enabled.
* Add missing assert.
* Use builtin knob for forcing intra-module inlining instead.
* Review feedback:
- Make StackView own the current frame rather than handing it out. This prevents the current frame (`FrameView`) from walking away and hiding somewhere it shouldn't, to be used unsoundly later. - Assert no-GC during stack walk.
* Merge debug-instrumentation hooks on FuncEnvironment into before/after hooks.
* Review feedback: avoid downcasting funcs twice.
* Add debug feature to `wasmtime` crate's defaults.
* Review feedback: u32s for local and stack indices in debug host API.
* Use *const u8 as stack pointers and `with_exposed_provenance` in debug API.
* Remove some `srcloc` plumbing in Wasm translator.
* Rename native-debug back to debug, and make the new thing "guest debugging".
* rustfmt in debugging test.
* fix disas test after guest-debug CLI option rename.
* Review feedback: no separate debug-instrumentation hooks on FuncEnvironment.
* Review feedback: update doc comment on `Config::guest_debug`.
* Review feedback: rename `generate_debuginfo` to `debug_native` in tunables.
* Review feedback: miscellaneous comments.
* Review comment: fix wording in safety conditions.
* revert wasi-common submodule update
* Properly root values in debug frame slots.
Fixes #11841.
* Fix non-`debug`-feature build.
* Review feedback: naming.
* Ignore tests that compile modules in miri.
show more ...
|
|
Revision tags: v37.0.2, v37.0.1, v37.0.0, v36.0.2 |
|
| #
73de2ee9 |
| 25-Aug-2025 |
Chris Fallin <[email protected]> |
Pull in new regalloc2 with fastalloc fixes for exceptions, and re-enable and add to testing. (#11533)
* Revert "Cranelift/Wasmtime: disable fastalloc (single-pass) allocator for now. (#10554)"
This
Pull in new regalloc2 with fastalloc fixes for exceptions, and re-enable and add to testing. (#11533)
* Revert "Cranelift/Wasmtime: disable fastalloc (single-pass) allocator for now. (#10554)"
This reverts commit d52e23b09191185996792b8ef18e5fca2865ca43.
* Upgrade to regalloc2 0.13.1.
Pulls in bytecodealliance/regalloc2#233 to update fastalloc to support the looser constraints needed by exception-related changes.
* cargo-vet update.
show more ...
|
|
Revision tags: v36.0.1 |
|
| #
2d25f862 |
| 21-Aug-2025 |
Chris Fallin <[email protected]> |
WebAssembly exception-handling support. (#11326)
* WebAssembly exception-handling support.
This PR introduces support for the [Wasm exception-handling proposal], which introduces a conventional try
WebAssembly exception-handling support. (#11326)
* WebAssembly exception-handling support.
This PR introduces support for the [Wasm exception-handling proposal], which introduces a conventional try/catch mechanism to WebAssembly. The PR supports modules that use `try_table` to register handlers for a lexical scope; and provides `throw` and `throw_ref` that allocate (in the first case) and throw exception objects.
This PR builds on top of the work in #10510 for Cranelift-level exception support, #10919 for an unwinder, and #11230 for exception objects built on top of GC, in addition a bunch of smaller fix and enabling PRs around those.
[Wasm exception-handling proposal]: https://github.com/WebAssembly/exception-handling/
prtest:full
* Permit UnwindToWasm to have unused fields in Pulley builds (for now).
* Resolve miri-caught reborrowing issue.
* Ignore exceptions tests in miri for now (Pulley not supported).
* Use wasmtime_test on exceptions tests.
* Get tests passing on pulley platforms
* Add a check to `supports_host` for the generated test and assert failure also when that is false. * Remove `pulley_unsupported` test as it falls out of `#[wasmtime_test]` * Remove `exceptions_store` helper as it falls out of `#[wasmtime_test]` * Remove miri annotations as they fall out of `#[wasmtime_test]`
* Remove dead import
* Skip some unsupported tests entirely in `#[wasmtime_test]`
If the selected compiler doesn't support the host at all then there's no need to run it. Actually running it could misinterpret `CraneliftNative` as "run with pulley" otherwise, so avoid such false negatives.
* Cranelift: dynamic contexts: account for outgoing-args area.
---------
Co-authored-by: Alex Crichton <[email protected]>
show more ...
|
|
Revision tags: v36.0.0 |
|
| #
3fab18ff |
| 19-Aug-2025 |
Alex Crichton <[email protected]> |
Change how wasm features/gc support work in `Config` (#11463)
This commit aims to address #11450 in complementary but somewhat orthogonal ways. First a new `Config::gc_support` option is added which
Change how wasm features/gc support work in `Config` (#11463)
This commit aims to address #11450 in complementary but somewhat orthogonal ways. First a new `Config::gc_support` option is added which is hooked up to the CLI as `-Wgc-support`. This option controls the wasmparser-internal `GC_TYPES` feature. Its default value, like before, is `cfg!(feature = "gc")` and additionally enabling it requires the `gc` crate feature to be enabled.
This commit then additionally updates how wasm features are processed during validating a deserialized module to only require enabled features to be enabled in the host. Previously modules that disabled a feature but the feature was enabled in the host would fail to deserialize. All WebAssembly proposals are additive, however, so it's always ok to disable a feature and then load it into a module that enables the wasm proposal.
Closes #11450
show more ...
|
| #
698028ce |
| 14-Aug-2025 |
Alex Crichton <[email protected]> |
Add a configuration knob for `PAGEMAP_SCAN` (#11433)
* Add a configuration knob for `PAGEMAP_SCAN`
This commit adds `PoolingAlloationConfig::pagemap_scan` and additionally adds `-Opooling-pagemap-s
Add a configuration knob for `PAGEMAP_SCAN` (#11433)
* Add a configuration knob for `PAGEMAP_SCAN`
This commit adds `PoolingAlloationConfig::pagemap_scan` and additionally adds `-Opooling-pagemap-scan` to configure on the CLI. This is the same tri-state configuration option as `MpkEnable` so that enum was renamed to just `Enabled` and repurposed for both options.
This then additionally turns the option off-by-default instead of the previous on-by-default-if-able-to to enable more slowly rolling out this feature.
* Fix broken test
show more ...
|
| #
eced7c7e |
| 12-Aug-2025 |
Alex Crichton <[email protected]> |
Add a new `-Sp3` option to the CLI (#11423)
* Add a new `-Sp3` option to the CLI
This commit adds a new WASI-specific CLI option dubbed "p3" which controls whether WASIp3 interfaces are added to th
Add a new `-Sp3` option to the CLI (#11423)
* Add a new `-Sp3` option to the CLI
This commit adds a new WASI-specific CLI option dubbed "p3" which controls whether WASIp3 interfaces are added to the component linker and whether WASIp3 exports are searched for. Integration here is only added with `wasmtime run` and support for `wasmtime serve` will come once wasi:http is migrated to this repository from the p3-prototyping repository.
The `-Sp3` option is off-by-default at this time but this is structured to enable it by default in the future. A test is added to ensure that WASIp3 is usable and a basic "hello world" works.
Some internal refactoring was done to share more code between `run` and `serve` with respect to adding WASI interfaces to a linker.
* Use a normal blocking test
* Fix warning
show more ...
|
| #
3ecb338e |
| 29-Jul-2025 |
Nick Fitzgerald <[email protected]> |
Wasmtime: Add (optional) bottom-up function inlining to Wasm compilation (#11283)
* Wasmtime: Add (optional) bottom-up function inlining to Wasm compilation
This commit plumbs together two pieces o
Wasmtime: Add (optional) bottom-up function inlining to Wasm compilation (#11283)
* Wasmtime: Add (optional) bottom-up function inlining to Wasm compilation
This commit plumbs together two pieces of recently-added infrastructure:
1. function inlining in Cranelift, and 2. the parallel bottom-up inlining scheduler in Wasmtime.
Sprinkle some very simple inlining heuristics on top, and this gives us function inlining in Wasm compilation.
The default Wasmtime configuration does not enable inlining, and when we do enable it, we only enable it for cross-component calls by default (since presumably the toolchain that produced a particular core Wasm module, like LLVM, already performed any inlining that was beneficial within that module, but that toolchain couldn't know how that Wasm module would be getting linked together with other modules via component composition, and so it could not have done any cross-component inlining). For what it is worth, there is a config knob to enable intra-module function inlining, but this is primarily for use by our fuzzers, so that they can easily excercise and explore this new inlining functionality.
All this plumbing required some changes to the `wasmtime_environ::Compiler` trait, since Winch cannot do inlining but Cranelift can. This is mostly encapsulated in the new `wasmtime_environ::InliningCompiler` trait, for the most part. Additionally, we take care not to construct the call graph, or any other data structures required only by the inliner and not regular compilation, both when using Winch and when using Cranelift with inlining disabled.
Finally, we add a `disas` test to verify that we successfully inline a series of calls from a function in one component, to a cross-component adapter function, to a function in another component. Most test coverage is expected to come from our fuzzing, however.
* Fix dead code warning when not `cfg(feature = "component-model")`
* fix winch trampoline compilation
* Move CLI options to codegen
* Move parameters into struct
* Use an index set for call-graph construction
* Smuggle inlining heuristic options through cranelift flags
* Remove old CLI flags
* set tunables before settings
* Only configure inlining options for cranelift in fuzzing
show more ...
|
|
Revision tags: 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 |
|
| #
03c2a823 |
| 06-Jun-2025 |
Nick Fitzgerald <[email protected]> |
Add a knob to `wasmtime::Config` and a CLI flag for GC support in the component-model (#10967)
|
| #
63d482c8 |
| 04-Jun-2025 |
Frank Emrich <[email protected]> |
Stack switching: Infrastructure and runtime support (#10388)
* [pr1] base
* prtest:full
* make sure to use ControlFlow result in trace_suspended_continuation
* stack-switching: cleanup: remove st
Stack switching: Infrastructure and runtime support (#10388)
* [pr1] base
* prtest:full
* make sure to use ControlFlow result in trace_suspended_continuation
* stack-switching: cleanup: remove stray c-api changes
These are remnants of unrelated wasmfx wasmtime experiments, possibly suitable for later submission against upstream.
* stack-switching: reuse async_stack_size
* stack-switching: delete delete_me debugging
* stack-switching: address feedback in environ::types
* stack-switching: remove unused code from vmoffsets
* stack-switching: drop dependency on std
* stack-switching: add compilation checks to ci matrix
* stack-switching: remove debug_println cruft
* stack-switching: export environ consts consistently
* stack-switching: export vm pub items consistently
* table_pool: reduced capacity for large elements
VMContRef elements which takes up two words and we don't want to double the size of all tables in order to support storing these. This change changes the table to target storing the requested max number of elements if they are "nominally" sized with (potentially) reduced capacity for non-nominally sized types when encountered.
Continuations are the only type of element which may result in fewer table slots being available than requested.
* stack-switching: extend conditional compilation
A fair bit of the definitions for stack switching are still enabled, but this patch takes things a bit further to avoid compilation problems; notably, cont_new is now not compiled in unless the feature is enabled.
* stack-switching: formatting fixes
* stack-switching: address new clippy checks
In addition, to get clippy to fully pass, plumbed in additional config to make winch paths happy; there's no impl for winch yet but plumbing through the feature is required to make paths incorporating macros at various layers satisfied (and it is expected we'll use the features in the future).
* stack-switching: more conditional compilation fixes
* stack-switching: additional conditional compile on table builtins for continuations
* stack-switching: additional conditional compile fixes
* stack-switching: additional conditional compile in store
* stack-switching: remove overly strict assertion
* stack-switching: remove errantly dropped no_mangle in config c-api
* stack-switching: VMContObj::from_raw_parts
* stack-switching: remove duplicate async_stack_size feature check
* stack-switching: VMArray -> VMHostArray
* stack-switching: remove unnecessary clippy exception
* stack-switching: fix docs referenced VMRuntimeLimits
* stack-switching: fix doc typo
* stack-switching: follow recommendations for type casts
* stack-switching: use usize::next_multiple_of
* stack-switching: update outdated comment
* stack-switching: use feature gate instead of allow(dead_code)
* stack-switching: rework backtrace using chunks/zip
* stack-switching: move tests to footer module
This is a bit more consistent with the prevailing style in tree and (subjectively) makes finding the tests as a reader more straightforward.
Tests left unchanged sans some import cleanup.
* stack-swictchding: verify stack_chain offsets at runtime
* fixup! stack-switching: use feature gate instead of allow(dead_code)
* stack-switching: document continuation roots tracing using match arms
---------
Co-authored-by: Paul Osborne <[email protected]>
show more ...
|
| #
c857f687 |
| 27-May-2025 |
Alex Crichton <[email protected]> |
Add plumbing for `error-context` component model feature (#10807)
This commit adds plumbing in locations for the `error-context` feature of the component model. This is porting some minor changes fr
Add plumbing for `error-context` component model feature (#10807)
This commit adds plumbing in locations for the `error-context` feature of the component model. This is porting some minor changes from the wasip3-prototyping repository back to the main repo.
show more ...
|
|
Revision tags: v33.0.0 |
|
| #
2cd52b76 |
| 29-Apr-2025 |
Ben Brandt <[email protected]> |
Allow creation of a CacheConfig without loading from a file (#10665)
* cache: Add builder pattern for CacheConfig
* wasmtime: Add cache_config method to wasmtime::Config
* Refactor test_builder_de
Allow creation of a CacheConfig without loading from a file (#10665)
* cache: Add builder pattern for CacheConfig
* wasmtime: Add cache_config method to wasmtime::Config
* Refactor test_builder_default to use test_prolog helper
* Remove enabled option from CacheConfigBuilder and always set to true
* Change builder methods to take &mut self and return &mut Self
* Simplify cache configuration API
A new `cache_config(Option<CacheConfig>)` method replaces multiple methods for controlling module caching. Now `None` disables caching, and users can directly provide a cache config or load one from a file.
* Make cache configuration optional
* Add Cache struct to separate configuration from runtime (wip)
* Ensure default values earlier
* Consolidate CacheConfig and CacheConfigBuilder
* Set Cache directly on wastime::Config and make it easier to create one from a file
* Validate after loading file again
* Move cache to top-level module
* Fix tests
show more ...
|
| #
1bee07d7 |
| 25-Apr-2025 |
Pat Hickey <[email protected]> |
update cli help text for WASI listenfd and tcplisten options (#10673)
* tcplisten is experimental (not described in a ratified standard) and legacy wasip1 implementation (aka wasi-common) only. *
update cli help text for WASI listenfd and tcplisten options (#10673)
* tcplisten is experimental (not described in a ratified standard) and legacy wasip1 implementation (aka wasi-common) only. * listenfd is not nonstandard, but its also legacy wasip1 only.
show more ...
|
|
Revision tags: v32.0.0 |
|
| #
3b21c448 |
| 11-Apr-2025 |
Andrew Brown <[email protected]> |
threads: add more flags (#10569)
This adds CLI-level flags for `shared-everything-threads` based on this [comment].
[comment]: https://github.com/bytecodealliance/wasmtime/pull/10206#pullrequestrev
threads: add more flags (#10569)
This adds CLI-level flags for `shared-everything-threads` based on this [comment].
[comment]: https://github.com/bytecodealliance/wasmtime/pull/10206#pullrequestreview-2760585559
show more ...
|
| #
d52e23b0 |
| 09-Apr-2025 |
Chris Fallin <[email protected]> |
Cranelift/Wasmtime: disable fastalloc (single-pass) allocator for now. (#10554)
Unfortunately, as discovered by a recent fuzzbug [1], the single-pass register allocator is not compatible with the ap
Cranelift/Wasmtime: disable fastalloc (single-pass) allocator for now. (#10554)
Unfortunately, as discovered by a recent fuzzbug [1], the single-pass register allocator is not compatible with the approach to callsite defs that exception-handling support has forced us to take. In particular, we needed to move all call return-value defs onto the call instruction itself, so calls could be terminators; this unbounded number of defs is made to be a solvable allocation problem by using `any` constraints, which allow allocation directly into spillslots; but fastalloc appears to error out if it runs out of registers, regardless of this constraint.
Long-term, we should fix this, but unfortunately I don't have cycles to dive into fastalloc's internals at the moment, and it's (I think) a tier-3 feature. As such, this PR disables its use for now. I've filed a tracking issue in RA2 [2], and referenced this in the Cranelift configuration option docs at least.
To keep from shifting all fuzzbugs / fuzzing corpii by altering the `arbitrary` interpretation, I opted to keep the enum the same in the fuzzing crate, and remap `SinglePass` to `Backtracking` there. I'm happy to take the other approach and remove the option (thus invalidating all fuzzbugs) if we'd prefer that instead.
[1]: https://oss-fuzz.com/testcase-detail/5433312476987392 [2]: https://github.com/bytecodealliance/regalloc2/issues/217
show more ...
|