Debugger: Fixed performance issue with disassembly

This commit is contained in:
Sour 2019-06-24 11:46:59 -04:00
parent 237718c6b8
commit cf6b21bf23
4 changed files with 10 additions and 8 deletions

View file

@ -181,7 +181,7 @@ void Debugger::ProcessCpuWrite(uint32_t addr, uint8_t value, MemoryOperationType
AddressInfo addressInfo = _memoryManager->GetAbsoluteAddress(addr);
MemoryOperationInfo operation = { addr, value, type };
if(addressInfo.Address >= 0 && (addressInfo.Type == SnesMemoryType::WorkRam || addressInfo.Type == SnesMemoryType::SaveRam)) {
_disassembler->InvalidateCache(addressInfo);
_disassembler->InvalidateCache(addressInfo, CpuType::Cpu);
}
if(_memoryManager->IsRegister(addr)) {
@ -268,7 +268,7 @@ void Debugger::ProcessSpcWrite(uint16_t addr, uint8_t value, MemoryOperationType
MemoryOperationInfo operation { addr, value, type };
ProcessBreakConditions(operation, addressInfo);
_disassembler->InvalidateCache(addressInfo);
_disassembler->InvalidateCache(addressInfo, CpuType::Spc);
_memoryAccessCounter->ProcessMemoryAccess(addressInfo, type, _memoryManager->GetMasterClock());
}

View file

@ -98,10 +98,12 @@ uint32_t Disassembler::BuildCache(AddressInfo &addrInfo, uint8_t cpuFlags, CpuTy
if(!disInfo.IsInitialized() || !disInfo.IsValid(cpuFlags)) {
disInfo.Initialize(source+address, cpuFlags, type);
_needDisassemble[(int)type] = true;
returnSize += disInfo.GetOpSize();
} else {
returnSize += disInfo.GetOpSize();
break;
}
returnSize += disInfo.GetOpSize();
if(disInfo.UpdateCpuFlags(cpuFlags)) {
address += disInfo.GetOpSize();
} else {
@ -117,7 +119,7 @@ void Disassembler::ResetPrgCache()
_needDisassemble[(int)CpuType::Cpu] = true;
}
void Disassembler::InvalidateCache(AddressInfo addrInfo)
void Disassembler::InvalidateCache(AddressInfo addrInfo, CpuType type)
{
uint8_t *source;
uint32_t sourceLength;
@ -129,9 +131,8 @@ void Disassembler::InvalidateCache(AddressInfo addrInfo)
if(addrInfo.Address >= i) {
if((*cache)[addrInfo.Address - i].IsInitialized()) {
(*cache)[addrInfo.Address - i].Reset();
_needDisassemble[(int)type] = true;
}
_needDisassemble[(int)CpuType::Cpu] = true;
_needDisassemble[(int)CpuType::Spc] = true;
}
}
}

View file

@ -55,7 +55,7 @@ public:
uint32_t BuildCache(AddressInfo &addrInfo, uint8_t cpuFlags, CpuType type);
void ResetPrgCache();
void InvalidateCache(AddressInfo addrInfo);
void InvalidateCache(AddressInfo addrInfo, CpuType type);
void Disassemble(CpuType cpuType);
DisassemblyInfo GetDisassemblyInfo(AddressInfo &info);

View file

@ -152,6 +152,7 @@ bool DisassemblyInfo::UpdateCpuFlags(uint8_t &cpuFlags)
}
return true;
default:
case CpuType::Spc: return false;
}
}