Code review feedback.
* Expand doc comment on `Engine::precompile_module`. * Add FIXME comment regarding a future ISA flag compatibility check before doing a JIT from `Module::from_binary`. * Remove no-longer-needed CLI groups from the `compile` command.
This commit is contained in:
@@ -89,6 +89,15 @@ impl Engine {
|
|||||||
/// If this is supplied then the text format will be parsed before validation.
|
/// If this is supplied then the text format will be parsed before validation.
|
||||||
/// Note that the `wat` feature is enabled by default.
|
/// 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
|
/// [binary]: https://webassembly.github.io/spec/core/binary/index.html
|
||||||
/// [text]: https://webassembly.github.io/spec/core/text/index.html
|
/// [text]: https://webassembly.github.io/spec/core/text/index.html
|
||||||
pub fn precompile_module(&self, bytes: &[u8]) -> Result<Vec<u8>> {
|
pub fn precompile_module(&self, bytes: &[u8]) -> Result<Vec<u8>> {
|
||||||
|
|||||||
@@ -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"));
|
const USE_PAGED_MEM_INIT: bool = cfg!(all(feature = "uffd", target_os = "linux"));
|
||||||
|
|
||||||
cfg_if::cfg_if! {
|
cfg_if::cfg_if! {
|
||||||
|
|||||||
@@ -4,10 +4,7 @@ use crate::CommonOptions;
|
|||||||
use anyhow::{bail, Context, Result};
|
use anyhow::{bail, Context, Result};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use structopt::{
|
use structopt::{clap::AppSettings, StructOpt};
|
||||||
clap::{AppSettings, ArgGroup},
|
|
||||||
StructOpt,
|
|
||||||
};
|
|
||||||
use target_lexicon::Triple;
|
use target_lexicon::Triple;
|
||||||
use wasmtime::Engine;
|
use wasmtime::Engine;
|
||||||
|
|
||||||
@@ -42,10 +39,6 @@ lazy_static::lazy_static! {
|
|||||||
name = "compile",
|
name = "compile",
|
||||||
version = env!("CARGO_PKG_VERSION"),
|
version = env!("CARGO_PKG_VERSION"),
|
||||||
setting = AppSettings::ColoredHelp,
|
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()
|
after_help = AFTER_HELP.as_str()
|
||||||
)]
|
)]
|
||||||
pub struct CompileCommand {
|
pub struct CompileCommand {
|
||||||
|
|||||||
Reference in New Issue
Block a user