Fix an issue in adapter module partitioning (#4622)
When an adapter module depends on a particular core wasm instance this means that it actually depends on not only that instance but all prior core wasm instances as well. This is because core wasm instances must be instantiated in the specified order within a component and that cannot change depending on the dataflow between adapters. This commit fixes a possible panic from linearizing the component dfg where an adapter module tried to depend on an instance that hadn't been instantiated yet because the ordering dependency between core wasm instances hadn't been modeled.
This commit is contained in:
@@ -352,6 +352,7 @@ enum RuntimeInstance {
|
||||
|
||||
impl LinearizeDfg<'_> {
|
||||
fn instantiate(&mut self, instance: InstanceId, args: &Instance) {
|
||||
log::trace!("creating instance {instance:?}");
|
||||
let instantiation = match args {
|
||||
Instance::Static(index, args) => InstantiateModule::Static(
|
||||
*index,
|
||||
@@ -500,8 +501,10 @@ impl LinearizeDfg<'_> {
|
||||
where
|
||||
T: Clone,
|
||||
{
|
||||
let instance = export.instance;
|
||||
log::trace!("referencing export of {instance:?}");
|
||||
info::CoreExport {
|
||||
instance: self.runtime_instances[&RuntimeInstance::Normal(export.instance)],
|
||||
instance: self.runtime_instances[&RuntimeInstance::Normal(instance)],
|
||||
item: export.item.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user