author | thartmann |
Tue, 22 Jan 2019 18:25:56 +0100 | |
changeset 53429 | 1b292ae4eb50 |
parent 49480 | d7df2dd501ce |
child 53417 | 126c5e7b97b1 |
permissions | -rw-r--r-- |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
1 |
/* |
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved. |
32582
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" |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33160
diff
changeset
|
29 |
#include "compiler/compilerDirectives.hpp" |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
30 |
#include "logging/log.hpp" |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
31 |
#include "logging/logStream.hpp" |
37248 | 32 |
#include "memory/resourceArea.hpp" |
49480
d7df2dd501ce
8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents:
47216
diff
changeset
|
33 |
#include "runtime/handles.inline.hpp" |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
34 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
35 |
CompileTask* CompileTask::_task_free_list = NULL; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
36 |
#ifdef ASSERT |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
37 |
int CompileTask::_num_allocated_tasks = 0; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
38 |
#endif |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
39 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
40 |
/** |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
41 |
* Allocate a CompileTask, from the free list if possible. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
42 |
*/ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
43 |
CompileTask* CompileTask::allocate() { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
44 |
MutexLocker locker(CompileTaskAlloc_lock); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
45 |
CompileTask* task = NULL; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
46 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
47 |
if (_task_free_list != NULL) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
48 |
task = _task_free_list; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
49 |
_task_free_list = task->next(); |
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 |
} else { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
52 |
task = new CompileTask(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
53 |
DEBUG_ONLY(_num_allocated_tasks++;) |
34197
bef14f844171
8143151: [JVMCI] assertion for allocation of "too many" CompileTasks must take JVMCI into account
twisti
parents:
34196
diff
changeset
|
54 |
assert (WhiteBoxAPI || JVMCI_ONLY(UseJVMCICompiler ||) _num_allocated_tasks < 10000, "Leaking compilation tasks?"); |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
55 |
task->set_next(NULL); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
56 |
task->set_is_free(true); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
57 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
58 |
assert(task->is_free(), "Task must be free."); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
59 |
task->set_is_free(false); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
60 |
return task; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
61 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
62 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
63 |
/** |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
64 |
* Add a task to the free list. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
65 |
*/ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
66 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
67 |
void CompileTask::free(CompileTask* task) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
68 |
MutexLocker locker(CompileTaskAlloc_lock); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
69 |
if (!task->is_free()) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
70 |
task->set_code(NULL); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
71 |
assert(!task->lock()->is_locked(), "Should not be locked when freed"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
72 |
JNIHandles::destroy_global(task->_method_holder); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
73 |
JNIHandles::destroy_global(task->_hot_method_holder); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
74 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
75 |
task->set_is_free(true); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
76 |
task->set_next(_task_free_list); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
77 |
_task_free_list = task; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
78 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
79 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
80 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
81 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
82 |
void CompileTask::initialize(int compile_id, |
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33160
diff
changeset
|
83 |
const methodHandle& method, |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
84 |
int osr_bci, |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
85 |
int comp_level, |
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33160
diff
changeset
|
86 |
const methodHandle& hot_method, |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
87 |
int hot_count, |
38218 | 88 |
CompileTask::CompileReason compile_reason, |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
89 |
bool is_blocking) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
90 |
assert(!_lock->is_locked(), "bad locking"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
91 |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
92 |
Thread* thread = Thread::current(); |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
93 |
_compile_id = compile_id; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
94 |
_method = method(); |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
95 |
_method_holder = JNIHandles::make_global(Handle(thread, method->method_holder()->klass_holder())); |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
96 |
_osr_bci = osr_bci; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
97 |
_is_blocking = is_blocking; |
34196
72152eea3d39
8141330: [JVMCI] avoid deadlock between application thread and JVMCI compiler thread under -Xbatch
twisti
parents:
33626
diff
changeset
|
98 |
JVMCI_ONLY(_has_waiter = CompileBroker::compiler(comp_level)->is_jvmci();) |
35547
0ee84aa8e705
8146705: Improve JVMCI support for blocking compilation
dnsimon
parents:
34197
diff
changeset
|
99 |
JVMCI_ONLY(_jvmci_compiler_thread = NULL;) |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
100 |
_comp_level = comp_level; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
101 |
_num_inlined_bytecodes = 0; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
102 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
103 |
_is_complete = false; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
104 |
_is_success = false; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
105 |
_code_handle = NULL; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
106 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
107 |
_hot_method = NULL; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
108 |
_hot_method_holder = NULL; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
109 |
_hot_count = hot_count; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
110 |
_time_queued = 0; // tidy |
38218 | 111 |
_compile_reason = compile_reason; |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
112 |
_failure_reason = NULL; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
113 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
114 |
if (LogCompilation) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
115 |
_time_queued = os::elapsed_counter(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
116 |
if (hot_method.not_null()) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
117 |
if (hot_method == method) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
118 |
_hot_method = _method; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
119 |
} else { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
120 |
_hot_method = hot_method(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
121 |
// only add loader or mirror if different from _method_holder |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42650
diff
changeset
|
122 |
_hot_method_holder = JNIHandles::make_global(Handle(thread, hot_method->method_holder()->klass_holder())); |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
123 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
124 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
125 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
126 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
127 |
_next = NULL; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
128 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
129 |
|
37281
c4e7456d6ae1
8144964: JVMCI compilations need to be disabled until the module system is initialized
twisti
parents:
35547
diff
changeset
|
130 |
/** |
c4e7456d6ae1
8144964: JVMCI compilations need to be disabled until the module system is initialized
twisti
parents:
35547
diff
changeset
|
131 |
* Returns the compiler for this task. |
c4e7456d6ae1
8144964: JVMCI compilations need to be disabled until the module system is initialized
twisti
parents:
35547
diff
changeset
|
132 |
*/ |
c4e7456d6ae1
8144964: JVMCI compilations need to be disabled until the module system is initialized
twisti
parents:
35547
diff
changeset
|
133 |
AbstractCompiler* CompileTask::compiler() { |
c4e7456d6ae1
8144964: JVMCI compilations need to be disabled until the module system is initialized
twisti
parents:
35547
diff
changeset
|
134 |
return CompileBroker::compiler(_comp_level); |
c4e7456d6ae1
8144964: JVMCI compilations need to be disabled until the module system is initialized
twisti
parents:
35547
diff
changeset
|
135 |
} |
c4e7456d6ae1
8144964: JVMCI compilations need to be disabled until the module system is initialized
twisti
parents:
35547
diff
changeset
|
136 |
|
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
137 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
138 |
// CompileTask::code/set_code |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
139 |
// |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
140 |
nmethod* CompileTask::code() const { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
141 |
if (_code_handle == NULL) return NULL; |
38133
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
37296
diff
changeset
|
142 |
CodeBlob *blob = _code_handle->code(); |
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
37296
diff
changeset
|
143 |
if (blob != NULL) { |
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
37296
diff
changeset
|
144 |
return blob->as_nmethod(); |
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
37296
diff
changeset
|
145 |
} |
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
37296
diff
changeset
|
146 |
return NULL; |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
147 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
148 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
149 |
void CompileTask::set_code(nmethod* nm) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
150 |
if (_code_handle == NULL && nm == NULL) return; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
151 |
guarantee(_code_handle != NULL, ""); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
152 |
_code_handle->set_code(nm); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
153 |
if (nm == NULL) _code_handle = NULL; // drop the handle also |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
154 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
155 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
156 |
void CompileTask::mark_on_stack() { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
157 |
// Mark these methods as something redefine classes cannot remove. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
158 |
_method->set_on_stack(true); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
159 |
if (_hot_method != NULL) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
160 |
_hot_method->set_on_stack(true); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
161 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
162 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
163 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
164 |
// RedefineClasses support |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
165 |
void CompileTask::metadata_do(void f(Metadata*)) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
166 |
f(method()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
167 |
if (hot_method() != NULL && hot_method() != method()) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
168 |
f(hot_method()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
169 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
170 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
171 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
172 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
173 |
// CompileTask::print_line_on_error |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
174 |
// |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
175 |
// This function is called by fatal error handler when the thread |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
176 |
// causing troubles is a compiler thread. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
177 |
// |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
178 |
// Do not grab any lock, do not allocate memory. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
179 |
// |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
180 |
// Otherwise it's the same as CompileTask::print_line() |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
181 |
// |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
182 |
void CompileTask::print_line_on_error(outputStream* st, char* buf, int buflen) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
183 |
// print compiler name |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
184 |
st->print("%s:", CompileBroker::compiler_name(comp_level())); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
185 |
print(st); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
186 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
187 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
188 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
189 |
// CompileTask::print_tty |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
190 |
void CompileTask::print_tty() { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
191 |
ttyLocker ttyl; // keep the following output all in one block |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
192 |
// print compiler name if requested |
40084 | 193 |
if (CIPrintCompilerName) { |
194 |
tty->print("%s:", CompileBroker::compiler_name(comp_level())); |
|
195 |
} |
|
196 |
print(tty); |
|
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
197 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
198 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
199 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
200 |
// CompileTask::print_impl |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
201 |
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
|
202 |
bool is_osr_method, int osr_bci, bool is_blocking, |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
203 |
const char* msg, bool short_form, bool cr) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
204 |
if (!short_form) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
205 |
st->print("%7d ", (int) st->time_stamp().milliseconds()); // print timestamp |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
206 |
} |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
207 |
// print compiler name if requested |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
208 |
if (CIPrintCompilerName) { |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
209 |
st->print("%s:", CompileBroker::compiler_name(comp_level)); |
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32582
diff
changeset
|
210 |
} |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
211 |
st->print("%4d ", compile_id); // print compilation number |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
212 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
213 |
// For unloaded methods the transition to zombie occurs after the |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
214 |
// method is cleared so it's impossible to report accurate |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
215 |
// information for that case. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
216 |
bool is_synchronized = false; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
217 |
bool has_exception_handler = false; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
218 |
bool is_native = false; |
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 |
is_synchronized = method->is_synchronized(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
221 |
has_exception_handler = method->has_exception_handler(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
222 |
is_native = method->is_native(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
223 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
224 |
// method attributes |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
225 |
const char compile_type = is_osr_method ? '%' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
226 |
const char sync_char = is_synchronized ? 's' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
227 |
const char exception_char = has_exception_handler ? '!' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
228 |
const char blocking_char = is_blocking ? 'b' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
229 |
const char native_char = is_native ? 'n' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
230 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
231 |
// print method attributes |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
232 |
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
|
233 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
234 |
if (TieredCompilation) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
235 |
if (comp_level != -1) st->print("%d ", comp_level); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
236 |
else st->print("- "); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
237 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
238 |
st->print(" "); // more indent |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
239 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
240 |
if (method == NULL) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
241 |
st->print("(method)"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
242 |
} else { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
243 |
method->print_short_name(st); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
244 |
if (is_osr_method) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
245 |
st->print(" @ %d", osr_bci); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
246 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
247 |
if (method->is_native()) |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
248 |
st->print(" (native)"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
249 |
else |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
250 |
st->print(" (%d bytes)", method->code_size()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
251 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
252 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
253 |
if (msg != NULL) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
254 |
st->print(" %s", msg); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
255 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
256 |
if (cr) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
257 |
st->cr(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
258 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
259 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
260 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
261 |
void CompileTask::print_inline_indent(int inline_level, outputStream* st) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
262 |
// 1234567 |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
263 |
st->print(" "); // print timestamp |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
264 |
// 1234 |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
265 |
st->print(" "); // print compilation number |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
266 |
// %s!bn |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
267 |
st->print(" "); // print method attributes |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
268 |
if (TieredCompilation) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
269 |
st->print(" "); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
270 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
271 |
st->print(" "); // more indent |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
272 |
st->print(" "); // initial inlining indent |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
273 |
for (int i = 0; i < inline_level; i++) st->print(" "); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
274 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
275 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
276 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
277 |
// CompileTask::print_compilation |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
278 |
void CompileTask::print(outputStream* st, const char* msg, bool short_form, bool cr) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
279 |
bool is_osr_method = osr_bci() != InvocationEntryBci; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
280 |
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
|
281 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
282 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
283 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
284 |
// CompileTask::log_task |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
285 |
void CompileTask::log_task(xmlStream* log) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
286 |
Thread* thread = Thread::current(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
287 |
methodHandle method(thread, this->method()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
288 |
ResourceMark rm(thread); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
289 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
290 |
// <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
|
291 |
log->print(" compile_id='%d'", _compile_id); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
292 |
if (_osr_bci != CompileBroker::standard_entry_bci) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
293 |
log->print(" compile_kind='osr'"); // same as nmethod::compile_kind |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
294 |
} // else compile_kind='c2c' |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
295 |
if (!method.is_null()) log->method(method); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
296 |
if (_osr_bci != CompileBroker::standard_entry_bci) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
297 |
log->print(" osr_bci='%d'", _osr_bci); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
298 |
} |
42650 | 299 |
if (_comp_level != CompLevel_highest_tier) { |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
300 |
log->print(" level='%d'", _comp_level); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
301 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
302 |
if (_is_blocking) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
303 |
log->print(" blocking='1'"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
304 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
305 |
log->stamp(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
306 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
307 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
308 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
309 |
// CompileTask::log_task_queued |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
310 |
void CompileTask::log_task_queued() { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
311 |
Thread* thread = Thread::current(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
312 |
ttyLocker ttyl; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
313 |
ResourceMark rm(thread); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
314 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
315 |
xtty->begin_elem("task_queued"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
316 |
log_task(xtty); |
38218 | 317 |
assert(_compile_reason > CompileTask::Reason_None && _compile_reason < CompileTask::Reason_Count, "Valid values"); |
318 |
xtty->print(" comment='%s'", reason_name(_compile_reason)); |
|
319 |
||
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
320 |
if (_hot_method != NULL) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
321 |
methodHandle hot(thread, _hot_method); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
322 |
methodHandle method(thread, _method); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
323 |
if (hot() != method()) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
324 |
xtty->method(hot); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
325 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
326 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
327 |
if (_hot_count != 0) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
328 |
xtty->print(" hot_count='%d'", _hot_count); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
329 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
330 |
xtty->end_elem(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
331 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
332 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
333 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
334 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
335 |
// CompileTask::log_task_start |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
336 |
void CompileTask::log_task_start(CompileLog* log) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
337 |
log->begin_head("task"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
338 |
log_task(log); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
339 |
log->end_head(); |
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 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
343 |
// ------------------------------------------------------------------ |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
344 |
// CompileTask::log_task_done |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
345 |
void CompileTask::log_task_done(CompileLog* log) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
346 |
Thread* thread = Thread::current(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
347 |
methodHandle method(thread, this->method()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
348 |
ResourceMark rm(thread); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
349 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
350 |
if (!_is_success) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
351 |
const char* reason = _failure_reason != NULL ? _failure_reason : "unknown"; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
352 |
log->elem("failure reason='%s'", reason); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
353 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
354 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
355 |
// <task_done ... stamp='1.234'> </task> |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
356 |
nmethod* nm = code(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
357 |
log->begin_elem("task_done success='%d' nmsize='%d' count='%d'", |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
358 |
_is_success, nm == NULL ? 0 : nm->content_size(), |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
359 |
method->invocation_count()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
360 |
int bec = method->backedge_count(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
361 |
if (bec != 0) log->print(" backedge_count='%d'", bec); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
362 |
// Note: "_is_complete" is about to be set, but is not. |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
363 |
if (_num_inlined_bytecodes != 0) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
364 |
log->print(" inlined_bytes='%d'", _num_inlined_bytecodes); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
365 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
366 |
log->stamp(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
367 |
log->end_elem(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
368 |
log->clear_identities(); // next task will have different CI |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
369 |
log->tail("task"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
370 |
if (log->unflushed_count() > 2000) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
371 |
log->flush(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
372 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
373 |
log->mark_file_end(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
374 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
375 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
376 |
// ------------------------------------------------------------------ |
33451
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33160
diff
changeset
|
377 |
// CompileTask::check_break_at_flags |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33160
diff
changeset
|
378 |
bool CompileTask::check_break_at_flags() { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33160
diff
changeset
|
379 |
int compile_id = this->_compile_id; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33160
diff
changeset
|
380 |
bool is_osr = (_osr_bci != CompileBroker::standard_entry_bci); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33160
diff
changeset
|
381 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33160
diff
changeset
|
382 |
if (CICountOSR && is_osr && (compile_id == CIBreakAtOSR)) { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33160
diff
changeset
|
383 |
return true; |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33160
diff
changeset
|
384 |
} else { |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33160
diff
changeset
|
385 |
return (compile_id == CIBreakAt); |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33160
diff
changeset
|
386 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33160
diff
changeset
|
387 |
} |
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33160
diff
changeset
|
388 |
|
0712796e4039
8137167: JEP165: Compiler Control: Implementation task
neliasso
parents:
33160
diff
changeset
|
389 |
// ------------------------------------------------------------------ |
32582
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
390 |
// CompileTask::print_inlining |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
391 |
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
|
392 |
// 1234567 |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
393 |
st->print(" "); // print timestamp |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
394 |
// 1234 |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
395 |
st->print(" "); // print compilation number |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
396 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
397 |
// method attributes |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
398 |
if (method->is_loaded()) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
399 |
const char sync_char = method->is_synchronized() ? 's' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
400 |
const char exception_char = method->has_exception_handlers() ? '!' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
401 |
const char monitors_char = method->has_monitor_bytecodes() ? 'm' : ' '; |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
402 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
403 |
// print method attributes |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
404 |
st->print(" %c%c%c ", sync_char, exception_char, monitors_char); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
405 |
} else { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
406 |
// %s!bn |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
407 |
st->print(" "); // print method attributes |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
408 |
} |
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 (TieredCompilation) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
411 |
st->print(" "); |
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->print(" "); // more indent |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
414 |
st->print(" "); // initial inlining indent |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
415 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
416 |
for (int i = 0; i < inline_level; i++) st->print(" "); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
417 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
418 |
st->print("@ %d ", bci); // print bci |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
419 |
method->print_short_name(st); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
420 |
if (method->is_loaded()) |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
421 |
st->print(" (%d bytes)", method->code_size()); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
422 |
else |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
423 |
st->print(" (not loaded)"); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
424 |
|
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
425 |
if (msg != NULL) { |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
426 |
st->print(" %s", msg); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
427 |
} |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
428 |
st->cr(); |
56619bb8bcaa
8135067: Preparatory refactorings for compiler control
neliasso
parents:
diff
changeset
|
429 |
} |
38218 | 430 |
|
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
431 |
void CompileTask::print_ul(const char* msg){ |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
432 |
LogTarget(Debug, jit, compilation) lt; |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
433 |
if (lt.is_enabled()) { |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
434 |
LogStream ls(lt); |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
435 |
print(&ls, msg, /* short form */ true, /* cr */ true); |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
436 |
} |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
437 |
} |
38218 | 438 |
|
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
439 |
void CompileTask::print_ul(const nmethod* nm, const char* msg) { |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
440 |
LogTarget(Debug, jit, compilation) lt; |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
441 |
if (lt.is_enabled()) { |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
442 |
LogStream ls(lt); |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
443 |
print_impl(&ls, nm->method(), nm->compile_id(), |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
444 |
nm->comp_level(), nm->is_osr_method(), |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
445 |
nm->is_osr_method() ? nm->osr_entry_bci() : -1, |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
446 |
/*is_blocking*/ false, |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
447 |
msg, /* short form */ true, /* cr */ true); |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
448 |
} |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
449 |
} |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
450 |
|
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
451 |
void CompileTask::print_inlining_ul(ciMethod* method, int inline_level, int bci, const char* msg) { |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
452 |
LogTarget(Debug, jit, inlining) lt; |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
453 |
if (lt.is_enabled()) { |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
454 |
LogStream ls(lt); |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
455 |
print_inlining_inner(&ls, method, inline_level, bci, msg); |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
456 |
} |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
457 |
} |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46271
diff
changeset
|
458 |