jit: Ignore zero byte icache invalidates.

These were getting marked pending and were clearing all cache, causing
performance concerns in for example LittleBigPlanet.
This commit is contained in:
Unknown W. Brackets committed 2022-10-15 18:27:52 -07:00
1 parent cbe31af8cf
commit c4bf2cb5c0
5 files changed
+18 -14

No files matched your search

+4 -3
View File
@@ -233,8 +233,9 @@ static int Replace_memcpy16() {
bool skip = false;
// Some games use memcpy on executable code. We need to flush emuhack ops.
currentMIPS->InvalidateICache(srcPtr, bytes);
if ((skipGPUReplacements & (int)GPUReplacementSkip::MEMCPY) == 0) {
if (bytes != 0)
currentMIPS->InvalidateICache(srcPtr, bytes);
if ((skipGPUReplacements & (int)GPUReplacementSkip::MEMCPY) == 0 && bytes != 0) {
if (Memory::IsVRAMAddress(destPtr) || Memory::IsVRAMAddress(srcPtr)) {
skip = gpu->PerformMemoryCopy(destPtr, srcPtr, bytes);
}
@@ -305,7 +306,7 @@ static int Replace_memmove() {
bool skip = false;
// Some games use memcpy on executable code. We need to flush emuhack ops.
if ((skipGPUReplacements & (int)GPUReplacementSkip::MEMMOVE) == 0) {
if ((skipGPUReplacements & (int)GPUReplacementSkip::MEMMOVE) == 0 && bytes != 0) {
currentMIPS->InvalidateICache(srcPtr, bytes);
if (Memory::IsVRAMAddress(destPtr) || Memory::IsVRAMAddress(srcPtr)) {
skip = gpu->PerformMemoryCopy(destPtr, srcPtr, bytes);
+1 -1
View File
@@ -49,7 +49,7 @@ static int __DmacMemcpy(u32 dst, u32 src, u32 size) {
if (Memory::IsVRAMAddress(src) || Memory::IsVRAMAddress(dst)) {
skip = gpu->PerformMemoryCopy(dst, src, size);
}
if (!skip) {
if (!skip && size != 0) {
currentMIPS->InvalidateICache(src, size);
if (MemBlockInfoDetailed(size)) {
const std::string tag = GetMemWriteTagAt("DmacMemcpy/", src, size);
+2 -1
View File
@@ -392,7 +392,8 @@ int sceKernelDcacheInvalidateRange(u32 addr, int size)
int sceKernelIcacheInvalidateRange(u32 addr, int size) {
DEBUG_LOG(CPU, "sceKernelIcacheInvalidateRange(%08x, %i)", addr, size);
currentMIPS->InvalidateICache(addr, size);
if (size != 0)
currentMIPS->InvalidateICache(addr, size);
return 0;
}
+2 -1
View File
@@ -624,7 +624,8 @@ static u32 sceKernelMemcpy(u32 dst, u32 src, u32 size)
DEBUG_LOG(SCEKERNEL, "sceKernelMemcpy(dest=%08x, src=%08x, size=%i)", dst, src, size);
// Some games copy from executable code. We need to flush emuhack ops.
currentMIPS->InvalidateICache(src, size);
if (size != 0)
currentMIPS->InvalidateICache(src, size);
bool skip = false;
if (Memory::IsVRAMAddress(src) || Memory::IsVRAMAddress(dst)) {
+9 -8
View File
@@ -366,14 +366,15 @@ void MIPSState::ProcessPendingClears() {
void MIPSState::InvalidateICache(u32 address, int length) {
// Only really applies to jit.
std::lock_guard<std::recursive_mutex> guard(MIPSComp::jitLock);
if (MIPSComp::jit) {
if (coreState == CORE_RUNNING || insideJit) {
pendingClears.emplace_back(address, length);
hasPendingClears = true;
CoreTiming::ForceCheck();
} else {
MIPSComp::jit->InvalidateCacheAt(address, length);
}
if (!MIPSComp::jit || length == 0)
return;
if (coreState == CORE_RUNNING || insideJit) {
pendingClears.emplace_back(address, length);
hasPendingClears = true;
CoreTiming::ForceCheck();
} else {
MIPSComp::jit->InvalidateCacheAt(address, length);
}
}