mirror of
https://github.com/libretro/parallel-ps2.git
synced 2026-11-10 17:26:34 -10:00
Two related removals, and one optimisation that fell out of the second.
The cursor accessors go. xGetPtr(), xSetPtr() and
xGetAlignedCallTarget() were macros over x86Ptr, kept -- per their own
comment -- against a future change of storage scheme that never came
in fifteen years; xGetAlignedCallTarget() did no alignment at all, it
was the cursor under a misleading name. 23 files now read and assign
x86Ptr directly.
legacy_instructions.h goes with them. Its jump half (J8Rel/J32Rel and
the JE8/JMP32/... macros over them, plus x86SetJ8/J32/J32A) duplicated
what the C89 core already does with xe_fwd_jcc8/32 and xe_fwd_set8/32:
145 call sites across iFPU, iFPUd, iMMI, iR5900Branch, iR3000Atables
and iR3000A convert mechanically. Its SSE half -- eight
SSE*_XMM_to_XMM wrappers -- had exact xe_* equivalents already, same
prefix and opcode.
Four things needed more than a rename, and they are the reason this is
one commit rather than a sed:
* x86SetJ32A padded to a 16-byte boundary with NOPs before patching.
The core had no equivalent, so xe_fwd_set32_aligned is new rather
than the alignment being quietly dropped.
* The branch bookkeeping was typed u32* because the legacy API
returned that; the C89 slot is e_u8*. recDoBranchImm's signature,
recSetBranchEQ/L's returns, _setupBranchTest's function-pointer
parameter (now a Jcc code) and ~20 locals follow.
* JNS8 mapped to a condition the enum does not spell: there is no
Jcc_NotSigned, the member is Jcc_Unsigned = 0x9. Mapped explicitly
with a comment, since it reads like a typo otherwise.
* The SSE wrappers were stored in function-pointer tables
(recComOpXMM_to_XMM in iFPU, recFPUOpXMM_to_XMM in iFPUd). Macros
have no address, so the tables become switches -- and since op is
a constant at every call site, that removes an indirect call from
the recompiler's emit path and lets the emission inline. That is
the optimisation: the tables were costing a call to save nothing.
tests/emitter/newbind.cpp oracled the eight C wrappers; it now oracles
the macros the recompilers actually call, which is the better test
anyway, and the reference tree drops its include of the deleted
header.
Verification: gates 36/36 in both configurations, byte suites green
(95,692 + 112,118 + 27,337, zero divergent -- the newbind figure is
unchanged because the same 8x16x16 cases are still covered, through
the macros now), Tekken and the 2048 ELF clean at 3000 real-BIOS
frames, and all four JIT region hashes identical to the previous
build. 145 jump sites and two dispatch tables rewritten with no
change to a single emitted byte.