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:
bors 2017-08-11 22:23:10 +00:00
commit 8da3ff3fcc

View File

@ -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 => {