-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Mark a handful of functions on the calling-into-Wasm path as #[inline]
#10643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,3 +30,4 @@ tests/all/pulley_provenance_test.cwasm | |
| /artifacts | ||
| testcase*.wat | ||
| testcase*.wasm | ||
| perf.data* | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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] | ||
| 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. | ||
|
|
@@ -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] | ||
|
||
| fn call_impl_check_args<T>( | ||
| &self, | ||
| store: &mut StoreContextMut<'_, T>, | ||
|
|
@@ -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>, | ||
|
|
@@ -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 { | ||
|
|
@@ -1751,6 +1755,7 @@ impl EntryStoreContext { | |
| } | ||
|
|
||
| impl Drop for EntryStoreContext { | ||
| #[inline] | ||
| fn drop(&mut self) { | ||
| self.exit_wasm(); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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!( | ||
|
|
@@ -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] | ||
|
||
| pub(crate) unsafe fn call_raw<T>( | ||
| store: &mut StoreContextMut<'_, T>, | ||
| ty: &FuncType, | ||
|
|
||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.