Skip to content

Commit 15c28cd

Browse files
authored
Simple LRU garbage collection for interned values (#839)
* simple LRU garbage collection for interned values * shard interned values * gate memo size assertion to 64-bit platforms * extend internal documentation for interned structs * remove `first_interned_at` field from interned values * clarify difference between tracked and interned structs * only keep track of low durability interned values for garbage collection
1 parent ac6fe53 commit 15c28cd

File tree

10 files changed

+898
-245
lines changed

10 files changed

+898
-245
lines changed

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ salsa-macros = { version = "0.22.0", path = "components/salsa-macros", optional
1414

1515
boxcar = { version = "0.2.12" }
1616
crossbeam-queue = "0.3.11"
17-
dashmap = { version = "6", features = ["raw-api"] }
18-
# the version of hashbrown used by dashmap
19-
hashbrown_14 = { version = "0.14", package = "hashbrown" }
17+
crossbeam-utils = "0.8.21"
2018
hashbrown = "0.15"
2119
hashlink = "0.10"
2220
indexmap = "2"
21+
intrusive-collections = "0.9.7"
2322
parking_lot = "0.12"
2423
portable-atomic = "1"
2524
rustc-hash = "2"
@@ -52,6 +51,7 @@ salsa-macros = { version = "=0.22.0", path = "components/salsa-macros" }
5251
[dev-dependencies]
5352
# examples
5453
crossbeam-channel = "0.5.14"
54+
dashmap = { version = "6", features = ["raw-api"] }
5555
eyre = "0.6.8"
5656
notify-debouncer-mini = "0.4.1"
5757
ordered-float = "4.2.1"

src/durability.rs

Lines changed: 0 additions & 8 deletions
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

Lines changed: 10 additions & 1 deletion
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

0 commit comments

Comments
 (0)