Move some stuff from bss to heap

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@521 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-09-13 18:35:49 +00:00
parent 7a8d4a1987
commit bec80af7d2
5 changed files with 76 additions and 50 deletions

View File

@ -38,6 +38,7 @@
#include "SystemTimers.h"
#include "../IPC_HLE/WII_IPC_HLE.h"
#include "../State.h"
#include "../PowerPC/PPCAnalyst.h"
#define CURVERSION 0x0001
@ -46,6 +47,7 @@ namespace HW
void Init()
{
CoreTiming::Init();
PPCAnalyst::Init();
Thunk_Init(); // not really hw, but this way we know it's inited first :P
State_Init();
@ -86,6 +88,7 @@ namespace HW
State_Shutdown();
Thunk_Shutdown();
CoreTiming::Shutdown();
PPCAnalyst::Shutdown();
}
void DoState(PointerWrap &p)

View File

@ -23,7 +23,7 @@
#include "Debugger/Debugger_SymbolMap.h"
LogManager::SMessage LogManager::m_Messages[MAX_MESSAGES];
LogManager::SMessage *LogManager::m_Messages;
int LogManager::m_nextMessages = 0;
CDebugger_Log* LogManager::m_Log[LogTypes::NUMBER_OF_LOGS];
@ -81,6 +81,7 @@ void CDebugger_Log::Shutdown()
void LogManager::Init()
{
m_Messages = new SMessage[MAX_MESSAGES];
m_bDirty = true;
// create Logs
@ -147,6 +148,8 @@ void LogManager::Shutdown()
m_Log[i] = NULL;
}
}
delete [] m_Messages;
}

View File

@ -84,7 +84,7 @@ public:
private:
friend class CDebugger_LogWindow;
friend class CLogWindow;
static SMessage m_Messages[MAX_MESSAGES];
static SMessage *m_Messages;
static int m_nextMessages;
static int m_activeLog;
static bool m_bDirty;

View File

@ -38,7 +38,22 @@ namespace PPCAnalyst {
using namespace std;
// VERY ugly. TODO: remove.
PPCAnalyst::CodeOp codebuffer[20000];
PPCAnalyst::CodeOp *codebuffer;
enum {
CODEBUFFER_SIZE = 32000,
};
void Init()
{
codebuffer = new PPCAnalyst::CodeOp[CODEBUFFER_SIZE];
}
void Shutdown()
{
delete [] codebuffer;
}
void AnalyzeFunction2(Symbol &func);
u32 EvaluateBranchTarget(UGeckoInstruction instr, u32 pc);
@ -441,7 +456,7 @@ CodeOp *Flatten(u32 address, u32 &realsize, BlockStats &st, BlockRegStats &gpa,
for (int j = 0; j < 2; j++)
code[i].regsOut[j] = -1;
code[i].fregOut=-1;
code[i].fregOut = -1;
int numOut = 0;
int numIn = 0;

View File

@ -31,8 +31,9 @@ struct Symbol;
namespace PPCAnalyst
{
struct CodeOp //16B
{
struct CodeOp //16B
{
UGeckoInstruction inst;
u32 address;
u32 branchTo; //if 0, not a branch
@ -49,17 +50,17 @@ namespace PPCAnalyst
bool outputCR1;
bool outputPS1;
const u8 *x86ptr;
};
};
struct BlockStats
{
struct BlockStats
{
bool isFirstBlockOfFunction;
bool isLastBlockOfFunction;
int numCycles;
};
};
struct BlockRegStats
{
struct BlockRegStats
{
short firstRead[32];
short firstWrite[32];
short lastRead[32];
@ -74,16 +75,20 @@ namespace PPCAnalyst
int GetUseRange(int reg) {
return max(lastRead[reg], lastWrite[reg]) -
min(firstRead[reg], firstWrite[reg]);}
};
};
void ShuffleUp(CodeOp *code, int first, int last);
void Init();
void Shutdown();
CodeOp *Flatten(u32 address, u32 &realsize, BlockStats &st, BlockRegStats &gpa, BlockRegStats &fpa);
void ShuffleUp(CodeOp *code, int first, int last);
void LogFunctionCall(u32 addr);
CodeOp *Flatten(u32 address, u32 &realsize, BlockStats &st, BlockRegStats &gpa, BlockRegStats &fpa);
void LogFunctionCall(u32 addr);
void FindFunctions(u32 startAddr, u32 endAddr, SymbolDB *func_db);
bool AnalyzeFunction(u32 startAddr, Symbol &func, int max_size = 0);
void FindFunctions(u32 startAddr, u32 endAddr, SymbolDB *func_db);
bool AnalyzeFunction(u32 startAddr, Symbol &func, int max_size = 0);
} // namespace
#endif