1 /********************************************************************
2 * Preferences handling. This is just a convenient place to put it *
3 ********************************************************************/
4 extern bool have_done_picasso;
5
check_prefs_changed_comp(bool checkonly)6 bool check_prefs_changed_comp (bool checkonly)
7 {
8 #ifdef FSUAE
9 if (!g_fs_uae_jit_compiler) {
10 return false;
11 }
12 #endif
13 bool changed = 0;
14 static int cachesize_prev, comptrust_prev;
15 static bool canbang_prev;
16
17 if (currprefs.comptrustbyte != changed_prefs.comptrustbyte ||
18 currprefs.comptrustword != changed_prefs.comptrustword ||
19 currprefs.comptrustlong != changed_prefs.comptrustlong ||
20 currprefs.comptrustnaddr!= changed_prefs.comptrustnaddr ||
21 currprefs.compnf != changed_prefs.compnf ||
22 currprefs.comp_hardflush != changed_prefs.comp_hardflush ||
23 currprefs.comp_constjump != changed_prefs.comp_constjump ||
24 currprefs.compfpu != changed_prefs.compfpu ||
25 currprefs.fpu_strict != changed_prefs.fpu_strict ||
26 currprefs.cachesize != changed_prefs.cachesize)
27 changed = 1;
28
29 if (checkonly)
30 return changed;
31
32 currprefs.comptrustbyte = changed_prefs.comptrustbyte;
33 currprefs.comptrustword = changed_prefs.comptrustword;
34 currprefs.comptrustlong = changed_prefs.comptrustlong;
35 currprefs.comptrustnaddr= changed_prefs.comptrustnaddr;
36 currprefs.compnf = changed_prefs.compnf;
37 currprefs.comp_hardflush = changed_prefs.comp_hardflush;
38 currprefs.comp_constjump = changed_prefs.comp_constjump;
39 currprefs.compfpu = changed_prefs.compfpu;
40 currprefs.fpu_strict = changed_prefs.fpu_strict;
41
42 if (currprefs.cachesize != changed_prefs.cachesize) {
43 if (currprefs.cachesize && !changed_prefs.cachesize) {
44 cachesize_prev = currprefs.cachesize;
45 comptrust_prev = currprefs.comptrustbyte;
46 canbang_prev = canbang;
47 } else if (!currprefs.cachesize && changed_prefs.cachesize == cachesize_prev) {
48 changed_prefs.comptrustbyte = currprefs.comptrustbyte = comptrust_prev;
49 changed_prefs.comptrustword = currprefs.comptrustword = comptrust_prev;
50 changed_prefs.comptrustlong = currprefs.comptrustlong = comptrust_prev;
51 changed_prefs.comptrustnaddr = currprefs.comptrustnaddr = comptrust_prev;
52 }
53 currprefs.cachesize = changed_prefs.cachesize;
54 alloc_cache();
55 changed = 1;
56 }
57
58 // Turn off illegal-mem logging when using JIT...
59 if(currprefs.cachesize)
60 currprefs.illegal_mem = changed_prefs.illegal_mem;// = 0;
61
62 if ((!canbang || !currprefs.cachesize) && currprefs.comptrustbyte != 1) {
63 // Set all of these to indirect when canbang == 0
64 currprefs.comptrustbyte = 1;
65 currprefs.comptrustword = 1;
66 currprefs.comptrustlong = 1;
67 currprefs.comptrustnaddr= 1;
68
69 changed_prefs.comptrustbyte = 1;
70 changed_prefs.comptrustword = 1;
71 changed_prefs.comptrustlong = 1;
72 changed_prefs.comptrustnaddr= 1;
73
74 changed = 1;
75
76 if (currprefs.cachesize)
77 write_log (_T("JIT: Reverting to \"indirect\" access, because canbang is zero!\n"));
78 }
79
80 if (changed)
81 write_log (_T("JIT: cache=%d. b=%d w=%d l=%d fpu=%d nf=%d inline=%d hard=%d\n"),
82 currprefs.cachesize,
83 currprefs.comptrustbyte, currprefs.comptrustword, currprefs.comptrustlong,
84 currprefs.compfpu, currprefs.compnf, currprefs.comp_constjump, currprefs.comp_hardflush);
85
86 return changed;
87 }
88