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
show more ...
Allow compiling debug-builtins in no_std environment to enable gdb jit (#11304)* Allow compiling debug-builtins in no_std environment to enable gdb jit- Make jit-debug crate #![no_std] when `std`
Allow compiling debug-builtins in no_std environment to enable gdb jit (#11304)* Allow compiling debug-builtins in no_std environment to enable gdb jit- Make jit-debug crate #![no_std] when `std` feature is not enabled- Make gdb_jit_int module build in no_std environment- Use std when perf_jitdebug is enabled because the perf_jitdebug module does not run in no_std environment- Change debug-builtins feature to only enable gdb_jit_int- The perf_jitdebug feature is enabled in profiling mode onlySigned-off-by: Doru Blânzeanu <[email protected]>* Remove feature listing from `default`These are otherwise present via `std`.* Shuffle around some features* Enable `wasmtime-jit-debug/std` from wasmtime's `std` feature* Only enable `perf_jitdump` from `profiling` as that's all that's explicitly needed.* Remove empty features list* Cut down on some `#[cfg]` usage* Update comments in gdb_jit_int module* Add CI checks that `debug-builtins` builds on no_std* Fix missing has_host_compiler_backend when debug-builtins enabledSigned-off-by: Doru Blânzeanu <[email protected]>---------Signed-off-by: Doru Blânzeanu <[email protected]>Co-authored-by: Alex Crichton <[email protected]>
More clearly flag internal crates as such (#10963)* More clearly flag internal crates as suchThis commit is an attempt to more clearly flag internal crates in thisproject as internal and not int
More clearly flag internal crates as such (#10963)* More clearly flag internal crates as suchThis commit is an attempt to more clearly flag internal crates in thisproject as internal and not intended for external use. Specifically:* Many crates are renamed from `wasmtime-foo` to `wasmtime-internal-foo`.* All of these crates now have `INTERNAL: ...` in their crates.io description.* All of these crates now have a warning at the top of their documentation discouraging use.This change is a result of rustsec/advisory-db#1999 where the goal is tobe crystal clear from a project perspective that usage of these cratesare highly discouraged and not supported. We'll still probably get suchadvisories but we won't be considering them CVEs from the project itselfdue to the internal nature of these crates and the discouragingwarnings.Some concrete changes used here are:* Inter-crate dependencies still use `wasmtime_foo` for naming and do so with Cargo's package-renaming features.* Crate renames are specified at the workspace level so the rename is only in one locations and all other inherit it.* Contribution documentation now has some brief guidelines about crate organization.* Update vet config* Update checks for wasmtime-fiberprtest:full* Update publish script* Another fiber rename* Fix some doc tests
Duplicate page size determination in `wasmtime-fiber` (#10803)* Duplicate page size determination in `wasmtime-fiber`Currently Wasmtime has a function `crate::runtime::vm::host_page_size`but thi
Duplicate page size determination in `wasmtime-fiber` (#10803)* Duplicate page size determination in `wasmtime-fiber`Currently Wasmtime has a function `crate::runtime::vm::host_page_size`but this isn't reachable from the `wasmtime-fiber` crate and instead thacrate uses `rustix::param::page_size` to determine the host page size.It looks like this usage of `rustix` is causing a panic in #10802.Ideally `wasmtime-fiber` would be able to use the same function but thecrate separation does not currently make that feasible. For nowduplicate the logic of `wasmtime` into `wasmtime-fiber` as it's modestenough to ensure that this does not panic.Closes #10802* Run full test suite in CIprtest:full
Enable the `unsafe-op-in-unsafe-fn` lint (#10559)* Enable the `unsafe-op-in-unsafe-fn` lintThis commit enables the `unsafe-op-in-unsafe-fn` lint in rustc for theentire workspace. This lint will
Enable the `unsafe-op-in-unsafe-fn` lint (#10559)* Enable the `unsafe-op-in-unsafe-fn` lintThis commit enables the `unsafe-op-in-unsafe-fn` lint in rustc for theentire workspace. This lint will be warn-by-default in the 2024 editionso this is intended to smooth the future migration to the new edition.Many `unsafe` blocks were added in places the lint warned about, withtwo major exceptions. The `wasmtime` and `wasmtime-c-api` crates simplyexpect this lint to fire and effectively disable the lint. They're toobig at this time to do through this PR. My hope is that one day in thefuture they'll be migrated, but more realistically that probably won'thappen so these crates just won't benefit from this lint.* Fix nostd fiber buildprtest:full* Fix build on Windows* Fix asan build
Enable `missing-unsafe-on-extern` lint (#9963)* Enable `missing-unsafe-on-extern` lintThis'll be a hard error in the 2024 edition so go ahead and opt-in to itnow to ease our future transition.
Enable `missing-unsafe-on-extern` lint (#9963)* Enable `missing-unsafe-on-extern` lintThis'll be a hard error in the 2024 edition so go ahead and opt-in to itnow to ease our future transition.* Fix adapter build* Fix custom c-api build* Fix fuzzer build* Fix some Windows `extern` blocks
Leverage Rust 1.79, 1.80 (#9498)This commit is a follow-up to #9496 to leverage various APIs that theworkspace now has access to. For example most dependencies on the`once_cell` crate are now rem
Leverage Rust 1.79, 1.80 (#9498)This commit is a follow-up to #9496 to leverage various APIs that theworkspace now has access to. For example most dependencies on the`once_cell` crate are now removed in favor of the types stabilized inthe standard library: `LazyLock` and `LazyCell`. One dependency remainsin the `wasmtime` crate due to the `get_or_try_init` not being stableyet.Some additional helper methods on raw pointer slices are also availablefor removing a few minor `unsafe` blocks.
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
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]>
Support multiple versions of `wasmtime` in the same crate (#6673)* Attempt versioned exports to facilitate having multiple versions in the same crate* Modify approach to use `export_name` and `li
Support multiple versions of `wasmtime` in the same crate (#6673)* Attempt versioned exports to facilitate having multiple versions in the same crate* Modify approach to use `export_name` and `link_name`* Only apply version to names in assembly and foreign item fns* Attempt to handle the s390x case* Fix alignment of backslashes in assembly file* Pretend I understand the preprocessor* Version symbols in `crates/runtime/src/helpers.c`* Stop versioning `__jit_debug_register_code` because gdb relies on it and it is uses `weak` linkage* Version symbol in `crates/fiber/src/windows.c`* Consolidate `LitStr` creation in macro* Add new crate to publish script and supply-chain config* Fix order in supply chain config* Set `audit-as-crates-io` to false* Missing `versioned_link` for Windows* Version strings used in debug* Formatting* Get rid of `versioned_str` and bring back `versioned_suffix`---------Co-authored-by: Alex Crichton <[email protected]>
Add support for generating perf maps for simple perf profiling (#6030)* Add support for generating perf maps for simple perf profiling* add missing enum entry in C code* bugfix: use hexa when p
Add support for generating perf maps for simple perf profiling (#6030)* Add support for generating perf maps for simple perf profiling* add missing enum entry in C code* bugfix: use hexa when printing the code region's length too (thanks bjorn3!)* sanitize file name + use bufwriter* introduce --profile CLI flag for wasmtime* Update doc and doc comments for new --profile option* remove redundant FromStr import* Apply review feedback: make_line receives a Write impl, report errors* fix tests?* better docs
Migrate most of wasmtime from lazy_static to once_cell (#4368)* Update tracing-core to a version which doesn't depend on lazy-static. * Update crossbeam-utils to a version that doesn't depend on
Migrate most of wasmtime from lazy_static to once_cell (#4368)* Update tracing-core to a version which doesn't depend on lazy-static. * Update crossbeam-utils to a version that doesn't depend on lazy-static. * Update crossbeam-epoch to a version that doesn't depend on lazy-static. * Update clap to a version that doesn't depend on lazy-static. * Convert Wasmtime's own use of lazy_static to once_cell. * Make `GDB_REGISTRATION`'s comment a doc comment. * Fix compilation on Windows.
Update WASI to cap-std 0.25 and windows-sys. (#4302)This updates to rustix 0.35.6, and updates wasi-common to use cap-std 0.25 and windows-sys (instead of winapi). Changes include: - Better
Update WASI to cap-std 0.25 and windows-sys. (#4302)This updates to rustix 0.35.6, and updates wasi-common to use cap-std 0.25 and windows-sys (instead of winapi). Changes include: - Better error code mappings on Windows. - Fixes undefined references to `utimensat` on Darwin. - Fixes undefined references to `preadv64` and `pwritev64` on Android. - Updates to io-lifetimes 0.7, which matches the io_safety API in Rust. - y2038 bug fixes for 32-bit platforms
Extract jit_int.rs and most of jitdump_linux.rs for use outside of wasmtime (#2744)* Extract gdb jit_int into wasmtime-jit-debug * Move a big chunk of the jitdump code to wasmtime-jit-debug *
Extract jit_int.rs and most of jitdump_linux.rs for use outside of wasmtime (#2744)* Extract gdb jit_int into wasmtime-jit-debug * Move a big chunk of the jitdump code to wasmtime-jit-debug * Fix doc markdown in perf_jitdump.rs