< 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   AtomicAccess::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 (AtomicAccess::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 (AtomicAccess::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   AtomicAccess::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 (AtomicAccess::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 (AtomicAccess::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   // Use stringStream to avoid breaking the line
201   stringStream sst;
202   if (!short_form) {
203     {
204       stringStream ss;
205       ss.print(UINT64_FORMAT, (uint64_t) tty->time_stamp().milliseconds());
206       sst.print("%7s ", ss.freeze());
207     }
208     { // Time waiting to be put on queue
209       stringStream ss;
210       if (time_created != 0 && time_queued != 0) {
211         ss.print("W%.1f", TimeHelper::counter_to_millis(time_queued - time_created));
212       }
213       sst.print("%7s ", ss.freeze());
214     }
215     { // Time in queue
216       stringStream ss;
217       if (time_queued != 0 && time_started != 0) {
218         ss.print("Q%.1f", TimeHelper::counter_to_millis(time_started - time_queued));
219       }
220       sst.print("%7s ", ss.freeze());
221     }
222     { // Time in compilation
223       stringStream ss;
224       if (time_started != 0 && time_finished != 0) {
225         ss.print("C%.1f", TimeHelper::counter_to_millis(time_finished - time_started));
226       }
227       sst.print("%7s ", ss.freeze());
228     }
229     { // Time to load from AOT code cache
230       stringStream ss;
231       if (aot_load_start != 0 && aot_load_finish != 0) {
232         ss.print("A%.1f", TimeHelper::counter_to_millis(aot_load_finish - aot_load_start));
233       }
234       sst.print("%7s ", ss.freeze());
235     }
236     sst.print("  ");
237   }
238 
239   // print compiler name if requested
240   if (CIPrintCompilerName) {
241     sst.print("%s:", compiler_name);
242   }
243   sst.print("%4d ", compile_id);    // print compilation number
244 
245   bool is_synchronized = false;
246   bool has_exception_handler = false;
247   bool is_native = false;
248   if (method != nullptr) {
249     is_synchronized       = method->is_synchronized();
250     has_exception_handler = method->has_exception_handler();
251     is_native             = method->is_native();
252   }
253   // method attributes
254   const char compile_type   = is_osr_method                   ? '%' : ' ';
255   const char sync_char      = is_synchronized                 ? 's' : ' ';
256   const char exception_char = has_exception_handler           ? '!' : ' ';
257   const char blocking_char  = is_blocking                     ? 'b' : ' ';
258   const char native_char    = is_native                       ? 'n' : ' ';
259   const char aot_char       = is_aot                          ? 'A' : ' ';
260   const char preload_char   = is_preload                      ? 'P' : ' ';
261 
262   // print method attributes
263   sst.print("%c%c%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char, aot_char, preload_char);
264 
265   if (TieredCompilation) {
266     if (comp_level != -1)  sst.print("%d ", comp_level);
267     else                   sst.print("- ");
268   }
269   sst.print("     ");  // more indent
270 
271   if (method == nullptr) {
272     sst.print("(method)");
273   } else {
274     method->print_short_name(&sst);
275     if (is_osr_method) {
276       sst.print(" @ %d", osr_bci);
277     }
278     if (method->is_native())
279       sst.print(" (native)");
280     else
281       sst.print(" (%d bytes)", method->code_size());
282   }
283 
284   if (msg != nullptr) {
285     sst.print("   %s", msg);
286   }
287   if (cr) {
288     sst.cr();
289   }
290   st->print("%s",sst.freeze());
291 }
292 
293 // ------------------------------------------------------------------
294 // CompileTask::print_compilation
295 void CompileTask::print(outputStream* st, const char* msg, bool short_form, bool cr) {
296   bool is_osr_method = osr_bci() != InvocationEntryBci;
297   bool is_aot = is_aot_load();
298   bool is_preload = preload();
299   if (is_precompile()) {
300     // Tag aot compilation too
301     is_preload = (compile_reason() == Reason_PrecompileForPreload);
302     is_aot = !is_preload;
303   }
304   print_impl(st, is_unloaded() ? nullptr : method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), is_aot, is_preload,
305              compiler()->name(), msg, short_form, cr, _time_created, _time_queued, _time_started, _time_finished, _aot_load_start, _aot_load_finish);
306 }
307 
308 // ------------------------------------------------------------------
309 // CompileTask::log_task
310 void CompileTask::log_task(xmlStream* log) {
311   Thread* thread = Thread::current();
312   methodHandle method(thread, this->method());
313   ResourceMark rm(thread);
314 
315   // <task id='9' method='M' osr_bci='X' level='1' blocking='1' stamp='1.234'>
316   log->print(" compile_id='%d'", _compile_id);
317   if (_osr_bci != CompileBroker::standard_entry_bci) {
318     log->print(" compile_kind='osr'");  // same as nmethod::compile_kind
319   } else if (preload()) {
320     log->print(" compile_kind='AP'");
321   } else if (is_aot_load()) {
322     log->print(" compile_kind='A'");
323   } // else compile_kind='c2c'
324   if (!method.is_null())  log->method(method());
325   if (_osr_bci != CompileBroker::standard_entry_bci) {
326     log->print(" osr_bci='%d'", _osr_bci);
327   }
328   if (_comp_level != CompilationPolicy::highest_compile_level()) {
329     log->print(" level='%d'", _comp_level);
330   }
331   if (_is_blocking) {
332     log->print(" blocking='1'");
333   }

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

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