Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
222 changes: 222 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ memmap2 = "0.9"
libc = "0.2"
ahash = "0.8"

# Loom is only pulled in for the seqlock memory-ordering model (issue #40), built
# solely under `RUSTFLAGS="--cfg loom"`. It is absent from normal/release builds and CI.
[target.'cfg(loom)'.dependencies]
loom = "0.7"

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(Py_GIL_DISABLED)'] }
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(Py_GIL_DISABLED)', 'cfg(loom)'] }

[profile.release]
lto = "fat"
Expand Down
8 changes: 8 additions & 0 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ For day-to-day workflow and commands, see [`CLAUDE.md`](../CLAUDE.md) and
- **Hash table capacity must be power-of-2** — bitmask probing uses
`hash & (capacity - 1)`. Always use `.next_power_of_two()`.
- **`#[repr(C)]` struct field ordering** — place u64 fields before u32 to avoid implicit
alignment padding; affects `size_of` assertions in `layout.rs`.
- **Seqlock writer ordering (issue #40).** The writer must publish the odd ("writer active")
sequence number *before* its data mutations become visible: `write_lock` does the odd store
then an `atomic::fence(Release)` (a Release store alone orders only *prior* ops). This pairs
with the reader's `atomic::fence(Acquire)` in `read_validate` — without the writer fence, on
weak-memory hardware a data write can float ahead of the odd publish and a reader can validate
a torn read against a stale even seq. The ordering is model-checked under `loom` (run
`RUSTFLAGS="--cfg loom" cargo test --lib seqlock_ordering`; loom is a `cfg(loom)`-only dep).
alignment padding; affects `size_of` assertions in `layout.rs`. Any field the lock-free
read path *writes* (currently only `SlotHeader.visited`) must be an atomic type accessed
with `Relaxed` — readers touch it without the write lock while writers reuse the slot, so a
Expand Down
Loading
Loading