CPU/Recompiler: Skip calling event update on interrupts
This commit is contained in:
parent
401fc006ea
commit
7d1747b527
|
@ -1998,6 +1998,12 @@ CodeBlock::HostCodePointer CodeGenerator::CompileDispatcher()
|
||||||
m_emit->Bind(&downcount_hit);
|
m_emit->Bind(&downcount_hit);
|
||||||
|
|
||||||
// check events then for frame done
|
// check events then for frame done
|
||||||
|
m_emit->ldr(a64::w8, a64::MemOperand(GetHostReg64(RCPUPTR), offsetof(State, pending_ticks)));
|
||||||
|
EmitLoadGlobalAddress(9, TimingEvents::GetHeadEventPtr());
|
||||||
|
m_emit->ldr(a64::x9, a64::MemOperand(a64::x9));
|
||||||
|
m_emit->ldr(a64::w9, a64::MemOperand(a64::x9, offsetof(TimingEvent, m_downcount)));
|
||||||
|
m_emit->cmp(a64::w8, a64::w9);
|
||||||
|
m_emit->b(&frame_done_loop, a64::lt);
|
||||||
EmitFunctionCall(nullptr, &TimingEvents::RunEvents);
|
EmitFunctionCall(nullptr, &TimingEvents::RunEvents);
|
||||||
m_emit->b(&frame_done_loop);
|
m_emit->b(&frame_done_loop);
|
||||||
|
|
||||||
|
|
|
@ -2620,6 +2620,11 @@ CodeBlock::HostCodePointer CodeGenerator::CompileDispatcher()
|
||||||
m_emit->L(downcount_hit);
|
m_emit->L(downcount_hit);
|
||||||
|
|
||||||
// check events then for frame done
|
// check events then for frame done
|
||||||
|
EmitLoadGlobalAddress(Xbyak::Operand::RAX, TimingEvents::GetHeadEventPtr());
|
||||||
|
m_emit->mov(m_emit->rax, m_emit->qword[m_emit->rax]);
|
||||||
|
m_emit->mov(m_emit->eax, m_emit->dword[m_emit->rax + offsetof(TimingEvent, m_downcount)]);
|
||||||
|
m_emit->cmp(m_emit->eax, m_emit->dword[m_emit->rbp + offsetof(State, pending_ticks)]);
|
||||||
|
m_emit->jg(frame_done_loop);
|
||||||
EmitFunctionCall(nullptr, &TimingEvents::RunEvents);
|
EmitFunctionCall(nullptr, &TimingEvents::RunEvents);
|
||||||
m_emit->jmp(frame_done_loop);
|
m_emit->jmp(frame_done_loop);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ static TimingEvent* s_active_events_tail;
|
||||||
static TimingEvent* s_current_event = nullptr;
|
static TimingEvent* s_current_event = nullptr;
|
||||||
static u32 s_active_event_count = 0;
|
static u32 s_active_event_count = 0;
|
||||||
static u32 s_global_tick_counter = 0;
|
static u32 s_global_tick_counter = 0;
|
||||||
static u32 s_last_event_run_time = 0;
|
|
||||||
|
|
||||||
u32 GetGlobalTickCounter()
|
u32 GetGlobalTickCounter()
|
||||||
{
|
{
|
||||||
|
@ -28,7 +27,6 @@ void Initialize()
|
||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
s_global_tick_counter = 0;
|
s_global_tick_counter = 0;
|
||||||
s_last_event_run_time = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown()
|
void Shutdown()
|
||||||
|
@ -260,7 +258,7 @@ void RunEvents()
|
||||||
{
|
{
|
||||||
DebugAssert(!s_current_event);
|
DebugAssert(!s_current_event);
|
||||||
|
|
||||||
TickCount pending_ticks = (s_global_tick_counter + CPU::GetPendingTicks()) - s_last_event_run_time;
|
TickCount pending_ticks = CPU::GetPendingTicks();
|
||||||
CPU::ResetPendingTicks();
|
CPU::ResetPendingTicks();
|
||||||
while (pending_ticks > 0)
|
while (pending_ticks > 0)
|
||||||
{
|
{
|
||||||
|
@ -296,7 +294,6 @@ void RunEvents()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
s_last_event_run_time = s_global_tick_counter;
|
|
||||||
s_current_event = nullptr;
|
s_current_event = nullptr;
|
||||||
UpdateCPUDowncount();
|
UpdateCPUDowncount();
|
||||||
}
|
}
|
||||||
|
@ -338,8 +335,6 @@ bool DoState(StateWrapper& sw)
|
||||||
event->m_interval = interval;
|
event->m_interval = interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
sw.Do(&s_last_event_run_time);
|
|
||||||
|
|
||||||
Log_DevPrintf("Loaded %u events from save state.", event_count);
|
Log_DevPrintf("Loaded %u events from save state.", event_count);
|
||||||
SortEvents();
|
SortEvents();
|
||||||
}
|
}
|
||||||
|
@ -357,8 +352,6 @@ bool DoState(StateWrapper& sw)
|
||||||
sw.Do(&event->m_interval);
|
sw.Do(&event->m_interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
sw.Do(&s_last_event_run_time);
|
|
||||||
|
|
||||||
Log_DevPrintf("Wrote %u events to save state.", s_active_event_count);
|
Log_DevPrintf("Wrote %u events to save state.", s_active_event_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue