Remove deadlock virtual call.
This commit is contained in:
parent
81241cbf3a
commit
5b921505ef
4 changed files with 9 additions and 11 deletions
|
@ -10,6 +10,8 @@ use rustc_errors::registry::Registry;
|
|||
use rustc_metadata::dynamic_lib::DynamicLibrary;
|
||||
#[cfg(parallel_compiler)]
|
||||
use rustc_middle::ty::tls;
|
||||
#[cfg(parallel_compiler)]
|
||||
use rustc_query_impl::QueryCtxt;
|
||||
use rustc_resolve::{self, Resolver};
|
||||
use rustc_session as session;
|
||||
use rustc_session::config::{self, CrateType};
|
||||
|
@ -176,7 +178,7 @@ unsafe fn handle_deadlock() {
|
|||
thread::spawn(move || {
|
||||
tls::enter_context(icx, |_| {
|
||||
rustc_span::set_session_globals_then(session_globals, || {
|
||||
tls::with(|tcx| tcx.queries.deadlock(tcx, ®istry))
|
||||
tls::with(|tcx| QueryCtxt::from_tcx(tcx).deadlock(®istry))
|
||||
})
|
||||
});
|
||||
});
|
||||
|
|
|
@ -71,7 +71,7 @@ use std::mem;
|
|||
use std::ops::{Bound, Deref};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub trait OnDiskCache<'tcx> {
|
||||
pub trait OnDiskCache<'tcx>: rustc_data_structures::sync::Sync {
|
||||
/// Creates a new `OnDiskCache` instance from the serialized data in `data`.
|
||||
fn new(sess: &'tcx Session, data: Vec<u8>, start_pos: usize) -> Self
|
||||
where
|
||||
|
|
|
@ -233,9 +233,6 @@ macro_rules! define_callbacks {
|
|||
pub trait QueryEngine<'tcx>: rustc_data_structures::sync::Sync {
|
||||
fn as_any(&'tcx self) -> &'tcx dyn std::any::Any;
|
||||
|
||||
#[cfg(parallel_compiler)]
|
||||
unsafe fn deadlock(&'tcx self, tcx: TyCtxt<'tcx>, registry: &rustc_rayon_core::Registry);
|
||||
|
||||
fn try_mark_green(&'tcx self, tcx: TyCtxt<'tcx>, dep_node: &dep_graph::DepNode) -> bool;
|
||||
|
||||
$($(#[$attr])*
|
||||
|
|
|
@ -155,6 +155,11 @@ impl<'tcx> QueryCtxt<'tcx> {
|
|||
self.queries.on_disk_cache.as_ref()
|
||||
}
|
||||
|
||||
#[cfg(parallel_compiler)]
|
||||
pub unsafe fn deadlock(self, registry: &rustc_rayon_core::Registry) {
|
||||
rustc_query_system::query::deadlock(self, registry)
|
||||
}
|
||||
|
||||
pub(super) fn encode_query_results(
|
||||
self,
|
||||
encoder: &mut on_disk_cache::CacheEncoder<'a, 'tcx, opaque::FileEncoder>,
|
||||
|
@ -537,12 +542,6 @@ macro_rules! define_queries_struct {
|
|||
this as _
|
||||
}
|
||||
|
||||
#[cfg(parallel_compiler)]
|
||||
unsafe fn deadlock(&'tcx self, tcx: TyCtxt<'tcx>, registry: &rustc_rayon_core::Registry) {
|
||||
let tcx = QueryCtxt { tcx, queries: self };
|
||||
rustc_query_system::query::deadlock(tcx, registry)
|
||||
}
|
||||
|
||||
fn try_mark_green(&'tcx self, tcx: TyCtxt<'tcx>, dep_node: &dep_graph::DepNode) -> bool {
|
||||
let qcx = QueryCtxt { tcx, queries: self };
|
||||
tcx.dep_graph.try_mark_green(qcx, dep_node).is_some()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue