@@ -41,16 +41,11 @@ where
4141
4242 let ( new_value, mut revisions) = match C :: CYCLE_STRATEGY {
4343 CycleRecoveryStrategy :: Panic => {
44- Self :: execute_query ( db, active_query , opt_old_memo , zalsa . current_revision ( ) , id)
44+ Self :: execute_query ( db, zalsa , active_query , opt_old_memo , id)
4545 }
4646 CycleRecoveryStrategy :: FallbackImmediate => {
47- let ( mut new_value, mut revisions) = Self :: execute_query (
48- db,
49- active_query,
50- opt_old_memo,
51- zalsa. current_revision ( ) ,
52- id,
53- ) ;
47+ let ( mut new_value, mut revisions) =
48+ Self :: execute_query ( db, zalsa, active_query, opt_old_memo, id) ;
5449
5550 if let Some ( cycle_heads) = revisions. cycle_heads_mut ( ) {
5651 // Did the new result we got depend on our own provisional value, in a cycle?
7772 let active_query = db
7873 . zalsa_local ( )
7974 . push_query ( database_key_index, IterationCount :: initial ( ) ) ;
80- new_value = C :: cycle_initial ( db, C :: id_to_input ( db , id) ) ;
75+ new_value = C :: cycle_initial ( db, C :: id_to_input ( zalsa , id) ) ;
8176 revisions = active_query. pop ( ) ;
8277 // We need to set `cycle_heads` and `verified_final` because it needs to propagate to the callers.
8378 // When verifying this, we will see we have fallback and mark ourselves verified.
@@ -136,13 +131,8 @@ where
136131 let mut opt_last_provisional: Option < & Memo < ' db , C > > = None ;
137132 loop {
138133 let previous_memo = opt_last_provisional. or ( opt_old_memo) ;
139- let ( mut new_value, mut revisions) = Self :: execute_query (
140- db,
141- active_query,
142- previous_memo,
143- zalsa. current_revision ( ) ,
144- id,
145- ) ;
134+ let ( mut new_value, mut revisions) =
135+ Self :: execute_query ( db, zalsa, active_query, previous_memo, id) ;
146136
147137 // Did the new result we got depend on our own provisional value, in a cycle?
148138 if let Some ( cycle_heads) = revisions
@@ -192,7 +182,7 @@ where
192182 db,
193183 & new_value,
194184 iteration_count. as_u32 ( ) ,
195- C :: id_to_input ( db , id) ,
185+ C :: id_to_input ( zalsa , id) ,
196186 ) {
197187 crate :: CycleRecoveryAction :: Iterate => { }
198188 crate :: CycleRecoveryAction :: Fallback ( fallback_value) => {
@@ -258,9 +248,9 @@ where
258248 #[ inline]
259249 fn execute_query < ' db > (
260250 db : & ' db C :: DbView ,
251+ zalsa : & ' db Zalsa ,
261252 active_query : ActiveQueryGuard < ' db > ,
262253 opt_old_memo : Option < & Memo < ' db , C > > ,
263- current_revision : Revision ,
264254 id : Id ,
265255 ) -> ( C :: Output < ' db > , QueryRevisions ) {
266256 if let Some ( old_memo) = opt_old_memo {
@@ -275,14 +265,16 @@ where
275265 // * ensure that tracked struct created during the previous iteration
276266 // (and are owned by the query) are alive even if the query in this iteration no longer creates them.
277267 // * ensure the final returned memo depends on all inputs from all iterations.
278- if old_memo. may_be_provisional ( ) && old_memo. verified_at . load ( ) == current_revision {
268+ if old_memo. may_be_provisional ( )
269+ && old_memo. verified_at . load ( ) == zalsa. current_revision ( )
270+ {
279271 active_query. seed_iteration ( & old_memo. revisions ) ;
280272 }
281273 }
282274
283275 // Query was not previously executed, or value is potentially
284276 // stale, or value is absent. Let's execute!
285- let new_value = C :: execute ( db, C :: id_to_input ( db , id) ) ;
277+ let new_value = C :: execute ( db, C :: id_to_input ( zalsa , id) ) ;
286278
287279 ( new_value, active_query. pop ( ) )
288280 }
0 commit comments