1
Fork 0

Don't use wait_for_query without the Rayon thread pool

This commit is contained in:
John Kåre Alsaker 2023-08-26 20:47:47 +02:00
parent 5739349e96
commit d35179f665
2 changed files with 13 additions and 13 deletions

View file

@ -124,7 +124,6 @@ impl<D: DepKind> QueryJob<D> {
} }
impl QueryJobId { impl QueryJobId {
#[cfg(not(parallel_compiler))]
pub(super) fn find_cycle_in_stack<D: DepKind>( pub(super) fn find_cycle_in_stack<D: DepKind>(
&self, &self,
query_map: QueryMap<D>, query_map: QueryMap<D>,

View file

@ -12,13 +12,13 @@ use crate::query::job::{report_cycle, QueryInfo, QueryJob, QueryJobId, QueryJobI
use crate::query::SerializedDepNodeIndex; use crate::query::SerializedDepNodeIndex;
use crate::query::{QueryContext, QueryMap, QuerySideEffects, QueryStackFrame}; use crate::query::{QueryContext, QueryMap, QuerySideEffects, QueryStackFrame};
use crate::HandleCycleError; use crate::HandleCycleError;
#[cfg(parallel_compiler)]
use rustc_data_structures::cold_path;
use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::sharded::Sharded; use rustc_data_structures::sharded::Sharded;
use rustc_data_structures::stack::ensure_sufficient_stack; use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_data_structures::sync::Lock; use rustc_data_structures::sync::Lock;
#[cfg(parallel_compiler)]
use rustc_data_structures::{cold_path, sync};
use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed, FatalError}; use rustc_errors::{DiagnosticBuilder, ErrorGuaranteed, FatalError};
use rustc_span::{Span, DUMMY_SP}; use rustc_span::{Span, DUMMY_SP};
use std::cell::Cell; use std::cell::Cell;
@ -223,7 +223,6 @@ where
#[cold] #[cold]
#[inline(never)] #[inline(never)]
#[cfg(not(parallel_compiler))]
fn cycle_error<Q, Qcx>( fn cycle_error<Q, Qcx>(
query: Q, query: Q,
qcx: Qcx, qcx: Qcx,
@ -336,8 +335,18 @@ where
} }
Entry::Occupied(mut entry) => { Entry::Occupied(mut entry) => {
match entry.get_mut() { match entry.get_mut() {
#[cfg(not(parallel_compiler))]
QueryResult::Started(job) => { QueryResult::Started(job) => {
#[cfg(parallel_compiler)]
if sync::is_dyn_thread_safe() {
// Get the latch out
let latch = job.latch();
drop(state_lock);
// Only call `wait_for_query` if we're using a Rayon thread pool
// as it will attempt to mark the worker thread as blocked.
return wait_for_query(query, qcx, span, key, latch, current_job_id);
}
let id = job.id; let id = job.id;
drop(state_lock); drop(state_lock);
@ -345,14 +354,6 @@ where
// so we just return the error. // so we just return the error.
cycle_error(query, qcx, id, span) cycle_error(query, qcx, id, span)
} }
#[cfg(parallel_compiler)]
QueryResult::Started(job) => {
// Get the latch out
let latch = job.latch();
drop(state_lock);
wait_for_query(query, qcx, span, key, latch, current_job_id)
}
QueryResult::Poisoned => FatalError.raise(), QueryResult::Poisoned => FatalError.raise(),
} }
} }