mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-12-23 19:29:18 +00:00
Add PROFILE_UNTRANSLATED_INSNS information. Interestingly, the following
are the bottleneck now: DIVS, BSR.L (why isn't it translated yet?), bit-field instructions (I need to self-motivate enough for that), and A-Traps.
This commit is contained in:
parent
94a9038826
commit
e9584dbcc1
@ -44,7 +44,8 @@
|
||||
#endif
|
||||
|
||||
#ifndef WIN32
|
||||
#define PROFILE_COMPILE_TIME 1
|
||||
#define PROFILE_COMPILE_TIME 1
|
||||
#define PROFILE_UNTRANSLATED_INSNS 1
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
@ -69,6 +70,17 @@ static clock_t emul_start_time = 0;
|
||||
static clock_t emul_end_time = 0;
|
||||
#endif
|
||||
|
||||
#if PROFILE_UNTRANSLATED_INSNS
|
||||
const int untranslated_top_ten = 20;
|
||||
static uae_u32 raw_cputbl_count[65536] = { 0, };
|
||||
static uae_u16 opcode_nums[65536];
|
||||
|
||||
static int untranslated_compfn(const void *e1, const void *e2)
|
||||
{
|
||||
return raw_cputbl_count[*(const uae_u16 *)e1] < raw_cputbl_count[*(const uae_u16 *)e2];
|
||||
}
|
||||
#endif
|
||||
|
||||
compop_func *compfunctbl[65536];
|
||||
compop_func *nfcompfunctbl[65536];
|
||||
cpuop_func *nfcpufunctbl[65536];
|
||||
@ -4641,6 +4653,10 @@ void compiler_init(void)
|
||||
|
||||
initialized = true;
|
||||
|
||||
#if PROFILE_UNTRANSLATED_INSNS
|
||||
write_log("<JIT compiler> : gather statistics on untranslated insns count\n");
|
||||
#endif
|
||||
|
||||
#if PROFILE_COMPILE_TIME
|
||||
write_log("<JIT compiler> : gather statistics on translation time\n");
|
||||
emul_start_time = clock();
|
||||
@ -4674,6 +4690,28 @@ void compiler_exit(void)
|
||||
100.0*double(compile_time)/double(emul_time));
|
||||
write_log("\n");
|
||||
#endif
|
||||
|
||||
#if PROFILE_UNTRANSLATED_INSNS
|
||||
uae_u64 untranslated_count = 0;
|
||||
for (int i = 0; i < 65536; i++) {
|
||||
opcode_nums[i] = i;
|
||||
untranslated_count += raw_cputbl_count[i];
|
||||
}
|
||||
write_log("Sorting out untranslated instructions count...\n");
|
||||
qsort(opcode_nums, 65536, sizeof(uae_u16), untranslated_compfn);
|
||||
write_log("\nRank Opc Count Name\n");
|
||||
for (int i = 0; i < untranslated_top_ten; i++) {
|
||||
uae_u32 count = raw_cputbl_count[opcode_nums[i]];
|
||||
struct instr *dp;
|
||||
struct mnemolookup *lookup;
|
||||
if (!count)
|
||||
break;
|
||||
dp = table68k + opcode_nums[i];
|
||||
for (lookup = lookuptab; lookup->mnemo != dp->mnemo; lookup++)
|
||||
;
|
||||
write_log("%03d: %04x %10lu %s\n", i, opcode_nums[i], count, lookup->name);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool compiler_use_jit(void)
|
||||
@ -6152,6 +6190,10 @@ static void compile_block(cpu_history* pc_hist, int blocklen)
|
||||
raw_mov_l_mi((uae_u32)®s.pc_p,
|
||||
(uae_u32)pc_hist[i].location);
|
||||
raw_call((uae_u32)cputbl[opcode]);
|
||||
#if PROFILE_UNTRANSLATED_INSNS
|
||||
// raw_cputbl_count[] is indexed with plain opcode (in m68k order)
|
||||
raw_add_l_mi((uae_u32)&raw_cputbl_count[cft_map(opcode)],1);
|
||||
#endif
|
||||
//raw_add_l_mi((uae_u32)&oink,1); // FIXME
|
||||
#if USE_NORMAL_CALLING_CONVENTION
|
||||
raw_inc_sp(4);
|
||||
|
Loading…
Reference in New Issue
Block a user