Skip to content

Commit 37b47f9

Browse files
committed
Remove jobserver from Session
It is effectively a global resource and the jobserver::Client in Session was a clone of GLOBAL_CLIENT anyway.
1 parent 1c9a333 commit 37b47f9

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

src/concurrency_limiter.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use std::sync::{Arc, Condvar, Mutex};
22

3-
use jobserver::HelperThread;
3+
use rustc_data_structures::jobserver::{self, HelperThread};
44
use rustc_errors::DiagCtxtHandle;
5-
use rustc_session::Session;
65

76
// FIXME don't panic when a worker thread panics
87

@@ -14,14 +13,13 @@ pub(super) struct ConcurrencyLimiter {
1413
}
1514

1615
impl ConcurrencyLimiter {
17-
pub(super) fn new(sess: &Session, pending_jobs: usize) -> Self {
16+
pub(super) fn new(pending_jobs: usize) -> Self {
1817
let state = Arc::new(Mutex::new(state::ConcurrencyLimiterState::new(pending_jobs)));
1918
let available_token_condvar = Arc::new(Condvar::new());
2019

2120
let state_helper = state.clone();
2221
let available_token_condvar_helper = available_token_condvar.clone();
23-
let helper_thread = sess
24-
.jobserver
22+
let helper_thread = jobserver::client()
2523
.clone()
2624
.into_helper_thread(move |token| {
2725
let mut state = state_helper.lock().unwrap();
@@ -113,7 +111,7 @@ impl Drop for ConcurrencyLimiterToken {
113111
}
114112

115113
mod state {
116-
use jobserver::Acquired;
114+
use rustc_data_structures::jobserver::Acquired;
117115

118116
#[derive(Debug)]
119117
pub(super) struct ConcurrencyLimiterState {

src/driver/aot.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ pub(crate) fn run_aot(
679679
metadata_module: None,
680680
metadata,
681681
crate_info: CrateInfo::new(tcx, target_cpu),
682-
concurrency_limiter: ConcurrencyLimiter::new(tcx.sess, 0),
682+
concurrency_limiter: ConcurrencyLimiter::new(0),
683683
});
684684
};
685685

@@ -711,7 +711,7 @@ pub(crate) fn run_aot(
711711
CguReuse::PreLto | CguReuse::PostLto => false,
712712
});
713713

714-
let concurrency_limiter = IntoDynSyncSend(ConcurrencyLimiter::new(tcx.sess, todo_cgus.len()));
714+
let concurrency_limiter = IntoDynSyncSend(ConcurrencyLimiter::new(todo_cgus.len()));
715715

716716
let modules = tcx.sess.time("codegen mono items", || {
717717
let mut modules: Vec<_> = par_map(todo_cgus, |(_, cgu)| {

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#![warn(unused_lifetimes)]
1313
// tidy-alphabetical-end
1414

15-
extern crate jobserver;
1615
#[macro_use]
1716
extern crate rustc_middle;
1817
extern crate rustc_abi;

0 commit comments

Comments
 (0)