mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-01-11 10:30:09 +00:00
- Optimize use of quit_program variable. This is a real boolean for B2.
- Remove unused/dead code concerning surroundings of (debugging). - m68k_compile_execute() is generated and optimized code now.
This commit is contained in:
parent
bdf9d76bb8
commit
75de104c92
@ -56,7 +56,7 @@ bool UseJIT = false;
|
||||
#endif
|
||||
|
||||
// From newcpu.cpp
|
||||
extern int quit_program;
|
||||
extern bool quit_program;
|
||||
|
||||
|
||||
/*
|
||||
@ -198,7 +198,7 @@ void Execute68kTrap(uint16 trap, struct M68kRegisters *r)
|
||||
// Execute trap
|
||||
m68k_setpc(m68k_areg(regs, 7));
|
||||
fill_prefetch_0();
|
||||
quit_program = 0;
|
||||
quit_program = false;
|
||||
m68k_execute();
|
||||
|
||||
// Clean up stack
|
||||
@ -213,7 +213,7 @@ void Execute68kTrap(uint16 trap, struct M68kRegisters *r)
|
||||
r->d[i] = m68k_dreg(regs, i);
|
||||
for (i=0; i<7; i++)
|
||||
r->a[i] = m68k_areg(regs, i);
|
||||
quit_program = 0;
|
||||
quit_program = false;
|
||||
}
|
||||
|
||||
|
||||
@ -245,7 +245,7 @@ void Execute68k(uint32 addr, struct M68kRegisters *r)
|
||||
// Execute routine
|
||||
m68k_setpc(addr);
|
||||
fill_prefetch_0();
|
||||
quit_program = 0;
|
||||
quit_program = false;
|
||||
m68k_execute();
|
||||
|
||||
// Clean up stack
|
||||
@ -260,5 +260,5 @@ void Execute68k(uint32 addr, struct M68kRegisters *r)
|
||||
r->d[i] = m68k_dreg(regs, i);
|
||||
for (i=0; i<7; i++)
|
||||
r->a[i] = m68k_areg(regs, i);
|
||||
quit_program = 0;
|
||||
quit_program = false;
|
||||
}
|
||||
|
@ -74,6 +74,9 @@ compop_func *nfcompfunctbl[65536];
|
||||
cpuop_func *nfcpufunctbl[65536];
|
||||
uae_u8* comp_pc_p;
|
||||
|
||||
// From newcpu.cpp
|
||||
extern bool quit_program;
|
||||
|
||||
// gb-- Extra data for Basilisk II/JIT
|
||||
#if JIT_DEBUG
|
||||
static bool JITDebug = false; // Enable runtime disassemblers through mon?
|
||||
@ -5461,7 +5464,6 @@ static __inline__ void create_popalls(void)
|
||||
popall_recompile_block=(void *)recompile_block;
|
||||
popall_do_nothing=(void *)do_nothing;
|
||||
popall_check_checksum=(void *)check_checksum;
|
||||
pushall_call_handler=get_target();
|
||||
#endif
|
||||
|
||||
/* And now, the code to do the matching pushes and then jump
|
||||
@ -5477,6 +5479,36 @@ static __inline__ void create_popalls(void)
|
||||
raw_mov_l_rm(r,(uae_u32)®s.pc_p);
|
||||
raw_and_l_ri(r,TAGMASK);
|
||||
raw_jmp_m_indexed((uae_u32)cache_tags,r,4);
|
||||
|
||||
#ifdef X86_ASSEMBLY
|
||||
align_target(align_jumps);
|
||||
m68k_compile_execute = (void (*)(void))get_target();
|
||||
for (i=N_REGS;i--;) {
|
||||
if (need_to_preserve[i])
|
||||
raw_push_l_r(i);
|
||||
}
|
||||
align_target(align_loops);
|
||||
uae_u32 dispatch_loop = (uae_u32)get_target();
|
||||
r=REG_PC_TMP;
|
||||
raw_mov_l_rm(r,(uae_u32)®s.pc_p);
|
||||
raw_and_l_ri(r,TAGMASK);
|
||||
raw_call_m_indexed((uae_u32)cache_tags,r,4);
|
||||
raw_cmp_l_mi((uae_u32)®s.spcflags,0);
|
||||
raw_jcc_b_oponly(NATIVE_CC_EQ);
|
||||
emit_byte(dispatch_loop-((uae_u32)get_target()+1));
|
||||
raw_call((uae_u32)m68k_do_specialties);
|
||||
raw_test_l_rr(REG_RESULT,REG_RESULT);
|
||||
raw_jcc_b_oponly(NATIVE_CC_EQ);
|
||||
emit_byte(dispatch_loop-((uae_u32)get_target()+1));
|
||||
raw_cmp_b_mi((uae_u32)&quit_program,0);
|
||||
raw_jcc_b_oponly(NATIVE_CC_EQ);
|
||||
emit_byte(dispatch_loop-((uae_u32)get_target()+1));
|
||||
for (i=0;i<N_REGS;i++) {
|
||||
if (need_to_preserve[i])
|
||||
raw_pop_l_r(i);
|
||||
}
|
||||
raw_ret();
|
||||
#endif
|
||||
}
|
||||
|
||||
static __inline__ void reset_lists(void)
|
||||
@ -6239,13 +6271,7 @@ void exec_nostats(void)
|
||||
{
|
||||
for (;;) {
|
||||
uae_u32 opcode = GET_OPCODE;
|
||||
#ifdef X86_ASSEMBLY__disable
|
||||
__asm__ __volatile__("\tpushl %%ebp\n\tcall *%%ebx\n\tpopl %%ebp" /* FIXME */
|
||||
: : "b" (cpufunctbl[opcode]), "a" (opcode)
|
||||
: "%edx", "%ecx", "%esi", "%edi", "%ebp", "memory", "cc");
|
||||
#else
|
||||
(*cpufunctbl[opcode])(opcode);
|
||||
#endif
|
||||
if (end_block(opcode) || SPCFLAGS_TEST(SPCFLAG_ALL)) {
|
||||
return; /* We will deal with the spcflags in the caller */
|
||||
}
|
||||
@ -6270,13 +6296,7 @@ void execute_normal(void)
|
||||
#if FLIGHT_RECORDER
|
||||
m68k_record_step(m68k_getpc());
|
||||
#endif
|
||||
#ifdef X86_ASSEMBLY__disable
|
||||
__asm__ __volatile__("\tpushl %%ebp\n\tcall *%%ebx\n\tpopl %%ebp" /* FIXME */
|
||||
: : "b" (cpufunctbl[opcode]), "a" (opcode)
|
||||
: "%edx", "%ecx", "%esi", "%edi", "%ebp", "memory", "cc");
|
||||
#else
|
||||
(*cpufunctbl[opcode])(opcode);
|
||||
#endif
|
||||
if (end_block(opcode) || SPCFLAGS_TEST(SPCFLAG_ALL) || blocklen>=MAXRUN) {
|
||||
compile_block(pc_hist, blocklen);
|
||||
return; /* We will deal with the spcflags in the caller */
|
||||
@ -6289,16 +6309,13 @@ void execute_normal(void)
|
||||
|
||||
typedef void (*compiled_handler)(void);
|
||||
|
||||
#ifdef X86_ASSEMBLY
|
||||
void (*m68k_compile_execute)(void) = NULL;
|
||||
#else
|
||||
void m68k_do_compile_execute(void)
|
||||
{
|
||||
for (;;) {
|
||||
#ifdef X86_ASSEMBLY
|
||||
__asm__ __volatile__("\tpushl %%ebp\n\tcall *%%ebx\n\tpopl %%ebp" /* FIXME */
|
||||
: : "b" (cache_tags[cacheline(regs.pc_p)].handler)
|
||||
: "%edx", "%ecx", "%eax", "%esi", "%edi", "%ebp", "memory", "cc");
|
||||
#else
|
||||
((compiled_handler)(pushall_call_handler))();
|
||||
#endif
|
||||
/* Whenever we return from that, we should check spcflags */
|
||||
if (SPCFLAGS_TEST(SPCFLAG_ALL)) {
|
||||
if (m68k_do_specialties ())
|
||||
@ -6306,3 +6323,4 @@ void m68k_do_compile_execute(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -34,8 +34,7 @@ B2_mutex *spcflags_lock = NULL;
|
||||
#include "mon_disass.h"
|
||||
#endif
|
||||
|
||||
int quit_program = 0;
|
||||
const int debugging = 0;
|
||||
bool quit_program = false;
|
||||
struct flag_struct regflags;
|
||||
|
||||
/* Opcode of faulting instruction */
|
||||
@ -1167,7 +1166,7 @@ void m68k_reset (void)
|
||||
void m68k_emulop_return(void)
|
||||
{
|
||||
SPCFLAGS_SET( SPCFLAG_BRK );
|
||||
quit_program = 1;
|
||||
quit_program = true;
|
||||
}
|
||||
|
||||
void m68k_emulop(uae_u32 opcode)
|
||||
@ -1320,36 +1319,21 @@ void m68k_do_execute (void)
|
||||
#if FLIGHT_RECORDER
|
||||
m68k_record_step(m68k_getpc());
|
||||
#endif
|
||||
#ifdef X86_ASSEMBLY
|
||||
__asm__ __volatile__("\tpushl %%ebp\n\tcall *%%ebx\n\tpopl %%ebp" /* FIXME */
|
||||
: : "b" (cpufunctbl[opcode]), "a" (opcode)
|
||||
: "%edx", "%ecx", "%esi", "%edi", "%ebp", "memory", "cc");
|
||||
#else
|
||||
(*cpufunctbl[opcode])(opcode);
|
||||
#endif
|
||||
if (SPCFLAGS_TEST(SPCFLAG_ALL_BUT_EXEC_RETURN)) {
|
||||
if (m68k_do_specialties())
|
||||
if (SPCFLAGS_TEST(SPCFLAG_ALL_BUT_EXEC_RETURN)) {
|
||||
if (m68k_do_specialties())
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if USE_JIT
|
||||
#if USE_JIT && !defined(X86_ASSEMBLY)
|
||||
void m68k_compile_execute (void)
|
||||
{
|
||||
for (;;) {
|
||||
if (quit_program > 0) {
|
||||
if (quit_program == 1)
|
||||
if (quit_program)
|
||||
break;
|
||||
quit_program = 0;
|
||||
m68k_reset ();
|
||||
}
|
||||
m68k_do_compile_execute();
|
||||
}
|
||||
if (debugging) {
|
||||
uaecptr nextpc;
|
||||
m68k_dumpstate(&nextpc);
|
||||
exit(1);
|
||||
m68k_do_compile_execute();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1359,22 +1343,11 @@ void m68k_execute (void)
|
||||
#if USE_JIT
|
||||
++m68k_execute_depth;
|
||||
#endif
|
||||
|
||||
for (;;) {
|
||||
if (quit_program > 0) {
|
||||
if (quit_program == 1)
|
||||
if (quit_program)
|
||||
break;
|
||||
quit_program = 0;
|
||||
m68k_reset ();
|
||||
}
|
||||
m68k_do_execute();
|
||||
m68k_do_execute();
|
||||
}
|
||||
if (debugging) {
|
||||
uaecptr nextpc;
|
||||
m68k_dumpstate(&nextpc);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#if USE_JIT
|
||||
--m68k_execute_depth;
|
||||
#endif
|
||||
|
@ -299,8 +299,13 @@ extern void m68k_record_step(uaecptr);
|
||||
extern void m68k_do_execute(void);
|
||||
extern void m68k_execute(void);
|
||||
#if USE_JIT
|
||||
#ifdef X86_ASSEMBLY
|
||||
/* This is generated code */
|
||||
extern void (*m68k_compile_execute)(void);
|
||||
#else
|
||||
extern void m68k_do_compile_execute(void);
|
||||
extern void m68k_compile_execute(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* NEWCPU_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user