diff --git a/CHANGELOG.md b/CHANGELOG.md index ab4ad6c..ef7df61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,7 +33,7 @@ remains unsupported. - Extended the read-only RDNA2 planning CLI (`python3 -m qa rdna2`) with family/status filters, compact summaries, Codex-ready manifests under `artifacts/`, active-claim exclusion (family claims exclude those families; path-only claims block overlapping permitted files), coverage reconcile against `semantic_coverage` without inflating counts, and inventory diffs. Covered by `tests/qa/test_rdna2_plan.py`; planning only, no GPU production edits. ### Fixed -- Replaced per-byte DBT cache validation with a constant-time executable-generation token that distinguishes cloned address spaces and changes on executable mappings and writes, including loader bypass writes. Non-executable data writes keep translations cached. Same-dispatch self-modification and reclamation of discarded native blocks remain unsupported; regression tests pin cache exhaustion. +- Replaced per-byte DBT cache validation with a constant-time executable-generation token that distinguishes cloned address spaces and changes on executable mappings and writes, including loader bypass writes. Non-executable data writes keep translations cached. The differential harness restores data within one address space for its warm-cache checks, preserving its state and cache assertions. Same-dispatch self-modification and reclamation of discarded native blocks remain unsupported; regression tests pin cache exhaustion. - The DBT no longer runs a stale translation after the guest rewrites its own code or runs against a different address space (#84). Each cached block now keeps the guest bytes it was translated from and is compared with the current executable bytes on every lookup; a mismatch, or bytes that are no longer readable, discards the block and translates it again, counted in the new `DbtMetrics::blocks_invalidated`. This makes the `cpu_known_answers` self-modifying-code case pass for the DBT, so it is no longer ignored as a known defect, and regression tests cover a rewritten block, a rewritten final byte, a budget-limited block and a second address space. The discarded native code stays in the JIT cache until cache reclamation exists (#99), and a store into a block's own later instructions during the same dispatch is not detected. Local verification only; not independently reviewed. - Non-canonical 64-bit guest data addresses now raise `#GP` instead of a memory fault in both the interpreter and native DBT, including accesses that cross the canonical-address boundary. The synthetic architectural test is enabled again. - Made the native semantic-review timeout in `scripts/test-gpu.sh` configurable with `XENORA_SEMANTIC_TIMEOUT` and raised its default from 120 to 300 seconds, so cold Apple Silicon runs do not fail while the expanded Metal known-answer suite is still progressing. diff --git a/crates/loader/tests/cpu_differential.rs b/crates/loader/tests/cpu_differential.rs index 90baf17..30c1987 100644 --- a/crates/loader/tests/cpu_differential.rs +++ b/crates/loader/tests/cpu_differential.rs @@ -200,16 +200,24 @@ impl Case { compare("DBT (1 step)", result, &translated_memory, 1, offset); } - // Exercise native block lowering and then reuse those blocks with a - // fresh copy of the guest input and memory at the same addresses. + // Exercise native block lowering, then reuse the same address space + // with its data restored. A new address space is intentionally a cold + // cache input, even when it has identical code at identical addresses. let mut dbt = DbtEngine::new(128 * 1024).unwrap(); let mut memory = self.memory(); let result = Interpreter::new(self.initial.cpu.clone(), &mut memory, BUDGET).run(); compare("interpreter", result, &memory, BUDGET, 0); + let mut translated_memory = self.memory(); let mut run_full = |engine| { - let mut memory = self.memory(); - let result = dbt.run(&mut self.initial.cpu.clone(), &mut memory, BUDGET); - compare(engine, result, &memory, BUDGET, 0); + translated_memory + .write_bytes(DATA, &self.initial.data) + .unwrap(); + let result = dbt.run( + &mut self.initial.cpu.clone(), + &mut translated_memory, + BUDGET, + ); + compare(engine, result, &translated_memory, BUDGET, 0); dbt.metrics }; let cold = run_full("DBT (cold)");