Files
psxrecomp/runtime/tests/test_interp_refused_game_text.py
Alexandros Mandravillis 67e9b4cf42 interp: keep interpreting through game text that dispatch refuses
When straight-line interpretation reaches a clean page, the interpreter
hands the PC back to static dispatch. If that PC is game text whose live
bytes differ from the boot EXE, dispatch refuses the compiled code and
enters the interpreter again, which hands back one instruction later. A
page of such text cost about a thousand dispatch round trips.

This happens during the retail BIOS intro on profiles whose shell runs
interpreted in RAM (the SCPH5552 profile has no shell seeds). In a game
whose boot EXE later owns that RAM, every shell instruction took the
round trip; on one PAL title the intro ran at 17 fields/s on the host
instead of 42.

Straight-line flow now keeps interpreting while the next PC is game text
that psx_game_text_native_ok() refuses, and re-tests every instruction,
so it hands back at the first PC dispatch accepts.

interp_refused_game_text links the production interpreter into a fixture:
from a dirty page into refused text, it hands back once and dispatch runs
the compiled code at the first accepted page. Before this change the
interpreter returned at the first clean page. A control checks that a
clean page outside game text is still handed back at once.
2026-10-01 09:39:57 +03:00

24 lines
945 B
Python

"""Straight-line interpretation does not hand refused game text back.
Links the production dirty_ram_interp.c (release build, game dispatch on) into
test_interp_refused_game_text.c at -O0 and -O2; every other runtime seam is an
abort() stub (fixture_link.py).
"""
import argparse
import tempfile
from pathlib import Path
from fixture_link import build_and_run
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--cc', default='gcc')
args = parser.parse_args()
here = Path(__file__).resolve().parent
with tempfile.TemporaryDirectory() as root:
for opt in ('-O0', '-O2'):
build_and_run(args.cc, here, here.parent, opt, Path(root),
['dirty_ram_interp.c'], 'test_interp_refused_game_text.c',
defines=('PSX_HAS_GAME_DISPATCH', 'PSX_NO_DEBUG_TOOLS'))
print('PASS: interpretation runs through refused game text (O0/O2)')