Skip to content

Commit 40d4576

Browse files
committed
Remove some dynamically dispatched Database::event calls
1 parent 7d417ac commit 40d4576

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
@@ -141,14 +141,13 @@ where
141141

142142
if memo.check_durability(zalsa) {
143143
// No input of the suitable durability has changed since last verified.
144-
let db = db.as_dyn_database();
145144
memo.mark_as_verified(
146145
db,
147146
revision_now,
148147
database_key_index,
149148
memo.revisions.accumulated_inputs.load(),
150149
);
151-
memo.mark_outputs_as_verified(zalsa, db, database_key_index);
150+
memo.mark_outputs_as_verified(zalsa, db.as_dyn_database(), database_key_index);
152151
return true;
153152
}
154153

@@ -256,12 +255,7 @@ where
256255
}
257256
};
258257

259-
old_memo.mark_as_verified(
260-
db.as_dyn_database(),
261-
zalsa.current_revision(),
262-
database_key_index,
263-
inputs,
264-
);
258+
old_memo.mark_as_verified(db, zalsa.current_revision(), database_key_index, inputs);
265259
true
266260
}
267261
}

src/function/memo.rs

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

170170
/// Mark memo as having been verified in the `revision_now`, which should
171171
/// be the current revision.
172-
pub(super) fn mark_as_verified(
172+
pub(super) fn mark_as_verified<Db: ?Sized + crate::Database>(
173173
&self,
174-
db: &dyn crate::Database,
174+
db: &Db,
175175
revision_now: Revision,
176176
database_key_index: DatabaseKeyIndex,
177177
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)