Skip to content

Commit 60026c0

Browse files
authored
reduce size of interned value metadata (#903)
1 parent a95bae5 commit 60026c0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/interned.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ where
125125
}
126126

127127
/// Shared value data can only be read through the lock.
128+
#[repr(Rust, packed)] // Allow `durability` to be stored in the padding of the outer `Value` struct.
128129
struct ValueShared {
129130
/// The interned ID for this value.
130131
///
@@ -325,7 +326,7 @@ where
325326
let value_shared = unsafe { &mut *value.shared.get() };
326327

327328
// Validate the value in this revision to avoid reuse.
328-
if value_shared.last_interned_at < current_revision {
329+
if { value_shared.last_interned_at } < current_revision {
329330
value_shared.last_interned_at = current_revision;
330331

331332
zalsa.event(&|| {
@@ -397,7 +398,7 @@ where
397398
}
398399

399400
// We should never reuse a value that was accessed in the current revision.
400-
debug_assert!(value_shared.last_interned_at < current_revision);
401+
debug_assert!({ value_shared.last_interned_at } < current_revision);
401402

402403
// Record the durability of the current query on the interned value.
403404
let (durability, last_interned_at) = zalsa_local
@@ -699,7 +700,7 @@ where
699700
let value_shared = unsafe { &mut *value.shared.get() };
700701

701702
let last_changed_revision = zalsa.last_changed_revision(value_shared.durability);
702-
value_shared.last_interned_at >= last_changed_revision
703+
({ value_shared.last_interned_at }) >= last_changed_revision
703704
},
704705
"Data was not interned in the latest revision for its durability."
705706
);

0 commit comments

Comments
 (0)