mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-09 06:08:29 +00:00
Fixed compilation issue
This commit is contained in:
@@ -136,7 +136,7 @@ cfg_if! {
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
|
pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
|
||||||
let compiler_config: Box<dyn CompilerConfig> = get_default_compiler_config();
|
let compiler_config: Box<dyn CompilerConfig> = get_default_compiler_config();
|
||||||
let engine: Arc<dyn Engine + Send + Sync> = Arc::new(JIT::new(*compiler_config).engine());
|
let engine: Arc<dyn Engine + Send + Sync> = Arc::new(JIT::new(compiler_config).engine());
|
||||||
Box::new(wasm_engine_t { inner: engine })
|
Box::new(wasm_engine_t { inner: engine })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -154,7 +154,7 @@ cfg_if! {
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
|
pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
|
||||||
let mut compiler_config: Box<dyn CompilerConfig> = get_default_compiler_config();
|
let mut compiler_config: Box<dyn CompilerConfig> = get_default_compiler_config();
|
||||||
let engine: Arc<dyn Engine + Send + Sync> = Arc::new(Native::new( *compiler_config).engine());
|
let engine: Arc<dyn Engine + Send + Sync> = Arc::new(Native::new(compiler_config).engine());
|
||||||
Box::new(wasm_engine_t { inner: engine })
|
Box::new(wasm_engine_t { inner: engine })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ pub extern "C" fn wasm_engine_new_with_config(
|
|||||||
wasmer_engine_t::JIT => {
|
wasmer_engine_t::JIT => {
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(feature = "jit")] {
|
if #[cfg(feature = "jit")] {
|
||||||
Arc::new(JIT::new(*compiler_config).engine())
|
Arc::new(JIT::new(compiler_config).engine())
|
||||||
} else {
|
} else {
|
||||||
return return_with_error("Wasmer has not been compiled with the `jit` feature.");
|
return return_with_error("Wasmer has not been compiled with the `jit` feature.");
|
||||||
}
|
}
|
||||||
@@ -252,7 +252,7 @@ pub extern "C" fn wasm_engine_new_with_config(
|
|||||||
wasmer_engine_t::NATIVE => {
|
wasmer_engine_t::NATIVE => {
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(feature = "native")] {
|
if #[cfg(feature = "native")] {
|
||||||
Arc::new(Native::new( *compiler_config).engine())
|
Arc::new(Native::new(compiler_config).engine())
|
||||||
} else {
|
} else {
|
||||||
return return_with_error("Wasmer has not been compiled with the `native` feature.");
|
return return_with_error("Wasmer has not been compiled with the `native` feature.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ pub struct JIT {
|
|||||||
|
|
||||||
impl JIT {
|
impl JIT {
|
||||||
/// Create a new JIT
|
/// Create a new JIT
|
||||||
pub fn new(compiler_config: impl CompilerConfig + 'static) -> Self {
|
pub fn new<T>(compiler_config: T) -> Self where T: Into<Box<dyn CompilerConfig>> {
|
||||||
Self {
|
Self {
|
||||||
compiler_config: Some(Box::new(compiler_config)),
|
compiler_config: Some(compiler_config.into()),
|
||||||
target: None,
|
target: None,
|
||||||
features: None,
|
features: None,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,12 @@ pub struct Native {
|
|||||||
impl Native {
|
impl Native {
|
||||||
#[cfg(feature = "compiler")]
|
#[cfg(feature = "compiler")]
|
||||||
/// Create a new Native
|
/// Create a new Native
|
||||||
pub fn new(mut compiler_config: impl CompilerConfig + 'static) -> Self {
|
pub fn new<T>(compiler_config: T) -> Self where T: Into<Box<dyn CompilerConfig>> {
|
||||||
|
let mut compiler_config = compiler_config.into();
|
||||||
compiler_config.enable_pic();
|
compiler_config.enable_pic();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
compiler_config: Some(Box::new(compiler_config)),
|
compiler_config: Some(compiler_config),
|
||||||
target: None,
|
target: None,
|
||||||
features: None,
|
features: None,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,12 @@ pub struct ObjectFile {
|
|||||||
impl ObjectFile {
|
impl ObjectFile {
|
||||||
#[cfg(feature = "compiler")]
|
#[cfg(feature = "compiler")]
|
||||||
/// Create a new ObjectFile
|
/// Create a new ObjectFile
|
||||||
pub fn new(mut compiler_config: impl CompilerConfig + 'static) -> Self {
|
pub fn new<T>(compiler_config: T) -> Self where T: Into<Box<dyn CompilerConfig>> {
|
||||||
|
let mut compiler_config = compiler_config.into();
|
||||||
compiler_config.enable_pic();
|
compiler_config.enable_pic();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
compiler_config: Some(Box::new(compiler_config)),
|
compiler_config: Some(compiler_config),
|
||||||
target: None,
|
target: None,
|
||||||
features: None,
|
features: None,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user