mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-18 11:54:30 +01:00
Each block was a call into IRInterpret from RunBlocks: register save and restore, the first dispatch through the shared switch, then the shadow lookup in RunBlocks. Now the exits look up the next block themselves and keep dispatching while downcount lasts, the same check RunBlocks makes. Anything else (a hook, an uncompiled block, an invalid address, downcount gone) still returns. Without the vertex JIT, as on iOS: 4.5-10% fewer instructions and 1-4% fewer cycles in the games measured. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
33 lines
893 B
C++
33 lines
893 B
C++
#pragma once
|
|
|
|
#include "Common/CommonTypes.h"
|
|
#include "Core/Core.h"
|
|
#include "Core/MemMap.h"
|
|
|
|
class MIPSState;
|
|
struct IRInst;
|
|
|
|
u32 IRRunBreakpoint(u32 pc);
|
|
u32 IRRunMemCheck(u32 pc, u32 addr);
|
|
|
|
template <uint32_t alignment>
|
|
u32 RunValidateAddress(u32 pc, u32 addr, u32 isWrite) {
|
|
static_assert(alignment <= 16);
|
|
const auto toss = [&](MemoryExceptionType t) {
|
|
Core_MemoryException(addr, alignment, pc, t);
|
|
return coreState != CORE_RUNNING_CPU ? 1 : 0;
|
|
};
|
|
|
|
if (!Memory::IsValidNAlignedAddress<alignment>(addr)) {
|
|
MemoryExceptionType t = isWrite == 1 ? MemoryExceptionType::WRITE_WORD : MemoryExceptionType::READ_WORD;
|
|
if constexpr (alignment > 4)
|
|
t = isWrite ? MemoryExceptionType::WRITE_BLOCK : MemoryExceptionType::READ_BLOCK;
|
|
return toss(t);
|
|
}
|
|
|
|
if constexpr (alignment > 1)
|
|
if ((addr & (alignment - 1)) != 0)
|
|
return toss(MemoryExceptionType::ALIGNMENT);
|
|
return 0;
|
|
}
|