Calculate self-profile strings in Compiler::enter
instead in codegen
This avoids each tool having to separately find and call `self_profile_alloc_strings`. - Don't compute the global context if it hasn't yet been computed This avoids giving extraneous errors about unresolved names if an error occurs during parsing.
This commit is contained in:
parent
1d1010f1af
commit
ca72f9ed70
3 changed files with 16 additions and 16 deletions
|
@ -1017,13 +1017,6 @@ pub fn start_codegen<'tcx>(
|
|||
tcx.sess.time("assert_dep_graph", || rustc_incremental::assert_dep_graph(tcx));
|
||||
tcx.sess.time("serialize_dep_graph", || rustc_incremental::save_dep_graph(tcx));
|
||||
|
||||
// We assume that no queries are run past here. If there are new queries
|
||||
// after this point, they'll show up as "<unknown>" in self-profiling data.
|
||||
{
|
||||
let _prof_timer = tcx.prof.generic_activity("self_profile_alloc_query_strings");
|
||||
tcx.alloc_self_profile_query_strings();
|
||||
}
|
||||
|
||||
info!("Post-codegen\n{:?}", tcx.debug_stats());
|
||||
|
||||
if tcx.sess.opts.output_types.contains_key(&OutputType::Mir) {
|
||||
|
|
|
@ -417,9 +417,19 @@ impl Compiler {
|
|||
let queries = Queries::new(&self);
|
||||
let ret = f(&queries);
|
||||
|
||||
if self.session().opts.debugging_opts.query_stats {
|
||||
if let Ok(gcx) = queries.global_ctxt() {
|
||||
gcx.peek_mut().print_stats();
|
||||
// NOTE: intentionally does not compute the global context if it hasn't been built yet,
|
||||
// since that likely means there was a parse error.
|
||||
if let Some(Ok(gcx)) = &mut *queries.global_ctxt.result.borrow_mut() {
|
||||
// We assume that no queries are run past here. If there are new queries
|
||||
// after this point, they'll show up as "<unknown>" in self-profiling data.
|
||||
{
|
||||
let _prof_timer =
|
||||
queries.session().prof.generic_activity("self_profile_alloc_query_strings");
|
||||
gcx.enter(|tcx| tcx.alloc_self_profile_query_strings());
|
||||
}
|
||||
|
||||
if self.session().opts.debugging_opts.query_stats {
|
||||
gcx.print_stats();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue