microVU: minor changes

- Added mVUcacheInitReserve and mVUcacheMaxReserve constant values for now which can be tinkered with until we implement runtime user-modifiable cache reserve-sizes.
- Improved the "microVU - cached program" printouts on dev builds.

pcsx2:
- Fixed the typos in SysOutOfMemory_EmergencyResponse()

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4087 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
cottonvibes 2010-12-12 06:38:17 +00:00
parent f68eb19543
commit e38a0ba32d
3 changed files with 22 additions and 18 deletions

View File

@ -130,25 +130,25 @@ void SysOutOfMemory_EmergencyResponse(uptr blocksize)
if (Cpu)
{
Cpu->SetCacheReserve( (Cpu->GetCacheReserve() * 3) / 2 );
Cpu->SetCacheReserve( (Cpu->GetCacheReserve() * 2) / 3 );
Cpu->Reset();
}
if (CpuVU0)
{
CpuVU0->SetCacheReserve( (CpuVU0->GetCacheReserve() * 3) / 2 );
CpuVU0->SetCacheReserve( (CpuVU0->GetCacheReserve() * 2) / 3 );
CpuVU0->Reset();
}
if (CpuVU1)
{
CpuVU1->SetCacheReserve( (CpuVU1->GetCacheReserve() * 3) / 2 );
CpuVU1->SetCacheReserve( (CpuVU1->GetCacheReserve() * 2) / 3 );
CpuVU1->Reset();
}
if (psxCpu)
{
psxCpu->SetCacheReserve( (psxCpu->GetCacheReserve() * 3) / 2 );
psxCpu->SetCacheReserve( (psxCpu->GetCacheReserve() * 2) / 3 );
psxCpu->Reset();
}
}

View File

@ -148,8 +148,7 @@ void microVU::reset() {
prog.x86end = z + ((cacheSize - mVUcacheSafeZone) * _1mb);
for (u32 i = 0; i < (progSize / 2); i++) {
if (!prog.prog[i])
{
if(!prog.prog[i]) {
prog.prog[i] = new deque<microProgram*>();
continue;
}
@ -186,10 +185,10 @@ void microVU::close() {
// Clears Block Data in specified range
static __fi void mVUclear(mV, u32 addr, u32 size) {
if (!mVU->prog.cleared) {
memzero(mVU->prog.lpState); // Clear pipeline state
if(!mVU->prog.cleared) {
mVU->prog.cleared = 1; // Next execution searches/creates a new microprogram
for (u32 i = 0; i < (mVU->progSize / 2); i++) {
memzero(mVU->prog.lpState); // Clear pipeline state
for(u32 i = 0; i < (mVU->progSize / 2); i++) {
mVU->prog.quick[i].block = NULL; // Clear current quick-reference block
mVU->prog.quick[i].prog = NULL; // Clear current quick-reference prog
}
@ -225,10 +224,11 @@ _mVUt __fi microProgram* mVUcreateProg(int startPC) {
prog->startPC = startPC;
mVUcacheProg<vuIndex>(*prog); // Cache Micro Program
double cacheSize = (double)((u32)mVU->prog.x86end - (u32)mVU->prog.x86start);
double cacheUsed =((double)((u32)mVU->prog.x86ptr - (u32)mVU->prog.x86start)) / cacheSize * 100;
double cacheUsed =((double)((u32)mVU->prog.x86ptr - (u32)mVU->prog.x86start)) / (double)_1mb;
double cachePerc =((double)((u32)mVU->prog.x86ptr - (u32)mVU->prog.x86start)) / cacheSize * 100;
ConsoleColors c = vuIndex ? Color_Orange : Color_Magenta;
DevCon.WriteLn(c, "microVU%d: Cached MicroPrograms = [%03d] [PC=%04x] [List=%02d] (Cache = %3.3f%%)",
vuIndex, prog->idx, startPC, mVU->prog.prog[startPC]->size()+1, cacheUsed);
DevCon.WriteLn(c, "microVU%d: Cached Prog = [%03d] [PC=%04x] [List=%02d] (Cache=%3.3f%%) [%3.1fmb]",
vuIndex, prog->idx, startPC*8, mVU->prog.prog[startPC]->size()+1, cachePerc, cacheUsed);
return prog;
}
@ -372,9 +372,11 @@ uint recMicroVU1::GetCacheReserve() const
void recMicroVU0::SetCacheReserve( uint reserveInMegs ) const
{
microVU0.cacheSize = reserveInMegs;
DevCon.WriteLn("microVU0: Upping cache size [%dmb]", reserveInMegs);
microVU0.cacheSize = min(reserveInMegs, mVUcacheMaxReserve);
}
void recMicroVU1::SetCacheReserve( uint reserveInMegs ) const
{
microVU1.cacheSize = reserveInMegs;
DevCon.WriteLn("microVU1: Upping cache size [%dmb]", reserveInMegs);
microVU1.cacheSize = min(reserveInMegs, mVUcacheMaxReserve);
}

View File

@ -149,8 +149,10 @@ struct microProgManager {
microRegInfo lpState; // Pipeline state from where program left off (useful for continuing execution)
};
static const uint mVUdispCacheSize = __pagesize; // Dispatcher Cache Size (in bytes)
static const uint mVUcacheSafeZone = 3; // Safe-Zone for program recompilation (in megabytes)
static const uint mVUdispCacheSize = __pagesize; // Dispatcher Cache Size (in bytes)
static const uint mVUcacheSafeZone = 3; // Safe-Zone for program recompilation (in megabytes)
static const uint mVUcacheInitReserve = 64; // Initial Reserve Cache Size (in megabytes)
static const uint mVUcacheMaxReserve = 128; // Max Reserve Cache Size (in megabytes)
struct microVU {
@ -196,7 +198,7 @@ struct microVU {
__fi VECTOR& getVF(uint reg) const { return regs().VF[reg]; }
__fi s16 Imm5() const { return ((code & 0x400) ? 0xfff0 : 0) | ((code >> 6) & 0xf); }
__fi s16 Imm5() const { return ((code & 0x400) ? 0xfff0 : 0) | ((code >> 6) & 0xf); }
__fi s32 Imm11() const { return (code & 0x400) ? (0xfffffc00 | (code & 0x3ff)) : (code & 0x3ff); }
__fi u32 Imm12() const { return (((code >> 21) & 0x1) << 11) | (code & 0x7ff); }
__fi u32 Imm15() const { return ((code >> 10) & 0x7800) | (code & 0x7ff); }
@ -225,7 +227,7 @@ struct microVU {
microVU()
{
cacheSize = 64;
cacheSize = mVUcacheInitReserve;
cache = NULL;
dispCache = NULL;
startFunct = NULL;