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:
Nick Fitzgerald
2023-02-07 14:09:02 -08:00
committed by GitHub
parent edfa10d607
commit 317cc51337
23 changed files with 126 additions and 126 deletions

View File

@@ -50,7 +50,7 @@ struct CompiledComponentInfo {
/// section of `code_memory`.
///
/// These trampolines are the function pointer within the
/// `VMCallerCheckedAnyfunc` and will delegate indirectly to a host function
/// `VMCallerCheckedFuncRef` and will delegate indirectly to a host function
/// pointer when called.
lowerings: PrimaryMap<LoweredIndex, FunctionLoc>,

View File

@@ -15,7 +15,7 @@ use wasmtime_environ::component::{
use wasmtime_runtime::component::{
InstanceFlags, VMComponentContext, VMLowering, VMLoweringCallee,
};
use wasmtime_runtime::{VMCallerCheckedAnyfunc, VMMemoryDefinition, VMOpaqueContext};
use wasmtime_runtime::{VMCallerCheckedFuncRef, VMMemoryDefinition, VMOpaqueContext};
pub struct HostFunc {
entrypoint: VMLoweringCallee,
@@ -43,7 +43,7 @@ impl HostFunc {
data: *mut u8,
flags: InstanceFlags,
memory: *mut VMMemoryDefinition,
realloc: *mut VMCallerCheckedAnyfunc,
realloc: *mut VMCallerCheckedFuncRef,
string_encoding: StringEncoding,
storage: *mut ValRaw,
storage_len: usize,
@@ -150,7 +150,7 @@ unsafe fn call_host<T, Params, Return, F>(
cx: *mut VMOpaqueContext,
mut flags: InstanceFlags,
memory: *mut VMMemoryDefinition,
realloc: *mut VMCallerCheckedAnyfunc,
realloc: *mut VMCallerCheckedFuncRef,
string_encoding: StringEncoding,
storage: &mut [ValRaw],
closure: F,
@@ -280,7 +280,7 @@ unsafe fn call_host_dynamic<T, F>(
cx: *mut VMOpaqueContext,
mut flags: InstanceFlags,
memory: *mut VMMemoryDefinition,
realloc: *mut VMCallerCheckedAnyfunc,
realloc: *mut VMCallerCheckedFuncRef,
string_encoding: StringEncoding,
storage: &mut [ValRaw],
closure: F,
@@ -398,7 +398,7 @@ extern "C" fn dynamic_entrypoint<T, F>(
data: *mut u8,
flags: InstanceFlags,
memory: *mut VMMemoryDefinition,
realloc: *mut VMCallerCheckedAnyfunc,
realloc: *mut VMCallerCheckedFuncRef,
string_encoding: StringEncoding,
storage: *mut ValRaw,
storage_len: usize,

View File

@@ -3,7 +3,7 @@ use crate::StoreContextMut;
use anyhow::{bail, Result};
use std::ptr::NonNull;
use wasmtime_environ::component::StringEncoding;
use wasmtime_runtime::{VMCallerCheckedAnyfunc, VMMemoryDefinition};
use wasmtime_runtime::{VMCallerCheckedFuncRef, VMMemoryDefinition};
/// Runtime representation of canonical ABI options in the component model.
///
@@ -30,7 +30,7 @@ pub struct Options {
/// function.
///
/// Safely using this pointer has the same restrictions as `memory` above.
realloc: Option<NonNull<VMCallerCheckedAnyfunc>>,
realloc: Option<NonNull<VMCallerCheckedFuncRef>>,
/// The encoding used for strings, if found.
///
@@ -57,7 +57,7 @@ impl Options {
pub unsafe fn new(
store_id: StoreId,
memory: Option<NonNull<VMMemoryDefinition>>,
realloc: Option<NonNull<VMCallerCheckedAnyfunc>>,
realloc: Option<NonNull<VMCallerCheckedFuncRef>>,
string_encoding: StringEncoding,
) -> Options {
Options {

View File

@@ -11,7 +11,7 @@ use std::pin::Pin;
use std::ptr::NonNull;
use std::sync::Arc;
use wasmtime_runtime::{
ExportFunction, InstanceHandle, VMCallerCheckedAnyfunc, VMContext, VMFunctionBody,
ExportFunction, InstanceHandle, VMCallerCheckedFuncRef, VMContext, VMFunctionBody,
VMFunctionImport, VMHostFuncContext, VMOpaqueContext, VMSharedSignatureIndex, VMTrampoline,
};
@@ -497,7 +497,7 @@ impl Func {
pub(crate) unsafe fn from_caller_checked_anyfunc(
store: &mut StoreOpaque,
raw: *mut VMCallerCheckedAnyfunc,
raw: *mut VMCallerCheckedFuncRef,
) -> Option<Func> {
let anyfunc = NonNull::new(raw)?;
debug_assert!(anyfunc.as_ref().type_index != VMSharedSignatureIndex::default());
@@ -891,7 +891,7 @@ impl Func {
pub(crate) unsafe fn call_unchecked_raw<T>(
store: &mut StoreContextMut<'_, T>,
anyfunc: NonNull<VMCallerCheckedAnyfunc>,
anyfunc: NonNull<VMCallerCheckedFuncRef>,
trampoline: VMTrampoline,
params_and_returns: *mut ValRaw,
) -> Result<()> {
@@ -1066,7 +1066,7 @@ impl Func {
pub(crate) fn caller_checked_anyfunc(
&self,
store: &StoreOpaque,
) -> NonNull<VMCallerCheckedAnyfunc> {
) -> NonNull<VMCallerCheckedFuncRef> {
store.store_data()[self.0].export().anyfunc
}

View File

@@ -6,7 +6,7 @@ use std::marker;
use std::mem::{self, MaybeUninit};
use std::ptr;
use wasmtime_runtime::{
VMCallerCheckedAnyfunc, VMContext, VMFunctionBody, VMOpaqueContext, VMSharedSignatureIndex,
VMCallerCheckedFuncRef, VMContext, VMFunctionBody, VMOpaqueContext, VMSharedSignatureIndex,
};
/// A statically typed WebAssembly function.
@@ -130,7 +130,7 @@ where
pub(crate) unsafe fn call_raw<T>(
store: &mut StoreContextMut<'_, T>,
func: ptr::NonNull<VMCallerCheckedAnyfunc>,
func: ptr::NonNull<VMCallerCheckedFuncRef>,
params: Params,
) -> Result<Results> {
// double-check that params/results match for this function's type in
@@ -409,7 +409,7 @@ unsafe impl WasmTy for Option<ExternRef> {
}
unsafe impl WasmTy for Option<Func> {
type Abi = *mut wasmtime_runtime::VMCallerCheckedAnyfunc;
type Abi = *mut wasmtime_runtime::VMCallerCheckedFuncRef;
#[inline]
fn valtype() -> ValType {

View File

@@ -11,7 +11,7 @@ use std::{
sync::{Arc, RwLock},
};
use wasmtime_jit::CodeMemory;
use wasmtime_runtime::{ModuleInfo, VMCallerCheckedAnyfunc, VMTrampoline};
use wasmtime_runtime::{ModuleInfo, VMCallerCheckedFuncRef, VMTrampoline};
/// Used for registering modules with a store.
///
@@ -125,7 +125,7 @@ impl ModuleRegistry {
}
/// Looks up a trampoline from an anyfunc.
pub fn lookup_trampoline(&self, anyfunc: &VMCallerCheckedAnyfunc) -> Option<VMTrampoline> {
pub fn lookup_trampoline(&self, anyfunc: &VMCallerCheckedFuncRef) -> Option<VMTrampoline> {
let (code, _offset) = self.code(anyfunc.func_ptr.as_ptr() as usize)?;
code.code.signatures().trampoline(anyfunc.type_index)
}

View File

@@ -95,7 +95,7 @@ use std::sync::Arc;
use std::task::{Context, Poll};
use wasmtime_runtime::{
InstanceAllocationRequest, InstanceAllocator, InstanceHandle, ModuleInfo,
OnDemandInstanceAllocator, SignalHandler, StorePtr, VMCallerCheckedAnyfunc, VMContext,
OnDemandInstanceAllocator, SignalHandler, StorePtr, VMCallerCheckedFuncRef, VMContext,
VMExternRef, VMExternRefActivationsTable, VMRuntimeLimits, VMSharedSignatureIndex,
VMTrampoline,
};
@@ -1263,7 +1263,7 @@ impl StoreOpaque {
/// `self.host_trampolines` we lazily populate `self.host_trampolines` by
/// iterating over `self.store_data().funcs`, inserting trampolines as we
/// go. If we find the right trampoline then it's returned.
pub fn lookup_trampoline(&mut self, anyfunc: &VMCallerCheckedAnyfunc) -> VMTrampoline {
pub fn lookup_trampoline(&mut self, anyfunc: &VMCallerCheckedFuncRef) -> VMTrampoline {
// First try to see if the `anyfunc` belongs to any module. Each module
// has its own map of trampolines-per-type-index and the code pointer in
// the `anyfunc` will enable us to quickly find a module.