Don't process threadsafe events from HLE.

Only from the runloop where blowing the jit cache is safe.
This commit is contained in:
Unknown W. Brackets 2013-02-22 00:38:22 -08:00
parent 44e2a69258
commit 31ada1ea07
3 changed files with 14 additions and 11 deletions

View File

@ -422,12 +422,6 @@ void RemoveAllEvents(int event_type)
//This raise only the events required while the fifo is processing data //This raise only the events required while the fifo is processing data
void ProcessFifoWaitEvents() void ProcessFifoWaitEvents()
{ {
if (Common::AtomicLoadAcquire(hasTsEvents))
MoveEvents();
if (!first)
return;
while (first) while (first)
{ {
if (first->time <= globalTimer) if (first->time <= globalTimer)
@ -471,14 +465,12 @@ void MoveEvents()
} }
} }
void Advance() void AdvanceQuick()
{ {
int cyclesExecuted = slicelength - currentMIPS->downcount; int cyclesExecuted = slicelength - currentMIPS->downcount;
globalTimer += cyclesExecuted; globalTimer += cyclesExecuted;
currentMIPS->downcount = slicelength; currentMIPS->downcount = slicelength;
ProcessFifoWaitEvents();
if (!first) if (!first)
{ {
// WARN_LOG(CPU, "WARNING - no events in queue. Setting currentMIPS->downcount to 10000"); // WARN_LOG(CPU, "WARNING - no events in queue. Setting currentMIPS->downcount to 10000");
@ -486,6 +478,8 @@ void Advance()
} }
else else
{ {
ProcessFifoWaitEvents();
slicelength = (int)(first->time - globalTimer); slicelength = (int)(first->time - globalTimer);
if (slicelength > MAX_SLICE_LENGTH) if (slicelength > MAX_SLICE_LENGTH)
slicelength = MAX_SLICE_LENGTH; slicelength = MAX_SLICE_LENGTH;
@ -495,6 +489,14 @@ void Advance()
advanceCallback(cyclesExecuted); advanceCallback(cyclesExecuted);
} }
void Advance()
{
if (Common::AtomicLoadAcquire(hasTsEvents))
MoveEvents();
AdvanceQuick();
}
void LogPendingEvents() void LogPendingEvents()
{ {
Event *ptr = first; Event *ptr = first;

View File

@ -100,6 +100,7 @@ namespace CoreTiming
void RemoveAllEvents(int event_type); void RemoveAllEvents(int event_type);
bool IsScheduled(int event_type); bool IsScheduled(int event_type);
void Advance(); void Advance();
void AdvanceQuick();
void MoveEvents(); void MoveEvents();
void ProcessFifoWaitEvents(); void ProcessFifoWaitEvents();

View File

@ -795,7 +795,7 @@ void __KernelIdle()
CoreTiming::Idle(); CoreTiming::Idle();
// Advance must happen between Idle and Reschedule, so that threads that were waiting for something // Advance must happen between Idle and Reschedule, so that threads that were waiting for something
// that was triggered at the end of the Idle period must get a chance to be scheduled. // that was triggered at the end of the Idle period must get a chance to be scheduled.
CoreTiming::Advance(); CoreTiming::AdvanceQuick();
// We must've exited a callback? // We must've exited a callback?
if (__KernelInCallback()) if (__KernelInCallback())
@ -1263,7 +1263,7 @@ void __KernelReSchedule(const char *reason)
} }
// Execute any pending events while we're doing scheduling. // Execute any pending events while we're doing scheduling.
CoreTiming::Advance(); CoreTiming::AdvanceQuick();
if (__IsInInterrupt() || __KernelInCallback()) if (__IsInInterrupt() || __KernelInCallback())
{ {
reason = "In Interrupt Or Callback"; reason = "In Interrupt Or Callback";