Skip to content
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

Add the ability to cache typechecking an instance #2962

Merged
merged 2 commits into from
Jun 3, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 5 additions & 1 deletion crates/wasmtime/src/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ impl Func {
/// initiates a panic. Also panics if `store` does not own this function.
pub fn call(&self, mut store: impl AsContextMut, params: &[Val]) -> Result<Box<[Val]>> {
assert!(
!cfg!(feature = "async") || !store.as_context().async_support(),
!store.as_context().async_support(),
"must use `call_async` when async support is enabled on the config",
);
let my_ty = self.ty(&store);
Expand Down Expand Up @@ -1894,6 +1894,10 @@ impl HostFunc {
let idx = self.export.anyfunc.as_ref().type_index;
store.register_host_trampoline(idx, self.trampoline);
}

pub(crate) fn sig_index(&self) -> VMSharedSignatureIndex {
unsafe { self.export.anyfunc.as_ref().type_index }
}
}

impl Drop for HostFunc {
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmtime/src/func/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ where
pub fn call(&self, mut store: impl AsContextMut, params: Params) -> Result<Results, Trap> {
let mut store = store.as_context_mut().opaque();
assert!(
!cfg!(feature = "async") || !store.async_support(),
!store.async_support(),
"must use `call_async` with async stores"
);
unsafe { self._call(&mut store, params) }
Expand Down
Loading