Files
psxrecomp/docs/internal
Shokunin 7342e6bcd1 emitters: charge an uncached (KSEG1) fetch before every instruction
Beetle's ReadInstruction never fills an I-cache line for a fetch at
0xA0000000 or above: every such fetch costs +4 and clears the pending load
give-back. The dirty-RAM interpreter charges that by fetching at every PC.
Both static emitters emitted psx_icache_fetch only at cache-line leaders,
which is exact for cached code only. In OpenBIOS, 5,477 of the 9,592
in-place ROM (KSEG1) instruction sites were uncharged: 21,908 cycles short
per pass through that code, each also missing its give-back clear.

Both emitters now charge a fetch before every instruction whose runtime PC
is uncached. The predicate is psx_fetch_uncached in psx_instr_cost.h, which
psx_icache.c now uses too. The A0/B0/C0 call-vector native stubs charge one
fetch per executed word, so a KSEG1 call pays like the interpreter. Cached
code keeps the leader rule. R4's regenerated game C is byte-identical, and
the OpenBIOS diff is insertions only. psx_instr_cost.h joins the codegen
hash list, since the emitters fold it into emitted code.

Tests:
- ctest uncached_fetch_charge runs psxrecomp-bios on OpenBIOS and compares
  per-instruction fetch charges three ways: the compiled fetches, the
  interpreter's fetch path (psx_icache_fetch_interp) at every PC, and a
  Beetle transcription.
- uncached_fetch_codegen_test checks the game emitter at KSEG1 and KSEG0.

Both tests fail on master. This closes bios-kseg1-fetch-charge in the
segment_aware_codegen ledger (#419).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 12:27:57 -07:00
..

Internal dev-logs & design notes

These are the working design documents and burn-down logs the project was built from. They are historical/working notes, not contributor onboarding docs — they capture decisions, phased plans, and deep subsystem investigations in the order they happened, and some sections are superseded by later ones.

If you're new here, start with the top-level README.md, then docs/ARCHITECTURE.md, docs/EXECUTION_MODEL.md, docs/BUILDING.md, and CONTRIBUTING.md. Come here when you need the why behind a specific subsystem.

Plans & roadmap

Cycle accuracy & timing

BIOS / scheduler

Renderer / widescreen

Project conventions & tracking

  • PRINCIPLES.md — this repo's debugging and enhancement principles (first-divergence, verified-enhancement HLE). Source comments cite it as docs/internal/PRINCIPLES.md; a "recomp-template PRINCIPLES.md" citation means a different repo's file.
  • ISSUES.md — the historical framework issue log. Live framework work is tracked in Beads (epic beads-eio.3), not here.
  • DEBUG.md — the debugging playbook behind the TCP debug server; the command reference itself is ../TCP_COMMANDS.md.
  • audit_inventory.md — what the codegen/GTE audit pipeline covers and why.

Overlay design & discovery

BIOS / boot hardening

GTE / CPU investigations

Upstream contributor reviews

upstream/ holds per-PR review notes for community contributions, one file per change, named <contributor>-<pr>-<topic>.md.

Overlay cache internals

  • SLJIT_PERSIST_CACHE.md — removed. It described the persisted shard cache of the sljit Tier-2 backend, which was deleted in 5b7e69b4 (2026-07-15). For the current model see runtime/src/overlay_loader.c (per-entry candidate validity), tools/compile_overlays.py (shard formation and the .ranges manifest), and ../COMPILING_OVERLAYS.md.

Removed