Remove try_mark_green_and_read.
This commit is contained in:
parent
c3bf3969d4
commit
45d6decc19
2 changed files with 8 additions and 16 deletions
|
@ -499,22 +499,11 @@ impl<K: DepKind> DepGraph<K> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try to read a node index for the node dep_node.
|
/// Try to mark a node index for the node dep_node.
|
||||||
|
///
|
||||||
/// A node will have an index, when it's already been marked green, or when we can mark it
|
/// A node will have an index, when it's already been marked green, or when we can mark it
|
||||||
/// green. This function will mark the current task as a reader of the specified node, when
|
/// green. This function will mark the current task as a reader of the specified node, when
|
||||||
/// a node index can be found for that node.
|
/// a node index can be found for that node.
|
||||||
pub fn try_mark_green_and_read<Ctxt: QueryContext<DepKind = K>>(
|
|
||||||
&self,
|
|
||||||
tcx: Ctxt,
|
|
||||||
dep_node: &DepNode<K>,
|
|
||||||
) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> {
|
|
||||||
self.try_mark_green(tcx, dep_node).map(|(prev_index, dep_node_index)| {
|
|
||||||
debug_assert!(self.is_green(&dep_node));
|
|
||||||
self.read_index(dep_node_index);
|
|
||||||
(prev_index, dep_node_index)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn try_mark_green<Ctxt: QueryContext<DepKind = K>>(
|
pub fn try_mark_green<Ctxt: QueryContext<DepKind = K>>(
|
||||||
&self,
|
&self,
|
||||||
tcx: Ctxt,
|
tcx: Ctxt,
|
||||||
|
|
|
@ -523,7 +523,8 @@ where
|
||||||
// We must ensure that this is handled correctly.
|
// We must ensure that this is handled correctly.
|
||||||
|
|
||||||
let (prev_dep_node_index, dep_node_index) =
|
let (prev_dep_node_index, dep_node_index) =
|
||||||
tcx.dep_context().dep_graph().try_mark_green_and_read(tcx, &dep_node)?;
|
tcx.dep_context().dep_graph().try_mark_green(tcx, &dep_node)?;
|
||||||
|
tcx.dep_context().dep_graph().read_index(dep_node_index);
|
||||||
|
|
||||||
debug_assert!(tcx.dep_context().dep_graph().is_green(dep_node));
|
debug_assert!(tcx.dep_context().dep_graph().is_green(dep_node));
|
||||||
|
|
||||||
|
@ -725,9 +726,10 @@ where
|
||||||
|
|
||||||
let dep_node = query.to_dep_node(*tcx.dep_context(), key);
|
let dep_node = query.to_dep_node(*tcx.dep_context(), key);
|
||||||
|
|
||||||
match tcx.dep_context().dep_graph().try_mark_green_and_read(tcx, &dep_node) {
|
let dep_graph = tcx.dep_context().dep_graph();
|
||||||
|
match dep_graph.try_mark_green(tcx, &dep_node) {
|
||||||
None => {
|
None => {
|
||||||
// A None return from `try_mark_green_and_read` means that this is either
|
// A None return from `try_mark_green` means that this is either
|
||||||
// a new dep node or that the dep node has already been marked red.
|
// a new dep node or that the dep node has already been marked red.
|
||||||
// Either way, we can't call `dep_graph.read()` as we don't have the
|
// Either way, we can't call `dep_graph.read()` as we don't have the
|
||||||
// DepNodeIndex. We must invoke the query itself. The performance cost
|
// DepNodeIndex. We must invoke the query itself. The performance cost
|
||||||
|
@ -736,6 +738,7 @@ where
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
Some((_, dep_node_index)) => {
|
Some((_, dep_node_index)) => {
|
||||||
|
dep_graph.read_index(dep_node_index);
|
||||||
tcx.dep_context().profiler().query_cache_hit(dep_node_index.into());
|
tcx.dep_context().profiler().query_cache_hit(dep_node_index.into());
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue