From 909c42ad92a9dd055d8fe74d63ae144e4427cee3 Mon Sep 17 00:00:00 2001 From: VolodymyrBg Date: Wed, 3 Dec 2025 23:41:08 +0200 Subject: [PATCH] fix(emulator): gate address snapshots to Simple mode --- vm/src/emulator/riscv/emulator/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vm/src/emulator/riscv/emulator/mod.rs b/vm/src/emulator/riscv/emulator/mod.rs index fe5b1d18..defdbe87 100644 --- a/vm/src/emulator/riscv/emulator/mod.rs +++ b/vm/src/emulator/riscv/emulator/mod.rs @@ -337,7 +337,7 @@ pub enum EmulatorMode { } /// save the *old* value (or a `None` marker) into `memory_snapshot`. -// TODO: may manually diff registers and page_table +/// Only snapshot during Simple mode (used by emulate_state() to build diffs). #[inline(always)] fn snapshot_addr_if_needed( _mode: &RiscvEmulatorMode, @@ -345,7 +345,9 @@ fn snapshot_addr_if_needed( addr: u32, entry: &Entry, ) { - // if !matches!(mode, RiscvEmulatorMode::Snapshot) { return; } + if !matches!(_mode, RiscvEmulatorMode::Simple) { + return; + } snapshot.entry(addr).or_insert_with(|| match entry { Entry::Occupied(e) => Some(*e.get()),