microVU: Move exception handler code to beginning of mVU rec execution instead of inside mVUsearchProg.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3384 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
cottonvibes 2010-07-04 07:33:24 +00:00
parent 714ea3c94f
commit 28ae87c5f7
1 changed files with 26 additions and 26 deletions

View File

@ -17,7 +17,6 @@
#include "PrecompiledHeader.h" #include "PrecompiledHeader.h"
#include "Common.h" #include "Common.h"
#include <deque>
#include "microVU.h" #include "microVU.h"
//------------------------------------------------------------------ //------------------------------------------------------------------
@ -280,28 +279,14 @@ _mVUt _f void* mVUsearchProg(u32 startPC, uptr pState) {
} }
// If cleared and program not found, make a new program instance // If cleared and program not found, make a new program instance
// Exception note: It's bad news if the recompiler throws any exceptions, so we have a clause to mVU->prog.cleared = 0;
// assert if an exception occurs. The rec should be pretty much exception safe, except for mVU->prog.isSame = 1;
// critical errors that would result in a crash regardless. mVU->prog.cur = mVUcreateProg<vuIndex>(startPC/8);
void* entryPoint = mVUblockFetch(mVU, startPC, pState);
try { quick.block = mVU->prog.cur->block[startPC/8];
mVU->prog.cleared = 0; quick.prog = mVU->prog.cur;
mVU->prog.isSame = 1; list.list->push_front(mVU->prog.cur);
mVU->prog.cur = mVUcreateProg<vuIndex>(startPC/8); return entryPoint;
void* entryPoint = mVUblockFetch(mVU, startPC, pState);
quick.block = mVU->prog.cur->block[startPC/8];
quick.prog = mVU->prog.cur;
list.list->push_front(mVU->prog.cur);
return entryPoint;
} catch( BaseException& pxDevelCode(ex) ) {
pxFailDev( wxsFormat(L"microVU%d recompiler exception: " + ex.FormatDiagnosticMessage(), mVU->index) );
} catch( std::exception& pxDevelCode(ex) ) {
pxFailDev( wxsFormat(L"microVU%d recompiler exception: " + Exception::RuntimeError(ex).FormatDiagnosticMessage(), mVU->index) );
}
return NULL;
} }
// If list.quick, then we've already found and recompiled the program ;) // If list.quick, then we've already found and recompiled the program ;)
mVU->prog.isSame = -1; mVU->prog.isSame = -1;
@ -366,10 +351,16 @@ void recMicroVU0::Execute(u32 cycles) {
if(!(VU0.VI[REG_VPU_STAT].UL & 1)) return; if(!(VU0.VI[REG_VPU_STAT].UL & 1)) return;
XMMRegisters::Freeze(); XMMRegisters::Freeze();
// sometimes games spin on vu0, so be careful with this value // Sometimes games spin on vu0, so be careful with this value
// woody hangs if too high on sVU (untested on mVU) // woody hangs if too high on sVU (untested on mVU)
// Edit: Need to test this again, if anyone ever has a "Woody" game :p // Edit: Need to test this again, if anyone ever has a "Woody" game :p
((mVUrecCall)microVU0.startFunct)(VU0.VI[REG_TPC].UL, cycles); try {
((mVUrecCall)microVU0.startFunct)(VU0.VI[REG_TPC].UL, cycles);
} catch (BaseException& pxDevelCode(ex)) {
pxFailDev( wxsFormat(L"microVU0 recompiler exception: " + ex.FormatDiagnosticMessage()));
} catch (std::exception& pxDevelCode(ex)) {
pxFailDev( wxsFormat(L"microVU0 recompiler exception: " + Exception::RuntimeError(ex).FormatDiagnosticMessage()));
}
XMMRegisters::Thaw(); XMMRegisters::Thaw();
} }
void recMicroVU1::Execute(u32 cycles) { void recMicroVU1::Execute(u32 cycles) {
@ -378,7 +369,16 @@ void recMicroVU1::Execute(u32 cycles) {
if(!(VU0.VI[REG_VPU_STAT].UL & 0x100)) return; if(!(VU0.VI[REG_VPU_STAT].UL & 0x100)) return;
XMMRegisters::Freeze(); XMMRegisters::Freeze();
((mVUrecCall)microVU1.startFunct)(VU1.VI[REG_TPC].UL, vu1RunCycles); // Exception note: It's bad news if the recompiler throws any exceptions, so we have a clause to
// assert if an exception occurs. The rec should be pretty much exception safe, except for
// critical errors that would result in a crash regardless.
try {
((mVUrecCall)microVU1.startFunct)(VU1.VI[REG_TPC].UL, vu1RunCycles);
} catch (BaseException& pxDevelCode(ex)) {
pxFailDev( wxsFormat(L"microVU1 recompiler exception: " + ex.FormatDiagnosticMessage()));
} catch (std::exception& pxDevelCode(ex)) {
pxFailDev( wxsFormat(L"microVU1 recompiler exception: " + Exception::RuntimeError(ex).FormatDiagnosticMessage()));
}
XMMRegisters::Thaw(); XMMRegisters::Thaw();
} }