mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-27 10:38:46 -04:00
7793bf5ac8
The dispatch path re-CRC32'd a native overlay function's ENTIRE code body on every single call (cand_crc, unconditional) before running it -- a real tax on hot per-frame code that blunted the native win. The page-generation counter that could make this a cheap skip existed but was demoted to a diagnostic. Promote it: a watched-page write is the ONLY way an entry's code can change, and every CPU/DMA store funnels through the store chokepoint which bumps overlay_page_gen for watched pages. So if the page-generation sum is unchanged since this entry was last confirmed VALID, the bytes are provably unchanged -> run native WITHOUT re-hashing. Fall back to the full crc32 only when the gen moved or the entry isn't known-valid (this also re-confirms reload-on-return, since write-away-then-back bumps the gen). Applied to both the main candidate chain and the CPS continuation re-entry path. Correctness identical to the old unconditional hash; only redundant hashing is cut. New gen_fastpath counter exposed in the overlay status. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>