Skip to content

Commit 954b67a

Browse files
committed
simx86: move exit_pending_xchg(0) out of the loop in DoExec_fast
This little instruction was responsible for half of the DoExec_fast execution time according to perf! Better to check for it inside the loop and only do the exchange after.
1 parent 94c78d6 commit 954b67a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/base/emu-i386/simx86/codegen.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ unsigned int DoExec_fast(TNode *G, unsigned *pLastXKey)
714714
unsigned char *ecpu = CPUOFFS(0);
715715
unsigned LastXKey = *pLastXKey;
716716
unsigned long flg = Exec_pre(ecpu);
717-
unsigned int ePC, mem_ref, e;
717+
unsigned int ePC, mem_ref;
718718
unsigned short seqflg = G->flags;
719719

720720
do {
@@ -729,18 +729,16 @@ unsigned int DoExec_fast(TNode *G, unsigned *pLastXKey)
729729
CEmuStat &= ~CeS_TRAP;
730730
break;
731731
}
732-
e = exit_pending_xchg(0);
733-
if (e) {
734-
CEmuStat |= e;
732+
if (exit_pending())
735733
break;
736-
}
737734
#ifdef SKIP_EMU_VBIOS
738735
if ((jcs&0xf000)==config.vbios_seg && !TheCPU.err)
739736
TheCPU.err = EXCP_GOBACK;
740737
#endif
741738
} while (!TheCPU.err && (G=FindTree(ePC)) &&
742739
!((seqflg=G->flags) & (F_FPOP|F_INHI|F_SLFJ)) && GoodNode(G));
743740

741+
CEmuStat |= exit_pending_xchg(0);
744742
Exec_post(flg, mem_ref, G ? seqflg : 0);
745743
*pLastXKey = LastXKey;
746744
return ePC;

0 commit comments

Comments
 (0)