Update to Cretonne 0.8.0.

This commit is contained in:
Dan Gohman
2018-05-14 12:58:28 -10:00
parent ed734f8ecb
commit b5e794a584
13 changed files with 116 additions and 104 deletions

View File

@@ -17,18 +17,18 @@ name = "wasm2obj"
path = "src/wasm2obj.rs" path = "src/wasm2obj.rs"
[dependencies] [dependencies]
cretonne = "0.4.0" cretonne-codegen = "0.8.0"
cretonne-frontend = "0.4.0" cretonne-frontend = "0.8.0"
cretonne-reader = "0.4.0" cretonne-reader = "0.8.0"
cretonne-wasm = "0.4.0" cretonne-wasm = "0.8.0"
cretonne-native = "0.4.0" cretonne-native = "0.8.0"
wasmstandalone_runtime = { path = "lib/runtime" } wasmstandalone_runtime = { path = "lib/runtime" }
wasmstandalone_execute = { path = "lib/execute" } wasmstandalone_execute = { path = "lib/execute" }
wasmstandalone_obj = { path = "lib/obj" } wasmstandalone_obj = { path = "lib/obj" }
docopt = "0.8.3" docopt = "1.0.0"
serde = "1.0.27" serde = "1.0.55"
serde_derive = "1.0.27" serde_derive = "1.0.55"
tempdir = "*" tempdir = "*"
faerie = "0.1.0" faerie = "0.3.0"
[workspace] [workspace]

View File

@@ -13,14 +13,14 @@ path = "../lib/runtime"
[dependencies.wasmstandalone_execute] [dependencies.wasmstandalone_execute]
path = "../lib/execute" path = "../lib/execute"
[dependencies.cretonne] [dependencies.cretonne-codegen]
version = "0.3.0" version = "0.8.0"
[dependencies.cretonne-wasm] [dependencies.cretonne-wasm]
version = "0.3.0" version = "0.8.0"
[dependencies.cretonne-native] [dependencies.cretonne-native]
version = "0.3.0" version = "0.8.0"
[dependencies.libfuzzer-sys] [dependencies.libfuzzer-sys]
git = "https://github.com/rust-fuzz/libfuzzer-sys.git" git = "https://github.com/rust-fuzz/libfuzzer-sys.git"

View File

@@ -8,7 +8,7 @@ repository = "https://github.com/sunfishcode/wasmstandalone"
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
[dependencies] [dependencies]
cretonne = "0.4.0" cretonne-codegen = "0.8.0"
cretonne-wasm = "0.4.0" cretonne-wasm = "0.8.0"
region = "0.1.1" region = "0.3.0"
wasmstandalone_runtime = { path = "../runtime" } wasmstandalone_runtime = { path = "../runtime" }

View File

@@ -2,12 +2,12 @@
#![deny(missing_docs)] #![deny(missing_docs)]
extern crate cretonne; extern crate cretonne_codegen;
extern crate cton_wasm; extern crate cretonne_wasm;
extern crate region; extern crate region;
extern crate wasmstandalone_runtime; extern crate wasmstandalone_runtime;
use cretonne::isa::TargetIsa; use cretonne_codegen::isa::TargetIsa;
use std::mem::transmute; use std::mem::transmute;
use region::Protection; use region::Protection;
use region::protect; use region::protect;

View File

@@ -5,7 +5,7 @@ authors = ["The Cretonne Project Developers"]
publish = false publish = false
[dependencies] [dependencies]
cretonne = "0.4.0" cretonne-codegen = "0.8.0"
cretonne-wasm = "0.4.0" cretonne-wasm = "0.8.0"
wasmstandalone_runtime = { path = "../runtime" } wasmstandalone_runtime = { path = "../runtime" }
faerie = "0.1.0" faerie = "0.3.0"

View File

@@ -1,5 +1,5 @@
use cretonne::settings; use cretonne_codegen::settings;
use cretonne::settings::Configurable; use cretonne_codegen::settings::Configurable;
use faerie::Artifact; use faerie::Artifact;
use wasmstandalone_runtime; use wasmstandalone_runtime;

View File

@@ -1,5 +1,5 @@
extern crate cretonne; extern crate cretonne_codegen;
extern crate cton_wasm; extern crate cretonne_wasm;
extern crate faerie; extern crate faerie;
extern crate wasmstandalone_runtime; extern crate wasmstandalone_runtime;

View File

@@ -8,6 +8,6 @@ repository = "https://github.com/sunfishcode/wasmstandalone"
license = "Apache-2.0" license = "Apache-2.0"
[dependencies] [dependencies]
cretonne = "0.4.0" cretonne-codegen = "0.8.0"
cretonne-wasm = "0.4.0" cretonne-wasm = "0.8.0"
wasmparser = "0.15.1" wasmparser = "0.16.1"

View File

@@ -1,8 +1,8 @@
//! An `Instance` contains all the runtime state used by execution of a wasm //! An `Instance` contains all the runtime state used by execution of a wasm
//! module. //! module.
use cretonne::ir; use cretonne_codegen::ir;
use cton_wasm::GlobalIndex; use cretonne_wasm::GlobalIndex;
use module::Module; use module::Module;
use DataInitializer; use DataInitializer;

View File

@@ -5,8 +5,8 @@
#![deny(missing_docs)] #![deny(missing_docs)]
extern crate cretonne; extern crate cretonne_codegen;
extern crate cton_wasm; extern crate cretonne_wasm;
extern crate wasmparser; extern crate wasmparser;
pub mod module; pub mod module;
@@ -17,21 +17,20 @@ pub use module::Module;
pub use compilation::Compilation; pub use compilation::Compilation;
pub use instance::Instance; pub use instance::Instance;
use cton_wasm::{FunctionIndex, GlobalIndex, TableIndex, MemoryIndex, Global, Table, Memory, use cretonne_wasm::{FunctionIndex, GlobalIndex, TableIndex, MemoryIndex, Global, Table, Memory,
GlobalValue, SignatureIndex, FuncTranslator}; GlobalValue, SignatureIndex, FuncTranslator};
use cretonne::ir::{InstBuilder, FuncRef, ExtFuncData, ExternalName, Signature, AbiParam, CallConv, use cretonne_codegen::ir::{InstBuilder, FuncRef, ExtFuncData, ExternalName, Signature, AbiParam,
ArgumentPurpose, ArgumentLoc, ArgumentExtension, Function}; ArgumentPurpose, ArgumentLoc, ArgumentExtension, Function};
use cretonne::ir::types::*; use cretonne_codegen::ir::types::*;
use cretonne::ir::immediates::Offset32; use cretonne_codegen::ir::immediates::Offset32;
use cretonne::cursor::FuncCursor; use cretonne_codegen::cursor::FuncCursor;
use cretonne::ir; use cretonne_codegen::ir;
use cretonne::isa; use cretonne_codegen::isa;
use cretonne::settings; use cretonne_codegen::settings;
use cretonne::binemit; use cretonne_codegen::binemit;
use std::error::Error;
/// Compute a `ir::ExternalName` for a given wasm function index. /// Compute a `ir::ExternalName` for a given wasm function index.
pub fn get_func_name(func_index: FunctionIndex) -> cretonne::ir::ExternalName { pub fn get_func_name(func_index: FunctionIndex) -> cretonne_codegen::ir::ExternalName {
debug_assert!(func_index as u32 as FunctionIndex == func_index); debug_assert!(func_index as u32 as FunctionIndex == func_index);
ir::ExternalName::user(0, func_index as u32) ir::ExternalName::user(0, func_index as u32)
} }
@@ -49,13 +48,12 @@ pub enum Export {
} }
/// Implementation of a relocation sink that just saves all the information for later /// Implementation of a relocation sink that just saves all the information for later
pub struct RelocSink<'func> { pub struct RelocSink {
func: &'func ir::Function,
/// Relocations recorded for the function. /// Relocations recorded for the function.
pub func_relocs: Vec<Relocation>, pub func_relocs: Vec<Relocation>,
} }
impl<'func> binemit::RelocSink for RelocSink<'func> { impl binemit::RelocSink for RelocSink {
fn reloc_ebb( fn reloc_ebb(
&mut self, &mut self,
_offset: binemit::CodeOffset, _offset: binemit::CodeOffset,
@@ -90,19 +88,15 @@ impl<'func> binemit::RelocSink for RelocSink<'func> {
&mut self, &mut self,
_offset: binemit::CodeOffset, _offset: binemit::CodeOffset,
_reloc: binemit::Reloc, _reloc: binemit::Reloc,
jt: ir::JumpTable, _jt: ir::JumpTable,
) { ) {
let _jump_table = &self.func.jump_tables[jt];
panic!("jump tables not yet implemented"); panic!("jump tables not yet implemented");
} }
} }
impl<'func> RelocSink<'func> { impl RelocSink {
fn new(func: &'func Function) -> RelocSink { fn new() -> RelocSink {
RelocSink { RelocSink { func_relocs: Vec::new() }
func,
func_relocs: Vec::new(),
}
} }
} }
@@ -138,10 +132,10 @@ impl<'data> LazyContents<'data> {
} }
/// Object containing the standalone runtime information. To be passed after creation as argument /// Object containing the standalone runtime information. To be passed after creation as argument
/// to `cton_wasm::translatemodule`. /// to `cretonne_wasm::translatemodule`.
pub struct ModuleEnvironment<'data, 'module> { pub struct ModuleEnvironment<'data, 'module> {
/// Compilation setting flags. /// Compilation setting flags.
pub flags: &'module settings::Flags, pub settings_flags: &'module settings::Flags,
/// Module information. /// Module information.
pub module: &'module mut Module, pub module: &'module mut Module,
@@ -154,18 +148,18 @@ impl<'data, 'module> ModuleEnvironment<'data, 'module> {
/// Allocates the runtime data structures with the given isa. /// Allocates the runtime data structures with the given isa.
pub fn new(flags: &'module settings::Flags, module: &'module mut Module) -> Self { pub fn new(flags: &'module settings::Flags, module: &'module mut Module) -> Self {
Self { Self {
flags, settings_flags: flags,
module, module,
lazy: LazyContents::new(), lazy: LazyContents::new(),
} }
} }
fn func_env(&self) -> FuncEnvironment { fn func_env(&self) -> FuncEnvironment {
FuncEnvironment::new(&self.flags, &self.module) FuncEnvironment::new(&self.settings_flags, &self.module)
} }
fn native_pointer(&self) -> ir::Type { fn native_pointer(&self) -> ir::Type {
use cton_wasm::FuncEnvironment; use cretonne_wasm::FuncEnvironment;
self.func_env().native_pointer() self.func_env().native_pointer()
} }
@@ -175,7 +169,7 @@ impl<'data, 'module> ModuleEnvironment<'data, 'module> {
/// `Module`. /// `Module`.
pub fn finish_translation(self) -> ModuleTranslation<'data, 'module> { pub fn finish_translation(self) -> ModuleTranslation<'data, 'module> {
ModuleTranslation { ModuleTranslation {
flags: self.flags, flags: self.settings_flags,
module: self.module, module: self.module,
lazy: self.lazy, lazy: self.lazy,
} }
@@ -231,7 +225,7 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
} }
} }
impl<'module_environment> cton_wasm::FuncEnvironment for FuncEnvironment<'module_environment> { impl<'module_environment> cretonne_wasm::FuncEnvironment for FuncEnvironment<'module_environment> {
fn flags(&self) -> &settings::Flags { fn flags(&self) -> &settings::Flags {
&self.settings_flags &self.settings_flags
} }
@@ -242,9 +236,9 @@ impl<'module_environment> cton_wasm::FuncEnvironment for FuncEnvironment<'module
let offset = 0 * ptr_size; let offset = 0 * ptr_size;
let offset32 = offset as i32; let offset32 = offset as i32;
debug_assert_eq!(offset32 as usize, offset); debug_assert_eq!(offset32 as usize, offset);
let new_base = func.create_global_var( let new_base = func.create_global_var(ir::GlobalVarData::VMContext {
ir::GlobalVarData::VmCtx { offset: Offset32::new(offset32) }, offset: Offset32::new(offset32),
); });
self.globals_base = Some(new_base); self.globals_base = Some(new_base);
new_base new_base
}); });
@@ -264,7 +258,7 @@ impl<'module_environment> cton_wasm::FuncEnvironment for FuncEnvironment<'module
fn make_heap(&mut self, func: &mut ir::Function, index: MemoryIndex) -> ir::Heap { fn make_heap(&mut self, func: &mut ir::Function, index: MemoryIndex) -> ir::Heap {
let ptr_size = self.ptr_size(); let ptr_size = self.ptr_size();
let memories_base = self.memories_base.unwrap_or_else(|| { let memories_base = self.memories_base.unwrap_or_else(|| {
let new_base = func.create_global_var(ir::GlobalVarData::VmCtx { let new_base = func.create_global_var(ir::GlobalVarData::VMContext {
offset: Offset32::new(ptr_size as i32), offset: Offset32::new(ptr_size as i32),
}); });
self.globals_base = Some(new_base); self.globals_base = Some(new_base);
@@ -294,7 +288,14 @@ impl<'module_environment> cton_wasm::FuncEnvironment for FuncEnvironment<'module
let sigidx = self.module.functions[index]; let sigidx = self.module.functions[index];
let signature = func.import_signature(self.module.signatures[sigidx].clone()); let signature = func.import_signature(self.module.signatures[sigidx].clone());
let name = get_func_name(index); let name = get_func_name(index);
func.import_function(ir::ExtFuncData { name, signature }) // We currently allocate all code segments independently, so nothing
// is colocated.
let colocated = false;
func.import_function(ir::ExtFuncData {
name,
signature,
colocated,
})
} }
fn translate_call_indirect( fn translate_call_indirect(
@@ -334,15 +335,19 @@ impl<'module_environment> cton_wasm::FuncEnvironment for FuncEnvironment<'module
debug_assert_eq!(index, 0, "non-default memories not supported yet"); debug_assert_eq!(index, 0, "non-default memories not supported yet");
let grow_mem_func = self.grow_memory_extfunc.unwrap_or_else(|| { let grow_mem_func = self.grow_memory_extfunc.unwrap_or_else(|| {
let sig_ref = pos.func.import_signature(Signature { let sig_ref = pos.func.import_signature(Signature {
call_conv: CallConv::Native, call_conv: self.settings_flags.call_conv(),
argument_bytes: None, argument_bytes: None,
params: vec![AbiParam::new(I32)], params: vec![AbiParam::new(I32)],
returns: vec![AbiParam::new(I32)], returns: vec![AbiParam::new(I32)],
}); });
// We currently allocate all code segments independently, so nothing
// is colocated.
let colocated = false;
// FIXME: Use a real ExternalName system. // FIXME: Use a real ExternalName system.
pos.func.import_function(ExtFuncData { pos.func.import_function(ExtFuncData {
name: ExternalName::testcase("grow_memory"), name: ExternalName::testcase("grow_memory"),
signature: sig_ref, signature: sig_ref,
colocated,
}) })
}); });
self.grow_memory_extfunc = Some(grow_mem_func); self.grow_memory_extfunc = Some(grow_mem_func);
@@ -359,15 +364,19 @@ impl<'module_environment> cton_wasm::FuncEnvironment for FuncEnvironment<'module
debug_assert_eq!(index, 0, "non-default memories not supported yet"); debug_assert_eq!(index, 0, "non-default memories not supported yet");
let cur_mem_func = self.current_memory_extfunc.unwrap_or_else(|| { let cur_mem_func = self.current_memory_extfunc.unwrap_or_else(|| {
let sig_ref = pos.func.import_signature(Signature { let sig_ref = pos.func.import_signature(Signature {
call_conv: CallConv::Native, call_conv: self.settings_flags.call_conv(),
argument_bytes: None, argument_bytes: None,
params: Vec::new(), params: Vec::new(),
returns: vec![AbiParam::new(I32)], returns: vec![AbiParam::new(I32)],
}); });
// We currently allocate all code segments independently, so nothing
// is colocated.
let colocated = false;
// FIXME: Use a real ExternalName system. // FIXME: Use a real ExternalName system.
pos.func.import_function(ExtFuncData { pos.func.import_function(ExtFuncData {
name: ExternalName::testcase("current_memory"), name: ExternalName::testcase("current_memory"),
signature: sig_ref, signature: sig_ref,
colocated,
}) })
}); });
self.current_memory_extfunc = Some(cur_mem_func); self.current_memory_extfunc = Some(cur_mem_func);
@@ -377,14 +386,18 @@ impl<'module_environment> cton_wasm::FuncEnvironment for FuncEnvironment<'module
} }
/// This trait is useful for /// This trait is useful for
/// `cton_wasm::translatemodule` because it /// `cretonne_wasm::translatemodule` because it
/// tells how to translate runtime-dependent wasm instructions. These functions should not be /// tells how to translate runtime-dependent wasm instructions. These functions should not be
/// called by the user. /// called by the user.
impl<'data, 'module> cton_wasm::ModuleEnvironment<'data> for ModuleEnvironment<'data, 'module> { impl<'data, 'module> cretonne_wasm::ModuleEnvironment<'data> for ModuleEnvironment<'data, 'module> {
fn get_func_name(&self, func_index: FunctionIndex) -> cretonne::ir::ExternalName { fn get_func_name(&self, func_index: FunctionIndex) -> cretonne_codegen::ir::ExternalName {
get_func_name(func_index) get_func_name(func_index)
} }
fn flags(&self) -> &settings::Flags {
self.settings_flags
}
fn declare_signature(&mut self, sig: &ir::Signature) { fn declare_signature(&mut self, sig: &ir::Signature) {
let mut sig = sig.clone(); let mut sig = sig.clone();
sig.params.push(AbiParam { sig.params.push(AbiParam {
@@ -431,7 +444,7 @@ impl<'data, 'module> cton_wasm::ModuleEnvironment<'data> for ModuleEnvironment<'
self.module.globals.push(global); self.module.globals.push(global);
} }
fn get_global(&self, global_index: GlobalIndex) -> &cton_wasm::Global { fn get_global(&self, global_index: GlobalIndex) -> &cretonne_wasm::Global {
&self.module.globals[global_index] &self.module.globals[global_index]
} }
@@ -557,7 +570,7 @@ impl<'data, 'module> ModuleTranslation<'data, 'module> {
let mut functions = Vec::new(); let mut functions = Vec::new();
let mut relocations = Vec::new(); let mut relocations = Vec::new();
for (func_index, input) in self.lazy.function_body_inputs.iter().enumerate() { for (func_index, input) in self.lazy.function_body_inputs.iter().enumerate() {
let mut context = cretonne::Context::new(); let mut context = cretonne_codegen::Context::new();
context.func.name = get_func_name(func_index); context.func.name = get_func_name(func_index);
context.func.signature = self.module.signatures[self.module.functions[func_index]] context.func.signature = self.module.signatures[self.module.functions[func_index]]
.clone(); .clone();
@@ -566,15 +579,14 @@ impl<'data, 'module> ModuleTranslation<'data, 'module> {
let reader = wasmparser::BinaryReader::new(input); let reader = wasmparser::BinaryReader::new(input);
trans trans
.translate_from_reader(reader, &mut context.func, &mut self.func_env()) .translate_from_reader(reader, &mut context.func, &mut self.func_env())
.map_err(|e| String::from(e.description()))?; .map_err(|e| e.to_string())?;
let code_size = context.compile(isa).map_err( let mut code_buf: Vec<u8> = Vec::new();
|e| String::from(e.description()), let mut reloc_sink = RelocSink::new();
)? as usize; let mut trap_sink = binemit::NullTrapSink {};
let mut code_buf: Vec<u8> = Vec::with_capacity(code_size as usize); context
let mut reloc_sink = RelocSink::new(&context.func); .compile_and_emit(isa, &mut code_buf, &mut reloc_sink, &mut trap_sink)
code_buf.resize(code_size, 0); .map_err(|e| e.to_string())?;
context.emit_to_memory(code_buf.as_mut_ptr(), &mut reloc_sink, isa);
functions.push(code_buf); functions.push(code_buf);
relocations.push(reloc_sink.func_relocs); relocations.push(reloc_sink.func_relocs);
} }

View File

@@ -1,9 +1,9 @@
//! A `Module` contains all the relevant information translated from a //! A `Module` contains all the relevant information translated from a
//! WebAssembly module. //! WebAssembly module.
use cton_wasm::{FunctionIndex, GlobalIndex, TableIndex, MemoryIndex, Global, Table, Memory, use cretonne_wasm::{FunctionIndex, GlobalIndex, TableIndex, MemoryIndex, Global, Table, Memory,
SignatureIndex}; SignatureIndex};
use cretonne::ir; use cretonne_codegen::ir;
use std::collections::HashMap; use std::collections::HashMap;
/// Possible values for a WebAssembly table element. /// Possible values for a WebAssembly table element.

View File

@@ -5,22 +5,22 @@
//! IL. Can also executes the `start` function of the module by laying out the memories, globals //! IL. Can also executes the `start` function of the module by laying out the memories, globals
//! and tables, then emitting the translated code with hardcoded addresses to memory. //! and tables, then emitting the translated code with hardcoded addresses to memory.
extern crate cton_wasm; extern crate cretonne_codegen;
extern crate cton_native; extern crate cretonne_wasm;
extern crate cretonne_native;
extern crate wasmstandalone_runtime; extern crate wasmstandalone_runtime;
extern crate wasmstandalone_execute; extern crate wasmstandalone_execute;
extern crate cretonne;
extern crate docopt; extern crate docopt;
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
extern crate tempdir; extern crate tempdir;
use cton_wasm::translate_module; use cretonne_wasm::translate_module;
use wasmstandalone_execute::{compile_module, execute}; use wasmstandalone_execute::{compile_module, execute};
use wasmstandalone_runtime::{Instance, Module, ModuleEnvironment}; use wasmstandalone_runtime::{Instance, Module, ModuleEnvironment};
use std::path::PathBuf; use std::path::PathBuf;
use cretonne::isa::TargetIsa; use cretonne_codegen::isa::TargetIsa;
use cretonne::settings; use cretonne_codegen::settings;
use std::fs::File; use std::fs::File;
use std::error::Error; use std::error::Error;
use std::io; use std::io;
@@ -30,7 +30,7 @@ use docopt::Docopt;
use std::path::Path; use std::path::Path;
use std::process::{exit, Command}; use std::process::{exit, Command};
use tempdir::TempDir; use tempdir::TempDir;
use cretonne::settings::Configurable; use cretonne_codegen::settings::Configurable;
const USAGE: &str = " const USAGE: &str = "
Wasm to Cretonne IL translation utility. Wasm to Cretonne IL translation utility.
@@ -70,7 +70,7 @@ fn main() {
.deserialize() .deserialize()
}) })
.unwrap_or_else(|e| e.exit()); .unwrap_or_else(|e| e.exit());
let (mut flag_builder, isa_builder) = cton_native::builders().unwrap_or_else(|_| { let (mut flag_builder, isa_builder) = cretonne_native::builders().unwrap_or_else(|_| {
panic!("host machine is not a supported target"); panic!("host machine is not a supported target");
}); });
@@ -84,7 +84,7 @@ fn main() {
flag_builder.set("opt_level", "best").unwrap(); flag_builder.set("opt_level", "best").unwrap();
} }
let isa = isa_builder.finish(settings::Flags::new(&flag_builder)); let isa = isa_builder.finish(settings::Flags::new(flag_builder));
for filename in &args.arg_file { for filename in &args.arg_file {
let path = Path::new(&filename); let path = Path::new(&filename);
match handle_module(&args, path.to_path_buf(), &*isa) { match handle_module(&args, path.to_path_buf(), &*isa) {

View File

@@ -4,19 +4,19 @@
//! IL, then translates it to native code, and writes it out to a native //! IL, then translates it to native code, and writes it out to a native
//! object file with relocations. //! object file with relocations.
extern crate cton_wasm; extern crate cretonne_codegen;
extern crate cretonne_native;
extern crate cretonne_wasm;
extern crate wasmstandalone_obj; extern crate wasmstandalone_obj;
extern crate wasmstandalone_runtime; extern crate wasmstandalone_runtime;
extern crate cretonne;
extern crate cton_native;
extern crate docopt; extern crate docopt;
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
extern crate faerie; extern crate faerie;
use cton_wasm::translate_module; use cretonne_wasm::translate_module;
use cretonne::settings; use cretonne_codegen::settings;
use cretonne::isa; use cretonne_codegen::isa;
use wasmstandalone_obj::emit_module; use wasmstandalone_obj::emit_module;
use std::path::PathBuf; use std::path::PathBuf;
use std::fs::File; use std::fs::File;
@@ -86,10 +86,10 @@ fn handle_module(path: PathBuf, output: &str) -> Result<(), String> {
}; };
// FIXME: Make the target a parameter. // FIXME: Make the target a parameter.
let (flag_builder, isa_builder) = cton_native::builders().unwrap_or_else(|_| { let (flag_builder, isa_builder) = cretonne_native::builders().unwrap_or_else(|_| {
panic!("host machine is not a supported target"); panic!("host machine is not a supported target");
}); });
let isa = isa_builder.finish(settings::Flags::new(&flag_builder)); let isa = isa_builder.finish(settings::Flags::new(flag_builder));
let mut module = wasmstandalone_runtime::Module::new(); let mut module = wasmstandalone_runtime::Module::new();
let mut environ = wasmstandalone_runtime::ModuleEnvironment::new(isa.flags(), &mut module); let mut environ = wasmstandalone_runtime::ModuleEnvironment::new(isa.flags(), &mut module);