mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 01:29:42 -06:00
On x86, disabling fastmem isn't enough actually.
Without fastmem, the JIT code still does an inline check for RAM addresses. With watchpoints we have to disable that too. (Hardware watchpoints would avoid all the slow, but be complicated to implement and limited in number - I doubt most people debugging games care much if they run slower.) With this change and watchpoints enabled, Melee runs at no more than 40% speed, despite running at full speed without them. Oh well. Better works slowly than doesn't bloody work. Incidentally, I'm getting an unrelated crash in PowerPC::HostIsRAMAddress when shutting down a game. This code sucks.
This commit is contained in:
@ -90,4 +90,6 @@ void JitBase::UpdateMemoryOptions()
|
||||
!any_watchpoints;
|
||||
jo.memcheck = SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU ||
|
||||
any_watchpoints;
|
||||
jo.alwaysUseMemFuncs = any_watchpoints;
|
||||
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ protected:
|
||||
bool accurateSinglePrecision;
|
||||
bool fastmem;
|
||||
bool memcheck;
|
||||
bool alwaysUseMemFuncs;
|
||||
};
|
||||
struct JitState
|
||||
{
|
||||
|
@ -349,14 +349,17 @@ void EmuCodeBlock::SafeLoadToReg(X64Reg reg_value, const Gen::OpArg & opAddress,
|
||||
LEA(32, RSCRATCH, MDisp(opAddress.GetSimpleReg(), offset));
|
||||
}
|
||||
|
||||
FixupBranch slow, exit;
|
||||
slow = CheckIfSafeAddress(R(reg_value), reg_addr, registersInUse, mem_mask);
|
||||
UnsafeLoadToReg(reg_value, R(reg_addr), accessSize, 0, signExtend);
|
||||
if (farcode.Enabled())
|
||||
SwitchToFarCode();
|
||||
else
|
||||
exit = J(true);
|
||||
SetJumpTarget(slow);
|
||||
FixupBranch exit;
|
||||
if (!jit->jo.alwaysUseMemFuncs)
|
||||
{
|
||||
FixupBranch slow = CheckIfSafeAddress(R(reg_value), reg_addr, registersInUse, mem_mask);
|
||||
UnsafeLoadToReg(reg_value, R(reg_addr), accessSize, 0, signExtend);
|
||||
if (farcode.Enabled())
|
||||
SwitchToFarCode();
|
||||
else
|
||||
exit = J(true);
|
||||
SetJumpTarget(slow);
|
||||
}
|
||||
size_t rsp_alignment = (flags & SAFE_LOADSTORE_NO_PROLOG) ? 8 : 0;
|
||||
ABI_PushRegistersAndAdjustStack(registersInUse, rsp_alignment);
|
||||
switch (accessSize)
|
||||
@ -387,12 +390,15 @@ void EmuCodeBlock::SafeLoadToReg(X64Reg reg_value, const Gen::OpArg & opAddress,
|
||||
MOVZX(64, accessSize, reg_value, R(ABI_RETURN));
|
||||
}
|
||||
|
||||
if (farcode.Enabled())
|
||||
if (!jit->jo.alwaysUseMemFuncs)
|
||||
{
|
||||
exit = J(true);
|
||||
SwitchToNearCode();
|
||||
if (farcode.Enabled())
|
||||
{
|
||||
exit = J(true);
|
||||
SwitchToNearCode();
|
||||
}
|
||||
SetJumpTarget(exit);
|
||||
}
|
||||
SetJumpTarget(exit);
|
||||
}
|
||||
|
||||
static OpArg SwapImmediate(int accessSize, OpArg reg_value)
|
||||
|
Reference in New Issue
Block a user