PlayAgain 0104: the direct block dispatch, switchable at run time (design J1 item 2). SPDX-License-Identifier: GPL-2.0-or-later Tree: vendor/dolphin (after 0103). What: the fork's patch 0050 tests RunWasmBlock second in ExecuteOneBlock's callback chain (after Interpret) and inlines it, but only with DOLPHIN_WEB_DIRECT_WASM_BLOCK_DISPATCH=1, which its builds set to 0: its 2026-07-14 fixed-scene screens (Kirby versus Link) were "neutral or negative" (commit 05f922bd8d), a speed verdict, not a correctness one. Without it a compiled block is reached after about 13 failed callback compares, through the generic callback call. PA_DIRECT_WASM_BLOCK_DISPATCH (default 1) compiles the arm in whatever the build flag says; the arm tests a flag read once per ExecuteOneBlock call. The state written is the generic path's (the same RunWasmBlock). Switch: ?directdispatch=0 (bit 2 of the cached-interpreter mask, DISABLE polarity, set by 0104-fork). --- a/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp +++ b/Source/Core/Core/PowerPC/CachedInterpreter/CachedInterpreter.cpp @@ -66,6 +66,13 @@ #line 56 #ifndef DOLPHIN_WEB_DIRECT_WASM_BLOCK_DISPATCH #define DOLPHIN_WEB_DIRECT_WASM_BLOCK_DISPATCH 0 +#endif +// PlayAgain 0104: the fork's direct RunWasmBlock arm (patch 0050; its builds pass +// DOLPHIN_WEB_DIRECT_WASM_BLOCK_DISPATCH=0, "neutral or negative" on its Kirby-versus-Link screen, +// 05f922bd8d) compiled in whatever that flag says, as the second test of ExecuteOneBlock's +// callback chain with RunWasmBlock inlined, and switched at run time (?directdispatch=0). +#ifndef PA_DIRECT_WASM_BLOCK_DISPATCH +#define PA_DIRECT_WASM_BLOCK_DISPATCH 1 #endif #ifdef __EMSCRIPTEN__ @@ -79,7 +86,7 @@ #define DOLPHIN_WEB_FAST_BRANCH_INLINE #endif -#if DOLPHIN_WEB_DIRECT_WASM_BLOCK_DISPATCH +#if DOLPHIN_WEB_DIRECT_WASM_BLOCK_DISPATCH || PA_DIRECT_WASM_BLOCK_DISPATCH #define DOLPHIN_WEB_DIRECT_WASM_BLOCK_INLINE __attribute__((always_inline)) #else #define DOLPHIN_WEB_DIRECT_WASM_BLOCK_INLINE @@ -401,7 +408,10 @@ // (and wherever relaxed SIMD is missing or unfused): the plain-f64 path. std::atomic s_fused_madd{false}; -// Bit 2 is unused (patch 0196 removed the helpers bits 1 and 2 gated). +// PlayAgain 0104: DISABLE polarity (default-on; ?directdispatch=0). Set: ExecuteOneBlock reaches +// a compiled block through the generic callback call again (after the hot callbacks' tests), as +// the fork's release builds do (DOLPHIN_WEB_DIRECT_WASM_BLOCK_DISPATCH=0). +constexpr u32 DOLPHIN_WEB_DISABLE_PA_DIRECT_DISPATCH = 1u << 2; // PlayAgain 0103: DISABLE polarity (default-on; ?mem2inline=0). Set: MEM2 (the Wii's 64 MiB) is // reached only through the MMU helpers again, as before 0103 (compiled code and the C++ paths // of the blocks too short to compile alike). @@ -11087,6 +11097,8 @@ const bool redispatch_enabled = allow_redispatch && !DolphinWebHelperDisabled(DOLPHIN_WEB_DISABLE_BLOCK_REDISPATCH) && !s_ppc_block_profile_enabled; + // PlayAgain 0104: the direct arm for compiled blocks, read once per call. + const bool direct_wasm_block = !DolphinWebHelperDisabled(DOLPHIN_WEB_DISABLE_PA_DIRECT_DISPATCH); #endif #ifdef __EMSCRIPTEN__ bool profile_block = false; @@ -11129,8 +11141,8 @@ Interpret(ppc_state, *reinterpret_cast(payload)); normal_entry = payload + sizeof(InterpretOperands); } -#if DOLPHIN_WEB_DIRECT_WASM_BLOCK_DISPATCH - else if (callback == AnyCallbackCast(RunWasmBlock)) +#if defined(__EMSCRIPTEN__) && (DOLPHIN_WEB_DIRECT_WASM_BLOCK_DISPATCH || PA_DIRECT_WASM_BLOCK_DISPATCH) + else if (direct_wasm_block && callback == AnyCallbackCast(RunWasmBlock)) { if (const auto distance = RunWasmBlock(ppc_state, *reinterpret_cast(payload)))