From f03e9ce352d24a776f04aff899a3eb520fcc75b3 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Fri, 6 Mar 2020 23:08:49 +0100 Subject: [PATCH] Monomorphise start_incremental_query. --- src/librustc/ty/query/plumbing.rs | 50 ++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index f9c902088fdd4..9e5937b85b3bb 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -559,24 +559,8 @@ impl<'tcx> TyCtxt<'tcx> { let dep_node = Q::to_dep_node(self, &key); if !Q::EVAL_ALWAYS { - // The diagnostics for this query will be - // promoted to the current session during - // `try_mark_green()`, so we can ignore them here. - let loaded = self.start_query(job.id, None, |tcx| { - let marked = tcx.dep_graph.try_mark_green_and_read(tcx, &dep_node); - marked.map(|(prev_dep_node_index, dep_node_index)| { - ( - tcx.load_from_disk_and_cache_in_memory( - key.clone(), - prev_dep_node_index, - dep_node_index, - &dep_node, - &Q::reify(), - ), - dep_node_index, - ) - }) - }); + let loaded = self.start_incremental_query(key.clone(), &dep_node, job.id, &Q::reify()); + if let Some((result, dep_node_index)) = loaded { job.complete(&result, dep_node_index); return result; @@ -616,6 +600,36 @@ impl<'tcx> TyCtxt<'tcx> { return (result, dep_node_index); } + #[inline(always)] + fn start_incremental_query( + self, + key: K, + dep_node: &DepNode, + job_id: QueryJobId, + query: &QueryVtable<'tcx, K, V>, + ) -> Option<(V, DepNodeIndex)> { + assert!(!query.eval_always); + + // The diagnostics for this query will be + // promoted to the current session during + // `try_mark_green()`, so we can ignore them here. + self.start_query(job_id, None, |tcx| { + let marked = tcx.dep_graph.try_mark_green_and_read(tcx, &dep_node); + marked.map(|(prev_dep_node_index, dep_node_index)| { + ( + tcx.load_from_disk_and_cache_in_memory( + key, + prev_dep_node_index, + dep_node_index, + &dep_node, + query, + ), + dep_node_index, + ) + }) + }) + } + fn load_from_disk_and_cache_in_memory( self, key: K,