< prev index next >

src/hotspot/share/compiler/compileTask.cpp

Print this page

 26 #include "compiler/compileBroker.hpp"
 27 #include "compiler/compileLog.hpp"
 28 #include "compiler/compilerDirectives.hpp"
 29 #include "compiler/compileTask.hpp"
 30 #include "logging/log.hpp"
 31 #include "logging/logStream.hpp"
 32 #include "memory/resourceArea.hpp"
 33 #include "oops/klass.inline.hpp"
 34 #include "oops/method.inline.hpp"
 35 #include "runtime/handles.inline.hpp"
 36 #include "runtime/jniHandles.hpp"
 37 #include "runtime/mutexLocker.hpp"
 38 
 39 int CompileTask::_active_tasks = 0;
 40 
 41 CompileTask::CompileTask(int compile_id,
 42                          const methodHandle& method,
 43                          int osr_bci,
 44                          int comp_level,
 45                          int hot_count,

 46                          CompileReason compile_reason,


 47                          bool is_blocking) {
 48   Thread* thread = Thread::current();
 49   _compile_id = compile_id;
 50   _method = method();
 51   _method_holder = JNIHandles::make_weak_global(Handle(thread, method->method_holder()->klass_holder()));
 52   _osr_bci = osr_bci;

 53   _is_blocking = is_blocking;
 54   JVMCI_ONLY(_has_waiter = CompileBroker::compiler(comp_level)->is_jvmci();)
 55   JVMCI_ONLY(_blocking_jvmci_compile_state = nullptr;)
 56   _comp_level = comp_level;
 57   _num_inlined_bytecodes = 0;
 58 
 59   _is_complete = false;
 60   _is_success = false;
 61 



 62   _hot_count = hot_count;
 63   _time_queued = os::elapsed_counter();

 64   _time_started = 0;



 65   _compile_reason = compile_reason;
 66   _nm_content_size = 0;
 67   AbstractCompiler* comp = compiler();
 68   _directive = DirectivesStack::getMatchingDirective(method, comp);
 69   _nm_insts_size = 0;
 70   _nm_total_size = 0;
 71   _failure_reason = nullptr;
 72   _failure_reason_on_C_heap = false;
 73   _training_data = nullptr;









 74   _arena_bytes = 0;
 75 
 76   _next = nullptr;
 77   _prev = nullptr;
 78 
 79   Atomic::add(&_active_tasks, 1, memory_order_relaxed);
 80 }
 81 
 82 CompileTask::~CompileTask() {
 83   if (_method_holder != nullptr && JNIHandles::is_weak_global_handle(_method_holder)) {
 84     JNIHandles::destroy_weak_global(_method_holder);
 85   } else {
 86     JNIHandles::destroy_global(_method_holder);
 87   }
 88   if (_failure_reason_on_C_heap && _failure_reason != nullptr) {
 89     os::free((void*) _failure_reason);
 90     _failure_reason = nullptr;
 91     _failure_reason_on_C_heap = false;
 92   }
 93 
 94   if (Atomic::sub(&_active_tasks, 1, memory_order_relaxed) == 0) {
 95     MonitorLocker wait_ml(CompileTaskWait_lock);
 96     wait_ml.notify_all();
 97   }
 98 }
 99 
100 void CompileTask::wait_for_no_active_tasks() {
101   MonitorLocker locker(CompileTaskWait_lock);
102   while (Atomic::load(&_active_tasks) > 0) {
103     locker.wait();
104   }
105 }
106 
107 /**
108  * Returns the compiler for this task.
109  */
110 AbstractCompiler* CompileTask::compiler() const {
111   return CompileBroker::compiler(_comp_level);

112 }
113 
114 // Replace weak handles by strong handles to avoid unloading during compilation.
115 CompileTask* CompileTask::select_for_compilation() {



116   if (is_unloaded()) {
117     // Guard against concurrent class unloading
118     return nullptr;
119   }
120   Thread* thread = Thread::current();
121   assert(_method->method_holder()->is_loader_alive(), "should be alive");
122   Handle method_holder(thread, _method->method_holder()->klass_holder());
123   JNIHandles::destroy_weak_global(_method_holder);
124   _method_holder = JNIHandles::make_global(method_holder);
125   return this;
126 }
127 
128 void CompileTask::mark_on_stack() {
129   if (is_unloaded()) {
130     return;
131   }
132   // Mark these methods as something redefine classes cannot remove.
133   _method->set_on_stack(true);
134 }
135 
136 bool CompileTask::is_unloaded() const {

137   return _method_holder != nullptr && JNIHandles::is_weak_global_handle(_method_holder) && JNIHandles::is_weak_global_cleared(_method_holder);
138 }
139 
140 // RedefineClasses support
141 void CompileTask::metadata_do(MetadataClosure* f) {
142   if (is_unloaded()) {
143     return;
144   }
145   f->do_metadata(method());
146 }
147 
148 // ------------------------------------------------------------------
149 // CompileTask::print_line_on_error
150 //
151 // This function is called by fatal error handler when the thread
152 // causing troubles is a compiler thread.
153 //
154 // Do not grab any lock, do not allocate memory.
155 //
156 // Otherwise it's the same as CompileTask::print_line()
157 //
158 void CompileTask::print_line_on_error(outputStream* st, char* buf, int buflen) {
159   // print compiler name
160   st->print("%s:", CompileBroker::compiler_name(comp_level()));
161   print(st);
162 }
163 
164 // ------------------------------------------------------------------
165 // CompileTask::print_tty
166 void CompileTask::print_tty() {
167   ttyLocker ttyl;  // keep the following output all in one block
168   print(tty);
169 }
170 
171 // ------------------------------------------------------------------
172 // CompileTask::print_impl
173 void CompileTask::print_impl(outputStream* st, Method* method, int compile_id, int comp_level,
174                              bool is_osr_method, int osr_bci, bool is_blocking,

175                              const char* msg, bool short_form, bool cr,
176                              jlong time_queued, jlong time_started) {

177   if (!short_form) {
178     // Print current time
179     st->print(UINT64_FORMAT " ", (uint64_t) tty->time_stamp().milliseconds());
180     if (Verbose && time_queued != 0) {
181       // Print time in queue and time being processed by compiler thread
182       jlong now = os::elapsed_counter();
183       st->print("%.0f ", TimeHelper::counter_to_millis(now-time_queued));
184       if (time_started != 0) {
185         st->print("%.0f ", TimeHelper::counter_to_millis(now-time_started));

186       }

187     }






















188   }

189   // print compiler name if requested
190   if (CIPrintCompilerName) {
191     st->print("%s:", CompileBroker::compiler_name(comp_level));
192   }
193   st->print("%4d ", compile_id);    // print compilation number
194 
195   bool is_synchronized = false;
196   bool has_exception_handler = false;
197   bool is_native = false;
198   if (method != nullptr) {
199     is_synchronized       = method->is_synchronized();
200     has_exception_handler = method->has_exception_handler();
201     is_native             = method->is_native();
202   }
203   // method attributes
204   const char compile_type   = is_osr_method                   ? '%' : ' ';
205   const char sync_char      = is_synchronized                 ? 's' : ' ';
206   const char exception_char = has_exception_handler           ? '!' : ' ';
207   const char blocking_char  = is_blocking                     ? 'b' : ' ';
208   const char native_char    = is_native                       ? 'n' : ' ';


209 
210   // print method attributes
211   st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char);
212 
213   if (TieredCompilation) {
214     if (comp_level != -1)  st->print("%d ", comp_level);
215     else                   st->print("- ");
216   }
217   st->print("     ");  // more indent
218 
219   if (method == nullptr) {
220     st->print("(method)");
221   } else {
222     method->print_short_name(st);
223     if (is_osr_method) {
224       st->print(" @ %d", osr_bci);
225     }
226     if (method->is_native())
227       st->print(" (native)");
228     else
229       st->print(" (%d bytes)", method->code_size());
230   }
231 
232   if (msg != nullptr) {
233     st->print("   %s", msg);
234   }
235   if (cr) {
236     st->cr();
237   }
238 }
239 
240 // ------------------------------------------------------------------
241 // CompileTask::print_compilation
242 void CompileTask::print(outputStream* st, const char* msg, bool short_form, bool cr) {
243   bool is_osr_method = osr_bci() != InvocationEntryBci;
244   print_impl(st, is_unloaded() ? nullptr : method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), msg, short_form, cr, _time_queued, _time_started);








245 }
246 
247 // ------------------------------------------------------------------
248 // CompileTask::log_task
249 void CompileTask::log_task(xmlStream* log) {
250   Thread* thread = Thread::current();
251   methodHandle method(thread, this->method());
252   ResourceMark rm(thread);
253 
254   // <task id='9' method='M' osr_bci='X' level='1' blocking='1' stamp='1.234'>
255   log->print(" compile_id='%d'", _compile_id);
256   if (_osr_bci != CompileBroker::standard_entry_bci) {
257     log->print(" compile_kind='osr'");  // same as nmethod::compile_kind




258   } // else compile_kind='c2c'
259   if (!method.is_null())  log->method(method());
260   if (_osr_bci != CompileBroker::standard_entry_bci) {
261     log->print(" osr_bci='%d'", _osr_bci);
262   }
263   if (_comp_level != CompilationPolicy::highest_compile_level()) {
264     log->print(" level='%d'", _comp_level);
265   }
266   if (_is_blocking) {
267     log->print(" blocking='1'");
268   }
269   log->stamp();
270 }
271 
272 // ------------------------------------------------------------------
273 // CompileTask::log_task_queued
274 void CompileTask::log_task_queued() {
275   ttyLocker ttyl;
276   ResourceMark rm;
277   NoSafepointVerifier nsv;
278 
279   xtty->begin_elem("task_queued");
280   log_task(xtty);
281   assert(_compile_reason > CompileTask::Reason_None && _compile_reason < CompileTask::Reason_Count, "Valid values");
282   xtty->print(" comment='%s'", reason_name(_compile_reason));
283 
284   if (_hot_count != 0) {
285     xtty->print(" hot_count='%d'", _hot_count);
286   }

287   xtty->end_elem();
288 }
289 
290 
291 // ------------------------------------------------------------------
292 // CompileTask::log_task_start
293 void CompileTask::log_task_start(CompileLog* log)   {
294   log->begin_head("task");
295   log_task(log);

296   log->end_head();
297 }
298 
299 
300 // ------------------------------------------------------------------
301 // CompileTask::log_task_done
302 void CompileTask::log_task_done(CompileLog* log) {
303   Thread* thread = Thread::current();
304   methodHandle method(thread, this->method());
305   ResourceMark rm(thread);
306 
307   if (!_is_success) {
308     assert(_failure_reason != nullptr, "missing");
309     const char* reason = _failure_reason != nullptr ? _failure_reason : "unknown";
310     log->begin_elem("failure reason='");
311     log->text("%s", reason);
312     log->print("'");
313     log->end_elem();
314   }
315 

417   } else if (result == InliningResult::FAILURE) {
418     st->print("   %s", "failed to inline");
419   }
420 }
421 
422 void CompileTask::print_ul(const char* msg){
423   LogTarget(Info, jit, compilation) lt;
424   if (lt.is_enabled()) {
425     LogStream ls(lt);
426     print(&ls, msg, /* short form */ true, /* cr */ true);
427   }
428 }
429 
430 void CompileTask::print_ul(const nmethod* nm, const char* msg) {
431   LogTarget(Info, jit, compilation) lt;
432   if (lt.is_enabled()) {
433     LogStream ls(lt);
434     print_impl(&ls, nm->method(), nm->compile_id(),
435                nm->comp_level(), nm->is_osr_method(),
436                nm->is_osr_method() ? nm->osr_entry_bci() : -1,
437                /*is_blocking*/ false,

438                msg, /* short form */ true, /* cr */ true);
439   }
440 }
441 
442 void CompileTask::print_inlining_ul(ciMethod* method, int inline_level, int bci, InliningResult result, const char* msg) {
443   LogTarget(Debug, jit, inlining) lt;
444   if (lt.is_enabled()) {
445     LogStream ls(lt);
446     print_inlining_inner(&ls, method, inline_level, bci, result, msg);
447   }
448 }
449 

 26 #include "compiler/compileBroker.hpp"
 27 #include "compiler/compileLog.hpp"
 28 #include "compiler/compilerDirectives.hpp"
 29 #include "compiler/compileTask.hpp"
 30 #include "logging/log.hpp"
 31 #include "logging/logStream.hpp"
 32 #include "memory/resourceArea.hpp"
 33 #include "oops/klass.inline.hpp"
 34 #include "oops/method.inline.hpp"
 35 #include "runtime/handles.inline.hpp"
 36 #include "runtime/jniHandles.hpp"
 37 #include "runtime/mutexLocker.hpp"
 38 
 39 int CompileTask::_active_tasks = 0;
 40 
 41 CompileTask::CompileTask(int compile_id,
 42                          const methodHandle& method,
 43                          int osr_bci,
 44                          int comp_level,
 45                          int hot_count,
 46                          AOTCodeEntry* aot_code_entry,
 47                          CompileReason compile_reason,
 48                          CompileQueue* compile_queue,
 49                          bool requires_online_compilation,
 50                          bool is_blocking) {
 51   Thread* thread = Thread::current();
 52   _compile_id = compile_id;
 53   _method = method();
 54   _method_holder = JNIHandles::make_weak_global(Handle(thread, method->method_holder()->klass_holder()));
 55   _osr_bci = osr_bci;
 56   _requires_online_compilation = requires_online_compilation;
 57   _is_blocking = is_blocking;


 58   _comp_level = comp_level;
 59   _num_inlined_bytecodes = 0;
 60 
 61   _is_complete = false;
 62   _is_success = false;
 63 
 64   _next = nullptr;
 65   _prev = nullptr;
 66 
 67   _hot_count = hot_count;
 68   _time_created = os::elapsed_counter();
 69   _time_queued = 0;
 70   _time_started = 0;
 71   _time_finished = 0;
 72   _aot_load_start = 0;
 73   _aot_load_finish = 0;
 74   _compile_reason = compile_reason;
 75   _nm_content_size = 0;


 76   _nm_insts_size = 0;
 77   _nm_total_size = 0;
 78   _failure_reason = nullptr;
 79   _failure_reason_on_C_heap = false;
 80   _training_data = nullptr;
 81   _aot_code_entry = aot_code_entry;
 82   _compile_queue = compile_queue;
 83 
 84   AbstractCompiler* comp = CompileBroker::compiler(comp_level);
 85   _compiler = comp;
 86   _directive = DirectivesStack::getMatchingDirective(method, comp);
 87 
 88   JVMCI_ONLY(_has_waiter = comp->is_jvmci();)
 89   JVMCI_ONLY(_blocking_jvmci_compile_state = nullptr;)
 90   _arena_bytes = 0;
 91 
 92   _next = nullptr;
 93   _prev = nullptr;
 94 
 95   Atomic::add(&_active_tasks, 1, memory_order_relaxed);
 96 }
 97 
 98 CompileTask::~CompileTask() {
 99   if (_method_holder != nullptr && JNIHandles::is_weak_global_handle(_method_holder)) {
100     JNIHandles::destroy_weak_global(_method_holder);
101   } else {
102     JNIHandles::destroy_global(_method_holder);
103   }
104   if (_failure_reason_on_C_heap && _failure_reason != nullptr) {
105     os::free((void*) _failure_reason);
106     _failure_reason = nullptr;
107     _failure_reason_on_C_heap = false;
108   }
109 
110   if (Atomic::sub(&_active_tasks, 1, memory_order_relaxed) == 0) {
111     MonitorLocker wait_ml(CompileTaskWait_lock);
112     wait_ml.notify_all();
113   }
114 }
115 
116 void CompileTask::wait_for_no_active_tasks() {
117   MonitorLocker locker(CompileTaskWait_lock);
118   while (Atomic::load(&_active_tasks) > 0) {
119     locker.wait();
120   }
121 }
122 
123 /**
124  * Returns the compiler for this task.
125  */
126 AbstractCompiler* CompileTask::compiler() const {
127   assert(_compiler != nullptr, "should be set");
128   return _compiler;
129 }
130 
131 // Replace weak handles by strong handles to avoid unloading during compilation.
132 CompileTask* CompileTask::select_for_compilation() {
133   if (_compile_reason == Reason_Preload) {
134     return this;
135   }
136   if (is_unloaded()) {
137     // Guard against concurrent class unloading
138     return nullptr;
139   }
140   Thread* thread = Thread::current();
141   assert(_method->method_holder()->is_loader_alive(), "should be alive");
142   Handle method_holder(thread, _method->method_holder()->klass_holder());
143   JNIHandles::destroy_weak_global(_method_holder);
144   _method_holder = JNIHandles::make_global(method_holder);
145   return this;
146 }
147 
148 void CompileTask::mark_on_stack() {
149   if (is_unloaded()) {
150     return;
151   }
152   // Mark these methods as something redefine classes cannot remove.
153   _method->set_on_stack(true);
154 }
155 
156 bool CompileTask::is_unloaded() const {
157   if (preload()) return false;
158   return _method_holder != nullptr && JNIHandles::is_weak_global_handle(_method_holder) && JNIHandles::is_weak_global_cleared(_method_holder);
159 }
160 
161 // RedefineClasses support
162 void CompileTask::metadata_do(MetadataClosure* f) {
163   if (is_unloaded()) {
164     return;
165   }
166   f->do_metadata(method());
167 }
168 
169 // ------------------------------------------------------------------
170 // CompileTask::print_line_on_error
171 //
172 // This function is called by fatal error handler when the thread
173 // causing troubles is a compiler thread.
174 //
175 // Do not grab any lock, do not allocate memory.
176 //
177 // Otherwise it's the same as CompileTask::print_line()
178 //
179 void CompileTask::print_line_on_error(outputStream* st, char* buf, int buflen) {
180   // print compiler name
181   st->print("%s:", compiler()->name());
182   print(st);
183 }
184 
185 // ------------------------------------------------------------------
186 // CompileTask::print_tty
187 void CompileTask::print_tty() {
188   ttyLocker ttyl;  // keep the following output all in one block
189   print(tty);
190 }
191 
192 // ------------------------------------------------------------------
193 // CompileTask::print_impl
194 void CompileTask::print_impl(outputStream* st, Method* method, int compile_id, int comp_level,
195                              bool is_osr_method, int osr_bci, bool is_blocking, bool is_aot, bool is_preload,
196                              const char* compiler_name,
197                              const char* msg, bool short_form, bool cr,
198                              jlong time_created, jlong time_queued, jlong time_started, jlong time_finished,
199                              jlong aot_load_start, jlong aot_load_finish) {
200   if (!short_form) {
201     {
202       stringStream ss;
203       ss.print(UINT64_FORMAT, (uint64_t) tty->time_stamp().milliseconds());
204       st->print("%7s ", ss.freeze());
205     }
206     { // Time waiting to be put on queue
207       stringStream ss;
208       if (time_created != 0 && time_queued != 0) {
209         ss.print("W%.1f", TimeHelper::counter_to_millis(time_queued - time_created));
210       }
211       st->print("%7s ", ss.freeze());
212     }
213     { // Time in queue
214       stringStream ss;
215       if (time_queued != 0 && time_started != 0) {
216         ss.print("Q%.1f", TimeHelper::counter_to_millis(time_started - time_queued));
217       }
218       st->print("%7s ", ss.freeze());
219     }
220     { // Time in compilation
221       stringStream ss;
222       if (time_started != 0 && time_finished != 0) {
223         ss.print("C%.1f", TimeHelper::counter_to_millis(time_finished - time_started));
224       }
225       st->print("%7s ", ss.freeze());
226     }
227     { // Time to load from AOT code cache
228       stringStream ss;
229       if (aot_load_start != 0 && aot_load_finish != 0) {
230         ss.print("A%.1f", TimeHelper::counter_to_millis(aot_load_finish - aot_load_start));
231       }
232       st->print("%7s ", ss.freeze());
233     }
234     st->print("  ");
235   }
236 
237   // print compiler name if requested
238   if (CIPrintCompilerName) {
239     st->print("%s:", compiler_name);
240   }
241   st->print("%4d ", compile_id);    // print compilation number
242 
243   bool is_synchronized = false;
244   bool has_exception_handler = false;
245   bool is_native = false;
246   if (method != nullptr) {
247     is_synchronized       = method->is_synchronized();
248     has_exception_handler = method->has_exception_handler();
249     is_native             = method->is_native();
250   }
251   // method attributes
252   const char compile_type   = is_osr_method                   ? '%' : ' ';
253   const char sync_char      = is_synchronized                 ? 's' : ' ';
254   const char exception_char = has_exception_handler           ? '!' : ' ';
255   const char blocking_char  = is_blocking                     ? 'b' : ' ';
256   const char native_char    = is_native                       ? 'n' : ' ';
257   const char aot_char       = is_aot                          ? 'A' : ' ';
258   const char preload_char   = is_preload                      ? 'P' : ' ';
259 
260   // print method attributes
261   st->print("%c%c%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char, aot_char, preload_char);
262 
263   if (TieredCompilation) {
264     if (comp_level != -1)  st->print("%d ", comp_level);
265     else                   st->print("- ");
266   }
267   st->print("     ");  // more indent
268 
269   if (method == nullptr) {
270     st->print("(method)");
271   } else {
272     method->print_short_name(st);
273     if (is_osr_method) {
274       st->print(" @ %d", osr_bci);
275     }
276     if (method->is_native())
277       st->print(" (native)");
278     else
279       st->print(" (%d bytes)", method->code_size());
280   }
281 
282   if (msg != nullptr) {
283     st->print("   %s", msg);
284   }
285   if (cr) {
286     st->cr();
287   }
288 }
289 
290 // ------------------------------------------------------------------
291 // CompileTask::print_compilation
292 void CompileTask::print(outputStream* st, const char* msg, bool short_form, bool cr) {
293   bool is_osr_method = osr_bci() != InvocationEntryBci;
294   bool is_aot = is_aot_load();
295   bool is_preload = preload();
296   if (is_precompile()) {
297     // Tag aot compilation too
298     is_preload = (compile_reason() == Reason_PrecompileForPreload);
299     is_aot = !is_preload;
300   }
301   print_impl(st, is_unloaded() ? nullptr : method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), is_aot, is_preload,
302              compiler()->name(), msg, short_form, cr, _time_created, _time_queued, _time_started, _time_finished, _aot_load_start, _aot_load_finish);
303 }
304 
305 // ------------------------------------------------------------------
306 // CompileTask::log_task
307 void CompileTask::log_task(xmlStream* log) {
308   Thread* thread = Thread::current();
309   methodHandle method(thread, this->method());
310   ResourceMark rm(thread);
311 
312   // <task id='9' method='M' osr_bci='X' level='1' blocking='1' stamp='1.234'>
313   log->print(" compile_id='%d'", _compile_id);
314   if (_osr_bci != CompileBroker::standard_entry_bci) {
315     log->print(" compile_kind='osr'");  // same as nmethod::compile_kind
316   } else if (preload()) {
317     log->print(" compile_kind='AP'");
318   } else if (is_aot_load()) {
319     log->print(" compile_kind='A'");
320   } // else compile_kind='c2c'
321   if (!method.is_null())  log->method(method());
322   if (_osr_bci != CompileBroker::standard_entry_bci) {
323     log->print(" osr_bci='%d'", _osr_bci);
324   }
325   if (_comp_level != CompilationPolicy::highest_compile_level()) {
326     log->print(" level='%d'", _comp_level);
327   }
328   if (_is_blocking) {
329     log->print(" blocking='1'");
330   }

331 }
332 
333 // ------------------------------------------------------------------
334 // CompileTask::log_task_queued
335 void CompileTask::log_task_queued() {
336   ttyLocker ttyl;
337   ResourceMark rm;
338   NoSafepointVerifier nsv;
339 
340   xtty->begin_elem("task_queued");
341   log_task(xtty);
342   assert(_compile_reason > CompileTask::Reason_None && _compile_reason < CompileTask::Reason_Count, "Valid values");
343   xtty->print(" comment='%s'", reason_name(_compile_reason));
344 
345   if (_hot_count != 0) {
346     xtty->print(" hot_count='%d'", _hot_count);
347   }
348   xtty->stamp();
349   xtty->end_elem();
350 }
351 
352 
353 // ------------------------------------------------------------------
354 // CompileTask::log_task_start
355 void CompileTask::log_task_start(CompileLog* log) {
356   log->begin_head("task");
357   log_task(log);
358   log->stamp();
359   log->end_head();
360 }
361 
362 
363 // ------------------------------------------------------------------
364 // CompileTask::log_task_done
365 void CompileTask::log_task_done(CompileLog* log) {
366   Thread* thread = Thread::current();
367   methodHandle method(thread, this->method());
368   ResourceMark rm(thread);
369 
370   if (!_is_success) {
371     assert(_failure_reason != nullptr, "missing");
372     const char* reason = _failure_reason != nullptr ? _failure_reason : "unknown";
373     log->begin_elem("failure reason='");
374     log->text("%s", reason);
375     log->print("'");
376     log->end_elem();
377   }
378 

480   } else if (result == InliningResult::FAILURE) {
481     st->print("   %s", "failed to inline");
482   }
483 }
484 
485 void CompileTask::print_ul(const char* msg){
486   LogTarget(Info, jit, compilation) lt;
487   if (lt.is_enabled()) {
488     LogStream ls(lt);
489     print(&ls, msg, /* short form */ true, /* cr */ true);
490   }
491 }
492 
493 void CompileTask::print_ul(const nmethod* nm, const char* msg) {
494   LogTarget(Info, jit, compilation) lt;
495   if (lt.is_enabled()) {
496     LogStream ls(lt);
497     print_impl(&ls, nm->method(), nm->compile_id(),
498                nm->comp_level(), nm->is_osr_method(),
499                nm->is_osr_method() ? nm->osr_entry_bci() : -1,
500                /*is_blocking*/ false, nm->is_aot(),
501                nm->preloaded(), nm->compiler_name(),
502                msg, /* short form */ true, /* cr */ true);
503   }
504 }
505 
506 void CompileTask::print_inlining_ul(ciMethod* method, int inline_level, int bci, InliningResult result, const char* msg) {
507   LogTarget(Debug, jit, inlining) lt;
508   if (lt.is_enabled()) {
509     LogStream ls(lt);
510     print_inlining_inner(&ls, method, inline_level, bci, result, msg);
511   }
512 }
513 
< prev index next >