Mercurial > octave
diff libinterp/interp-core/jit-typeinfo.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 | 0754bdfbc8fe |
children | 1f076c40c133 |
line wrap: on
line diff
--- a/libinterp/interp-core/jit-typeinfo.cc Sun Nov 04 20:09:23 2012 -0700 +++ b/libinterp/interp-core/jit-typeinfo.cc Sun Nov 04 21:11:33 2012 -0700 @@ -1110,6 +1110,15 @@ engine->addGlobalMapping (lerror_state, reinterpret_cast<void *> (&error_state)); + // sig_atomic_type is going to be some sort of integer + sig_atomic_type = llvm::Type::getIntNTy (context, sizeof(sig_atomic_t) * 8); + loctave_interrupt_state + = new llvm::GlobalVariable (*module, sig_atomic_type, false, + llvm::GlobalValue::ExternalLinkage, 0, + "octave_interrupt_state"); + engine->addGlobalMapping (loctave_interrupt_state, + reinterpret_cast<void *> (&octave_interrupt_state)); + // generic call function { jit_type *int_t = intN (sizeof (octave_builtin::fcn) * 8); @@ -1799,7 +1808,7 @@ casts[scalar->type_id ()].stash_name ("(scalar)"); casts[complex->type_id ()].stash_name ("(complex)"); casts[matrix->type_id ()].stash_name ("(matrix)"); - casts[any->type_id ()].stash_name ("(range)"); + casts[range->type_id ()].stash_name ("(range)"); // cast any <- matrix fn = create_function (jit_convention::external, "octave_jit_cast_any_matrix", @@ -2078,6 +2087,14 @@ return abuilder.CreateLoad (lerror_state); } +llvm::Value * +jit_typeinfo::do_insert_interrupt_check (llvm::IRBuilderD& abuilder) +{ + llvm::LoadInst *val = abuilder.CreateLoad (loctave_interrupt_state); + val->setVolatile (true); + return abuilder.CreateICmpSGT (val, abuilder.getInt32 (0)); +} + void jit_typeinfo::add_builtin (const std::string& name) {