remove the YAPS2_* environment-variable knobs

Eight testing-only env gates shipped in release builds, against the project's
own rule that env-var gates are scaffolding:

  YAPS2_EESB / _LO / _HI   offline A/B bisection of EE superblock formation,
                           self-labelled "Not a production knob"
  YAPS2_EESB_DUMP          emitted-host-code dump for the same bisection
  YAPS2_NULL_GS            libretro M1 headless-renderer fallback (two sites:
                           the renderer seed and the s_hw_render_vulkan gate --
                           removing only one leaves an inconsistent pairing)
  YAPS2_RUN_SLEEP          M2 bring-up pacing sleep in retro_run
  YAPS2_PERF_LOG           M1/M2 bring-up speed probe

Deletes the knobs and their now-dead branches. eeScanContinuable loses its
famBit parameter, which existed only to feed the bisect mask; the libretro core
now always takes the Vulkan path.

recompiler_tests 1407/1407.
This commit is contained in:
Brian Degenhardt
2026-07-21 21:47:45 -07:00
parent 4637de4d6e
commit 1bbe9225a1
2 changed files with 10 additions and 72 deletions
+7 -23
View File
@@ -208,14 +208,12 @@ bool LibretroCore::InitializeConfig()
if (FileSystem::FileExists(secrets_path.c_str()))
s_secrets_settings->Load();
// Libretro-core overrides. Default is the shared-context Vulkan renderer
// (M2); YAPS2_NULL_GS=1 falls back to the headless Null renderer (the M1
// smoke-test mode). SDL input/audio will be replaced by the libretro
// paths in M3.
// Libretro-core overrides: the shared-context Vulkan renderer, and SDL
// input/audio replaced by the libretro paths.
{
auto lock = Host::GetSettingsLock();
s_base_settings->SetIntValue("EmuCore/GS", "Renderer",
static_cast<int>(getenv("YAPS2_NULL_GS") ? GSRendererType::Null : GSRendererType::VK));
static_cast<int>(GSRendererType::VK));
s_base_settings->SetBoolValue("InputSources", "SDL", false);
// Audio goes out through retro_run pulling the stream ring; the Null
// backend keeps SPU2 mixing into the ring with no device thread.
@@ -1483,10 +1481,10 @@ RETRO_API bool retro_load_game(const struct retro_game_info* game)
s_shutdown_requested.store(false, std::memory_order_release);
// Vulkan HW render (unless the Null fallback is forced). The negotiation
// interface must be registered inside retro_load_game; the frontend
// invokes it while creating its Vulkan context, after this returns.
LibretroCore::s_hw_render_vulkan = !getenv("YAPS2_NULL_GS");
// Vulkan HW render. The negotiation interface must be registered inside
// retro_load_game; the frontend invokes it while creating its Vulkan
// context, after this returns.
LibretroCore::s_hw_render_vulkan = true;
if (LibretroCore::s_hw_render_vulkan)
{
static struct retro_hw_render_callback hw_render = {};
@@ -1584,11 +1582,6 @@ RETRO_API void retro_run(void)
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &options_updated) && options_updated)
ApplyCoreOptions(false);
// TEMP (M2 bring-up): pace headless harness runs so the free-running VM
// gets wall-clock time to boot.
if (getenv("YAPS2_RUN_SLEEP"))
std::this_thread::sleep_for(std::chrono::milliseconds(16));
// M3 input: forward the libretro joypad straight into the DualShock2
// bind slots (bypasses InputManager entirely).
if (VMManager::HasValidVM())
@@ -1709,15 +1702,6 @@ RETRO_API void retro_run(void)
}
}
// Bring-up diagnostics (YAPS2_PERF_LOG=1): internal speed probe.
if (getenv("YAPS2_PERF_LOG"))
{
static u32 run_count = 0;
if ((++run_count % 600) == 0)
std::fprintf(stderr, "[libretro] perf: fps=%.1f speed=%.0f%%\n",
PerformanceMetrics::GetFPS(), PerformanceMetrics::GetSpeed());
}
// M3 audio: drain whatever SPU2 mixed since the last retro_run out of the
// (null-backend) stream ring and hand it to the frontend.
if (AudioStream* stream = SPU2::GetOutputStream())
+3 -49
View File
@@ -3145,31 +3145,8 @@ static bool eeScanInsnIsBranchClass(u32 code)
// Scanner-side continuation gate for a conditional branch at `i` targeting
// `target`. Forward-only (backward keeps the split/end logic), bounded, and
// refuses a branch-class delay slot.
static bool eeScanContinuable(u32 startpc, u32 i, u32 target, u32 famBit)
static bool eeScanContinuable(u32 startpc, u32 i, u32 target)
{
// Testing-only kill switch (offline A/B bisection of superblock formation):
// YAPS2_EESB is a bitmask of continuation-site families — bit0 BEQ/BNE,
// bit1 BLEZ/BGTZ, bit2 REGIMM BLTZ/BGEZ. Unset = all on; 0 = all off
// (reverts block formation to the pre-superblock shape without a rebuild).
// Not a production knob.
static const u32 s_sitesMask = []() -> u32 {
const char* e = std::getenv("YAPS2_EESB");
return e ? static_cast<u32>(std::atoi(e)) : 0xffu;
}();
if (!(s_sitesMask & famBit))
return false;
// Optional guest-pc window (hex), same offline-bisection purpose: only
// branches inside [YAPS2_EESB_LO, YAPS2_EESB_HI) become sites.
static const u32 s_siteLo = []() -> u32 {
const char* e = std::getenv("YAPS2_EESB_LO");
return e ? static_cast<u32>(std::strtoul(e, nullptr, 16)) : 0u;
}();
static const u32 s_siteHi = []() -> u32 {
const char* e = std::getenv("YAPS2_EESB_HI");
return e ? static_cast<u32>(std::strtoul(e, nullptr, 16)) : 0xffffffffu;
}();
if (i < s_siteLo || i >= s_siteHi)
return false;
return target > i + 4 &&
s_numContSites < kMaxContSites &&
((i + 8 - startpc) / 4) < kMaxSuperblockInsns &&
@@ -3473,7 +3450,7 @@ static void recRecompile(const u32 startpc)
// SL-03: forward BLTZ/BGEZ (rt 0/1) become continuation
// sites — scan on at the fallthrough. Likely + AL forms
// keep ending the block.
if (_Rt_ < 2 && eeScanContinuable(startpc, i, _Imm_ * 4 + i + 4, 4u))
if (_Rt_ < 2 && eeScanContinuable(startpc, i, _Imm_ * 4 + i + 4))
{
s_contSitePcs[s_numContSites++] = i;
i += 8; // skip the delay slot word in the scan
@@ -3506,8 +3483,7 @@ static void recRecompile(const u32 startpc)
// idiom (always taken: everything after is unreachable on the
// fallthrough) and keeps ending the block.
if (!((cpuRegs.code >> 26) == 4 && _Rs_ == _Rt_) &&
eeScanContinuable(startpc, i, _Imm_ * 4 + i + 4,
(cpuRegs.code >> 26) < 6 ? 1u : 2u))
eeScanContinuable(startpc, i, _Imm_ * 4 + i + 4))
{
s_contSitePcs[s_numContSites++] = i;
i += 8; // skip the delay slot word in the scan
@@ -3953,30 +3929,8 @@ StartRecomp:
// SL-10: outline the side-exit bodies into the cold arena and patch the
// islands. Runs as its own emission session so the bodies land outside
// the hot compile-order stream.
const u8* coldDumpStart = s_coldPtr;
recEmitColdSideExits();
// Testing-only: YAPS2_EESB_DUMP=<hex guest pc> dumps the emitted host code
// (including the literal pool, post-finalize so offsets are patched) of any
// block whose guest range covers that pc (offline bisection aid).
{
static const u32 s_dumpPc = []() -> u32 {
const char* e = std::getenv("YAPS2_EESB_DUMP");
return e ? static_cast<u32>(std::strtoul(e, nullptr, 16)) : 0u;
}();
if (s_dumpPc && startpc <= s_dumpPc && s_dumpPc < s_nEndBlock)
{
fprintf(stderr, "EESB_DUMP: block %08x..%08x fnptr=%p size=%u endptr=%p sites=%d cold=%p+%u\n",
startpc, s_nEndBlock, (void*)s_pCurBlockEx->fnptr, s_pCurBlockEx->x86size,
(void*)recPtr, s_numContSites,
(void*)coldDumpStart, static_cast<u32>(s_coldPtr - coldDumpStart));
armDisassembleAndDumpCode((void*)s_pCurBlockEx->fnptr,
static_cast<size_t>((uptr)recPtr - (uptr)s_pCurBlockEx->fnptr));
if (s_coldPtr != coldDumpStart)
armDisassembleAndDumpCode(coldDumpStart, static_cast<size_t>(s_coldPtr - coldDumpStart));
}
}
pxAssert((g_cpuHasConstReg & g_cpuFlushedConstReg) == g_cpuHasConstReg);
s_pCurBlock = NULL;