Skip to content

Commit 26639fc

Browse files
committed
simx86: eliminate F_LEAV, use a function leave_instremu() instead.
This way we no longer have flags that only need to be checked once for the node and then reset.
1 parent 3679093 commit 26639fc

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,8 +643,6 @@ unsigned int DoExec(TNode *G)
643643
hitimer_t TimeStartExec;
644644
if (debug_level('e')) TimeStartExec = GETTSC();
645645
#endif
646-
/* these flags need to be checked only once for the node */
647-
G->flags &= ~F_LEAV;
648646
ePC = ExecOne(G);
649647
// G is unreliable (maybe deleted) past this point!
650648

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@
193193
#define F_SLFL 0x0004 // links to itself
194194
#define F_PREJ 0x0010 // generated by any prejit thread
195195
#define F_SPRJ 0x0020 // generated by speculative prejit thread
196-
#define F_LEAV 0x0040 // leave instremu after executing this node
197196
#define F_SLFJ 0x0080 // self-jump (forever loop)
198197
#define F_LJMP 0x0100 // node ends with direct far jmp
199198

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

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,26 @@ static unsigned int ExceptionGen(unsigned int PC, int basemode, int trapno,
420420
static unsigned int _Interp86(unsigned int PC, unsigned int Interp_LONG_CS,
421421
unsigned short ocs, int basemode, int flags);
422422

423+
static int leave_instremu(void)
424+
{
425+
if (CEmuStat & CeS_INSTREMUx(PROTMODE())) {
426+
if (debug_level('e')>1)
427+
dbug_printf("CeS_INSTREMU, count=%d\n",
428+
interp_inst_emu_count);
429+
if (interp_inst_emu_count == 0 ||
430+
--interp_inst_emu_count == 0) {
431+
if ((CEmuStat & CeS_INSTREMU_PM) &&
432+
config.dpmi_remote &&
433+
vga.inst_emu) {
434+
instr_emu_sim_reset_count();
435+
} else {
436+
return 1;
437+
}
438+
}
439+
}
440+
return 0;
441+
}
442+
423443
static unsigned int FindExecCode(unsigned int PC)
424444
{
425445
TNode *G;
@@ -491,11 +511,10 @@ static unsigned int FindExecCode(unsigned int PC)
491511
error("@corrupted at %x\n", G->key + j);
492512
}
493513
/* ---- this is the MAIN EXECUTE point ---- */
494-
unsigned short seqflg = G->flags;
495514
NodesExecd++;
496515
#if PROFILE
497516
TotalNodesExecd++;
498-
if (seqflg & F_PREJ)
517+
if (G->flags & F_PREJ)
499518
PrejitNodesExecd++;
500519
#endif
501520
assert(G->seqlen);
@@ -511,7 +530,7 @@ static unsigned int FindExecCode(unsigned int PC)
511530
speculate = 0;
512531
}
513532
#endif
514-
if (seqflg & F_LEAV)
533+
if (leave_instremu())
515534
TheCPU.err = EXCP_EMULEAVE;
516535

517536
if (TheCPU.err) return PC;
@@ -552,22 +571,6 @@ static int interp_post(unsigned int PC, unsigned int Interp_LONG_CS,
552571
int gap = (flags & F_SPRJ) ? SAFE_PRJ_GAP : 1;
553572
assert (CurrIMeta>=0);
554573

555-
if (CEmuStat & CeS_INSTREMUx(PROTMODE())) {
556-
if (debug_level('e')>1)
557-
dbug_printf("CeS_INSTREMU, count=%d\n",
558-
interp_inst_emu_count);
559-
if (interp_inst_emu_count == 0 ||
560-
--interp_inst_emu_count == 0) {
561-
if ((CEmuStat & CeS_INSTREMU_PM) &&
562-
config.dpmi_remote &&
563-
vga.inst_emu) {
564-
instr_emu_sim_reset_count();
565-
} else {
566-
flags |= F_LEAV;
567-
}
568-
}
569-
}
570-
571574
#ifndef SINGLEBLOCK
572575
IMeta *GL = &InstrMeta[CurrIMeta];
573576
if ((mode & MSSTP) ||
@@ -586,7 +589,7 @@ static void sprj_deep(TNode *G, unsigned PC, unsigned int Interp_LONG_CS,
586589
#ifdef SPEC_PREJIT
587590
int i = 0;
588591

589-
while (G->clink_t.link && !(G->flags & (F_LJMP|F_LEAV))) {
592+
while (G->clink_t.link && !(G->flags & F_LJMP)) {
590593
TNode *oldG = G;
591594
PC = G->clink_t.target;
592595
if (e_querymark(PC, SAFE_PRJ_GAP)) break;

0 commit comments

Comments
 (0)