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