Merge pull request #2305 from alexcrichton/no-arc
Don't store `Arc<VMInterrupts>` in instances
This commit is contained in:
@@ -68,10 +68,6 @@ pub(crate) struct Instance {
|
||||
/// Hosts can store arbitrary per-instance information here.
|
||||
host_state: Box<dyn Any>,
|
||||
|
||||
/// Externally allocated data indicating how this instance will be
|
||||
/// interrupted.
|
||||
pub(crate) interrupts: Arc<VMInterrupts>,
|
||||
|
||||
/// Additional context used by compiled wasm code. This field is last, and
|
||||
/// represents a dynamically-sized array that extends beyond the nominal
|
||||
/// end of the struct (similar to a flexible array member).
|
||||
@@ -824,7 +820,7 @@ impl InstanceHandle {
|
||||
mem_creator: Option<&dyn RuntimeMemoryCreator>,
|
||||
vmshared_signatures: BoxedSlice<SignatureIndex, VMSharedSignatureIndex>,
|
||||
host_state: Box<dyn Any>,
|
||||
interrupts: Arc<VMInterrupts>,
|
||||
interrupts: *const VMInterrupts,
|
||||
externref_activations_table: *mut VMExternRefActivationsTable,
|
||||
stack_map_registry: *mut StackMapRegistry,
|
||||
) -> Result<Self, InstantiationError> {
|
||||
@@ -863,7 +859,6 @@ impl InstanceHandle {
|
||||
passive_data,
|
||||
trampolines,
|
||||
host_state,
|
||||
interrupts,
|
||||
vmctx: VMContext {},
|
||||
};
|
||||
let layout = instance.alloc_layout();
|
||||
@@ -930,7 +925,7 @@ impl InstanceHandle {
|
||||
instance.builtin_functions_ptr() as *mut VMBuiltinFunctionsArray,
|
||||
VMBuiltinFunctionsArray::initialized(),
|
||||
);
|
||||
*instance.interrupts() = &*instance.interrupts;
|
||||
*instance.interrupts() = interrupts;
|
||||
*instance.externref_activations_table() = externref_activations_table;
|
||||
*instance.stack_map_registry() = stack_map_registry;
|
||||
|
||||
|
||||
@@ -453,8 +453,8 @@ impl<'a> CallThreadState<'a> {
|
||||
UnwindReason::JitTrap { backtrace, pc } => {
|
||||
debug_assert_eq!(ret, 0);
|
||||
let maybe_interrupted = unsafe {
|
||||
(*self.vmctx).instance().interrupts.stack_limit.load(SeqCst)
|
||||
== wasmtime_environ::INTERRUPTED
|
||||
let interrupts = (*self.vmctx).instance().interrupts();
|
||||
(**interrupts).stack_limit.load(SeqCst) == wasmtime_environ::INTERRUPTED
|
||||
};
|
||||
Err(Trap::Jit {
|
||||
pc,
|
||||
|
||||
Reference in New Issue
Block a user