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:
sudonim1 2009-07-15 18:07:34 +00:00
parent ae85ad0f3b
commit 21dac50152
1 changed files with 5 additions and 54 deletions

View File

@ -93,7 +93,6 @@ static u32 s_nInstCacheSize = 0;
static BASEBLOCK* s_pCurBlock = NULL;
static BASEBLOCKEX* s_pCurBlockEx = NULL;
u32 s_nEndBlock = 0; // what pc the current block ends
//static u32 s_nHasDelay = 0;
static bool s_nBlockFF;
// save states for branches
@ -454,12 +453,13 @@ PCSX2_ALIGNED16( static u8 manual_counter[Ps2MemSize::Base >> 12] );
////////////////////////////////////////////////////
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;
memset_8<0xcc, REC_CACHEMEM>(recMem); // 0xcc is INT3
memzero_ptr<m_recBlockAllocSize>( m_recBlockAlloc );
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 );
@ -519,42 +519,6 @@ void recResetEE( void )
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 )
{
ProfilerTerminateSource( "EERec" );
@ -1303,7 +1267,7 @@ void recRecompile( const u32 startpc )
// if recPtr reached the mem limit reset whole mem
if ( ( (uptr)recPtr - (uptr)recMem ) >= REC_CACHEMEM-0x40000 || dumplog == 0xffffffff) {
recResetEE_Fast();
recResetEE();
}
if ( (recConstBufPtr - recConstBuf) >= RECCONSTBUF_SIZE - 64 ) {
DevCon::WriteLn("EE recompiler stack reset");
@ -1359,7 +1323,6 @@ void recRecompile( const u32 startpc )
// go until the next branch
i = startpc;
s_nEndBlock = 0xffffffff;
/*s_nHasDelay = 0;*/
while(1) {
BASEBLOCK* pblock = PC_GETBLOCK(i);
@ -1390,7 +1353,6 @@ void recRecompile( const u32 startpc )
case 0: // special
if( _Funct_ == 8 || _Funct_ == 9 ) { // JR, JALR
s_nEndBlock = i + 8;
/*s_nHasDelay = 1;*/
goto StartRecomp;
}
break;
@ -1399,9 +1361,6 @@ void recRecompile( const u32 startpc )
if( _Rt_ < 4 || (_Rt_ >= 16 && _Rt_ < 20) ) {
// branches
/*if( _Rt_ == 2 || _Rt_ == 3 || _Rt_ == 18 || _Rt_ == 19 ) s_nHasDelay = 1;
else s_nHasDelay = 2;*/
branchTo = _Imm_ * 4 + i + 4;
if( branchTo > startpc && branchTo < i ) s_nEndBlock = branchTo;
else s_nEndBlock = i+8;
@ -1412,17 +1371,12 @@ void recRecompile( const u32 startpc )
case 2: // J
case 3: // JAL
/*s_nHasDelay = 1;*/
s_nEndBlock = i + 8;
goto StartRecomp;
// branches
case 4: case 5: case 6: case 7:
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;
if( branchTo > startpc && branchTo < i ) s_nEndBlock = branchTo;
else s_nEndBlock = i+8;
@ -1444,9 +1398,6 @@ void recRecompile( const u32 startpc )
if( _Rs_ == 8 ) {
// BC1F, BC1T, BC1FL, BC1TL
// BC2F, BC2T, BC2FL, BC2TL
/*if( _Rt_ >= 2 ) s_nHasDelay = 1;
else s_nHasDelay = 2;*/
branchTo = _Imm_ * 4 + i + 4;
if( branchTo > startpc && branchTo < i ) s_nEndBlock = branchTo;
else s_nEndBlock = i+8;