wasmtime: Add criterion micro benchmarks for traps (#4398)

* wasmtime: Rename host->wasm trampolines

As we introduce new types of trampolines, having clear names for our existing
trampolines will be helpful.

* Fix typo in docs for `VMCOMPONENT_MAGIC`

* wasmtime: Add criterion micro benchmarks for traps
This commit is contained in:
Nick Fitzgerald
2022-07-06 17:20:40 -07:00
committed by GitHub
parent 8629cbc6a4
commit 7000b0a4cf
4 changed files with 181 additions and 3 deletions

View File

@@ -20,7 +20,7 @@ use crate::PtrSize;
/// Equivalent of `VMCONTEXT_MAGIC` except for components.
///
/// This is stored at the start of all `VMComponentContext` structures adn
/// This is stored at the start of all `VMComponentContext` structures and
/// double-checked on `VMComponentContext::from_opaque`.
pub const VMCOMPONENT_MAGIC: u32 = u32::from_le_bytes(*b"comp");

View File

@@ -1940,7 +1940,7 @@ macro_rules! impl_into_func {
/// It reads the arguments out of the incoming `args` array,
/// calls the given function pointer, and then stores the result
/// back into the `args` array.
unsafe extern "C" fn host_trampoline<$($args,)* R>(
unsafe extern "C" fn host_to_wasm_trampoline<$($args,)* R>(
callee_vmctx: *mut VMOpaqueContext,
caller_vmctx: *mut VMContext,
ptr: *const VMFunctionBody,
@@ -1977,7 +1977,7 @@ macro_rules! impl_into_func {
let shared_signature_id = engine.signatures().register(ty.as_wasm_func_type());
let trampoline = host_trampoline::<$($args,)* R>;
let trampoline = host_to_wasm_trampoline::<$($args,)* R>;
let instance = unsafe {