]> git.lizzy.rs Git - rust.git/commitdiff
Remove try_mark_green_and_read.
authorCamille GILLOT <gillot.camille@gmail.com>
Sun, 30 May 2021 08:48:48 +0000 (10:48 +0200)
committerCamille GILLOT <gillot.camille@gmail.com>
Sun, 22 Aug 2021 18:23:29 +0000 (20:23 +0200)
compiler/rustc_query_system/src/dep_graph/graph.rs
compiler/rustc_query_system/src/query/plumbing.rs

index 21f9d51e7af309ed249867d19aa30d17bfd7ff49..16fca7a3cd958f0171d8ffa1042fbc9a6a72f4a5 100644 (file)
@@ -499,22 +499,11 @@ fn node_color(&self, dep_node: &DepNode<K>) -> Option<DepNodeColor> {
         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
     /// 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.
-    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>>(
         &self,
         tcx: Ctxt,
index 86097042da016ff28c7d2f25ddf0ab01f1466f40..9f89f6f530910ec5ce26ba1fd79f921b6fe0aeb1 100644 (file)
@@ -523,7 +523,8 @@ fn try_load_from_disk_and_cache_in_memory<CTX, K, V>(
     // We must ensure that this is handled correctly.
 
     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));
 
@@ -725,9 +726,10 @@ fn ensure_must_run<CTX, K, V>(tcx: CTX, key: &K, query: &QueryVtable<CTX, K, V>)
 
     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 => {
-            // 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.
             // 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
@@ -736,6 +738,7 @@ fn ensure_must_run<CTX, K, V>(tcx: CTX, key: &K, query: &QueryVtable<CTX, K, V>)
             true
         }
         Some((_, dep_node_index)) => {
+            dep_graph.read_index(dep_node_index);
             tcx.dep_context().profiler().query_cache_hit(dep_node_index.into());
             false
         }