Skip to content

Commit 325d9ac

Browse files
authored
Merge pull request #731 from Veykril/veykril/push-nzkwqzxxkxou
Remove some dynamically dispatched `Database::event` calls
2 parents 447b371 + 40d4576 commit 325d9ac

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

src/function/diff_outputs.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::{memo::Memo, Configuration, IngredientImpl};
22
use crate::{
33
hash::FxHashSet, key::OutputDependencyIndex, zalsa::Zalsa, zalsa_local::QueryRevisions,
4-
AsDynDatabase as _, DatabaseKeyIndex, Event, EventKind,
4+
AsDynDatabase as _, Database, DatabaseKeyIndex, Event, EventKind,
55
};
66

77
impl<C> IngredientImpl<C>
@@ -49,15 +49,13 @@ where
4949
key: DatabaseKeyIndex,
5050
output: OutputDependencyIndex,
5151
) {
52-
let db = db.as_dyn_database();
53-
5452
db.salsa_event(&|| {
5553
Event::new(EventKind::WillDiscardStaleOutput {
5654
execute_key: key,
5755
output_key: output,
5856
})
5957
});
6058

61-
output.remove_stale_output(zalsa, db, key);
59+
output.remove_stale_output(zalsa, db.as_dyn_database(), key);
6260
}
6361
}

src/function/maybe_changed_after.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,13 @@ where
149149
);
150150
if last_changed <= verified_at {
151151
// No input of the suitable durability has changed since last verified.
152-
let db = db.as_dyn_database();
153152
memo.mark_as_verified(
154153
db,
155154
revision_now,
156155
database_key_index,
157156
memo.revisions.accumulated_inputs.load(),
158157
);
159-
memo.mark_outputs_as_verified(zalsa, db, database_key_index);
158+
memo.mark_outputs_as_verified(zalsa, db.as_dyn_database(), database_key_index);
160159
return true;
161160
}
162161

@@ -264,12 +263,7 @@ where
264263
}
265264
};
266265

267-
old_memo.mark_as_verified(
268-
db.as_dyn_database(),
269-
zalsa.current_revision(),
270-
database_key_index,
271-
inputs,
272-
);
266+
old_memo.mark_as_verified(db, zalsa.current_revision(), database_key_index, inputs);
273267
true
274268
}
275269
}

src/function/memo.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ impl<V> Memo<V> {
157157

158158
/// Mark memo as having been verified in the `revision_now`, which should
159159
/// be the current revision.
160-
pub(super) fn mark_as_verified(
160+
pub(super) fn mark_as_verified<Db: ?Sized + crate::Database>(
161161
&self,
162-
db: &dyn crate::Database,
162+
db: &Db,
163163
revision_now: Revision,
164164
database_key_index: DatabaseKeyIndex,
165165
accumulated: InputAccumulatedValues,

src/function/specify.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ where
127127

128128
let database_key_index = self.database_key_index(key);
129129
memo.mark_as_verified(
130-
db.as_dyn_database(),
130+
db,
131131
zalsa.current_revision(),
132132
database_key_index,
133133
InputAccumulatedValues::Empty,

0 commit comments

Comments
 (0)