@@ -379,7 +379,11 @@ where
379
379
380
380
match JobOwner :: < ' _ , Q :: Key , Qcx :: DepKind > :: try_start ( & qcx, state, state_lock, span, key) {
381
381
TryGetJob :: NotYetStarted ( job) => {
382
- let ( result, dep_node_index) = execute_job ( query, qcx, key. clone ( ) , dep_node, job. id ) ;
382
+ let ( result, dep_node_index) = match qcx. dep_context ( ) . dep_graph ( ) . data ( ) {
383
+ None => execute_job_non_incr ( query, qcx, key, job. id ) ,
384
+ Some ( data) => execute_job_incr ( query, qcx, data, key, dep_node, job. id ) ,
385
+ } ;
386
+
383
387
let cache = query. query_cache ( qcx) ;
384
388
if query. feedable ( ) {
385
389
// We should not compute queries that also got a value via feeding.
@@ -413,48 +417,53 @@ where
413
417
}
414
418
}
415
419
420
+ // Fast path for when incr. comp. is off.
416
421
#[ inline( always) ]
417
- fn execute_job < Q , Qcx > (
422
+ fn execute_job_non_incr < Q , Qcx > (
418
423
query : Q ,
419
424
qcx : Qcx ,
420
425
key : Q :: Key ,
421
- mut dep_node_opt : Option < DepNode < Qcx :: DepKind > > ,
422
426
job_id : QueryJobId ,
423
427
) -> ( Q :: Value , DepNodeIndex )
424
428
where
425
429
Q : QueryConfig < Qcx > ,
426
430
Qcx : QueryContext ,
427
431
{
428
- let dep_graph = qcx. dep_context ( ) . dep_graph ( ) ;
429
- let dep_graph_data = match dep_graph. data ( ) {
430
- // Fast path for when incr. comp. is off.
431
- None => {
432
- // Fingerprint the key, just to assert that it doesn't
433
- // have anything we don't consider hashable
434
- if cfg ! ( debug_assertions) {
435
- let _ = key. to_fingerprint ( * qcx. dep_context ( ) ) ;
436
- }
432
+ // Fingerprint the key, just to assert that it doesn't
433
+ // have anything we don't consider hashable
434
+ if cfg ! ( debug_assertions) {
435
+ let _ = key. to_fingerprint ( * qcx. dep_context ( ) ) ;
436
+ }
437
437
438
- let prof_timer = qcx. dep_context ( ) . profiler ( ) . query_provider ( ) ;
439
- let result =
440
- qcx. start_query ( job_id, query. depth_limit ( ) , None , || query. compute ( qcx, key) ) ;
441
- let dep_node_index = dep_graph. next_virtual_depnode_index ( ) ;
442
- prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
443
-
444
- // Similarly, fingerprint the result to assert that
445
- // it doesn't have anything not considered hashable.
446
- if cfg ! ( debug_assertions) && let Some ( hash_result) = query. hash_result ( )
447
- {
448
- qcx. dep_context ( ) . with_stable_hashing_context ( |mut hcx| {
449
- hash_result ( & mut hcx, & result) ;
450
- } ) ;
451
- }
438
+ let prof_timer = qcx. dep_context ( ) . profiler ( ) . query_provider ( ) ;
439
+ let result = qcx. start_query ( job_id, query. depth_limit ( ) , None , || query. compute ( qcx, key) ) ;
440
+ let dep_node_index = qcx. dep_context ( ) . dep_graph ( ) . next_virtual_depnode_index ( ) ;
441
+ prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
452
442
453
- return ( result, dep_node_index) ;
454
- }
455
- Some ( data) => data,
456
- } ;
443
+ // Similarly, fingerprint the result to assert that
444
+ // it doesn't have anything not considered hashable.
445
+ if cfg ! ( debug_assertions) && let Some ( hash_result) = query. hash_result ( ) {
446
+ qcx. dep_context ( ) . with_stable_hashing_context ( |mut hcx| {
447
+ hash_result ( & mut hcx, & result) ;
448
+ } ) ;
449
+ }
457
450
451
+ ( result, dep_node_index)
452
+ }
453
+
454
+ #[ inline( always) ]
455
+ fn execute_job_incr < Q , Qcx > (
456
+ query : Q ,
457
+ qcx : Qcx ,
458
+ dep_graph_data : & DepGraphData < Qcx :: DepKind > ,
459
+ key : Q :: Key ,
460
+ mut dep_node_opt : Option < DepNode < Qcx :: DepKind > > ,
461
+ job_id : QueryJobId ,
462
+ ) -> ( Q :: Value , DepNodeIndex )
463
+ where
464
+ Q : QueryConfig < Qcx > ,
465
+ Qcx : QueryContext ,
466
+ {
458
467
if !query. anon ( ) && !query. eval_always ( ) {
459
468
// `to_dep_node` is expensive for some `DepKind`s.
460
469
let dep_node =
0 commit comments