mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Rollup merge of #101635 - jyn514:queries-new-derived, r=cjgillot
Move `Queries::new` out of the macro Split out from https://github.com/rust-lang/rust/pull/101178 to make sure it's not contributing to the perf impact. r? `@cjgillot`
This commit is contained in:
commit
b0455e9ab4
@ -48,7 +48,7 @@ cfg_if! {
|
||||
/// the native atomic types.
|
||||
/// You should use this type through the `AtomicU64`, `AtomicUsize`, etc, type aliases
|
||||
/// as it's not intended to be used separately.
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct Atomic<T: Copy>(Cell<T>);
|
||||
|
||||
impl<T: Copy> Atomic<T> {
|
||||
|
@ -5,7 +5,7 @@
|
||||
use crate::keys::Key;
|
||||
use crate::{on_disk_cache, Queries};
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_data_structures::sync::Lock;
|
||||
use rustc_data_structures::sync::{AtomicU64, Lock};
|
||||
use rustc_errors::{Diagnostic, Handler};
|
||||
use rustc_middle::dep_graph::{
|
||||
self, DepKind, DepKindStruct, DepNode, DepNodeIndex, SerializedDepNodeIndex,
|
||||
@ -499,19 +499,7 @@ macro_rules! define_queries {
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! define_queries_struct {
|
||||
(
|
||||
input: ($(([$($modifiers:tt)*] [$($attr:tt)*] [$name:ident]))*)) => {
|
||||
pub struct Queries<'tcx> {
|
||||
local_providers: Box<Providers>,
|
||||
extern_providers: Box<ExternProviders>,
|
||||
|
||||
pub on_disk_cache: Option<OnDiskCache<'tcx>>,
|
||||
|
||||
jobs: AtomicU64,
|
||||
|
||||
$($(#[$attr])* $name: QueryState<<queries::$name<'tcx> as QueryConfig>::Key>,)*
|
||||
}
|
||||
use crate::{ExternProviders, OnDiskCache, Providers};
|
||||
|
||||
impl<'tcx> Queries<'tcx> {
|
||||
pub fn new(
|
||||
@ -524,10 +512,27 @@ macro_rules! define_queries_struct {
|
||||
extern_providers: Box::new(extern_providers),
|
||||
on_disk_cache,
|
||||
jobs: AtomicU64::new(1),
|
||||
$($name: Default::default()),*
|
||||
..Queries::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! define_queries_struct {
|
||||
(
|
||||
input: ($(([$($modifiers:tt)*] [$($attr:tt)*] [$name:ident]))*)) => {
|
||||
#[derive(Default)]
|
||||
pub struct Queries<'tcx> {
|
||||
local_providers: Box<Providers>,
|
||||
extern_providers: Box<ExternProviders>,
|
||||
|
||||
pub on_disk_cache: Option<OnDiskCache<'tcx>>,
|
||||
|
||||
jobs: AtomicU64,
|
||||
|
||||
$($(#[$attr])* $name: QueryState<<queries::$name<'tcx> as QueryConfig>::Key>,)*
|
||||
}
|
||||
|
||||
impl<'tcx> Queries<'tcx> {
|
||||
pub(crate) fn try_collect_active_jobs(
|
||||
&'tcx self,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
|
Loading…
Reference in New Issue
Block a user