19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "compiler/compilationPolicy.hpp"
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 CompileTask* CompileTask::_task_free_list = nullptr;
40
41 /**
42 * Allocate a CompileTask, from the free list if possible.
43 */
44 CompileTask* CompileTask::allocate() {
45 MutexLocker locker(CompileTaskAlloc_lock);
46 CompileTask* task = nullptr;
47
48 if (_task_free_list != nullptr) {
49 task = _task_free_list;
50 _task_free_list = task->next();
51 task->set_next(nullptr);
52 } else {
53 task = new CompileTask();
54 task->set_next(nullptr);
55 task->set_is_free(true);
56 }
57 assert(task->is_free(), "Task must be free.");
58 task->set_is_free(false);
59 return task;
60 }
61
62 /**
63 * Add a task to the free list.
64 */
65 void CompileTask::free(CompileTask* task) {
66 MutexLocker locker(CompileTaskAlloc_lock);
67 if (!task->is_free()) {
68 assert(!task->lock()->is_locked(), "Should not be locked when freed");
69 if ((task->_method_holder != nullptr && JNIHandles::is_weak_global_handle(task->_method_holder))) {
70 JNIHandles::destroy_weak_global(task->_method_holder);
71 } else {
72 JNIHandles::destroy_global(task->_method_holder);
73 }
74 if (task->_failure_reason_on_C_heap && task->_failure_reason != nullptr) {
75 os::free((void*) task->_failure_reason);
76 }
77 task->_failure_reason = nullptr;
78 task->_failure_reason_on_C_heap = false;
79
80 task->set_is_free(true);
81 task->set_next(_task_free_list);
82 _task_free_list = task;
83 }
84 }
85
86 void CompileTask::initialize(int compile_id,
87 const methodHandle& method,
88 int osr_bci,
89 int comp_level,
90 int hot_count,
91 CompileTask::CompileReason compile_reason,
92 bool is_blocking) {
93 assert(!_lock->is_locked(), "bad locking");
94
95 Thread* thread = Thread::current();
96 _compile_id = compile_id;
97 _method = method();
98 _method_holder = JNIHandles::make_weak_global(Handle(thread, method->method_holder()->klass_holder()));
99 _osr_bci = osr_bci;
100 _is_blocking = is_blocking;
101 JVMCI_ONLY(_has_waiter = CompileBroker::compiler(comp_level)->is_jvmci();)
102 JVMCI_ONLY(_blocking_jvmci_compile_state = nullptr;)
103 _comp_level = comp_level;
104 _num_inlined_bytecodes = 0;
105
106 _waiting_count = 0;
107
108 _is_complete = false;
109 _is_success = false;
110
111 _hot_count = hot_count;
112 _time_queued = os::elapsed_counter();
113 _time_started = 0;
114 _compile_reason = compile_reason;
115 _nm_content_size = 0;
116 AbstractCompiler* comp = compiler();
117 _directive = DirectivesStack::getMatchingDirective(method, comp);
118 _nm_insts_size = 0;
119 _nm_total_size = 0;
120 _failure_reason = nullptr;
121 _failure_reason_on_C_heap = false;
122 _training_data = nullptr;
123 _arena_bytes = 0;
124
125 _next = nullptr;
126 }
127
128 /**
129 * Returns the compiler for this task.
130 */
131 AbstractCompiler* CompileTask::compiler() const {
132 return CompileBroker::compiler(_comp_level);
133 }
134
135 // Replace weak handles by strong handles to avoid unloading during compilation.
136 CompileTask* CompileTask::select_for_compilation() {
137 if (is_unloaded()) {
138 // Guard against concurrent class unloading
139 return nullptr;
140 }
141 Thread* thread = Thread::current();
142 assert(_method->method_holder()->is_loader_alive(), "should be alive");
143 Handle method_holder(thread, _method->method_holder()->klass_holder());
144 JNIHandles::destroy_weak_global(_method_holder);
145 _method_holder = JNIHandles::make_global(method_holder);
146 return this;
147 }
148
149 void CompileTask::mark_on_stack() {
150 if (is_unloaded()) {
151 return;
152 }
153 // Mark these methods as something redefine classes cannot remove.
154 _method->set_on_stack(true);
155 }
156
157 bool CompileTask::is_unloaded() const {
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:", CompileBroker::compiler_name(comp_level()));
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,
196 const char* msg, bool short_form, bool cr,
197 jlong time_queued, jlong time_started) {
198 if (!short_form) {
199 // Print current time
200 st->print(UINT64_FORMAT " ", (uint64_t) tty->time_stamp().milliseconds());
201 if (Verbose && time_queued != 0) {
202 // Print time in queue and time being processed by compiler thread
203 jlong now = os::elapsed_counter();
204 st->print("%.0f ", TimeHelper::counter_to_millis(now-time_queued));
205 if (time_started != 0) {
206 st->print("%.0f ", TimeHelper::counter_to_millis(now-time_started));
207 }
208 }
209 }
210 // print compiler name if requested
211 if (CIPrintCompilerName) {
212 st->print("%s:", CompileBroker::compiler_name(comp_level));
213 }
214 st->print("%4d ", compile_id); // print compilation number
215
216 bool is_synchronized = false;
217 bool has_exception_handler = false;
218 bool is_native = false;
219 if (method != nullptr) {
220 is_synchronized = method->is_synchronized();
221 has_exception_handler = method->has_exception_handler();
222 is_native = method->is_native();
223 }
224 // method attributes
225 const char compile_type = is_osr_method ? '%' : ' ';
226 const char sync_char = is_synchronized ? 's' : ' ';
227 const char exception_char = has_exception_handler ? '!' : ' ';
228 const char blocking_char = is_blocking ? 'b' : ' ';
229 const char native_char = is_native ? 'n' : ' ';
230
231 // print method attributes
232 st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char);
233
234 if (TieredCompilation) {
235 if (comp_level != -1) st->print("%d ", comp_level);
236 else st->print("- ");
237 }
238 st->print(" "); // more indent
239
240 if (method == nullptr) {
241 st->print("(method)");
242 } else {
243 method->print_short_name(st);
244 if (is_osr_method) {
245 st->print(" @ %d", osr_bci);
246 }
247 if (method->is_native())
248 st->print(" (native)");
249 else
250 st->print(" (%d bytes)", method->code_size());
251 }
252
253 if (msg != nullptr) {
254 st->print(" %s", msg);
255 }
256 if (cr) {
257 st->cr();
258 }
259 }
260
261 // ------------------------------------------------------------------
262 // CompileTask::print_compilation
263 void CompileTask::print(outputStream* st, const char* msg, bool short_form, bool cr) {
264 bool is_osr_method = osr_bci() != InvocationEntryBci;
265 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);
266 }
267
268 // ------------------------------------------------------------------
269 // CompileTask::log_task
270 void CompileTask::log_task(xmlStream* log) {
271 Thread* thread = Thread::current();
272 methodHandle method(thread, this->method());
273 ResourceMark rm(thread);
274
275 // <task id='9' method='M' osr_bci='X' level='1' blocking='1' stamp='1.234'>
276 log->print(" compile_id='%d'", _compile_id);
277 if (_osr_bci != CompileBroker::standard_entry_bci) {
278 log->print(" compile_kind='osr'"); // same as nmethod::compile_kind
279 } // else compile_kind='c2c'
280 if (!method.is_null()) log->method(method());
281 if (_osr_bci != CompileBroker::standard_entry_bci) {
282 log->print(" osr_bci='%d'", _osr_bci);
283 }
284 if (_comp_level != CompilationPolicy::highest_compile_level()) {
285 log->print(" level='%d'", _comp_level);
286 }
287 if (_is_blocking) {
288 log->print(" blocking='1'");
289 }
290 log->stamp();
291 }
292
293 // ------------------------------------------------------------------
294 // CompileTask::log_task_queued
295 void CompileTask::log_task_queued() {
296 ttyLocker ttyl;
297 ResourceMark rm;
298 NoSafepointVerifier nsv;
299
300 xtty->begin_elem("task_queued");
301 log_task(xtty);
302 assert(_compile_reason > CompileTask::Reason_None && _compile_reason < CompileTask::Reason_Count, "Valid values");
303 xtty->print(" comment='%s'", reason_name(_compile_reason));
304
305 if (_hot_count != 0) {
306 xtty->print(" hot_count='%d'", _hot_count);
307 }
308 xtty->end_elem();
309 }
310
311
312 // ------------------------------------------------------------------
313 // CompileTask::log_task_start
314 void CompileTask::log_task_start(CompileLog* log) {
315 log->begin_head("task");
316 log_task(log);
317 log->end_head();
318 }
319
320
321 // ------------------------------------------------------------------
322 // CompileTask::log_task_done
323 void CompileTask::log_task_done(CompileLog* log) {
324 Thread* thread = Thread::current();
325 methodHandle method(thread, this->method());
326 ResourceMark rm(thread);
327
328 if (!_is_success) {
329 assert(_failure_reason != nullptr, "missing");
330 const char* reason = _failure_reason != nullptr ? _failure_reason : "unknown";
331 log->begin_elem("failure reason='");
332 log->text("%s", reason);
333 log->print("'");
334 log->end_elem();
335 }
336
438 } else if (result == InliningResult::FAILURE) {
439 st->print(" %s", "failed to inline");
440 }
441 }
442
443 void CompileTask::print_ul(const char* msg){
444 LogTarget(Info, jit, compilation) lt;
445 if (lt.is_enabled()) {
446 LogStream ls(lt);
447 print(&ls, msg, /* short form */ true, /* cr */ true);
448 }
449 }
450
451 void CompileTask::print_ul(const nmethod* nm, const char* msg) {
452 LogTarget(Info, jit, compilation) lt;
453 if (lt.is_enabled()) {
454 LogStream ls(lt);
455 print_impl(&ls, nm->method(), nm->compile_id(),
456 nm->comp_level(), nm->is_osr_method(),
457 nm->is_osr_method() ? nm->osr_entry_bci() : -1,
458 /*is_blocking*/ false,
459 msg, /* short form */ true, /* cr */ true);
460 }
461 }
462
463 void CompileTask::print_inlining_ul(ciMethod* method, int inline_level, int bci, InliningResult result, const char* msg) {
464 LogTarget(Debug, jit, inlining) lt;
465 if (lt.is_enabled()) {
466 LogStream ls(lt);
467 print_inlining_inner(&ls, method, inline_level, bci, result, msg);
468 }
469 }
470
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "compiler/compilationPolicy.hpp"
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 CompileTask::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 _waiting_count = 0;
62
63 _is_complete = false;
64 _is_success = false;
65
66 _next = nullptr;
67 _prev = nullptr;
68
69 _hot_count = hot_count;
70 _time_created = os::elapsed_counter();
71 _time_queued = 0;
72 _time_started = 0;
73 _time_finished = 0;
74 _aot_load_start = 0;
75 _aot_load_finish = 0;
76 _compile_reason = compile_reason;
77 _nm_content_size = 0;
78 _nm_insts_size = 0;
79 _nm_total_size = 0;
80 _failure_reason = nullptr;
81 _failure_reason_on_C_heap = false;
82 _training_data = nullptr;
83 _aot_code_entry = aot_code_entry;
84 _compile_queue = compile_queue;
85
86 AbstractCompiler* comp = CompileBroker::compiler(comp_level);
87 #if INCLUDE_JVMCI
88 if (comp->is_jvmci() && CompileBroker::compiler3() != nullptr) {
89 assert(_method != nullptr, "sanity");
90 if (((JVMCICompiler*)comp)->force_comp_at_level_simple(method)) {
91 comp = CompileBroker::compiler3();
92 }
93 }
94 #endif
95 _compiler = comp;
96 _directive = DirectivesStack::getMatchingDirective(method, comp);
97
98 JVMCI_ONLY(_has_waiter = comp->is_jvmci();)
99 JVMCI_ONLY(_blocking_jvmci_compile_state = nullptr;)
100 _arena_bytes = 0;
101
102 _next = nullptr;
103
104 Atomic::add(&_active_tasks, 1);
105 }
106
107 CompileTask::~CompileTask() {
108 if ((_method_holder != nullptr && JNIHandles::is_weak_global_handle(_method_holder))) {
109 JNIHandles::destroy_weak_global(_method_holder);
110 } else {
111 JNIHandles::destroy_global(_method_holder);
112 }
113 if (_failure_reason_on_C_heap && _failure_reason != nullptr) {
114 os::free((void*) _failure_reason);
115 _failure_reason = nullptr;
116 _failure_reason_on_C_heap = false;
117 }
118
119 if (Atomic::sub(&_active_tasks, 1) == 0) {
120 MonitorLocker wait_ml(CompileTaskWait_lock);
121 wait_ml.notify_all();
122 }
123 }
124
125 void CompileTask::wait_for_no_active_tasks() {
126 MonitorLocker locker(CompileTaskWait_lock);
127 while (Atomic::load(&_active_tasks) > 0) {
128 locker.wait();
129 }
130 }
131
132 /**
133 * Returns the compiler for this task.
134 */
135 AbstractCompiler* CompileTask::compiler() const {
136 assert(_compiler != nullptr, "should be set");
137 return _compiler;
138 }
139
140 // Replace weak handles by strong handles to avoid unloading during compilation.
141 CompileTask* CompileTask::select_for_compilation() {
142 if (_compile_reason == Reason_Preload) {
143 return this;
144 }
145 if (is_unloaded()) {
146 // Guard against concurrent class unloading
147 return nullptr;
148 }
149 Thread* thread = Thread::current();
150 assert(_method->method_holder()->is_loader_alive(), "should be alive");
151 Handle method_holder(thread, _method->method_holder()->klass_holder());
152 JNIHandles::destroy_weak_global(_method_holder);
153 _method_holder = JNIHandles::make_global(method_holder);
154 return this;
155 }
156
157 void CompileTask::mark_on_stack() {
158 if (is_unloaded()) {
159 return;
160 }
161 // Mark these methods as something redefine classes cannot remove.
162 _method->set_on_stack(true);
163 }
164
165 bool CompileTask::is_unloaded() const {
166 if (preload()) return false;
167 return _method_holder != nullptr && JNIHandles::is_weak_global_handle(_method_holder) && JNIHandles::is_weak_global_cleared(_method_holder);
168 }
169
170 // RedefineClasses support
171 void CompileTask::metadata_do(MetadataClosure* f) {
172 if (is_unloaded()) {
173 return;
174 }
175 f->do_metadata(method());
176 }
177
178 // ------------------------------------------------------------------
179 // CompileTask::print_line_on_error
180 //
181 // This function is called by fatal error handler when the thread
182 // causing troubles is a compiler thread.
183 //
184 // Do not grab any lock, do not allocate memory.
185 //
186 // Otherwise it's the same as CompileTask::print_line()
187 //
188 void CompileTask::print_line_on_error(outputStream* st, char* buf, int buflen) {
189 // print compiler name
190 st->print("%s:", compiler()->name());
191 print(st);
192 }
193
194 // ------------------------------------------------------------------
195 // CompileTask::print_tty
196 void CompileTask::print_tty() {
197 ttyLocker ttyl; // keep the following output all in one block
198 print(tty);
199 }
200
201 // ------------------------------------------------------------------
202 // CompileTask::print_impl
203 void CompileTask::print_impl(outputStream* st, Method* method, int compile_id, int comp_level,
204 bool is_osr_method, int osr_bci, bool is_blocking, bool is_aot, bool is_preload,
205 const char* compiler_name,
206 const char* msg, bool short_form, bool cr,
207 jlong time_created, jlong time_queued, jlong time_started, jlong time_finished,
208 jlong aot_load_start, jlong aot_load_finish) {
209 if (!short_form) {
210 {
211 stringStream ss;
212 ss.print(UINT64_FORMAT, (uint64_t) tty->time_stamp().milliseconds());
213 st->print("%7s ", ss.freeze());
214 }
215 { // Time waiting to be put on queue
216 stringStream ss;
217 if (time_created != 0 && time_queued != 0) {
218 ss.print("W%.1f", TimeHelper::counter_to_millis(time_queued - time_created));
219 }
220 st->print("%7s ", ss.freeze());
221 }
222 { // Time in queue
223 stringStream ss;
224 if (time_queued != 0 && time_started != 0) {
225 ss.print("Q%.1f", TimeHelper::counter_to_millis(time_started - time_queued));
226 }
227 st->print("%7s ", ss.freeze());
228 }
229 { // Time in compilation
230 stringStream ss;
231 if (time_started != 0 && time_finished != 0) {
232 ss.print("C%.1f", TimeHelper::counter_to_millis(time_finished - time_started));
233 }
234 st->print("%7s ", ss.freeze());
235 }
236 { // Time to load from AOT code cache
237 stringStream ss;
238 if (aot_load_start != 0 && aot_load_finish != 0) {
239 ss.print("A%.1f", TimeHelper::counter_to_millis(aot_load_finish - aot_load_start));
240 }
241 st->print("%7s ", ss.freeze());
242 }
243 st->print(" ");
244 }
245
246 // print compiler name if requested
247 if (CIPrintCompilerName) {
248 st->print("%s:", compiler_name);
249 }
250 st->print("%4d ", compile_id); // print compilation number
251
252 bool is_synchronized = false;
253 bool has_exception_handler = false;
254 bool is_native = false;
255 if (method != nullptr) {
256 is_synchronized = method->is_synchronized();
257 has_exception_handler = method->has_exception_handler();
258 is_native = method->is_native();
259 }
260 // method attributes
261 const char compile_type = is_osr_method ? '%' : ' ';
262 const char sync_char = is_synchronized ? 's' : ' ';
263 const char exception_char = has_exception_handler ? '!' : ' ';
264 const char blocking_char = is_blocking ? 'b' : ' ';
265 const char native_char = is_native ? 'n' : ' ';
266 const char aot_char = is_aot ? 'A' : ' ';
267 const char preload_char = is_preload ? 'P' : ' ';
268
269 // print method attributes
270 st->print("%c%c%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char, aot_char, preload_char);
271
272 if (TieredCompilation) {
273 if (comp_level != -1) st->print("%d ", comp_level);
274 else st->print("- ");
275 }
276 st->print(" "); // more indent
277
278 if (method == nullptr) {
279 st->print("(method)");
280 } else {
281 method->print_short_name(st);
282 if (is_osr_method) {
283 st->print(" @ %d", osr_bci);
284 }
285 if (method->is_native())
286 st->print(" (native)");
287 else
288 st->print(" (%d bytes)", method->code_size());
289 }
290
291 if (msg != nullptr) {
292 st->print(" %s", msg);
293 }
294 if (cr) {
295 st->cr();
296 }
297 }
298
299 // ------------------------------------------------------------------
300 // CompileTask::print_compilation
301 void CompileTask::print(outputStream* st, const char* msg, bool short_form, bool cr) {
302 bool is_osr_method = osr_bci() != InvocationEntryBci;
303 print_impl(st, is_unloaded() ? nullptr : method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), is_aot(), preload(),
304 compiler()->name(), msg, short_form, cr, _time_created, _time_queued, _time_started, _time_finished, _aot_load_start, _aot_load_finish);
305 }
306
307 // ------------------------------------------------------------------
308 // CompileTask::log_task
309 void CompileTask::log_task(xmlStream* log) {
310 Thread* thread = Thread::current();
311 methodHandle method(thread, this->method());
312 ResourceMark rm(thread);
313
314 // <task id='9' method='M' osr_bci='X' level='1' blocking='1' stamp='1.234'>
315 log->print(" compile_id='%d'", _compile_id);
316 if (_osr_bci != CompileBroker::standard_entry_bci) {
317 log->print(" compile_kind='osr'"); // same as nmethod::compile_kind
318 } // else compile_kind='c2c'
319 if (!method.is_null()) log->method(method());
320 if (_osr_bci != CompileBroker::standard_entry_bci) {
321 log->print(" osr_bci='%d'", _osr_bci);
322 }
323 if (_comp_level != CompilationPolicy::highest_compile_level()) {
324 log->print(" level='%d'", _comp_level);
325 }
326 if (_is_blocking) {
327 log->print(" blocking='1'");
328 }
329 }
330
331 // ------------------------------------------------------------------
332 // CompileTask::log_task_queued
333 void CompileTask::log_task_queued() {
334 ttyLocker ttyl;
335 ResourceMark rm;
336 NoSafepointVerifier nsv;
337
338 xtty->begin_elem("task_queued");
339 log_task(xtty);
340 assert(_compile_reason > CompileTask::Reason_None && _compile_reason < CompileTask::Reason_Count, "Valid values");
341 xtty->print(" comment='%s'", reason_name(_compile_reason));
342
343 if (_hot_count != 0) {
344 xtty->print(" hot_count='%d'", _hot_count);
345 }
346 xtty->stamp();
347 xtty->end_elem();
348 }
349
350
351 // ------------------------------------------------------------------
352 // CompileTask::log_task_start
353 void CompileTask::log_task_start(CompileLog* log) {
354 log->begin_head("task");
355 log_task(log);
356 log->stamp();
357 log->end_head();
358 }
359
360
361 // ------------------------------------------------------------------
362 // CompileTask::log_task_done
363 void CompileTask::log_task_done(CompileLog* log) {
364 Thread* thread = Thread::current();
365 methodHandle method(thread, this->method());
366 ResourceMark rm(thread);
367
368 if (!_is_success) {
369 assert(_failure_reason != nullptr, "missing");
370 const char* reason = _failure_reason != nullptr ? _failure_reason : "unknown";
371 log->begin_elem("failure reason='");
372 log->text("%s", reason);
373 log->print("'");
374 log->end_elem();
375 }
376
478 } else if (result == InliningResult::FAILURE) {
479 st->print(" %s", "failed to inline");
480 }
481 }
482
483 void CompileTask::print_ul(const char* msg){
484 LogTarget(Info, jit, compilation) lt;
485 if (lt.is_enabled()) {
486 LogStream ls(lt);
487 print(&ls, msg, /* short form */ true, /* cr */ true);
488 }
489 }
490
491 void CompileTask::print_ul(const nmethod* nm, const char* msg) {
492 LogTarget(Info, jit, compilation) lt;
493 if (lt.is_enabled()) {
494 LogStream ls(lt);
495 print_impl(&ls, nm->method(), nm->compile_id(),
496 nm->comp_level(), nm->is_osr_method(),
497 nm->is_osr_method() ? nm->osr_entry_bci() : -1,
498 /*is_blocking*/ false, nm->aot_code_entry() != nullptr,
499 nm->preloaded(), nm->compiler_name(),
500 msg, /* short form */ true, /* cr */ true);
501 }
502 }
503
504 void CompileTask::print_inlining_ul(ciMethod* method, int inline_level, int bci, InliningResult result, const char* msg) {
505 LogTarget(Debug, jit, inlining) lt;
506 if (lt.is_enabled()) {
507 LogStream ls(lt);
508 print_inlining_inner(&ls, method, inline_level, bci, result, msg);
509 }
510 }
511
|