Files
psxrecomp/runtime/src/code_provider.c
T
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

51 lines
2.4 KiB
C

/* code_provider.c — the CodeProvider implementation + active selection.
* See code_provider.h for the abstraction.
*
* The "spawn compiler" provider is a thin pass-through over the validated
* autocompile_* path (compile emitted overlay C to a DLL and load it); it backs
* BOTH the gcc and tcc tiers, which differ only in which compiler the pipeline
* invokes. Which behavior is active is decided once at init by
* overlay_backend_resolve() in overlay_backend.c (env PSX_OVERLAY_BACKEND >
* [runtime] overlay_backend > auto). The auto tier order is:
* static -> gcc (if gcc on PATH) -> tcc (bundled toolchain-free fallback).
* (The in-process sljit JIT provider was removed 2026-07-15; overlay gaps fall
* to the interpreter.) */
#include <stddef.h>
#include "code_provider.h"
#include "autocompile.h"
#include "overlay_backend.h"
/* ---- gcc provider: pass-through to the validated spawn->DLL->rescan path --- */
/* The hook signatures match autocompile_* exactly, so we point straight at
* them — no wrappers, no behavior change. compile_fragment stays NULL: a
* compiler spawn is orders of magnitude too slow for the dispatch path, so gcc
* never produces a fragment synchronously (it self-improves via the batch path
* + autocapture instead). */
static const CodeProvider s_gcc = {
/* name */ "gcc",
/* available */ autocompile_configured,
/* request */ autocompile_request,
/* busy */ autocompile_busy,
/* poll_main */ autocompile_poll_main,
};
/* ---- active selection ------------------------------------------------------ */
/* Default to gcc so any caller before code_provider_init() (there should be
* none — init runs at overlay-cache setup) gets the proven path. */
static const CodeProvider *s_active = &s_gcc;
void code_provider_init(const char *cfg_backend, int gcc_configured) {
/* overlay_backend_resolve resolves AUTO to GCC or TCC (never AUTO). Both the
* gcc and tcc tiers are the same spawn-a-compiler->DLL->rescan provider
* (the actual compiler is whatever overlay_autocompile_cmd runs, selected in
* main.cpp by the resolved backend), so there is a single provider now. The
* call still runs for its side effect of logging the resolved backend
* (surfaced via the overlay_status debug command). */
(void)overlay_backend_resolve(cfg_backend, gcc_configured);
s_active = &s_gcc;
}
const CodeProvider *code_provider_active(void) { return s_active; }