Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #122 from lioncash/rename-default
Rename the JIT function Default() to FallBackToInterpreter(). Communicates intent way better in terms of telling the reader what's going on.
  • Loading branch information
Parlane committed Mar 5, 2014
2 parents 8557e96 + 34b5a78 commit e5b250f
Show file tree
Hide file tree
Showing 40 changed files with 1,774 additions and 1,338 deletions.
4 changes: 2 additions & 2 deletions Source/Core/Core/PowerPC/Jit64/Jit.cpp
Expand Up @@ -199,7 +199,7 @@ void Jit64::Shutdown()
asm_routines.Shutdown();
}

// This is only called by Default() in this file. It will execute an instruction with the interpreter functions.
// This is only called by FallBackToInterpreter() in this file. It will execute an instruction with the interpreter functions.
void Jit64::WriteCallInterpreter(UGeckoInstruction inst)
{
gpr.Flush(FLUSH_ALL);
Expand All @@ -218,7 +218,7 @@ void Jit64::unknown_instruction(UGeckoInstruction inst)
PanicAlert("unknown_instruction %08x - Fix me ;)", inst.hex);
}

void Jit64::Default(UGeckoInstruction _inst)
void Jit64::FallBackToInterpreter(UGeckoInstruction _inst)
{
WriteCallInterpreter(_inst.hex);
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/PowerPC/Jit64/Jit.h
Expand Up @@ -113,7 +113,7 @@ class Jit64 : public Jitx86Base

// OPCODES
void unknown_instruction(UGeckoInstruction _inst);
void Default(UGeckoInstruction _inst);
void FallBackToInterpreter(UGeckoInstruction _inst);
void DoNothing(UGeckoInstruction _inst);
void HLEFunction(UGeckoInstruction _inst);

Expand Down
526 changes: 263 additions & 263 deletions Source/Core/Core/PowerPC/Jit64/Jit64_Tables.cpp

Large diffs are not rendered by default.

71 changes: 46 additions & 25 deletions Source/Core/Core/PowerPC/Jit64/Jit_FloatingPoint.cpp
Expand Up @@ -75,13 +75,18 @@ void Jit64::fp_arith(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITFloatingPointOff)
if (inst.Rc) {
Default(inst); return;

if (inst.Rc)
{
FallBackToInterpreter(inst);
return;
}

// Only the interpreter has "proper" support for (some) FP flags
if (inst.SUBOP5 == 25 && Core::g_CoreStartupParameter.bEnableFPRF) {
Default(inst); return;
if (inst.SUBOP5 == 25 && Core::g_CoreStartupParameter.bEnableFPRF)
{
FallBackToInterpreter(inst);
return;
}

bool single = inst.OPCD == 59;
Expand All @@ -98,29 +103,35 @@ void Jit64::fp_arith(UGeckoInstruction inst)

void Jit64::frsqrtex(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITFloatingPointOff)
int d = inst.FD;
int b = inst.FB;
fpr.Lock(b, d);
fpr.BindToRegister(d, true, true);
MOVSD(XMM0, M((void *)&one_const));
SQRTSD(XMM1, fpr.R(b));
DIVSD(XMM0, R(XMM1));
MOVSD(fpr.R(d), XMM0);
fpr.UnlockAll();
INSTRUCTION_START
JITDISABLE(bJITFloatingPointOff)
int d = inst.FD;
int b = inst.FB;
fpr.Lock(b, d);
fpr.BindToRegister(d, true, true);
MOVSD(XMM0, M((void *)&one_const));
SQRTSD(XMM1, fpr.R(b));
DIVSD(XMM0, R(XMM1));
MOVSD(fpr.R(d), XMM0);
fpr.UnlockAll();
}

void Jit64::fmaddXX(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITFloatingPointOff)
if (inst.Rc) {
Default(inst); return;

if (inst.Rc)
{
FallBackToInterpreter(inst);
return;
}

// Only the interpreter has "proper" support for (some) FP flags
if (inst.SUBOP5 == 29 && Core::g_CoreStartupParameter.bEnableFPRF) {
Default(inst); return;
if (inst.SUBOP5 == 29 && Core::g_CoreStartupParameter.bEnableFPRF)
{
FallBackToInterpreter(inst);
return;
}

bool single_precision = inst.OPCD == 59;
Expand Down Expand Up @@ -172,8 +183,11 @@ void Jit64::fsign(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITFloatingPointOff)
if (inst.Rc) {
Default(inst); return;

if (inst.Rc)
{
FallBackToInterpreter(inst);
return;
}

int d = inst.FD;
Expand Down Expand Up @@ -203,9 +217,13 @@ void Jit64::fmrx(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITFloatingPointOff)
if (inst.Rc) {
Default(inst); return;

if (inst.Rc)
{
FallBackToInterpreter(inst);
return;
}

int d = inst.FD;
int b = inst.FB;
fpr.Lock(b, d);
Expand All @@ -219,8 +237,11 @@ void Jit64::fcmpx(UGeckoInstruction inst)
{
INSTRUCTION_START
JITDISABLE(bJITFloatingPointOff)
if (jo.fpAccurateFcmp) {
Default(inst); return; // turn off from debugger

if (jo.fpAccurateFcmp)
{
FallBackToInterpreter(inst); // turn off from debugger
return;
}

//bool ordered = inst.SUBOP10 == 32;
Expand Down
12 changes: 9 additions & 3 deletions Source/Core/Core/PowerPC/Jit64/Jit_Integer.cpp
Expand Up @@ -296,7 +296,7 @@ void Jit64::reg_imm(UGeckoInstruction inst)
case 12: regimmop(d, a, false, (u32)(s32)inst.SIMM_16, Add, &XEmitter::ADD, false, true); break; //addic
case 13: regimmop(d, a, true, (u32)(s32)inst.SIMM_16, Add, &XEmitter::ADD, true, true); break; //addic_rc
default:
Default(inst);
FallBackToInterpreter(inst);
break;
}
}
Expand Down Expand Up @@ -2111,15 +2111,21 @@ void Jit64::srawix(UGeckoInstruction inst)
}
else
{
Default(inst); return; // FIXME
// FIXME
FallBackToInterpreter(inst);
return;

gpr.Lock(a, s);
JitClearCA();
gpr.BindToRegister(a, a == s, true);

if (a != s)
{
MOV(32, gpr.R(a), gpr.R(s));
}
if (inst.Rc) {

if (inst.Rc)
{
ComputeRC(gpr.R(a));
}
gpr.UnlockAll();
Expand Down
32 changes: 23 additions & 9 deletions Source/Core/Core/PowerPC/Jit64/Jit_LoadStore.cpp
Expand Up @@ -20,11 +20,20 @@ void Jit64::lXXx(UGeckoInstruction inst)

// Skip disabled JIT instructions
if (Core::g_CoreStartupParameter.bJITLoadStorelbzxOff && (inst.OPCD == 31) && (inst.SUBOP10 == 87))
{ Default(inst); return; }
{
FallBackToInterpreter(inst);
return;
}
if (Core::g_CoreStartupParameter.bJITLoadStorelXzOff && ((inst.OPCD == 34) || (inst.OPCD == 40) || (inst.OPCD == 32)))
{ Default(inst); return; }
{
FallBackToInterpreter(inst);
return;
}
if (Core::g_CoreStartupParameter.bJITLoadStorelwzOff && (inst.OPCD == 32))
{ Default(inst); return; }
{
FallBackToInterpreter(inst);
return;
}

// Determine memory access size and sign extend
int accessSize = 0;
Expand Down Expand Up @@ -225,7 +234,8 @@ void Jit64::dcbst(UGeckoInstruction inst)
// dcbt = 0x7c00022c
if ((Memory::ReadUnchecked_U32(js.compilerPC - 4) & 0x7c00022c) != 0x7c00022c)
{
Default(inst); return;
FallBackToInterpreter(inst);
return;
}
}

Expand All @@ -235,7 +245,9 @@ void Jit64::dcbz(UGeckoInstruction inst)
INSTRUCTION_START
JITDISABLE(bJITLoadStoreOff)

Default(inst); return;
// FIXME
FallBackToInterpreter(inst);
return;

MOV(32, R(EAX), gpr.R(inst.RB));
if (inst.RA)
Expand Down Expand Up @@ -398,7 +410,7 @@ void Jit64::stXx(UGeckoInstruction inst)
int a = inst.RA, b = inst.RB, s = inst.RS;
if (!a || a == s || a == b)
{
Default(inst);
FallBackToInterpreter(inst);
return;
}
gpr.Lock(a, b, s);
Expand Down Expand Up @@ -451,7 +463,8 @@ void Jit64::lmw(UGeckoInstruction inst)
}
gpr.UnlockAllX();
#else
Default(inst); return;
FallBackToInterpreter(inst);
return;
#endif
}

Expand All @@ -473,12 +486,13 @@ void Jit64::stmw(UGeckoInstruction inst)
}
gpr.UnlockAllX();
#else
Default(inst); return;
FallBackToInterpreter(inst);
return;
#endif
}

void Jit64::icbi(UGeckoInstruction inst)
{
Default(inst);
FallBackToInterpreter(inst);
WriteExit(js.compilerPC + 4);
}
26 changes: 19 additions & 7 deletions Source/Core/Core/PowerPC/Jit64/Jit_LoadStoreFloating.cpp
Expand Up @@ -36,9 +36,10 @@ void Jit64::lfs(UGeckoInstruction inst)
int a = inst.RA;
if (!a)
{
Default(inst);
FallBackToInterpreter(inst);
return;
}

s32 offset = (s32)(s16)inst.SIMM_16;

SafeLoadToReg(EAX, gpr.R(a), 32, offset, RegistersInUse(), false);
Expand All @@ -60,15 +61,20 @@ void Jit64::lfd(UGeckoInstruction inst)
INSTRUCTION_START
JITDISABLE(bJITLoadStoreFloatingOff)

if (js.memcheck) { Default(inst); return; }
if (js.memcheck)
{
FallBackToInterpreter(inst);
return;
}

int d = inst.RD;
int a = inst.RA;
if (!a)
{
Default(inst);
FallBackToInterpreter(inst);
return;
}

s32 offset = (s32)(s16)inst.SIMM_16;
gpr.FlushLockX(ABI_PARAM1);
gpr.Lock(a);
Expand Down Expand Up @@ -129,13 +135,17 @@ void Jit64::stfd(UGeckoInstruction inst)
INSTRUCTION_START
JITDISABLE(bJITLoadStoreFloatingOff)

if (js.memcheck) { Default(inst); return; }
if (js.memcheck)
{
FallBackToInterpreter(inst);
return;
}

int s = inst.RS;
int a = inst.RA;
if (!a)
{
Default(inst);
FallBackToInterpreter(inst);
return;
}

Expand Down Expand Up @@ -218,8 +228,10 @@ void Jit64::stfs(UGeckoInstruction inst)
int s = inst.RS;
int a = inst.RA;
s32 offset = (s32)(s16)inst.SIMM_16;
if (!a || update) {
Default(inst);

if (!a || update)
{
FallBackToInterpreter(inst);
return;
}

Expand Down
16 changes: 12 additions & 4 deletions Source/Core/Core/PowerPC/Jit64/Jit_LoadStorePaired.cpp
Expand Up @@ -19,12 +19,16 @@ void Jit64::psq_st(UGeckoInstruction inst)
INSTRUCTION_START
JITDISABLE(bJITLoadStorePairedOff)

if (js.memcheck) { Default(inst); return; }
if (js.memcheck)
{
FallBackToInterpreter(inst);
return;
}

if (!inst.RA)
{
// TODO: Support these cases if it becomes necessary.
Default(inst);
FallBackToInterpreter(inst);
return;
}

Expand Down Expand Up @@ -71,11 +75,15 @@ void Jit64::psq_l(UGeckoInstruction inst)
INSTRUCTION_START
JITDISABLE(bJITLoadStorePairedOff)

if (js.memcheck) { Default(inst); return; }
if (js.memcheck)
{
FallBackToInterpreter(inst);
return;
}

if (!inst.RA)
{
Default(inst);
FallBackToInterpreter(inst);
return;
}

Expand Down

0 comments on commit e5b250f

Please sign in to comment.