Split the runtime and execution code into separate crates.

This commit is contained in:
Dan Gohman
2017-10-03 14:57:52 -07:00
parent 6ded83332f
commit 23bafd1218
13 changed files with 62 additions and 40 deletions

View File

@@ -7,7 +7,8 @@
extern crate cton_wasm;
extern crate cton_native;
extern crate wasmstandalone;
extern crate wasmstandalone_runtime;
extern crate wasmstandalone_execute;
extern crate wasmparser;
extern crate cretonne;
extern crate wasmtext;
@@ -18,7 +19,7 @@ extern crate term;
extern crate tempdir;
use cton_wasm::{translate_module, TranslationResult};
use wasmstandalone::{compile_module, execute};
use wasmstandalone_execute::{compile_module, execute};
use std::path::PathBuf;
use wasmparser::{Parser, ParserState, WasmDecoder, SectionCode};
use wasmtext::Writer;
@@ -157,7 +158,7 @@ fn handle_module(args: &Args, path: PathBuf, name: &str, isa: &TargetIsa) -> Res
|err| String::from(err.description()),
)?;
}
let mut runtime = wasmstandalone::Runtime::with_flags(isa.flags().clone());
let mut runtime = wasmstandalone_runtime::Runtime::with_flags(isa.flags().clone());
let translation = {
match translate_module(&data, &mut runtime) {
Ok(x) => x,
@@ -320,7 +321,7 @@ fn pretty_print_translation(
writer_wat: &mut Write,
writer_cretonne: &mut Write,
isa: &TargetIsa,
runtime: &wasmstandalone::Runtime,
runtime: &wasmstandalone_runtime::Runtime,
) -> Result<(), io::Error> {
let mut terminal = term::stdout().unwrap();
let mut parser = Parser::new(data);

View File

@@ -5,19 +5,19 @@
//! object file with relocations.
extern crate cton_wasm;
extern crate wasm2obj;
extern crate wasmstandalone_obj;
extern crate wasmstandalone_runtime;
extern crate cretonne;
extern crate cton_native;
extern crate docopt;
#[macro_use]
extern crate serde_derive;
extern crate wasmstandalone;
extern crate faerie;
use cton_wasm::translate_module;
use cretonne::settings;
use cretonne::isa;
use wasm2obj::emit_module;
use wasmstandalone_obj::emit_module;
use std::path::PathBuf;
use std::fs::File;
use std::error::Error;
@@ -91,7 +91,7 @@ fn handle_module(path: PathBuf, output: &str) -> Result<(), String> {
});
let isa = isa_builder.finish(settings::Flags::new(&flag_builder));
let mut runtime = wasmstandalone::Runtime::with_flags(isa.flags().clone());
let mut runtime = wasmstandalone_runtime::Runtime::with_flags(isa.flags().clone());
let translation = {
match translate_module(&data, &mut runtime) {