mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 23:41:26 +12:00
PPU/LLVM: Do not notify already compiled block.
Also flush m_pending_address_start to avoid memory consumption explosion.
This commit is contained in:
parent
ecb3d93918
commit
c407c786cc
1 changed files with 10 additions and 1 deletions
|
@ -302,6 +302,8 @@ const Executable RecompilationEngine::GetCompiledExecutableIfAvailable(u32 addre
|
||||||
void RecompilationEngine::NotifyBlockStart(u32 address) {
|
void RecompilationEngine::NotifyBlockStart(u32 address) {
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(m_pending_address_start_lock);
|
std::lock_guard<std::mutex> lock(m_pending_address_start_lock);
|
||||||
|
if (m_pending_address_start.size() > 10000)
|
||||||
|
m_pending_address_start.clear();
|
||||||
m_pending_address_start.push_back(address);
|
m_pending_address_start.push_back(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,7 +547,8 @@ static BranchType GetBranchTypeFromInstruction(u32 instruction)
|
||||||
u32 ppu_recompiler_llvm::CPUHybridDecoderRecompiler::ExecuteTillReturn(PPUThread * ppu_state, u64 context) {
|
u32 ppu_recompiler_llvm::CPUHybridDecoderRecompiler::ExecuteTillReturn(PPUThread * ppu_state, u64 context) {
|
||||||
CPUHybridDecoderRecompiler *execution_engine = (CPUHybridDecoderRecompiler *)ppu_state->GetDecoder();
|
CPUHybridDecoderRecompiler *execution_engine = (CPUHybridDecoderRecompiler *)ppu_state->GetDecoder();
|
||||||
|
|
||||||
execution_engine->m_recompilation_engine->NotifyBlockStart(ppu_state->PC);
|
// A block is a sequence of contiguous address.
|
||||||
|
bool previousInstContigousAndInterp = false;
|
||||||
|
|
||||||
while (PollStatus(ppu_state) == false) {
|
while (PollStatus(ppu_state) == false) {
|
||||||
const Executable executable = execution_engine->m_recompilation_engine->GetCompiledExecutableIfAvailable(ppu_state->PC);
|
const Executable executable = execution_engine->m_recompilation_engine->GetCompiledExecutableIfAvailable(ppu_state->PC);
|
||||||
|
@ -558,8 +561,13 @@ u32 ppu_recompiler_llvm::CPUHybridDecoderRecompiler::ExecuteTillReturn(PPUThread
|
||||||
if (exit == ExecutionStatus::ExecutionStatusPropagateException)
|
if (exit == ExecutionStatus::ExecutionStatusPropagateException)
|
||||||
return ExecutionStatus::ExecutionStatusPropagateException;
|
return ExecutionStatus::ExecutionStatusPropagateException;
|
||||||
execution_engine->m_recompilation_engine->NotifyBlockStart(ppu_state->PC);
|
execution_engine->m_recompilation_engine->NotifyBlockStart(ppu_state->PC);
|
||||||
|
previousInstContigousAndInterp = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// if previousInstContigousAndInterp is true, ie previous step was either a compiled block or a branch inst
|
||||||
|
// that caused a "gap" in instruction flow, we notify a new block.
|
||||||
|
if (!previousInstContigousAndInterp)
|
||||||
|
execution_engine->m_recompilation_engine->NotifyBlockStart(ppu_state->PC);
|
||||||
u32 instruction = vm::ps3::read32(ppu_state->PC);
|
u32 instruction = vm::ps3::read32(ppu_state->PC);
|
||||||
u32 oldPC = ppu_state->PC;
|
u32 oldPC = ppu_state->PC;
|
||||||
try
|
try
|
||||||
|
@ -571,6 +579,7 @@ u32 ppu_recompiler_llvm::CPUHybridDecoderRecompiler::ExecuteTillReturn(PPUThread
|
||||||
ppu_state->pending_exception = std::current_exception();
|
ppu_state->pending_exception = std::current_exception();
|
||||||
return ExecutionStatus::ExecutionStatusPropagateException;
|
return ExecutionStatus::ExecutionStatusPropagateException;
|
||||||
}
|
}
|
||||||
|
previousInstContigousAndInterp = (oldPC == ppu_state->PC);
|
||||||
auto branch_type = ppu_state->PC != oldPC ? GetBranchTypeFromInstruction(instruction) : BranchType::NonBranch;
|
auto branch_type = ppu_state->PC != oldPC ? GetBranchTypeFromInstruction(instruction) : BranchType::NonBranch;
|
||||||
ppu_state->PC += 4;
|
ppu_state->PC += 4;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue