From 730a0a38ca1855be32d629b27261c6b83b3bdf2c Mon Sep 17 00:00:00 2001 From: Antoni Sawicki Date: Fri, 7 Aug 2026 23:36:35 -0700 Subject: [PATCH] iris-gui: port live MIPS estimate to CyclesPtr 926d56f converted REX3's cycle counter from Arc to a Cell volatile read but only updated src/, leaving iris-gui/src/handle.rs on the old API and the GUI build broken: error[E0308]: mismatched types --> iris-gui/src/handle.rs:409:34 | expected `Option>>`, found `Option>` Latch the CyclesPtr instead of cloning an Arc and read it with .get(), mirroring REX3's own refresh thread in src/rex3.rs. CyclesPtr is Copy, so the Option no longer needs .as_ref(); .get() is null-safe, and the existing Stop/SyncDisks paths already clear it to None. --- iris-gui/src/handle.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/iris-gui/src/handle.rs b/iris-gui/src/handle.rs index 22e93d8..5d327b4 100644 --- a/iris-gui/src/handle.rs +++ b/iris-gui/src/handle.rs @@ -314,7 +314,7 @@ fn worker_loop( // the delta by wall-clock between ticks. Mirrors the status-bar math in // src/disp.rs, but driven here since the GUI never runs REX3's own // refresh/status-bar loop. `None` until a machine is up. - let mut cycles: Option> = None; + let mut cycles: Option = None; let mut prev_cycles: u64 = 0; let mut prev_tick = std::time::Instant::now(); // Tick cadence for the status poll while idle on the command channel. @@ -323,11 +323,11 @@ fn worker_loop( match cmd_rx.recv_timeout(STATUS_TICK) { // Periodic tick (no command pending): refresh the MIPS estimate. Err(crossbeam_channel::RecvTimeoutError::Timeout) => { - if let Some(c) = &cycles { + if let Some(c) = cycles { let now = std::time::Instant::now(); let dt = now.duration_since(prev_tick).as_secs_f64(); if dt >= 0.1 { - let cur = c.load(std::sync::atomic::Ordering::Relaxed); + let cur = c.get(); let dc = cur.wrapping_sub(prev_cycles); let mips = (dc as f64 / dt / 1_000_000.0 * 10.0).round() as f32 / 10.0; prev_cycles = cur; @@ -406,11 +406,8 @@ fn worker_loop( .into_iter().map(|h| (h.network, h.prefix)).collect()); *ps2_slot.lock() = Some(m.get_ps2()); // Latch REX3's cycle counter for the live MIPS estimate. - cycles = m.get_rex3().map(|r| r.cycles.clone()); - prev_cycles = cycles - .as_ref() - .map(|c| c.load(std::sync::atomic::Ordering::Relaxed)) - .unwrap_or(0); + cycles = m.get_rex3().map(|r| r.cycles.get()); + prev_cycles = cycles.map(|c| c.get()).unwrap_or(0); prev_tick = std::time::Instant::now(); machine = Some(m); let _ = evt_tx.send(Evt::Started);