mirror of
https://github.com/ARMSX2/ARMSX2.git
synced 2026-08-24 16:50:16 -07:00
Merges yaps2/main (github.com/yaps2/yaps2,c16b88cb7) into ARMSX2, replacing the arm64 recompiler family with the yaps2 JITs and importing the yaps2 testing, perf, and libretro infrastructure. Common ancestor is upstream PCSX2342db5152(2026-06-19); git auto-merged all but 38 files. Replaced (deleted in this merge, recoverable from history): - arm64/aR5900*, aR3000A*, aVU* -> arm64/iR5900*/iR3000A*/microVU*-arm64: EE static-pin register file with lazy dirty tracking, dual-residence allocator, IOP block linking, native COP2 macro ops, inline unaligned fastmem, persisted VU program cache, call-ret shadow ring, VU0 spin fast-forward. - MVU_DIFF shadow-run hooks in shared VU interpreter TUs (superseded by the offline vurunner JIT-vs-interp oracle). Imported from yaps2: - tests/ctest/core/recompilers: ~80 gtest suites (EE/IOP/VU differential harnesses, fuzzers, ABI digest tripwire, capture format pins) plus the gs_vertex_tests kernel oracle. - pcsx2-vurunner / pcsx2-eerunner headless capture-replay runners. - tools/perf counter-based A/B rigs, perf jitdump productionization, PmuCounters, clang-perf/clang-handheld presets. - pcsx2-libretro core (ENABLE_LIBRETRO, default OFF; rename pending). - GS vertex-kick fast path (GV series): TBL-based packed parse, register-resident kick, scalar-outcode cull, fused draw-rect/FindMinMax. - Null renderer, VK_KHR_display direct WSI, swapchain PresentStats. - SPU2 NEON mixer vectorization, EE timer read clamp (NFL 2K5 hang), IOP ioman signed-compare fix, assorted UB fixes. Kept from ARMSX2 in the both-touched files: - iOS dual-map W^X and fastmem-unavailable resilience (Memory, HostSys, vtlb). The split data/code area model is retained; both areas now take fixed VA hints so cached VU JIT code stays deterministic on Linux. - Android thread-affinity model, VMState shutdown early-outs, all platform frontends, branding, CI, RetroAchievements identity/policy. - GSDeviceVK: ARMSX2's push-descriptor decision logic (Mali crash gate, proprietary-vs-turnip Adreno split) merged with yaps2's descriptor-pool exhaustion recovery (flush + render-pass restart instead of dropped binds). Vendor feature policy is the union: Mali fbfetch policy with MediaTek/G57/Xclipse gates from ARMSX2; Adreno stencil/ROV/ test-and-sample-depth hang avoidance and no_ps2_z_quantization from yaps2. Build-system notes: - The Qt debugger is now gated behind ENABLE_QT_DEBUGGER (default off on arm64) so handheld builds drop the KDDockWidgets dependency. - GSDeviceNone and remaining yaps2 GS code were ported to the newer upstream GSTexture Usage-flags API. The replaced backend's interpreter-fallback glue (intExecuteOneInst, AndroidEEOpHist) and the EEDiffVerify runtime differ are retained for now; dead pieces will be removed in a follow-up commit.
45 lines
1.7 KiB
C++
45 lines
1.7 KiB
C++
// SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team
|
|
// SPDX-License-Identifier: GPL-3.0+
|
|
|
|
#pragma once
|
|
#include "Pcsx2Defs.h"
|
|
#include <cstdint>
|
|
#include <cstddef>
|
|
|
|
struct fastjmp_buf
|
|
{
|
|
#if defined(_WIN32)
|
|
static constexpr std::size_t BUF_SIZE = 240;
|
|
#elif defined(ARCH_ARM64)
|
|
static constexpr std::size_t BUF_SIZE = 168;
|
|
#else
|
|
static constexpr std::size_t BUF_SIZE = 64;
|
|
#endif
|
|
|
|
alignas(16) std::uint8_t buf[BUF_SIZE];
|
|
};
|
|
|
|
// fastjmp_set can "return twice" (once normally with 0, and again via fastjmp_jmp with the
|
|
// passed value), exactly like setjmp. It MUST be marked returns_twice so the compiler does
|
|
// not optimize the calling function assuming the code after the call runs only once — most
|
|
// importantly, so it does not tail-call-optimize a subsequent call (which would deallocate
|
|
// the caller's frame that fastjmp_set captured the SP of, leaving fastjmp_jmp to restore a
|
|
// frame whose saved registers have since been clobbered).
|
|
#if defined(__GNUC__) || defined(__clang__)
|
|
#define FASTJMP_RETURNS_TWICE __attribute__((returns_twice))
|
|
#else
|
|
#define FASTJMP_RETURNS_TWICE
|
|
#endif
|
|
|
|
extern "C" {
|
|
// returns_twice is load-bearing: without it the optimizer may pop the
|
|
// caller's frame and tail-call the code reached after fastjmp_set returns
|
|
// (observed with clang LTO inlining execI into intStep), leaving the armed
|
|
// jmp_buf's saved SP pointing into a successor's live frame — fastjmp_jmp
|
|
// then resumes on a clobbered stack and the caller returns into garbage.
|
|
// The attribute (same contract as setjmp) pins the frame and disables
|
|
// tail-call/value-caching transforms across the call.
|
|
FASTJMP_RETURNS_TWICE int fastjmp_set(fastjmp_buf* buf);
|
|
__noreturn void fastjmp_jmp(const fastjmp_buf* buf, int ret);
|
|
}
|