Skip to content

Commit ea07f22

Browse files
committed
remove first_interned_at field from interned values
1 parent 7f288ac commit ea07f22

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/interned.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,6 @@ struct ValueShared {
141141
/// the value is re-interned with a new ID.
142142
id: Id,
143143

144-
/// The revision the value was first interned in, i.e. the latest revision
145-
/// in which the slot was reused.
146-
first_interned_at: Revision,
147-
148144
/// The revision the value was most-recently interned in.
149145
last_interned_at: Revision,
150146

@@ -343,10 +339,13 @@ where
343339
}
344340

345341
// Record a dependency on the value.
342+
//
343+
// Note that we can use `Revision::start()` here as the ID with the given generation
344+
// is unique to this use of the interned slot.
346345
zalsa_local.report_tracked_read_simple(
347346
index,
348347
value_shared.durability,
349-
value_shared.first_interned_at,
348+
Revision::start(),
350349
);
351350

352351
return value_shared.id;
@@ -419,16 +418,17 @@ where
419418
id: new_id,
420419
durability,
421420
last_interned_at,
422-
// Record the revision in which we are re-interning the value.
423-
first_interned_at: current_revision,
424421
};
425422

426423
// Record a dependency on the new value.
424+
//
425+
// Note that we can use `Revision::start()` here as we just incremented the ID generation,
426+
// so it as if a new input has been created.
427427
let index = self.database_key_index(value_shared.id);
428428
zalsa_local.report_tracked_read_simple(
429429
index,
430430
value_shared.durability,
431-
value_shared.first_interned_at,
431+
Revision::start(),
432432
);
433433

434434
zalsa.event(&|| {
@@ -546,8 +546,6 @@ where
546546
id,
547547
durability,
548548
last_interned_at,
549-
// Record the revision in which we are re-interning the value.
550-
first_interned_at: current_revision,
551549
}),
552550
});
553551

@@ -575,7 +573,7 @@ where
575573
let index = self.database_key_index(id);
576574

577575
// Record a dependency on the newly interned value.
578-
zalsa_local.report_tracked_read_simple(index, durability, current_revision);
576+
zalsa_local.report_tracked_read_simple(index, durability, Revision::start());
579577

580578
zalsa.event(&|| {
581579
Event::new(EventKind::DidInternValue {
@@ -739,7 +737,7 @@ where
739737
&self,
740738
db: &dyn Database,
741739
input: Id,
742-
revision: Revision,
740+
_revision: Revision,
743741
_cycle_heads: &mut CycleHeads,
744742
) -> VerifyResult {
745743
let zalsa = db.zalsa();
@@ -757,7 +755,7 @@ where
757755
let value_shared = unsafe { &mut *value.shared.get() };
758756

759757
// The slot was reused.
760-
if value_shared.first_interned_at > revision {
758+
if value_shared.id.generation() > input.generation() {
761759
return VerifyResult::Changed;
762760
}
763761

0 commit comments

Comments
 (0)