Mercurial > octave
changeset 26003:c60a5493688a
avoid std::cout in JIT compiler code
* jit-typeinfo.cc, pt-jit.cc: Use octave_stdout instead of std::cout for
debugging messages. Use error instead of writing to std::cerr.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 01 Nov 2018 14:37:10 -0400 |
parents | 8c3e5b727e8f |
children | 94fecd437d9c |
files | libinterp/parse-tree/jit-typeinfo.cc libinterp/parse-tree/pt-jit.cc |
diffstat | 2 files changed, 23 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/jit-typeinfo.cc Thu Nov 01 14:35:35 2018 -0400 +++ b/libinterp/parse-tree/jit-typeinfo.cc Thu Nov 01 14:37:10 2018 -0400 @@ -438,7 +438,7 @@ extern "C" void octave_jit_print_matrix (jit_matrix *m) { - std::cout << *m << std::endl; + octave_stdout << *m << std::endl; } OCTAVE_NORETURN static
--- a/libinterp/parse-tree/pt-jit.cc Thu Nov 01 14:35:35 2018 -0400 +++ b/libinterp/parse-tree/pt-jit.cc Thu Nov 01 14:37:10 2018 -0400 @@ -36,6 +36,7 @@ #include "defun.h" #include "errwarn.h" #include "ov.h" +#include "pager.h" #include "pt-all.h" #include "pt-jit.h" #include "sighandlers.h" @@ -2142,10 +2143,7 @@ // FIXME: autconf this if (e == nullptr) - { - std::cerr << "Failed to create JIT engine" << std::endl; - std::cerr << err << std::endl; - } + error ("failed to create JIT engine: %s", err.c_str ()); return jit::EngineOwner (e); } @@ -2502,14 +2500,14 @@ { jit_block_list& blocks = infer.get_blocks (); blocks.label (); - std::cout << "-------------------- Compiling function "; - std::cout << "--------------------\n"; - - tree_print_code tpc (std::cout); + octave_stdout << "-------------------- Compiling function "; + octave_stdout << "--------------------\n"; + + tree_print_code tpc (octave_stdout); tpc.visit_octave_user_function_header (fcn); tpc.visit_statement_list (*fcn.body ()); tpc.visit_octave_user_function_trailer (fcn); - blocks.print (std::cout, "octave jit ir"); + blocks.print (octave_stdout, "octave jit ir"); } jit_factory& factory = conv.get_factory (); @@ -2520,9 +2518,9 @@ if (Vdebug_jit) { - std::cout << "-------------------- raw function "; - std::cout << "--------------------\n"; - std::cout << *raw_fn.to_llvm () << std::endl; + octave_stdout << "-------------------- raw function "; + octave_stdout << "--------------------\n"; + octave_stdout << *raw_fn.to_llvm () << std::endl; llvm::verifyFunction (*raw_fn.to_llvm ()); } @@ -2574,9 +2572,9 @@ if (Vdebug_jit) { - std::cout << "-------------------- optimized and wrapped "; - std::cout << "--------------------\n"; - std::cout << *llvm_function << std::endl; + octave_stdout << "-------------------- optimized and wrapped "; + octave_stdout << "--------------------\n"; + octave_stdout << *llvm_function << std::endl; llvm::verifyFunction (*llvm_function); } @@ -2602,7 +2600,7 @@ if (Vdebug_jit) { if (e.known ()) - std::cout << "jit fail: " << e.what () << std::endl; + octave_stdout << "jit fail: " << e.what () << std::endl; } Vjit_failcnt++; @@ -2755,9 +2753,9 @@ { jit_block_list& blocks = infer.get_blocks (); blocks.label (); - std::cout << "-------------------- Compiling tree --------------------\n"; - std::cout << tee.str_print_code () << std::endl; - blocks.print (std::cout, "octave jit ir"); + octave_stdout << "-------------------- Compiling tree --------------------\n"; + octave_stdout << tee.str_print_code () << std::endl; + blocks.print (octave_stdout, "octave jit ir"); } jit_factory& factory = conv.get_factory (); @@ -2776,7 +2774,7 @@ if (Vdebug_jit) { if (e.known ()) - std::cout << "jit fail: " << e.what () << std::endl; + octave_stdout << "jit fail: " << e.what () << std::endl; } Vjit_failcnt++; @@ -2787,8 +2785,8 @@ { if (Vdebug_jit) { - std::cout << "-------------------- llvm ir --------------------"; - std::cout << *llvm_function << std::endl; + octave_stdout << "-------------------- llvm ir --------------------"; + octave_stdout << *llvm_function << std::endl; llvm::verifyFunction (*llvm_function); } @@ -2796,9 +2794,9 @@ if (Vdebug_jit) { - std::cout << "-------------------- optimized llvm ir " + octave_stdout << "-------------------- optimized llvm ir " << "--------------------\n"; - std::cout << *llvm_function << std::endl; + octave_stdout << *llvm_function << std::endl; } finalizeObject ();