Make lowering incremental, take 3/N#142830
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (a6b131d): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 10.5%, secondary 10.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.5%, secondary 4.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.1%, secondary -0.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 690.042s -> 689.298s (-0.11%) |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (31325ff): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 10.8%, secondary 10.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.1%, secondary 4.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.1%, secondary -0.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 689.082s -> 688.79s (-0.04%) |
|
Some changes occurred in coverage instrumentation. cc @Zalathar These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
I don't think I will be able to do much better in terms of perf. Meanwhile, it unblocks making progress on more incremental name resolution. r? @petrochenkov |
| #[derive(Debug)] | ||
| pub enum AstOwner { | ||
| NonOwner, | ||
| Synthetic(rustc_span::def_id::LocalDefId), |
There was a problem hiding this comment.
| Synthetic(rustc_span::def_id::LocalDefId), | |
| Synthetic(LocalDefId), |
| #[derive(Debug)] | ||
| pub enum AstOwner { | ||
| NonOwner, | ||
| Synthetic(rustc_span::def_id::LocalDefId), |
There was a problem hiding this comment.
This is used specifically for nested imports, maybe use a more specific name and add an explanation comment?
| query resolver_for_lowering_raw(_: ()) -> (&'tcx Steal<(ty::ResolverAstLowering<'tcx>, Arc<ast::Crate>)>, &'tcx ty::ResolverGlobalCtxt) { | ||
| query resolver_for_lowering_raw(_: ()) -> ( | ||
| &'tcx Steal<ty::ResolverAstLowering<'tcx>>, | ||
| &'tcx Steal<ast::Crate>, |
There was a problem hiding this comment.
It would be useful to add a comment telling why the Steals are used here.
| } | ||
|
|
||
| query index_ast(_: ()) -> &'tcx IndexVec<LocalDefId, Steal<( | ||
| Arc<ty::ResolverAstLowering<'tcx>>, |
There was a problem hiding this comment.
It would be useful to add a comment telling why the Arcs are used here.
| query lower_to_hir(key: LocalDefId) -> hir::MaybeOwner<'tcx> { | ||
| eval_always | ||
| desc { "lowering the delayed AST owner `{}`", tcx.def_path_str(def_id) } | ||
| desc { "lowering HIR for `{}`", tcx.def_path_str(key.to_def_id()) } |
There was a problem hiding this comment.
| desc { "lowering HIR for `{}`", tcx.def_path_str(key.to_def_id()) } | |
| desc { "lowering HIR for `{}`", tcx.def_path_str(def_id) } |
| /// Pre-computed hash of the full HIR. Used in the crate hash. Only present | ||
| /// when incr. comp. is enabled. | ||
| pub opt_hash_including_bodies: Option<Fingerprint>, | ||
| pub opt_hash: Option<Fingerprint>, |
There was a problem hiding this comment.
Does the hash still include bodies?
Is it not valuable to mention it? (Perhaps it can be mentioned in the comment above.)
|
Started reviewing today, starting from the easy parts, will continue on Monday. |
This comment has been minimized.
This comment has been minimized.
| span, | ||
| vis: Visibility { kind: VisibilityKind::Public, span, tokens: None }, | ||
| // Lacking a better choice, we replace the contents with a macro call. | ||
| // Unexpanded macros should never reach lowering, so this is not confusing. |
There was a problem hiding this comment.
Macro expansion uses the same approach (compiler\rustc_expand\src\placeholders.rs), maybe it can even be reused here.
| pub type ForeignItem = Item<ForeignItemKind>; | ||
|
|
||
| #[derive(Debug)] | ||
| pub enum AstOwner { |
There was a problem hiding this comment.
If it's only used in AST lowering, then maybe it's better to move it there.
| AstOwner::ImplItem(item) => item_lowerer.lower_impl_item(&item), | ||
| AstOwner::ForeignItem(item) => item_lowerer.lower_foreign_item(&item), | ||
| AstOwner::Synthetic(parent_id) => fallback_to_parent(*parent_id), | ||
| AstOwner::NonOwner => fallback_to_parent(tcx.local_parent(def_id)), |
There was a problem hiding this comment.
In which cases AstOwner::NonOwners appear at all? Only during error recovery?
Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
View all comments
Rebase of #88186 that was rebased by #127262
No real change in design, so I'm not expecting a perf miracle.
r? @ghost