Add options to wasmtime and wasm2obj to pick compilation strategy.

This commit is contained in:
Dan Gohman
2019-10-02 13:59:49 -07:00
parent d4353f03cb
commit 8d89c3b479
6 changed files with 72 additions and 24 deletions

View File

@@ -22,8 +22,13 @@ impl Context {
}
}
pub fn create(flags: settings::Flags, features: Features, debug_info: bool) -> Context {
Context::new(create_compiler(flags), features, debug_info)
pub fn create(
flags: settings::Flags,
features: Features,
debug_info: bool,
strategy: CompilationStrategy,
) -> Context {
Context::new(create_compiler(flags, strategy), features, debug_info)
}
pub(crate) fn debug_info(&self) -> bool {
@@ -52,12 +57,12 @@ impl PartialEq for Context {
}
}
pub(crate) fn create_compiler(flags: settings::Flags) -> Compiler {
pub(crate) fn create_compiler(flags: settings::Flags, strategy: CompilationStrategy) -> Compiler {
let isa = {
let isa_builder =
cranelift_native::builder().expect("host machine is not a supported target");
isa_builder.finish(flags)
};
Compiler::new(isa, CompilationStrategy::Auto)
Compiler::new(isa, strategy)
}