mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-08 10:38:04 +00:00
Merge branch 'master' into command/pyodide
This commit is contained in:
commit
d165763b4d
@ -76,6 +76,7 @@
|
|||||||
//! [`wasmer-clif-backend`]: https://crates.io/crates/wasmer-clif-backend
|
//! [`wasmer-clif-backend`]: https://crates.io/crates/wasmer-clif-backend
|
||||||
//! [`compile_with`]: fn.compile_with.html
|
//! [`compile_with`]: fn.compile_with.html
|
||||||
|
|
||||||
|
pub use wasmer_runtime_core::codegen::{MiddlewareChain, StreamingCompiler};
|
||||||
pub use wasmer_runtime_core::export::Export;
|
pub use wasmer_runtime_core::export::Export;
|
||||||
pub use wasmer_runtime_core::global::Global;
|
pub use wasmer_runtime_core::global::Global;
|
||||||
pub use wasmer_runtime_core::import::ImportObject;
|
pub use wasmer_runtime_core::import::ImportObject;
|
||||||
|
@ -16,21 +16,19 @@ use structopt::StructOpt;
|
|||||||
use wasmer::*;
|
use wasmer::*;
|
||||||
use wasmer_clif_backend::CraneliftCompiler;
|
use wasmer_clif_backend::CraneliftCompiler;
|
||||||
#[cfg(feature = "backend:llvm")]
|
#[cfg(feature = "backend:llvm")]
|
||||||
use wasmer_llvm_backend::code::LLVMModuleCodeGenerator;
|
use wasmer_llvm_backend::LLVMCompiler;
|
||||||
use wasmer_runtime::{
|
use wasmer_runtime::{
|
||||||
cache::{Cache as BaseCache, FileSystemCache, WasmHash, WASMER_VERSION_HASH},
|
cache::{Cache as BaseCache, FileSystemCache, WasmHash, WASMER_VERSION_HASH},
|
||||||
error::RuntimeError,
|
error::RuntimeError,
|
||||||
Func, Value,
|
Func, Value,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "backend:singlepass")]
|
|
||||||
use wasmer_runtime_core::codegen::{MiddlewareChain, StreamingCompiler};
|
|
||||||
use wasmer_runtime_core::{
|
use wasmer_runtime_core::{
|
||||||
self,
|
self,
|
||||||
backend::{Compiler, CompilerConfig, MemoryBoundCheckMode},
|
backend::{Compiler, CompilerConfig, MemoryBoundCheckMode},
|
||||||
loader::{Instance as LoadedInstance, LocalLoader},
|
loader::{Instance as LoadedInstance, LocalLoader},
|
||||||
};
|
};
|
||||||
#[cfg(feature = "backend:singlepass")]
|
#[cfg(feature = "backend:singlepass")]
|
||||||
use wasmer_singlepass_backend::ModuleCodeGenerator as SinglePassMCG;
|
use wasmer_singlepass_backend::SinglePassCompiler;
|
||||||
#[cfg(feature = "wasi")]
|
#[cfg(feature = "wasi")]
|
||||||
use wasmer_wasi;
|
use wasmer_wasi;
|
||||||
|
|
||||||
@ -120,9 +118,6 @@ struct Run {
|
|||||||
/// Application arguments
|
/// Application arguments
|
||||||
#[structopt(name = "--", raw(multiple = "true"))]
|
#[structopt(name = "--", raw(multiple = "true"))]
|
||||||
args: Vec<String>,
|
args: Vec<String>,
|
||||||
|
|
||||||
#[structopt(long = "inst-limit")]
|
|
||||||
instruction_limit: Option<u64>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
@ -344,33 +339,12 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
|
|||||||
|
|
||||||
let compiler: Box<dyn Compiler> = match options.backend {
|
let compiler: Box<dyn Compiler> = match options.backend {
|
||||||
#[cfg(feature = "backend:singlepass")]
|
#[cfg(feature = "backend:singlepass")]
|
||||||
Backend::Singlepass => {
|
Backend::Singlepass => Box::new(SinglePassCompiler::new()),
|
||||||
let c: StreamingCompiler<SinglePassMCG, _, _, _, _> = StreamingCompiler::new(|| {
|
|
||||||
let mut chain = MiddlewareChain::new();
|
|
||||||
use wasmer_middleware_common::metering::Metering;
|
|
||||||
if let Some(limit) = options.instruction_limit {
|
|
||||||
chain.push(Metering::new(limit));
|
|
||||||
}
|
|
||||||
chain
|
|
||||||
});
|
|
||||||
Box::new(c)
|
|
||||||
}
|
|
||||||
#[cfg(not(feature = "backend:singlepass"))]
|
#[cfg(not(feature = "backend:singlepass"))]
|
||||||
Backend::Singlepass => return Err("The singlepass backend is not enabled".to_string()),
|
Backend::Singlepass => return Err("The singlepass backend is not enabled".to_string()),
|
||||||
Backend::Cranelift => Box::new(CraneliftCompiler::new()),
|
Backend::Cranelift => Box::new(CraneliftCompiler::new()),
|
||||||
#[cfg(feature = "backend:llvm")]
|
#[cfg(feature = "backend:llvm")]
|
||||||
Backend::LLVM => {
|
Backend::LLVM => Box::new(LLVMCompiler::new()),
|
||||||
let c: StreamingCompiler<LLVMModuleCodeGenerator, _, _, _, _> =
|
|
||||||
StreamingCompiler::new(|| {
|
|
||||||
let mut chain = MiddlewareChain::new();
|
|
||||||
use wasmer_middleware_common::metering::Metering;
|
|
||||||
if let Some(limit) = options.instruction_limit {
|
|
||||||
chain.push(Metering::new(limit));
|
|
||||||
}
|
|
||||||
chain
|
|
||||||
});
|
|
||||||
Box::new(c)
|
|
||||||
}
|
|
||||||
#[cfg(not(feature = "backend:llvm"))]
|
#[cfg(not(feature = "backend:llvm"))]
|
||||||
Backend::LLVM => return Err("the llvm backend is not enabled".to_string()),
|
Backend::LLVM => return Err("the llvm backend is not enabled".to_string()),
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user