@@ -193,16 +193,13 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
193
193
/// Executes a job by changing the ImplicitCtxt to point to the
194
194
/// new query job while it executes. It returns the diagnostics
195
195
/// captured during execution and the actual result.
196
- // FIXME: Remove inline(never)
197
- #[ inline( never) ]
198
- pub ( super ) fn with_context < ' lcx , F , R > (
196
+ #[ inline( always) ]
197
+ pub ( super ) fn compute (
199
198
& self ,
200
- tcx : TyCtxt < ' _ , ' tcx , ' lcx > ,
199
+ tcx : TyCtxt < ' _ , ' tcx , ' tcx > ,
201
200
task : & OpenTask ,
202
- compute : F )
203
- -> R
204
- where
205
- F : for < ' b > FnOnce ( TyCtxt < ' b , ' tcx , ' lcx > ) -> R
201
+ key : Q :: Key ,
202
+ ) -> Q :: Value
206
203
{
207
204
// Update the ImplicitCtxt to point to our new query job
208
205
let new_icx = tls:: ImplicitCtxt {
@@ -214,7 +211,7 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> {
214
211
215
212
// Use the ImplicitCtxt while we execute the query
216
213
tls:: enter_context ( & new_icx, |_| {
217
- compute ( tcx)
214
+ Q :: compute ( tcx, key )
218
215
} )
219
216
}
220
217
}
@@ -398,7 +395,7 @@ impl<'a, 'gcx> TyCtxt<'a, 'gcx, 'gcx> {
398
395
self . sess . profiler ( |p| p. start_activity ( Q :: CATEGORY ) ) ;
399
396
400
397
let res = self . dep_graph . with_anon_open_task ( dep_node. kind , |open_task| {
401
- job. with_context ( self , open_task, |tcx | Q :: compute ( tcx . global_tcx ( ) , key) )
398
+ job. compute ( self , open_task, key)
402
399
} ) ;
403
400
404
401
self . sess . profiler ( |p| p. end_activity ( Q :: CATEGORY ) ) ;
@@ -454,8 +451,7 @@ impl<'a, 'gcx> TyCtxt<'a, 'gcx, 'gcx> {
454
451
self . sess . opts . debugging_opts . incremental_queries {
455
452
let prev_dep_node_index =
456
453
self . dep_graph . prev_dep_node_index_of ( dep_node) ;
457
- let result = Q :: try_load_from_disk ( self . global_tcx ( ) ,
458
- prev_dep_node_index) ;
454
+ let result = Q :: try_load_from_disk ( self , prev_dep_node_index) ;
459
455
460
456
// We always expect to find a cached result for things that
461
457
// can be forced from DepNode.
@@ -480,7 +476,7 @@ impl<'a, 'gcx> TyCtxt<'a, 'gcx, 'gcx> {
480
476
// try_mark_green(), so we can ignore them here.
481
477
// The dep-graph for this computation is already in
482
478
// place so we pass OpenTask::Ignore.
483
- job. with_context ( self , & OpenTask :: Ignore , |tcx| Q :: compute ( tcx , key) )
479
+ job. compute ( self , & OpenTask :: Ignore , key)
484
480
} ;
485
481
486
482
// If -Zincremental-verify-ich is specified, re-hash results from
@@ -518,8 +514,8 @@ impl<'a, 'gcx> TyCtxt<'a, 'gcx, 'gcx> {
518
514
Ok ( result)
519
515
}
520
516
521
- // FIXME: Inline this so LLVM can tell what kind of DepNode we are using
522
- #[ inline( never ) ]
517
+ // Inlined so LLVM can tell what kind of DepNode we are using
518
+ #[ inline( always ) ]
523
519
fn force_query_with_job < Q : QueryDescription < ' gcx > > (
524
520
self ,
525
521
key : Q :: Key ,
@@ -543,15 +539,13 @@ impl<'a, 'gcx> TyCtxt<'a, 'gcx, 'gcx> {
543
539
p. record_query ( Q :: CATEGORY ) ;
544
540
} ) ;
545
541
546
- let provider = Q :: provider ( self , & key) ;
547
-
548
542
let res = if dep_node. kind . is_eval_always ( ) {
549
543
self . dep_graph . with_eval_always_task ( self , dep_node, |task| {
550
- job. with_context ( self , task, |tcx| provider ( tcx , key) )
544
+ job. compute ( self , task, key)
551
545
} )
552
546
} else {
553
547
self . dep_graph . with_query_task ( self , dep_node, |task| {
554
- job. with_context ( self , task, |tcx| provider ( tcx , key) )
548
+ job. compute ( self , task, key)
555
549
} )
556
550
} ;
557
551
@@ -806,16 +800,6 @@ macro_rules! define_queries_inner {
806
800
} ) *
807
801
}
808
802
809
- // This module and the functions in it exist only to provide a
810
- // predictable symbol name prefix for query providers. This is helpful
811
- // for analyzing queries in profilers.
812
- pub ( super ) mod __query_compute {
813
- $( #[ inline( never) ]
814
- pub fn $name<F : FnOnce ( ) -> R , R >( f: F ) -> R {
815
- f( )
816
- } ) *
817
- }
818
-
819
803
$( impl <$tcx> QueryConfig <$tcx> for queries:: $name<$tcx> {
820
804
type Key = $K;
821
805
type Value = $V;
@@ -844,20 +828,18 @@ macro_rules! define_queries_inner {
844
828
}
845
829
846
830
#[ inline( always) ]
847
- fn provider (
831
+ fn compute (
848
832
tcx: TyCtxt <' _, ' tcx, ' tcx>,
849
- key: & Self :: Key
850
- ) -> fn ( TyCtxt <' _, ' tcx, ' tcx>, Self :: Key ) -> Self :: Value {
851
- __query_compute:: $name( move || {
852
- let provider = tcx. queries. providers. get( key. query_crate( ) )
853
- // HACK(eddyb) it's possible crates may be loaded after
854
- // the query engine is created, and because crate loading
855
- // is not yet integrated with the query engine, such crates
856
- // would be be missing appropriate entries in `providers`.
857
- . unwrap_or( & tcx. queries. fallback_extern_providers)
858
- . $name;
859
- provider
860
- } )
833
+ key: Self :: Key
834
+ ) -> Self :: Value {
835
+ let provider = tcx. queries. providers. get( key. query_crate( ) )
836
+ // HACK(eddyb) it's possible crates may be loaded after
837
+ // the query engine is created, and because crate loading
838
+ // is not yet integrated with the query engine, such crates
839
+ // would be be missing appropriate entries in `providers`.
840
+ . unwrap_or( & tcx. queries. fallback_extern_providers)
841
+ . $name;
842
+ provider( tcx, key)
861
843
}
862
844
863
845
fn handle_cycle_error( tcx: TyCtxt <' _, ' tcx, ' _>) -> Self :: Value {
0 commit comments