提交 179bf198 编写于 作者: N Nicholas Nethercote

Tweak a loop condition.

This loop condition involves `codegen_state`, `work_items`, and
`running_with_own_token`. But the body of the loop cannot modify
`codegen_state`, so repeatedly checking it is unnecessary.
上级 d21d31cc
......@@ -1431,13 +1431,17 @@ enum CodegenState {
// Spin up what work we can, only doing this while we've got available
// parallelism slots and work left to spawn.
while codegen_state != Aborted
&& !work_items.is_empty()
&& running_with_own_token < tokens.len()
{
let (item, _) = work_items.pop().unwrap();
spawn_work(&cgcx, &mut llvm_start_time, get_worker_id(&mut free_worker_ids), item);
running_with_own_token += 1;
if codegen_state != Aborted {
while !work_items.is_empty() && running_with_own_token < tokens.len() {
let (item, _) = work_items.pop().unwrap();
spawn_work(
&cgcx,
&mut llvm_start_time,
get_worker_id(&mut free_worker_ids),
item,
);
running_with_own_token += 1;
}
}
// Relinquish accidentally acquired extra tokens.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册