/[pcsx2_0.9.7]/trunk/pcsx2/x86/microVU.h
ViewVC logotype

Diff of /trunk/pcsx2/x86/microVU.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/pcsx2/x86/microVU.h	2010/12/23 11:48:33	279
+++ trunk/pcsx2/x86/microVU.h	2010/12/23 12:02:12	280
@@ -28,7 +28,6 @@
 #include "iR5900.h"
 #include "R5900OpcodeTables.h"
 #include "x86emitter/x86emitter.h"
-#include "SamplProf.h"
 #include "microVU_Misc.h"
 #include "microVU_IR.h"
 
@@ -50,10 +49,9 @@
 	}
 	~microBlockManager() { reset(); }
 	void reset() {
-		microBlockLink* linkI = blockList;
-		while( linkI != NULL )
-		{
+		for(microBlockLink* linkI = blockList; linkI != NULL; ) {
 			microBlockLink* freeI = linkI;
+			safe_delete_array(linkI->block.jumpCache);
 			linkI = linkI->next;
 			_aligned_free(freeI);
 		}
@@ -64,7 +62,8 @@
 		microBlock* thisBlock = search(&pBlock->pState);
 		if (!thisBlock) {
 			listI++;
-			microBlockLink* newBlock = (microBlockLink*)_aligned_malloc(sizeof(microBlockLink), 16);
+			microBlockLink* newBlock  = (microBlockLink*)_aligned_malloc(sizeof(microBlockLink), 16);
+			newBlock->block.jumpCache = NULL;
 			newBlock->next = NULL;
 
 			if (blockEnd) {
@@ -150,11 +149,10 @@
 	microRegInfo		lpState;			// Pipeline state from where program left off (useful for continuing execution)
 };
 
-#define mVUdispCacheSize (0x1000) // Dispatcher Cache Size
-#define mVUcacheSize     ((index) ? (_1mb *  17) : (_1mb *  7)) // Initial Size (Excluding Safe-Zone)
-#define mVUcacheMaxSize  ((mVU->index) ? (_1mb * 100) : (_1mb * 50)) // Max Size allowed to grow to
-#define mVUcacheGrowBy	 ((mVU->index) ? (_1mb *  15) : (_1mb * 10)) // Grows by this amount
-#define mVUcacheSafeZone ((index) ? (_1mb *   3) : (_1mb *  3)) // Safe-Zone for last program
+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 {
 
@@ -171,11 +169,13 @@
 	u32 progMemMask;	// VU Micro Memory Size (in u32's)
 	u32 cacheSize;		// VU Cache Size
 
-	microProgManager prog;		// Micro Program Data
+	microProgManager			prog;		// Micro Program Data
 	ScopedPtr<microRegAlloc>	regAlloc;	// Reg Alloc Class
 	ScopedPtr<AsciiFile>		logFile;	// Log File Pointer
 
-	u8*		cache;		 // Dynarec Cache Start (where we will start writing the recompiled code to)
+
+	RecompiledCodeReserve* cache_reserve;
+	u8*		cache;       // Dynarec Cache Start (where we will start writing the recompiled code to)
 	u8*		dispCache;	 // Dispatchers Cache (where startFunct and exitFunct are written to)
 	u8*		startFunct;	 // Ptr Function to the Start code for recompiled programs
 	u8*		exitFunct;	 // Ptr Function to the Exit  code for recompiled programs
@@ -198,7 +198,7 @@
 	__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); }
@@ -224,7 +224,17 @@
 		pxAssumeDev((prog.IRinfo.curPC & 1) == 0, "microVU recompiler: Upper instructions cannot have valid branch addresses.");
 		return (((prog.IRinfo.curPC + 4)  + (Imm11() * 2)) & progMemMask) * 4;
 	}
+	
+	microVU()
+	{
+		cacheSize		= mVUcacheInitReserve;
+		cache			= NULL;
+		dispCache		= NULL;
+		startFunct		= NULL;
+		exitFunct		= NULL;
+	}
 
+	void reserveCache();
 	void init(uint vuIndex);
 	void reset();
 	void close();
@@ -239,9 +249,8 @@
 
 // Main Functions
 static void  mVUclear(mV, u32, u32);
-static void  mVUresizeCache(mV, u32);
 static void* mVUblockFetch(microVU* mVU, u32 startPC, uptr pState);
-_mVUt extern void* __fastcall mVUcompileJIT(u32 startPC, uptr pState);
+_mVUt extern void* __fastcall mVUcompileJIT(u32 startPC, uptr ptr);
 
 // Prototypes for Linux
 extern void  __fastcall mVUcleanUpVU0();

 

  ViewVC Help
Powered by ViewVC 1.1.22