Small speedup for the EE/IOP recompilers, by removing the legacy limit on the number of recompiled blocks (was causing recompilers to reset the code buffers way more than necessary).

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1135 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-05-05 01:26:18 +00:00
parent 002b9af006
commit a7cbcae4be
4 changed files with 5 additions and 27 deletions

View File

@ -21,9 +21,6 @@
BASEBLOCKEX* BaseBlocks::New(u32 startpc, uptr fnptr) BASEBLOCKEX* BaseBlocks::New(u32 startpc, uptr fnptr)
{ {
if (blocks.size() == size)
return 0;
BASEBLOCKEX newblock; BASEBLOCKEX newblock;
std::vector<BASEBLOCKEX>::iterator iter; std::vector<BASEBLOCKEX>::iterator iter;
memset(&newblock, 0, sizeof newblock); memset(&newblock, 0, sizeof newblock);

View File

@ -53,17 +53,15 @@ private:
// switch to a hash map later? // switch to a hash map later?
std::multimap<u32, uptr> links; std::multimap<u32, uptr> links;
typedef std::multimap<u32, uptr>::iterator linkiter_t; typedef std::multimap<u32, uptr>::iterator linkiter_t;
unsigned long size;
uptr recompiler; uptr recompiler;
std::vector<BASEBLOCKEX> blocks; std::vector<BASEBLOCKEX> blocks;
public: public:
BaseBlocks(unsigned long size_, uptr recompiler_) : BaseBlocks(uptr recompiler_) :
size(size_),
recompiler(recompiler_), recompiler(recompiler_),
blocks(0) blocks(0)
{ {
blocks.reserve(size); blocks.reserve(0x4000);
} }
BASEBLOCKEX* New(u32 startpc, uptr fnptr); BASEBLOCKEX* New(u32 startpc, uptr fnptr);

View File

@ -51,7 +51,6 @@ uptr psxhwLUT[0x10000];
#define HWADDR(mem) (psxhwLUT[mem >> 16] + (mem)) #define HWADDR(mem) (psxhwLUT[mem >> 16] + (mem))
#define PSX_NUMBLOCKS (1<<12)
#define MAPBASE 0x48000000 #define MAPBASE 0x48000000
#define RECMEM_SIZE (8*1024*1024) #define RECMEM_SIZE (8*1024*1024)
@ -63,7 +62,7 @@ static BASEBLOCK *recRAM = NULL; // and the ptr to the blocks here
static BASEBLOCK *recROM = NULL; // and here static BASEBLOCK *recROM = NULL; // and here
static BASEBLOCK *recROM1 = NULL; // also here static BASEBLOCK *recROM1 = NULL; // also here
void iopJITCompile(); void iopJITCompile();
static BaseBlocks recBlocks(PSX_NUMBLOCKS, (uptr)iopJITCompile); static BaseBlocks recBlocks((uptr)iopJITCompile);
static u8 *recPtr = NULL; static u8 *recPtr = NULL;
u32 psxpc; // recompiler psxpc u32 psxpc; // recompiler psxpc
int psxbranch; // set for branch int psxbranch; // set for branch
@ -986,16 +985,8 @@ void iopRecRecompile(u32 startpc)
|| s_pCurBlock->GetFnptr() == (uptr)iopJITCompileInBlock); || s_pCurBlock->GetFnptr() == (uptr)iopJITCompileInBlock);
s_pCurBlockEx = recBlocks.Get(HWADDR(startpc)); s_pCurBlockEx = recBlocks.Get(HWADDR(startpc));
if(!s_pCurBlockEx || s_pCurBlockEx->startpc != HWADDR(startpc)) { if(!s_pCurBlockEx || s_pCurBlockEx->startpc != HWADDR(startpc))
s_pCurBlockEx = recBlocks.New(HWADDR(startpc), (uptr)recPtr); s_pCurBlockEx = recBlocks.New(HWADDR(startpc), (uptr)recPtr);
if( s_pCurBlockEx == NULL ) {
DevCon::WriteLn("IOP Recompiler data reset");
recResetIOP();
x86SetPtr( recPtr );
s_pCurBlockEx = recBlocks.New(HWADDR(startpc), (uptr)recPtr);
}
}
psxbranch = 0; psxbranch = 0;

View File

@ -76,7 +76,6 @@ u32 g_cpuHasConstReg = 0, g_cpuFlushedConstReg = 0;
#define X86 #define X86
static const int RECSTACK_SIZE = 0x00010000; static const int RECSTACK_SIZE = 0x00010000;
static const int EE_NUMBLOCKS = (1<<15);
static u8 *recMem = NULL; // the recompiled blocks will be here static u8 *recMem = NULL; // the recompiled blocks will be here
static u8* recStack = NULL; // stack mem static u8* recStack = NULL; // stack mem
@ -85,7 +84,7 @@ static BASEBLOCK *recROM = NULL; // and here
static BASEBLOCK *recROM1 = NULL; // also here static BASEBLOCK *recROM1 = NULL; // also here
static u32 *recRAMCopy = NULL; static u32 *recRAMCopy = NULL;
void JITCompile(); void JITCompile();
static BaseBlocks recBlocks(EE_NUMBLOCKS, (uptr)JITCompile); static BaseBlocks recBlocks((uptr)JITCompile);
static u8* recPtr = NULL, *recStackPtr = NULL; static u8* recPtr = NULL, *recStackPtr = NULL;
EEINST* s_pInstCache = NULL; EEINST* s_pInstCache = NULL;
static u32 s_nInstCacheSize = 0; static u32 s_nInstCacheSize = 0;
@ -1283,13 +1282,6 @@ void recRecompile( const u32 startpc )
s_pCurBlockEx = recBlocks.New(HWADDR(startpc), (uptr)recPtr); s_pCurBlockEx = recBlocks.New(HWADDR(startpc), (uptr)recPtr);
if( s_pCurBlockEx == NULL ) {
//Console::WriteLn("ee reset (blocks)");
recResetEE();
x86SetPtr( recPtr );
s_pCurBlockEx = recBlocks.New(HWADDR(startpc), (uptr)recPtr);
}
assert(s_pCurBlockEx); assert(s_pCurBlockEx);
branch = 0; branch = 0;