Skip to content

Commit

Permalink
Rename wasmtime::Func::caller_checked_func_ref to `wasmtime::Func::…
Browse files Browse the repository at this point in the history
…vm_func_ref`

We removed the "caller checked" part of the `VMFuncRef` type's name a while ago,
so update this method to be in line with that.

No functional changes, just mechanical renaming.
  • Loading branch information
fitzgen committed Sep 25, 2023
1 parent a22561f commit 1929db6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/wasmtime/src/externals/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
6 changes: 3 additions & 3 deletions crates/wasmtime/src/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -1080,7 +1080,7 @@ impl Func {
}

#[inline]
pub(crate) fn caller_checked_func_ref(&self, store: &mut StoreOpaque) -> NonNull<VMFuncRef> {
pub(crate) fn vm_func_ref(&self, store: &mut StoreOpaque) -> NonNull<VMFuncRef> {
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()
Expand Down Expand Up @@ -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
}
}

Expand Down
6 changes: 3 additions & 3 deletions crates/wasmtime/src/func/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}

Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -439,7 +439,7 @@ unsafe impl WasmTy for Option<Func> {
#[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()
}
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmtime/src/trampoline/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmtime/src/values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())),
Expand Down

0 comments on commit 1929db6

Please sign in to comment.