Update Wasmtime to the 2024 Rust Edition (#10806)* Update Wasmtime to the 2024 Rust EditionNow that our MSRV supports the 2024 edition it's possible to make thisswitch. This commit moves Wasmtim
Update Wasmtime to the 2024 Rust Edition (#10806)* Update Wasmtime to the 2024 Rust EditionNow that our MSRV supports the 2024 edition it's possible to make thisswitch. This commit moves Wasmtime to the 2024 Edition to keepup-to-date with Rust idioms and access many of the edition featuresexclusive to the 2024 edition.prtest:full* Reformat with the 2024 edition
show more ...
Enforce `uninlined_format_args` for the workspace (#9065)* Enforce `uninlined_format_args` for the workspace* fix: failing `Monolith Checks` job* fix: formatting
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 MIRIprtest: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
Rename define_function to define_function_with_control_plane (#6165)And add a define_function convenience function which uses a defaultcontrol plane.
Chaos mode MVP: Skip branch optimization in MachBuffer (#6039)* fuzz: Add chaos mode control planeCo-authored-by: Falk Zwimpfer <[email protected]>Co-authored-by: Moritz Wa
Chaos mode MVP: Skip branch optimization in MachBuffer (#6039)* fuzz: Add chaos mode control planeCo-authored-by: Falk Zwimpfer <[email protected]>Co-authored-by: Moritz Waser <[email protected]>* fuzz: Skip branch optimization with chaos modeCo-authored-by: Falk Zwimpfer <[email protected]>Co-authored-by: Moritz Waser <[email protected]>* fuzz: Rename chaos engine -> control planeCo-authored-by: Falk Zwimpfer <[email protected]>Co-authored-by: Moritz Waser <[email protected]>* chaos mode: refactoring ControlPlane to be passed through the call stack by referenceCo-authored-by: Falk Zwimpfer <[email protected]>Co-authored-by: Remo Senekowitsch <[email protected]>* fuzz: annotate chaos todosCo-authored-by: Falk Zwimpfer <[email protected]>Co-authored-by: Moritz Waser <[email protected]>* fuzz: cleanup control planeCo-authored-by: Falk Zwimpfer <[email protected]>Co-authored-by: Moritz Waser <[email protected]>* fuzz: remove control plane from compiler contextCo-authored-by: Falk Zwimpfer <[email protected]>Co-authored-by: Moritz Waser <[email protected]>* fuzz: move control plane into emit stateCo-authored-by: Falk Zwimpfer <[email protected]>Co-authored-by: Moritz Waser <[email protected]>* fuzz: fix remaining compiler errorsCo-authored-by: Falk Zwimpfer <[email protected]>Co-authored-by: Moritz Waser <[email protected]>* fix tests* refactor emission state ctrl plane accessorsCo-authored-by: Falk Zwimpfer <[email protected]>Co-authored-by: Moritz Waser <[email protected]>* centralize conditional compilation of chaos modeAlso cleanup a few straggling dependencies on cranelift-controlthat aren't needed anymore.Co-authored-by: Falk Zwimpfer <[email protected]>Co-authored-by: Moritz Waser <[email protected]>* add cranelift-control to published cratesprtest:fullCo-authored-by: Falk Zwimpfer <[email protected]>Co-authored-by: Moritz Waser <[email protected]>* add cranelift-control to public cratesCo-authored-by: Falk Zwimpfer <[email protected]>Co-authored-by: Moritz Waser <[email protected]>---------Co-authored-by: Falk Zwimpfer <[email protected]>Co-authored-by: Moritz Waser <[email protected]>Co-authored-by: Remo Senekowitsch <[email protected]>
Fix ABI of jitted function in cranelift-jit example. (#5736)
cranelift: improve syscall error/oom handling in JIT module (#5173)* cranelift: improve syscall error/oom handling in JIT module The JIT module has several places where it `expect`s or `panic`s
cranelift: improve syscall error/oom handling in JIT module (#5173)* cranelift: improve syscall error/oom handling in JIT module The JIT module has several places where it `expect`s or `panic`s on syscall or allocator errors. For example, `mmap` and `mprotect` can fail if Linux `vm.max_map_count` is not high enough, and some users may wish to handle this error rather than immediately crashing. This commit plumbs these errors upward as new `ModuleError` types, so that callers of jit module functions like `finalize_definitions` and `define_function` can handle them (or just `unwrap()`, as desired). * cranelift: Remove ModuleError::Syscall variant Syscall errors can just be folded into the generic Backend error, which is an anyhow::Error * cranelift-jit: return io::ErrorKind::OutOfMemory for alloc failure Just using `io::Error::last_os_error()` is not correct as global allocator impls are not required to set errno
Implement an incremental compilation cache for Cranelift (#4551)This is the implementation of https://github.com/bytecodealliance/wasmtime/issues/4155, using the "inverted API" approach suggested b
Implement an incremental compilation cache for Cranelift (#4551)This is the implementation of https://github.com/bytecodealliance/wasmtime/issues/4155, using the "inverted API" approach suggested by @cfallin (thanks!) in Cranelift, and trait object to provide a backend for an all-included experience in Wasmtime. After the suggestion of Chris, `Function` has been split into mostly two parts: - on the one hand, `FunctionStencil` contains all the fields required during compilation, and that act as a compilation cache key: if two function stencils are the same, then the result of their compilation (`CompiledCodeBase<Stencil>`) will be the same. This makes caching trivial, as the only thing to cache is the `FunctionStencil`. - on the other hand, `FunctionParameters` contain the... function parameters that are required to finalize the result of compilation into a `CompiledCode` (aka `CompiledCodeBase<Final>`) with proper final relocations etc., by applying fixups and so on. Most changes are here to accomodate those requirements, in particular that `FunctionStencil` should be `Hash`able to be used as a key in the cache: - most source locations are now relative to a base source location in the function, and as such they're encoded as `RelSourceLoc` in the `FunctionStencil`. This required changes so that there's no need to explicitly mark a `SourceLoc` as the base source location, it's automatically detected instead the first time a non-default `SourceLoc` is set. - user-defined external names in the `FunctionStencil` (aka before this patch `ExternalName::User { namespace, index }`) are now references into an external table of `UserExternalNameRef -> UserExternalName`, present in the `FunctionParameters`, and must be explicitly declared using `Function::declare_imported_user_function`. - some refactorings have been made for function names: - `ExternalName` was used as the type for a `Function`'s name; while it thus allowed `ExternalName::Libcall` in this place, this would have been quite confusing to use it there. Instead, a new enum `UserFuncName` is introduced for this name, that's either a user-defined function name (the above `UserExternalName`) or a test case name. - The future of `ExternalName` is likely to become a full reference into the `FunctionParameters`'s mapping, instead of being "either a handle for user-defined external names, or the thing itself for other variants". I'm running out of time to do this, and this is not trivial as it implies touching ISLE which I'm less familiar with. The cache computes a sha256 hash of the `FunctionStencil`, and uses this as the cache key. No equality check (using `PartialEq`) is performed in addition to the hash being the same, as we hope that this is sufficient data to avoid collisions. A basic fuzz target has been introduced that tries to do the bare minimum: - check that a function successfully compiled and cached will be also successfully reloaded from the cache, and returns the exact same function. - check that a trivial modification in the external mapping of `UserExternalNameRef -> UserExternalName` hits the cache, and that other modifications don't hit the cache. - This last check is less efficient and less likely to happen, so probably should be rethought a bit. Thanks to both @alexcrichton and @cfallin for your very useful feedback on Zulip. Some numbers show that for a large wasm module we're using internally, this is a 20% compile-time speedup, because so many `FunctionStencil`s are the same, even within a single module. For a group of modules that have a lot of code in common, we get hit rates up to 70% when they're used together. When a single function changes in a wasm module, every other function is reloaded; that's still slower than I expect (between 10% and 50% of the overall compile time), so there's likely room for improvement. Fixes #4155.
Cranelift: ensure ISA level needed for SIMD is present when SIMD is enabled. (#3816)Addresses #3809: when we are asked to create a Cranelift backend with shared flags that indicate support for SIM
Cranelift: ensure ISA level needed for SIMD is present when SIMD is enabled. (#3816)Addresses #3809: when we are asked to create a Cranelift backend with shared flags that indicate support for SIMD, we should check that the ISA level needed for our SIMD lowerings is present.
Remove sink arguments from compile_and_emitThe data can be accessed after the fact using context.mach_compile_result
cranelift-module: Add support for passing a StackMapSink when defining functionsFixes #2738This follows the convention set by the existing method of passing aTrapSink by adding another argument
cranelift-module: Add support for passing a StackMapSink when defining functionsFixes #2738This follows the convention set by the existing method of passing aTrapSink by adding another argument for a StackMapSink.
Rename SimpleJIT to JIT as it isn't simple anymore