mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-28 19:07:47 -04:00
5589966161
Prerequisite for persisting sljit shards to disk (SLJIT_PERSIST_CACHE.md). The JIT baked absolute host-helper pointers as SLJIT_IMM operands at three sites (emit_helper2: memx/cop2; emit_ws_cull; PEND_CALL: call), so a shard serialized in one process would call stale addresses when reloaded at a different ASLR base. Route all four helpers (SLJIT_HLP_MEMX/COP2/WS_CULL/CALL) through a cpu-relative table CPUState.sljit_helpers[], loaded via MEM1(R_CPU)[offset] instead of a baked immediate, so serialized LIR holds zero absolute host addresses. The table is appended at the END of CPUState (existing gcc overlay-DLL field offsets stay put) and populated once at startup (overlay_sljit_init_helpers). In-session JIT is unchanged behaviourally (one extra indirection per helper call). Smoke-tested: forced sljit with the gcc cache moved aside, 12 shards JIT'd and ran, title renders, no crash. Broader playtest folds into the Stage 2 reload test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>