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
@ -109,7 +110,7 @@ void LogManager::Init()
m_Log[LogTypes::WII_IOB] = new CDebugger_Log("WII_IOB", "WII IO Bridge");
m_Log[LogTypes::WII_IPC] = new CDebugger_Log("WII_IPC", "WII IPC");
m_Log[LogTypes::WII_IPC_HLE] = new CDebugger_Log("WII_IPC_HLE", "WII IPC HLE");
m_Log[LogTypes::WIIMOTE] = new CDebugger_Log("WIIMOTE", "WIIMOTE");
m_Log[LogTypes::WIIMOTE] = new CDebugger_Log("WIIMOTE", "WIIMOTE");
for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; i++)
{
@ -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,59 +31,64 @@ struct Symbol;
namespace PPCAnalyst
{
struct CodeOp //16B
{
UGeckoInstruction inst;
u32 address;
u32 branchTo; //if 0, not a branch
int branchToIndex; //index of target block
u8 regsOut[2];
u8 regsIn[3];
u8 fregOut;
u8 fregsIn[3];
bool isBranchTarget;
bool wantsCR0;
bool wantsCR1;
bool wantsPS1;
bool outputCR0;
bool outputCR1;
bool outputPS1;
const u8 *x86ptr;
};
struct BlockStats
{
bool isFirstBlockOfFunction;
bool isLastBlockOfFunction;
int numCycles;
};
struct CodeOp //16B
{
UGeckoInstruction inst;
u32 address;
u32 branchTo; //if 0, not a branch
int branchToIndex; //index of target block
u8 regsOut[2];
u8 regsIn[3];
u8 fregOut;
u8 fregsIn[3];
bool isBranchTarget;
bool wantsCR0;
bool wantsCR1;
bool wantsPS1;
bool outputCR0;
bool outputCR1;
bool outputPS1;
const u8 *x86ptr;
};
struct BlockRegStats
{
short firstRead[32];
short firstWrite[32];
short lastRead[32];
short lastWrite[32];
short numReads[32];
short numWrites[32];
struct BlockStats
{
bool isFirstBlockOfFunction;
bool isLastBlockOfFunction;
int numCycles;
};
bool any;
bool anyTimer;
struct BlockRegStats
{
short firstRead[32];
short firstWrite[32];
short lastRead[32];
short lastWrite[32];
short numReads[32];
short numWrites[32];
int GetTotalNumAccesses(int reg) {return numReads[reg] + numWrites[reg];}
int GetUseRange(int reg) {
return max(lastRead[reg], lastWrite[reg]) -
min(firstRead[reg], firstWrite[reg]);}
};
bool any;
bool anyTimer;
void ShuffleUp(CodeOp *code, int first, int last);
int GetTotalNumAccesses(int reg) {return numReads[reg] + numWrites[reg];}
int GetUseRange(int reg) {
return max(lastRead[reg], lastWrite[reg]) -
min(firstRead[reg], firstWrite[reg]);}
};
CodeOp *Flatten(u32 address, u32 &realsize, BlockStats &st, BlockRegStats &gpa, BlockRegStats &fpa);
void Init();
void Shutdown();
void LogFunctionCall(u32 addr);
void ShuffleUp(CodeOp *code, int first, int last);
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