Writes of the title's that change nothing are not made: faulting stores and copies beside the guards, and flags it sets that are set (VICTORY_WRITE_SITES=<file>: places changed at load to look first; off without it)

A store that faults, or a part of a copy into a guarded block, whose bytes
are there already is left out (with VICTORY_STORE_BESIDE, VICTORY_COPY_BESIDE).
The places in the title's code where that is the rule and the instruction is
an `or` of a byte with a constant are written into the file, and made to look
before they write at the next start. The file holds offsets, no code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-25 13:10:05 -06:00
1 parent f19e55b8b6
commit 83a1bcf5b7
8 files changed
+437 -18

No files matched your search

+18
View File
@@ -968,6 +968,15 @@ pub(crate) fn put_beside(block: usize, weight: u32, put: impl FnOnce(usize)) ->
Beside::Done
}
/// A faulting store of the title's leaves `block` as it is: whether it may be
/// left out (until that has been so often, since the block was taken, that
/// the faults cost more than opening it).
pub(crate) fn nothing_put(block: usize) -> bool {
use std::sync::atomic::Ordering::Relaxed;
let count = put_count(block);
count.load(Relaxed) < crate::titlewrite::MOST && count.fetch_add(1, Relaxed) < crate::titlewrite::MOST
}
/// The title is about to write block by block around `at`: as by a fault.
pub(crate) fn opened_for_writing(at: usize) {
let mut g = guards();
@@ -3524,6 +3533,15 @@ mod tests {
}
}
assert!(kept > 10, "the guard stayed {kept} times: {:?}", crate::titlewrite::DONE);
// What is there already is not written: nothing to tell.
for k in 0..10 {
// SAFETY (all): as above.
unsafe { ((one + 64) as *mut u32).write_volatile(198) };
let same = unsafe { std::slice::from_raw_parts((one + BLOCK - 900) as *const u8, 1500) }.to_vec();
unsafe { copy((one + BLOCK - 900) as *mut u8, same.as_ptr(), same.len()) };
assert!(!writable(one) && !writable(two), "{k}");
}
assert_eq!(guard(one, one + SIZE), Some(Vec::new()));
// Many stores to a block: it is opened.
quiet();
for k in 0..20 {