65 MutexLocker locker(CompileTaskAlloc_lock);
66 if (!task->is_free()) {
67 task->set_code(NULL);
68 assert(!task->lock()->is_locked(), "Should not be locked when freed");
69 JNIHandles::destroy_global(task->_method_holder);
70 JNIHandles::destroy_global(task->_hot_method_holder);
71
72 task->set_is_free(true);
73 task->set_next(_task_free_list);
74 _task_free_list = task;
75 }
76 }
77
78
79 void CompileTask::initialize(int compile_id,
80 const methodHandle& method,
81 int osr_bci,
82 int comp_level,
83 const methodHandle& hot_method,
84 int hot_count,
85 const char* comment,
86 bool is_blocking) {
87 assert(!_lock->is_locked(), "bad locking");
88
89 _compile_id = compile_id;
90 _method = method();
91 _method_holder = JNIHandles::make_global(method->method_holder()->klass_holder());
92 _osr_bci = osr_bci;
93 _is_blocking = is_blocking;
94 JVMCI_ONLY(_has_waiter = CompileBroker::compiler(comp_level)->is_jvmci();)
95 JVMCI_ONLY(_jvmci_compiler_thread = NULL;)
96 _comp_level = comp_level;
97 _num_inlined_bytecodes = 0;
98
99 _is_complete = false;
100 _is_success = false;
101 _code_handle = NULL;
102
103 _hot_method = NULL;
104 _hot_method_holder = NULL;
105 _hot_count = hot_count;
106 _time_queued = 0; // tidy
107 _comment = comment;
108 _failure_reason = NULL;
109
110 if (LogCompilation) {
111 _time_queued = os::elapsed_counter();
112 if (hot_method.not_null()) {
113 if (hot_method == method) {
114 _hot_method = _method;
115 } else {
116 _hot_method = hot_method();
117 // only add loader or mirror if different from _method_holder
118 _hot_method_holder = JNIHandles::make_global(hot_method->method_holder()->klass_holder());
119 }
120 }
121 }
122
123 _next = NULL;
124 }
125
126 /**
127 * Returns the compiler for this task.
288 }
289 // Always print the level in tiered.
290 if (_comp_level != CompLevel_highest_tier || TieredCompilation) {
291 log->print(" level='%d'", _comp_level);
292 }
293 if (_is_blocking) {
294 log->print(" blocking='1'");
295 }
296 log->stamp();
297 }
298
299 // ------------------------------------------------------------------
300 // CompileTask::log_task_queued
301 void CompileTask::log_task_queued() {
302 Thread* thread = Thread::current();
303 ttyLocker ttyl;
304 ResourceMark rm(thread);
305
306 xtty->begin_elem("task_queued");
307 log_task(xtty);
308 if (_comment != NULL) {
309 xtty->print(" comment='%s'", _comment);
310 }
311 if (_hot_method != NULL) {
312 methodHandle hot(thread, _hot_method);
313 methodHandle method(thread, _method);
314 if (hot() != method()) {
315 xtty->method(hot);
316 }
317 }
318 if (_hot_count != 0) {
319 xtty->print(" hot_count='%d'", _hot_count);
320 }
321 xtty->end_elem();
322 }
323
324
325 // ------------------------------------------------------------------
326 // CompileTask::log_task_dequeued
327 void CompileTask::log_task_dequeued(const char* comment) {
328 if (LogCompilation && xtty != NULL) {
329 Thread* thread = Thread::current();
330 ttyLocker ttyl;
419 if (TieredCompilation) {
420 st->print(" ");
421 }
422 st->print(" "); // more indent
423 st->print(" "); // initial inlining indent
424
425 for (int i = 0; i < inline_level; i++) st->print(" ");
426
427 st->print("@ %d ", bci); // print bci
428 method->print_short_name(st);
429 if (method->is_loaded())
430 st->print(" (%d bytes)", method->code_size());
431 else
432 st->print(" (not loaded)");
433
434 if (msg != NULL) {
435 st->print(" %s", msg);
436 }
437 st->cr();
438 }
|
65 MutexLocker locker(CompileTaskAlloc_lock);
66 if (!task->is_free()) {
67 task->set_code(NULL);
68 assert(!task->lock()->is_locked(), "Should not be locked when freed");
69 JNIHandles::destroy_global(task->_method_holder);
70 JNIHandles::destroy_global(task->_hot_method_holder);
71
72 task->set_is_free(true);
73 task->set_next(_task_free_list);
74 _task_free_list = task;
75 }
76 }
77
78
79 void CompileTask::initialize(int compile_id,
80 const methodHandle& method,
81 int osr_bci,
82 int comp_level,
83 const methodHandle& hot_method,
84 int hot_count,
85 CompileTask::CompileReason compile_reason,
86 bool is_blocking) {
87 assert(!_lock->is_locked(), "bad locking");
88
89 _compile_id = compile_id;
90 _method = method();
91 _method_holder = JNIHandles::make_global(method->method_holder()->klass_holder());
92 _osr_bci = osr_bci;
93 _is_blocking = is_blocking;
94 JVMCI_ONLY(_has_waiter = CompileBroker::compiler(comp_level)->is_jvmci();)
95 JVMCI_ONLY(_jvmci_compiler_thread = NULL;)
96 _comp_level = comp_level;
97 _num_inlined_bytecodes = 0;
98
99 _is_complete = false;
100 _is_success = false;
101 _code_handle = NULL;
102
103 _hot_method = NULL;
104 _hot_method_holder = NULL;
105 _hot_count = hot_count;
106 _time_queued = 0; // tidy
107 _compile_reason = compile_reason;
108 _failure_reason = NULL;
109
110 if (LogCompilation) {
111 _time_queued = os::elapsed_counter();
112 if (hot_method.not_null()) {
113 if (hot_method == method) {
114 _hot_method = _method;
115 } else {
116 _hot_method = hot_method();
117 // only add loader or mirror if different from _method_holder
118 _hot_method_holder = JNIHandles::make_global(hot_method->method_holder()->klass_holder());
119 }
120 }
121 }
122
123 _next = NULL;
124 }
125
126 /**
127 * Returns the compiler for this task.
288 }
289 // Always print the level in tiered.
290 if (_comp_level != CompLevel_highest_tier || TieredCompilation) {
291 log->print(" level='%d'", _comp_level);
292 }
293 if (_is_blocking) {
294 log->print(" blocking='1'");
295 }
296 log->stamp();
297 }
298
299 // ------------------------------------------------------------------
300 // CompileTask::log_task_queued
301 void CompileTask::log_task_queued() {
302 Thread* thread = Thread::current();
303 ttyLocker ttyl;
304 ResourceMark rm(thread);
305
306 xtty->begin_elem("task_queued");
307 log_task(xtty);
308 assert(_compile_reason > CompileTask::Reason_None && _compile_reason < CompileTask::Reason_Count, "Valid values");
309 xtty->print(" comment='%s'", reason_name(_compile_reason));
310
311 if (_hot_method != NULL) {
312 methodHandle hot(thread, _hot_method);
313 methodHandle method(thread, _method);
314 if (hot() != method()) {
315 xtty->method(hot);
316 }
317 }
318 if (_hot_count != 0) {
319 xtty->print(" hot_count='%d'", _hot_count);
320 }
321 xtty->end_elem();
322 }
323
324
325 // ------------------------------------------------------------------
326 // CompileTask::log_task_dequeued
327 void CompileTask::log_task_dequeued(const char* comment) {
328 if (LogCompilation && xtty != NULL) {
329 Thread* thread = Thread::current();
330 ttyLocker ttyl;
419 if (TieredCompilation) {
420 st->print(" ");
421 }
422 st->print(" "); // more indent
423 st->print(" "); // initial inlining indent
424
425 for (int i = 0; i < inline_level; i++) st->print(" ");
426
427 st->print("@ %d ", bci); // print bci
428 method->print_short_name(st);
429 if (method->is_loaded())
430 st->print(" (%d bytes)", method->code_size());
431 else
432 st->print(" (not loaded)");
433
434 if (msg != NULL) {
435 st->print(" %s", msg);
436 }
437 st->cr();
438 }
439
440
|