diff options
| author | bors <bors@rust-lang.org> | 2021-09-09 06:16:04 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-09-09 06:16:04 +0000 |
| commit | 02a57fa13291f5bbb9d8efbc71f7423642b8d105 (patch) | |
| tree | e6d22d57a4eb0d19ad17c6b426d323208a70927a | |
| parent | c5cbf7852a7692c7c51df64c09a59e7838b55202 (diff) | |
| parent | 102264652e3b8ea3f9dbe61ca5fa68051802349d (diff) | |
| download | rust-02a57fa13291f5bbb9d8efbc71f7423642b8d105.tar.gz rust-02a57fa13291f5bbb9d8efbc71f7423642b8d105.zip | |
Auto merge of #88748 - bjorn3:try_fix_perf_regression, r=wesleywiser
Revert "Remove optimization_fuel_crate from Session" This reverts commit 5464b2e713d5366b3aec5c6eebbe1b84a782c51e. This hopefully fixes the perf regression in https://github.com/rust-lang/rust/pull/88530#issuecomment-915314117.
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index c71595ab57e..4471e1e0ae8 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -170,6 +170,9 @@ pub struct Session { /// Data about code being compiled, gathered during compilation. pub code_stats: CodeStats, + /// If `-zfuel=crate=n` is specified, `Some(crate)`. + optimization_fuel_crate: Option<String>, + /// Tracks fuel info if `-zfuel=crate=n` is specified. optimization_fuel: Lock<OptimizationFuel>, @@ -883,7 +886,7 @@ impl Session { /// This expends fuel if applicable, and records fuel if applicable. pub fn consider_optimizing<T: Fn() -> String>(&self, crate_name: &str, msg: T) -> bool { let mut ret = true; - if let Some(c) = self.opts.debugging_opts.fuel.as_ref().map(|i| &i.0) { + if let Some(ref c) = self.optimization_fuel_crate { if c == crate_name { assert_eq!(self.threads(), 1); let mut fuel = self.optimization_fuel.lock(); @@ -1254,6 +1257,7 @@ pub fn build_session( let local_crate_source_file = local_crate_source_file.map(|path| file_path_mapping.map_prefix(path).0); + let optimization_fuel_crate = sopts.debugging_opts.fuel.as_ref().map(|i| i.0.clone()); let optimization_fuel = Lock::new(OptimizationFuel { remaining: sopts.debugging_opts.fuel.as_ref().map_or(0, |i| i.1), out_of_fuel: false, @@ -1305,6 +1309,7 @@ pub fn build_session( normalize_projection_ty: AtomicUsize::new(0), }, code_stats: Default::default(), + optimization_fuel_crate, optimization_fuel, print_fuel, jobserver: jobserver::client(), |
