Enable tracing for all queryies

This commit is contained in:
Oli Scherer 2022-05-04 08:30:13 +00:00
parent 9add63257b
commit 0d5a738b8b
4 changed files with 6 additions and 1 deletions

View File

@ -4244,6 +4244,7 @@ dependencies = [
"rustc_serialize", "rustc_serialize",
"rustc_session", "rustc_session",
"rustc_span", "rustc_span",
"tracing",
] ]
[[package]] [[package]]

View File

@ -20,6 +20,7 @@ rustc_query_system = { path = "../rustc_query_system" }
rustc_serialize = { path = "../rustc_serialize" } rustc_serialize = { path = "../rustc_serialize" }
rustc_session = { path = "../rustc_session" } rustc_session = { path = "../rustc_session" }
rustc_span = { path = "../rustc_span" } rustc_span = { path = "../rustc_span" }
tracing = "0.1"
[features] [features]
rustc_use_parallel_compiler = ["rustc-rayon-core", "rustc_query_system/rustc_use_parallel_compiler"] rustc_use_parallel_compiler = ["rustc-rayon-core", "rustc_query_system/rustc_use_parallel_compiler"]

View File

@ -435,6 +435,8 @@ macro_rules! define_queries {
fn force_from_dep_node(tcx: TyCtxt<'_>, dep_node: DepNode) -> bool { fn force_from_dep_node(tcx: TyCtxt<'_>, dep_node: DepNode) -> bool {
if let Some(key) = recover(tcx, dep_node) { if let Some(key) = recover(tcx, dep_node) {
#[cfg(debug_assertions)]
let _guard = tracing::span!(tracing::Level::TRACE, stringify!($name), ?key).entered();
let tcx = QueryCtxt::from_tcx(tcx); let tcx = QueryCtxt::from_tcx(tcx);
force_query::<queries::$name<'_>, _>(tcx, key, dep_node); force_query::<queries::$name<'_>, _>(tcx, key, dep_node);
true true
@ -532,6 +534,7 @@ macro_rules! define_queries_struct {
$($(#[$attr])* $($(#[$attr])*
#[inline(always)] #[inline(always)]
#[tracing::instrument(level = "trace", skip(self, tcx))]
fn $name( fn $name(
&'tcx self, &'tcx self,
tcx: TyCtxt<$tcx>, tcx: TyCtxt<$tcx>,

View File

@ -675,6 +675,7 @@ where
} }
} }
#[derive(Debug)]
pub enum QueryMode { pub enum QueryMode {
Get, Get,
Ensure, Ensure,
@ -697,7 +698,6 @@ where
None None
}; };
debug!("ty::query::get_query<{}>(key={:?}, span={:?})", Q::NAME, key, span);
let (result, dep_node_index) = try_execute_query( let (result, dep_node_index) = try_execute_query(
tcx, tcx,
Q::query_state(tcx), Q::query_state(tcx),