MicroVU: removed usage of "using namespace std"

This commit is contained in:
archshift 2014-08-10 00:53:02 -07:00 committed by Gui Andrade
parent 66765d827b
commit 285e07be76
4 changed files with 16 additions and 17 deletions

View File

@ -104,10 +104,10 @@ void mVUreset(microVU& mVU, bool resetReserve) {
for(u32 i = 0; i < (mVU.progSize / 2); i++) { for(u32 i = 0; i < (mVU.progSize / 2); i++) {
if(!mVU.prog.prog[i]) { if(!mVU.prog.prog[i]) {
mVU.prog.prog[i] = new deque<microProgram*>(); mVU.prog.prog[i] = new std::deque<microProgram*>();
continue; continue;
} }
deque<microProgram*>::iterator it(mVU.prog.prog[i]->begin()); std::deque<microProgram*>::iterator it(mVU.prog.prog[i]->begin());
for ( ; it != mVU.prog.prog[i]->end(); ++it) { for ( ; it != mVU.prog.prog[i]->end(); ++it) {
mVUdeleteProg(mVU, it[0]); mVUdeleteProg(mVU, it[0]);
} }
@ -126,7 +126,7 @@ void mVUclose(microVU& mVU) {
// Delete Programs and Block Managers // Delete Programs and Block Managers
for (u32 i = 0; i < (mVU.progSize / 2); i++) { for (u32 i = 0; i < (mVU.progSize / 2); i++) {
if (!mVU.prog.prog[i]) continue; if (!mVU.prog.prog[i]) continue;
deque<microProgram*>::iterator it(mVU.prog.prog[i]->begin()); std::deque<microProgram*>::iterator it(mVU.prog.prog[i]->begin());
for ( ; it != mVU.prog.prog[i]->end(); ++it) { for ( ; it != mVU.prog.prog[i]->end(); ++it) {
mVUdeleteProg(mVU, it[0]); mVUdeleteProg(mVU, it[0]);
} }
@ -169,7 +169,7 @@ __ri microProgram* mVUcreateProg(microVU& mVU, int startPC) {
microProgram* prog = (microProgram*)_aligned_malloc(sizeof(microProgram), 64); microProgram* prog = (microProgram*)_aligned_malloc(sizeof(microProgram), 64);
memzero_ptr<sizeof(microProgram)>(prog); memzero_ptr<sizeof(microProgram)>(prog);
prog->idx = mVU.prog.total++; prog->idx = mVU.prog.total++;
prog->ranges = new deque<microRange>(); prog->ranges = new std::deque<microRange>();
prog->startPC = startPC; prog->startPC = startPC;
mVUcacheProg(mVU, *prog); // Cache Micro Program mVUcacheProg(mVU, *prog); // Cache Micro Program
double cacheSize = (double)((uptr)mVU.prog.x86end - (uptr)mVU.prog.x86start); double cacheSize = (double)((uptr)mVU.prog.x86end - (uptr)mVU.prog.x86start);
@ -191,7 +191,7 @@ __ri void mVUcacheProg(microVU& mVU, microProgram& prog) {
// Generate Hash for partial program based on compiled ranges... // Generate Hash for partial program based on compiled ranges...
u64 mVUrangesHash(microVU& mVU, microProgram& prog) { u64 mVUrangesHash(microVU& mVU, microProgram& prog) {
u32 hash[2] = {0, 0}; u32 hash[2] = {0, 0};
deque<microRange>::const_iterator it(prog.ranges->begin()); std::deque<microRange>::const_iterator it(prog.ranges->begin());
for ( ; it != prog.ranges->end(); ++it) { for ( ; it != prog.ranges->end(); ++it) {
if((it[0].start<0)||(it[0].end<0)) { DevCon.Error("microVU%d: Negative Range![%d][%d]", mVU.index, it[0].start, it[0].end); } if((it[0].start<0)||(it[0].end<0)) { DevCon.Error("microVU%d: Negative Range![%d][%d]", mVU.index, it[0].start, it[0].end); }
for(int i = it[0].start/4; i < it[0].end/4; i++) { for(int i = it[0].start/4; i < it[0].end/4; i++) {
@ -204,11 +204,11 @@ u64 mVUrangesHash(microVU& mVU, microProgram& prog) {
// Prints the ratio of unique programs to total programs // Prints the ratio of unique programs to total programs
void mVUprintUniqueRatio(microVU& mVU) { void mVUprintUniqueRatio(microVU& mVU) {
vector<u64> v; std::vector<u64> v;
for(u32 pc = 0; pc < mProgSize/2; pc++) { for(u32 pc = 0; pc < mProgSize/2; pc++) {
microProgramList* list = mVU.prog.prog[pc]; microProgramList* list = mVU.prog.prog[pc];
if (!list) continue; if (!list) continue;
deque<microProgram*>::iterator it(list->begin()); std::deque<microProgram*>::iterator it(list->begin());
for ( ; it != list->end(); ++it) { for ( ; it != list->end(); ++it) {
v.push_back(mVUrangesHash(mVU, *it[0])); v.push_back(mVUrangesHash(mVU, *it[0]));
} }
@ -222,7 +222,7 @@ void mVUprintUniqueRatio(microVU& mVU) {
// Compare partial program by only checking compiled ranges... // Compare partial program by only checking compiled ranges...
__ri bool mVUcmpPartial(microVU& mVU, microProgram& prog) { __ri bool mVUcmpPartial(microVU& mVU, microProgram& prog) {
deque<microRange>::const_iterator it(prog.ranges->begin()); std::deque<microRange>::const_iterator it(prog.ranges->begin());
for ( ; it != prog.ranges->end(); ++it) { for ( ; it != prog.ranges->end(); ++it) {
if((it[0].start<0)||(it[0].end<0)) { DevCon.Error("microVU%d: Negative Range![%d][%d]", mVU.index, it[0].start, it[0].end); } if((it[0].start<0)||(it[0].end<0)) { DevCon.Error("microVU%d: Negative Range![%d][%d]", mVU.index, it[0].start, it[0].end); }
if (memcmp_mmx(cmpOffset(prog.data), cmpOffset(mVU.regs().Micro), ((it[0].end + 8) - it[0].start))) { if (memcmp_mmx(cmpOffset(prog.data), cmpOffset(mVU.regs().Micro), ((it[0].end + 8) - it[0].start))) {
@ -250,7 +250,7 @@ _mVUt __fi void* mVUsearchProg(u32 startPC, uptr pState) {
microProgramQuick& quick = mVU.prog.quick[startPC/8]; microProgramQuick& quick = mVU.prog.quick[startPC/8];
microProgramList* list = mVU.prog.prog [startPC/8]; microProgramList* list = mVU.prog.prog [startPC/8];
if(!quick.prog) { // If null, we need to search for new program if(!quick.prog) { // If null, we need to search for new program
deque<microProgram*>::iterator it(list->begin()); std::deque<microProgram*>::iterator it(list->begin());
for ( ; it != list->end(); ++it) { for ( ; it != list->end(); ++it) {
if (mVUcmpProg(mVU, *it[0], 0)) { if (mVUcmpProg(mVU, *it[0], 0)) {
quick.block = it[0]->block[startPC/8]; quick.block = it[0]->block[startPC/8];

View File

@ -18,7 +18,6 @@
//#define mVUprofileProg // Shows opcode statistics in console //#define mVUprofileProg // Shows opcode statistics in console
class AsciiFile; class AsciiFile;
using namespace std;
using namespace x86Emitter; using namespace x86Emitter;
#include <deque> #include <deque>
@ -145,12 +144,12 @@ struct microRange {
struct microProgram { struct microProgram {
u32 data [mProgSize]; // Holds a copy of the VU microProgram u32 data [mProgSize]; // Holds a copy of the VU microProgram
microBlockManager* block[mProgSize/2]; // Array of Block Managers microBlockManager* block[mProgSize/2]; // Array of Block Managers
deque<microRange>* ranges; // The ranges of the microProgram that have already been recompiled std::deque<microRange>* ranges; // The ranges of the microProgram that have already been recompiled
u32 startPC; // Start PC of this program u32 startPC; // Start PC of this program
int idx; // Program index int idx; // Program index
}; };
typedef deque<microProgram*> microProgramList; typedef std::deque<microProgram*> microProgramList;
struct microProgramQuick { struct microProgramQuick {
microBlockManager* block; // Quick reference to valid microBlockManager for current startPC microBlockManager* block; // Quick reference to valid microBlockManager for current startPC

View File

@ -43,11 +43,11 @@ __fi void mVUcheckIsSame(mV) {
// Sets up microProgram PC ranges based on whats been recompiled // Sets up microProgram PC ranges based on whats been recompiled
void mVUsetupRange(microVU& mVU, s32 pc, bool isStartPC) { void mVUsetupRange(microVU& mVU, s32 pc, bool isStartPC) {
deque<microRange>*& ranges = mVUcurProg.ranges; std::deque<microRange>*& ranges = mVUcurProg.ranges;
pc &= mVU.microMemSize - 8; pc &= mVU.microMemSize - 8;
if (isStartPC) { // Check if startPC is already within a block we've recompiled if (isStartPC) { // Check if startPC is already within a block we've recompiled
deque<microRange>::const_iterator it(ranges->begin()); std::deque<microRange>::const_iterator it(ranges->begin());
for ( ; it != ranges->end(); ++it) { for ( ; it != ranges->end(); ++it) {
if ((pc >= it[0].start) && (pc <= it[0].end)) { if ((pc >= it[0].start) && (pc <= it[0].end)) {
if (it[0].start != it[0].end) if (it[0].start != it[0].end)
@ -72,7 +72,7 @@ void mVUsetupRange(microVU& mVU, s32 pc, bool isStartPC) {
bool mergedRange = false; bool mergedRange = false;
s32 rStart = mVUrange.start; s32 rStart = mVUrange.start;
s32 rEnd = mVUrange.end; s32 rEnd = mVUrange.end;
deque<microRange>::iterator it(ranges->begin()); std::deque<microRange>::iterator it(ranges->begin());
for (++it; it != ranges->end(); ++it) { for (++it; it != ranges->end(); ++it) {
if((it[0].start >= rStart) && (it[0].start <= rEnd)) { if((it[0].start >= rStart) && (it[0].start <= rEnd)) {
it[0].end = max(it[0].end, rEnd); it[0].end = max(it[0].end, rEnd);

View File

@ -338,7 +338,7 @@ __fi void mVUsetupFlags(mV, microFlagCycles& mFC) {
} }
// Scan through instructions and check if flags are read (FSxxx, FMxxx, FCxxx opcodes) // Scan through instructions and check if flags are read (FSxxx, FMxxx, FCxxx opcodes)
void _mVUflagPass(mV, u32 startPC, u32 sCount, u32 found, vector<u32>& v) { void _mVUflagPass(mV, u32 startPC, u32 sCount, u32 found, std::vector<u32>& v) {
for (u32 i = 0; i < v.size(); i++) { for (u32 i = 0; i < v.size(); i++) {
if (v[i] == startPC) return; // Prevent infinite recursion if (v[i] == startPC) return; // Prevent infinite recursion
@ -375,7 +375,7 @@ void _mVUflagPass(mV, u32 startPC, u32 sCount, u32 found, vector<u32>& v) {
} }
void mVUflagPass(mV, u32 startPC, u32 sCount = 0, u32 found = 0) { void mVUflagPass(mV, u32 startPC, u32 sCount = 0, u32 found = 0) {
vector<u32> v; std::vector<u32> v;
_mVUflagPass(mVU, startPC, sCount, found, v); _mVUflagPass(mVU, startPC, sCount, found, v);
} }