vif: don't allocate vifblock hash on the heap

Avoid an extra indirection to access the hash bucket (Find function)
This commit is contained in:
Gregory Hainaut 2016-12-12 19:20:26 +01:00
parent 3dc7dc0cdc
commit 1acc81c25d
3 changed files with 4 additions and 10 deletions

View File

@ -86,7 +86,7 @@ struct nVifStruct {
RecompiledCodeReserve* recReserve;
u8* recWritePtr; // current write pos into the reserve
HashBucket<_tParams>* vifBlocks; // Vif Blocks
HashBucket<_tParams> vifBlocks; // Vif Blocks
nVifStruct();
};

View File

@ -23,7 +23,7 @@
#include "Utilities/Perf.h"
static void recReset(int idx) {
nVif[idx].vifBlocks->clear();
nVif[idx].vifBlocks.clear();
nVif[idx].recReserve->Reset();
@ -40,17 +40,12 @@ void dVifReserve(int idx) {
void dVifReset(int idx) {
pxAssertDev(nVif[idx].recReserve, "Dynamic VIF recompiler reserve must be created prior to VIF use or reset!");
if(!nVif[idx].vifBlocks)
nVif[idx].vifBlocks = new HashBucket<_tParams>();
recReset(idx);
}
void dVifClose(int idx) {
if (nVif[idx].recReserve)
nVif[idx].recReserve->Reset();
safe_delete(nVif[idx].vifBlocks);
}
void dVifRelease(int idx) {
@ -303,7 +298,7 @@ _vifT static __ri void dVifExecuteUnpack(const u8* data, uptr x86, bool isFill)
_vifT __fi uptr dVifCompile(nVifBlock& key) {
nVifStruct& v = nVif[idx];
nVifBlock* block = v.vifBlocks->find(&key);
nVifBlock* block = v.vifBlocks.find(&key);
// Cache hit
if (likely(block != nullptr))
@ -321,7 +316,7 @@ _vifT __fi uptr dVifCompile(nVifBlock& key) {
xSetPtr(v.recWritePtr);
key.startPtr = (uptr)xGetAlignedCallTarget();
v.vifBlocks->add(key);
v.vifBlocks.add(key);
VifUnpackSSE_Dynarec(v, key).CompileRoutine();

View File

@ -73,7 +73,6 @@ static const __aligned16 Fnptr_VifUnpackLoop UnpackLoopTable[2][2][2] = {
nVifStruct::nVifStruct()
{
vifBlocks = NULL;
}
void reserveNewVif(int idx)