From 56caaa6cf31876168eec9a8bc459dbfc8ef2a9da Mon Sep 17 00:00:00 2001 From: Frode Solheim Date: Sun, 6 Sep 2015 22:27:12 +0200 Subject: [PATCH] JIT: define big_to_small_state only #if USE_MATCH, other harmless merging --- jit/compemu_support.cpp | 98 +++++++++++++++++++++++++++++------------ 1 file changed, 70 insertions(+), 28 deletions(-) diff --git a/jit/compemu_support.cpp b/jit/compemu_support.cpp index 675395a9..16c8042b 100644 --- a/jit/compemu_support.cpp +++ b/jit/compemu_support.cpp @@ -1148,31 +1148,7 @@ static uae_s8 nstate[N_REGS]; #define L_NEEDED -2 #define L_UNNEEDED -3 -#ifdef UAE -static inline void big_to_small_state(bigstate* b, smallstate* s) -{ - /* FIXME: replace with ARAnyM version */ - int i; - int count=0; - - for (i=0;inat[i].validsize=0; - s->nat[i].dirtysize=0; - if (b->nat[i].nholds) { - int index=b->nat[i].nholds-1; - int r=b->nat[i].holds[index]; - s->nat[i].holds=r; - s->nat[i].validsize=b->state[r].validsize; - s->nat[i].dirtysize=b->state[r].dirtysize; - count++; - } - } - write_log (_T("JIT: count=%d\n"),count); - for (i=0;inat[i].dirtysize=0; - } -} -#else +#if USE_MATCH static inline void big_to_small_state(bigstate * /* b */, smallstate * s) { int i; @@ -1182,9 +1158,7 @@ static inline void big_to_small_state(bigstate * /* b */, smallstate * s) for (i = 0; i < N_REGS; i++) s->nat[i] = nstate[i]; } -#endif -#if 0 static inline int callers_need_recompile(bigstate * /* b */, smallstate * s) { int i; @@ -2367,13 +2341,64 @@ static inline const char *str_on_off(bool b) return b ? "on" : "off"; } +#ifdef UAE static +#endif void compiler_init(void) { static bool initialized = false; if (initialized) return; +#ifdef UAE +#else +#ifdef JIT_DEBUG + // JIT debug mode ? + JITDebug = bx_options.startup.debugger; +#endif + D(panicbug(" : enable runtime disassemblers : %s", JITDebug ? "yes" : "no")); + +#ifdef USE_JIT_FPU + // Use JIT compiler for FPU instructions ? + avoid_fpu = !bx_options.jit.jitfpu; +#else + // JIT FPU is always disabled + avoid_fpu = true; +#endif + panicbug(" : compile FPU instructions : %s", !avoid_fpu ? "yes" : "no"); + + // Get size of the translation cache (in KB) + cache_size = bx_options.jit.jitcachesize; + panicbug(" : requested translation cache size : %d KB", cache_size); + + // Initialize target CPU (check for features, e.g. CMOV, rat stalls) + raw_init_cpu(); + setzflg_uses_bsf = target_check_bsf(); + panicbug(" : target processor has CMOV instructions : %s", have_cmov ? "yes" : "no"); + panicbug(" : target processor can suffer from partial register stalls : %s", have_rat_stall ? "yes" : "no"); + panicbug(" : alignment for loops, jumps are %d, %d", align_loops, align_jumps); + + // Translation cache flush mechanism + lazy_flush = (bx_options.jit.jitlazyflush == 0) ? false : true; + panicbug(" : lazy translation cache invalidation : %s", str_on_off(lazy_flush)); + flush_icache = lazy_flush ? flush_icache_lazy : flush_icache_hard; + + // Compiler features + panicbug(" : register aliasing : %s", str_on_off(1)); + panicbug(" : FP register aliasing : %s", str_on_off(USE_F_ALIAS)); + panicbug(" : lazy constant offsetting : %s", str_on_off(USE_OFFSET)); +#if USE_INLINING + follow_const_jumps = bx_options.jit.jitinline; +#endif + panicbug(" : block inlining : %s", str_on_off(follow_const_jumps)); + panicbug(" : separate blockinfo allocation : %s", str_on_off(USE_SEPARATE_BIA)); + + // Build compiler tables + build_comp(); +#endif + + initialized = true; + #if PROFILE_UNTRANSLATED_INSNS panicbug(" : gather statistics on untranslated insns count"); #endif @@ -2384,13 +2409,30 @@ void compiler_init(void) #endif } +#ifdef UAE static +#endif void compiler_exit(void) { #if PROFILE_COMPILE_TIME emul_end_time = clock(); #endif +#ifdef UAE +#else + // Deallocate translation cache + if (compiled_code) { + vm_release(compiled_code, cache_size * 1024); + compiled_code = 0; + } + + // Deallocate popallspace + if (popallspace) { + vm_release(popallspace, POPALLSPACE_SIZE); + popallspace = 0; + } +#endif + #if PROFILE_COMPILE_TIME panicbug("### Compile Block statistics"); panicbug("Number of calls to compile_block : %d", compile_count); @@ -4301,7 +4343,7 @@ void compile_block(cpu_history* pc_hist, int blocklen, int totcycles) } } -#if USE_MATCH +#if USE_MATCH if (callers_need_recompile(&live,&(bi->env))) { mark_callers_recompile(bi); } -- 2.47.3