Auto merge of #43766 - michaelwoerister:trans-scheduler-touch-up, r=alexcrichton
Improve LLVM/trans scheduling a bit Currently it's possible that the main thread is waiting on LLVM threads to finish work while its implicit token is going to waste. This PR let's the main thread take over, so one of the running LLVM threads can free its token earlier. r? @alexcrichton
This commit is contained in:
commit
8da3ff3fcc
@ -1356,6 +1356,16 @@ fn start_executing_work(sess: &Session,
|
||||
maybe_start_llvm_timer(&item, &mut llvm_start_time);
|
||||
main_thread_worker_state = MainThreadWorkerState::LLVMing;
|
||||
spawn_work(cgcx, item);
|
||||
} else {
|
||||
// There is no unstarted work, so let the main thread
|
||||
// take over for a running worker. Otherwise the
|
||||
// implicit token would just go to waste.
|
||||
// We reduce the `running` counter by one. The
|
||||
// `tokens.truncate()` below will take care of
|
||||
// giving the Token back.
|
||||
debug_assert!(running > 0);
|
||||
running -= 1;
|
||||
main_thread_worker_state = MainThreadWorkerState::LLVMing;
|
||||
}
|
||||
}
|
||||
MainThreadWorkerState::Translating => {
|
||||
|
Loading…
Reference in New Issue
Block a user