mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-25 02:12:13 +00:00
Updates to get wasmer crate compiling
This commit is contained in:
parent
985e2b2f42
commit
3e641d9f89
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1107,6 +1107,7 @@ dependencies = [
|
||||
name = "wasmer-clif-backend"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cranelift-codegen 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cranelift-entity 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cranelift-native 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -190,3 +190,10 @@ impl ImportResolver for Imports {
|
||||
pub trait ImportResolver {
|
||||
fn get(&self, module: &str, name: &str) -> Option<&Import>;
|
||||
}
|
||||
|
||||
// TODO Remove this later, only needed for compilation till emscripten is updated
|
||||
impl Instance {
|
||||
pub fn memory_offset_addr(&self, index: usize, offset: usize) -> *const usize {
|
||||
unimplemented!("TODO replace this emscripten stub")
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
use wasmer_runtime::{Instance, Module};
|
||||
use wasmer_runtime::{Instance, module::Module};
|
||||
//use wasmer_runtime::Instance;
|
||||
use crate::apis::emscripten::env;
|
||||
use libc::stat;
|
||||
|
@ -74,18 +74,18 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
|
||||
.map_err(|err| format!("Can't create the WebAssembly module: {}", err))?;
|
||||
|
||||
let abi = if apis::is_emscripten_module(&module) {
|
||||
wasmer_runtime::InstanceABI::Emscripten
|
||||
webassembly::InstanceABI::Emscripten
|
||||
} else {
|
||||
wasmer_runtime::InstanceABI::None
|
||||
webassembly::InstanceABI::None
|
||||
};
|
||||
|
||||
let import_object = if abi == wasmer_runtime::InstanceABI::Emscripten {
|
||||
let import_object = if abi == webassembly::InstanceABI::Emscripten {
|
||||
apis::generate_emscripten_env()
|
||||
} else {
|
||||
wasmer_runtime::Imports::new()
|
||||
};
|
||||
|
||||
let instance_options = wasmer_runtime::InstanceOptions {
|
||||
let instance_options = webassembly::InstanceOptions {
|
||||
mock_missing_imports: true,
|
||||
mock_missing_globals: true,
|
||||
mock_missing_tables: true,
|
||||
|
@ -4,9 +4,9 @@ pub mod relocation;
|
||||
pub mod utils;
|
||||
|
||||
use wasmer_clif_backend::CraneliftCompiler;
|
||||
use wasmer_runtime::{Compiler, Module};
|
||||
use wasmer_runtime::{backend::Compiler, module::Module};
|
||||
use wasmer_runtime;
|
||||
use wasmer_runtime::{Import, Imports, Instance, InstanceOptions};
|
||||
use wasmer_runtime::{Import, Imports, Instance};
|
||||
use cranelift_codegen::{
|
||||
isa,
|
||||
settings::{self, Configurable},
|
||||
@ -31,6 +31,23 @@ 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,
|
||||
pub mock_missing_globals: bool,
|
||||
pub mock_missing_tables: bool,
|
||||
pub abi: InstanceABI,
|
||||
pub show_progressbar: bool,
|
||||
// pub isa: Box<isa::TargetIsa>, TODO isa
|
||||
}
|
||||
|
||||
#[derive(PartialEq)]
|
||||
pub enum InstanceABI {
|
||||
Emscripten,
|
||||
None,
|
||||
}
|
||||
|
||||
/// The webassembly::instantiate() function allows you to compile and
|
||||
/// instantiate WebAssembly code
|
||||
/// Params:
|
||||
|
Loading…
x
Reference in New Issue
Block a user