Skip push/pop code version on Windows.

This commit is contained in:
losfair 2019-11-22 08:07:24 +08:00
parent 5da44c3bf8
commit ee7b0d625a

View File

@ -687,27 +687,37 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
#[cfg(not(feature = "managed"))]
{
use wasmer_runtime::error::RuntimeError;
#[cfg(unix)]
use wasmer_runtime_core::{
fault::{pop_code_version, push_code_version},
state::CodeVersion,
};
let cv_pushed = if let Some(msm) =
instance.module.runnable_module.get_module_state_map()
let result;
#[cfg(unix)]
{
push_code_version(CodeVersion {
baseline: true,
msm: msm,
base: instance.module.runnable_module.get_code().unwrap().as_ptr() as usize,
backend: options.backend,
});
true
} else {
false
};
let result = start.call();
if cv_pushed {
pop_code_version().unwrap();
let cv_pushed =
if let Some(msm) = instance.module.runnable_module.get_module_state_map() {
push_code_version(CodeVersion {
baseline: true,
msm: msm,
base: instance.module.runnable_module.get_code().unwrap().as_ptr()
as usize,
backend: options.backend,
});
true
} else {
false
};
result = start.call();
if cv_pushed {
pop_code_version().unwrap();
}
}
#[cfg(not(unix))]
{
result = start.call();
}
if let Err(ref err) = result {