Skip to content

Commit f71c545

Browse files
committed
Make sure to count reused cgus towards the count of jobs done
1 parent 5b41956 commit f71c545

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/concurrency_limiter.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ impl ConcurrencyLimiter {
4949
state = self.available_token_condvar.wait(state).unwrap();
5050
}
5151
}
52+
53+
pub(super) fn job_already_done(&mut self) {
54+
let mut state = self.state.lock().unwrap();
55+
state.job_already_done();
56+
}
5257
}
5358

5459
impl Drop for ConcurrencyLimiter {
@@ -137,6 +142,14 @@ mod state {
137142
self.assert_invariants();
138143
}
139144

145+
pub(super) fn job_already_done(&mut self) {
146+
self.assert_invariants();
147+
self.pending_jobs -= 1;
148+
self.assert_invariants();
149+
self.drop_excess_capacity();
150+
self.assert_invariants();
151+
}
152+
140153
fn drop_excess_capacity(&mut self) {
141154
self.assert_invariants();
142155
if self.active_jobs == self.pending_jobs {

src/driver/aot.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ pub(crate) fn run_aot(
391391
}
392392
CguReuse::PreLto => unreachable!(),
393393
CguReuse::PostLto => {
394+
concurrency_limiter.job_already_done();
394395
OngoingModuleCodegen::Sync(reuse_workproduct_for_cgu(tcx, &*cgu))
395396
}
396397
}

0 commit comments

Comments
 (0)