Skip to content

Commit

Permalink
Handle traced modules in compute_chunk_group_info
Browse files Browse the repository at this point in the history
  • Loading branch information
wbinnssmith authored and sokra committed Jan 16, 2025
1 parent 466bf6e commit 95f402a
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,13 @@ pub async fn compute_chunk_group_info(graph: &ModuleGraph) -> Result<Vc<ChunkGro
// ----

let mut visitor =
async |parent_info: Option<(&'_ SingleModuleGraphModuleNode, &'_ ChunkingType)>,
node: &'_ SingleModuleGraphModuleNode,
module_chunk_groups: &mut HashMap<
|parent_info: Option<(&'_ SingleModuleGraphModuleNode, &'_ ChunkingType)>,
node: &'_ SingleModuleGraphModuleNode,
module_chunk_groups: &mut HashMap<
ResolvedVc<Box<dyn Module>>,
RoaringBitmapWrapper,
>|
-> Result<GraphTraversalAction> {
-> GraphTraversalAction {
enum ChunkGroupInheritance<It: Iterator<Item = ChunkGroup>> {
Inherit(ResolvedVc<Box<dyn Module>>),
ChunkGroup(It),
Expand Down Expand Up @@ -218,15 +218,18 @@ pub async fn compute_chunk_group_info(graph: &ModuleGraph) -> Result<Vc<ChunkGro
},
),
)),
ChunkingType::Traced => unreachable!(),
ChunkingType::Traced => {
// Traced modules are not placed in chunk groups
return GraphTraversalAction::Skip;
}
}
} else {
ChunkGroupInheritance::ChunkGroup(Either::Left(std::iter::once(
ChunkGroup::Entry(node.module),
)))
};

Ok(match chunk_groups {
match chunk_groups {
ChunkGroupInheritance::ChunkGroup(chunk_groups) => {
// Start of a new chunk group, don't inherit anything from parent
let chunk_group_ids = chunk_groups.map(|chunk_group| {
Expand Down Expand Up @@ -287,7 +290,7 @@ pub async fn compute_chunk_group_info(graph: &ModuleGraph) -> Result<Vc<ChunkGro
}
}
}
})
}
};

let mut visit_count = 0usize;
Expand All @@ -307,8 +310,7 @@ pub async fn compute_chunk_group_info(graph: &ModuleGraph) -> Result<Vc<ChunkGro
None,
get_node!(graphs, entry_node.node),
&mut module_chunk_groups,
)
.await?;
);
}
while let Some(NodeWithPriority { node, .. }) = queue.pop() {
queue_set.remove(&node);
Expand All @@ -329,8 +331,7 @@ pub async fn compute_chunk_group_info(graph: &ModuleGraph) -> Result<Vc<ChunkGro
Some((node_weight, edge_weight)),
succ_weight,
&mut module_chunk_groups,
)
.await?;
);

if action == GraphTraversalAction::Continue && queue_set.insert(succ) {
queue.push(NodeWithPriority {
Expand Down

0 comments on commit 95f402a

Please sign in to comment.