Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit f43477d

Browse files
committed
Make ComponentInstance::store no-optional again
No longer needed for it to be an `Option`.
1 parent 7429925 commit f43477d

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

crates/wasmtime/src/runtime/vm/component.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pub struct ComponentInstance {
109109
imports: Arc<PrimaryMap<RuntimeImportIndex, RuntimeImport>>,
110110

111111
/// Self-pointer back to `Store<T>` and its functions.
112-
store: Option<VMStoreRawPtr>,
112+
store: VMStoreRawPtr,
113113

114114
/// Cached ABI return value from the last-invoked function call along with
115115
/// the function index that was invoked.
@@ -297,8 +297,8 @@ impl ComponentInstance {
297297
),
298298
component: component.clone(),
299299
resource_types,
300-
store: Some(VMStoreRawPtr(store)),
301300
imports: imports.clone(),
301+
store: VMStoreRawPtr(store),
302302
post_return_arg: None,
303303
vmctx: VMComponentContext {
304304
_marker: marker::PhantomPinned,
@@ -344,10 +344,8 @@ impl ComponentInstance {
344344
}
345345

346346
/// Returns the store that this component was created with.
347-
///
348-
/// This will panic if this instance has been removed from its store.
349347
pub fn store(&self) -> *mut dyn VMStore {
350-
self.store.unwrap().0.as_ptr()
348+
self.store.0.as_ptr()
351349
}
352350

353351
/// Returns the runtime memory definition corresponding to the index of the
@@ -600,7 +598,7 @@ impl ComponentInstance {
600598
*self.vmctx_plus_offset_mut(self.offsets.builtins()) =
601599
VmPtr::from(NonNull::from(&libcalls::VMComponentBuiltins::INIT));
602600
*self.vmctx_plus_offset_mut(self.offsets.vm_store_context()) =
603-
VmPtr::from(self.store.unwrap().0.as_ref().vm_store_context_ptr());
601+
VmPtr::from(self.store.0.as_ref().vm_store_context_ptr());
604602

605603
for i in 0..self.offsets.num_runtime_component_instances {
606604
let i = RuntimeComponentInstanceIndex::from_u32(i);

0 commit comments

Comments
 (0)