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"))] #[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)]
{ {
push_code_version(CodeVersion { let cv_pushed =
baseline: true, if let Some(msm) = instance.module.runnable_module.get_module_state_map() {
msm: msm, push_code_version(CodeVersion {
base: instance.module.runnable_module.get_code().unwrap().as_ptr() as usize, baseline: true,
backend: options.backend, msm: msm,
}); base: instance.module.runnable_module.get_code().unwrap().as_ptr()
true as usize,
} else { backend: options.backend,
false });
}; true
let result = start.call(); } else {
if cv_pushed { false
pop_code_version().unwrap(); };
result = start.call();
if cv_pushed {
pop_code_version().unwrap();
}
}
#[cfg(not(unix))]
{
result = start.call();
} }
if let Err(ref err) = result { if let Err(ref err) = result {