Skip to content

Commit b54e365

Browse files
committed
simple LRU garbage collection for interned values
1 parent ad3dff6 commit b54e365

9 files changed

+470
-158
lines changed

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ salsa-macros = { version = "0.21.0", path = "components/salsa-macros", optional
1414

1515
boxcar = "0.2.11"
1616
crossbeam-queue = "0.3.11"
17-
dashmap = { version = "6", features = ["raw-api"] }
1817
hashbrown = "0.15"
1918
hashlink = "0.10"
2019
indexmap = "2"
20+
intrusive-collections = "0.9.7"
2121
parking_lot = "0.12"
2222
portable-atomic = "1"
2323
rustc-hash = "2"
@@ -47,6 +47,7 @@ salsa-macros = { version = "=0.21.0", path = "components/salsa-macros" }
4747
[dev-dependencies]
4848
# examples
4949
crossbeam-channel = "0.5.14"
50+
dashmap = { version = "6", features = ["raw-api"] }
5051
eyre = "0.6.8"
5152
notify-debouncer-mini = "0.4.1"
5253
ordered-float = "4.2.1"

src/durability.rs

-8
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,6 @@ impl Durability {
8787
pub(crate) fn index(self) -> usize {
8888
self.0 as usize
8989
}
90-
91-
pub(crate) fn as_u8(self) -> u8 {
92-
self.0 as u8
93-
}
94-
95-
pub(crate) fn from_u8(value: u8) -> Self {
96-
Self(DurabilityVal::from(value))
97-
}
9890
}
9991

10092
impl Default for Durability {

src/event.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,17 @@ pub enum EventKind {
108108
revision: Revision,
109109
},
110110

111+
/// Indicates that a value was interned by reusing an existing slot.
112+
DidReuseInternedValue {
113+
// The key of the interned value.
114+
key: DatabaseKeyIndex,
115+
116+
// The revision the value was interned in.
117+
revision: Revision,
118+
},
119+
111120
/// Indicates that a previously interned value was read in a new revision.
112-
DidReinternValue {
121+
DidValidateInternedValue {
113122
// The key of the interned value.
114123
key: DatabaseKeyIndex,
115124

src/hash.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::hash::{BuildHasher, Hash};
22

33
pub(crate) type FxHasher = std::hash::BuildHasherDefault<rustc_hash::FxHasher>;
44
pub(crate) type FxIndexSet<K> = indexmap::IndexSet<K, FxHasher>;
5-
pub(crate) type FxDashMap<K, V> = dashmap::DashMap<K, V, FxHasher>;
65
pub(crate) type FxLinkedHashSet<K> = hashlink::LinkedHashSet<K, FxHasher>;
76
pub(crate) type FxHashSet<K> = std::collections::HashSet<K, FxHasher>;
87

0 commit comments

Comments
 (0)