From: Frode Solheim Date: Sun, 6 Sep 2015 20:34:07 +0000 (+0200) Subject: JIT: restructured check_checksum, added (unused) called_check_checksum X-Git-Tag: 3200~79^2~15 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=e42784bf42ab5b30cc2498022e10675530f873c4;p=francis%2Fwinuae.git JIT: restructured check_checksum, added (unused) called_check_checksum --- diff --git a/jit/compemu_support.cpp b/jit/compemu_support.cpp index 469492a0..2d8243bf 100644 --- a/jit/compemu_support.cpp +++ b/jit/compemu_support.cpp @@ -2677,6 +2677,7 @@ void flush(int save_regs) } } +#if 0 static void flush_keepflags(void) { int i; @@ -2712,6 +2713,7 @@ static void flush_keepflags(void) } raw_fp_cleanup_drop(); } +#endif void freescratch(void) { @@ -3363,29 +3365,12 @@ static void cache_miss(void) static int called_check_checksum(blockinfo* bi); -static void check_checksum(void) +static inline int block_check_checksum(blockinfo* bi) { - blockinfo* bi=get_blockinfo_addr(regs.pc_p); - uae_u32 cl=cacheline(regs.pc_p); - blockinfo* bi2=get_blockinfo(cl); - uae_u32 c1,c2; bool isgood; checksum_count++; - /* These are not the droids you are looking for... */ - if (!bi) { - /* Whoever is the primary target is in a dormant state, but - calling it was accidental, and we should just compile this - new block */ - execute_normal(); - return; - } - if (bi!=bi2) { - /* The block was hit accidentally, but it does exist. Cache miss */ - cache_miss(); - return; - } if (bi->c1 || bi->c2) calc_checksum(bi,&c1,&c2); @@ -3413,8 +3398,45 @@ static void check_checksum(void) jit_log2("discard %p/%p (%x %x/%x %x)",bi,bi->pc_p, c1,c2,bi->c1,bi->c2); invalidate_block(bi); raise_in_cl_list(bi); + } + return isgood; +} + +static int called_check_checksum(blockinfo* bi) +{ + int isgood=1; + int i; + + for (i=0;i<2 && isgood;i++) { + if (bi->dep[i].jmp_off) { + isgood=block_check_checksum(bi->dep[i].target); + } + } + return isgood; +} + +static void check_checksum(void) +{ + blockinfo* bi=get_blockinfo_addr(regs.pc_p); + uae_u32 cl=cacheline(regs.pc_p); + blockinfo* bi2=get_blockinfo(cl); + + /* These are not the droids you are looking for... */ + if (!bi) { + /* Whoever is the primary target is in a dormant state, but + calling it was accidental, and we should just compile this + new block */ execute_normal(); + return; + } + if (bi!=bi2) { + /* The block was hit accidentally, but it does exist. Cache miss */ + cache_miss(); + return; } + + if (!block_check_checksum(bi)) + execute_normal(); } static inline void match_states(blockinfo* bi)