Mercurial > hg > octave-nkf
diff libinterp/interp-core/jit-ir.cc @ 15603:44272909d926
Stop JIT on interrupt
* jit-ir.cc (jit_call::needs_release): Move to cc file and do not release
artificial assigns.
(jit_error_check::variable_to_strign): New function.
(jit_error_check::print): Move to cc file and improve output.
* jit-ir.h (jit_call::needs_release): Move to cc file.
(jit_error_check::variable): New enum.
(jit_error_check::variable_to_string): New declaration.
(jit_error_check::jit_error_check): Add variable argument and new overload.
(jit_error_check::check_variable, jit_error_check::has_check_for): New function.
(jit_error_check::check_for): Ensure has_check_for is true.
(jit_error_check::print): Move to cc file.
(jit_error_check::check_alive): Always true if has_check_for is false.
(jit_error_check::mvariable): New variable.
* jit-typeinfo.cc (jit_typeinfo::jit_typeinfo): Initialize
loctave_interrupt_state and fix name of cast to any.
(jit_typeinfo::do_insert_interrupt_check): New function.
* jit-typeinfo.h (jit_typeinfo::insert_interrupt_check): New function.
(jit_typeinfo::do_insert_interrupt_check): New declaration.
(jit_typeinfo::loctave_interrupt_state): New variable.
* pt-jit.cc (jit_convert::visit_simple_for_command,
jit_convert::visit_while_command): Check interrupt state.
(jit_convert::create_check_impl): Specify var_error_state check.
(jit_convert_llvm::visit): Generate var_interrupt error check.
(jit_function_info::execute, jit_info::execute): Call octave_quit.
author | Max Brister <max@2bass.com> |
---|---|
date | Sun, 04 Nov 2012 21:11:33 -0700 |
parents | f3e339aee38f |
children | e2de3c8882be |
line wrap: on
line diff
--- a/libinterp/interp-core/jit-ir.cc +++ b/libinterp/interp-core/jit-ir.cc @@ -698,6 +698,23 @@ // -------------------- jit_call -------------------- bool +jit_call::needs_release (void) const +{ + if (type () && jit_typeinfo::get_release (type ()).valid ()) + { + for (jit_use *use = first_use (); use; use = use->next ()) + { + jit_assign *assign = dynamic_cast<jit_assign *> (use->user ()); + if (assign && assign->artificial ()) + return false; + } + + return true; + } + return false; +} + +bool jit_call::infer (void) { // FIXME: explain algorithm @@ -726,6 +743,33 @@ return false; } +// -------------------- jit_error_check -------------------- +std::string +jit_error_check::variable_to_string (variable v) +{ + switch (v) + { + case var_error_state: + return "error_state"; + case var_interrupt: + return "interrupt"; + default: + panic_impossible (); + } +} + +std::ostream& +jit_error_check::print (std::ostream& os, size_t indent) const +{ + print_indent (os, indent) << "error_check " << variable_to_string (mvariable) + << ", "; + + if (has_check_for ()) + os << "<for> " << *check_for () << ", "; + print_successor (os << "<normal> ", 1) << ", "; + return print_successor (os << "<error> ", 0); +} + // -------------------- jit_magic_end -------------------- jit_magic_end::context::context (jit_factory& factory, jit_value *avalue, size_t aindex, size_t acount)