Rename wasmtime-runtime to wasmtime-environ.

This mirrors changes in cranelift.
This commit is contained in:
Dan Gohman
2018-08-03 15:20:19 -07:00
parent b8daa27884
commit 548c45c604
18 changed files with 38 additions and 37 deletions

View File

@@ -19,7 +19,7 @@ path = "src/wasm2obj.rs"
[dependencies]
cranelift-codegen = "0.18.1"
cranelift-native = "0.18.1"
wasmtime-runtime = { path = "lib/runtime" }
wasmtime-environ = { path = "lib/environ" }
wasmtime-execute = { path = "lib/execute" }
wasmtime-obj = { path = "lib/obj" }
docopt = "1.0.0"

View File

@@ -8,7 +8,7 @@ publish = false
cargo-fuzz = true
[dependencies]
wasmtime-runtime = { path = "../lib/runtime" }
wasmtime-environ = { path = "../lib/environ" }
wasmtime-execute = { path = "../lib/execute" }
cranelift-codegen = "0.18.1"
cranelift-wasm = "0.18.1"

View File

@@ -5,13 +5,13 @@ extern crate libfuzzer_sys;
extern crate cranelift_codegen;
extern crate cranelift_wasm;
extern crate cranelift_native;
extern crate wasmtime_runtime;
extern crate wasmtime_environ;
extern crate wasmtime_execute;
extern crate wasmparser;
use cranelift_codegen::settings;
use cranelift_wasm::translate_module;
use wasmtime_runtime::{ModuleEnvironment, Module};
use wasmtime_environ::{ModuleEnvironment, Module};
use wasmparser::{validate};
fuzz_target!(|data: &[u8]| {
@@ -23,8 +23,8 @@ fuzz_target!(|data: &[u8]| {
});
let isa = isa_builder.finish(settings::Flags::new(flag_builder));
let mut module = Module::new();
let mut runtime = ModuleEnvironment::new(&*isa, &mut module);
let translation = match translate_module(&data, &mut runtime) {
let mut environment = ModuleEnvironment::new(&*isa, &mut module);
let translation = match translate_module(&data, &mut environment) {
Ok(()) => (),
Err(_) => return,
};

View File

@@ -1,9 +1,9 @@
[package]
name = "wasmtime-runtime"
name = "wasmtime-environ"
version = "0.0.0"
authors = ["The Cranelift Project Developers"]
publish = false
description = "Standalone runtime support for WebAsssembly code in Cranelift"
description = "Standalone environment support for WebAsssembly code in Cranelift"
repository = "https://github.com/sunfishcode/wasmtime"
license = "Apache-2.0 WITH LLVM-exception"

View File

@@ -17,7 +17,7 @@ pub struct Compilation {
}
impl Compilation {
/// Allocates the runtime data structures with the given flags.
/// Allocates the compilation result with the given function bodies.
pub fn new(functions: Vec<Vec<u8>>) -> Self {
Self { functions }
}

View File

@@ -21,8 +21,8 @@ pub fn get_func_name(func_index: FunctionIndex) -> ir::ExternalName {
ir::ExternalName::user(0, func_index as u32)
}
/// Object containing the standalone runtime information. To be passed after creation as argument
/// to `compile_module`.
/// Object containing the standalone environment information. To be passed after creation as
/// argument to `compile_module`.
pub struct ModuleEnvironment<'data, 'module> {
/// Compilation setting flags.
pub isa: &'module isa::TargetIsa,
@@ -35,7 +35,7 @@ pub struct ModuleEnvironment<'data, 'module> {
}
impl<'data, 'module> ModuleEnvironment<'data, 'module> {
/// Allocates the runtime data structures with the given isa.
/// Allocates the enironment data structures with the given isa.
pub fn new(isa: &'module isa::TargetIsa, module: &'module mut Module) -> Self {
Self {
isa,
@@ -119,7 +119,7 @@ impl<'module_environment> FuncEnvironment<'module_environment> {
/// This trait is useful for
/// `cranelift_wasm::translate_module` because it
/// tells how to translate runtime-dependent wasm instructions. These functions should not be
/// tells how to translate enironment-dependent wasm instructions. These functions should not be
/// called by the user.
impl<'data, 'module> cranelift_wasm::ModuleEnvironment<'data>
for ModuleEnvironment<'data, 'module>

View File

@@ -1,4 +1,4 @@
//! Standalone runtime for WebAssembly using Cranelift. Provides functions to translate
//! Standalone environment for WebAssembly using Cranelift. Provides functions to translate
//! `get_global`, `set_global`, `current_memory`, `grow_memory`, `call_indirect` that hardcode in
//! the translation the base addresses of regions of memory that will hold the globals, tables and
//! linear memories.

View File

@@ -3,7 +3,7 @@ name = "wasmtime-execute"
version = "0.0.0"
authors = ["The Cranelift Project Developers"]
publish = false
description = "JIT-style runtime support for WebAsssembly code in Cranelift"
description = "JIT-style execution for WebAsssembly code in Cranelift"
repository = "https://github.com/sunfishcode/wasmtime"
license = "Apache-2.0 WITH LLVM-exception"
@@ -11,4 +11,4 @@ license = "Apache-2.0 WITH LLVM-exception"
cranelift-codegen = "0.18.1"
cranelift-wasm = "0.18.1"
region = "0.3.0"
wasmtime-runtime = { path = "../runtime" }
wasmtime-environ = { path = "../environ" }

View File

@@ -5,9 +5,10 @@ use region::protect;
use region::Protection;
use std::mem::transmute;
use std::ptr::write_unaligned;
use wasmtime_runtime::{compile_module, Compilation, Module, ModuleTranslation, Relocation};
use wasmtime_environ::{compile_module, Compilation, Module, ModuleTranslation, Relocation};
/// Executes a module that has been translated with the `standalone::Runtime` runtime implementation.
/// Executes a module that has been translated with the `wasmtime-environ` environment
/// implementation.
pub fn compile_and_link_module<'data, 'module>(
isa: &TargetIsa,
translation: &ModuleTranslation<'data, 'module>,
@@ -56,7 +57,7 @@ fn relocate(compilation: &mut Compilation, relocations: &[Vec<Relocation>]) {
}
/// Create the VmCtx data structure for the JIT'd code to use. This must
/// match the VmCtx layout in the runtime.
/// match the VmCtx layout in the environment.
fn make_vmctx(instance: &mut Instance) -> Vec<*mut u8> {
let mut memories = Vec::new();
let mut vmctx = Vec::new();

View File

@@ -3,7 +3,7 @@
use cranelift_codegen::ir;
use cranelift_wasm::GlobalIndex;
use wasmtime_runtime::{DataInitializer, Module, TableElements};
use wasmtime_environ::{DataInitializer, Module, TableElements};
const PAGE_SIZE: usize = 65536;

View File

@@ -15,7 +15,7 @@
extern crate cranelift_codegen;
extern crate cranelift_wasm;
extern crate region;
extern crate wasmtime_runtime;
extern crate wasmtime_environ;
mod execute;
mod instance;

View File

@@ -7,5 +7,5 @@ license = "Apache-2.0 WITH LLVM-exception"
[dependencies]
cranelift-codegen = "0.18.1"
wasmtime-runtime = { path = "../runtime" }
wasmtime-environ = { path = "../environ" }
faerie = "0.4.4"

View File

@@ -1,15 +1,15 @@
use cranelift_codegen::settings;
use cranelift_codegen::settings::Configurable;
use faerie::Artifact;
use wasmtime_runtime;
use wasmtime_environ::{Module, Compilation, Relocations};
/// Emits a module that has been emitted with the `WasmRuntime` runtime
/// Emits a module that has been emitted with the `wasmtime-environ` environment
/// implementation to a native object file.
pub fn emit_module(
obj: &mut Artifact,
module: &wasmtime_runtime::Module,
compilation: &wasmtime_runtime::Compilation,
relocations: &wasmtime_runtime::Relocations,
module: &Module,
compilation: &Compilation,
relocations: &Relocations,
) -> Result<(), String> {
debug_assert!(
module.start_func.is_none() || module.start_func.unwrap() >= module.imported_funcs.len(),

View File

@@ -1,4 +1,4 @@
//! Object-file writing library using the wasmtime runtime.
//! Object-file writing library using the wasmtime environment.
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates, unstable_features)]
#![warn(unused_import_braces)]
@@ -14,7 +14,7 @@
extern crate cranelift_codegen;
extern crate faerie;
extern crate wasmtime_runtime;
extern crate wasmtime_environ;
mod emit_module;

View File

@@ -21,7 +21,7 @@ extern crate cranelift_codegen;
extern crate cranelift_native;
extern crate docopt;
extern crate wasmtime_execute;
extern crate wasmtime_runtime;
extern crate wasmtime_environ;
#[macro_use]
extern crate serde_derive;
extern crate tempdir;
@@ -40,7 +40,7 @@ use std::path::PathBuf;
use std::process::{exit, Command};
use tempdir::TempDir;
use wasmtime_execute::{compile_and_link_module, execute, Instance};
use wasmtime_runtime::{Module, ModuleEnvironment};
use wasmtime_environ::{Module, ModuleEnvironment};
const USAGE: &str = "
Wasm to Cranelift IL translation utility.

View File

@@ -20,7 +20,7 @@ extern crate cranelift_codegen;
extern crate cranelift_native;
extern crate docopt;
extern crate wasmtime_obj;
extern crate wasmtime_runtime;
extern crate wasmtime_environ;
#[macro_use]
extern crate serde_derive;
extern crate faerie;
@@ -37,13 +37,13 @@ use std::path::Path;
use std::path::PathBuf;
use std::process;
use wasmtime_obj::emit_module;
use wasmtime_runtime::compile_module;
use wasmtime_environ::{compile_module, Module, ModuleEnvironment};
const USAGE: &str = "
Wasm to native object translation utility.
Takes a binary WebAssembly module into a native object file.
The translation is dependent on the runtime chosen.
The default is a dummy runtime that produces placeholder values.
The translation is dependent on the environment chosen.
The default is a dummy environment that produces placeholder values.
Usage:
wasm2obj <file> -o <output>
@@ -103,8 +103,8 @@ fn handle_module(path: PathBuf, output: &str) -> Result<(), String> {
let mut obj = Artifact::new(isa.triple().clone(), String::from(output));
let mut module = wasmtime_runtime::Module::new();
let environ = wasmtime_runtime::ModuleEnvironment::new(&*isa, &mut module);
let mut module = Module::new();
let environ = ModuleEnvironment::new(&*isa, &mut module);
let translation = environ.translate(&data).map_err(|e| e.to_string())?;
// FIXME: We need to initialize memory in a way that supports alternate