[iterate-4A] jit: cache MemEnv fast_mem + expose mmio_count (prep for block chaining)
Behavior-neutral prep on top of the inline-load parity milestone:
* JitCache caches mem.fast_mem() (resolved once — the mapping is invariant for
a run) so compiled blocks build their MemEnv without a virtual call per
execution. MemEnv::from_fast(mem, Option<FastMem>) is the non-virtual
constructor. Measured impact is within noise (96.5 -> 96.4 MIPS) but it
removes redundant per-block work.
* FastMem/MemEnv gain mmio_count: a pointer to GuestMemory's monotonic MMIO
access counter. Unused for now; the upcoming superblock-chaining JIT will
sample it across a block boundary to stop chaining on an MMIO touch
(preserving the interpreter's fine-grained MMIO ordering).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,11 @@ pub struct FastMem {
|
||||
/// condition for `addr` to be MMIO, so `!=` proves non-MMIO.
|
||||
pub mmio_mask: u32,
|
||||
pub mmio_value: u32,
|
||||
/// Pointer to the monotonic MMIO-access counter (`AtomicU64` as `*const
|
||||
/// u64`). A superblock JIT samples this across a block boundary to detect an
|
||||
/// MMIO touch and stop chaining there (preserving the interpreter's
|
||||
/// fine-grained MMIO ordering).
|
||||
pub mmio_count: *const u64,
|
||||
}
|
||||
|
||||
/// Trait for all guest memory access. Every load/store goes through this,
|
||||
|
||||
@@ -519,6 +519,7 @@ impl MemoryAccess for GuestMemory {
|
||||
page_table: self.page_table.as_ptr() as *const u64,
|
||||
mmio_mask: self.mmio_aperture_mask,
|
||||
mmio_value: self.mmio_aperture_value,
|
||||
mmio_count: &self.mmio_access_count as *const AtomicU64 as *const u64,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user