Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 264b63a

Browse files
committedDec 7, 2018
Auto merge of #56509 - Zoxc:query-perf, r=<try>
[WIP] Tweak query code for performance r? @michaelwoerister
2 parents fc84f5f + f0c9eec commit 264b63a

File tree

26 files changed

+1030
-620
lines changed

26 files changed

+1030
-620
lines changed
 

‎Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -1975,6 +1975,7 @@ dependencies = [
19751975
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
19761976
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
19771977
"polonius-engine 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
1978+
"rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
19781979
"rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
19791980
"rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
19801981
"rustc_apfloat 0.0.0",

‎src/librustc/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ log = { version = "0.4", features = ["release_max_level_info", "std"] }
2020
polonius-engine = "0.5.0"
2121
rustc-rayon = "0.1.1"
2222
rustc-rayon-core = "0.1.1"
23+
rustc-hash = "1.0.1"
2324
rustc_apfloat = { path = "../librustc_apfloat" }
2425
rustc_target = { path = "../librustc_target" }
2526
rustc_data_structures = { path = "../librustc_data_structures" }

‎src/librustc/dep_graph/dep_node.rs

+23-12
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ macro_rules! define_dep_nodes {
162162
}
163163
}
164164

165-
#[inline]
165+
// FIXME: Make `is_anon`, `is_input`, `is_eval_always` and `has_params` properties
166+
// of queries
167+
#[inline(always)]
166168
pub fn is_anon(&self) -> bool {
167169
match *self {
168170
$(
@@ -171,16 +173,20 @@ macro_rules! define_dep_nodes {
171173
}
172174
}
173175

174-
#[inline]
175-
pub fn is_input(&self) -> bool {
176+
#[inline(always)]
177+
pub fn is_input_inlined(&self) -> bool {
176178
match *self {
177179
$(
178180
DepKind :: $variant => { contains_input_attr!($($attr),*) }
179181
)*
180182
}
181183
}
182184

183-
#[inline]
185+
pub fn is_input(&self) -> bool {
186+
self.is_input_inlined()
187+
}
188+
189+
#[inline(always)]
184190
pub fn is_eval_always(&self) -> bool {
185191
match *self {
186192
$(
@@ -190,8 +196,8 @@ macro_rules! define_dep_nodes {
190196
}
191197

192198
#[allow(unreachable_code)]
193-
#[inline]
194-
pub fn has_params(&self) -> bool {
199+
#[inline(always)]
200+
pub fn has_params_inlined(&self) -> bool {
195201
match *self {
196202
$(
197203
DepKind :: $variant => {
@@ -212,6 +218,10 @@ macro_rules! define_dep_nodes {
212218
)*
213219
}
214220
}
221+
222+
pub fn has_params(&self) -> bool {
223+
self.has_params_inlined()
224+
}
215225
}
216226

217227
pub enum DepConstructor<$tcx> {
@@ -230,7 +240,8 @@ macro_rules! define_dep_nodes {
230240

231241
impl DepNode {
232242
#[allow(unreachable_code, non_snake_case)]
233-
pub fn new<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
243+
#[inline(always)]
244+
pub fn new_inlined<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
234245
dep: DepConstructor<'gcx>)
235246
-> DepNode
236247
where 'gcx: 'a + 'tcx,
@@ -299,7 +310,7 @@ macro_rules! define_dep_nodes {
299310
/// Construct a DepNode from the given DepKind and DefPathHash. This
300311
/// method will assert that the given DepKind actually requires a
301312
/// single DefId/DefPathHash parameter.
302-
#[inline]
313+
#[inline(always)]
303314
pub fn from_def_path_hash(kind: DepKind,
304315
def_path_hash: DefPathHash)
305316
-> DepNode {
@@ -313,9 +324,9 @@ macro_rules! define_dep_nodes {
313324
/// Create a new, parameterless DepNode. This method will assert
314325
/// that the DepNode corresponding to the given DepKind actually
315326
/// does not require any parameters.
316-
#[inline]
327+
#[inline(always)]
317328
pub fn new_no_params(kind: DepKind) -> DepNode {
318-
assert!(!kind.has_params());
329+
assert!(!kind.has_params_inlined());
319330
DepNode {
320331
kind,
321332
hash: Fingerprint::ZERO,
@@ -418,14 +429,14 @@ impl fmt::Debug for DepNode {
418429

419430

420431
impl DefPathHash {
421-
#[inline]
432+
#[inline(always)]
422433
pub fn to_dep_node(self, kind: DepKind) -> DepNode {
423434
DepNode::from_def_path_hash(kind, self)
424435
}
425436
}
426437

427438
impl DefId {
428-
#[inline]
439+
#[inline(always)]
429440
pub fn to_dep_node(self, tcx: TyCtxt<'_, '_, '_>, kind: DepKind) -> DepNode {
430441
DepNode::from_def_path_hash(kind, tcx.def_path_hash(self))
431442
}

0 commit comments

Comments
 (0)
Please sign in to comment.