diff --git a/crates/wasmtime/src/externals/global.rs b/crates/wasmtime/src/externals/global.rs index 594080a18025..ef5cc730f14f 100644 --- a/crates/wasmtime/src/externals/global.rs +++ b/crates/wasmtime/src/externals/global.rs @@ -155,7 +155,7 @@ impl Global { Val::F64(f) => *definition.as_u64_mut() = f, Val::FuncRef(f) => { *definition.as_func_ref_mut() = f.map_or(ptr::null_mut(), |f| { - f.caller_checked_func_ref(store).as_ptr().cast() + f.vm_func_ref(store).as_ptr().cast() }); } Val::ExternRef(x) => { diff --git a/crates/wasmtime/src/func.rs b/crates/wasmtime/src/func.rs index 134a8321a59d..5c35f1616c50 100644 --- a/crates/wasmtime/src/func.rs +++ b/crates/wasmtime/src/func.rs @@ -946,7 +946,7 @@ impl Func { /// this function is properly rooted within it. Additionally this function /// should not be liberally used since it's a very low-level knob. pub unsafe fn to_raw(&self, mut store: impl AsContextMut) -> *mut c_void { - self.caller_checked_func_ref(store.as_context_mut().0) + self.vm_func_ref(store.as_context_mut().0) .as_ptr() .cast() } @@ -1080,7 +1080,7 @@ impl Func { } #[inline] - pub(crate) fn caller_checked_func_ref(&self, store: &mut StoreOpaque) -> NonNull { + pub(crate) fn vm_func_ref(&self, store: &mut StoreOpaque) -> NonNull { let func_data = &mut store.store_data_mut()[self.0]; if let Some(in_store) = func_data.in_store_func_ref { in_store.as_non_null() @@ -1347,7 +1347,7 @@ impl Func { /// will be consistent across all of these functions. #[allow(dead_code)] // Not used yet, but added for consistency. pub(crate) fn hash_key(&self, store: &mut StoreOpaque) -> impl std::hash::Hash + Eq { - self.caller_checked_func_ref(store).as_ptr() as usize + self.vm_func_ref(store).as_ptr() as usize } } diff --git a/crates/wasmtime/src/func/typed.rs b/crates/wasmtime/src/func/typed.rs index 8229e14585b3..f1188faad4aa 100644 --- a/crates/wasmtime/src/func/typed.rs +++ b/crates/wasmtime/src/func/typed.rs @@ -84,7 +84,7 @@ where !store.0.async_support(), "must use `call_async` with async stores" ); - let func = self.func.caller_checked_func_ref(store.0); + let func = self.func.vm_func_ref(store.0); unsafe { Self::call_raw(&mut store, func, params) } } @@ -122,7 +122,7 @@ where ); store .on_fiber(|store| { - let func = self.func.caller_checked_func_ref(store.0); + let func = self.func.vm_func_ref(store.0); unsafe { Self::call_raw(store, func, params) } }) .await? @@ -439,7 +439,7 @@ unsafe impl WasmTy for Option { #[inline] fn into_abi(self, store: &mut StoreOpaque) -> Self::Abi { if let Some(f) = self { - f.caller_checked_func_ref(store).as_ptr() + f.vm_func_ref(store).as_ptr() } else { ptr::null_mut() } diff --git a/crates/wasmtime/src/trampoline/global.rs b/crates/wasmtime/src/trampoline/global.rs index 263e91b2e34f..39880a485559 100644 --- a/crates/wasmtime/src/trampoline/global.rs +++ b/crates/wasmtime/src/trampoline/global.rs @@ -54,7 +54,7 @@ pub fn generate_global_export( Val::V128(x) => *global.as_u128_mut() = x.into(), Val::FuncRef(f) => { *global.as_func_ref_mut() = f.map_or(ptr::null_mut(), |f| { - f.caller_checked_func_ref(store).as_ptr() + f.vm_func_ref(store).as_ptr() }) } Val::ExternRef(x) => *global.as_externref_mut() = x.map(|x| x.inner), diff --git a/crates/wasmtime/src/values.rs b/crates/wasmtime/src/values.rs index 87040ec6850f..8f20b27bf7f2 100644 --- a/crates/wasmtime/src/values.rs +++ b/crates/wasmtime/src/values.rs @@ -195,7 +195,7 @@ impl Val { bail!("cross-`Store` values are not supported in tables"); } Ok(TableElement::FuncRef( - f.caller_checked_func_ref(store).as_ptr(), + f.vm_func_ref(store).as_ptr(), )) } (Val::FuncRef(None), ValType::FuncRef) => Ok(TableElement::FuncRef(ptr::null_mut())),