Skip to content

Commit 99a9d68

Browse files
committed
Auto merge of #51538 - nikomatsakis:nll-perf-examination, r=eddyb
convert NLL ops to caches This is a extension of <#51460>. It uses a lot more caching than we used to do. This caching is not yet as efficient as it could be, but I'm curious to see the current perf results. This is the high-level idea: in the MIR type checker, use [canonicalized queries](https://rust-lang-nursery.github.io/rustc-guide/traits/canonical-queries.html) for all the major operations. This is helpful because the MIR type check is operating in a context where all types are fully known (mostly, anyway) but regions are completely renumbered. This means we often wind up with duplicate queries like `Foo<'1, '2> :Bar` and `Foo<'3, '4>: Bar`. Canonicalized queries let us re-use the results. By the final commit in this PR, we can essentially just "read off" the resulting region relations and add them to the NLL type check.
2 parents 266afeb + 1523de3 commit 99a9d68

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3139
-1767
lines changed

Diff for: src/librustc/dep_graph/dep_node.rs

+13-3
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
7070
use std::fmt;
7171
use std::hash::Hash;
7272
use syntax_pos::symbol::InternedString;
73-
use traits::query::{CanonicalProjectionGoal,
74-
CanonicalTyGoal, CanonicalPredicateGoal};
75-
use ty::{TyCtxt, Instance, InstanceDef, ParamEnv, ParamEnvAnd, PolyTraitRef, Ty};
73+
use traits::query::{
74+
CanonicalProjectionGoal, CanonicalTyGoal, CanonicalTypeOpEqGoal, CanonicalTypeOpSubtypeGoal,
75+
CanonicalPredicateGoal, CanonicalTypeOpProvePredicateGoal, CanonicalTypeOpNormalizeGoal,
76+
};
77+
use ty::{TyCtxt, FnSig, Instance, InstanceDef,
78+
ParamEnv, ParamEnvAnd, Predicate, PolyFnSig, PolyTraitRef, Ty};
7679
use ty::subst::Substs;
7780

7881
// erase!() just makes tokens go away. It's used to specify which macro argument
@@ -647,6 +650,13 @@ define_dep_nodes!( <'tcx>
647650
[] NormalizeTyAfterErasingRegions(ParamEnvAnd<'tcx, Ty<'tcx>>),
648651
[] DropckOutlives(CanonicalTyGoal<'tcx>),
649652
[] EvaluateObligation(CanonicalPredicateGoal<'tcx>),
653+
[] TypeOpEq(CanonicalTypeOpEqGoal<'tcx>),
654+
[] TypeOpSubtype(CanonicalTypeOpSubtypeGoal<'tcx>),
655+
[] TypeOpProvePredicate(CanonicalTypeOpProvePredicateGoal<'tcx>),
656+
[] TypeOpNormalizeTy(CanonicalTypeOpNormalizeGoal<'tcx, Ty<'tcx>>),
657+
[] TypeOpNormalizePredicate(CanonicalTypeOpNormalizeGoal<'tcx, Predicate<'tcx>>),
658+
[] TypeOpNormalizePolyFnSig(CanonicalTypeOpNormalizeGoal<'tcx, PolyFnSig<'tcx>>),
659+
[] TypeOpNormalizeFnSig(CanonicalTypeOpNormalizeGoal<'tcx, FnSig<'tcx>>),
650660

651661
[] SubstituteNormalizeAndTestPredicates { key: (DefId, &'tcx Substs<'tcx>) },
652662

0 commit comments

Comments
 (0)