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:
hrydgard 2008-08-03 16:56:31 +00:00
parent e7786f3934
commit 494c1f3187
8 changed files with 25 additions and 9 deletions

View File

@ -138,9 +138,11 @@ void ABI_PushAllCalleeSavedRegsAndAdjustStack() {
PUSH(R13);
PUSH(R14);
PUSH(R15);
PUSH(RAX); //just to align stack. we don't care about it's value.
}
void ABI_PopAllCalleeSavedRegsAndAdjustStack() {
POP(RAX);
POP(R15);
POP(R14);
POP(R13);

View File

@ -26,6 +26,8 @@ namespace Gen
void SetCodePtr(u8 *ptr)
{
if (!ptr)
PanicAlert("SetCodePtr: wtf, ptr=%p", ptr);
code = ptr;
}
const u8 *GetCodePtr()

View File

@ -258,6 +258,12 @@ namespace Jit64
// 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 ImHereLog = false;
std::map<u32, int> been_here;
@ -335,7 +341,6 @@ namespace Jit64
const u8* DoJit(u32 emaddress, JitBlock &b)
{
_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;
js.isLastInstruction = false;
@ -347,9 +352,7 @@ namespace Jit64
//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.
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
b.checkedEntry = start;
FixupBranch skip = J_CC(CC_NBE);
MOV(32, M(&PC), Imm32(js.blockStart));
@ -388,7 +391,13 @@ namespace Jit64
js.op = &ops[i];
js.instructionNumber = i;
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();
fpr.SanityCheck();
}

View File

@ -259,6 +259,10 @@ namespace Jit64
return (CompiledCode)blockCodePointers[blockNumber];
}
int GetCodeSize() {
return GetCodePtr() - codeCache;
}
//Block linker
//Make sure to have as many blocks as possible compiled before calling this
//It's O(N), so it's fast :)

View File

@ -55,6 +55,7 @@ namespace Jit64
CompiledCode GetCompiledCode(u32 address);
CompiledCode GetCompiledCodeFromBlock(int blockNumber);
int GetCodeSize();
int GetNumBlocks();
u8 **GetCodePointers();

View File

@ -57,9 +57,6 @@ bool BootCore(const std::string& _rFilename)
// StartUp.bUseDualCore = false;
StartUp.bUseDynarec = true;
}
#ifndef _WIN32
StartUp.bUseDynarec = false;//Never use Dynarec in Linux, crashes
#endif
StartUp.m_BootType = SCoreStartupParameter::BOOT_ISO;
StartUp.m_strFilename = _rFilename;
StartUp.bRunCompareClient = false;

View File

@ -576,4 +576,4 @@ void PixelShaderMngr::GetPixelShaderId(PixelShaderMngr::PIXELSHADERUID& uid)
}
uid.indstages = (u32)(pcurvalue-&uid.values[0]-2-uid.tevstages);
}
}

View File

@ -470,6 +470,7 @@ void VertexLoader::ProcessFormat()
}
// compile the pointer set function
u8 *old_code_ptr = GetWritableCodePtr();
SetCodePtr(m_compiledCode);
Util::EmitPrologue(6);
//INT3();
@ -575,7 +576,7 @@ void VertexLoader::ProcessFormat()
Crash();
}
SetCodePtr(0);
SetCodePtr(old_code_ptr);
}
void VertexLoader::PrepareRun()