@@ -30,11 +30,10 @@ use rustc_target::spec::MergeFunctions;
30
30
use syntax:: attr;
31
31
use syntax_pos:: hygiene:: ExpnId ;
32
32
use syntax_pos:: symbol:: { Symbol , sym} ;
33
- use jobserver :: { Client , Acquired } ;
33
+ use rustc_jobserver :: Acquired ;
34
34
35
35
use std:: any:: Any ;
36
36
use std:: fs;
37
- use std:: io;
38
37
use std:: mem;
39
38
use std:: path:: { Path , PathBuf } ;
40
39
use std:: str;
@@ -433,7 +432,6 @@ pub fn start_async_codegen<B: ExtraBackendMethods>(
433
432
codegen_worker_send,
434
433
coordinator_receive,
435
434
total_cgus,
436
- sess. jobserver . clone ( ) ,
437
435
Arc :: new ( modules_config) ,
438
436
Arc :: new ( metadata_config) ,
439
437
Arc :: new ( allocator_config) ,
@@ -890,7 +888,7 @@ fn execute_lto_work_item<B: ExtraBackendMethods>(
890
888
}
891
889
892
890
pub enum Message < B : WriteBackendMethods > {
893
- Token ( io :: Result < Acquired > ) ,
891
+ Token ( Acquired ) ,
894
892
NeedsFatLTO {
895
893
result : FatLTOInput < B > ,
896
894
worker_id : usize ,
@@ -938,7 +936,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
938
936
codegen_worker_send : Sender < Message < B > > ,
939
937
coordinator_receive : Receiver < Box < dyn Any + Send > > ,
940
938
total_cgus : usize ,
941
- jobserver : Client ,
942
939
modules_config : Arc < ModuleConfig > ,
943
940
metadata_config : Arc < ModuleConfig > ,
944
941
allocator_config : Arc < ModuleConfig > ,
@@ -981,9 +978,9 @@ fn start_executing_work<B: ExtraBackendMethods>(
981
978
// get tokens on `coordinator_receive` which will
982
979
// get managed in the main loop below.
983
980
let coordinator_send2 = coordinator_send. clone ( ) ;
984
- let helper = jobserver . into_helper_thread ( move |token| {
981
+ let helper = rustc_jobserver :: helper_thread ( move |token| {
985
982
drop ( coordinator_send2. send ( Box :: new ( Message :: Token :: < B > ( token) ) ) ) ;
986
- } ) . expect ( "failed to spawn helper thread" ) ;
983
+ } ) ;
987
984
988
985
let mut each_linked_rlib_for_lto = Vec :: new ( ) ;
989
986
drop ( link:: each_linked_rlib ( crate_info, & mut |cnum, path| {
@@ -1374,25 +1371,15 @@ fn start_executing_work<B: ExtraBackendMethods>(
1374
1371
// this to spawn a new unit of work, or it may get dropped
1375
1372
// immediately if we have no more work to spawn.
1376
1373
Message :: Token ( token) => {
1377
- match token {
1378
- Ok ( token) => {
1379
- tokens. push ( token) ;
1380
-
1381
- if main_thread_worker_state == MainThreadWorkerState :: LLVMing {
1382
- // If the main thread token is used for LLVM work
1383
- // at the moment, we turn that thread into a regular
1384
- // LLVM worker thread, so the main thread is free
1385
- // to react to codegen demand.
1386
- main_thread_worker_state = MainThreadWorkerState :: Idle ;
1387
- running += 1 ;
1388
- }
1389
- }
1390
- Err ( e) => {
1391
- let msg = & format ! ( "failed to acquire jobserver token: {}" , e) ;
1392
- shared_emitter. fatal ( msg) ;
1393
- // Exit the coordinator thread
1394
- panic ! ( "{}" , msg)
1395
- }
1374
+ tokens. push ( token) ;
1375
+
1376
+ if main_thread_worker_state == MainThreadWorkerState :: LLVMing {
1377
+ // If the main thread token is used for LLVM work
1378
+ // at the moment, we turn that thread into a regular
1379
+ // LLVM worker thread, so the main thread is free
1380
+ // to react to codegen demand.
1381
+ main_thread_worker_state = MainThreadWorkerState :: Idle ;
1382
+ running += 1 ;
1396
1383
}
1397
1384
}
1398
1385
0 commit comments