pooling needs the store earlier
This commit is contained in:
@@ -92,12 +92,10 @@ impl StorePtr {
|
||||
pub fn new(ptr: *mut dyn Store) -> Self {
|
||||
Self(Some(ptr))
|
||||
}
|
||||
/*
|
||||
/// Update an empty StorePtr to point to a Store.
|
||||
pub fn set(&mut self, ptr: *mut dyn Store) {
|
||||
self.0 = Some(ptr)
|
||||
/// The raw contents of this struct
|
||||
pub fn as_raw(&self) -> Option<*mut dyn Store> {
|
||||
self.0.clone()
|
||||
}
|
||||
*/
|
||||
/// Use the StorePtr as a mut ref to the Store.
|
||||
// XXX should this be an unsafe fn? is it always safe at a use site?
|
||||
pub(crate) fn get(&mut self) -> Option<&mut dyn Store> {
|
||||
@@ -461,7 +459,7 @@ fn initialize_instance(
|
||||
}
|
||||
|
||||
unsafe fn initialize_vmcontext(instance: &mut Instance, req: InstanceAllocationRequest) {
|
||||
if let Some(store) = req.store.0 {
|
||||
if let Some(store) = req.store.as_raw() {
|
||||
*instance.interrupts() = (*store).vminterrupts();
|
||||
*instance.externref_activations_table() = (*store).externref_activations_table().0;
|
||||
instance.set_store(store);
|
||||
|
||||
@@ -384,6 +384,12 @@ impl InstancePool {
|
||||
instance.host_state = std::mem::replace(&mut req.host_state, Box::new(()));
|
||||
instance.wasm_data = &*req.wasm_data;
|
||||
|
||||
// set_instance_memories and _tables will need the store before we can completely
|
||||
// initialize the vmcontext.
|
||||
if let Some(store) = req.store.as_raw() {
|
||||
instance.set_store(store);
|
||||
}
|
||||
|
||||
Self::set_instance_memories(
|
||||
instance,
|
||||
self.memories.get(index),
|
||||
|
||||
Reference in New Issue
Block a user