diff --git a/lib/runtime-core/src/fault.rs b/lib/runtime-core/src/fault.rs index d3422d55e..75b92bb23 100644 --- a/lib/runtime-core/src/fault.rs +++ b/lib/runtime-core/src/fault.rs @@ -198,7 +198,7 @@ unsafe fn with_breakpoint_map) -> R>(f: F) - #[cfg(not(target_arch = "x86_64"))] pub fn allocate_and_run R>(size: usize, f: F) -> R { - unimplemented!("allocate_and_run only supported on x86_64"); + f() } #[cfg(target_arch = "x86_64")] diff --git a/lib/runtime-core/src/instance.rs b/lib/runtime-core/src/instance.rs index e6ba365f6..38ac2ab8f 100644 --- a/lib/runtime-core/src/instance.rs +++ b/lib/runtime-core/src/instance.rs @@ -3,6 +3,7 @@ use crate::{ backing::{ImportBacking, LocalBacking}, error::{CallError, CallResult, ResolveError, ResolveResult, Result, RuntimeError}, export::{Context, Export, ExportIter, FuncPointer}, + fault::{pop_code_version, push_code_version}, global::Global, import::{ImportObject, LikeNamespace}, loader::Loader, @@ -11,6 +12,7 @@ use crate::{ sig_registry::SigRegistry, structures::TypedIndex, table::Table, + state::CodeVersion, typed_func::{Func, Wasm, WasmTrapInfo, WasmTypeList}, types::{FuncIndex, FuncSig, GlobalIndex, LocalOrImport, MemoryIndex, TableIndex, Type, Value}, vm::{self, InternalField}, @@ -333,7 +335,13 @@ impl Instance { let mut results = Vec::new(); - call_func_with_index( + push_code_version(CodeVersion { + baseline: true, + msm: self.module.runnable_module.get_module_state_map().unwrap(), + base: self.module.runnable_module.get_code().unwrap().as_ptr() as usize, + }); + + let result = call_func_with_index( &self.module.info, &*self.module.runnable_module, &self.inner.import_backing, @@ -341,7 +349,10 @@ impl Instance { func_index, params, &mut results, - )?; + ); + + pop_code_version().unwrap(); + result?; Ok(results) }