]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
JIT opcode blacklist config entry.
authorToni Wilen <twilen@winuae.net>
Sun, 27 Sep 2020 18:08:15 +0000 (21:08 +0300)
committerToni Wilen <twilen@winuae.net>
Sun, 27 Sep 2020 18:08:15 +0000 (21:08 +0300)
cfgfile.cpp
include/options.h
jit/compemu_support.cpp

index 0d7fda1f59af4700b1937eb540902d01670803f1..550c4629291bc56fd399b6623f781b2b78a7c1a4 100644 (file)
@@ -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)
index 820fea84f343467f974785b149f1c65717491c3f..73afb12ac2292340082f609e4833e44fa3441d50 100644 (file)
@@ -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;
 
index 89783f9341255806c956e3571afb6779f5fe9eb1..b70eaea4b0a9b4709f866b8a3a425c3b3788e2cc 100644 (file)
@@ -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("<JIT compiler> : 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