-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #33425 - eddyb:rift, r=nikomatsakis
Split the type context into a global and a local (inference-only) one. After this change, each `InferCtxt` creates its own local type interner for types with inference by-products. Most of the code which handles both a global and a local interner uses `'gcx` and `'tcx` for them. A reference to the type context in that situation (e.g. `infcx.tcx`) is `TyCtxt<'a, 'gcx, 'tcx>`. The global type context which used to be `&'a TyCtxt<'tcx>` is now `TyCtxt<'a, 'tcx, 'tcx>`. In order to minimize the number of extra lifetime parameters, many functions became methods. Where possible (some inherent impls), lifetime parameters were added on the impl, not each method. As inference by-products no longer escape their inference contexts, memory usage is lower. Example of `-Z time-passes` excerpt for `librustc`, stage1 (~100MB gains): Before "rustc: Split local type contexts interners from the global one.": ``` time: 0.395; rss: 335MB item-types checking time: 15.392; rss: 472MB item-bodies checking time: 0.000; rss: 472MB drop-impl checking time: 1.140; rss: 478MB const checking time: 0.139; rss: 478MB privacy checking time: 0.024; rss: 478MB stability index time: 0.072; rss: 478MB intrinsic checking time: 0.038; rss: 478MB effect checking time: 0.255; rss: 478MB match checking time: 0.128; rss: 484MB liveness checking time: 1.372; rss: 484MB rvalue checking time: 1.404; rss: 597MB MIR dump time: 0.809; rss: 599MB MIR passes ``` After: ``` time: 0.467; rss: 337MB item-types checking time: 17.443; rss: 395MB item-bodies checking time: 0.000; rss: 395MB drop-impl checking time: 1.423; rss: 401MB const checking time: 0.141; rss: 401MB privacy checking time: 0.024; rss: 401MB stability index time: 0.116; rss: 401MB intrinsic checking time: 0.038; rss: 401MB effect checking time: 0.382; rss: 401MB match checking time: 0.132; rss: 407MB liveness checking time: 1.678; rss: 407MB rvalue checking time: 1.614; rss: 503MB MIR dump time: 0.957; rss: 512MB MIR passes ``` **NOTE**: Functions changed to methods weren't re-indented to keep this PR easier to review. Once approved, the changes will be mechanically performed. However, indentation changes of function arguments are there - and I believe there's a way to hide whitespace-only changes in diffs on GitHub.
- Loading branch information
Showing
199 changed files
with
15,089 additions
and
14,867 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.