Miscellaneous feature-related build fixes. (#12719)Most found with cargo-all-features.Signed-off-by: Piotr Sikora <[email protected]>
Polyfill `ToWasmtimeResult` and add eventually-necessary call sites (#12308)* Polyfill `ToWasmtimeResult` and add eventually-necessary call sitesThis commit polyfills `wasmtime_internal_error::To
Polyfill `ToWasmtimeResult` and add eventually-necessary call sites (#12308)* Polyfill `ToWasmtimeResult` and add eventually-necessary call sitesThis commit polyfills `wasmtime_internal_error::ToWasmtimeResult` in`wasmtime_environ`, adds the cargo feature plumbing that will eventually connectto the `"wasmtime_internal_error/anyhow"` cargo feature but for now justconfigures this polyfill, and adds uses of the polyfill at all the sites thatwill be necessary once we swap out `anyhow` for`wasmtime_internal_error`. Currently, the polyfill is just an identity function,because `wasmtime::Result`/`wasmtime_environ::error::Result` is just anothername for `anyhow::Result`. Once we do move away from `anyhow`, however, thatwill no longer be the case, and these uses will do the necessary conversion.My goal with landing this as an incremental commit is to make it so that theactual commit that does the error crate swap out can be as close to _just_ the`Cargo.toml` dependency change, without any other code changes as much aspossible. This, in turn, means that swap out should be super easy to revert, ifnecessary.* Add a couple more `.to_wasmtime_result()` invocations in fuzz code* Revert "Add a couple more `.to_wasmtime_result()` invocations in fuzz code"This reverts commit b33696e5f63f7eed731ca9dad10fec5e55a550d3.* Move cranelift fuzz targets back to anyhow* Fix cargo feature enablement for explorer
show more ...
Make profiling more amenable to other in-process engines (#11865)Both the perfmap and jitdump protocols for profiling JITs require thatthere's a single file with metadata per-process. This has the
Make profiling more amenable to other in-process engines (#11865)Both the perfmap and jitdump protocols for profiling JITs require thatthere's a single file with metadata per-process. This has theunfortunate side effect of if there are multiple engines in the sameprocess there's no real way for them to coordinate when writing outrecords to this file. In an attempt to at least try to synchronize thiscommit updates these two implementations to issue a single `write`syscall with the full contents of the record to a file opened in`O_APPEND` mode.If all the stars align and a partial write doesn't happen then thatmeans we're doing our best effort to cooperate with other engines in thesame process. If a partial write happens the decision in this PR is togo ahead and retry the rest of the write (using the `write_all` helper).This is a tradeoff where it makes the single-engine use case more robust(partial writes are handled correctly) but the multi-engine use casewill produce corrupt files. It doesn't feel like a great tradeoff to saythat profiling can't be done in Wasmtime when a partial write wouldhappen for this niche use case of multiple engines, hence the directionof this tradeoff.Closes #11862
Remove `cranelift_entity::{Signed, Unsigned}` (#11400)Use `*::cast_{un,}signed` in the Rust standard library stabilized in1.87.
Enable `allow_attributes_without_reason` (#11195)* Enable `allow_attributes_without_reason`This commit enables the `clippy::allow_attributes_without_reason` forthe `wasmtime` crate which previou
Enable `allow_attributes_without_reason` (#11195)* Enable `allow_attributes_without_reason`This commit enables the `clippy::allow_attributes_without_reason` forthe `wasmtime` crate which previously forcibly allowed it. The reasonthis was allowed was that when the workspace was first migrated theWasmtime crate had too many instances that I was willing to fix. I'venow come back around and tried to fix everything.In short: ideally delete `#[allow]`, otherwise use `#[expect]`,otherwise use `#[allow]`.prtest:full* Adjust some directives* Fix some warnings* Fix stack switching size tests on unix* Don't have a conditional `Drop` impl* Force `testing_freelist` method to be usedToo lazy to write `#[cfg]`, but not too lazy to write a test.
fix: typos in documentation files (#10227)* Update README.md* Update compiler.rs* Update types.rs* Update pulley.rs* Update func.rs
Add basic support for profiling Pulley (#10034)* Add basic support for profiling PulleyThis commit adds basic support for profiling the Pulley interpreter.This is partially achievable previously
Add basic support for profiling Pulley (#10034)* Add basic support for profiling PulleyThis commit adds basic support for profiling the Pulley interpreter.This is partially achievable previously through the use of nativeprofilers, but the downside of that approach is that you can find hotinstructions but it's not clear in what context the hot instructions arebeing executed nor what functions are hot. The goal of this profiler isto show pulley bytecode and time spent in bytecode itself to betterunderstand the shape of code around a hot instruction to identify newmacro opcodes for example.The general structure of this new profiler is:* There is a compile-time feature for Pulley which is off-by-default where, when enabled, Pulley will record its current program counter into an `AtomicUsize` before each instruction.* When the CLI has `--profile pulley` Wasmtime will spawn a sampling thread in the same process which will periodically read from this `AtomicUsize` to record where the program is currently executing.* The Pulley profiler additionally records all bytecode through the use of the `ProfilingAgent` trait to ensure that the recording has access to all bytecode as well.* Samples are taken throughout the process and emitted to a `pulley-$pid.data` file. This file is then interpreted and printed by an "example" program `profiler-html.rs` in the `pulley/examples` directory.The end result is that hot functions of Pulley bytecode can be seen andinstructions are annotated with how frequently they were executed. Thisenables finding hot loops and understanding more about the whole loop,bytecodes that were selected, and such.* Add missing source file* Check the profile-pulley feature in CI* Miscellaneous fixes for CI* Fix type-checking of `become` on nightly Rust* Fix more misc CI issues* Fix dispatch in tail loop* Update test expectations* Review comments* Fix a feature combo
Enforce `uninlined_format_args` for the workspace (#9065)* Enforce `uninlined_format_args` for the workspace* fix: failing `Monolith Checks` job* fix: formatting
Refactor internal profiling APIs to be safer (#8914)Pass around `&[u8]` instead of `*const u8` and `usize` to avoid the needfor raw unsafe abstractions.Closes #8905
Add `anyhow` stuff to our internal `wasmtime` crate prelude (#8804)* Add `anyhow` stuff to our internal `wasmtime` crate preludeWe use it basically everywhere and it is annoying to have to import
Add `anyhow` stuff to our internal `wasmtime` crate prelude (#8804)* Add `anyhow` stuff to our internal `wasmtime` crate preludeWe use it basically everywhere and it is annoying to have to import.I also did an audit of existing `use` statements and removed the now-redundantones and replaced one-off imports with usage of the prelude, so that the preludeis available by default in more places.* Fix `cargo doc`
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]>
Add support for `#![no_std]` to the `wasmtime` crate (#8533)* Always fall back to custom platform for WasmtimeThis commit updates Wasmtime's platform support to no longer require anopt-in `RUSTF
Add support for `#![no_std]` to the `wasmtime` crate (#8533)* Always fall back to custom platform for WasmtimeThis commit updates Wasmtime's platform support to no longer require anopt-in `RUSTFLAGS` `--cfg` flag to be specified. With `no_std` becomingofficially supported this should provide a better onboarding experiencewhere the fallback custom platform is used. This will cause linkererrors if the symbols aren't implemented and searching/googling shouldlead back to our docs/repo (eventually, hopefully).* Change Wasmtime's TLS state to a single pointerThis commit updates the management of TLS to rely on just a singlepointer rather than a pair of a pointer and a `bool`. Additionallymanagement of the TLS state is pushed into platform-specific modules toenable different means of managing it, namely the "custom" platform nowhas a C function required to implement TLS state for Wasmtime.* Delay conversion to `Instant` in atomic intrinsicsThe `Duration` type is available in `no_std` but the `Instant` type isnot. The intention is to only support the `threads` proposal if `std` isactive but to assist with this split push the `Duration` further intoWasmtime to avoid using a type that can't be mentioned in `no_std`.* Gate more parts of Wasmtime on the `profiling` featureMove `serde_json` to an optional dependency and gate the guest profilerentirely on the `profiling` feature.* Refactor conversion to `anyhow::Error` in `wasmtime-environ`Have a dedicated trait for consuming `self` in addition to a`Result`-friendly trait.* Gate `gimli` in Wasmtime on `addr2line`Cut down the dependency list if `addr2line` isn't enabled since thenthe dependency is not used. While here additionally lift the versionrequirement for `addr2line` up to the workspace level.* Update `bindgen!` to have `no_std`-compatible outputPull most types from Wasmtime's `__internal` module as the source oftruth.* Use an `Option` for `gc_store` instead of `OnceCell`No need for synchronization here when mutability is already available inthe necessary contexts.* Enable embedder-defined host feature detection* Add `#![no_std]` support to the `wasmtime` crateThis commit enables compiling the `runtime`, `gc`, and `component-model`features of the `wasmtime` crate on targets that do not have `std`. Thistags the crate as `#![no_std]` and then updates everything internally toimport from `core` or `alloc` and adapt for the various idioms. Thisended up requiring some relatively extensive changes, but nothing tootoo bad in the grand scheme of things.* Require `std` for the perfmap profiling agentprtest:full* Fix build on wasm* Fix windows build* Remove unused import* Fix Windows/Unix build without `std` feature* Fix some doc links* Remove unused import* Fix build of wasi-common in isolation* Fix no_std build on macos* Re-fix build* Fix standalone build of wasmtime-cli-flags* Resolve a merge conflict* Review comments* Remove unused import
Remove `wasmtime-jit` (#7769)* Move `jit` crate to `environ`Move the platform agnostic parts of the crate `wasmtime-jit` to`wasmtime-environ`. This is the first part of the refactoring discussed
Remove `wasmtime-jit` (#7769)* Move `jit` crate to `environ`Move the platform agnostic parts of the crate `wasmtime-jit` to`wasmtime-environ`. This is the first part of the refactoring discussedhere: https://github.com/bytecodealliance/wasmtime/issues/7652 and afollow up will move the remaining parts of `wasmtime-jit` so that thecrate can be deleted.* Move `jit` crate to `wasmtime`Move the remaining parts of `wasmtime-jit` to the `wasmtime` crate andremove `wasmtime-jit`. This is part of the refactoring discussed inhttps://github.com/bytecodealliance/wasmtime/issues/7652.* undo toml formatting* Trigger pipeline: prtest:full* Remove `jit` directory* move `ProfilingAgent` out of `profiling` feature* add links to ELF_NAME_DATA