44 |
|
#endif |
45 |
|
|
46 |
|
#ifndef WIN32 |
47 |
< |
#define PROFILE_COMPILE_TIME 1 |
47 |
> |
#define PROFILE_COMPILE_TIME 1 |
48 |
> |
#define PROFILE_UNTRANSLATED_INSNS 1 |
49 |
|
#endif |
50 |
|
|
51 |
|
#ifdef WIN32 |
70 |
|
static clock_t emul_end_time = 0; |
71 |
|
#endif |
72 |
|
|
73 |
+ |
#if PROFILE_UNTRANSLATED_INSNS |
74 |
+ |
const int untranslated_top_ten = 20; |
75 |
+ |
static uae_u32 raw_cputbl_count[65536] = { 0, }; |
76 |
+ |
static uae_u16 opcode_nums[65536]; |
77 |
+ |
|
78 |
+ |
static int untranslated_compfn(const void *e1, const void *e2) |
79 |
+ |
{ |
80 |
+ |
return raw_cputbl_count[*(const uae_u16 *)e1] < raw_cputbl_count[*(const uae_u16 *)e2]; |
81 |
+ |
} |
82 |
+ |
#endif |
83 |
+ |
|
84 |
|
compop_func *compfunctbl[65536]; |
85 |
|
compop_func *nfcompfunctbl[65536]; |
86 |
|
cpuop_func *nfcpufunctbl[65536]; |
4653 |
|
|
4654 |
|
initialized = true; |
4655 |
|
|
4656 |
+ |
#if PROFILE_UNTRANSLATED_INSNS |
4657 |
+ |
write_log("<JIT compiler> : gather statistics on untranslated insns count\n"); |
4658 |
+ |
#endif |
4659 |
+ |
|
4660 |
|
#if PROFILE_COMPILE_TIME |
4661 |
|
write_log("<JIT compiler> : gather statistics on translation time\n"); |
4662 |
|
emul_start_time = clock(); |
4690 |
|
100.0*double(compile_time)/double(emul_time)); |
4691 |
|
write_log("\n"); |
4692 |
|
#endif |
4693 |
+ |
|
4694 |
+ |
#if PROFILE_UNTRANSLATED_INSNS |
4695 |
+ |
uae_u64 untranslated_count = 0; |
4696 |
+ |
for (int i = 0; i < 65536; i++) { |
4697 |
+ |
opcode_nums[i] = i; |
4698 |
+ |
untranslated_count += raw_cputbl_count[i]; |
4699 |
+ |
} |
4700 |
+ |
write_log("Sorting out untranslated instructions count...\n"); |
4701 |
+ |
qsort(opcode_nums, 65536, sizeof(uae_u16), untranslated_compfn); |
4702 |
+ |
write_log("\nRank Opc Count Name\n"); |
4703 |
+ |
for (int i = 0; i < untranslated_top_ten; i++) { |
4704 |
+ |
uae_u32 count = raw_cputbl_count[opcode_nums[i]]; |
4705 |
+ |
struct instr *dp; |
4706 |
+ |
struct mnemolookup *lookup; |
4707 |
+ |
if (!count) |
4708 |
+ |
break; |
4709 |
+ |
dp = table68k + opcode_nums[i]; |
4710 |
+ |
for (lookup = lookuptab; lookup->mnemo != dp->mnemo; lookup++) |
4711 |
+ |
; |
4712 |
+ |
write_log("%03d: %04x %10lu %s\n", i, opcode_nums[i], count, lookup->name); |
4713 |
+ |
} |
4714 |
+ |
#endif |
4715 |
|
} |
4716 |
|
|
4717 |
|
bool compiler_use_jit(void) |
6190 |
|
raw_mov_l_mi((uae_u32)®s.pc_p, |
6191 |
|
(uae_u32)pc_hist[i].location); |
6192 |
|
raw_call((uae_u32)cputbl[opcode]); |
6193 |
+ |
#if PROFILE_UNTRANSLATED_INSNS |
6194 |
+ |
// raw_cputbl_count[] is indexed with plain opcode (in m68k order) |
6195 |
+ |
raw_add_l_mi((uae_u32)&raw_cputbl_count[cft_map(opcode)],1); |
6196 |
+ |
#endif |
6197 |
|
//raw_add_l_mi((uae_u32)&oink,1); // FIXME |
6198 |
|
#if USE_NORMAL_CALLING_CONVENTION |
6199 |
|
raw_inc_sp(4); |