@@ -379,7 +379,11 @@ where
379379
380380 match JobOwner :: < ' _ , Q :: Key , Qcx :: DepKind > :: try_start ( & qcx, state, state_lock, span, key) {
381381 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+
383387 let cache = query. query_cache ( qcx) ;
384388 if query. feedable ( ) {
385389 // We should not compute queries that also got a value via feeding.
@@ -413,48 +417,55 @@ where
413417 }
414418}
415419
420+ // Fast path for when incr. comp. is off.
416421#[ inline( always) ]
417- fn execute_job < Q , Qcx > (
422+ fn execute_job_non_incr < Q , Qcx > (
418423 query : Q ,
419424 qcx : Qcx ,
420425 key : Q :: Key ,
421- mut dep_node_opt : Option < DepNode < Qcx :: DepKind > > ,
422426 job_id : QueryJobId ,
423427) -> ( Q :: Value , DepNodeIndex )
424428where
425429 Q : QueryConfig < Qcx > ,
426430 Qcx : QueryContext ,
427431{
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+ debug_assert ! ( !qcx. dep_context( ) . dep_graph( ) . is_fully_enabled( ) ) ;
437433
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- }
434+ // Fingerprint the key, just to assert that it doesn't
435+ // have anything we don't consider hashable
436+ if cfg ! ( debug_assertions) {
437+ let _ = key. to_fingerprint ( * qcx. dep_context ( ) ) ;
438+ }
452439
453- return ( result, dep_node_index) ;
454- }
455- Some ( data) => data,
456- } ;
440+ let prof_timer = qcx. dep_context ( ) . profiler ( ) . query_provider ( ) ;
441+ let result = qcx. start_query ( job_id, query. depth_limit ( ) , None , || query. compute ( qcx, key) ) ;
442+ let dep_node_index = qcx. dep_context ( ) . dep_graph ( ) . next_virtual_depnode_index ( ) ;
443+ prof_timer. finish_with_query_invocation_id ( dep_node_index. into ( ) ) ;
444+
445+ // Similarly, fingerprint the result to assert that
446+ // it doesn't have anything not considered hashable.
447+ if cfg ! ( debug_assertions) && let Some ( hash_result) = query. hash_result ( ) {
448+ qcx. dep_context ( ) . with_stable_hashing_context ( |mut hcx| {
449+ hash_result ( & mut hcx, & result) ;
450+ } ) ;
451+ }
457452
453+ ( result, dep_node_index)
454+ }
455+
456+ #[ inline( always) ]
457+ fn execute_job_incr < Q , Qcx > (
458+ query : Q ,
459+ qcx : Qcx ,
460+ dep_graph_data : & DepGraphData < Qcx :: DepKind > ,
461+ key : Q :: Key ,
462+ mut dep_node_opt : Option < DepNode < Qcx :: DepKind > > ,
463+ job_id : QueryJobId ,
464+ ) -> ( Q :: Value , DepNodeIndex )
465+ where
466+ Q : QueryConfig < Qcx > ,
467+ Qcx : QueryContext ,
468+ {
458469 if !query. anon ( ) && !query. eval_always ( ) {
459470 // `to_dep_node` is expensive for some `DepKind`s.
460471 let dep_node =
0 commit comments