mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Fixed profiled ReJIT. It's very experimental though. Makes a great performance boost, but is way too unsafe. However it seems to work fine on games I've tested. Can be enabled from ini-file (ProfiledReJIT = True in [Core]).
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3321 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -223,6 +223,7 @@ void SConfig::LoadSettings()
|
|||||||
ini.Get("Core", "SlotA", (int*)&m_EXIDevice[0], EXIDEVICE_MEMORYCARD_A);
|
ini.Get("Core", "SlotA", (int*)&m_EXIDevice[0], EXIDEVICE_MEMORYCARD_A);
|
||||||
ini.Get("Core", "SlotB", (int*)&m_EXIDevice[1], EXIDEVICE_MEMORYCARD_B);
|
ini.Get("Core", "SlotB", (int*)&m_EXIDevice[1], EXIDEVICE_MEMORYCARD_B);
|
||||||
ini.Get("Core", "SerialPort1", (int*)&m_EXIDevice[2], EXIDEVICE_DUMMY);
|
ini.Get("Core", "SerialPort1", (int*)&m_EXIDevice[2], EXIDEVICE_DUMMY);
|
||||||
|
ini.Get("Core", "ProfiledReJIT", &m_LocalCoreStartupParameter.bJITProfiledReJIT, false);
|
||||||
char sidevicenum[16];
|
char sidevicenum[16];
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
|
@ -55,6 +55,7 @@ struct SCoreStartupParameter
|
|||||||
bool bJITPairedOff;
|
bool bJITPairedOff;
|
||||||
bool bJITSystemRegistersOff;
|
bool bJITSystemRegistersOff;
|
||||||
bool bJITBranchOff;
|
bool bJITBranchOff;
|
||||||
|
bool bJITProfiledReJIT;
|
||||||
|
|
||||||
bool bUseDualCore;
|
bool bUseDualCore;
|
||||||
bool bDSPThread;
|
bool bDSPThread;
|
||||||
|
@ -138,6 +138,7 @@ Fix profiled loads/stores to work safely. On 32-bit, one solution is to
|
|||||||
#include "JitAsm.h"
|
#include "JitAsm.h"
|
||||||
#include "Jit.h"
|
#include "Jit.h"
|
||||||
#include "../../HW/GPFifo.h"
|
#include "../../HW/GPFifo.h"
|
||||||
|
#include "../../Core.h"
|
||||||
using namespace Gen;
|
using namespace Gen;
|
||||||
|
|
||||||
namespace IREmitter {
|
namespace IREmitter {
|
||||||
@ -1287,17 +1288,18 @@ static void regWriteExit(RegInfo& RI, InstLoc dest) {
|
|||||||
if (isImm(*dest)) {
|
if (isImm(*dest)) {
|
||||||
RI.Jit->WriteExit(RI.Build->GetImmValue(dest), RI.exitNumber++);
|
RI.Jit->WriteExit(RI.Build->GetImmValue(dest), RI.exitNumber++);
|
||||||
} else {
|
} else {
|
||||||
RI.Jit->MOV(32, R(EAX), regLocForInst(RI, dest));
|
if (!regLocForInst(RI, dest).IsSimpleReg(EAX))
|
||||||
|
RI.Jit->MOV(32, R(EAX), regLocForInst(RI, dest));
|
||||||
RI.Jit->WriteExitDestInEAX(RI.exitNumber++);
|
RI.Jit->WriteExitDestInEAX(RI.exitNumber++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DoWriteCode(IRBuilder* ibuild, Jit64* Jit, bool UseProfile) {
|
static void DoWriteCode(IRBuilder* ibuild, Jit64* Jit, bool UseProfile, bool MakeProfile) {
|
||||||
//printf("Writing block: %x\n", js.blockStart);
|
//printf("Writing block: %x\n", js.blockStart);
|
||||||
RegInfo RI(Jit, ibuild->getFirstInst(), ibuild->getNumInsts());
|
RegInfo RI(Jit, ibuild->getFirstInst(), ibuild->getNumInsts());
|
||||||
RI.Build = ibuild;
|
RI.Build = ibuild;
|
||||||
RI.UseProfile = UseProfile;
|
RI.UseProfile = UseProfile;
|
||||||
RI.MakeProfile = false;//!RI.UseProfile;
|
RI.MakeProfile = MakeProfile;
|
||||||
// Pass to compute liveness
|
// Pass to compute liveness
|
||||||
ibuild->StartBackPass();
|
ibuild->StartBackPass();
|
||||||
for (unsigned int index = (unsigned int)RI.IInfo.size() - 1; index != -1U; --index) {
|
for (unsigned int index = (unsigned int)RI.IInfo.size() - 1; index != -1U; --index) {
|
||||||
@ -2268,13 +2270,12 @@ static void DoWriteCode(IRBuilder* ibuild, Jit64* Jit, bool UseProfile) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Jit64::WriteCode() {
|
void Jit64::WriteCode() {
|
||||||
DoWriteCode(&ibuild, this, false);
|
DoWriteCode(&ibuild, this, false, Core::GetStartupParameter().bJITProfiledReJIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfiledReJit() {
|
void ProfiledReJit() {
|
||||||
u8* x = (u8*)jit.GetCodePtr();
|
|
||||||
jit.SetCodePtr(jit.js.rewriteStart);
|
jit.SetCodePtr(jit.js.rewriteStart);
|
||||||
DoWriteCode(&jit.ibuild, &jit, true);
|
DoWriteCode(&jit.ibuild, &jit, true, false);
|
||||||
jit.js.curBlock->codeSize = (int)(jit.GetCodePtr() - jit.js.rewriteStart);
|
jit.js.curBlock->codeSize = (int)(jit.GetCodePtr() - jit.js.rewriteStart);
|
||||||
jit.SetCodePtr(x);
|
jit.GetBlockCache()->FinalizeBlock(jit.js.curBlock->blockNum, jit.jo.enableBlocklink, jit.js.curBlock->normalEntry);
|
||||||
}
|
}
|
||||||
|
@ -428,6 +428,7 @@ namespace CPUCompare
|
|||||||
SetJumpTarget(skip);
|
SetJumpTarget(skip);
|
||||||
|
|
||||||
const u8 *normalEntry = GetCodePtr();
|
const u8 *normalEntry = GetCodePtr();
|
||||||
|
b->normalEntry = normalEntry;
|
||||||
|
|
||||||
if (ImHereDebug)
|
if (ImHereDebug)
|
||||||
ABI_CallFunction((void *)&ImHere); //Used to get a trace of the last few blocks before a crash, sometimes VERY useful
|
ABI_CallFunction((void *)&ImHere); //Used to get a trace of the last few blocks before a crash, sometimes VERY useful
|
||||||
|
@ -168,6 +168,7 @@ bool JitBlock::ContainsAddress(u32 em_address)
|
|||||||
b.exitPtrs[1] = 0;
|
b.exitPtrs[1] = 0;
|
||||||
b.linkStatus[0] = false;
|
b.linkStatus[0] = false;
|
||||||
b.linkStatus[1] = false;
|
b.linkStatus[1] = false;
|
||||||
|
b.blockNum = num_blocks;
|
||||||
num_blocks++; //commit the current block
|
num_blocks++; //commit the current block
|
||||||
return num_blocks - 1;
|
return num_blocks - 1;
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ struct JitBlock
|
|||||||
u32 codeSize;
|
u32 codeSize;
|
||||||
u32 originalSize;
|
u32 originalSize;
|
||||||
int runCount; // for profiling.
|
int runCount; // for profiling.
|
||||||
|
int blockNum;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// we don't really need to save start and stop
|
// we don't really need to save start and stop
|
||||||
@ -55,6 +56,7 @@ struct JitBlock
|
|||||||
LARGE_INTEGER ticCounter; // for profiling - time.
|
LARGE_INTEGER ticCounter; // for profiling - time.
|
||||||
#endif
|
#endif
|
||||||
const u8 *checkedEntry;
|
const u8 *checkedEntry;
|
||||||
|
const u8 *normalEntry;
|
||||||
bool invalid;
|
bool invalid;
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user