remove unneeded dolphin code, C++11 static_assert

This commit is contained in:
RSDuck
2019-08-16 23:17:08 +02:00
parent 727be0fd92
commit 86b96ca47a
12 changed files with 41 additions and 216 deletions

View File

@ -257,7 +257,7 @@ void Compiler::Comp_MulOp(bool S, bool add, Gen::OpArg rd, Gen::OpArg rm, Gen::O
Comp_AddCycles_CI(RSCRATCH, add ? 2 : 1);
}
static_assert(EAX == RSCRATCH);
static_assert(EAX == RSCRATCH, "Someone changed RSCRATCH!");
MOV(32, R(RSCRATCH), rm);
if (add)
{
@ -383,7 +383,7 @@ OpArg Compiler::Comp_RegShiftReg(int op, Gen::OpArg rs, Gen::OpArg rm, bool S, b
}
MOV(32, R(RSCRATCH), rm);
static_assert(RSCRATCH3 == ECX);
static_assert(RSCRATCH3 == ECX, "Someone changed RSCRATCH3");
MOV(32, R(ECX), rs);
AND(32, R(ECX), Imm32(0xFF));

View File

@ -63,12 +63,11 @@ Compiler::Compiler()
mprotect(pageAligned, alignedSize, PROT_EXEC | PROT_READ | PROT_WRITE);
#endif
region = pageAligned;
region_size = alignedSize;
total_region_size = region_size;
ResetStart = pageAligned;
CodeMemSize = alignedSize;
}
ClearCodeSpace();
Reset();
for (int i = 0; i < 3; i++)
{
@ -169,9 +168,8 @@ Compiler::Compiler()
}
// move the region forward to prevent overwriting the generated functions
region_size -= GetWritableCodePtr() - region;
total_region_size = region_size;
region = GetWritableCodePtr();
CodeMemSize -= GetWritableCodePtr() - ResetStart;
ResetStart = GetWritableCodePtr();
}
void Compiler::LoadCPSR()
@ -208,7 +206,7 @@ Gen::FixupBranch Compiler::CheckCondition(u32 cond)
{
if (cond >= 0x8)
{
static_assert(RSCRATCH3 == ECX);
static_assert(RSCRATCH3 == ECX, "RSCRATCH has to be equal to ECX!");
MOV(32, R(RSCRATCH3), R(RCPSR));
SHR(32, R(RSCRATCH3), Imm8(28));
MOV(32, R(RSCRATCH), Imm32(1));
@ -346,12 +344,13 @@ const Compiler::CompileFunc T_Comp[ARMInstrInfo::tk_Count] = {
void Compiler::Reset()
{
ClearCodeSpace();
memset(ResetStart, 0xcc, CodeMemSize);
SetCodePtr(ResetStart);
}
CompiledBlock Compiler::CompileBlock(ARM* cpu, FetchedInstr instrs[], int instrsCount)
{
if (IsAlmostFull())
if (CodeMemSize - (GetWritableCodePtr() - ResetStart) < 1024 * 32) // guess...
InvalidateBlockCache();
ConstantCycles = 0;

View File

@ -17,7 +17,7 @@ const Gen::X64Reg RSCRATCH2 = Gen::EDX;
const Gen::X64Reg RSCRATCH3 = Gen::ECX;
class Compiler : public Gen::X64CodeBlock
class Compiler : public Gen::XEmitter
{
public:
Compiler();
@ -132,6 +132,9 @@ public:
return Gen::R(RegCache.Mapping[reg]);
}
u8* ResetStart;
u32 CodeMemSize;
void* MemoryFuncs9[3][2];
void* MemoryFuncs7[3][2][2];

View File

@ -171,7 +171,7 @@ void* Compiler::Gen_MemoryRoutine9(bool store, int size)
}
RET();
static_assert(RSCRATCH == EAX);
static_assert(RSCRATCH == EAX, "Someone changed RSCRATCH!");
return res;
}