Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ tests/all/pulley_provenance_test.cwasm
/artifacts
testcase*.wat
testcase*.wasm
perf.data*
5 changes: 5 additions & 0 deletions crates/wasmtime/src/runtime/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,7 @@ impl Func {
/// `StoreOpaque` while the `FuncType` is also being used (from the
/// perspective of the borrow-checker) because otherwise the signature would
/// consider `StoreOpaque` borrowed mutable while `FuncType` is in use.
#[inline]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems related to the dynamic calls case which we don't tend to try to put too much effort into optimizing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was hot in a benchmark that was regressing compared to main; easy to fix; don't see why we wouldn't do this.

fn ty_ref<'a>(&self, store: &'a mut StoreOpaque) -> (&'a FuncType, &'a StoreOpaque) {
// If we haven't loaded our type into the store yet then do so lazily at
// this time.
Expand Down Expand Up @@ -1178,6 +1179,7 @@ impl Func {
/// This must be called just before `call_impl_do_call`.
///
/// Returns whether we need to GC before calling `call_impl_do_call`.
#[inline]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is dealing with a dynamic Val does #[inline] really help much here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one was indeed showing up in profiles.

fn call_impl_check_args<T>(
&self,
store: &mut StoreContextMut<'_, T>,
Expand Down Expand Up @@ -1234,6 +1236,7 @@ impl Func {
/// You must have type checked the arguments by calling
/// `call_impl_check_args` immediately before calling this function. It is
/// only safe to call this function if that one did not return an error.
#[inline]
unsafe fn call_impl_do_call<T>(
&self,
store: &mut StoreContextMut<'_, T>,
Expand Down Expand Up @@ -1737,6 +1740,7 @@ impl EntryStoreContext {
/// function through this type's `Drop` implementation. This ensures that we
/// even restore the values if we unwind the stack (e.g., because we are
/// panicing out of a Wasm execution).
#[inline]
fn exit_wasm(&mut self) {
unsafe {
if let Some(limit) = self.stack_limit {
Expand All @@ -1751,6 +1755,7 @@ impl EntryStoreContext {
}

impl Drop for EntryStoreContext {
#[inline]
fn drop(&mut self) {
self.exit_wasm();
}
Expand Down
2 changes: 2 additions & 0 deletions crates/wasmtime/src/runtime/func/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ where
/// connected to an asynchronous store.
///
/// [`Trap`]: crate::Trap
#[inline]
pub fn call(&self, mut store: impl AsContextMut, params: Params) -> Result<Results> {
let mut store = store.as_context_mut();
assert!(
Expand Down Expand Up @@ -179,6 +180,7 @@ where
///
/// If `Self::need_gc_before_call_raw`, then the caller must have done a GC
/// just before calling this method.
#[inline]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a pretty big function, does inlining this really help that much?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one was also showing up in profiles.

pub(crate) unsafe fn call_raw<T>(
store: &mut StoreContextMut<'_, T>,
ty: &FuncType,
Expand Down
1 change: 1 addition & 0 deletions crates/wasmtime/src/runtime/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2384,6 +2384,7 @@ impl FuncType {
}

#[cfg(feature = "gc")]
#[inline]
pub(crate) fn as_wasm_func_type(&self) -> &WasmFuncType {
self.registered_type.unwrap_func()
}
Expand Down
2 changes: 2 additions & 0 deletions crates/wasmtime/src/runtime/vm/vmcontext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@ impl VMFuncRef {
///
/// Note that the unsafety invariants to maintain here are not currently
/// exhaustively documented.
#[inline]
pub unsafe fn array_call(
&self,
pulley: Option<InterpreterRef<'_>>,
Expand Down Expand Up @@ -867,6 +868,7 @@ impl VMFuncRef {
)
}

#[inline]
unsafe fn array_call_native(
&self,
caller: NonNull<VMOpaqueContext>,
Expand Down