Repository navigation
Make the tracing core the only build, with in-wasm classification maps - #54
Merged
Merged
Conversation
trace_access was a wasm->JS import called on every instruction fetch, read, write, and immediate — millions of boundary crossings per emulated second, landing in an empty JS stub. It is now implemented inside the wasm bridge: each access ORs its TraceType flags into one of two classification maps that JS reads as zero-copy Uint8Array views (Minimon.biosTrace / .cartridgeTrace). Two maps, two lifetimes, per the debugger design: the 4KB BIOS map is universal (the BIOS never changes; the front-end will persist it), the 2MB cartridge map dies with the cartridge (cleared on eject). RAM and hardware registers are always data and aren't tracked. With the boundary cost gone there is no reason for a non-tracing build: the dual libminimon.wasm/libminimon.tracing.wasm outputs become a single always-tracing binary, and the .tracing toggle, the binary swap in Minimon.init(), the trace() stub, and the Settings toggle are all removed. The native (harness/libretro) builds still compile without TRACING and are unaffected. This is phase A of the debugger-panel rewrite: the maps feed the code/data/unknown segmentation of the upcoming document model. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 7, 2026
This was referenced Jun 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase A of the debugger-panel rewrite (see the design discussion): classification has to live in the core, and once it does, the dual-build stops earning its keep.
trace_accessmoves into the wasm bridge. It was an env import — a wasm→JS call on every instruction fetch, read, write, and immediate, landing in an empty JS stub. Now each access ORs itsTraceTypeflags into in-core maps; JS reads them as zero-copyUint8Arrayviews (Minimon.biosTrace/.cartridgeTrace).0x1000-0x20FF) are always data and aren't tracked.libminimon.tracing.wasmis gone;libminimon.wasmis always-D TRACING. The.tracingtoggle, binary swap ininit(),trace()stub, and the Settings toggle are all removed. Native harness/libretro builds compile withoutTRACINGand are untouched.Verification
Browser, after 300k BIOS steps: 309 BIOS bytes classified code, 795 data, remainder untouched; the PC's byte carries
INSTRUCTION|IMMEDIATE|BRANCH_TARGET|READ; the cartridge map accumulates BIOS probe reads andeject()zeroes it. Settings shows only the Running toggle; no console errors.make -C core/test checkpasses (nocore/srcchanges — the harness baselines are untouched by construction);npm run check+vite buildclean.Next: PR B (shared UI components), PR C (document model + per-cartridge persistence), PR D (the panel).
🤖 Generated with Claude Code