diff --git a/crates/wasmtime/src/engine.rs b/crates/wasmtime/src/engine.rs index 28391d298b..f7d9c4eaa4 100644 --- a/crates/wasmtime/src/engine.rs +++ b/crates/wasmtime/src/engine.rs @@ -89,6 +89,15 @@ impl Engine { /// If this is supplied then the text format will be parsed before validation. /// Note that the `wat` feature is enabled by default. /// + /// This method may be used to compile a module for use with a different target + /// host. The output of this method may be used with [`Module::new`](crate::Module::new) + /// on hosts compatible with the [`Config`] associated with this [`Engine`]. + /// + /// The output of this method is safe to send to another host machine for later + /// execution. As the output is already a compiled module, translation and code + /// generation will be skipped and this will improve the performance of constructing + /// a [`Module`](crate::Module) from the output of this method. + /// /// [binary]: https://webassembly.github.io/spec/core/binary/index.html /// [text]: https://webassembly.github.io/spec/core/text/index.html pub fn precompile_module(&self, bytes: &[u8]) -> Result> { diff --git a/crates/wasmtime/src/module.rs b/crates/wasmtime/src/module.rs index cffcc04278..8408d2af97 100644 --- a/crates/wasmtime/src/module.rs +++ b/crates/wasmtime/src/module.rs @@ -279,6 +279,10 @@ impl Module { ); } + // FIXME: we may want to validate that the ISA flags in the config match those that + // would be inferred for the host, otherwise the JIT might produce unrunnable code + // for the features the host's CPU actually has. + const USE_PAGED_MEM_INIT: bool = cfg!(all(feature = "uffd", target_os = "linux")); cfg_if::cfg_if! { diff --git a/src/commands/compile.rs b/src/commands/compile.rs index 21f0cedc76..7b9a7ebcc2 100644 --- a/src/commands/compile.rs +++ b/src/commands/compile.rs @@ -4,10 +4,7 @@ use crate::CommonOptions; use anyhow::{bail, Context, Result}; use std::fs; use std::path::PathBuf; -use structopt::{ - clap::{AppSettings, ArgGroup}, - StructOpt, -}; +use structopt::{clap::AppSettings, StructOpt}; use target_lexicon::Triple; use wasmtime::Engine; @@ -42,10 +39,6 @@ lazy_static::lazy_static! { name = "compile", version = env!("CARGO_PKG_VERSION"), setting = AppSettings::ColoredHelp, - group = ArgGroup::with_name("x64").multiple(true), - group = ArgGroup::with_name("preset-x64"), - group = ArgGroup::with_name("aarch64").multiple(true).conflicts_with_all(&["x64", "preset-x64"]), - group = ArgGroup::with_name("preset-aarch64").conflicts_with_all(&["x64", "preset-x64"]), after_help = AFTER_HELP.as_str() )] pub struct CompileCommand {