mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 06:51:17 +01:00
JIT works in linux with ALL OPTIMIZATION OFF - well, at least it's faster than pure interpreter :P
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@128 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
e7786f3934
commit
494c1f3187
@ -138,9 +138,11 @@ void ABI_PushAllCalleeSavedRegsAndAdjustStack() {
|
|||||||
PUSH(R13);
|
PUSH(R13);
|
||||||
PUSH(R14);
|
PUSH(R14);
|
||||||
PUSH(R15);
|
PUSH(R15);
|
||||||
|
PUSH(RAX); //just to align stack. we don't care about it's value.
|
||||||
}
|
}
|
||||||
|
|
||||||
void ABI_PopAllCalleeSavedRegsAndAdjustStack() {
|
void ABI_PopAllCalleeSavedRegsAndAdjustStack() {
|
||||||
|
POP(RAX);
|
||||||
POP(R15);
|
POP(R15);
|
||||||
POP(R14);
|
POP(R14);
|
||||||
POP(R13);
|
POP(R13);
|
||||||
|
@ -26,6 +26,8 @@ namespace Gen
|
|||||||
|
|
||||||
void SetCodePtr(u8 *ptr)
|
void SetCodePtr(u8 *ptr)
|
||||||
{
|
{
|
||||||
|
if (!ptr)
|
||||||
|
PanicAlert("SetCodePtr: wtf, ptr=%p", ptr);
|
||||||
code = ptr;
|
code = ptr;
|
||||||
}
|
}
|
||||||
const u8 *GetCodePtr()
|
const u8 *GetCodePtr()
|
||||||
|
@ -258,6 +258,12 @@ namespace Jit64
|
|||||||
// Yup, just don't do anything.
|
// Yup, just don't do anything.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RESULTS (running kururin with optimizations on)
|
||||||
|
// at block 13968 they diverge.
|
||||||
|
// linux goes to 8010fe54
|
||||||
|
// windoze goes to 8010feb0
|
||||||
|
// after they they are completely out of sync.
|
||||||
|
// branches from the cmp result of r0, which comes from an lbz (loaded from stack)
|
||||||
bool ImHereDebug = false;
|
bool ImHereDebug = false;
|
||||||
bool ImHereLog = false;
|
bool ImHereLog = false;
|
||||||
std::map<u32, int> been_here;
|
std::map<u32, int> been_here;
|
||||||
@ -335,7 +341,6 @@ namespace Jit64
|
|||||||
const u8* DoJit(u32 emaddress, JitBlock &b)
|
const u8* DoJit(u32 emaddress, JitBlock &b)
|
||||||
{
|
{
|
||||||
_assert_msg_(DYNA_REC, emaddress != 0, "ERROR - Trying to compile at 0. LR=%08x",LR);
|
_assert_msg_(DYNA_REC, emaddress != 0, "ERROR - Trying to compile at 0. LR=%08x",LR);
|
||||||
//Step 1: Start from the "flattened" representation and assign/preload registers/locations
|
|
||||||
|
|
||||||
u32 size;
|
u32 size;
|
||||||
js.isLastInstruction = false;
|
js.isLastInstruction = false;
|
||||||
@ -347,9 +352,7 @@ namespace Jit64
|
|||||||
//Analyze the block, collect all instructions it is made of (including inlining,
|
//Analyze the block, collect all instructions it is made of (including inlining,
|
||||||
//if that is enabled), reorder instructions for optimal performance, and join joinable instructions.
|
//if that is enabled), reorder instructions for optimal performance, and join joinable instructions.
|
||||||
PPCAnalyst::CodeOp *ops = PPCAnalyst::Flatten(emaddress, size, js.st, js.gpa, js.fpa);
|
PPCAnalyst::CodeOp *ops = PPCAnalyst::Flatten(emaddress, size, js.st, js.gpa, js.fpa);
|
||||||
// This is where we would write the block number if my evil plan comes to fruition
|
|
||||||
const u8 *start = AlignCode4(); //TODO: Test if this or AlignCode16 make a difference from GetCodePtr
|
const u8 *start = AlignCode4(); //TODO: Test if this or AlignCode16 make a difference from GetCodePtr
|
||||||
|
|
||||||
b.checkedEntry = start;
|
b.checkedEntry = start;
|
||||||
FixupBranch skip = J_CC(CC_NBE);
|
FixupBranch skip = J_CC(CC_NBE);
|
||||||
MOV(32, M(&PC), Imm32(js.blockStart));
|
MOV(32, M(&PC), Imm32(js.blockStart));
|
||||||
@ -388,7 +391,13 @@ namespace Jit64
|
|||||||
js.op = &ops[i];
|
js.op = &ops[i];
|
||||||
js.instructionNumber = i;
|
js.instructionNumber = i;
|
||||||
if (i == (int)size - 1) js.isLastInstruction = true;
|
if (i == (int)size - 1) js.isLastInstruction = true;
|
||||||
PPCTables::CompileInstruction(ops[i].inst);
|
//PPCTables::CompileInstruction(ops[i].inst);
|
||||||
|
#ifndef _WIN32
|
||||||
|
if (!js.isLastInstruction)
|
||||||
|
Default(ops[i].inst);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
PPCTables::CompileInstruction(ops[i].inst);
|
||||||
gpr.SanityCheck();
|
gpr.SanityCheck();
|
||||||
fpr.SanityCheck();
|
fpr.SanityCheck();
|
||||||
}
|
}
|
||||||
|
@ -259,6 +259,10 @@ namespace Jit64
|
|||||||
return (CompiledCode)blockCodePointers[blockNumber];
|
return (CompiledCode)blockCodePointers[blockNumber];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetCodeSize() {
|
||||||
|
return GetCodePtr() - codeCache;
|
||||||
|
}
|
||||||
|
|
||||||
//Block linker
|
//Block linker
|
||||||
//Make sure to have as many blocks as possible compiled before calling this
|
//Make sure to have as many blocks as possible compiled before calling this
|
||||||
//It's O(N), so it's fast :)
|
//It's O(N), so it's fast :)
|
||||||
|
@ -55,6 +55,7 @@ namespace Jit64
|
|||||||
CompiledCode GetCompiledCode(u32 address);
|
CompiledCode GetCompiledCode(u32 address);
|
||||||
CompiledCode GetCompiledCodeFromBlock(int blockNumber);
|
CompiledCode GetCompiledCodeFromBlock(int blockNumber);
|
||||||
|
|
||||||
|
int GetCodeSize();
|
||||||
int GetNumBlocks();
|
int GetNumBlocks();
|
||||||
|
|
||||||
u8 **GetCodePointers();
|
u8 **GetCodePointers();
|
||||||
|
@ -57,9 +57,6 @@ bool BootCore(const std::string& _rFilename)
|
|||||||
// StartUp.bUseDualCore = false;
|
// StartUp.bUseDualCore = false;
|
||||||
StartUp.bUseDynarec = true;
|
StartUp.bUseDynarec = true;
|
||||||
}
|
}
|
||||||
#ifndef _WIN32
|
|
||||||
StartUp.bUseDynarec = false;//Never use Dynarec in Linux, crashes
|
|
||||||
#endif
|
|
||||||
StartUp.m_BootType = SCoreStartupParameter::BOOT_ISO;
|
StartUp.m_BootType = SCoreStartupParameter::BOOT_ISO;
|
||||||
StartUp.m_strFilename = _rFilename;
|
StartUp.m_strFilename = _rFilename;
|
||||||
StartUp.bRunCompareClient = false;
|
StartUp.bRunCompareClient = false;
|
||||||
|
@ -576,4 +576,4 @@ void PixelShaderMngr::GetPixelShaderId(PixelShaderMngr::PIXELSHADERUID& uid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
uid.indstages = (u32)(pcurvalue-&uid.values[0]-2-uid.tevstages);
|
uid.indstages = (u32)(pcurvalue-&uid.values[0]-2-uid.tevstages);
|
||||||
}
|
}
|
||||||
|
@ -470,6 +470,7 @@ void VertexLoader::ProcessFormat()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// compile the pointer set function
|
// compile the pointer set function
|
||||||
|
u8 *old_code_ptr = GetWritableCodePtr();
|
||||||
SetCodePtr(m_compiledCode);
|
SetCodePtr(m_compiledCode);
|
||||||
Util::EmitPrologue(6);
|
Util::EmitPrologue(6);
|
||||||
//INT3();
|
//INT3();
|
||||||
@ -575,7 +576,7 @@ void VertexLoader::ProcessFormat()
|
|||||||
Crash();
|
Crash();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCodePtr(0);
|
SetCodePtr(old_code_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VertexLoader::PrepareRun()
|
void VertexLoader::PrepareRun()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user