mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-30 17:11:33 +00:00
Require backend:singlepass for suspend/resume.
This commit is contained in:
@ -44,6 +44,7 @@ pub mod vmcalls;
|
|||||||
#[cfg(all(unix, target_arch = "x86_64"))]
|
#[cfg(all(unix, target_arch = "x86_64"))]
|
||||||
pub use trampoline_x64 as trampoline;
|
pub use trampoline_x64 as trampoline;
|
||||||
pub mod state;
|
pub mod state;
|
||||||
|
#[cfg(all(unix, target_arch = "x86_64"))]
|
||||||
pub mod suspend;
|
pub mod suspend;
|
||||||
|
|
||||||
use self::error::CompileResult;
|
use self::error::CompileResult;
|
||||||
|
@ -112,6 +112,7 @@ struct Run {
|
|||||||
)]
|
)]
|
||||||
loader: Option<LoaderName>,
|
loader: Option<LoaderName>,
|
||||||
|
|
||||||
|
#[cfg(feature = "backend:singlepass")]
|
||||||
#[structopt(long = "image-file")]
|
#[structopt(long = "image-file")]
|
||||||
image_file: Option<String>,
|
image_file: Option<String>,
|
||||||
|
|
||||||
@ -508,6 +509,8 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
|
|||||||
mapped_dirs,
|
mapped_dirs,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#[cfg(feature = "backend:singlepass")]
|
||||||
|
{
|
||||||
if let Some(ref name) = options.image_file {
|
if let Some(ref name) = options.image_file {
|
||||||
use wasmer_runtime_core::suspend::{patch_import_object, SuspendConfig};
|
use wasmer_runtime_core::suspend::{patch_import_object, SuspendConfig};
|
||||||
patch_import_object(
|
patch_import_object(
|
||||||
@ -517,11 +520,14 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let mut instance = module
|
let mut instance = module
|
||||||
.instantiate(&import_object)
|
.instantiate(&import_object)
|
||||||
.map_err(|e| format!("Can't instantiate module: {:?}", e))?;
|
.map_err(|e| format!("Can't instantiate module: {:?}", e))?;
|
||||||
|
|
||||||
|
#[cfg(feature = "backend:singlepass")]
|
||||||
|
{
|
||||||
if let Some(ref name) = options.image_file {
|
if let Some(ref name) = options.image_file {
|
||||||
if options.resume {
|
if options.resume {
|
||||||
use wasmer_runtime_core::state::x64::invoke_call_return_on_stack_raw_image;
|
use wasmer_runtime_core::state::x64::invoke_call_return_on_stack_raw_image;
|
||||||
@ -552,6 +558,7 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let start: Func<(), ()> = instance.func("_start").map_err(|e| format!("{:?}", e))?;
|
let start: Func<(), ()> = instance.func("_start").map_err(|e| format!("{:?}", e))?;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user