Update prefs editor with "JIT Compiler" pane

This commit is contained in:
gbeauche 2002-09-17 16:06:37 +00:00
parent 4fc127c8df
commit ea8bdf1941
3 changed files with 141 additions and 0 deletions

View File

@ -52,6 +52,7 @@ static void create_graphics_pane(GtkWidget *top);
static void create_input_pane(GtkWidget *top); static void create_input_pane(GtkWidget *top);
static void create_serial_pane(GtkWidget *top); static void create_serial_pane(GtkWidget *top);
static void create_memory_pane(GtkWidget *top); static void create_memory_pane(GtkWidget *top);
static void create_jit_pane(GtkWidget *top);
static void read_settings(void); static void read_settings(void);
@ -64,6 +65,10 @@ struct opt_desc {
GtkSignalFunc func; GtkSignalFunc func;
}; };
struct combo_desc {
int label_id;
};
static void add_menu_item(GtkWidget *menu, int label_id, GtkSignalFunc func) static void add_menu_item(GtkWidget *menu, int label_id, GtkSignalFunc func)
{ {
GtkWidget *item = gtk_menu_item_new_with_label(GetString(label_id)); GtkWidget *item = gtk_menu_item_new_with_label(GetString(label_id));
@ -203,6 +208,36 @@ static GtkWidget *make_checkbox(GtkWidget *top, int label_id, const char *prefs_
return button; return button;
} }
static GtkWidget *make_combobox(GtkWidget *top, int label_id, const char *prefs_item, const combo_desc *options)
{
GtkWidget *box, *label, *combo;
char str[32];
box = gtk_hbox_new(FALSE, 4);
gtk_widget_show(box);
gtk_box_pack_start(GTK_BOX(top), box, FALSE, FALSE, 0);
label = gtk_label_new(GetString(label_id));
gtk_widget_show(label);
gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0);
GList *glist = NULL;
while (options->label_id) {
glist = g_list_append(glist, (void *)GetString(options->label_id));
options++;
}
combo = gtk_combo_new();
gtk_widget_show(combo);
gtk_combo_set_popdown_strings(GTK_COMBO(combo), glist);
sprintf(str, "%d", PrefsFindInt32(prefs_item));
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(combo)->entry), str);
gtk_box_pack_start(GTK_BOX(box), combo, TRUE, TRUE, 0);
return combo;
}
/* /*
* Show preferences editor * Show preferences editor
@ -369,6 +404,7 @@ bool PrefsEditor(void)
create_input_pane(notebook); create_input_pane(notebook);
create_serial_pane(notebook); create_serial_pane(notebook);
create_memory_pane(notebook); create_memory_pane(notebook);
create_jit_pane(notebook);
static const opt_desc buttons[] = { static const opt_desc buttons[] = {
{STR_START_BUTTON, GTK_SIGNAL_FUNC(cb_start)}, {STR_START_BUTTON, GTK_SIGNAL_FUNC(cb_start)},
@ -545,6 +581,84 @@ static void create_volumes_pane(GtkWidget *top)
} }
/*
* "JIT Compiler" pane
*/
static GtkWidget *w_jit_fpu;
static GtkWidget *w_jit_atraps;
static GtkWidget *w_jit_cache_size;
static GtkWidget *w_jit_lazy_flush;
// Set sensitivity of widgets
static void set_jit_sensitive(void)
{
const bool jit_enabled = PrefsFindBool("jit");
gtk_widget_set_sensitive(w_jit_fpu, jit_enabled);
gtk_widget_set_sensitive(w_jit_cache_size, jit_enabled);
gtk_widget_set_sensitive(w_jit_lazy_flush, jit_enabled);
}
// "Use JIT Compiler" button toggled
static void tb_jit(GtkWidget *widget)
{
PrefsReplaceBool("jit", GTK_TOGGLE_BUTTON(widget)->active);
set_jit_sensitive();
}
// "Compile FPU Instructions" button toggled
static void tb_jit_fpu(GtkWidget *widget)
{
PrefsReplaceBool("jitfpu", GTK_TOGGLE_BUTTON(widget)->active);
}
// "Lazy translation cache invalidation" button toggled
static void tb_jit_lazy_flush(GtkWidget *widget)
{
PrefsReplaceBool("jitlazyflush", GTK_TOGGLE_BUTTON(widget)->active);
}
// Read settings from widgets and set preferences
static void read_jit_settings(void)
{
#if USE_JIT
bool jit_enabled = PrefsFindBool("jit");
if (jit_enabled) {
const char *str = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(w_jit_cache_size)->entry));
PrefsReplaceInt32("jitcachesize", atoi(str));
}
#endif
}
// Create "JIT Compiler" pane
static void create_jit_pane(GtkWidget *top)
{
#if USE_JIT
GtkWidget *box, *table, *label, *menu;
char str[32];
box = make_pane(top, STR_JIT_PANE_TITLE);
make_checkbox(box, STR_JIT_CTRL, "jit", GTK_SIGNAL_FUNC(tb_jit));
w_jit_fpu = make_checkbox(box, STR_JIT_FPU_CTRL, "jitfpu", GTK_SIGNAL_FUNC(tb_jit_fpu));
// Translation cache size
static const combo_desc options[] = {
STR_JIT_CACHE_SIZE_2MB_LAB,
STR_JIT_CACHE_SIZE_4MB_LAB,
STR_JIT_CACHE_SIZE_8MB_LAB,
STR_JIT_CACHE_SIZE_16MB_LAB,
0
};
w_jit_cache_size = make_combobox(box, STR_JIT_CACHE_SIZE_CTRL, "jitcachesize", options);
// Lazy translation cache invalidation
w_jit_lazy_flush = make_checkbox(box, STR_JIT_LAZY_CINV_CTRL, "jitlazyflush", GTK_SIGNAL_FUNC(tb_jit_lazy_flush));
set_jit_sensitive();
#endif
}
/* /*
* "SCSI" pane * "SCSI" pane
*/ */
@ -1253,4 +1367,5 @@ static void read_settings(void)
read_input_settings(); read_input_settings();
read_serial_settings(); read_serial_settings();
read_memory_settings(); read_memory_settings();
read_jit_settings();
} }

View File

@ -57,6 +57,11 @@ prefs_desc common_prefs_items[] = {
{"nosound", TYPE_BOOLEAN, false, "don't enable sound output"}, {"nosound", TYPE_BOOLEAN, false, "don't enable sound output"},
{"noclipconversion", TYPE_BOOLEAN, false, "don't convert clipboard contents"}, {"noclipconversion", TYPE_BOOLEAN, false, "don't convert clipboard contents"},
{"nogui", TYPE_BOOLEAN, false, "disable GUI"}, {"nogui", TYPE_BOOLEAN, false, "disable GUI"},
{"jit", TYPE_BOOLEAN, false, "enable JIT compiler"},
{"jitfpu", TYPE_BOOLEAN, false, "enable JIT compilation of FPU instructions"},
{"jitdebug", TYPE_BOOLEAN, false, "enable JIT debugger (requires mon builtin)"},
{"jitcachesize", TYPE_INT32, false, "translation cache size in KB"},
{"jitlazyflush", TYPE_BOOLEAN, false, "enable lazy invalidation of translation cache"},
{NULL, TYPE_END, false, NULL} // End of list {NULL, TYPE_END, false, NULL} // End of list
}; };
@ -81,4 +86,15 @@ void AddPrefsDefaults(void)
PrefsAddBool("nosound", false); PrefsAddBool("nosound", false);
PrefsAddBool("noclipconversion", false); PrefsAddBool("noclipconversion", false);
PrefsAddBool("nogui", false); PrefsAddBool("nogui", false);
#if USE_JIT
// JIT compiler specific options
PrefsAddBool("jit", true);
PrefsAddBool("jitfpu", true);
PrefsAddBool("jitdebug", false);
PrefsAddInt32("jitcachesize", 8192);
PrefsAddInt32("jitlazyflush", true);
#else
PrefsAddBool("jit", false);
#endif
} }

View File

@ -201,6 +201,16 @@ user_string_def common_strings[] = {
{STR_CPU_68040_LAB, "68040"}, {STR_CPU_68040_LAB, "68040"},
{STR_ROM_FILE_CTRL, "ROM File"}, {STR_ROM_FILE_CTRL, "ROM File"},
{STR_JIT_PANE_TITLE, "JIT Compiler"},
{STR_JIT_CTRL, "Enable JIT Compiler"},
{STR_JIT_FPU_CTRL, "Compile FPU Instructions"},
{STR_JIT_CACHE_SIZE_CTRL, "Translation Cache Size"},
{STR_JIT_CACHE_SIZE_2MB_LAB, "2048"},
{STR_JIT_CACHE_SIZE_4MB_LAB, "4096"},
{STR_JIT_CACHE_SIZE_8MB_LAB, "8192"},
{STR_JIT_CACHE_SIZE_16MB_LAB, "16384"},
{STR_JIT_LAZY_CINV_CTRL, "Enable lazy invalidation of translation cache"},
{STR_WINDOW_TITLE, "Basilisk II"}, {STR_WINDOW_TITLE, "Basilisk II"},
{STR_WINDOW_TITLE_FROZEN, "Basilisk II *** FROZEN ***"}, {STR_WINDOW_TITLE_FROZEN, "Basilisk II *** FROZEN ***"},
{STR_WINDOW_MENU, "Basilisk II"}, {STR_WINDOW_MENU, "Basilisk II"},