From b31b4612e91d04607e43a3ee076727c113d20fb8 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Mon, 4 Aug 2025 13:13:18 -0700 Subject: [PATCH] pre-emptive thread register cache updating on ctrl thread - cache reading/updating on ui thread should always be allowed to gracefully fail, since it is literally impossible on linux, but we can always rely on the ctrl thread to pipe the right thing through eventually. --- src/ctrl/ctrl_core.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/ctrl/ctrl_core.c b/src/ctrl/ctrl_core.c index 345b8601..2415dc36 100644 --- a/src/ctrl/ctrl_core.c +++ b/src/ctrl/ctrl_core.c @@ -3867,6 +3867,22 @@ ctrl_thread__entry_point(void *p) ins_atomic_u64_inc_eval(&ctrl_state->mem_gen); ins_atomic_u64_inc_eval(&ctrl_state->reg_gen); + //- rjf: update thread register cache + ProfScope("update thread register cache") + { + CTRL_EntityCtx *entity_ctx = &ctrl_state->ctrl_thread_entity_store->ctx; + CTRL_EntityArray threads = ctrl_entity_array_from_kind(entity_ctx, CTRL_EntityKind_Thread); + REGS_RegBlockX64 *blocks = push_array(scratch.arena, REGS_RegBlockX64, threads.count); + { + for EachIndex(idx, threads.count) + { + Temp scratch = scratch_begin(0, 0); + ctrl_reg_block_from_thread(scratch.arena, entity_ctx, threads.v[idx]->handle); + scratch_end(scratch); + } + } + } + //- rjf: gather & output logs ctrl_thread__end_and_flush_log(); }