* Adding in trampoline compiling method for ISA * Adding support for indirect call to memory address * Refactoring frame to externalize defined locals, so it removes WASM depedencies in trampoline case * Adding initial version of trampoline for testing * Refactoring trampoline to be re-used by other architectures * Initial wiring for winch with wasmtime * Add a Wasmtime CLI option to select `winch` This is effectively an option to select the `Strategy` enumeration. * Implement `Compiler::compile_function` for Winch Hook this into the `TargetIsa::compile_function` hook as well. Currently this doesn't take into account `Tunables`, but that's left as a TODO for later. * Filling out Winch append_code method * Adding back in changes from previous branch Most of these are a WIP. It's missing trampolines for x64, but a basic one exists for aarch64. It's missing the handling of arguments that exist on the stack. It currently imports `cranelift_wasm::WasmFuncType` since it's what's passed to the `Compiler` trait. It's a bit awkward to use in the `winch_codegen` crate since it mostly operates on `wasmparser` types. I've had to hack in a conversion to get things working. Long term, I'm not sure it's wise to rely on this type but it seems like it's easier on the Cranelift side when creating the stub IR. * Small API changes to make integration easier * Adding in new FuncEnv, only a stub for now * Removing unneeded parts of the old PoC, and refactoring trampoline code * Moving FuncEnv into a separate file * More comments for trampolines * Adding in winch integration tests for first pass * Using new addressing method to fix stack pointer error * Adding test for stack arguments * Only run tests on x86 for now, it's more complete for winch * Add in missing documentation after rebase * Updating based on feedback in draft PR * Fixing formatting on doc comment for argv register * Running formatting * Lock updates, and turning on winch feature flags during tests * Updating configuration with comments to no longer gate Strategy enum * Using the winch-environ FuncEnv, but it required changing the sig * Proper comment formatting * Removing wasmtime-winch from dev-dependencies, adding the winch feature makes this not necessary * Update doc attr to include winch check * Adding winch feature to doc generation, which seems to fix the feature error in CI * Add the `component-model` feature to the cargo doc invocation in CI To match the metadata used by the docs.rs invocation when building docs. * Add a comment clarifying the usage of `component-model` for docs.rs * Correctly order wasmtime-winch and winch-environ in the publish script * Ensure x86 test dependencies are included in cfg(target_arch) * Further constrain Winch tests to x86_64 _and_ unix --------- Co-authored-by: Alex Crichton <alex@alexcrichton.com> Co-authored-by: Saúl Cabrera <saulecabrera@gmail.com>
74 lines
1.8 KiB
Rust
74 lines
1.8 KiB
Rust
mod async_functions;
|
|
mod call_hook;
|
|
mod cli_tests;
|
|
mod component_model;
|
|
mod custom_signal_handler;
|
|
mod debug;
|
|
mod epoch_interruption;
|
|
mod externals;
|
|
mod fuel;
|
|
mod func;
|
|
mod funcref;
|
|
mod gc;
|
|
mod globals;
|
|
mod host_funcs;
|
|
mod iloop;
|
|
mod import_calling_export;
|
|
mod import_indexes;
|
|
mod instance;
|
|
mod invoke_func_via_table;
|
|
mod limits;
|
|
mod linker;
|
|
mod memory;
|
|
mod memory_creator;
|
|
mod module;
|
|
mod module_serialize;
|
|
mod name;
|
|
mod pooling_allocator;
|
|
mod relocs;
|
|
mod stack_overflow;
|
|
mod store;
|
|
mod table;
|
|
mod threads;
|
|
mod traps;
|
|
mod wait_notify;
|
|
mod wasi_testsuite;
|
|
mod wast;
|
|
// Currently Winch is only supported in x86_64 unix platforms.
|
|
#[cfg(all(target_arch = "x86_64", target_family = "unix"))]
|
|
mod winch;
|
|
|
|
/// A helper to compile a module in a new store with reference types enabled.
|
|
pub(crate) fn ref_types_module(
|
|
use_epochs: bool,
|
|
source: &str,
|
|
) -> anyhow::Result<(wasmtime::Store<()>, wasmtime::Module)> {
|
|
use wasmtime::*;
|
|
|
|
let _ = env_logger::try_init();
|
|
|
|
let mut config = Config::new();
|
|
config.wasm_reference_types(true);
|
|
if use_epochs {
|
|
config.epoch_interruption(true);
|
|
}
|
|
|
|
let engine = Engine::new(&config)?;
|
|
let mut store = Store::new(&engine, ());
|
|
if use_epochs {
|
|
store.set_epoch_deadline(1);
|
|
}
|
|
|
|
let module = Module::new(&engine, source)?;
|
|
|
|
Ok((store, module))
|
|
}
|
|
|
|
/// A helper determining whether the pooling allocator tests should be skipped.
|
|
pub(crate) fn skip_pooling_allocator_tests() -> bool {
|
|
// There are a couple of issues when running the pooling allocator tests under QEMU:
|
|
// - high memory usage that may exceed the limits imposed by the environment (e.g. CI)
|
|
// - https://github.com/bytecodealliance/wasmtime/pull/2518#issuecomment-747280133
|
|
std::env::var("WASMTIME_TEST_NO_HOG_MEMORY").is_ok()
|
|
}
|