From eb48e6e042b95d54bc77e51d3ef0c0083f3d579f Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 27 Sep 2020 21:08:15 +0300 Subject: [PATCH] JIT opcode blacklist config entry. --- cfgfile.cpp | 5 +++- include/options.h | 1 + jit/compemu_support.cpp | 53 ++++++++++++++++++++++++++++++++++++----- 3 files changed, 52 insertions(+), 7 deletions(-) diff --git a/cfgfile.cpp b/cfgfile.cpp index 0d7fda1f..550c4629 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -1989,7 +1989,8 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_write_bool (f, _T("compfpu"), p->compfpu); #endif cfgfile_write_bool(f, _T("comp_catchfault"), p->comp_catchfault); - cfgfile_write (f, _T("cachesize"), _T("%d"), p->cachesize); + cfgfile_write(f, _T("cachesize"), _T("%d"), p->cachesize); + cfgfile_dwrite_str(f, _T("jit_blacklist"), p->jitblacklist); for (i = 0; i < MAX_JPORTS; i++) { struct jport *jp = &p->jports[i]; @@ -5402,6 +5403,8 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH return 1; if (cfgfile_string(option, value, _T("ne2000_pcmcia"), p->ne2000pcmcianame, sizeof p->ne2000pcmcianame / sizeof(TCHAR))) return 1; + if (cfgfile_string(option, value, _T("jit_blacklist"), p->jitblacklist, sizeof p->jitblacklist / sizeof(TCHAR))) + return 1; if (cfgfile_yesno(option, value, _T("immediate_blits"), &p->immediate_blits) || cfgfile_yesno(option, value, _T("fpu_no_unimplemented"), &p->fpu_no_unimplemented) diff --git a/include/options.h b/include/options.h index 820fea84..73afb12a 100644 --- a/include/options.h +++ b/include/options.h @@ -532,6 +532,7 @@ struct uae_prefs { bool comp_constjump; bool comp_catchfault; int cachesize; + TCHAR jitblacklist[MAX_DPATH]; bool fpu_strict; int fpu_mode; diff --git a/jit/compemu_support.cpp b/jit/compemu_support.cpp index 89783f93..b70eaea4 100644 --- a/jit/compemu_support.cpp +++ b/jit/compemu_support.cpp @@ -4181,13 +4181,8 @@ static bool read_fpu_opcode(const char **pp) } #endif -static bool merge_blacklist() +static bool merge_blacklist2(const char *blacklist) { -#ifdef UAE - const char *blacklist = ""; -#else - const char *blacklist = bx_options.jit.jitblacklist; -#endif #ifdef USE_JIT_FPU for (unsigned int i = 0; i < (sizeof(jit_opcodes) / sizeof(jit_opcodes[0])); i++) *jit_opcodes[i].disabled = false; @@ -4195,9 +4190,41 @@ static bool merge_blacklist() if (blacklist[0] != '\0') { const char *p = blacklist; for (;;) { + int len; if (*p == 0) return true; + const char *endp = strchr(p, ','); + if (endp) { + len = endp - p - 1; + } else { + len = strlen(p); + } + + TCHAR *s = au(p); + bool found = false; + for (int i = 0; lookuptab[i].name; i++) { + if (!_tcsnicmp(s, lookuptab[i].name, len) && _tcslen(lookuptab[i].name) == len) { + int mnemo = lookuptab[i].mnemo; + for (int opcode = 0; opcode < 65536; opcode++) { + struct instr *table = &table68k[opcode]; + if (table->mnemo == mnemo) { + reset_compop(cft_map(opcode)); + jit_log(" : blacklist opcode : %04x", opcode); + } + } + p += len; + if (*p) + p++; + found = true; + break; + } + } + xfree(s); + if (found) { + continue; + } + int opcode1 = read_opcode(p); if (opcode1 < 0) { @@ -4239,6 +4266,20 @@ static bool merge_blacklist() return true; } +static bool merge_blacklist(void) +{ + bool ret; +#ifdef UAE + const char *blacklist = ua(currprefs.jitblacklist); + ret = merge_blacklist2(blacklist); + xfree((void*)blacklist); +#else + const char *blacklist = bx_options.jit.jitblacklist; + ret = merge_blacklist2(blacklist); +#endif + return ret; +} + void build_comp(void) { #ifdef FSUAE -- 2.47.3