Rename VMCallerCheckedAnyfunc to VMCallerCheckedFuncRef (#5738)
At some point what is now `funcref` was called `anyfunc` and the spec changed, but we didn't update our internal names. This does that. Co-authored-by: Jamey Sharp <jsharp@fastly.com>
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
//! cranelift-compiled adapters, will use this `VMComponentContext` as well.
|
||||
|
||||
use crate::{
|
||||
Store, VMCallerCheckedAnyfunc, VMFunctionBody, VMGlobalDefinition, VMMemoryDefinition,
|
||||
Store, VMCallerCheckedFuncRef, VMFunctionBody, VMGlobalDefinition, VMMemoryDefinition,
|
||||
VMOpaqueContext, VMSharedSignatureIndex, ValRaw,
|
||||
};
|
||||
use memoffset::offset_of;
|
||||
@@ -79,7 +79,7 @@ pub type VMLoweringCallee = extern "C" fn(
|
||||
data: *mut u8,
|
||||
flags: InstanceFlags,
|
||||
opt_memory: *mut VMMemoryDefinition,
|
||||
opt_realloc: *mut VMCallerCheckedAnyfunc,
|
||||
opt_realloc: *mut VMCallerCheckedFuncRef,
|
||||
string_encoding: StringEncoding,
|
||||
args_and_results: *mut ValRaw,
|
||||
nargs_and_results: usize,
|
||||
@@ -201,7 +201,7 @@ impl ComponentInstance {
|
||||
///
|
||||
/// This can only be called after `idx` has been initialized at runtime
|
||||
/// during the instantiation process of a component.
|
||||
pub fn runtime_realloc(&self, idx: RuntimeReallocIndex) -> NonNull<VMCallerCheckedAnyfunc> {
|
||||
pub fn runtime_realloc(&self, idx: RuntimeReallocIndex) -> NonNull<VMCallerCheckedFuncRef> {
|
||||
unsafe {
|
||||
let ret = *self.vmctx_plus_offset::<NonNull<_>>(self.offsets.runtime_realloc(idx));
|
||||
debug_assert!(ret.as_ptr() as usize != INVALID_PTR);
|
||||
@@ -216,7 +216,7 @@ impl ComponentInstance {
|
||||
pub fn runtime_post_return(
|
||||
&self,
|
||||
idx: RuntimePostReturnIndex,
|
||||
) -> NonNull<VMCallerCheckedAnyfunc> {
|
||||
) -> NonNull<VMCallerCheckedFuncRef> {
|
||||
unsafe {
|
||||
let ret = *self.vmctx_plus_offset::<NonNull<_>>(self.offsets.runtime_post_return(idx));
|
||||
debug_assert!(ret.as_ptr() as usize != INVALID_PTR);
|
||||
@@ -246,7 +246,7 @@ impl ComponentInstance {
|
||||
///
|
||||
/// This can only be called after `idx` has been initialized at runtime
|
||||
/// during the instantiation process of a component.
|
||||
pub fn lowering_anyfunc(&self, idx: LoweredIndex) -> NonNull<VMCallerCheckedAnyfunc> {
|
||||
pub fn lowering_anyfunc(&self, idx: LoweredIndex) -> NonNull<VMCallerCheckedFuncRef> {
|
||||
unsafe { self.anyfunc(self.offsets.lowering_anyfunc(idx)) }
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ impl ComponentInstance {
|
||||
pub fn always_trap_anyfunc(
|
||||
&self,
|
||||
idx: RuntimeAlwaysTrapIndex,
|
||||
) -> NonNull<VMCallerCheckedAnyfunc> {
|
||||
) -> NonNull<VMCallerCheckedFuncRef> {
|
||||
unsafe { self.anyfunc(self.offsets.always_trap_anyfunc(idx)) }
|
||||
}
|
||||
|
||||
@@ -262,12 +262,12 @@ impl ComponentInstance {
|
||||
pub fn transcoder_anyfunc(
|
||||
&self,
|
||||
idx: RuntimeTranscoderIndex,
|
||||
) -> NonNull<VMCallerCheckedAnyfunc> {
|
||||
) -> NonNull<VMCallerCheckedFuncRef> {
|
||||
unsafe { self.anyfunc(self.offsets.transcoder_anyfunc(idx)) }
|
||||
}
|
||||
|
||||
unsafe fn anyfunc(&self, offset: u32) -> NonNull<VMCallerCheckedAnyfunc> {
|
||||
let ret = self.vmctx_plus_offset::<VMCallerCheckedAnyfunc>(offset);
|
||||
unsafe fn anyfunc(&self, offset: u32) -> NonNull<VMCallerCheckedFuncRef> {
|
||||
let ret = self.vmctx_plus_offset::<VMCallerCheckedFuncRef>(offset);
|
||||
debug_assert!((*ret).func_ptr.as_ptr() as usize != INVALID_PTR);
|
||||
debug_assert!((*ret).vmctx as usize != INVALID_PTR);
|
||||
NonNull::new(ret).unwrap()
|
||||
@@ -294,7 +294,7 @@ impl ComponentInstance {
|
||||
pub fn set_runtime_realloc(
|
||||
&mut self,
|
||||
idx: RuntimeReallocIndex,
|
||||
ptr: NonNull<VMCallerCheckedAnyfunc>,
|
||||
ptr: NonNull<VMCallerCheckedFuncRef>,
|
||||
) {
|
||||
unsafe {
|
||||
let storage = self.vmctx_plus_offset(self.offsets.runtime_realloc(idx));
|
||||
@@ -307,7 +307,7 @@ impl ComponentInstance {
|
||||
pub fn set_runtime_post_return(
|
||||
&mut self,
|
||||
idx: RuntimePostReturnIndex,
|
||||
ptr: NonNull<VMCallerCheckedAnyfunc>,
|
||||
ptr: NonNull<VMCallerCheckedFuncRef>,
|
||||
) {
|
||||
unsafe {
|
||||
let storage = self.vmctx_plus_offset(self.offsets.runtime_post_return(idx));
|
||||
@@ -378,7 +378,7 @@ impl ComponentInstance {
|
||||
) {
|
||||
debug_assert!(*self.vmctx_plus_offset::<usize>(offset) == INVALID_PTR);
|
||||
let vmctx = self.vmctx();
|
||||
*self.vmctx_plus_offset(offset) = VMCallerCheckedAnyfunc {
|
||||
*self.vmctx_plus_offset(offset) = VMCallerCheckedFuncRef {
|
||||
func_ptr,
|
||||
type_index,
|
||||
vmctx: VMOpaqueContext::from_vmcomponent(vmctx),
|
||||
@@ -510,7 +510,7 @@ impl OwnedComponentInstance {
|
||||
pub fn set_runtime_realloc(
|
||||
&mut self,
|
||||
idx: RuntimeReallocIndex,
|
||||
ptr: NonNull<VMCallerCheckedAnyfunc>,
|
||||
ptr: NonNull<VMCallerCheckedFuncRef>,
|
||||
) {
|
||||
unsafe { self.instance_mut().set_runtime_realloc(idx, ptr) }
|
||||
}
|
||||
@@ -519,7 +519,7 @@ impl OwnedComponentInstance {
|
||||
pub fn set_runtime_post_return(
|
||||
&mut self,
|
||||
idx: RuntimePostReturnIndex,
|
||||
ptr: NonNull<VMCallerCheckedAnyfunc>,
|
||||
ptr: NonNull<VMCallerCheckedFuncRef>,
|
||||
) {
|
||||
unsafe { self.instance_mut().set_runtime_post_return(idx, ptr) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user