Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the query system to a dedicated crate #70162

Merged
merged 31 commits into from
Mar 28, 2020
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8c1c90b
Make QueryConfig argument a type.
cjgillot Mar 8, 2020
f74fd03
Make QueryAccessor argument a type.
cjgillot Mar 8, 2020
57c3177
Make QueryDescription parameter a type.
cjgillot Mar 8, 2020
c4a451e
Make QueryCache generic on the context.
cjgillot Mar 11, 2020
ee9781c
Make QueryContext a subtrait of DepContext.
cjgillot Mar 18, 2020
2a52436
Generalise QueryJobId.
cjgillot Mar 18, 2020
a51ad88
Decouple from DepKind.
cjgillot Mar 18, 2020
232364a
Generalise QueryLatch.
cjgillot Mar 18, 2020
63087b6
Parametrise by try_collect_active_jobs.
cjgillot Mar 19, 2020
42f0db5
Move HashStable bound to the trait definition.
cjgillot Mar 19, 2020
decfd70
Generalise try_get_cached.
cjgillot Mar 19, 2020
4ac4ccd
Generalise JobOwner::try_start.
cjgillot Mar 19, 2020
27e8a95
Generalise Query starting.
cjgillot Mar 19, 2020
6184a71
Make get_query into an extension trait.
cjgillot Mar 19, 2020
5b8dac3
Move query system to librustc_query_system.
cjgillot Mar 19, 2020
8e873c3
Make librustc_query_system compile.
cjgillot Mar 19, 2020
dca0344
Make librustc compile.
cjgillot Mar 19, 2020
301ad11
Rustfmt.
cjgillot Mar 26, 2020
d305b2c
Unify key types in get_lookup.
cjgillot Mar 24, 2020
228ca8e
Access QueryStateShard directly.
cjgillot Mar 24, 2020
b6033fc
Retire DepGraphSafe and HashStableContext.
cjgillot Mar 24, 2020
0e8b59a
Prune dependencies.
cjgillot Mar 24, 2020
fa06cfd
Move generics on QueryCache.
cjgillot Mar 24, 2020
5dfed41
Simplify generics on try_start.
cjgillot Mar 24, 2020
fce0d37
Add comment.
cjgillot Mar 24, 2020
d224e21
Rename read_query_job -> current_query_job and simplify it.
cjgillot Mar 25, 2020
260cfab
Don't allow access to the Session.
cjgillot Mar 25, 2020
4faf701
Remove the QueryGetter trait.
cjgillot Mar 27, 2020
db5be1f
Move QueryContext to the parent module.
cjgillot Mar 27, 2020
222d010
Cleanups.
cjgillot Mar 27, 2020
2d7bbda
Implement HashStable directly.
cjgillot Mar 27, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4042,12 +4042,12 @@ version = "0.0.0"
dependencies = [
"log",
"parking_lot 0.9.0",
"rustc_ast",
"rustc-rayon-core",
"rustc_data_structures",
"rustc_errors",
"rustc_hir",
"rustc_index",
"rustc_macros",
"rustc_span",
"serialize",
"smallvec 1.0.0",
]
Expand Down
31 changes: 14 additions & 17 deletions src/librustc/dep_graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use rustc_errors::Diagnostic;
use rustc_hir::def_id::DefId;

mod dep_node;
mod safe;

pub(crate) use rustc_query_system::dep_graph::DepNodeParams;
pub use rustc_query_system::dep_graph::{
Expand All @@ -17,8 +16,6 @@ pub use rustc_query_system::dep_graph::{
};

pub use dep_node::{label_strs, DepConstructor, DepKind, DepNode, DepNodeExt};
pub use safe::AssertDepGraphSafe;
pub use safe::DepGraphSafe;

pub type DepGraph = rustc_query_system::dep_graph::DepGraph<DepKind>;
pub type TaskDeps = rustc_query_system::dep_graph::TaskDeps<DepKind>;
Expand All @@ -27,6 +24,8 @@ pub type PreviousDepGraph = rustc_query_system::dep_graph::PreviousDepGraph<DepK
pub type SerializedDepGraph = rustc_query_system::dep_graph::SerializedDepGraph<DepKind>;

impl rustc_query_system::dep_graph::DepKind for DepKind {
const NULL: Self = DepKind::Null;

fn is_eval_always(&self) -> bool {
DepKind::is_eval_always(self)
}
Expand Down Expand Up @@ -82,6 +81,10 @@ impl rustc_query_system::dep_graph::DepKind for DepKind {
op(icx.task_deps)
})
}

fn can_reconstruct_query_key(&self) -> bool {
DepKind::can_reconstruct_query_key(self)
}
}

impl<'tcx> DepContext for TyCtxt<'tcx> {
Expand Down Expand Up @@ -160,6 +163,14 @@ impl<'tcx> DepContext for TyCtxt<'tcx> {
self.queries.on_disk_cache.store_diagnostics(dep_node_index, diagnostics)
}

fn store_diagnostics_for_anon_node(
&self,
dep_node_index: DepNodeIndex,
diagnostics: ThinVec<Diagnostic>,
) {
self.queries.on_disk_cache.store_diagnostics_for_anon_node(dep_node_index, diagnostics)
}

fn profiler(&self) -> &SelfProfilerRef {
&self.prof
}
Expand All @@ -175,17 +186,3 @@ impl rustc_query_system::HashStableContext for StableHashingContext<'_> {
self.sess().opts.debugging_opts.dep_tasks
}
}

impl rustc_query_system::HashStableContextProvider<StableHashingContext<'tcx>> for TyCtxt<'tcx> {
fn get_stable_hashing_context(&self) -> StableHashingContext<'tcx> {
self.create_stable_hashing_context()
}
}

impl rustc_query_system::HashStableContextProvider<StableHashingContext<'a>>
for StableHashingContext<'a>
{
fn get_stable_hashing_context(&self) -> Self {
self.clone()
}
}
9 changes: 0 additions & 9 deletions src/librustc/dep_graph/safe.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/librustc/ich/hcx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ impl<'a> StableHashingContextProvider<'a> for StableHashingContext<'a> {
}
}

impl<'a> crate::dep_graph::DepGraphSafe for StableHashingContext<'a> {}

impl<'a> HashStable<StableHashingContext<'a>> for ast::NodeId {
fn hash_stable(&self, _: &mut StableHashingContext<'a>, _: &mut StableHasher) {
panic!("Node IDs should not appear in incremental state");
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1603,7 +1603,7 @@ nop_list_lift! {substs; GenericArg<'a> => GenericArg<'tcx>}
pub mod tls {
use super::{ptr_eq, GlobalCtxt, TyCtxt};

use crate::dep_graph::TaskDeps;
use crate::dep_graph::{DepKind, TaskDeps};
use crate::ty::query;
use rustc_data_structures::sync::{self, Lock};
use rustc_data_structures::thin_vec::ThinVec;
Expand All @@ -1630,7 +1630,7 @@ pub mod tls {

/// The current query job, if any. This is updated by `JobOwner::start` in
/// `ty::query::plumbing` when executing a query.
pub query: Option<query::QueryJobId>,
pub query: Option<query::QueryJobId<DepKind>>,

/// Where to store diagnostics for the current query job, if any.
/// This is updated by `JobOwner::start` in `ty::query::plumbing` when executing a query.
Expand Down
82 changes: 0 additions & 82 deletions src/librustc/ty/query/config.rs

This file was deleted.

Loading