Add tracing spans to macro generated database

This commit is contained in:
Lukas Wirth 2024-03-06 19:11:40 +01:00
parent 52d8ae791d
commit a3b6e891ea
12 changed files with 78 additions and 128 deletions

View file

@ -136,7 +136,7 @@ where
) -> std::fmt::Result {
let slot_map = self.slot_map.read();
let key = slot_map.get_index(index as usize).unwrap().0;
write!(fmt, "{}({:?})", Q::QUERY_NAME, key)
write!(fmt, "{}::{}({:?})", std::any::type_name::<Q>(), Q::QUERY_NAME, key)
}
fn maybe_changed_after(
@ -146,13 +146,13 @@ where
revision: Revision,
) -> bool {
debug_assert!(revision < db.salsa_runtime().current_revision());
let read = self.slot_map.read();
let Some((key, slot)) = read.get_index(index as usize) else {
return false;
let (key, slot) = {
let read = self.slot_map.read();
let Some((key, slot)) = read.get_index(index as usize) else {
return false;
};
(key.clone(), slot.clone())
};
let (key, slot) = (key.clone(), slot.clone());
// note: this drop is load-bearing. removing it would causes deadlocks.
drop(read);
slot.maybe_changed_after(db, revision, &key)
}