author | twisti |
Thu, 08 Oct 2015 12:49:30 -1000 | |
changeset 33160 | c59f1676d27e |
parent 32582 | 56619bb8bcaa |
child 33451 | 0712796e4039 |
child 33593 | 60764a78fa5c |
permissions | -rw-r--r-- |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
1 |
/* |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
2 |
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
4 |
* |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
8 |
* |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
13 |
* accompanied this code). |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
14 |
* |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
18 |
* |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
21 |
* questions. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
22 |
* |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
23 |
*/ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
24 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
25 |
#include "precompiled.hpp" |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
26 |
#include "compiler/compileTask.hpp" |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
27 |
#include "compiler/compileLog.hpp" |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
28 |
#include "compiler/compileBroker.hpp" |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
29 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
30 |
CompileTask* CompileTask::_task_free_list = NULL; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
31 |
#ifdef ASSERT |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
32 |
int CompileTask::_num_allocated_tasks = 0; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
33 |
#endif |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
34 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
35 |
/** |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
36 |
* Allocate a CompileTask, from the free list if possible. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
37 |
*/ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
38 |
CompileTask* CompileTask::allocate() { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
39 |
MutexLocker locker(CompileTaskAlloc_lock); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
40 |
CompileTask* task = NULL; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
41 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
42 |
if (_task_free_list != NULL) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
43 |
task = _task_free_list; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
44 |
_task_free_list = task->next(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
45 |
task->set_next(NULL); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
46 |
} else { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
47 |
task = new CompileTask(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
48 |
DEBUG_ONLY(_num_allocated_tasks++;) |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
49 |
assert (WhiteBoxAPI || _num_allocated_tasks < 10000, "Leaking compilation tasks?"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
50 |
task->set_next(NULL); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
51 |
task->set_is_free(true); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
52 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
53 |
assert(task->is_free(), "Task must be free."); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
54 |
task->set_is_free(false); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
55 |
return task; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
56 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
57 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
58 |
/** |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
59 |
* Add a task to the free list. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
60 |
*/ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
61 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
62 |
void CompileTask::free(CompileTask* task) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
63 |
MutexLocker locker(CompileTaskAlloc_lock); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
64 |
if (!task->is_free()) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
65 |
task->set_code(NULL); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
66 |
assert(!task->lock()->is_locked(), "Should not be locked when freed"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
67 |
JNIHandles::destroy_global(task->_method_holder); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
68 |
JNIHandles::destroy_global(task->_hot_method_holder); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
69 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
70 |
task->set_is_free(true); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
71 |
task->set_next(_task_free_list); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
72 |
_task_free_list = task; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
73 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
74 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
75 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
76 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
77 |
void CompileTask::initialize(int compile_id, |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
78 |
methodHandle method, |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
79 |
int osr_bci, |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
80 |
int comp_level, |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
81 |
methodHandle hot_method, |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
82 |
int hot_count, |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
83 |
const char* comment, |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
84 |
bool is_blocking) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
85 |
assert(!_lock->is_locked(), "bad locking"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
86 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
87 |
_compile_id = compile_id; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
88 |
_method = method(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
89 |
_method_holder = JNIHandles::make_global(method->method_holder()->klass_holder()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
90 |
_osr_bci = osr_bci; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
91 |
_is_blocking = is_blocking; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
92 |
_comp_level = comp_level; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
93 |
_num_inlined_bytecodes = 0; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
94 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
95 |
_is_complete = false; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
96 |
_is_success = false; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
97 |
_code_handle = NULL; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
98 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
99 |
_hot_method = NULL; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
100 |
_hot_method_holder = NULL; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
101 |
_hot_count = hot_count; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
102 |
_time_queued = 0; // tidy |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
103 |
_comment = comment; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
104 |
_failure_reason = NULL; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
105 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
106 |
if (LogCompilation) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
107 |
_time_queued = os::elapsed_counter(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
108 |
if (hot_method.not_null()) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
109 |
if (hot_method == method) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
110 |
_hot_method = _method; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
111 |
} else { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
112 |
_hot_method = hot_method(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
113 |
// only add loader or mirror if different from _method_holder |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
114 |
_hot_method_holder = JNIHandles::make_global(hot_method->method_holder()->klass_holder()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
115 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
116 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
117 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
118 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
119 |
_next = NULL; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
120 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
121 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
122 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
123 |
// CompileTask::code/set_code |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
124 |
// |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
125 |
nmethod* CompileTask::code() const { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
126 |
if (_code_handle == NULL) return NULL; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
127 |
return _code_handle->code(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
128 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
129 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
130 |
void CompileTask::set_code(nmethod* nm) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
131 |
if (_code_handle == NULL && nm == NULL) return; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
132 |
guarantee(_code_handle != NULL, ""); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
133 |
_code_handle->set_code(nm); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
134 |
if (nm == NULL) _code_handle = NULL; // drop the handle also |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
135 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
136 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
137 |
void CompileTask::mark_on_stack() { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
138 |
// Mark these methods as something redefine classes cannot remove. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
139 |
_method->set_on_stack(true); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
140 |
if (_hot_method != NULL) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
141 |
_hot_method->set_on_stack(true); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
142 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
143 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
144 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
145 |
// RedefineClasses support |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
146 |
void CompileTask::metadata_do(void f(Metadata*)) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
147 |
f(method()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
148 |
if (hot_method() != NULL && hot_method() != method()) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
149 |
f(hot_method()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
150 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
151 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
152 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
153 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
154 |
// CompileTask::print_line_on_error |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
155 |
// |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
156 |
// This function is called by fatal error handler when the thread |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
157 |
// causing troubles is a compiler thread. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
158 |
// |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
159 |
// Do not grab any lock, do not allocate memory. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
160 |
// |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
161 |
// Otherwise it's the same as CompileTask::print_line() |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
162 |
// |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
163 |
void CompileTask::print_line_on_error(outputStream* st, char* buf, int buflen) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
164 |
// print compiler name |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
165 |
st->print("%s:", CompileBroker::compiler_name(comp_level())); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
166 |
print(st); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
167 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
168 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
169 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
170 |
// CompileTask::print_tty |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
171 |
void CompileTask::print_tty() { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
172 |
ttyLocker ttyl; // keep the following output all in one block |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
173 |
// print compiler name if requested |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
174 |
if (CIPrintCompilerName) tty->print("%s:", CompileBroker::compiler_name(comp_level())); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
175 |
print(tty); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
176 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
177 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
178 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
179 |
// CompileTask::print_impl |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
180 |
void CompileTask::print_impl(outputStream* st, Method* method, int compile_id, int comp_level, |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
181 |
bool is_osr_method, int osr_bci, bool is_blocking, |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
182 |
const char* msg, bool short_form, bool cr) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
183 |
if (!short_form) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
184 |
st->print("%7d ", (int) st->time_stamp().milliseconds()); // print timestamp |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
185 |
} |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
186 |
// print compiler name if requested |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
187 |
if (CIPrintCompilerName) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
188 |
st->print("%s:", CompileBroker::compiler_name(comp_level)); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
189 |
} |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
190 |
st->print("%4d ", compile_id); // print compilation number |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
191 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
192 |
// For unloaded methods the transition to zombie occurs after the |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
193 |
// method is cleared so it's impossible to report accurate |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
194 |
// information for that case. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
195 |
bool is_synchronized = false; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
196 |
bool has_exception_handler = false; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
197 |
bool is_native = false; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
198 |
if (method != NULL) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
199 |
is_synchronized = method->is_synchronized(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
200 |
has_exception_handler = method->has_exception_handler(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
201 |
is_native = method->is_native(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
202 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
203 |
// method attributes |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
204 |
const char compile_type = is_osr_method ? '%' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
205 |
const char sync_char = is_synchronized ? 's' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
206 |
const char exception_char = has_exception_handler ? '!' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
207 |
const char blocking_char = is_blocking ? 'b' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
208 |
const char native_char = is_native ? 'n' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
209 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
210 |
// print method attributes |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
211 |
st->print("%c%c%c%c%c ", compile_type, sync_char, exception_char, blocking_char, native_char); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
212 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
213 |
if (TieredCompilation) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
214 |
if (comp_level != -1) st->print("%d ", comp_level); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
215 |
else st->print("- "); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
216 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
217 |
st->print(" "); // more indent |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
218 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
219 |
if (method == NULL) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
220 |
st->print("(method)"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
221 |
} else { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
222 |
method->print_short_name(st); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
223 |
if (is_osr_method) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
224 |
st->print(" @ %d", osr_bci); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
225 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
226 |
if (method->is_native()) |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
227 |
st->print(" (native)"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
228 |
else |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
229 |
st->print(" (%d bytes)", method->code_size()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
230 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
231 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
232 |
if (msg != NULL) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
233 |
st->print(" %s", msg); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
234 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
235 |
if (cr) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
236 |
st->cr(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
237 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
238 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
239 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
240 |
void CompileTask::print_inline_indent(int inline_level, outputStream* st) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
241 |
// 1234567 |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
242 |
st->print(" "); // print timestamp |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
243 |
// 1234 |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
244 |
st->print(" "); // print compilation number |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
245 |
// %s!bn |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
246 |
st->print(" "); // print method attributes |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
247 |
if (TieredCompilation) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
248 |
st->print(" "); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
249 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
250 |
st->print(" "); // more indent |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
251 |
st->print(" "); // initial inlining indent |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
252 |
for (int i = 0; i < inline_level; i++) st->print(" "); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
253 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
254 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
255 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
256 |
// CompileTask::print_compilation |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
257 |
void CompileTask::print(outputStream* st, const char* msg, bool short_form, bool cr) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
258 |
bool is_osr_method = osr_bci() != InvocationEntryBci; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
259 |
print_impl(st, method(), compile_id(), comp_level(), is_osr_method, osr_bci(), is_blocking(), msg, short_form, cr); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
260 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
261 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
262 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
263 |
// CompileTask::log_task |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
264 |
void CompileTask::log_task(xmlStream* log) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
265 |
Thread* thread = Thread::current(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
266 |
methodHandle method(thread, this->method()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
267 |
ResourceMark rm(thread); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
268 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
269 |
// <task id='9' method='M' osr_bci='X' level='1' blocking='1' stamp='1.234'> |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
270 |
log->print(" compile_id='%d'", _compile_id); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
271 |
if (_osr_bci != CompileBroker::standard_entry_bci) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
272 |
log->print(" compile_kind='osr'"); // same as nmethod::compile_kind |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
273 |
} // else compile_kind='c2c' |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
274 |
if (!method.is_null()) log->method(method); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
275 |
if (_osr_bci != CompileBroker::standard_entry_bci) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
276 |
log->print(" osr_bci='%d'", _osr_bci); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
277 |
} |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
278 |
// Always print the level in tiered. |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
279 |
if (_comp_level != CompLevel_highest_tier || TieredCompilation) { |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
280 |
log->print(" level='%d'", _comp_level); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
281 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
282 |
if (_is_blocking) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
283 |
log->print(" blocking='1'"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
284 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
285 |
log->stamp(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
286 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
287 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
288 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
289 |
// CompileTask::log_task_queued |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
290 |
void CompileTask::log_task_queued() { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
291 |
Thread* thread = Thread::current(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
292 |
ttyLocker ttyl; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
293 |
ResourceMark rm(thread); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
294 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
295 |
xtty->begin_elem("task_queued"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
296 |
log_task(xtty); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
297 |
if (_comment != NULL) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
298 |
xtty->print(" comment='%s'", _comment); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
299 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
300 |
if (_hot_method != NULL) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
301 |
methodHandle hot(thread, _hot_method); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
302 |
methodHandle method(thread, _method); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
303 |
if (hot() != method()) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
304 |
xtty->method(hot); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
305 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
306 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
307 |
if (_hot_count != 0) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
308 |
xtty->print(" hot_count='%d'", _hot_count); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
309 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
310 |
xtty->end_elem(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
311 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
312 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
313 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
314 |
// ------------------------------------------------------------------ |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
315 |
// CompileTask::log_task_dequeued |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
316 |
void CompileTask::log_task_dequeued(const char* comment) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
317 |
if (LogCompilation && xtty != NULL) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
318 |
Thread* thread = Thread::current(); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
319 |
ttyLocker ttyl; |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
320 |
ResourceMark rm(thread); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
321 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
322 |
xtty->begin_elem("task_dequeued"); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
323 |
log_task(xtty); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
324 |
if (comment != NULL) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
325 |
xtty->print(" comment='%s'", comment); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
326 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
327 |
xtty->end_elem(); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
328 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
329 |
} |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
330 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
331 |
|
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
332 |
// ------------------------------------------------------------------ |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
333 |
// CompileTask::log_task_start |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
334 |
void CompileTask::log_task_start(CompileLog* log) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
335 |
log->begin_head("task"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
336 |
log_task(log); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
337 |
log->end_head(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
338 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
339 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
340 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
341 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
342 |
// CompileTask::log_task_done |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
343 |
void CompileTask::log_task_done(CompileLog* log) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
344 |
Thread* thread = Thread::current(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
345 |
methodHandle method(thread, this->method()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
346 |
ResourceMark rm(thread); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
347 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
348 |
if (!_is_success) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
349 |
const char* reason = _failure_reason != NULL ? _failure_reason : "unknown"; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
350 |
log->elem("failure reason='%s'", reason); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
351 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
352 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
353 |
// <task_done ... stamp='1.234'> </task> |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
354 |
nmethod* nm = code(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
355 |
log->begin_elem("task_done success='%d' nmsize='%d' count='%d'", |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
356 |
_is_success, nm == NULL ? 0 : nm->content_size(), |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
357 |
method->invocation_count()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
358 |
int bec = method->backedge_count(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
359 |
if (bec != 0) log->print(" backedge_count='%d'", bec); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
360 |
// Note: "_is_complete" is about to be set, but is not. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
361 |
if (_num_inlined_bytecodes != 0) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
362 |
log->print(" inlined_bytes='%d'", _num_inlined_bytecodes); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
363 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
364 |
log->stamp(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
365 |
log->end_elem(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
366 |
log->clear_identities(); // next task will have different CI |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
367 |
log->tail("task"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
368 |
if (log->unflushed_count() > 2000) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
369 |
log->flush(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
370 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
371 |
log->mark_file_end(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
372 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
373 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
374 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
375 |
// CompileTask::print_inlining |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
376 |
void CompileTask::print_inlining_inner(outputStream* st, ciMethod* method, int inline_level, int bci, const char* msg) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
377 |
// 1234567 |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
378 |
st->print(" "); // print timestamp |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
379 |
// 1234 |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
380 |
st->print(" "); // print compilation number |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
381 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
382 |
// method attributes |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
383 |
if (method->is_loaded()) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
384 |
const char sync_char = method->is_synchronized() ? 's' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
385 |
const char exception_char = method->has_exception_handlers() ? '!' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
386 |
const char monitors_char = method->has_monitor_bytecodes() ? 'm' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
387 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
388 |
// print method attributes |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
389 |
st->print(" %c%c%c ", sync_char, exception_char, monitors_char); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
390 |
} else { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
391 |
// %s!bn |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
392 |
st->print(" "); // print method attributes |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
393 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
394 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
395 |
if (TieredCompilation) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
396 |
st->print(" "); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
397 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
398 |
st->print(" "); // more indent |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
399 |
st->print(" "); // initial inlining indent |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
400 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
401 |
for (int i = 0; i < inline_level; i++) st->print(" "); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
402 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
403 |
st->print("@ %d ", bci); // print bci |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
404 |
method->print_short_name(st); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
405 |
if (method->is_loaded()) |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
406 |
st->print(" (%d bytes)", method->code_size()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
407 |
else |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
408 |
st->print(" (not loaded)"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
409 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
410 |
if (msg != NULL) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
411 |
st->print(" %s", msg); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
412 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
413 |
st->cr(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
414 |
} |