Skip to content

Commit ab5d3fb

Browse files
committed
Add inlining attributes for query system functions
1 parent a049550 commit ab5d3fb

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

compiler/rustc_middle/src/ty/context.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,7 @@ impl<'tcx> TyCtxt<'tcx> {
10111011

10121012
/// Note that this is *untracked* and should only be used within the query
10131013
/// system if the result is otherwise tracked through queries
1014+
#[inline]
10141015
pub fn cstore_untracked(self) -> MappedReadGuard<'tcx, CrateStoreDyn> {
10151016
ReadGuard::map(self.untracked.cstore.read(), |c| &**c)
10161017
}

compiler/rustc_query_system/src/dep_graph/graph.rs

+5
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ impl<K: DepKind> DepGraph<K> {
279279
/// `arg` parameter.
280280
///
281281
/// [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/incremental-compilation.html
282+
#[inline(always)]
282283
pub fn with_task<Ctxt: HasDepContext<DepKind = K>, A: Debug, R>(
283284
&self,
284285
key: DepNode<K>,
@@ -298,6 +299,7 @@ impl<K: DepKind> DepGraph<K> {
298299
}
299300
}
300301

302+
#[inline(always)]
301303
fn with_task_impl<Ctxt: HasDepContext<DepKind = K>, A: Debug, R>(
302304
&self,
303305
key: DepNode<K>,
@@ -598,6 +600,7 @@ impl<K: DepKind> DepGraph<K> {
598600
self.data.is_some() && self.dep_node_index_of_opt(dep_node).is_some()
599601
}
600602

603+
#[inline]
601604
pub fn prev_fingerprint_of(&self, dep_node: &DepNode<K>) -> Option<Fingerprint> {
602605
self.data.as_ref().unwrap().previous.fingerprint_of(dep_node)
603606
}
@@ -1127,6 +1130,7 @@ impl<K: DepKind> CurrentDepGraph<K> {
11271130

11281131
/// Writes the node to the current dep-graph and allocates a `DepNodeIndex` for it.
11291132
/// Assumes that this is a node that has no equivalent in the previous dep-graph.
1133+
#[inline(always)]
11301134
fn intern_new_node(
11311135
&self,
11321136
profiler: &SelfProfilerRef,
@@ -1365,6 +1369,7 @@ impl DepNodeColorMap {
13651369
}
13661370
}
13671371

1372+
#[inline]
13681373
fn insert(&self, index: SerializedDepNodeIndex, color: DepNodeColor) {
13691374
self.values[index].store(
13701375
match color {

compiler/rustc_query_system/src/query/plumbing.rs

+4
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ where
394394
}
395395
}
396396

397+
#[inline(always)]
397398
fn execute_job<Q, Qcx>(
398399
qcx: Qcx,
399400
key: Q::Key,
@@ -479,6 +480,7 @@ where
479480
(result, dep_node_index)
480481
}
481482

483+
#[inline(always)]
482484
fn try_load_from_disk_and_cache_in_memory<Q, Qcx>(
483485
qcx: Qcx,
484486
key: &Q::Key,
@@ -569,6 +571,7 @@ where
569571
Some((result, dep_node_index))
570572
}
571573

574+
#[inline]
572575
#[instrument(skip(tcx, result, hash_result), level = "debug")]
573576
pub(crate) fn incremental_verify_ich<Tcx, V: Debug>(
574577
tcx: Tcx,
@@ -723,6 +726,7 @@ pub enum QueryMode {
723726
Ensure,
724727
}
725728

729+
#[inline(always)]
726730
pub fn get_query<Q, Qcx, D>(qcx: Qcx, span: Span, key: Q::Key, mode: QueryMode) -> Option<Q::Value>
727731
where
728732
D: DepKind,

0 commit comments

Comments
 (0)