Mercurial > hg > octave-lyh
changeset 15582:52df2e7baabe
Disable JIT when breakpoints are present
* pt-jit.cc (Venable_jit_debug, Venable_jit_compiler): Mark as static.
(tree_jit::do_execute): Check tree_jit::enabled.
(tree_jit::enabled): New function.
* pt-jit.h (Venable_jit_debug, Venable_jit_compiler): Remove declaration.
(tree_jit::enabled): New function.
* ov-usr-fcn.cc (octave_user_function::do_multi_index_op): Do not check
Venable_jit_compiler.
* pt-eval.cc (tree_evaluator::visit_while_command,
tree_evaluator::visit_simple_for_command): Do not check Venable_jit_compiler.
author | Max Brister <max@2bass.com> |
---|---|
date | Fri, 02 Nov 2012 14:32:22 -0600 |
parents | 5649e84ea3ce |
children | 0754bdfbc8fe |
files | libinterp/interp-core/pt-jit.cc libinterp/interp-core/pt-jit.h libinterp/octave-value/ov-usr-fcn.cc libinterp/parse-tree/pt-eval.cc |
diffstat | 4 files changed, 20 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/interp-core/pt-jit.cc +++ b/libinterp/interp-core/pt-jit.cc @@ -27,6 +27,7 @@ #include <config.h> #endif +#include "debug.h" #include "defun.h" #include "ov.h" #include "pt-all.h" @@ -34,9 +35,9 @@ #include "symtab.h" #include "variables.h" -bool Venable_jit_debugging = false; +static bool Venable_jit_debugging = false; -bool Venable_jit_compiler = true; +static bool Venable_jit_compiler = true; #ifdef HAVE_LLVM @@ -1793,7 +1794,7 @@ const size_t MIN_TRIP_COUNT = 1000; size_t tc = trip_count (bounds); - if (! tc || ! initialize ()) + if (! tc || ! initialize () || ! enabled ()) return false; jit_info::vmap extra_vars; @@ -1816,7 +1817,7 @@ bool tree_jit::do_execute (tree_while_command& cmd) { - if (! initialize ()) + if (! initialize () || ! enabled ()) return false; jit_info *info = cmd.get_info (); @@ -1834,7 +1835,7 @@ tree_jit::do_execute (octave_user_function& fcn, const octave_value_list& args, octave_value_list& retval) { - if (! initialize ()) + if (! initialize () || ! enabled ()) return false; jit_function_info *info = fcn.get_info (); @@ -1848,6 +1849,15 @@ return info->execute (args, retval); } +bool +tree_jit::enabled (void) +{ + // Ideally, we should only disable JIT if there is a breakpoint in the code we + // are about to run. However, we can't figure this out in O(1) time, so we + // conservatively check for the existence of any breakpoints. + return Venable_jit_compiler && ! bp_table::have_breakpoints (); +} + size_t tree_jit::trip_count (const octave_value& bounds) const {
--- a/libinterp/interp-core/pt-jit.h +++ b/libinterp/interp-core/pt-jit.h @@ -379,6 +379,8 @@ bool do_execute (octave_user_function& fcn, const octave_value_list& args, octave_value_list& retval); + bool enabled (void); + size_t trip_count (const octave_value& bounds) const; llvm::Module *module; @@ -439,11 +441,4 @@ }; #endif - -// If TRUE, enable JIT compiler debugging/tracing. -extern bool Venable_jit_debugging; - -// If TRUE, enable JIT compiler. -extern bool Venable_jit_compiler; - #endif
--- a/libinterp/octave-value/ov-usr-fcn.cc +++ b/libinterp/octave-value/ov-usr-fcn.cc @@ -382,7 +382,7 @@ return retval; #ifdef HAVE_LLVM - if (Venable_jit_compiler && is_special_expr () + if (is_special_expr () && tree_jit::execute (*this, args, retval)) return retval; #endif
--- a/libinterp/parse-tree/pt-eval.cc +++ b/libinterp/parse-tree/pt-eval.cc @@ -307,7 +307,7 @@ octave_value rhs = expr->rvalue1 (); #if HAVE_LLVM - if (Venable_jit_compiler && tree_jit::execute (cmd, rhs)) + if (tree_jit::execute (cmd, rhs)) return; #endif @@ -1044,7 +1044,7 @@ return; #if HAVE_LLVM - if (Venable_jit_compiler && tree_jit::execute (cmd)) + if (tree_jit::execute (cmd)) return; #endif