From: Frode Solheim Date: Sat, 5 Sep 2015 21:57:06 +0000 (+0200) Subject: JIT: logging updates, jit_abort X-Git-Tag: 3200~79^2~48 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=53aa2765791d1f4f6269dd3f54f00a0bdac74ad1;p=francis%2Fwinuae.git JIT: logging updates, jit_abort --- diff --git a/include/uae.h b/include/uae.h index 12f71bac..ab944c7c 100644 --- a/include/uae.h +++ b/include/uae.h @@ -84,6 +84,9 @@ extern uae_u32 uaerandgetseed (void); int get_guid_target (uae_u8 *out); void filesys_addexternals (void); -void jit_abort (const TCHAR *format,...); +void jit_abort(const char *format,...); +#if SIZEOF_TCHAR != 1 +void jit_abort(const TCHAR *format, ...); +#endif #endif /* UAE_UAE_H */ diff --git a/jit/compemu_support.cpp b/jit/compemu_support.cpp index 1bd5f944..16540fd6 100644 --- a/jit/compemu_support.cpp +++ b/jit/compemu_support.cpp @@ -19,6 +19,10 @@ #ifdef UAE #define UNUSED(x) #define HAVE_GET_WORD_UNSWAPPED +#include "uae.h" +#include "uae/log.h" +#define jit_log uae_log +#define jit_log2(...) #else #define DEBUG 0 #include "debug.h" @@ -31,8 +35,6 @@ // %%% BRIAN KING WAS HERE %%% extern bool canbang; -//#include -extern void jit_abort(const TCHAR*,...); # include # include @@ -231,8 +233,6 @@ static void inline flush_cpu_icache(void *from, void *to); static void inline write_jmp_target(uae_u32 *jmpaddr, cpuop_func* a); static void inline emit_jmp_target(uae_u32 a); -static uae_s32 nextused[VREGS]; - uae_u32 m68k_pc_offset; /* Some arithmetic operations can be optimized away if the operands @@ -386,28 +386,14 @@ static inline void adjust_jmpdep(dependency* d, cpuop_func* a) static inline void set_dhtu(blockinfo* bi, cpuop_func *dh) { -#ifdef UAE - //write_log (_T("JIT: bi is %p\n"),bi); -#else - D2(panicbug("bi is %p",bi)); -#endif + jit_log2("bi is %p",bi); if (dh!=bi->direct_handler_to_use) { dependency* x=bi->deplist; -#ifdef UAE - //write_log (_T("JIT: bi->deplist=%p\n"),bi->deplist); -#else - D2(panicbug("bi->deplist=%p",bi->deplist)); -#endif + jit_log2("bi->deplist=%p",bi->deplist); while (x) { -#ifdef UAE - //write_log (_T("JIT: x is %p\n"),x); - //write_log (_T("JIT: x->next is %p\n"),x->next); - //write_log (_T("JIT: x->prev_p is %p\n"),x->prev_p); -#else - D2(panicbug("x is %p",x)); - D2(panicbug("x->next is %p",x->next)); - D2(panicbug("x->prev_p is %p",x->prev_p)); -#endif + jit_log2("x is %p",x); + jit_log2("x->next is %p",x->next); + jit_log2("x->prev_p is %p",x->prev_p); if (x->jmp_off) { adjust_jmpdep(x,dh); @@ -442,12 +428,7 @@ static inline void create_jmpdep(blockinfo* bi, int i, uae_u32* jmpaddr, uae_u32 blockinfo* tbi=get_blockinfo_addr((void*)(uintptr)target); Dif(!tbi) { -#ifdef UAE - jit_abort (_T("JIT: Could not create jmpdep!\n")); -#else - D(panicbug("Could not create jmpdep!")); - abort(); -#endif + jit_abort("Could not create jmpdep!"); } bi->dep[i].jmp_off=jmpaddr; bi->dep[i].target=tbi; @@ -496,12 +477,7 @@ static inline blockinfo* get_blockinfo_addr_new(void* addr, int /* setstate */) } } if (!bi) { -#ifdef UAE - jit_abort (_T("JIT: Looking for blockinfo, can't find free one\n")); -#else - panicbug("Looking for blockinfo, can't find free one"); - abort(); -#endif + jit_abort("Looking for blockinfo, can't find free one"); } #if USE_MATCHSTATE @@ -1180,43 +1156,23 @@ static inline void log_dump(void) return; -#ifdef UAE - write_log (_T("----------------------\n")); -#else - D(panicbug("----------------------")); -#endif + jit_log("----------------------"); for (i=0;i0) { -#ifdef UAE - write_log (_T("%08x "),*pos); -#else - D(panicbug("%08x ",*pos)); -#endif + jit_log("%08x ",*pos); pos++; len-=4; } -#ifdef UAE - write_log (_T(" bla\n")); -#else - D(panicbug(" bla")); -#endif + jit_log(" bla"); } } #endif @@ -3647,11 +3549,7 @@ void build_comp(void) if (compfunctbl[opcode]) count++; } -#ifdef UAE - write_log (_T("JIT: Supposedly %d compileable opcodes!\n"),count); -#else - D(panicbug(" : supposedly %d compileable opcodes!",count)); -#endif + jit_log("Supposedly %d compileable opcodes!",count); /* Initialise state */ alloc_cache(); diff --git a/od-win32/writelog.cpp b/od-win32/writelog.cpp index b3b2b415..d6fe438c 100644 --- a/od-win32/writelog.cpp +++ b/od-win32/writelog.cpp @@ -680,3 +680,17 @@ void jit_abort (const TCHAR *format,...) happened = 1; uae_reset (1, 0); } + +void jit_abort(const char *format, ...) +{ + char buffer[WRITE_LOG_BUF_SIZE]; + va_list parms; + TCHAR *b; + + va_start(parms, format); + vsprintf(buffer, format, parms); + b = au(buffer); + jit_abort(_T("%s"), b); + xfree(b); + va_end(parms); +} \ No newline at end of file