mirror of https://github.com/PCSX2/pcsx2.git
Cleaner version of the EE reset optimisation, there's no particular reason not to skip these steps every time so there's no need for a second function.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1524 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
ae85ad0f3b
commit
21dac50152
|
@ -93,7 +93,6 @@ static u32 s_nInstCacheSize = 0;
|
||||||
static BASEBLOCK* s_pCurBlock = NULL;
|
static BASEBLOCK* s_pCurBlock = NULL;
|
||||||
static BASEBLOCKEX* s_pCurBlockEx = NULL;
|
static BASEBLOCKEX* s_pCurBlockEx = NULL;
|
||||||
u32 s_nEndBlock = 0; // what pc the current block ends
|
u32 s_nEndBlock = 0; // what pc the current block ends
|
||||||
//static u32 s_nHasDelay = 0;
|
|
||||||
static bool s_nBlockFF;
|
static bool s_nBlockFF;
|
||||||
|
|
||||||
// save states for branches
|
// save states for branches
|
||||||
|
@ -454,12 +453,13 @@ PCSX2_ALIGNED16( static u8 manual_counter[Ps2MemSize::Base >> 12] );
|
||||||
////////////////////////////////////////////////////
|
////////////////////////////////////////////////////
|
||||||
void recResetEE( void )
|
void recResetEE( void )
|
||||||
{
|
{
|
||||||
Console::Status( "Issuing full EE/iR5900-32 Recompiler Reset [mem/structure cleanup]" );
|
Console::Status( "Issuing EE/iR5900-32 Recompiler Reset [mem/structure cleanup]" );
|
||||||
|
|
||||||
maxrecmem = 0;
|
maxrecmem = 0;
|
||||||
|
|
||||||
memset_8<0xcc, REC_CACHEMEM>(recMem); // 0xcc is INT3
|
if (IsDevBuild)
|
||||||
memzero_ptr<m_recBlockAllocSize>( m_recBlockAlloc );
|
memset_8<0xcc, REC_CACHEMEM>(recMem); // 0xcc is INT3
|
||||||
|
memzero_ptr<m_recBlockAllocSize - Ps2MemSize::Base>( m_recBlockAlloc ); // Excluding the 32mb ram copy
|
||||||
memzero_ptr<RECCONSTBUF_SIZE * sizeof(u32)>(recConstBuf);
|
memzero_ptr<RECCONSTBUF_SIZE * sizeof(u32)>(recConstBuf);
|
||||||
memzero_obj( manual_page );
|
memzero_obj( manual_page );
|
||||||
memzero_obj( manual_counter );
|
memzero_obj( manual_counter );
|
||||||
|
@ -519,42 +519,6 @@ void recResetEE( void )
|
||||||
SetCPUState(Config.sseMXCSR, Config.sseVUMXCSR);
|
SetCPUState(Config.sseMXCSR, Config.sseVUMXCSR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void recResetEE_Fast( void )
|
|
||||||
{
|
|
||||||
Console::Status( "Issuing fast EE/iR5900-32 Recompiler Reset [mem/structure cleanup]" );
|
|
||||||
|
|
||||||
maxrecmem = 0;
|
|
||||||
|
|
||||||
if( IsDevBuild ) memset_8<0xcc, REC_CACHEMEM>(recMem); // 0xcc is INT3
|
|
||||||
memzero_ptr<(m_recBlockAllocSize-Ps2MemSize::Base)>( m_recBlockAlloc ); //Excluding the 32mb ram copy
|
|
||||||
memzero_ptr<RECCONSTBUF_SIZE * sizeof(u32)>(recConstBuf);
|
|
||||||
memzero_obj( manual_page );
|
|
||||||
memzero_obj( manual_counter );
|
|
||||||
ClearRecLUT((BASEBLOCK*)m_recBlockAlloc,
|
|
||||||
(((Ps2MemSize::Base + Ps2MemSize::Rom + Ps2MemSize::Rom1) / 4)));
|
|
||||||
|
|
||||||
if( s_pInstCache )
|
|
||||||
memset( s_pInstCache, 0, sizeof(EEINST)*s_nInstCacheSize );
|
|
||||||
|
|
||||||
recBlocks.Reset();
|
|
||||||
mmap_ResetBlockTracking();
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
__asm emms;
|
|
||||||
#else
|
|
||||||
__asm__("emms");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
x86SetPtr(recMem);
|
|
||||||
|
|
||||||
recPtr = recMem;
|
|
||||||
recConstBufPtr = recConstBuf;
|
|
||||||
x86FpuState = FPU_STATE;
|
|
||||||
|
|
||||||
branch = 0;
|
|
||||||
SetCPUState(Config.sseMXCSR, Config.sseVUMXCSR);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void recShutdown( void )
|
static void recShutdown( void )
|
||||||
{
|
{
|
||||||
ProfilerTerminateSource( "EERec" );
|
ProfilerTerminateSource( "EERec" );
|
||||||
|
@ -1303,7 +1267,7 @@ void recRecompile( const u32 startpc )
|
||||||
|
|
||||||
// if recPtr reached the mem limit reset whole mem
|
// if recPtr reached the mem limit reset whole mem
|
||||||
if ( ( (uptr)recPtr - (uptr)recMem ) >= REC_CACHEMEM-0x40000 || dumplog == 0xffffffff) {
|
if ( ( (uptr)recPtr - (uptr)recMem ) >= REC_CACHEMEM-0x40000 || dumplog == 0xffffffff) {
|
||||||
recResetEE_Fast();
|
recResetEE();
|
||||||
}
|
}
|
||||||
if ( (recConstBufPtr - recConstBuf) >= RECCONSTBUF_SIZE - 64 ) {
|
if ( (recConstBufPtr - recConstBuf) >= RECCONSTBUF_SIZE - 64 ) {
|
||||||
DevCon::WriteLn("EE recompiler stack reset");
|
DevCon::WriteLn("EE recompiler stack reset");
|
||||||
|
@ -1359,7 +1323,6 @@ void recRecompile( const u32 startpc )
|
||||||
// go until the next branch
|
// go until the next branch
|
||||||
i = startpc;
|
i = startpc;
|
||||||
s_nEndBlock = 0xffffffff;
|
s_nEndBlock = 0xffffffff;
|
||||||
/*s_nHasDelay = 0;*/
|
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
BASEBLOCK* pblock = PC_GETBLOCK(i);
|
BASEBLOCK* pblock = PC_GETBLOCK(i);
|
||||||
|
@ -1390,7 +1353,6 @@ void recRecompile( const u32 startpc )
|
||||||
case 0: // special
|
case 0: // special
|
||||||
if( _Funct_ == 8 || _Funct_ == 9 ) { // JR, JALR
|
if( _Funct_ == 8 || _Funct_ == 9 ) { // JR, JALR
|
||||||
s_nEndBlock = i + 8;
|
s_nEndBlock = i + 8;
|
||||||
/*s_nHasDelay = 1;*/
|
|
||||||
goto StartRecomp;
|
goto StartRecomp;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1399,9 +1361,6 @@ void recRecompile( const u32 startpc )
|
||||||
|
|
||||||
if( _Rt_ < 4 || (_Rt_ >= 16 && _Rt_ < 20) ) {
|
if( _Rt_ < 4 || (_Rt_ >= 16 && _Rt_ < 20) ) {
|
||||||
// branches
|
// branches
|
||||||
/*if( _Rt_ == 2 || _Rt_ == 3 || _Rt_ == 18 || _Rt_ == 19 ) s_nHasDelay = 1;
|
|
||||||
else s_nHasDelay = 2;*/
|
|
||||||
|
|
||||||
branchTo = _Imm_ * 4 + i + 4;
|
branchTo = _Imm_ * 4 + i + 4;
|
||||||
if( branchTo > startpc && branchTo < i ) s_nEndBlock = branchTo;
|
if( branchTo > startpc && branchTo < i ) s_nEndBlock = branchTo;
|
||||||
else s_nEndBlock = i+8;
|
else s_nEndBlock = i+8;
|
||||||
|
@ -1412,17 +1371,12 @@ void recRecompile( const u32 startpc )
|
||||||
|
|
||||||
case 2: // J
|
case 2: // J
|
||||||
case 3: // JAL
|
case 3: // JAL
|
||||||
/*s_nHasDelay = 1;*/
|
|
||||||
s_nEndBlock = i + 8;
|
s_nEndBlock = i + 8;
|
||||||
goto StartRecomp;
|
goto StartRecomp;
|
||||||
|
|
||||||
// branches
|
// branches
|
||||||
case 4: case 5: case 6: case 7:
|
case 4: case 5: case 6: case 7:
|
||||||
case 20: case 21: case 22: case 23:
|
case 20: case 21: case 22: case 23:
|
||||||
|
|
||||||
/*if( (cpuRegs.code >> 26) >= 20 ) s_nHasDelay = 1;
|
|
||||||
else s_nHasDelay = 2;*/
|
|
||||||
|
|
||||||
branchTo = _Imm_ * 4 + i + 4;
|
branchTo = _Imm_ * 4 + i + 4;
|
||||||
if( branchTo > startpc && branchTo < i ) s_nEndBlock = branchTo;
|
if( branchTo > startpc && branchTo < i ) s_nEndBlock = branchTo;
|
||||||
else s_nEndBlock = i+8;
|
else s_nEndBlock = i+8;
|
||||||
|
@ -1444,9 +1398,6 @@ void recRecompile( const u32 startpc )
|
||||||
if( _Rs_ == 8 ) {
|
if( _Rs_ == 8 ) {
|
||||||
// BC1F, BC1T, BC1FL, BC1TL
|
// BC1F, BC1T, BC1FL, BC1TL
|
||||||
// BC2F, BC2T, BC2FL, BC2TL
|
// BC2F, BC2T, BC2FL, BC2TL
|
||||||
/*if( _Rt_ >= 2 ) s_nHasDelay = 1;
|
|
||||||
else s_nHasDelay = 2;*/
|
|
||||||
|
|
||||||
branchTo = _Imm_ * 4 + i + 4;
|
branchTo = _Imm_ * 4 + i + 4;
|
||||||
if( branchTo > startpc && branchTo < i ) s_nEndBlock = branchTo;
|
if( branchTo > startpc && branchTo < i ) s_nEndBlock = branchTo;
|
||||||
else s_nEndBlock = i+8;
|
else s_nEndBlock = i+8;
|
||||||
|
|
Loading…
Reference in New Issue