From ab5d3fbe7db281ca48a7b88f90c81bf5e795564c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Thu, 23 Feb 2023 01:14:48 +0100 Subject: [PATCH] Add inlining attributes for query system functions --- compiler/rustc_middle/src/ty/context.rs | 1 + compiler/rustc_query_system/src/dep_graph/graph.rs | 5 +++++ compiler/rustc_query_system/src/query/plumbing.rs | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 796daa7646f..2c0b3b690cf 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -1011,6 +1011,7 @@ impl<'tcx> TyCtxt<'tcx> { /// Note that this is *untracked* and should only be used within the query /// system if the result is otherwise tracked through queries + #[inline] pub fn cstore_untracked(self) -> MappedReadGuard<'tcx, CrateStoreDyn> { ReadGuard::map(self.untracked.cstore.read(), |c| &**c) } diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs index 35fa932e0f1..59e0c359745 100644 --- a/compiler/rustc_query_system/src/dep_graph/graph.rs +++ b/compiler/rustc_query_system/src/dep_graph/graph.rs @@ -279,6 +279,7 @@ impl DepGraph { /// `arg` parameter. /// /// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/incremental-compilation.html + #[inline(always)] pub fn with_task, A: Debug, R>( &self, key: DepNode, @@ -298,6 +299,7 @@ impl DepGraph { } } + #[inline(always)] fn with_task_impl, A: Debug, R>( &self, key: DepNode, @@ -598,6 +600,7 @@ impl DepGraph { self.data.is_some() && self.dep_node_index_of_opt(dep_node).is_some() } + #[inline] pub fn prev_fingerprint_of(&self, dep_node: &DepNode) -> Option { self.data.as_ref().unwrap().previous.fingerprint_of(dep_node) } @@ -1127,6 +1130,7 @@ impl CurrentDepGraph { /// Writes the node to the current dep-graph and allocates a `DepNodeIndex` for it. /// Assumes that this is a node that has no equivalent in the previous dep-graph. + #[inline(always)] fn intern_new_node( &self, profiler: &SelfProfilerRef, @@ -1365,6 +1369,7 @@ impl DepNodeColorMap { } } + #[inline] fn insert(&self, index: SerializedDepNodeIndex, color: DepNodeColor) { self.values[index].store( match color { diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs index 148d7f09f51..fa877ceaf23 100644 --- a/compiler/rustc_query_system/src/query/plumbing.rs +++ b/compiler/rustc_query_system/src/query/plumbing.rs @@ -394,6 +394,7 @@ where } } +#[inline(always)] fn execute_job( qcx: Qcx, key: Q::Key, @@ -479,6 +480,7 @@ where (result, dep_node_index) } +#[inline(always)] fn try_load_from_disk_and_cache_in_memory( qcx: Qcx, key: &Q::Key, @@ -569,6 +571,7 @@ where Some((result, dep_node_index)) } +#[inline] #[instrument(skip(tcx, result, hash_result), level = "debug")] pub(crate) fn incremental_verify_ich( tcx: Tcx, @@ -723,6 +726,7 @@ pub enum QueryMode { Ensure, } +#[inline(always)] pub fn get_query(qcx: Qcx, span: Span, key: Q::Key, mode: QueryMode) -> Option where D: DepKind,