aboutsummaryrefslogtreecommitdiff
path: root/src/ARMJIT_x64
diff options
context:
space:
mode:
authorRSDuck <rsduck@users.noreply.github.com>2019-08-16 23:17:08 +0200
committerRSDuck <rsduck@users.noreply.github.com>2020-04-26 13:04:57 +0200
commit5e443e79625b66daf15350d68921d74673cb5232 (patch)
tree7829e144c54fde6bd638163d8817e1d6df5d864e /src/ARMJIT_x64
parentdcf21c98f2d253a5c7300c358d21ca67c193944d (diff)
remove unneeded dolphin code, C++11 static_assert
Diffstat (limited to 'src/ARMJIT_x64')
-rw-r--r--src/ARMJIT_x64/ARMJIT_ALU.cpp4
-rw-r--r--src/ARMJIT_x64/ARMJIT_Compiler.cpp19
-rw-r--r--src/ARMJIT_x64/ARMJIT_Compiler.h5
-rw-r--r--src/ARMJIT_x64/ARMJIT_LoadStore.cpp2
4 files changed, 16 insertions, 14 deletions
diff --git a/src/ARMJIT_x64/ARMJIT_ALU.cpp b/src/ARMJIT_x64/ARMJIT_ALU.cpp
index 368fd8b..f0bcf8e 100644
--- a/src/ARMJIT_x64/ARMJIT_ALU.cpp
+++ b/src/ARMJIT_x64/ARMJIT_ALU.cpp
@@ -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));
diff --git a/src/ARMJIT_x64/ARMJIT_Compiler.cpp b/src/ARMJIT_x64/ARMJIT_Compiler.cpp
index cb11f73..0fbcfda 100644
--- a/src/ARMJIT_x64/ARMJIT_Compiler.cpp
+++ b/src/ARMJIT_x64/ARMJIT_Compiler.cpp
@@ -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;
diff --git a/src/ARMJIT_x64/ARMJIT_Compiler.h b/src/ARMJIT_x64/ARMJIT_Compiler.h
index 0ce7d8d..3151cbc 100644
--- a/src/ARMJIT_x64/ARMJIT_Compiler.h
+++ b/src/ARMJIT_x64/ARMJIT_Compiler.h
@@ -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];
diff --git a/src/ARMJIT_x64/ARMJIT_LoadStore.cpp b/src/ARMJIT_x64/ARMJIT_LoadStore.cpp
index ee0a7af..6386f8b 100644
--- a/src/ARMJIT_x64/ARMJIT_LoadStore.cpp
+++ b/src/ARMJIT_x64/ARMJIT_LoadStore.cpp
@@ -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;
}