Files
psxrecomp/runtime/include/code_provider.h
Matthew Stanley 5b7e69b441 Remove the sljit Tier-2 in-process JIT backend
The tier mis-compiled and has been hard-gated off since 2026-06-25; overlay
gaps fall to gcc/tcc shards and the dirty-RAM interpreter, unchanged.

Re-do on master of the removal validated on the stale branch (6da8c02),
reconciled with everything master grew since the fork:

- Delete overlay_sljit.{c,h}, overlay_compile_worker.{c,h}, lib/sljit,
  runtime/tests/sljit_*.c, and the runtime.cmake sources/include-dirs.
- Strip the sljit provider/backend from code_provider.{c,h},
  overlay_backend.{c,h} ("sljit" in overlay_backend/PSX_OVERLAY_BACKEND now
  degrades to auto so stale configs still boot), main.cpp, debug_server.c
  (sljit_status/sljit_async/sljit_try TCP commands), overlay_loader.{c,h}
  (live policy, JIT-on-miss, persisted-shard cache, async worker glue,
  psx_sljit_call/cop2/memx host helpers — reachable only via the removed
  cpu->sljit_helpers table), and cpu_state.h (SLJIT_HLP_* enum + the
  sljit_helpers[] member; CPUState layout change reshards via the cg tag).
- Master-only entanglement resolved before deletion: 28165d6's Einhander WS
  player-X bound emit existed in three paths (gcc code_generator, sljit,
  dirty_ram_interp). The gcc shard link contract now forwards
  psx_ws_player_x_bound (ABI v13, previous commit), so deleting the sljit
  emit path loses no widescreen behavior; ffc6688's game-dispatch block
  inside the dead psx_sljit_call helper goes with it.
- Reword comments that described sljit as a live backend (gpu.{c,h},
  ws_*_detect.h, cosim_state.c, dirty_ram_interp.c, autocompile.h,
  boot_state.h, config_loader.h, compile_overlays.py, and the CPS marker
  comments the recompiler emits).

recompiler psxrecomp-game builds clean; game runtimes rebuilt + boot-verified
separately.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 22:22:38 -07:00

62 lines
2.6 KiB
C

/* code_provider.h — the backend-agnostic code-production seam.
*
* One interface the overlay capture/dispatch spine talks to instead of calling
* a specific backend directly. The validated gcc/tcc spawn->DLL->rescan path is
* its implementation. Everything that makes overlays correct — content-keyed
* multi-candidate dispatch, per-call live-byte validation, the self-mod
* blacklist, the coverage manifest — is backend-blind.
*
* Production is BATCH / ASYNC (request / busy / poll_main): kicked by the
* autocapture tick, spawns a compiler off-thread, applied later via a cache
* rescan on the emu thread. Seconds of latency; many fragments per run. A
* provider sets the hooks it supports and leaves the rest NULL; callers
* null-check before invoking.
*
* (The in-process sljit JIT provider — a synchronous on-miss producer with a
* compile_fragment hook — was removed 2026-07-15; it had been disabled by
* default since 2026-06-25 due to an emitter bug. Gaps gcc/tcc have not yet
* covered fall to the interpreter, the always-safe precision-over-recall floor.)
*/
#ifndef PSXRECOMP_CODE_PROVIDER_H
#define PSXRECOMP_CODE_PROVIDER_H
#include "cpu_state.h"
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Native shard ABI — identical to overlay_loader's OverlayFn. */
typedef void (*CodeProviderFn)(CPUState *);
typedef struct CodeProvider {
const char *name; /* "gcc" (spawns gcc OR tcc) */
int (*available)(void); /* a compile cmd is configured */
/* Batch/async production (autocapture-driven). request() returns 1 if a
* compile was started. busy() is 1 while one is in flight. poll_main() runs
* on the emu thread to apply a finished compile (cache rescan). Any may be
* NULL on a provider that does not do batch production. */
int (*request)(void);
int (*busy)(void);
void (*poll_main)(void);
} CodeProvider;
/* Resolve the active backend (overlay_backend_resolve) and cache the matching
* provider. cfg_backend = [runtime] overlay_backend ("auto"|"gcc"|"tcc"|
* "auto-no-gcc", may be NULL/empty for auto); gcc_configured =
* autocompile_configured(). Call once at overlay-cache init, on the emu thread,
* before the run loop starts. */
void code_provider_init(const char *cfg_backend, int gcc_configured);
/* The active/primary provider (owns the batch path + default selection). Never
* NULL — defaults to the gcc provider before code_provider_init() runs. */
const CodeProvider *code_provider_active(void);
#ifdef __cplusplus
}
#endif
#endif /* PSXRECOMP_CODE_PROVIDER_H */