diff libinterp/octave.cc @ 15310:b055fc077224

allow jit compiler to be enabled at run-time * pt-jit.h, pt-jit.cc (Venable_jit_debug, Venable_jit_compiler): New variables. (Fenable_jit_debug, Fenable_jit_compiler): New functions. (jit_info::compile): Make JIT debugging info conditional on Venable_jit_debug. * pt-eval.cc (tree_evaluator::visit_simple_for_command, tree_evaluator::visit_while_command): Make JIT compiling conditional on Venable_jit_compiler. * octave.cc (no_jit_compiler_option, jit_debug_option): New file-scope variables. (JIT_DEBUG_OPTION, NO_JIT_COMPILER_OPTION): New option macros. (log_opts): Add --jit_debug and --no-jit-compiler options. (octave_process_command_line): Handle JIT_DEBUG_OPTION and NO_JIT_COMPILER_OPTION. (octave_initialize_interpreter): Handle jit_debug_option and no_jit_compiler_option.
author John W. Eaton <jwe@octave.org>
date Thu, 06 Sep 2012 01:33:08 -0400
parents 99db33cae82b
children cc18c566a7cd
line wrap: on
line diff
--- a/libinterp/octave.cc	Wed Sep 05 20:31:48 2012 -0700
+++ b/libinterp/octave.cc	Thu Sep 06 01:33:08 2012 -0400
@@ -128,6 +128,14 @@
 // (--no-gui)
 static bool no_gui_option = false;
 
+// If TRUE, disable the JIT compiler.
+// (--no-jit-compiler)
+static bool no_jit_compiler_option = false;
+
+// If TRUE, enable JIT compiler debugging/tracing.
+// (--jit-debug)
+static bool jit_debug_option = false;
+
 // If TRUE, force readline command line editing.
 // (--line-editing)
 static bool forced_line_editing = false;
@@ -178,10 +186,11 @@
   "octave [-HVdfhiqvx] [--debug] [--echo-commands] [--eval CODE]\n\
        [--exec-path path] [--force-gui] [--help] [--image-path path]\n\
        [--info-file file] [--info-program prog] [--interactive]\n\
-       [--line-editing] [--no-gui] [--no-history] [--no-init-file]\n\
-       [--no-init-path] [--no-line-editing] [--no-site-file]\n\
-       [--no-window-system] [-p path] [--path path] [--silent]\n\
-       [--traditional] [--verbose] [--version] [file]";
+       [--jit-debug] [--line-editing] [--no-gui] [--no-history]\n\
+       [--no-init-file] [--no-init-path] [--no-jit-compiler]\n\
+       [--no-line-editing] [--no-site-file] [--no-window-system]\n\
+       [-p path] [--path path] [--silent] [--traditional]\n\
+       [--verbose] [--version] [file]";
 
 // This is here so that it's more likely that the usage message and
 // the real set of options will agree.  Note: the `+' must come first
@@ -203,16 +212,18 @@
 #define IMAGE_PATH_OPTION 5
 #define INFO_FILE_OPTION 6
 #define INFO_PROG_OPTION 7
-#define LINE_EDITING_OPTION 8
-#define NO_GUI_OPTION 9
-#define NO_INIT_FILE_OPTION 10
-#define NO_INIT_PATH_OPTION 11
-#define NO_LINE_EDITING_OPTION 12
-#define NO_SITE_FILE_OPTION 13
-#define NO_WINDOW_SYSTEM_OPTION 14
-#define PERSIST_OPTION 15
-#define TEXI_MACROS_FILE_OPTION 16
-#define TRADITIONAL_OPTION 17
+#define JIT_DEBUG_OPTION 8
+#define LINE_EDITING_OPTION 9
+#define NO_GUI_OPTION 10
+#define NO_INIT_FILE_OPTION 11
+#define NO_INIT_PATH_OPTION 12
+#define NO_JIT_COMPILER_OPTION 13
+#define NO_LINE_EDITING_OPTION 14
+#define NO_SITE_FILE_OPTION 15
+#define NO_WINDOW_SYSTEM_OPTION 16
+#define PERSIST_OPTION 17
+#define TEXI_MACROS_FILE_OPTION 18
+#define TRADITIONAL_OPTION 19
 struct option long_opts[] =
   {
     { "braindead",        no_argument,       0, TRADITIONAL_OPTION },
@@ -227,11 +238,13 @@
     { "info-file",        required_argument, 0, INFO_FILE_OPTION },
     { "info-program",     required_argument, 0, INFO_PROG_OPTION },
     { "interactive",      no_argument,       0, 'i' },
+    { "jit-debug",        no_argument,       0, JIT_DEBUG_OPTION },
     { "line-editing",     no_argument,       0, LINE_EDITING_OPTION },
     { "no-gui",           no_argument,       0, NO_GUI_OPTION },
     { "no-history",       no_argument,       0, 'H' },
     { "no-init-file",     no_argument,       0, NO_INIT_FILE_OPTION },
     { "no-init-path",     no_argument,       0, NO_INIT_PATH_OPTION },
+    { "no-jit",           no_argument,       0, NO_JIT_COMPILER_OPTION },
     { "no-line-editing",  no_argument,       0, NO_LINE_EDITING_OPTION },
     { "no-site-file",     no_argument,       0, NO_SITE_FILE_OPTION },
     { "no-window-system", no_argument,       0, NO_WINDOW_SYSTEM_OPTION },
@@ -575,11 +588,13 @@
   --info-file FILE        Use top-level info file FILE.\n\
   --info-program PROGRAM  Use PROGRAM for reading info files.\n\
   --interactive, -i       Force interactive behavior.\n\
+  --jit-debug             Enable JIT compiler debugging/tracing.\n\
   --line-editing          Force readline use for command-line editing.\n\
   --no-gui                Disable the graphical user interface.\n\
   --no-history, -H        Don't save commands to the history list\n\
   --no-init-file          Don't read the ~/.octaverc or .octaverc files.\n\
   --no-init-path          Don't initialize function search path.\n\
+  --no-jit-compiler       Disable the JIT compiler.\n\
   --no-line-editing       Don't use readline for command-line editing.\n\
   --no-site-file          Don't read the site-wide octaverc file.\n\
   --no-window-system      Disable window system, including graphics.\n\
@@ -801,20 +816,28 @@
             info_program = optarg;
           break;
 
+        case JIT_DEBUG_OPTION:
+          jit_debug_option = true;
+          break;
+
         case LINE_EDITING_OPTION:
           forced_line_editing = true;
           break;
 
+        case NO_GUI_OPTION:
+          no_gui_option = true;
+          break;
+
         case NO_INIT_FILE_OPTION:
           read_init_files = false;
           break;
 
-        case NO_GUI_OPTION:
-          no_gui_option = true;
+        case NO_INIT_PATH_OPTION:
+          set_initial_path = false;
           break;
 
-        case NO_INIT_PATH_OPTION:
-          set_initial_path = false;
+        case NO_JIT_COMPILER_OPTION:
+          no_jit_compiler_option = true;
           break;
 
         case NO_LINE_EDITING_OPTION:
@@ -944,6 +967,12 @@
   if (! texi_macros_file.empty ())
     bind_internal_variable ("texi_macros_file", texi_macros_file);
 
+  if (jit_debug_option)
+    bind_internal_variable ("enable_jit_debugging", true);
+
+  if (no_jit_compiler_option)
+    bind_internal_variable ("enable_jit_compiler", false);
+
   // Make sure we clean up when we exit.  Also allow users to register
   // functions.  If we don't have atexit or on_exit, we're going to
   // leave some junk files around if we exit abnormally.