ARM Dynarec: Fix performance regression

This commit is contained in:
Jeffrey Pfau 2016-05-18 01:04:02 -07:00
parent b6f784b3be
commit 361d9ceeec
3 changed files with 11 additions and 5 deletions

View File

@ -301,9 +301,14 @@ void ARMRun(struct ARMCore* cpu) {
} }
void ARMRunLoop(struct ARMCore* cpu) { void ARMRunLoop(struct ARMCore* cpu) {
if (cpu->dynarec.inDynarec) { if (cpu->dynarec.currentEntry) {
cpu->dynarec.inDynarec = true;
while (cpu->dynarec.currentEntry) {
void (*entry)(struct ARMCore*) = cpu->dynarec.currentEntry;
cpu->dynarec.currentEntry = NULL;
entry(cpu);
}
cpu->dynarec.inDynarec = false; cpu->dynarec.inDynarec = false;
cpu->dynarec.currentEntry(cpu);
return; return;
} }
if (cpu->executionMode == MODE_THUMB) { if (cpu->executionMode == MODE_THUMB) {

View File

@ -54,8 +54,9 @@ void ARMDynarecCountTrace(struct ARMCore* cpu, uint32_t address, enum ExecutionM
ARMDynarecRecompileTrace(cpu, trace); ARMDynarecRecompileTrace(cpu, trace);
} }
if (trace->entry) { if (trace->entry) {
cpu->dynarec.inDynarec = true; if (!cpu->dynarec.inDynarec) {
cpu->nextEvent = cpu->cycles; cpu->nextEvent = cpu->cycles;
}
cpu->dynarec.currentEntry = trace->entry; cpu->dynarec.currentEntry = trace->entry;
} }
} }

View File

@ -243,7 +243,7 @@ static void GBASetActiveRegion(struct ARMCore* cpu, uint32_t address) {
gba->lastJump = address; gba->lastJump = address;
memory->lastPrefetchedPc = 0; memory->lastPrefetchedPc = 0;
memory->lastPrefetchedLoads = 0; memory->lastPrefetchedLoads = 0;
cpu->dynarec.inDynarec = false; cpu->dynarec.currentEntry = NULL;
if (newRegion == memory->activeRegion) { if (newRegion == memory->activeRegion) {
if (cpu->executor == ARM_DYNAREC && newRegion >= REGION_CART0) { if (cpu->executor == ARM_DYNAREC && newRegion >= REGION_CART0) {
ARMDynarecCountTrace(cpu, address,cpu->executionMode); ARMDynarecCountTrace(cpu, address,cpu->executionMode);