Don't store Arc<VMInterrupts> in instances

Similar to other data structures owned by the `Store` there's no need
for `Instance` to have a strong `Arc` reference, instead it's sufficient
for `Store` to have the owning reference.
This commit is contained in:
Alex Crichton
2020-10-20 22:23:35 -07:00
parent 76998f0404
commit 04e85b044e
6 changed files with 9 additions and 14 deletions

View File

@@ -22,7 +22,7 @@ fn instantiate(
imports,
&mut store.signatures_mut(),
config.memory_creator.as_ref().map(|a| a as _),
store.interrupts().clone(),
store.interrupts(),
host,
store.externref_activations_table() as *const VMExternRefActivationsTable as *mut _,
store.stack_map_registry() as *const StackMapRegistry as *mut _,

View File

@@ -1030,7 +1030,7 @@ impl Store {
self.inner.signal_handler.borrow_mut()
}
pub(crate) fn interrupts(&self) -> &Arc<VMInterrupts> {
pub(crate) fn interrupts(&self) -> &VMInterrupts {
&self.inner.interrupts
}
@@ -1128,7 +1128,7 @@ impl Store {
pub fn interrupt_handle(&self) -> Result<InterruptHandle> {
if self.engine().config().tunables.interruptable {
Ok(InterruptHandle {
interrupts: self.interrupts().clone(),
interrupts: self.inner.interrupts.clone(),
})
} else {
bail!("interrupts aren't enabled for this `Store`")

View File

@@ -42,7 +42,7 @@ pub(crate) fn create_handle(
store.memory_creator(),
signatures.into_boxed_slice(),
state,
store.interrupts().clone(),
store.interrupts(),
store.externref_activations_table() as *const VMExternRefActivationsTable as *mut _,
store.stack_map_registry() as *const StackMapRegistry as *mut _,
)?;