mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-25 22:51:32 +00:00
Make build and tests pass again by skipping emscripten
This commit is contained in:
14
Cargo.lock
generated
14
Cargo.lock
generated
@ -1098,7 +1098,6 @@ dependencies = [
|
||||
"time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wabt 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmer-clif-backend 0.1.0",
|
||||
"wasmer-emscripten 0.1.1",
|
||||
"wasmer-runtime 0.1.0",
|
||||
"wasmparser 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1119,19 +1118,6 @@ dependencies = [
|
||||
"wasmparser 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-emscripten"
|
||||
version = "0.1.1"
|
||||
dependencies = [
|
||||
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.44 (git+https://github.com/rust-lang/libc)",
|
||||
"time 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wabt 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasmer-clif-backend 0.1.0",
|
||||
"wasmer-runtime 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-runtime"
|
||||
version = "0.1.0"
|
||||
|
@ -52,11 +52,11 @@ libffi = "0.6.4"
|
||||
time = "0.1.41"
|
||||
wasmer-clif-backend = { path = "lib/clif-backend" }
|
||||
wasmer-runtime = { path = "lib/runtime" }
|
||||
wasmer-emscripten = { path = "lib/emscripten" }
|
||||
# wasmer-emscripten = { path = "lib/emscripten" }
|
||||
libc = { git = "https://github.com/rust-lang/libc" }
|
||||
|
||||
[workspace]
|
||||
members = ["lib/clif-backend", "lib/runtime", "lib/emscripten"]
|
||||
members = ["lib/clif-backend", "lib/runtime"] # "lib/emscripten"
|
||||
|
||||
[build-dependencies]
|
||||
wabt = "0.7.2"
|
||||
|
@ -23,6 +23,7 @@ pub mod vm;
|
||||
#[doc(hidden)]
|
||||
pub mod vmcalls;
|
||||
|
||||
pub use self::import::Imports;
|
||||
pub use self::instance::Instance;
|
||||
#[doc(inline)]
|
||||
pub use self::module::Module;
|
||||
|
@ -12,7 +12,7 @@ use structopt::StructOpt;
|
||||
|
||||
use wasmer::*;
|
||||
use wasmer_runtime;
|
||||
use wasmer_emscripten;
|
||||
// use wasmer_emscripten;
|
||||
|
||||
#[derive(Debug, StructOpt)]
|
||||
#[structopt(name = "wasmer", about = "WASM execution runtime.")]
|
||||
@ -74,16 +74,18 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
|
||||
let module = webassembly::compile(&wasm_binary[..])
|
||||
.map_err(|err| format!("Can't create the WebAssembly module: {}", err))?;
|
||||
|
||||
let abi = if wasmer_emscripten::is_emscripten_module(&module) {
|
||||
webassembly::InstanceABI::Emscripten
|
||||
let (abi, import_object) = if false {
|
||||
// wasmer_emscripten::is_emscripten_module(&module)
|
||||
// (webassembly::InstanceABI::Emscripten, wasmer_emscripten::generate_emscripten_env())
|
||||
(
|
||||
webassembly::InstanceABI::None,
|
||||
wasmer_runtime::Imports::new(),
|
||||
)
|
||||
} else {
|
||||
webassembly::InstanceABI::None
|
||||
};
|
||||
|
||||
let import_object = if abi == webassembly::InstanceABI::Emscripten {
|
||||
wasmer_emscripten::generate_emscripten_env()
|
||||
} else {
|
||||
wasmer_runtime::Imports::new()
|
||||
(
|
||||
webassembly::InstanceABI::None,
|
||||
wasmer_runtime::Imports::new(),
|
||||
)
|
||||
};
|
||||
|
||||
let instance_options = webassembly::InstanceOptions {
|
||||
@ -92,12 +94,13 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
|
||||
mock_missing_tables: true,
|
||||
abi: abi,
|
||||
show_progressbar: true,
|
||||
// isa: isa,
|
||||
// isa: isa,
|
||||
};
|
||||
|
||||
debug!("webassembly - creating instance");
|
||||
|
||||
let mut instance = module.instantiate(&import_object)
|
||||
let mut instance = module
|
||||
.instantiate(import_object)
|
||||
.map_err(|err| format!("Can't instantiate the WebAssembly module: {}", err))?;
|
||||
|
||||
webassembly::start_instance(
|
||||
|
@ -8,10 +8,10 @@ extern crate libc;
|
||||
extern crate region;
|
||||
extern crate structopt;
|
||||
extern crate wabt;
|
||||
extern crate wasmparser;
|
||||
extern crate wasmer_clif_backend;
|
||||
extern crate wasmer_runtime;
|
||||
extern crate wasmer_emscripten;
|
||||
extern crate wasmparser;
|
||||
// extern crate wasmer_emscripten;
|
||||
#[macro_use]
|
||||
extern crate target_lexicon;
|
||||
extern crate byteorder;
|
||||
|
@ -4,9 +4,10 @@ pub mod relocation;
|
||||
pub mod utils;
|
||||
|
||||
use wasmer_clif_backend::CraneliftCompiler;
|
||||
use wasmer_runtime::{backend::Compiler, module::Module};
|
||||
use wasmer_runtime;
|
||||
use wasmer_runtime::{Import, Imports, Instance};
|
||||
use wasmer_runtime::{backend::Compiler, module::Module};
|
||||
use wasmer_runtime::{Imports, Instance};
|
||||
|
||||
use cranelift_codegen::{
|
||||
isa,
|
||||
settings::{self, Configurable},
|
||||
@ -20,7 +21,7 @@ use wasmparser::WasmDecoder;
|
||||
|
||||
pub use self::errors::{Error, ErrorKind};
|
||||
|
||||
use wasmer_emscripten::{allocate_cstr_on_stack, allocate_on_stack, is_emscripten_module};
|
||||
// use wasmer_emscripten::{allocate_cstr_on_stack, allocate_on_stack, is_emscripten_module};
|
||||
|
||||
pub struct ResultObject {
|
||||
/// A webassembly::Module object representing the compiled WebAssembly module.
|
||||
@ -31,7 +32,6 @@ pub struct ResultObject {
|
||||
pub instance: Box<Instance>,
|
||||
}
|
||||
|
||||
|
||||
pub struct InstanceOptions {
|
||||
// Shall we mock automatically the imported functions if they don't exist?
|
||||
pub mock_missing_imports: bool,
|
||||
@ -39,7 +39,7 @@ pub struct InstanceOptions {
|
||||
pub mock_missing_tables: bool,
|
||||
pub abi: InstanceABI,
|
||||
pub show_progressbar: bool,
|
||||
// pub isa: Box<isa::TargetIsa>, TODO isa
|
||||
// pub isa: Box<isa::TargetIsa>, TODO isa
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
@ -71,10 +71,10 @@ pub fn instantiate(
|
||||
|
||||
//let instance = Instance::new(&module, import_object, options)?;
|
||||
unimplemented!()
|
||||
// let instance = wasmer_runtime::instantiate(buffer_source, &CraneliftCompiler::new(), import_object)
|
||||
// .map_err(|e| ErrorKind::CompileError(e))?;
|
||||
//
|
||||
// let isa = get_isa();
|
||||
// let instance = wasmer_runtime::instantiate(buffer_source, &CraneliftCompiler::new(), import_object)
|
||||
// .map_err(|e| ErrorKind::CompileError(e))?;
|
||||
//
|
||||
// let isa = get_isa();
|
||||
// let abi = if is_emscripten_module(&instance.module) {
|
||||
// InstanceABI::Emscripten
|
||||
// } else {
|
||||
@ -90,11 +90,11 @@ pub fn instantiate(
|
||||
// isa,
|
||||
// });
|
||||
|
||||
// debug!("webassembly - instance created");
|
||||
// Ok(ResultObject {
|
||||
// module: Arc::clone(&instance.module),
|
||||
// instance,
|
||||
// })
|
||||
// debug!("webassembly - instance created");
|
||||
// Ok(ResultObject {
|
||||
// module: Arc::clone(&instance.module),
|
||||
// instance,
|
||||
// })
|
||||
}
|
||||
|
||||
/// The webassembly::instantiate_streaming() function compiles and instantiates
|
||||
@ -118,9 +118,7 @@ pub fn instantiate_streaming(
|
||||
/// If the operation fails, the Result rejects with a
|
||||
/// webassembly::CompileError.
|
||||
pub fn compile(buffer_source: &[u8]) -> Result<Arc<Module>, ErrorKind> {
|
||||
let compiler = &CraneliftCompiler {};
|
||||
let module = compiler
|
||||
.compile(buffer_source)
|
||||
let module = wasmer_runtime::compile(&buffer_source, &CraneliftCompiler::new())
|
||||
.map_err(|e| ErrorKind::CompileError(e))?;
|
||||
|
||||
Ok(Arc::new(module))
|
||||
@ -169,23 +167,23 @@ pub fn get_isa() -> Box<isa::TargetIsa> {
|
||||
isa::lookup(triple!("x86_64")).unwrap().finish(flags)
|
||||
}
|
||||
|
||||
fn store_module_arguments(path: &str, args: Vec<&str>, instance: &mut Instance) -> (u32, u32) {
|
||||
let argc = args.len() + 1;
|
||||
// fn store_module_arguments(path: &str, args: Vec<&str>, instance: &mut Instance) -> (u32, u32) {
|
||||
// let argc = args.len() + 1;
|
||||
|
||||
let (argv_offset, argv_slice): (_, &mut [u32]) =
|
||||
unsafe { allocate_on_stack(((argc + 1) * 4) as u32, instance) };
|
||||
assert!(!argv_slice.is_empty());
|
||||
// let (argv_offset, argv_slice): (_, &mut [u32]) =
|
||||
// unsafe { allocate_on_stack(((argc + 1) * 4) as u32, instance) };
|
||||
// assert!(!argv_slice.is_empty());
|
||||
|
||||
argv_slice[0] = unsafe { allocate_cstr_on_stack(path, instance).0 };
|
||||
// argv_slice[0] = unsafe { allocate_cstr_on_stack(path, instance).0 };
|
||||
|
||||
for (slot, arg) in argv_slice[1..argc].iter_mut().zip(args.iter()) {
|
||||
*slot = unsafe { allocate_cstr_on_stack(&arg, instance).0 };
|
||||
}
|
||||
// for (slot, arg) in argv_slice[1..argc].iter_mut().zip(args.iter()) {
|
||||
// *slot = unsafe { allocate_cstr_on_stack(&arg, instance).0 };
|
||||
// }
|
||||
|
||||
argv_slice[argc] = 0;
|
||||
// argv_slice[argc] = 0;
|
||||
|
||||
(argc as u32, argv_offset)
|
||||
}
|
||||
// (argc as u32, argv_offset)
|
||||
// }
|
||||
|
||||
// fn get_module_arguments(options: &Run, instance: &mut webassembly::Instance) -> (u32, u32) {
|
||||
// // Application Arguments
|
||||
@ -227,7 +225,8 @@ pub fn start_instance(
|
||||
path: &str,
|
||||
args: Vec<&str>,
|
||||
) -> Result<(), String> {
|
||||
let main_name = if is_emscripten_module(&instance.module) {
|
||||
let main_name = if false {
|
||||
// is_emscripten_module(&instance.module)
|
||||
"_main"
|
||||
} else {
|
||||
"main"
|
||||
|
Reference in New Issue
Block a user